RFD: Unwind_Backtrace for ARM EABI

Daniel Jacobowitz dan@debian.org
Tue Aug 14 15:28:00 GMT 2007


On Tue, Aug 14, 2007 at 03:31:58PM +0100, Andrew Haley wrote:
> This is one of the last pieces in the jigsaw for gcj on ARM.
> 
> Unwind_Backtrace is not defined in the ARM exception handling spec at
> http://www.arm.com/pdfs/ehabi.pdf, but it can be implemented by
> performing Phase 1 of a forced unwind, calling the trace function as
> we go.  This works for gcj, which uses backtraces quite heavily, and
> as far as I can see it'd work everywhere else too.

That's clever, I think it will work.  The only problem I see is that
libstdc++'s personality routine will call terminate if it gets
lost.

> +  /* Set demand-save flags.  */
> +  saved_vrs.demand_save_flags = ~(_uw) 0;

You probably need a call to restore_non_core_regs at the end, or
you'll corrupt the caller's VFP / WMMXT state.

> +      /* Call the pr to decide what to do.  */
> +      code = ((personality_routine) UCB_PR_ADDR (ucbp))
> +	(_US_VIRTUAL_UNWIND_FRAME | _US_FORCE_UNWIND, 
> +	 ucbp, (void *) &saved_vrs);
> +    }
> +  while (code != _URC_END_OF_STACK);

This will keep going if the personality routine returns _URC_FAILURE.
Do you need anything besides _URC_CONTINUE_UNWIND?  The personality
routine in libsupc++ for ARM will return _URC_HANDLER_FOUND even
during forced unwinding but that seems like a bug now that you've
given a meaning to _US_VIRTUAL_UNWIND_FRAME | _US_FORCE_UNWIND.

-- 
Daniel Jacobowitz
CodeSourcery



More information about the Java mailing list