This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFC] Unexpected automatic language switch - get_frame_language()
- From: Michael Snyder <msnyder at redhat dot com>
- To: Joel Brobecker <brobecker at gnat dot com>
- Cc: gdb-patches at sources dot redhat dot com
- Date: Fri, 05 Dec 2003 15:57:20 -0800
- Subject: Re: [RFC] Unexpected automatic language switch - get_frame_language()
- Organization: Red Hat, Inc.
- References: <20031205224807.GE716@gnat.com>
Joel Brobecker wrote:
So we determine the language by looking up the symtab associated to
the given frame pc. Unfortunately, we were not very lucky in our case
because the call instruction was the last instruction of the function.
And because get_frame_pc actually gives a return address (except for
the bottom frame), the pc return is actually pointing to a different
function. And this is where we're not lucky for the second time, because
the next function is in a different unit written in a different
language!
Sounds kinda like a debugging-optimized-code problem. Your function
is tail-return optimized -- doesn't really return. That's outside
the expected API.
I think you have to do "special" things for non-returning functions.
I've seen the same sort of thing for eg. _exit.
[...]
So I think the correct way of doing this is to use a decremented PC
for any frame but the bottom one.
I think that's fixing the wrong problem. And it's not really portable.
[...]
> PS: I couldn't reduce the testcase more, the test is too sensitive
> to code generation and placement...
That's generally a good sign of an optimization problem.