_Unwind_FindEnclosingFunction vs darwin

Jack Howarth howarth@bromo.med.uc.edu
Fri Dec 18 20:41:00 GMT 2009


On Fri, Dec 18, 2009 at 03:01:08PM +0000, Andrew Haley wrote:
> 
> _Unwind_Find_FDE is a standard function.  Does Darwin support that?
> 

Andrew,
    I believe we do have _Unwind_Find_FDE on darwin10 but it
is only functional if compact unwind information isn't used.
This is currently the case in gcc trunk since I disabled
the darwin10 linker's default of using compact unwind info
to avoid issues with the new epilog unwind info on the
darwin10 linker.
     Shouldn't we be able to add something like...

 void *
 darwin10_Unwind_FindEnclosingFunction (void *pc)
 {
   struct dwarf_eh_bases bases;
   const struct dwarf_fde *fde = _Unwind_Find_FDE (pc-1, &bases);
   if (fde)
     return bases.func;
   else
     return NULL;
 }

and use...

#undefine _Unwind_FindEnclosingFunction(PC) 
#define _Unwind_FindEnclosingFunction(PC) darwin10_Unwind_FindEnclosingFunction(PC)

to avoid the system _Unwind_FindEnclosingFunction() on darwin10?
I assume that darwin10_Unwind_FindEnclosingFunction code would have to go into
libjava/darwin.cc. However, I am unclear where to place...

#undefine _Unwind_FindEnclosingFunction(PC) 
#define _Unwind_FindEnclosingFunction(PC) darwin10_Unwind_FindEnclosingFunction(PC)

The most logical place would be in gcc/config/darwin10.h but I am uncertain if
this would be parsed for when libjava compiles libjava/gnu/classpath/natVMStackWalker.cc
so that the call to _Unwind_FindEnclosingFunction() is redirected to
darwin10_Unwind_FindEnclosingFunction(). Any advice would be welcome.
             Jack



More information about the Java mailing list