/* src/threads/threads-common.c - machine independent thread functions
- Copyright (C) 2007 R. Grafl, A. Krall, C. Kruegel,
- C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
- E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
- J. Wenninger, Institut f. Computersprachen - TU Wien
+ Copyright (C) 2007, 2008
+ CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
This file is part of CACAO.
#include "native/include/java_lang_Thread.h"
#if defined(WITH_CLASSPATH_GNU)
+# include "native/include/java_lang_Throwable.h"
# include "native/include/java_lang_VMThread.h"
#endif
LLNI_field_set_val(object, vm_thread, (java_lang_Object *) t);
#endif
- threads_thread_set_object(t, object);
+ threads_thread_set_object(t, (java_handle_t *) object);
/* set java.lang.Thread fields */
/* iterate over all started threads */
for (t = threads_list_first(); t != NULL; t = threads_list_next(t)) {
+ /* ignore threads which are in state NEW */
+ if (t->state == THREAD_STATE_NEW)
+ continue;
+
/* print thread info */
printf("\n");
/* threads_thread_print_stacktrace *********************************************
- Print the current stacktrace of the current thread.
+ Print the current stacktrace of the given thread.
*******************************************************************************/
void threads_thread_print_stacktrace(threadobject *thread)
{
- stackframeinfo *sfi;
- stacktracebuffer *stb;
- s4 dumpsize;
-
- /* mark start of dump memory area */
-
- dumpsize = dump_size();
+ stackframeinfo_t *sfi;
+ java_handle_bytearray_t *ba;
+ stacktrace_t *st;
- /* create a stacktrace for the passed thread */
+ /* Build a stacktrace for the passed thread. */
sfi = thread->_stackframeinfo;
- stb = stacktrace_create(sfi);
+ ba = stacktrace_get();
+
+ /* We need a critical section here as we use the byte-array data
+ pointer directly. */
+
+ LLNI_CRITICAL_START;
+
+ st = (stacktrace_t *) LLNI_array_data(ba);
- /* print stacktrace */
+ /* Print stacktrace. */
- if (stb != NULL)
- stacktrace_print_trace_from_buffer(stb);
+ if (st != NULL)
+ stacktrace_print(st);
else {
puts("\t<<No stacktrace available>>");
fflush(stdout);
}
- dump_release(dumpsize);
+ LLNI_CRITICAL_END;
}