[WINESYNC] dbghelp: Return a dos path from SymGetLineFromAddr.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=34687
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id 4aa7fbe0561e6a27f098a05a63c5a7d12397e678 by Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
This commit is contained in:
winesync 2020-09-11 16:13:16 +02:00 committed by Jérôme Gardou
parent d8267536c4
commit 70880dd15f
4 changed files with 25 additions and 9 deletions

View file

@ -50,6 +50,8 @@ static __inline const char *debugstr_wn( const WCHAR *s, int n ) { return wine_d
static __inline const char *debugstr_a( const char *s ) { return wine_dbgstr_an( s, -1 ); } static __inline const char *debugstr_a( const char *s ) { return wine_dbgstr_an( s, -1 ); }
static __inline const char *debugstr_w( const WCHAR *s ) { return wine_dbgstr_wn( s, -1 ); } static __inline const char *debugstr_w( const WCHAR *s ) { return wine_dbgstr_wn( s, -1 ); }
static __inline const char *wine_dbgstr_w( const WCHAR *s ){return wine_dbgstr_wn( s, -1 );} static __inline const char *wine_dbgstr_w( const WCHAR *s ){return wine_dbgstr_wn( s, -1 );}
/* This should never be called */
#define wine_get_dos_file_name(__x) (assert(0), NULL)
#if 0 #if 0
#define WARN(fmt, ...) fprintf(stderr, "WARN %s: " fmt, __FUNCTION__, ##__VA_ARGS__) #define WARN(fmt, ...) fprintf(stderr, "WARN %s: " fmt, __FUNCTION__, ##__VA_ARGS__)
@ -829,6 +831,13 @@ typedef struct _IMAGEHLP_LINE64
PCHAR FileName; PCHAR FileName;
DWORD64 Address; DWORD64 Address;
} IMAGEHLP_LINE64, *PIMAGEHLP_LINE64; } IMAGEHLP_LINE64, *PIMAGEHLP_LINE64;
typedef enum
{
SYMOPT_EX_DISABLEACCESSTIMEUPDATE,
SYMOPT_EX_MAX,
/* __WINESRC__ */
SYMOPT_EX_WINE_NATIVE_MODULES = 1000
} IMAGEHLP_EXTENDED_OPTIONS;
typedef struct _SRCCODEINFO typedef struct _SRCCODEINFO
{ {
DWORD SizeOfStruct; DWORD SizeOfStruct;
@ -859,6 +868,7 @@ PVOID WINAPI SymFunctionTableAccess64(HANDLE, DWORD64);
BOOL WINAPI SymFromAddr(HANDLE hProcess, DWORD64 Address, DWORD64* Displacement, PSYMBOL_INFO Symbol); BOOL WINAPI SymFromAddr(HANDLE hProcess, DWORD64 Address, DWORD64* Displacement, PSYMBOL_INFO Symbol);
BOOL WINAPI SymEnumLines(HANDLE hProcess, ULONG64 base, PCSTR compiland, PCSTR srcfile, PSYM_ENUMLINES_CALLBACK cb, PVOID user); BOOL WINAPI SymEnumLines(HANDLE hProcess, ULONG64 base, PCSTR compiland, PCSTR srcfile, PSYM_ENUMLINES_CALLBACK cb, PVOID user);
DWORD WINAPI SymSetOptions(DWORD opts); DWORD WINAPI SymSetOptions(DWORD opts);
BOOL WINAPI SymSetExtendedOption(IMAGEHLP_EXTENDED_OPTIONS option, BOOL value);
BOOL WINAPI SymGetLineFromAddr64(HANDLE hProcess, DWORD64 dwAddr, PDWORD pdwDisplacement, PIMAGEHLP_LINE64 Line); BOOL WINAPI SymGetLineFromAddr64(HANDLE hProcess, DWORD64 dwAddr, PDWORD pdwDisplacement, PIMAGEHLP_LINE64 Line);
typedef BOOL (CALLBACK *PFIND_EXE_FILE_CALLBACKW)(HANDLE, PCWSTR, PVOID); typedef BOOL (CALLBACK *PFIND_EXE_FILE_CALLBACKW)(HANDLE, PCWSTR, PVOID);
#define FindExecutableImageExW __FindExecutableImageExW #define FindExecutableImageExW __FindExecutableImageExW
@ -1296,13 +1306,6 @@ typedef struct API_VERSION
USHORT Revision; USHORT Revision;
USHORT Reserved; USHORT Reserved;
} API_VERSION, *LPAPI_VERSION; } API_VERSION, *LPAPI_VERSION;
typedef enum
{
SYMOPT_EX_DISABLEACCESSTIMEUPDATE,
SYMOPT_EX_MAX,
/* __WINESRC__ */
SYMOPT_EX_WINE_NATIVE_MODULES = 1000
} IMAGEHLP_EXTENDED_OPTIONS;
// cvconst.h // cvconst.h
/* symbols & types enumeration */ /* symbols & types enumeration */

View file

@ -1502,7 +1502,19 @@ BOOL symt_fill_func_line_info(const struct module* module, const struct symt_fun
} }
if (found) if (found)
{ {
line->FileName = (char*)source_get(module, dli->u.source_file); if (dbghelp_opt_native)
{
/* Return native file paths when using winedbg */
line->FileName = (char*)source_get(module, dli->u.source_file);
}
else
{
WCHAR *dospath = wine_get_dos_file_name(source_get(module, dli->u.source_file));
DWORD len = WideCharToMultiByte(CP_ACP, 0, dospath, -1, NULL, 0, NULL, NULL);
line->FileName = fetch_buffer(module->process, len);
WideCharToMultiByte(CP_ACP, 0, dospath, -1, line->FileName, len, NULL, NULL);
HeapFree( GetProcessHeap(), 0, dospath );
}
return TRUE; return TRUE;
} }
} }

View file

@ -1357,6 +1357,7 @@ int main(int argc, char* argv[])
// SYMOPT_LOAD_ANYTHING // SYMOPT_LOAD_ANYTHING
// SYMOPT_LOAD_LINES // SYMOPT_LOAD_LINES
SymSetOptions(0x10000 | 0x800000 | 0x40 | 0x10); SymSetOptions(0x10000 | 0x800000 | 0x40 | 0x10);
SymSetExtendedOption(SYMOPT_EX_WINE_NATIVE_MODULES, TRUE);
SymInitialize(FileData, ".", 0); SymInitialize(FileData, ".", 0);
module_base = SymLoadModule(FileData, file, path1, path1, 0, FileSize) & 0xffffffff; module_base = SymLoadModule(FileData, file, path1, path1, 0, FileSize) & 0xffffffff;

View file

@ -4,4 +4,4 @@ files:
include/dbghelp.h: sdk/include/psdk/dbghelp.h include/dbghelp.h: sdk/include/psdk/dbghelp.h
include/wine/mscvpdb.h: sdk/include/reactos/wine/mscvpdb.h include/wine/mscvpdb.h: sdk/include/reactos/wine/mscvpdb.h
tags: tags:
wine: 101820d01a1c776e4b6ff42e661ac3a1380f10c7 wine: 4aa7fbe0561e6a27f098a05a63c5a7d12397e678