[kaffe] CVS kaffe (doogie): Add -debug-fd option, to specify where debug output should go.

Kaffe CVS cvs-commits at kaffe.org
Fri Dec 17 23:48:49 PST 2004


PatchSet 5658 
Date: 2004/12/18 07:33:20
Author: doogie
Branch: HEAD
Tag: (none) 
Log:
Add -debug-fd option, to specify where debug output should go.

Members: 
	ChangeLog:1.3203->1.3204 
	kaffe/kaffe/main.c:1.71->1.72 
	kaffe/kaffevm/debug.c:1.57->1.58 
	kaffe/kaffevm/debug.h:1.37->1.38 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3203 kaffe/ChangeLog:1.3204
--- kaffe/ChangeLog:1.3203	Sat Dec 18 07:30:50 2004
+++ kaffe/ChangeLog	Sat Dec 18 07:33:20 2004
@@ -1,5 +1,10 @@
 2004-12-18  Adam Heath  <doogieg at brainfood.com>
 
+	* kaffe/kaffe/main.c, kaffe/kaffevm/debug.c, kaffe/kaffevm/debug.c:
+	  Add -debug-fd option, to specify where debug output should go.
+
+2004-12-18  Adam Heath  <doogieg at brainfood.com>
+
 	* configure.ac, configure:
 	  The processing of --disable-debug had the CPPFLAGS block only
 	  running when --disable-debug is specified.  It never ran in the
Index: kaffe/kaffe/kaffe/main.c
diff -u kaffe/kaffe/kaffe/main.c:1.71 kaffe/kaffe/kaffe/main.c:1.72
--- kaffe/kaffe/kaffe/main.c:1.71	Fri Dec 17 17:47:34 2004
+++ kaffe/kaffe/kaffe/main.c	Sat Dec 18 07:33:18 2004
@@ -821,6 +821,22 @@
 				exit(1);
                 }
 #endif
+                else if (strcmp(argv[i], "-debug-fd") == 0) {
+			char *end;
+                        i++;
+                        if (argv[i] == 0) { /* forgot second arg */
+                                fprintf(stderr, 
+					_("Error: -debug-fd an open descriptor.\n"));
+                                exit(1);
+                        }
+			kaffe_dprintf_fd = strtol(argv[i], &end, 10);
+			fprintf(stderr, "fd=%i end=%s\n", kaffe_dprintf_fd, end);
+			if (end != 0 && *end != '\0') {
+				fprintf(stderr,
+					_("Error: -debug-fd requires an integer.\n"));
+				exit(1);
+			}
+                }
 		else if (argv[i][1] ==  'D') {
 			/* Set a property */
 			char *propStr = strdup(&argv[i][2]);
@@ -909,6 +925,7 @@
 #ifdef KAFFE_VMDEBUG
         fprintf(stderr, _("	-vmdebug <flag{,flag}>	 Internal VM debugging.  Set flag=list for a list\n"));
 #endif
+        fprintf(stderr, _("	-debug-fd <descriptor>	 Descriptor to send debug info to\n"));
 #ifdef KAFFE_STATS
         fprintf(stderr, _("	-vmstats <flag{,flag}>	 Print VM statistics.  Set flag=all for all\n"));
 #endif
Index: kaffe/kaffe/kaffevm/debug.c
diff -u kaffe/kaffe/kaffevm/debug.c:1.57 kaffe/kaffe/kaffevm/debug.c:1.58
--- kaffe/kaffe/kaffevm/debug.c:1.57	Fri Dec 10 20:54:37 2004
+++ kaffe/kaffe/kaffevm/debug.c	Sat Dec 18 07:33:19 2004
@@ -49,6 +49,7 @@
 static size_t bufferBegin = 0;
 static size_t bufferSz = 16 * 1024;
 static int bufferOutput = 0;
+int kaffe_dprintf_fd = 2;
 
 #if defined(NDEBUG) || !defined(KAFFE_VMDEBUG)
 /* --- Debugging is NOT enabled --- */
@@ -420,7 +421,7 @@
 		 */
 		max = 0;
 		while (max < n) {
-                        rc = KWRITE(2,
+                        rc = KWRITE(kaffe_dprintf_fd,
                                        debugBuffer + max,
                                        (size_t)n - max,&w);
 
Index: kaffe/kaffe/kaffevm/debug.h
diff -u kaffe/kaffe/kaffevm/debug.h:1.37 kaffe/kaffe/kaffevm/debug.h:1.38
--- kaffe/kaffe/kaffevm/debug.h:1.37	Sun Jun 29 21:07:01 2003
+++ kaffe/kaffe/kaffevm/debug.h	Sat Dec 18 07:33:19 2004
@@ -205,6 +205,7 @@
 #define KFUNC_FORMAT(archtype,fmt,arg)
 #endif
 
+extern int kaffe_dprintf_fd;
 int kaffe_dprintf(const char *fmt, ...) KFUNC_FORMAT(printf,1,2);
 
 /* Set the debugging mask to use. (give the mask) */




More information about the kaffe mailing list