public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH, testsuite] Fix gdb.cp/nsalias.exp issues
@ 2014-06-18  8:48 Luis Machado
  2014-06-18 11:37 ` Luis Machado
  0 siblings, 1 reply; 3+ messages in thread
From: Luis Machado @ 2014-06-18  8:48 UTC (permalink / raw)
  To: 'gdb-patches@sourceware.org'

[-- Attachment #1: Type: text/plain, Size: 1057 bytes --]

Hi,

I've been chasing failures on gdb.cp/nsalias.exp for MIPS, but the 
strange thing is that the failures only reproduced with a GDB built 
without optimization.

Upon further investigation, i noticed the testcase was generating 
DW_AT_high_pc and DW_AT_low_pc entries with type DW_FORM_string, which 
is wrong.

GDB was using that information to load data as strings, and then 
proceeded to use the string pointers as addresses.

Even then, the test was passing just fine, because we were lucky enough 
to have the low_pc string pointer smaller than the high_pc string pointer.

The following patch fixes two issues. The first one is the 
DW_FORM_string type. The second one is adjusting the addresses so that 
they are non-zero, since GDB doesn't like seeing 0 in these fields due 
to a check contained in dwarf2_get_pc_bounds:

   if (low == 0 && !dwarf2_per_objfile->has_section_at_zero)
     return 0;

With both fixes, the testcase passes deterministically, and the failures 
i saw for the MIPS case were bad luck with the pointer comparisons.

OK?

[-- Attachment #2: nsalias.diff --]
[-- Type: text/x-patch, Size: 882 bytes --]

2014-06-18  Luis Machado  <lgustavo@codesourcery.com>

	* gdb.cp/nsalias.exp: Set type of low_pc and high_pc entries
	to DW_FORM_addr and use non-zero addresses.

diff --git a/gdb/testsuite/gdb.cp/nsalias.exp b/gdb/testsuite/gdb.cp/nsalias.exp
index f99b609..1179c1c 100644
--- a/gdb/testsuite/gdb.cp/nsalias.exp
+++ b/gdb/testsuite/gdb.cp/nsalias.exp
@@ -153,20 +153,20 @@ Dwarf::assemble $asm_file {
 
 	    subprogram {
 		{specification :$im_foo_label}
-		{low_pc 0x0}
-		{high_pc 0x1}
+		{low_pc 0x1 DW_FORM_addr }
+		{high_pc 0x2 DW_FORM_addr }
 	    }
 
 	    subprogram {
 		{specification :$i_foo_label}
-		{low_pc 0x2}
-		{high_pc 0x3}
+		{low_pc 0x3 DW_FORM_addr }
+		{high_pc 0x4 DW_FORM_addr }
 	    }
 
 	    subprogram {
 		{specification :$o_foo_label}
-		{low_pc 0x4}
-		{high_pc 0x5}
+		{low_pc 0x5 DW_FORM_addr }
+		{high_pc 0x6 DW_FORM_addr }
 	    }
 	}
     }

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

* Re: [PATCH, testsuite] Fix gdb.cp/nsalias.exp issues
  2014-06-18  8:48 [PATCH, testsuite] Fix gdb.cp/nsalias.exp issues Luis Machado
@ 2014-06-18 11:37 ` Luis Machado
  2014-06-18 14:31   ` Tom Tromey
  0 siblings, 1 reply; 3+ messages in thread
From: Luis Machado @ 2014-06-18 11:37 UTC (permalink / raw)
  To: 'gdb-patches@sourceware.org'

[-- Attachment #1: Type: text/plain, Size: 1218 bytes --]

On 06/18/2014 09:48 AM, Luis Machado wrote:
> Hi,
>
> I've been chasing failures on gdb.cp/nsalias.exp for MIPS, but the
> strange thing is that the failures only reproduced with a GDB built
> without optimization.
>
> Upon further investigation, i noticed the testcase was generating
> DW_AT_high_pc and DW_AT_low_pc entries with type DW_FORM_string, which
> is wrong.
>
> GDB was using that information to load data as strings, and then
> proceeded to use the string pointers as addresses.
>
> Even then, the test was passing just fine, because we were lucky enough
> to have the low_pc string pointer smaller than the high_pc string pointer.
>
> The following patch fixes two issues. The first one is the
> DW_FORM_string type. The second one is adjusting the addresses so that
> they are non-zero, since GDB doesn't like seeing 0 in these fields due
> to a check contained in dwarf2_get_pc_bounds:
>
>    if (low == 0 && !dwarf2_per_objfile->has_section_at_zero)
>      return 0;
>
> With both fixes, the testcase passes deterministically, and the failures
> i saw for the MIPS case were bad luck with the pointer comparisons.
>
> OK?

Updated patch without the spurious whitespaces before the closing brackets.



[-- Attachment #2: nsalias.diff --]
[-- Type: text/x-patch, Size: 876 bytes --]

2014-06-18  Luis Machado  <lgustavo@codesourcery.com>

	* gdb.cp/nsalias.exp: Set type of low_pc and high_pc entries
	to DW_FORM_addr and use non-zero addresses.

diff --git a/gdb/testsuite/gdb.cp/nsalias.exp b/gdb/testsuite/gdb.cp/nsalias.exp
index f99b609..1179c1c 100644
--- a/gdb/testsuite/gdb.cp/nsalias.exp
+++ b/gdb/testsuite/gdb.cp/nsalias.exp
@@ -153,20 +153,20 @@ Dwarf::assemble $asm_file {
 
 	    subprogram {
 		{specification :$im_foo_label}
-		{low_pc 0x0}
-		{high_pc 0x1}
+		{low_pc 0x1 DW_FORM_addr}
+		{high_pc 0x2 DW_FORM_addr}
 	    }
 
 	    subprogram {
 		{specification :$i_foo_label}
-		{low_pc 0x2}
-		{high_pc 0x3}
+		{low_pc 0x3 DW_FORM_addr}
+		{high_pc 0x4 DW_FORM_addr}
 	    }
 
 	    subprogram {
 		{specification :$o_foo_label}
-		{low_pc 0x4}
-		{high_pc 0x5}
+		{low_pc 0x5 DW_FORM_addr}
+		{high_pc 0x6 DW_FORM_addr}
 	    }
 	}
     }

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

* Re: [PATCH, testsuite] Fix gdb.cp/nsalias.exp issues
  2014-06-18 11:37 ` Luis Machado
@ 2014-06-18 14:31   ` Tom Tromey
  0 siblings, 0 replies; 3+ messages in thread
From: Tom Tromey @ 2014-06-18 14:31 UTC (permalink / raw)
  To: lgustavo; +Cc: 'gdb-patches@sourceware.org'

>>>>> "Luis" == Luis Machado <lgustavo@codesourcery.com> writes:

Luis> 2014-06-18  Luis Machado  <lgustavo@codesourcery.com>

Luis> 	* gdb.cp/nsalias.exp: Set type of low_pc and high_pc entries
Luis> 	to DW_FORM_addr and use non-zero addresses.

Ok.

Tom

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

end of thread, other threads:[~2014-06-18 14:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-18  8:48 [PATCH, testsuite] Fix gdb.cp/nsalias.exp issues Luis Machado
2014-06-18 11:37 ` Luis Machado
2014-06-18 14:31   ` Tom Tromey

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).