GCJ on arm-linux

David Daney ddaney@avtrex.com
Wed Aug 9 19:55:00 GMT 2006


Tom Tromey wrote:
>>>Signal handlers are simpler than they used to be, for sure.  We'd need
>>>MD_FALLBACK_FRAME_STATE_FOR.
> 
> 
> Casey> This I was aware of (and the replies confirmed it). What does this do? I
> Casey> understand what FFI needs to do, but this is really opaque.
> 
> There are some docs for this macro in gcc/doc/tm.texi.  Essentially it
> is what lets us throw an exception from a signal handler.  Special
> support is needed for the unwinder to be able to unwind through a
> signal frame; this macro tells GCC how to do that.
> 

For DWARF exceptions, there are tables in the .eh_frame section (not 
sure if arm-linux uses DWARF) that describe the stack frame for each 
exception throw point.

When a SIGSEGV for example is converted to a NullPointerException, we 
are not in a stack frame that is known to the DWARF unwinder.  When the 
unwinder finds a frame it knows nothing about it invokes 
MD_FALLBACK_FRAME_STATE_FOR to see if it knows what to do.  Most 
implementations of MD_FALLBACK_FRAME_STATE_FOR for linux examine the 
stack at the location of interest to see if a linux signal trampoline is 
present.  If so it signals that the frame is recognized and points the 
unwinder at the saved (by the kernel) contents of the registers so that 
the unwinder can proceed back into the frames that have valid .eh_frame 
data.

In order to write a MD_FALLBACK_FRAME_STATE_FOR, you will have to have 
documentation on the ABI in use as well as examine the arm specific 
linux kernel signal handling code.  Studying the DWARF[23] 
specifications as well as the code in gcc/unwind-dw2-fde-glibc.c will 
undoubtedly be of use.  If you look at the MIPS version you will see 
that the macro simply invokes a function to do all the work.  I would 
recommend doing the same, as debugging a gigantic macro is difficult. 
It is also a good idea to be comfortable examining raw hex dumps of 
(stack) memory.  There are some test cases for this (gcc.dg/cleanup-9.c) 
that you should test with also.

I know next to nothing about arm-linux, but *did* write the 
MD_FALLBACK_FRAME_STATE_FOR for mips[el]-linux, so I might be able to 
help with general questions.

David Daney



More information about the Java mailing list