2004-11-04 Zoltan Varga <vargaz@freemail.hu>
[mono.git] / mono / interpreter / interp.c
index 10b043bd012af29c45262bdec47bdb4833643294..893d736c90b7131fab3d48f099dece4376866a12 100644 (file)
@@ -669,13 +669,17 @@ ves_array_element_address (MonoInvocation *frame)
 }
 
 static void
-interp_walk_stack (MonoStackWalk func, gpointer user_data)
+interp_walk_stack (MonoStackWalk func, gboolean do_il_offset, gpointer user_data)
 {
        ThreadContext *context = TlsGetValue (thread_context_id);
-       MonoInvocation *frame = context->current_frame;
+       MonoInvocation *frame;
        int il_offset;
        MonoMethodHeader *hd;
 
+       if (!context) return;
+               
+       frame = context->current_frame;
+
        while (frame) {
                gboolean managed = FALSE;
                MonoMethod *method = frame->runtime_method->method;
@@ -4379,7 +4383,8 @@ mono_interp_init(const char *file)
        g_log_set_always_fatal (G_LOG_LEVEL_ERROR);
        g_log_set_fatal_mask (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR);
 
-       g_thread_init (NULL);
+       if (!g_thread_supported ())
+               g_thread_init (NULL);
 
        thread_context_id = TlsAlloc ();
        TlsSetValue (thread_context_id, NULL);
@@ -4410,6 +4415,7 @@ mono_interp_init(const char *file)
 
        mono_runtime_init (domain, NULL, NULL);
 
+       mono_thread_attach (domain);
        return domain;
 }
 
@@ -4427,6 +4433,8 @@ mono_main (int argc, char *argv [])
        if (argc < 2)
                usage ();
 
+       MONO_GC_PRE_INIT ();
+       
        for (i = 1; i < argc && argv [i][0] == '-'; i++){
                if (strcmp (argv [i], "--trace") == 0)
                        global_tracing = 1;