[kaffe] CVS kaffe (guilhem): Reformatted stack trace output in Kaffe VM.
Kaffe CVS
cvs-commits at kaffe.org
Wed Jun 1 13:21:06 PDT 2005
PatchSet 6606
Date: 2005/06/01 20:14:50
Author: guilhem
Branch: HEAD
Tag: (none)
Log:
Reformatted stack trace output in Kaffe VM.
* kaffe/kaffevm/stackTrace.c
(printStackTrace): Reformatted trace output.
* kaffe/kaffevm/support.c
(kprintf): Use vfprintf stored in kaffe VM arguments.
* kaffe/kaffevm/jni/jni.c
(Kaffe_ExceptionDescribe): Always print the stack trace using
kaffe internal routines. That way we always get a stack trace when
an exception is thrown.
* test/regression/ProcessClassInst.java,
test/regression/ProcessClassStop.java: Fixed expected output
accordingly.
Members:
ChangeLog:1.4132->1.4133
kaffe/kaffevm/stackTrace.c:1.50->1.51
kaffe/kaffevm/support.c:1.84->1.85
kaffe/kaffevm/jni/jni.c:1.29->1.30
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4132 kaffe/ChangeLog:1.4133
--- kaffe/ChangeLog:1.4132 Tue May 31 21:18:31 2005
+++ kaffe/ChangeLog Wed Jun 1 20:14:50 2005
@@ -1,3 +1,20 @@
+2005-06-01 Guilhem Lavaux <guilhem at kaffe.org>
+
+ * kaffe/kaffevm/stackTrace.c
+ (printStackTrace): Reformatted trace output.
+
+ * kaffe/kaffevm/support.c
+ (kprintf): Use vfprintf stored in kaffe VM arguments.
+
+ * kaffe/kaffevm/jni/jni.c
+ (Kaffe_ExceptionDescribe): Always print the stack trace using
+ kaffe internal routines. That way we always get a stack trace when
+ an exception is thrown.
+
+ * test/regression/ProcessClassInst.java,
+ test/regression/ProcessClassStop.java: Fixed expected output
+ accordingly.
+
2005-05-31 Adam Heath <doogie at brainfood.com>
* kaffe/kaffevm/jni/jni.c,
Index: kaffe/kaffe/kaffevm/stackTrace.c
diff -u kaffe/kaffe/kaffevm/stackTrace.c:1.50 kaffe/kaffe/kaffevm/stackTrace.c:1.51
--- kaffe/kaffe/kaffevm/stackTrace.c:1.50 Sat May 28 13:41:52 2005
+++ kaffe/kaffe/kaffevm/stackTrace.c Wed Jun 1 20:14:52 2005
@@ -262,13 +262,13 @@
if (linenr == -1) {
if (meth->accflags & ACC_NATIVE) {
- sprintf(buf, "\tat %s.%s(%s:native)",
+ sprintf(buf, " at %s.%s (%s:native)",
class_dot_name,
meth->name->data,
CLASS_SOURCEFILE(meth->class));
}
else {
- sprintf(buf, "\tat %s.%s(%s:line unknown, pc %p)",
+ sprintf(buf, " at %s.%s (%s:line unknown, pc %p)",
class_dot_name,
meth->name->data,
CLASS_SOURCEFILE(meth->class),
@@ -276,7 +276,7 @@
}
}
else {
- sprintf(buf, "\tat %s.%s(%s:%d)",
+ sprintf(buf, " at %s.%s (%s:%d)",
class_dot_name,
meth->name->data,
CLASS_SOURCEFILE(meth->class),
Index: kaffe/kaffe/kaffevm/support.c
diff -u kaffe/kaffe/kaffevm/support.c:1.84 kaffe/kaffe/kaffevm/support.c:1.85
--- kaffe/kaffe/kaffevm/support.c:1.84 Sat May 14 21:46:31 2005
+++ kaffe/kaffe/kaffevm/support.c Wed Jun 1 20:14:52 2005
@@ -942,7 +942,7 @@
va_list argptr;
va_start(argptr, mess);
- vfprintf(out, mess, argptr);
+ Kaffe_JavaVMArgs.vfprintf(out, mess, argptr);
va_end(argptr);
}
Index: kaffe/kaffe/kaffevm/jni/jni.c
diff -u kaffe/kaffe/kaffevm/jni/jni.c:1.29 kaffe/kaffe/kaffevm/jni/jni.c:1.30
--- kaffe/kaffe/kaffevm/jni/jni.c:1.29 Tue May 31 21:18:29 2005
+++ kaffe/kaffe/kaffevm/jni/jni.c Wed Jun 1 20:14:54 2005
@@ -472,10 +472,35 @@
Kaffe_ExceptionDescribe(JNIEnv* env UNUSED)
{
BEGIN_EXCEPTION_HANDLING_VOID();
+ const char* cname;
+ Hjava_lang_Class* class;
+ Hjava_lang_Throwable *eobj = thread_data->exceptObj;
- if (thread_data->exceptObj != 0) {
- do_execute_java_method(NULL, thread_data->exceptObj, "printStackTrace", "()V",
- NULL, 0, thread_data->exceptObj);
+ if (eobj != 0) {
+ /* Don't use the java stack printer because the exception
+ * may arise in the IO codec.
+ */
+ Hjava_lang_String *msg;
+ char *realname;
+
+ class = OBJECT_CLASS(&eobj->base);
+ cname = CLASS_CNAME(class);
+ realname = KMALLOC(strlen(cname));
+ pathname2classname(cname, realname);
+
+ msg = unhand(eobj)->detailMessage;
+ if (msg != NULL) {
+ char *cmsg = checkPtr(stringJava2C(msg));
+
+ kprintf(stderr, "%s: %s\n", realname, cmsg);
+ KFREE(cmsg);
+ unhand(eobj)->detailMessage = NULL;
+ } else {
+ kprintf(stderr, "%s\n", realname);
+ }
+ KFREE(realname);
+
+ printStackTrace (eobj, NULL, true);
}
END_EXCEPTION_HANDLING();
}
More information about the kaffe
mailing list