winedbg: Use GetMappedFileNameW() as fallback when fetching module names.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
39b20a2bd3
commit
c050df1250
|
@ -419,6 +419,7 @@ extern enum dbg_start dbg_active_auto(int argc, char* argv[]);
|
||||||
extern enum dbg_start dbg_active_minidump(int argc, char* argv[]);
|
extern enum dbg_start dbg_active_minidump(int argc, char* argv[]);
|
||||||
extern void dbg_active_wait_for_first_exception(void);
|
extern void dbg_active_wait_for_first_exception(void);
|
||||||
extern BOOL dbg_attach_debuggee(DWORD pid);
|
extern BOOL dbg_attach_debuggee(DWORD pid);
|
||||||
|
extern void fetch_module_name(void* name_addr, void* mod_addr, WCHAR* buffer, size_t bufsz);
|
||||||
|
|
||||||
/* tgt_minidump.c */
|
/* tgt_minidump.c */
|
||||||
extern void minidump_write(const char*, const EXCEPTION_RECORD*);
|
extern void minidump_write(const char*, const EXCEPTION_RECORD*);
|
||||||
|
|
|
@ -443,10 +443,8 @@ static BOOL handle_debug_event(struct gdb_context* gdbctx)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
case LOAD_DLL_DEBUG_EVENT:
|
case LOAD_DLL_DEBUG_EVENT:
|
||||||
memory_get_string_indirect(gdbctx->process,
|
fetch_module_name( de->u.LoadDll.lpImageName, de->u.LoadDll.lpBaseOfDll,
|
||||||
de->u.LoadDll.lpImageName,
|
u.buffer, ARRAY_SIZE(u.buffer) );
|
||||||
de->u.LoadDll.fUnicode,
|
|
||||||
u.buffer, ARRAY_SIZE(u.buffer));
|
|
||||||
fprintf(stderr, "%04x:%04x: loads DLL %s @%p (%u<%u>)\n",
|
fprintf(stderr, "%04x:%04x: loads DLL %s @%p (%u<%u>)\n",
|
||||||
de->dwProcessId, de->dwThreadId,
|
de->dwProcessId, de->dwThreadId,
|
||||||
dbg_W2A(u.buffer, -1),
|
dbg_W2A(u.buffer, -1),
|
||||||
|
|
|
@ -296,16 +296,23 @@ static DWORD dbg_handle_exception(const EXCEPTION_RECORD* rec, BOOL first_chance
|
||||||
|
|
||||||
static BOOL tgt_process_active_close_process(struct dbg_process* pcs, BOOL kill);
|
static BOOL tgt_process_active_close_process(struct dbg_process* pcs, BOOL kill);
|
||||||
|
|
||||||
static void fetch_module_name(void* name_addr, BOOL unicode, void* mod_addr,
|
void fetch_module_name(void* name_addr, void* mod_addr, WCHAR* buffer, size_t bufsz)
|
||||||
WCHAR* buffer, size_t bufsz)
|
|
||||||
{
|
{
|
||||||
static const WCHAR dlladdr[] = {'D','L','L','_','%','0','8','l','x',0};
|
static const WCHAR dlladdr[] = {'D','L','L','_','%','0','8','l','x',0};
|
||||||
|
|
||||||
memory_get_string_indirect(dbg_curr_process, name_addr, unicode, buffer, bufsz);
|
memory_get_string_indirect(dbg_curr_process, name_addr, TRUE, buffer, bufsz);
|
||||||
if (!buffer[0] &&
|
if (!buffer[0] && !GetModuleFileNameExW(dbg_curr_process->handle, mod_addr, buffer, bufsz))
|
||||||
!GetModuleFileNameExW(dbg_curr_process->handle, mod_addr, buffer, bufsz))
|
|
||||||
{
|
{
|
||||||
snprintfW(buffer, bufsz, dlladdr, (ULONG_PTR)mod_addr);
|
if (GetMappedFileNameW( dbg_curr_process->handle, mod_addr, buffer, bufsz ))
|
||||||
|
{
|
||||||
|
/* FIXME: proper NT->Dos conversion */
|
||||||
|
static const WCHAR nt_prefixW[] = {'\\','?','?','\\'};
|
||||||
|
|
||||||
|
if (!strncmpW( buffer, nt_prefixW, 4 ))
|
||||||
|
memmove( buffer, buffer + 4, (lstrlenW(buffer + 4) + 1) * sizeof(WCHAR) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
snprintfW(buffer, bufsz, dlladdr, (ULONG_PTR)mod_addr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -462,9 +469,7 @@ static unsigned dbg_handle_debug_event(DEBUG_EVENT* de)
|
||||||
WINE_ERR("Unknown thread\n");
|
WINE_ERR("Unknown thread\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
fetch_module_name(de->u.LoadDll.lpImageName,
|
fetch_module_name(de->u.LoadDll.lpImageName, de->u.LoadDll.lpBaseOfDll,
|
||||||
de->u.LoadDll.fUnicode,
|
|
||||||
de->u.LoadDll.lpBaseOfDll,
|
|
||||||
u.buffer, ARRAY_SIZE(u.buffer));
|
u.buffer, ARRAY_SIZE(u.buffer));
|
||||||
|
|
||||||
WINE_TRACE("%04x:%04x: loads DLL %s @%p (%u<%u>)\n",
|
WINE_TRACE("%04x:%04x: loads DLL %s @%p (%u<%u>)\n",
|
||||||
|
|
Loading…
Reference in New Issue