public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix gdb.dwarf2/dwz.exp for thumb mode
@ 2014-09-03  1:23 Yao Qi
  2014-09-03 17:51 ` Doug Evans
  2014-09-14  9:35 ` Yao Qi
  0 siblings, 2 replies; 14+ messages in thread
From: Yao Qi @ 2014-09-03  1:23 UTC (permalink / raw)
  To: gdb-patches

Hi,
We see the fail in gdb.dwarf2/dwz.exp in thumb mode,

p the_int^M
$2 = 99^M
(gdb) FAIL: gdb.dwarf2/dwz.exp: p the_int

In thumb mode, the lsb of references to 'main' in the assembly
(produced by dwarf assember) is set, so the generated debug
information is incorrect.

This patch copies the approach from

  [PATCH 4/4] Fix gdb.trace/entry-values.exp for thumb mode
  https://sourceware.org/ml/gdb-patches/2014-07/msg00041.html

introduce new label 'main_start' which is the correct
function address (without lsb set).  This patch fixes these
fails we've seen.

Regression tested on arm-none-eabi and x86_64-linux.

gdb/testsuite:

2014-09-03  Yao Qi  <yao@codesourcery.com>

	* gdb.dwarf2/dwz.exp: Use main_start instead of main.
	* gdb.dwarf2/main.c: Define label 'main_start' at the beginning
	function 'main'.
---
 gdb/testsuite/gdb.dwarf2/dwz.exp | 4 ++--
 gdb/testsuite/gdb.dwarf2/main.c  | 4 ++++
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/gdb/testsuite/gdb.dwarf2/dwz.exp b/gdb/testsuite/gdb.dwarf2/dwz.exp
index 9175f9e..ef19631 100644
--- a/gdb/testsuite/gdb.dwarf2/dwz.exp
+++ b/gdb/testsuite/gdb.dwarf2/dwz.exp
@@ -79,8 +79,8 @@ Dwarf::assemble $asm_file {
 	partial_label: partial_unit {} {
 	    subprogram {
 		{name main}
-		{low_pc main addr}
-		{high_pc "main + $main_length" addr}
+		{low_pc main_start addr}
+		{high_pc "main_start + $main_length" addr}
 	    }
 	}
     }
diff --git a/gdb/testsuite/gdb.dwarf2/main.c b/gdb/testsuite/gdb.dwarf2/main.c
index 3ddd194..5a4cbc3 100644
--- a/gdb/testsuite/gdb.dwarf2/main.c
+++ b/gdb/testsuite/gdb.dwarf2/main.c
@@ -17,6 +17,10 @@
 
 /* Dummy main function.  */
 
+asm (".section	\".text\"");
+asm (".balign 8");
+asm ("main_start: .globl main_start");
+
 int
 main()
 {
-- 
1.9.3

^ permalink raw reply	[flat|nested] 14+ messages in thread
* Re: [PATCH] Fix gdb.dwarf2/dwz.exp for thumb mode
@ 2014-09-14 11:31 Andreas Schwab
  2014-09-14 14:37 ` Yao Qi
  0 siblings, 1 reply; 14+ messages in thread
From: Andreas Schwab @ 2014-09-14 11:31 UTC (permalink / raw)
  To: Yao Qi; +Cc: gdb-patches

Yao Qi <yao@codesourcery.com> writes:

> @@ -59,9 +60,17 @@ gdb_test_multiple $test $test {
>      }
>  }
>  
> -if { $main_length == "" } {
> +set main_label_offset ""
> +set test "p main_label"
> +gdb_test_multiple $test $test {
> +    -re ".* = {.*} $hex <main\\+($decimal)>.*\r\n$gdb_prompt $" {
> +	set main_label_offset $expect_out(1,string)
> +    }
> +}

This will also fail to match if assembler labels are prefixed.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2014-10-08 15:21 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-03  1:23 [PATCH] Fix gdb.dwarf2/dwz.exp for thumb mode Yao Qi
2014-09-03 17:51 ` Doug Evans
2014-09-05 11:08   ` Yao Qi
2014-09-14  9:35 ` Yao Qi
2014-09-15 12:29   ` Yao Qi
2014-09-22 13:52     ` Yao Qi
2014-09-30 14:04       ` Yao Qi
2014-10-07 14:03         ` Yao Qi
2014-10-08 15:21     ` Doug Evans
2014-09-14 11:31 Andreas Schwab
2014-09-14 14:37 ` Yao Qi
2014-09-14 15:24   ` Andreas Schwab
2014-09-15  2:09     ` Yao Qi
2014-09-15  8:57       ` Andreas Schwab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).