From: Eric Pouech epouech@codeweavers.com
Currently, dbghelp returns the source file either: - in DOS format when native module option isn't enabled - as stored in debug info format otherwise
This used to work for PE modules inside ELF shared libraries but is broken since evolution to REAL modules. This generates several issues: - winedbg does not always set the native module option when calling dbghelp for source file related functions, leading to heterogenous output to user - some dbghelp function rely on matching source paths, hence leading to errors in winedbg when mixing the two formats for the same source file.
Introduce a new Wine only dbghelp option to return the source paths as they are stored inside debug information format, and activate it unconditionaly inside winedbg.
This fixes some failure cases of command 'break <NN>' in winedbg.
Signed-off-by: Eric Pouech epouech@codeweavers.com --- dlls/dbghelp/dbghelp.c | 7 +++++++ dlls/dbghelp/dbghelp_private.h | 1 + dlls/dbghelp/symbol.c | 2 +- include/dbghelp.h | 4 ++++ programs/winedbg/winedbg.c | 2 ++ 5 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/dlls/dbghelp/dbghelp.c b/dlls/dbghelp/dbghelp.c index 3341bea442e..d3003fc44d2 100644 --- a/dlls/dbghelp/dbghelp.c +++ b/dlls/dbghelp/dbghelp.c @@ -68,6 +68,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(dbghelp); unsigned dbghelp_options = SYMOPT_UNDNAME; BOOL dbghelp_opt_native = FALSE; BOOL dbghelp_opt_real_path = FALSE; +BOOL dbghelp_opt_source_actual_path = FALSE; SYSTEM_INFO sysinfo;
static struct process* process_first /* = NULL */; @@ -619,6 +620,10 @@ BOOL WINAPI SymSetExtendedOption(IMAGEHLP_EXTENDED_OPTIONS option, BOOL value) old = dbghelp_opt_real_path; dbghelp_opt_real_path = value; break; + case SYMOPT_EX_WINE_SOURCE_ACTUAL_PATH: + old = dbghelp_opt_source_actual_path; + dbghelp_opt_source_actual_path = value; + break; default: FIXME("Unsupported option %d with value %d\n", option, value); } @@ -638,6 +643,8 @@ BOOL WINAPI SymGetExtendedOption(IMAGEHLP_EXTENDED_OPTIONS option) return dbghelp_opt_native; case SYMOPT_EX_WINE_MODULE_REAL_PATH: return dbghelp_opt_real_path; + case SYMOPT_EX_WINE_SOURCE_ACTUAL_PATH: + return dbghelp_opt_source_actual_path; default: FIXME("Unsupported option %d\n", option); } diff --git a/dlls/dbghelp/dbghelp_private.h b/dlls/dbghelp/dbghelp_private.h index 9a9773269af..7ba10447771 100644 --- a/dlls/dbghelp/dbghelp_private.h +++ b/dlls/dbghelp/dbghelp_private.h @@ -112,6 +112,7 @@ void* hash_table_iter_up(struct hash_table_iter* hti) DECLSPEC_HIDDEN; extern unsigned dbghelp_options DECLSPEC_HIDDEN; extern BOOL dbghelp_opt_native DECLSPEC_HIDDEN; extern BOOL dbghelp_opt_real_path DECLSPEC_HIDDEN; +extern BOOL dbghelp_opt_source_actual_path DECLSPEC_HIDDEN; extern SYSTEM_INFO sysinfo DECLSPEC_HIDDEN;
/* FIXME: this could be optimized later on by using relative offsets and smaller integral sizes */ diff --git a/dlls/dbghelp/symbol.c b/dlls/dbghelp/symbol.c index e3352761c53..5579d79bf48 100644 --- a/dlls/dbghelp/symbol.c +++ b/dlls/dbghelp/symbol.c @@ -1882,7 +1882,7 @@ static BOOL get_line_from_function(struct module_pair* pair, struct symt_functio if (found_dli) { BOOL ret; - if (dbghelp_opt_native) + if (dbghelp_opt_source_actual_path) { /* Return native file paths when using winedbg */ ret = internal_line_set_nameA(pair->pcs, intl, (char*)source_get(pair->effective, dli->u.source_file), FALSE); diff --git a/include/dbghelp.h b/include/dbghelp.h index fda8fefa35f..84fa7e10595 100644 --- a/include/dbghelp.h +++ b/include/dbghelp.h @@ -1098,8 +1098,12 @@ typedef enum SYMOPT_EX_MAX,
#ifdef __WINESRC__ + /* Include ELF/Mach-O modules in module operations */ SYMOPT_EX_WINE_NATIVE_MODULES = 1000, + /* Return the Unix actual path of loaded module */ SYMOPT_EX_WINE_MODULE_REAL_PATH, + /* Return the raw source file path from debug info (not always mapped to DOS) */ + SYMOPT_EX_WINE_SOURCE_ACTUAL_PATH, #endif } IMAGEHLP_EXTENDED_OPTIONS;
diff --git a/programs/winedbg/winedbg.c b/programs/winedbg/winedbg.c index 9815ed4a046..e7ba6afa2e4 100644 --- a/programs/winedbg/winedbg.c +++ b/programs/winedbg/winedbg.c @@ -722,6 +722,8 @@ int main(int argc, char** argv) SYMOPT_LOAD_LINES | SYMOPT_DEFERRED_LOADS | SYMOPT_AUTO_PUBLICS | SYMOPT_INCLUDE_32BIT_MODULES);
+ SymSetExtendedOption(SYMOPT_EX_WINE_SOURCE_ACTUAL_PATH, TRUE); + if (argc && !strcmp(argv[0], "--auto")) { switch (dbg_active_auto(argc, argv))