[PATCH resend] winedbg: Try to load debug symbols for executable in gdb mode.
Signed-off-by: Bernhard Übelacker <bernhardu(a)mailbox.org> ---- This loads the debug information similar to LOAD_DLL_DEBUG_EVENT for dll's a few lines below, or CREATE_PROCESS_DEBUG_EVENT for exe's in winedbg/tgt_active.c. It should be an improvement just for real PE executables. For .exe.so files the debug information gets loaded via the ELF enumeration, with this patch 'info share' shows a line for the fake exe additional to the .exe.so line. First submission: https://www.winehq.org/pipermail/wine-devel/2021-May/186536.html --- programs/winedbg/gdbproxy.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/programs/winedbg/gdbproxy.c b/programs/winedbg/gdbproxy.c index 478e0d16fe0..d768a8a585c 100644 --- a/programs/winedbg/gdbproxy.c +++ b/programs/winedbg/gdbproxy.c @@ -437,6 +437,17 @@ static BOOL handle_debug_event(struct gdb_context* gdbctx) fprintf(stderr, "%04x:%04x: create thread I @%p\n", de->dwProcessId, de->dwThreadId, de->u.CreateProcessInfo.lpStartAddress); + fetch_module_name( de->u.CreateProcessInfo.lpImageName, de->u.CreateProcessInfo.lpBaseOfImage, + u.buffer, ARRAY_SIZE(u.buffer) ); + fprintf(stderr, "%04x:%04x: loads EXE %s @%p (%u<%u>)\n", + de->dwProcessId, de->dwThreadId, + dbg_W2A(u.buffer, -1), + de->u.CreateProcessInfo.lpBaseOfImage, + de->u.CreateProcessInfo.dwDebugInfoFileOffset, + de->u.CreateProcessInfo.nDebugInfoSize); + dbg_load_module(gdbctx->process->handle, de->u.CreateProcessInfo.hFile, u.buffer, + (DWORD_PTR)de->u.CreateProcessInfo.lpBaseOfImage, 0); + dbg_add_thread(gdbctx->process, de->dwThreadId, de->u.CreateProcessInfo.hThread, de->u.CreateProcessInfo.lpThreadLocalBase); -- 2.30.2
Bernhard Übelacker <bernhardu(a)mailbox.org> writes:
diff --git a/programs/winedbg/gdbproxy.c b/programs/winedbg/gdbproxy.c index 478e0d16fe0..d768a8a585c 100644 --- a/programs/winedbg/gdbproxy.c +++ b/programs/winedbg/gdbproxy.c @@ -437,6 +437,17 @@ static BOOL handle_debug_event(struct gdb_context* gdbctx) fprintf(stderr, "%04x:%04x: create thread I @%p\n", de->dwProcessId, de->dwThreadId, de->u.CreateProcessInfo.lpStartAddress);
+ fetch_module_name( de->u.CreateProcessInfo.lpImageName, de->u.CreateProcessInfo.lpBaseOfImage, + u.buffer, ARRAY_SIZE(u.buffer) ); + fprintf(stderr, "%04x:%04x: loads EXE %s @%p (%u<%u>)\n", + de->dwProcessId, de->dwThreadId, + dbg_W2A(u.buffer, -1), + de->u.CreateProcessInfo.lpBaseOfImage, + de->u.CreateProcessInfo.dwDebugInfoFileOffset, + de->u.CreateProcessInfo.nDebugInfoSize);
None of that should be necessary, it looks like you are copying some old code. -- Alexandre Julliard julliard(a)winehq.org
Am 25.06.21 um 16:26 schrieb Alexandre Julliard:
Bernhard Übelacker <bernhardu(a)mailbox.org> writes:
diff --git a/programs/winedbg/gdbproxy.c b/programs/winedbg/gdbproxy.c index 478e0d16fe0..d768a8a585c 100644 --- a/programs/winedbg/gdbproxy.c +++ b/programs/winedbg/gdbproxy.c @@ -437,6 +437,17 @@ static BOOL handle_debug_event(struct gdb_context* gdbctx) fprintf(stderr, "%04x:%04x: create thread I @%p\n", de->dwProcessId, de->dwThreadId, de->u.CreateProcessInfo.lpStartAddress);
+ fetch_module_name( de->u.CreateProcessInfo.lpImageName, de->u.CreateProcessInfo.lpBaseOfImage, + u.buffer, ARRAY_SIZE(u.buffer) ); + fprintf(stderr, "%04x:%04x: loads EXE %s @%p (%u<%u>)\n", + de->dwProcessId, de->dwThreadId, + dbg_W2A(u.buffer, -1), + de->u.CreateProcessInfo.lpBaseOfImage, + de->u.CreateProcessInfo.dwDebugInfoFileOffset, + de->u.CreateProcessInfo.nDebugInfoSize);
None of that should be necessary, it looks like you are copying some old code.
I copied this from the LOAD_DLL_DEBUG_EVENT a few lines below. But yes, the fetch_module_name for the CREATE_PROCESS_DEBUG_EVENT is not necessary, the lpBaseOfImage is already filled. The "loads EXE" is also just a copy of the "loads DLL" line printed for each dll. I will send a new version with both removed. Thanks for the review. Kind regards, Bernhard
participants (2)
-
Alexandre Julliard -
Bernhard Übelacker