mscoree: Add WINE_MONO_VERBOSE environment setting.

Vincent Povirk madewokherd at gmail.com
Wed Feb 27 14:40:06 CST 2013


This is mostly useful for debugging the Mono JIT, or correlating
backtraces from winedbg with managed code methods. The level of
verbosity can be any integer from 0 to 4 (other integers won't break
anything, but they're not useful either, hence my laziness in parsing
the value).
-------------- next part --------------
From 40934de43d326dd7c90f8f7b95728341ad41142f Mon Sep 17 00:00:00 2001
From: Vincent Povirk <vincent at codeweavers.com>
Date: Wed, 27 Feb 2013 09:46:43 -0600
Subject: [PATCH] mscoree: Add WINE_MONO_VERBOSE environment setting.

---
 dlls/mscoree/metahost.c        | 10 ++++++++++
 dlls/mscoree/mscoree_private.h |  1 +
 2 files changed, 11 insertions(+)

diff --git a/dlls/mscoree/metahost.c b/dlls/mscoree/metahost.c
index eb3bc93..143494c 100644
--- a/dlls/mscoree/metahost.c
+++ b/dlls/mscoree/metahost.c
@@ -138,6 +138,8 @@ static HRESULT load_mono(CLRRuntimeInfo *This, loaded_mono **result)
     char mono_lib_path_a[MAX_PATH], mono_etc_path_a[MAX_PATH];
     int trace_size;
     char trace_setting[256];
+    int verbose_size;
+    char verbose_setting[256];
 
     if (This->mono_abi_version <= 0 || This->mono_abi_version > NUM_ABI_VERSIONS)
     {
@@ -204,6 +206,7 @@ static HRESULT load_mono(CLRRuntimeInfo *This, loaded_mono **result)
         LOAD_MONO_FUNCTION(mono_runtime_object_init);
         LOAD_MONO_FUNCTION(mono_runtime_quit);
         LOAD_MONO_FUNCTION(mono_set_dirs);
+        LOAD_MONO_FUNCTION(mono_set_verbose_level);
         LOAD_MONO_FUNCTION(mono_stringify_assembly_name);
         LOAD_MONO_FUNCTION(mono_string_new);
         LOAD_MONO_FUNCTION(mono_thread_attach);
@@ -254,6 +257,13 @@ static HRESULT load_mono(CLRRuntimeInfo *This, loaded_mono **result)
         {
             (*result)->mono_jit_set_trace_options(trace_setting);
         }
+
+        verbose_size = GetEnvironmentVariableA("WINE_MONO_VERBOSE", verbose_setting, sizeof(verbose_setting));
+
+        if (verbose_size)
+        {
+            (*result)->mono_set_verbose_level(verbose_setting[0] - '0');
+        }
     }
 
     return S_OK;
diff --git a/dlls/mscoree/mscoree_private.h b/dlls/mscoree/mscoree_private.h
index f7e9c11..4677921 100644
--- a/dlls/mscoree/mscoree_private.h
+++ b/dlls/mscoree/mscoree_private.h
@@ -171,6 +171,7 @@ struct loaded_mono
     void (CDECL *mono_runtime_quit)(void);
     void (CDECL *mono_runtime_set_shutting_down)(void);
     void (CDECL *mono_set_dirs)(const char *assembly_dir, const char *config_dir);
+    void (CDECL *mono_set_verbose_level)(DWORD level);
     char* (CDECL *mono_stringify_assembly_name)(MonoAssemblyName *aname);
     void (CDECL *mono_thread_pool_cleanup)(void);
     void (CDECL *mono_thread_suspend_all_other_threads)(void);
-- 
1.8.1.2


More information about the wine-patches mailing list