#include <gnu/gcj/runtime/NameFinder.h>
#include <sysdep/backtrace.h>
+#include <sysdep/descriptor.h>
using namespace java::lang;
using namespace java::lang::reflect;
using namespace java::util;
using namespace gnu::gcj::runtime;
-struct _Jv_FindCallingClassState: _Jv_UnwindState
-{
- jclass result;
-};
-
// Maps ncode values to their containing native class.
// NOTE: Currently this Map contradicts class GC for native classes. This map
// (and the "new class stack") will need to use WeakReferences in order to
for (int i=0; i < klass->method_count; i++)
{
_Jv_Method *method = &klass->methods[i];
+ void *ncode = method->ncode;
// Add non-abstract methods to ncodeMap.
- if (method->ncode)
+ if (ncode)
{
- //printf("map->put 0x%x / %s.%s\n", method->ncode, klass->name->data,
- // method->name->data);
- ncodeMap->put ((java::lang::Object *) method->ncode, klass);
+ ncode = UNWRAP_FUNCTION_DESCRIPTOR (ncode);
+ ncodeMap->put ((java::lang::Object *)ncode, klass);
}
}
}
#endif
// Use dladdr() to determine in which binary the address IP resides.
#if defined (HAVE_DLFCN_H) && defined (HAVE_DLADDR)
- extern char **_Jv_argv;
Dl_info info;
jstring binaryName = NULL;
+ const char *argv0 = _Jv_GetSafeArg(0);
void *ip = frame->ip;
_Unwind_Ptr offset = 0;
-
+
if (dladdr (ip, &info))
{
if (info.dli_fname)
return;
// addr2line expects relative addresses for shared libraries.
- if (strcmp (info.dli_fname, _Jv_argv[0]) == 0)
+ if (strcmp (info.dli_fname, argv0) == 0)
offset = (_Unwind_Ptr) ip;
else
offset = (_Unwind_Ptr) ip - (_Unwind_Ptr) info.dli_fbase;
_Jv_StackFrame *frame = &state.frames[i];
FillInFrameInfo (frame);
- if (seen_checkClass
- && frame->klass
- && frame->klass != checkClass)
+ if (seen_checkClass)
{
- jframe_count++;
- if (start_pos == -1)
- start_pos = i;
+ if (frame->klass)
+ {
+ jframe_count++;
+ if (start_pos == -1)
+ start_pos = i;
+ }
}
-
- if (!seen_checkClass
- && frame->klass
- && frame->klass == checkClass)
- seen_checkClass = true;
+ else
+ seen_checkClass = frame->klass == checkClass;
}
result = (JArray<jclass> *) _Jv_NewObjectArray (jframe_count, &Class::class$, NULL);
int pos = 0;
{
classLoader = frame->klass->getClassLoaderInternal();
#ifdef INTERPRETER
- if (classLoader != NULL && classLoader != ClassLoader::systemClassLoader)
+ if (classLoader != NULL)
{
state->trace_data = (void *) classLoader;
return _URC_NORMAL_STOP;