2008-08-18 Zoltan Varga <vargaz@gmail.com>
[mono.git] / mono / mini / trace.c
index a3366b226beb350b6beeb0e05257448d8cb1eee6..c6e4e82bc090379e7b9a2cb4421a7ecad19fc3fa 100644 (file)
@@ -10,7 +10,9 @@
 
 #include <config.h>
 #include <signal.h>
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
 #include <string.h>
 #include "mini.h"
 #include <mono/metadata/debug-helpers.h>
@@ -67,7 +69,7 @@ static int is_filenamechar (char p)
                return TRUE;
        if (p >= '0' && p <= '9')
                return TRUE;
-       if (p == '.' || p == ':' || p == '_')
+       if (p == '.' || p == ':' || p == '_' || p == '-')
                return TRUE;
        return FALSE;
 }
@@ -212,9 +214,9 @@ get_spec (int *last)
 }
 
 MonoTraceSpec *
-mono_trace_parse_options (char *options)
+mono_trace_parse_options (const char *options)
 {
-       char *p = options;
+       char *p = (char*)options;
        int size = 1;
        int last_used;
        int token;
@@ -227,13 +229,13 @@ mono_trace_parse_options (char *options)
                return &trace_spec;
        }
                
-       for (p = options; *p != 0; p++)
+       for (p = (char*)options; *p != 0; p++)
                if (*p == ',')
                        size++;
        
        trace_spec.ops = g_new0 (MonoTraceOperation, size);
 
-       input = options;
+       input = (char*)options;
        last_used = 0;
        
        while ((token = (get_spec (&last_used))) != TOKEN_END){
@@ -260,9 +262,7 @@ static void indent (int diff) {
        if (diff < 0)
                indent_level += diff;
        v = indent_level;
-       while (v-- > 0) {
-               printf (". ");
-       }
+       printf ("[%d] ", indent_level);
        if (diff > 0)
                indent_level += diff;
 }
@@ -310,9 +310,6 @@ mono_trace_enter_method (MonoMethod *method, char *ebp)
                printf (") ip: %p\n", __builtin_return_address (1));
                return;
        }       
-       if ((GPOINTER_TO_INT (ebp) & (MONO_ARCH_FRAME_ALIGNMENT - 1)) != 0) {
-               g_error ("unaligned stack detected (%p)", ebp);
-       }
 
        sig = mono_method_signature (method);
 
@@ -405,6 +402,8 @@ mono_trace_enter_method (MonoMethod *method, char *ebp)
                                        g_free (as);
                                } else if (class == mono_defaults.int32_class) {
                                        printf ("[INT32:%p:%d], ", o, *(gint32 *)((char *)o + sizeof (MonoObject)));
+                               } else if (class == mono_defaults.monotype_class) {
+                                       printf ("[TYPE:%s], ", mono_type_full_name (((MonoReflectionType*)o)->type));
                                } else
                                        printf ("[%s.%s:%p], ", class->name_space, class->name, o);
                        } else {