This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH][gdb] Fix gdb.dwarf2/amd64-entry-value-param.exp with -fPIE/-pie
- From: Pedro Alves <palves at redhat dot com>
- To: Tom de Vries <tdevries at suse dot de>, Tom Tromey <tom at tromey dot com>
- Cc: gdb-patches at sourceware dot org, Jan Kratochvil <jan dot kratochvil at redhat dot com>
- Date: Fri, 16 Aug 2019 19:33:02 +0100
- Subject: Re: [PATCH][gdb] Fix gdb.dwarf2/amd64-entry-value-param.exp with -fPIE/-pie
- References: <20190809075424.GA15972@delia> <87h86q4324.fsf@tromey.com> <c488f464-21c0-8947-c68e-bc4e025720d0@suse.de>
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