[kaffe] CVS kaffe (robilad): Added debug codes for ksem and references and guarded all dprintf invocations
Kaffe CVS
cvs-commits at kaffe.org
Sun Jan 30 10:28:11 PST 2005
PatchSet 5952
Date: 2005/01/30 18:21:36
Author: robilad
Branch: HEAD
Tag: (none)
Log:
Added debug codes for ksem and references and guarded all dprintf invocations
2005-01-29 Dalibor Topic <robilad at kaffe.org>
* kaffe/kaffevm/ksem.c: Include debug.h for dprintf.
* kaffe/kaffevm/debug.c
kaffe/kaffevm/debug.h:
Added debug identifiers for ksem and references.
* kaffe/kaffevm/baseClasses.c,
kaffe/kaffevm/gcFuncs.c,
kaffe/kaffevm/reference.c,
kaffe/kaffevm/thread.c,
kaffe/kaffevm/intrp/machine.c,
kaffe/kaffevm/jni/jni-base.c:
Added guards for dprintf invocations.
Reported by: Michael Franz <mvfranz at gmail.com>
Members:
ChangeLog:1.3491->1.3492
kaffe/kaffevm/baseClasses.c:1.58->1.59
kaffe/kaffevm/debug.c:1.60->1.61
kaffe/kaffevm/debug.h:1.39->1.40
kaffe/kaffevm/gcFuncs.c:1.64->1.65
kaffe/kaffevm/ksem.c:1.11->1.12
kaffe/kaffevm/reference.c:1.1->1.2
kaffe/kaffevm/thread.c:1.91->1.92
kaffe/kaffevm/intrp/machine.c:1.45->1.46
kaffe/kaffevm/jni/jni-base.c:1.12->1.13
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3491 kaffe/ChangeLog:1.3492
--- kaffe/ChangeLog:1.3491 Sun Jan 30 15:36:15 2005
+++ kaffe/ChangeLog Sun Jan 30 18:21:36 2005
@@ -1,5 +1,23 @@
2005-01-29 Dalibor Topic <robilad at kaffe.org>
+ * kaffe/kaffevm/ksem.c: Include debug.h for dprintf.
+
+ * kaffe/kaffevm/debug.c
+ kaffe/kaffevm/debug.h:
+ Added debug identifiers for ksem and references.
+
+ * kaffe/kaffevm/baseClasses.c,
+ kaffe/kaffevm/gcFuncs.c,
+ kaffe/kaffevm/reference.c,
+ kaffe/kaffevm/thread.c,
+ kaffe/kaffevm/intrp/machine.c,
+ kaffe/kaffevm/jni/jni-base.c:
+ Added guards for dprintf invocations.
+
+ Reported by: Michael Franz <mvfranz at gmail.com>
+
+2005-01-29 Dalibor Topic <robilad at kaffe.org>
+
* developers/autogen.sh:
Set locale to C tp avoid different locales interfering
with sorting of class lists.
Index: kaffe/kaffe/kaffevm/baseClasses.c
diff -u kaffe/kaffe/kaffevm/baseClasses.c:1.58 kaffe/kaffe/kaffevm/baseClasses.c:1.59
--- kaffe/kaffe/kaffevm/baseClasses.c:1.58 Sun Jan 30 12:42:40 2005
+++ kaffe/kaffe/kaffevm/baseClasses.c Sun Jan 30 18:21:38 2005
@@ -142,9 +142,11 @@
{
if( !enableXProfiling() )
{
- dprintf(
+ DBG(INIT,
+ dprintf(
"Unable to initialize cross "
"language profiling\n");
+ );
}
}
#endif
@@ -208,7 +210,7 @@
constructor_name && Code_name && LineNumberTable_name &&
LocalVariableTable_name && ConstantValue_name &&
Exceptions_name && SourceFile_name && InnerClasses_name)) {
- dprintf("not enough memory to run kaffe\n");
+ DBG(INIT, dprintf("not enough memory to run kaffe\n"); );
ABORT();
}
@@ -246,15 +248,19 @@
static void NONRETURNING
abortWithEarlyClassFailure(errorInfo* einfo)
{
+ DBG(INIT,
dprintf("\n"
"Failure loading and/or initializing a critical class.\n"
"This failure occured too early in the VM startup, and is\n"
"indicative of bug in the initialization, or a insufficient\n"
"stack space or heap space to complete initialization.\n");
+ );
/* XXX print einfo. */
+ DBG(INIT,
dprintf("*einfo: type=%d;\n\tclassname=`%s';\n\tmess=`%s'\n",
einfo->type, einfo->classname, einfo->mess);
+ );
EXIT(-1);
}
Index: kaffe/kaffe/kaffevm/debug.c
diff -u kaffe/kaffe/kaffevm/debug.c:1.60 kaffe/kaffe/kaffevm/debug.c:1.61
--- kaffe/kaffe/kaffevm/debug.c:1.60 Mon Dec 27 16:09:46 2004
+++ kaffe/kaffe/kaffevm/debug.c Sun Jan 30 18:21:38 2005
@@ -155,7 +155,10 @@
D(VERIFY2, "Debug verifier, pass 2...outputs constant pool."),
D(VERIFY3, "Debug verifier, pass 3...outputs walkthrough of data-flow analysis."),
D(VERIFY, "Debug verifier, passes 2 and 3...produces a TON of output."),
-
+
+ D(KSEM, "Debug semaphores."),
+ D(REFERENCE, "Debug references."),
+
/* you can define combinations too */
{ "lookup", DBG_MLOOKUP|DBG_ELOOKUP|DBG_FLOOKUP,
"Various lookup operations" },
Index: kaffe/kaffe/kaffevm/debug.h
diff -u kaffe/kaffe/kaffevm/debug.h:1.39 kaffe/kaffe/kaffevm/debug.h:1.40
--- kaffe/kaffe/kaffevm/debug.h:1.39 Sun Dec 19 06:25:07 2004
+++ kaffe/kaffe/kaffevm/debug.h Sun Jan 30 18:21:38 2005
@@ -114,6 +114,9 @@
# define DBG_VERIFY3 DBG_BIT(61)
# define DBG_VERIFY (DBG_VERIFY2 | DBG_VERIFY3)
+# define DBG_KSEM DBG_BIT(62)
+# define DBG_REFERENCE DBG_BIT(63)
+
# define DBG_ALL ((debugmask_t)(-1))
# define DBG_ANY DBG_ALL
Index: kaffe/kaffe/kaffevm/gcFuncs.c
diff -u kaffe/kaffe/kaffevm/gcFuncs.c:1.64 kaffe/kaffe/kaffevm/gcFuncs.c:1.65
--- kaffe/kaffe/kaffevm/gcFuncs.c:1.64 Sun Jan 30 12:42:40 2005
+++ kaffe/kaffe/kaffevm/gcFuncs.c Sun Jan 30 18:21:38 2005
@@ -89,8 +89,10 @@
#endif
if (Kaffe_JavaVMArgs.enableVerboseGC > 0 && clazz->name) {
- dprintf("<GC: unloading class `%s'>\n",
- CLASS_CNAME(clazz));
+ DBG(CLASSGC,
+ dprintf("<GC: unloading class `%s'>\n",
+ CLASS_CNAME(clazz));
+ );
}
/* destroy all fields */
Index: kaffe/kaffe/kaffevm/ksem.c
diff -u kaffe/kaffe/kaffevm/ksem.c:1.11 kaffe/kaffe/kaffevm/ksem.c:1.12
--- kaffe/kaffe/kaffevm/ksem.c:1.11 Sun Jan 30 12:42:41 2005
+++ kaffe/kaffe/kaffevm/ksem.c Sun Jan 30 18:21:38 2005
@@ -8,6 +8,7 @@
* of this file.
*/
+#include "debug.h"
#include "ksem.h"
#include "support.h"
@@ -51,7 +52,9 @@
if (timeout == 0)
timeout = NOTIMEOUT;
- dprintf("ksem_get sp=%p\n", &r);
+ DBG(KSEM,
+ dprintf("ksem_get sp=%p\n", &r);
+ );
KMUTEX(lock)(&sem->mux);
/* If no stored wakeups, then sleep. */
Index: kaffe/kaffe/kaffevm/reference.c
diff -u kaffe/kaffe/kaffevm/reference.c:1.1 kaffe/kaffe/kaffevm/reference.c:1.2
--- kaffe/kaffe/kaffevm/reference.c:1.1 Sun Jan 30 12:42:41 2005
+++ kaffe/kaffe/kaffevm/reference.c Sun Jan 30 18:21:38 2005
@@ -9,6 +9,7 @@
* of this file.
*/
+#include "debug.h"
#include "gtypes.h"
#include "hashtab.h"
#include "baseClasses.h"
@@ -105,8 +106,11 @@
if (referent_field == NULL)
{
dumpErrorInfo(&einfo);
- dprintf("Internal error: The java/lang/ref/Reference class does not have any 'referent' field.\n"
- "Aborting.\n");
+ DBG(REFERENCE,
+ dprintf("Internal error: The java/lang/ref/Reference class does not have any "
+ "'referent' field.\n"
+ "Aborting.\n");
+ );
ABORT();
}
@@ -179,9 +183,11 @@
}
else
{
- dprintf("Internal error: a reference without the enqueue method has been registered.");
-
- dprintf("Aborting.\n");
+ DBG(REFERENCE,
+ dprintf("Internal error: a reference without the enqueue method "
+ "has been registered.");
+ dprintf("Aborting.\n");
+ );
ABORT();
}
@@ -250,8 +256,10 @@
kobj->finalizer_call = referenceObjectFinalizer;
break;
default:
- dprintf("Internal error: invalid finalizer type %d for object %p.\n", fintype, obj);
- dprintf("Aborting.\n");
+ DBG(REFERENCE,
+ dprintf("Internal error: invalid finalizer type %d for object %p.\n", fintype, obj);
+ dprintf("Aborting.\n");
+ );
ABORT();
}
}
Index: kaffe/kaffe/kaffevm/thread.c
diff -u kaffe/kaffe/kaffevm/thread.c:1.91 kaffe/kaffe/kaffevm/thread.c:1.92
--- kaffe/kaffe/kaffevm/thread.c:1.91 Sun Jan 30 12:42:41 2005
+++ kaffe/kaffe/kaffevm/thread.c Sun Jan 30 18:21:38 2005
@@ -604,17 +604,21 @@
static void
dumpJavaThread(jthread_t thread, UNUSED void *p)
{
+DBG(VMTHREAD,
Hjava_lang_VMThread *tid = (Hjava_lang_VMThread *)KTHREAD(get_data)(thread)->jlThread;
dprintf("`%s' ", nameThread(tid));
KTHREAD(dumpthreadinfo)(thread);
dprintf("\n");
+);
}
static void
dumpThreads(void)
{
+DBG(VMTHREAD,
dprintf("Dumping live threads:\n");
KTHREAD(walkLiveThreads_r)(dumpJavaThread, NULL);
+);
}
/*
@@ -639,9 +643,12 @@
#if defined(JTHREAD_RESTORE_FD)
jthreadRestoreFD(2);
#endif
+
dumpLocks();
dumpThreads();
+DBG(VMTHREAD,
dprintf("Deadlock: all threads blocked on internal events\n");
+);
fflush(stderr);
ABORT();
}
Index: kaffe/kaffe/kaffevm/intrp/machine.c
diff -u kaffe/kaffe/kaffevm/intrp/machine.c:1.45 kaffe/kaffe/kaffevm/intrp/machine.c:1.46
--- kaffe/kaffe/kaffevm/intrp/machine.c:1.45 Sun Jan 30 12:42:41 2005
+++ kaffe/kaffe/kaffevm/intrp/machine.c Sun Jan 30 18:21:40 2005
@@ -110,8 +110,10 @@
/* implement stack overflow check */
if (KTHREAD(stackcheck)(thread_data->needOnStack) == false) {
if (thread_data->needOnStack == STACK_LOW) {
- dprintf(
+ CHDBG(
+ dprintf(
"Panic: unhandled StackOverflowError()\n");
+ );
ABORT();
}
@@ -268,7 +270,7 @@
switch (code[pc]) {
default:
- dprintf("Unknown bytecode %d\n", code[pc]);
+ CHDBG(dprintf("Unknown bytecode %d\n", code[pc]); );
throwException(NEW_LANG_EXCEPTION(VerifyError));
break;
#include "kaffe.def"
Index: kaffe/kaffe/kaffevm/jni/jni-base.c
diff -u kaffe/kaffe/kaffevm/jni/jni-base.c:1.12 kaffe/kaffe/kaffevm/jni/jni-base.c:1.13
--- kaffe/kaffe/kaffevm/jni/jni-base.c:1.12 Sun Jan 30 12:42:42 2005
+++ kaffe/kaffe/kaffevm/jni/jni-base.c Sun Jan 30 18:21:41 2005
@@ -15,6 +15,7 @@
#include "config.h"
#include "config-std.h"
#include "config-mem.h"
+#include "debug.h"
#include "jni.h"
#include "jnirefs.h"
#include "jni_i.h"
@@ -222,7 +223,9 @@
{
args->nativeStackSize = sz;
}
- dprintf("Setup stack size to %d\n", sz);
+ DBG(INIT,
+ dprintf("Setup stack size to %d\n", sz);
+ );
}
}
args->bootClasspath = bootClasspath;
More information about the kaffe
mailing list