The testcase was generating DW_AT_high_pc and DW_AT_low_pc entries
authorLuis Machado <lgustavo@codesourcery.com>
Thu, 19 Jun 2014 06:07:48 +0000 (07:07 +0100)
committerLuis Machado <lgustavo@codesourcery.com>
Thu, 19 Jun 2014 06:07:48 +0000 (07:07 +0100)
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.

Two issues are fixed.  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.

2014-06-19  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.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.cp/nsalias.exp

index 9a6aa77e2165b6634d664a7ea0e8ad1782286345..2fdcbb46010f6be2787189baf7fecbac758732b7 100644 (file)
@@ -1,3 +1,8 @@
+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.
+
 2014-06-18  Siva Chandra Reddy  <sivachandra@google.com>
 
        PR gdb/17017
index f99b609bc0857b3220dff8271933dd8ba7cf7c43..d46c302af4a9be0e08f259020651312f9831207b 100644 (file)
@@ -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}
            }
        }
     }
This page took 0.029403 seconds and 4 git commands to generate.