Commit 812b4b1c authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

dbghelp: Use source file path as stored in debug info format.

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: 's avatarEric Pouech <epouech@codeweavers.com>
parent fd87ddfa
...@@ -68,6 +68,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(dbghelp); ...@@ -68,6 +68,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(dbghelp);
unsigned dbghelp_options = SYMOPT_UNDNAME; unsigned dbghelp_options = SYMOPT_UNDNAME;
BOOL dbghelp_opt_native = FALSE; BOOL dbghelp_opt_native = FALSE;
BOOL dbghelp_opt_real_path = FALSE; BOOL dbghelp_opt_real_path = FALSE;
BOOL dbghelp_opt_source_actual_path = FALSE;
SYSTEM_INFO sysinfo; SYSTEM_INFO sysinfo;
static struct process* process_first /* = NULL */; static struct process* process_first /* = NULL */;
...@@ -619,6 +620,10 @@ BOOL WINAPI SymSetExtendedOption(IMAGEHLP_EXTENDED_OPTIONS option, BOOL value) ...@@ -619,6 +620,10 @@ BOOL WINAPI SymSetExtendedOption(IMAGEHLP_EXTENDED_OPTIONS option, BOOL value)
old = dbghelp_opt_real_path; old = dbghelp_opt_real_path;
dbghelp_opt_real_path = value; dbghelp_opt_real_path = value;
break; break;
case SYMOPT_EX_WINE_SOURCE_ACTUAL_PATH:
old = dbghelp_opt_source_actual_path;
dbghelp_opt_source_actual_path = value;
break;
default: default:
FIXME("Unsupported option %d with value %d\n", option, value); FIXME("Unsupported option %d with value %d\n", option, value);
} }
...@@ -638,6 +643,8 @@ BOOL WINAPI SymGetExtendedOption(IMAGEHLP_EXTENDED_OPTIONS option) ...@@ -638,6 +643,8 @@ BOOL WINAPI SymGetExtendedOption(IMAGEHLP_EXTENDED_OPTIONS option)
return dbghelp_opt_native; return dbghelp_opt_native;
case SYMOPT_EX_WINE_MODULE_REAL_PATH: case SYMOPT_EX_WINE_MODULE_REAL_PATH:
return dbghelp_opt_real_path; return dbghelp_opt_real_path;
case SYMOPT_EX_WINE_SOURCE_ACTUAL_PATH:
return dbghelp_opt_source_actual_path;
default: default:
FIXME("Unsupported option %d\n", option); FIXME("Unsupported option %d\n", option);
} }
......
...@@ -112,6 +112,7 @@ void* hash_table_iter_up(struct hash_table_iter* hti) DECLSPEC_HIDDEN; ...@@ -112,6 +112,7 @@ void* hash_table_iter_up(struct hash_table_iter* hti) DECLSPEC_HIDDEN;
extern unsigned dbghelp_options DECLSPEC_HIDDEN; extern unsigned dbghelp_options DECLSPEC_HIDDEN;
extern BOOL dbghelp_opt_native DECLSPEC_HIDDEN; extern BOOL dbghelp_opt_native DECLSPEC_HIDDEN;
extern BOOL dbghelp_opt_real_path 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; extern SYSTEM_INFO sysinfo DECLSPEC_HIDDEN;
/* FIXME: this could be optimized later on by using relative offsets and smaller integral sizes */ /* FIXME: this could be optimized later on by using relative offsets and smaller integral sizes */
......
...@@ -1882,7 +1882,7 @@ static BOOL get_line_from_function(struct module_pair* pair, struct symt_functio ...@@ -1882,7 +1882,7 @@ static BOOL get_line_from_function(struct module_pair* pair, struct symt_functio
if (found_dli) if (found_dli)
{ {
BOOL ret; BOOL ret;
if (dbghelp_opt_native) if (dbghelp_opt_source_actual_path)
{ {
/* Return native file paths when using winedbg */ /* 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); ret = internal_line_set_nameA(pair->pcs, intl, (char*)source_get(pair->effective, dli->u.source_file), FALSE);
......
...@@ -1098,8 +1098,12 @@ typedef enum ...@@ -1098,8 +1098,12 @@ typedef enum
SYMOPT_EX_MAX, SYMOPT_EX_MAX,
#ifdef __WINESRC__ #ifdef __WINESRC__
/* Include ELF/Mach-O modules in module operations */
SYMOPT_EX_WINE_NATIVE_MODULES = 1000, SYMOPT_EX_WINE_NATIVE_MODULES = 1000,
/* Return the Unix actual path of loaded module */
SYMOPT_EX_WINE_MODULE_REAL_PATH, 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 #endif
} IMAGEHLP_EXTENDED_OPTIONS; } IMAGEHLP_EXTENDED_OPTIONS;
......
...@@ -722,6 +722,8 @@ int main(int argc, char** argv) ...@@ -722,6 +722,8 @@ int main(int argc, char** argv)
SYMOPT_LOAD_LINES | SYMOPT_DEFERRED_LOADS | SYMOPT_AUTO_PUBLICS | SYMOPT_LOAD_LINES | SYMOPT_DEFERRED_LOADS | SYMOPT_AUTO_PUBLICS |
SYMOPT_INCLUDE_32BIT_MODULES); SYMOPT_INCLUDE_32BIT_MODULES);
SymSetExtendedOption(SYMOPT_EX_WINE_SOURCE_ACTUAL_PATH, TRUE);
if (argc && !strcmp(argv[0], "--auto")) if (argc && !strcmp(argv[0], "--auto"))
{ {
switch (dbg_active_auto(argc, argv)) switch (dbg_active_auto(argc, argv))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment