patch for debug and classpath stuff

Patrick Tullmann tullmann at cs.utah.edu
Thu Mar 9 13:54:13 PST 2000


The attached patch cleans up some of the -vmdebug debugging
infrastructure in Kaffe, though only a little.  Specifically, I
renamed VMLOCKS to SLOWLOCKS, and updated findInJar to the use the
-vmdebug-style magic.  VMLOCKS is currently unused, and SLOWLOCKS
makes more sense (and will be used in a forthcoming patch... :)

ChangeLog entry:

Patrick Tullmann <tullmann at cs.utah.edu>
	* kaffe/kaffevm/debug.[ch]: drop DBG_VMLOCKS, add
	  DBG_SLOWLOCKS, DBG_INITCLASSPATH and DBG_CLASSLOOKUP flags.
	* kaffe/kaffevm/findInJar.c: drop old-style debugging, use
	  DBG_INITCLASSPATH and DBG_CLASSLOOKUP for debugging rumaging 
	  around in jar files.

-Pat

Index: kaffe/kaffevm/debug.c
===================================================================
RCS file: /cvs/kaffe/kaffe/kaffe/kaffevm/debug.c,v
retrieving revision 1.27
diff -u -r1.27 debug.c
--- kaffe/kaffevm/debug.c	2000/02/03 18:27:53	1.27
+++ kaffe/kaffevm/debug.c	2000/03/09 21:46:23
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 1999 The University of Utah. All rights reserved.
+ * Copyright (c) 1998, 1999, 2000 The University of Utah. All rights reserved.
  *
  * See the file "license.terms" for information on usage and redistribution
  * of this file.
@@ -61,7 +61,7 @@
 	/* XXX Clean these names up, re-order them and make them consistent. */
 #define D(name, str) { #name, DBG_ ## name, str }
 	D(NONE, "Nothing"),
-	D(VMLOCKS,  "Mutex lock/unlock operations called by VM"),
+	D(SLOWLOCKS,  "Heavy lock/unlock operations"),
 	D(VMCONDS,  "Show condition variable operations called by VM"),
 	D(NEWINSTR, "Show softnew_ instructions (NEW, NEWARRAY, ANEWARRAY)"),
 	D(VMTHREAD, "Show some java.lang.Thread operations called by VM"),
@@ -71,6 +71,7 @@
 	D(EXCEPTION, "Debug exceptions, don't catch traps"),
 	D(STACKTRACE, "Debug stack trace inspection"),
 	D(INIT,     "Show initialization steps."),
+	D(INITCLASSPATH,     "Show classpath initialization."),
 	D(BREAKONEXIT, "Cause an exception before exiting. (Useful under GDB)"),
 	D(GCPRIM,   "Debug gc_primitive_*"),
 	D(GCALLOC,   "Debug gc_heap_alloc*"),
@@ -93,9 +94,10 @@
 	D(INT_RETURN, "Show return from function. (interpreter)"),
 	D(INT_VMCALL, "Show call to virtualMachine. (interpreter)"),
 	D(INT_CHECKS, "Show various checks. (interpreter)"),
-	D(ELOOKUP, "Debug exception lookup"),
-	D(FLOOKUP, "Debug field lookup"),
-	D(MLOOKUP, "Debug method lookup"),
+	D(ELOOKUP, "Debug exception lookup."),
+	D(FLOOKUP, "Debug field lookup."),
+	D(MLOOKUP, "Debug method lookup."),
+	D(CLASSLOOKUP, "Debug class lookup."),
 	D(JIT, 	"Debug JIT compiler--show emitted instructions."),
 	D(MOREJIT, 	"Debug JIT compiler--show callinfo."),
 	D(NOGC,	"Turn garbage collection off."),
@@ -129,7 +131,7 @@
 
 	{ "gcj", DBG_GCJ|DBG_GCJMORE,
 			"Debug GCJ support in detailed" },
