Stack traces, etc.

Andrew Haley
Tue Dec 3 07:58:00 GMT 2002

Tom Tromey writes:
 > >>>>> "Andrew" == Andrew Haley <> writes:
 > Andrew> Revised, VMThrowable reinstated, testing now.  Checkin
 > Andrew> tomorrow unless anyone complains.
 > No complaint here.
 > Andrew> + #ifdef INTERPRETER
 > Andrew> +       extern void _Jv_StartOfInterpreter (void);
 > Andrew> +       extern void _Jv_EndOfInterpreter (void);
 > Anthony, you once said your stack trace patch used the address of the
 > libffi stub to keep track of interpreted frames.  Can you tell me how
 > to do this?  How do I find the size of the stub?
 > This seems like a cleaner implementation, provided we get the GC
 > behavior correct.  And it will fix PR 8170 (we need a hack similar to
 > the above for JNI methods).

The Right Way to do it is something like this

  _Jv_frame_info *frame = GET_FRAME (n);
  void *p = _Unwind_FindEnclosingFunction (frame->addr);
  if (p == &interpreterf1 
      || p == &interpreterf2 ...

or, alternatively something like

      _Jv_frame_info *frame = GET_FRAME (n);
      gnu::gcj::runtime::MethodRef *ref 
        = getCompiledMethodRef ((gnu::gcj::RawData *)frame->addr);
      if (ref && ref->klass == &gnu::gcj::interpreter)
        ... it's an interpreter function ...


More information about the Java mailing list