public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* find_pc_partial_function may produce the wrong answer
@ 2005-07-20 14:28 Paul Koning
  2005-07-20 14:33 ` Daniel Jacobowitz
  0 siblings, 1 reply; 7+ messages in thread
From: Paul Koning @ 2005-07-20 14:28 UTC (permalink / raw)
  To: gdb

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...

I noticed the disassemble command calls the same function, so I
checked why it seemed to be ok.  The difference is that it passes a
pointer to the end_address argument, and that forces the psymtab to be
read which has the right answer.

Well, that's not the whole workaround either.  "disassemble" works
correctly if you just open the shared library ("file
usr/lib/libc.so").  But it too does the wrong thing -- starts
disassembling at the previous non-static function start -- when the
function is in a shared library that's mapped when you open the
corefile, via the "set solib-absolute-prefix" machinery.

Help?

	paul

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-07-20 17:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-20 14:28 find_pc_partial_function may produce the wrong answer Paul Koning
2005-07-20 14:33 ` Daniel Jacobowitz
2005-07-20 15:38   ` Paul Koning
2005-07-20 16:17     ` H. J. Lu
2005-07-20 16:24       ` Paul Koning
2005-07-20 17:09   ` Paul Koning
2005-07-20 17:13     ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).