-	{ "thread", DBG_JTHREAD|DBG_VMLOCKS|DBG_VMCONDS, 
+	{ "thread", DBG_JTHREAD|DBG_SLOWLOCKS|DBG_VMCONDS, 
 			"Thread operations and locking operations" },
 
 	{ "intrp", DBG_INT_NATIVE|DBG_INT_RETURN|DBG_INT_VMCALL, 
Index: kaffe/kaffevm/debug.h
===================================================================
RCS file: /cvs/kaffe/kaffe/kaffe/kaffevm/debug.h,v
retrieving revision 1.24
diff -u -r1.24 debug.h
--- kaffe/kaffevm/debug.h	2000/01/28 23:21:46	1.24
+++ kaffe/kaffevm/debug.h	2000/03/09 21:46:23
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 1999 The University of Utah. All rights reserved.
+ * Copyright (c) 1998, 1999, 2000 The University of Utah. All rights reserved.
  *
  * See the file "license.terms" for information on usage and redistribution
  * of this file.
@@ -41,7 +41,7 @@
 /* Debug Masks: (1 bit per option) */
 # define DBG_BIT(x) (((jlong)1)<<x)
 # define DBG_NONE		(0)
-# define DBG_VMLOCKS            DBG_BIT(0)
+# define DBG_SLOWLOCKS          DBG_BIT(0)
 # define DBG_VMCONDS		DBG_BIT(1)
 # define DBG_NEWINSTR		DBG_BIT(2)
 # define DBG_VMTHREAD		DBG_BIT(3) 
@@ -101,6 +101,8 @@
 # define DBG_SLACKANAL		DBG_BIT(52) 
 # define DBG_GCJ		DBG_BIT(53) 
 # define DBG_GCJMORE		DBG_BIT(54) 
+# define DBG_INITCLASSPATH      DBG_BIT(55)
+# define DBG_CLASSLOOKUP        DBG_BIT(56)
 
 # define DBG_ALL		((jlong)(-1))
 # define DBG_ANY                DBG_ALL
Index: kaffe/kaffevm/findInJar.c
===================================================================
RCS file: /cvs/kaffe/kaffe/kaffe/kaffevm/findInJar.c,v
retrieving revision 1.40
diff -u -r1.40 findInJar.c
--- kaffe/kaffevm/findInJar.c	1999/11/29 23:51:08	1.40
+++ kaffe/kaffevm/findInJar.c	2000/03/09 21:46:23
@@ -9,11 +9,6 @@
  * of this file. 
  */
 
-#define	FDBG(s)
-#define ZDBG(s)
-#define	PDBG(s)
-#define	CDBG(s)
-
 #include "config.h"
 #include "debug.h"
 #include "config-std.h"
@@ -106,7 +101,8 @@
 	assert(centry->class == 0);
 
 	/* Look for the class */
-CDBG(	dprintf("Scanning for class %s\n", cname);		)
+DBG(CLASSLOOKUP,
+	dprintf("Scanning for class %s\n", cname);		)
 
 	buf = checkPtr(KMALLOC(strlen(cname) + 8));
 	sprintf(buf, "%s.class", cname);
@@ -178,7 +174,8 @@
 	int iLockRoot;
 
 	/* Look for the class */
-CDBG(	dprintf("Scanning for element %s\n", cname);		)
+DBG(CLASSLOOKUP,
+	dprintf("Scanning for element %s\n", cname);		)
 
 	/* One into the jar at once */
 	lockStaticMutex(&jarlock);
@@ -187,7 +184,7 @@
 		hand.type = ptr->type;
 		switch (ptr->type) {
 		case CP_ZIPFILE:
-ZDBG(			dprintf("Opening JAR file %s for %s\n", ptr->path, cname); )
+DBG(CLASSLOOKUP,	dprintf("Opening JAR file %s for %s\n", ptr->path, cname); )
 			if (ptr->u.jar == 0) {
 				ptr->u.jar = openJarFile(ptr->path);
 				if (ptr->u.jar == 0) {
@@ -224,7 +221,7 @@
 			    + strlen(file_separator) + strlen(cname) + 1));
 			sprintf(buf, "%s%s%s",
 			    ptr->path, file_separator, cname);
-FDBG(			dprintf("Opening java file %s for %s\n", buf, cname); )
+DBG(CLASSLOOKUP,	dprintf("Opening java file %s for %s\n", buf, cname); )
 			rc = KOPEN(buf, O_RDONLY|O_BINARY, 0, &fp);
 			KFREE(buf);
 			/* if we can't open the file, we keep looking */
@@ -359,7 +356,8 @@
 {
 	char* end;
 
-PDBG(	dprintf("initClasspath(): '%s'\n", cp);				)
+DBG(INITCLASSPATH,
+    	dprintf("initClasspath(): '%s'\n", cp); )
 
 	for (;;) {
 		/* FIXME: requires path_separator to have length 1 */
@@ -447,7 +445,8 @@
 	classpathEntry* ptr;
 	classpathEntry* lptr;
 
-PDBG(	dprintf("insertClasspath(): '%s' %spend\n", cp, prepend ? "pre" : "ap");)
+DBG(INITCLASSPATH,
+	dprintf("insertClasspath(): '%s' %spend\n", cp, prepend ? "pre" : "ap"); )
 
 	lptr = 0;
 	for (ptr = classpath; ptr != 0; ptr = ptr->next) {


More information about the kaffe mailing list