This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


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

Exception hanlding under g++ questions


Hi,

Under PPC Linux I have a g++ routine that properly saves the return address (lr register) in the previous stack frame (as shown by disassembly).

However when a routine called by this one throws an exception, the stack walkback only gets as far as this routine and then is terminated because the next pc to look for is out in the weeds someplace (as shown by gdb with breakpoints in throw_helper).

Looking in libgcc2.c I notice the following in throw_helper:

pc = get_return_addr(udata, sub_udata) - 1;

I tried to track down exactly where this is implemented to no avail (something about BUILT_IN_EXTRACT_RETURN_ADDR)

Why would this return a value out in the weeds instead of just the value of the correctly saved return address (lr valued stored in the offset of 4 in the previous frame).

What I am seeing is gdb easily able to do a backtrace through this function but the throw_helper
never gets past this routine and then terminates with a funny pc pointing to who knows where.

What additional info is the stack walk back using that gdb does not?

Ideas on how to debug this would be greatly appreciated.  

Or any pointers on what to read to understand more about what is happening here.

please cc any replies to:

khendricks@ivey.uwo.ca

Thanks,

Kevin

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