[PATCH][gdb] Fix gdb.dwarf2/amd64-entry-value-param.exp with -fPIE/-pie

Pedro Alves palves@redhat.com
Fri Aug 16 18:33:00 GMT 2019


On 8/12/19 2:10 PM, Tom de Vries wrote:
>> Tom> +	CORE_ADDR baseaddr
>> Tom> +	  = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
>>
>> I guess this assumes the text section - but then can the call to
>> find_pc_section give anything else?  Maybe it's just something to
>> comment and move on.
>>
> I suppose that find_pc_section also can return .init or .fini., but I
> imagine these wil have the same sections offsets as .text.
> 

Hmm.  That'll usually be the case on GNU/Linux and other standard
operating systems, where you have a single text segment containing all sections.
But they might well not have the same offsets if you're debugging a relocatable
object, for example.  Some targets' shared libraries are relocatable objects
instead of fully linked binaries.  See "Library List Format" in the manual:

 ~~~
 For the common case of libraries that are fully linked binaries, the
 library should have a list of segments.  If the target supports
 dynamic linking of a relocatable object file, its library XML element
 should instead include a list of allocated sections.  The segment or
 section bases are start addresses, not relocation offsets; they do not
 depend on the library's link-time base addresses.
 ~~~

Linux kernel modules would be something like that too, I think.

If easy, it seems better to look up the section.

Thanks,
Pedro Alves



More information about the Gdb-patches mailing list