[PATCH][gdb] Fix gdb.dwarf2/varval.exp with -fPIE/-pie

Tom de Vries tdevries@suse.de
Fri Aug 9 04:50:00 GMT 2019


On 08-08-19 20:04, Kevin Buettner wrote:
> On Thu, 08 Aug 2019 11:16:44 -0600
> Tom Tromey <tom@tromey.com> wrote:
> 
>>>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:  
>>
>> Thanks for the patch.
>>
>> Tom> +      CORE_ADDR baseaddr
>> Tom> +	= ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
>> Tom> +      struct gdbarch *gdbarch = get_objfile_arch (objfile);  
>>  
>> Tom>        for (const auto &cand_off
>> Tom>  	     : dwarf2_per_objfile->abstract_to_concrete[die->sect_off])
>> Tom> @@ -23220,6 +23223,8 @@ dwarf2_fetch_die_loc_sect_off (sect_offset sect_off,  
>>  
>> Tom>  	  CORE_ADDR pc_low, pc_high;
>> Tom>  	  get_scope_pc_bounds (cand->parent, &pc_low, &pc_high, cu);
>> Tom> +	  pc_low = gdbarch_adjust_dwarf2_addr (gdbarch, pc_low + baseaddr);
>> Tom> +	  pc_high = gdbarch_adjust_dwarf2_addr (gdbarch, pc_high + baseaddr);
>> Tom>  	  if (pc_low == ((CORE_ADDR) -1)  
>>
>> I think this test has to precede the offsetting.

Ouch, thanks for catching that.

> 
> Yes, I agree.
> 
> It appears to me that the test / continue in its entirety...
> 
> 	  if (pc_low == ((CORE_ADDR) -1)
> 	      || !(pc_low <= pc && pc < pc_high))
> 	    continue;
> 
> ...will need to be split with the -1 part being performed before the
> pc_low/pc_high adjustment and the other part being performed after.

Done.

Committed as attached.

Thanks,
- Tom


-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-gdb-Fix-gdb.dwarf2-varval.exp-with-fPIE-pie.patch
Type: text/x-patch
Size: 1839 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20190809/dd85a62b/attachment.bin>


More information about the Gdb-patches mailing list