src/vm/options.h: Added the commandlineswitch --verbosecolor which enables
authortbfg <none@none>
Fri, 18 Aug 2006 18:37:19 +0000 (18:37 +0000)
committertbfg <none@none>
Fri, 18 Aug 2006 18:37:19 +0000 (18:37 +0000)
colored output of show: -si prints method names in red -sd shows datasegment
dump in blue. (use | less -R)

src/vm/options.c (options_get): There is a nasty bug in there, read comment.

src/vm/jit/Makefile.am
src/vm/jit/dseg.c
src/vm/method.c
src/vm/options.c
src/vm/options.h
src/vm/vm.c

index 60aa36c63c4f109c2725b438389ccfbaee5b8a55..7b920455562828b56a5aa9c3ca75c1e184052b89 100644 (file)
@@ -28,7 +28,7 @@
 ##
 ## Changes: Edwin Steiner
 ##
-## $Id: Makefile.am 5234 2006-08-14 17:50:12Z christian $
+## $Id: Makefile.am 5253 2006-08-18 18:37:19Z tbfg $
 
 ## Process this file with automake to produce Makefile.in
 
@@ -144,7 +144,8 @@ libjit_la_SOURCES = \
        stack.c \
        stack.h \
        stacktrace.c \
-       stacktrace.h
+       stacktrace.h \
+       ../options.h
 
 libjit_la_SOURCES += \
        cfg.c \
index f67fa3ef724f1ea9a3df8288a5dc93e9c92c4849..4eba934780c1a7d6331929e7d5085b217544366a 100644 (file)
@@ -31,7 +31,7 @@
             Joseph Wenninger
                        Edwin Steiner
 
-   $Id: dseg.c 5186 2006-07-28 13:24:43Z twisti $
+   $Id: dseg.c 5253 2006-08-18 18:37:19Z tbfg $
 
 */
 
 
 #include <assert.h>
 
+#include "vm/options.h"
 #include "vm/types.h"
 
 #include "mm/memory.h"
 #include "vm/jit/codegen-common.h"
 
 
+
 /* dseg_finish *****************************************************************
 
    Fills the data segment with the values stored.
@@ -799,6 +801,7 @@ void dseg_display(jitdata *jd)
 
        s4ptr = (s4 *) (ptrint) code->mcode;
 
+       if (opt_colorverbose) printf("\033[34m");       /* blue */
        printf("  --- dump of datasegment\n");
 
        for (i = cd->dseglen; i > 0 ; i -= 4) {
@@ -813,6 +816,7 @@ void dseg_display(jitdata *jd)
        }
 
        printf("  --- begin of data segment: %p\n", (void *) s4ptr);
+       if (opt_colorverbose) printf("\033[m");
 }
 #endif /* !defined(NDEBUG) */
 
index 6857e65c9c7f5bfcd866e92a90afe0eb83ad9002..6bbb8c7ac1c36fb2809e583acaf8382a07940d52 100644 (file)
@@ -32,7 +32,7 @@
             Edwin Steiner
             Christian Thalinger
 
-   $Id: method.c 5038 2006-06-19 22:22:34Z twisti $
+   $Id: method.c 5253 2006-08-18 18:37:19Z tbfg $
 
 */
 
@@ -50,6 +50,7 @@
 #include "vm/linker.h"
 #include "vm/loader.h"
 #include "vm/method.h"
+#include "vm/options.h"
 #include "vm/jit/methodheader.h"
 
 
@@ -212,7 +213,9 @@ void method_print(methodinfo *m)
 #if !defined(NDEBUG)
 void method_println(methodinfo *m)
 {
+       if (opt_colorverbose) printf("\033[31m");       /* red */
        method_print(m);
+       if (opt_colorverbose) printf("\033[m"); 
        printf("\n");
 }
 #endif /* !defined(NDEBUG) */
index 65efad16d13db25543505085fdaf56a5879cd012..6b8b666567db35fc0e53b473748a58e2ec252b92 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes:
 
-   $Id: options.c 5234 2006-08-14 17:50:12Z christian $
+   $Id: options.c 5253 2006-08-18 18:37:19Z tbfg $
 
 */
 
@@ -68,6 +68,7 @@ s4   opt_heapstartsize = 0;     /* initial heap size                          */
 s4   opt_stacksize     = 0;     /* thread stack size                          */
 
 bool opt_verbose = false;
+bool opt_colorverbose = false; /* use ANSI terminal sequences                */
 bool compileall = false;
 
 bool loadverbose = false;
@@ -198,6 +199,10 @@ s4 options_get(opt_struct *opts, JavaVMInitArgs *vm_args)
                        } else {
                                /* parameter and option have no space between */
 
+                               /* FIXME: this assumption is plain wrong, hits you if there is a
+                                * parameter with no argument starting with same letter as param with argument
+                                * but named after that one, ouch! */
+
                                size_t l = strlen(opts[i].name);
 
                                if (strlen(option + 1) > l) {
index 700b9c950f49945b92ac0d535b380930bf063570..292b145fa4761af5cd4113e2d98e531a752857ce 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes:
 
-   $Id: options.h 5234 2006-08-14 17:50:12Z christian $
+   $Id: options.h 5253 2006-08-18 18:37:19Z tbfg $
 
 */
 
@@ -80,6 +80,7 @@ extern s4   opt_heapstartsize;
 extern s4   opt_stacksize;
 
 extern bool opt_verbose;
+extern bool opt_colorverbose;
 extern bool compileall;
 
 extern bool loadverbose;         /* Print debug messages during loading */
index 6eb3dad0b32c2b3d9a2ecd5ab98d40e950e1b23a..2a9325df55ad4387dcee290fa75a2d648e88a168 100644 (file)
@@ -167,6 +167,7 @@ enum {
        OPT_METHOD,
        OPT_SIGNATURE,
        OPT_SHOW,
+       OPT_COLORVERBOSE,
        OPT_ALL,
 
 #if defined(ENABLE_VERIFIER)
@@ -329,6 +330,7 @@ opt_struct opts[] = {
 #endif
        { "m",                 true,  OPT_METHOD },
        { "s",                 true,  OPT_SHOW },
+       { "verbosecolor",     false,  OPT_COLORVERBOSE },
 
        { NULL,                false, 0 }
 };
@@ -380,6 +382,7 @@ void usage(void)
        puts("    -v                       write state-information");
        puts("    -verbose[:call|exception|jit]");
        puts("                             enable specific verbose output");
+       puts("    -verbosecolor            colored output for ANSI terms");
 #ifdef TYPECHECK_VERBOSE
        puts("    -verbosetc               write debug messages while typechecking");
 #endif
@@ -858,6 +861,9 @@ bool vm_create(JavaVMInitArgs *vm_args)
                        else if (strcmp("exception", opt_arg) == 0)
                                opt_verboseexception = true;
                        break;
+               case OPT_COLORVERBOSE:
+                       opt_colorverbose = true;
+                       break;
 
 #if defined(ENABLE_VERIFIER) && defined(TYPECHECK_VERBOSE)
                case OPT_VERBOSETC: