This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: find_pc_partial_function may produce the wrong answer
>>>>> "Daniel" == Daniel Jacobowitz <drow@false.org> writes:
Daniel> On Wed, Jul 20, 2005 at 10:28:14AM -0400, Paul Koning wrote:
>> I was tracking down a problem in my (modified) gdb, which showed
>> up when doing callstack tracing by reading the prologue.
>> (mips-tdep can do that, and in my version it does it most of the
>> time.)
>>
>> The problem is that find_pc_partial_function is used to find the
>> start of the function, and it was producing the wrong answer.
>> Specifically, it produces the wrong answer when the function is in
>> a shared library.
>>
>> The cause of the problem is that find_pc_partial_function looks up
>> the symbol in the msymtab, and that contains only external
>> symbols, not static symbols. The comments in the source code
>> explicitly claim that it DOES contain static symbols, but "maint
>> print msymtab" clearly shows that it doesn't. At least not for
>> MIPS shared libraries...
Daniel> Is the shared library stripped? I am absolutely positive
Daniel> that the minimal symbol table will include the static symtab
Daniel> - as long as there is one.
Daniel> If for some reason in your modified GDB this is not the case,
Daniel> figure out why not.
It isn't related to the modified gdb; the stock gdb from CVS sources
does the same.
It looks instead like there is something bizarre going on in the
compile. I looked in the build directory and found that the offending
file (malloc.o) has no static syms in its symbol table according to
readelf. But when I repeat the compile by hand I get a rather
different looking symbol table that does have them. Need to track
this down.
Thanks.
paul