Re: [patch] Fix oddity in personality routine

Jack Howarth <[email protected]>
Newsgroups gmane.comp.gcc.java.devel
Message-ID <[email protected]>
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.
> 
Andrew,
    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? Also, would it help if I
recompiled libgcj with -O0 as well?
                        Jack

> 
> Andrew.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.