From: Sebastian Lackner Subject: libwine: Add public symbol to access list of debug options. Message-Id: <8bf24267-4514-5e33-e14f-d2e44b6e6380@fds-team.de> Date: Sun, 9 Oct 2016 18:56:29 +0200 Signed-off-by: Sebastian Lackner --- Fixes https://bugs.winehq.org/show_bug.cgi?id=41457. Currently, the "edit debug channels" feature of taskmgr is broken in release builds, because: * "debug_options" is not exported as a public symbol * taskmgr passes SYMOPT_PUBLICS_ONLY to SymSetOptions This combination does not make any sense (not even installing debug packages is sufficient). This patch replaces debug_options with __wine_dbg_options and makes it a public symbol. libs/wine/debug.c | 24 ++++++++++++------------ libs/wine/wine.def | 1 + libs/wine/wine.map | 1 + programs/taskmgr/dbgchnl.c | 2 +- programs/winedbg/info.c | 2 +- 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/libs/wine/debug.c b/libs/wine/debug.c index 8b04ef9..b26dd52 100644 --- a/libs/wine/debug.c +++ b/libs/wine/debug.c @@ -44,7 +44,7 @@ static const char * const debug_classes[] = { "fixme", "err", "warn", "trace" }; static unsigned char default_flags = (1 << __WINE_DBCL_ERR) | (1 << __WINE_DBCL_FIXME); static int nb_debug_options = -1; -static struct __wine_debug_channel debug_options[MAX_DEBUG_OPTIONS]; +struct __wine_debug_channel __wine_dbg_options[MAX_DEBUG_OPTIONS]; static struct __wine_debug_functions funcs; @@ -64,8 +64,8 @@ unsigned char __wine_dbg_get_channel_flags( struct __wine_debug_channel *channel if (nb_debug_options) { - struct __wine_debug_channel *opt = bsearch( channel->name, debug_options, nb_debug_options, - sizeof(debug_options[0]), cmp_name ); + struct __wine_debug_channel *opt = bsearch( channel->name, __wine_dbg_options, nb_debug_options, + sizeof(__wine_dbg_options[0]), cmp_name ); if (opt) return opt->flags; } /* no option for this channel */ @@ -81,8 +81,8 @@ int __wine_dbg_set_channel_flags( struct __wine_debug_channel *channel, if (nb_debug_options) { - struct __wine_debug_channel *opt = bsearch( channel->name, debug_options, nb_debug_options, - sizeof(debug_options[0]), cmp_name ); + struct __wine_debug_channel *opt = bsearch( channel->name, __wine_dbg_options, nb_debug_options, + sizeof(__wine_dbg_options[0]), cmp_name ); if (opt) { opt->flags = (opt->flags & ~clear) | set; @@ -102,15 +102,15 @@ static void add_option( const char *name, unsigned char set, unsigned char clear default_flags = (default_flags & ~clear) | set; return; } - if (strlen(name) >= sizeof(debug_options[0].name)) return; + if (strlen(name) >= sizeof(__wine_dbg_options[0].name)) return; while (min <= max) { pos = (min + max) / 2; - res = strcmp( name, debug_options[pos].name ); + res = strcmp( name, __wine_dbg_options[pos].name ); if (!res) { - debug_options[pos].flags = (debug_options[pos].flags & ~clear) | set; + __wine_dbg_options[pos].flags = (__wine_dbg_options[pos].flags & ~clear) | set; return; } if (res < 0) max = pos - 1; @@ -119,10 +119,10 @@ static void add_option( const char *name, unsigned char set, unsigned char clear if (nb_debug_options >= MAX_DEBUG_OPTIONS) return; pos = min; - if (pos < nb_debug_options) memmove( &debug_options[pos + 1], &debug_options[pos], - (nb_debug_options - pos) * sizeof(debug_options[0]) ); - strcpy( debug_options[pos].name, name ); - debug_options[pos].flags = (default_flags & ~clear) | set; + if (pos < nb_debug_options) memmove( &__wine_dbg_options[pos + 1], &__wine_dbg_options[pos], + (nb_debug_options - pos) * sizeof(__wine_dbg_options[0]) ); + strcpy( __wine_dbg_options[pos].name, name ); + __wine_dbg_options[pos].flags = (default_flags & ~clear) | set; nb_debug_options++; } diff --git a/libs/wine/wine.def b/libs/wine/wine.def index ed315bd..c08c83b 100644 --- a/libs/wine/wine.def +++ b/libs/wine/wine.def @@ -2,6 +2,7 @@ LIBRARY libwine.dll EXPORTS __wine_dbg_get_channel_flags + __wine_dbg_options __wine_dbg_set_channel_flags __wine_dbg_set_functions __wine_dll_register diff --git a/libs/wine/wine.map b/libs/wine/wine.map index 2159fac..f44c66f 100644 --- a/libs/wine/wine.map +++ b/libs/wine/wine.map @@ -2,6 +2,7 @@ WINE_1.0 { global: __wine_dbg_get_channel_flags; + __wine_dbg_options; __wine_dbg_set_channel_flags; __wine_dbg_set_functions; __wine_dll_register; diff --git a/programs/taskmgr/dbgchnl.c b/programs/taskmgr/dbgchnl.c index 6e2dea0..da9a078 100644 --- a/programs/taskmgr/dbgchnl.c +++ b/programs/taskmgr/dbgchnl.c @@ -196,7 +196,7 @@ static int enum_channel(HANDLE hProcess, EnumChannelCB ce, void* user) int ret = 1; void* addr; - if (!(addr = get_symbol(hProcess, "libwine.so.1!debug_options"))) return -1; + if (!(addr = get_symbol(hProcess, "libwine.so.1!__wine_dbg_options"))) return -1; while (ret && addr && ReadProcessMemory(hProcess, addr, &channel, sizeof(channel), NULL)) { diff --git a/programs/winedbg/info.c b/programs/winedbg/info.c index e521252..33c7873 100644 --- a/programs/winedbg/info.c +++ b/programs/winedbg/info.c @@ -796,7 +796,7 @@ void info_wine_dbg_channel(BOOL turn_on, const char* cls, const char* name) return; } - if (symbol_get_lvalue("debug_options", -1, &lvalue, FALSE) != sglv_found) + if (symbol_get_lvalue("__wine_dbg_options", -1, &lvalue, FALSE) != sglv_found) { return; } -- 2.9.0