/* src/vm/jit/stacktrace.cpp - machine independent stacktrace system
- Copyright (C) 1996-2005, 2006, 2007, 2008
+ Copyright (C) 1996-2011
CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
Copyright (C) 2009 Theobroma Systems Ltd.
#include "vm/types.h"
+#include "arch.h"
#include "md.h"
#include "mm/gc.hpp"
/* On S390 we use REG_RA as REG_ITMP3, so we have always to get
the RA from stack. */
- framesize = *((u4 *) (((uintptr_t) pv) + FrameSize));
+ framesize = md_stacktrace_get_framesize(code);
ra = md_stacktrace_get_returnaddress(sp, framesize);
# else
the asm_vm_call_method special case. */
if ((code == NULL) || !code_is_leafmethod(code)) {
- framesize = *((u4 *) (((uintptr_t) pv) + FrameSize));
+ framesize = md_stacktrace_get_framesize(code);
ra = md_stacktrace_get_returnaddress(sp, framesize);
}
/* Get the current stack frame size. */
- framesize = *((uint32_t *) (((intptr_t) pv) + FrameSize));
+ framesize = md_stacktrace_get_framesize(code);
/* Get the RA of the current stack frame (RA to the parent Java
method) if the current method is a non-leaf method. Otherwise
else
#endif
{
-#if defined(__I386__) || defined (__X86_64__) || defined (__M68K__)
+#if STACKFRMAE_RA_BETWEEN_FRAMES
sp = (void *) (((intptr_t) sp) + framesize + SIZEOF_VOID_P);
#elif defined(__SPARC_64__)
/* already has the new sp */
m = tmpsfi.code->m;
cl = class_get_classloader(m->clazz);
+#if defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
+ /* NOTE: See hotspot/src/share/vm/runtime/vframe.cpp
+ (vframeStreamCommon::skip_reflection_related_frames). */
+ if (class_issubclass(m->clazz, class_sun_reflect_MethodAccessorImpl) ||
+ class_issubclass(m->clazz, class_sun_reflect_ConstructorAccessorImpl))
+ continue;
+#endif
+
if (cl != NULL)
return cl;
}
/* stacktrace_print_of_thread **************************************************
- Print the current stacktrace of the given thread.
+ Print the current stacktrace of the given thread. It will only work
+ for suspended threads.
ARGUMENTS:
t ... thread
sfi = t->_stackframeinfo;
- if (sfi == NULL) {
+ if (!t->suspended || sfi == NULL) {
puts("\t<<No stacktrace available>>");
fflush(stdout);
return;