This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] Unexpected automatic language switch - get_frame_language()


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.




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]