This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: Improving GDB's mechanism to check if function is GC'ed
- From: Pedro Alves <palves at redhat dot com>
- To: Yao Qi <qiyaoltc at gmail dot com>, Taimoor <tmirza at codesourcery dot com>
- Cc: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Thu, 11 Jun 2015 09:54:40 +0100
- Subject: Re: Improving GDB's mechanism to check if function is GC'ed
- Authentication-results: sourceware.org; auth=none
- References: <556DB1BB dot 50601 at codesourcery dot com> <86eglkeyfw dot fsf at gmail dot com> <55780EB4 dot 1070003 at redhat dot com> <5578285D dot 2030808 at gmail dot com> <55784D18 dot 2000003 at redhat dot com> <5579472A dot 6020200 at gmail dot com>
On 06/11/2015 09:30 AM, Yao Qi wrote:
>> >
>> > IIUC, this triggers on use of add-symbol-file with relocatable
>> > objects, when there's real code at address 0. I think that's the angle
>> > we should look at things.
>> >
> Yes, that is the problem. GDB thinks the function is GC'ed by linker
> but in fact it isn't.
The key point here is _relocatable_ objects. These are special in
that they aren't fully linked, so they have relocations in the debug info,
and their sections on file start at address zero. See default_symfile_offsets.
I still don't understand how lowpc doesn't end up as 0 in the case
at hand, meaning there's really code at 0.
Or does lowpc really end up as 0, but the real issue is that "lowpc==0"
is ambiguous, and we need to track a separate "have pc range" flag?
Taimoor, I'd expect you're passing a "0" to add-symbol-file, like:
(gdb) add-symbol-file ... -s .some_section 0 ...
I think it'd help to see an example invocation of the command.
I'd think it possible to expand gdb.base/relocate.exp (or create
a new test based on it) to cover this scenario everywhere.
Thanks,
Pedro Alves