[patch] Fix oddity in personality routine

Andrew Haley aph@redhat.com
Tue Nov 17 16:22:00 GMT 2009


Jack Howarth wrote:
> On Tue, Nov 17, 2009 at 02:54:53PM +0000, Andrew Haley wrote:
>> Jack Howarth wrote:
>>
>>>   In the unwinder walk, are there any particular places where I could
>>> get additional debug information in gdb that would be helpful to diagnose this
>>> issue?
>> Sure.  The trace you provided is very incomplete, and in particular
>> I can't see any stepping into _Unwind_RaiseException.
>>
>> The main loop looks like this:
>>
>>   while (1)
>>     {
>>       _Unwind_FrameState fs;
>>
>>       /* Set up fs to describe the FDE for the caller of cur_context.  The
>> 	 first time through the loop, that means __cxa_throw.  */
>>       code = uw_frame_state_for (&cur_context, &fs);
>>
>>       if (code == _URC_END_OF_STACK)
>> 	/* Hit end of stack with no handler found.  */
>> 	return _URC_END_OF_STACK;
>>
>>       if (code != _URC_NO_REASON)
>> 	/* Some error encountered.  Usually the unwinder doesn't
>> 	   diagnose these and merely crashes.  */
>> 	return _URC_FATAL_PHASE1_ERROR;
>>
>>       /* Unwind successful.  Run the personality routine, if any.  */
>>       if (fs.personality)
>> 	{
>> 	  code = (*fs.personality) (1, _UA_SEARCH_PHASE, exc->exception_class,
>> 				    exc, &cur_context);
>> 	  if (code == _URC_HANDLER_FOUND)
>> 	    break;
>> 	  else if (code != _URC_CONTINUE_UNWIND)
>> 	    return _URC_FATAL_PHASE1_ERROR;
>> 	}
>>
>>       /* Update cur_context to describe the same frame as fs.  */
>>       uw_update_context (&cur_context, &fs);
>>     }
>>
>> So, for each stack frame, we read the unwinder data and then call the
>> appropriate personality routine (in this case, in libgcj.)
>>
>> cur_context.ra is the program counter for the current stack frame.
>> So,
>>
>> (gdb) x cur_context.ra
>> 0x7ffff659ca7f <_ZN4java3net14URLClassLoader9findClassEJPNS_4lang5ClassEPNS2_6StringE+255>:	0x41c58949
>>
>> tells you which frame is being inspected.  So, you can see where the
>> exception handler should be, and you can step into the personality
>> routine to see why it's not recognized.

>     At which points should I be sampling with 'x cur_context.ra'? Is there a particular
> breakpoint that would be useful to set in order to do this?

Before and sfter uw_frame_state_for.  Then step into the personality routine.

> Also, would it help if I
> recompiled libgcj with -O0 as well?

Probably.

Andrew.



More information about the Java mailing list