[PATCH 0/1] MR3231: winedbg: Avoid crash in auto processing when process terminates.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55187 With this patch winedbg does from a user point of view not silently exit, instead it can at least give this information which might be at least better than nothing: ``` Process of pid=0020 has terminated No process loaded, cannot execute 'echo Modules:' Cannot get info on module while no process is loaded No process loaded, cannot execute 'echo Threads:' process tid prio name (all IDs are in hex) ... (list of still running processes) System information: Wine build: wine-8.11-146-gb0faa6fb042 Platform: i386 Version: Windows 10 Host system: Linux Host version: 6.1.0-9-amd64 ``` -- https://gitlab.winehq.org/wine/wine/-/merge_requests/3231
From: Bernhard Übelacker <bernhardu(a)mailbox.org> Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55187 --- programs/winedbg/tgt_active.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/programs/winedbg/tgt_active.c b/programs/winedbg/tgt_active.c index 0d5ae754af5..f074784e9dc 100644 --- a/programs/winedbg/tgt_active.c +++ b/programs/winedbg/tgt_active.c @@ -869,11 +869,11 @@ static void output_system_info(void) const char *(CDECL *wine_get_build_id)(void); void (CDECL *wine_get_host_version)( const char **sysname, const char **release ); - BOOL is_wow64; + BOOL is_wow64 = FALSE; wine_get_build_id = (void *)GetProcAddress(GetModuleHandleA("ntdll.dll"), "wine_get_build_id"); wine_get_host_version = (void *)GetProcAddress(GetModuleHandleA("ntdll.dll"), "wine_get_host_version"); - if (!IsWow64Process( dbg_curr_process->handle, &is_wow64 )) is_wow64 = FALSE; + if (dbg_curr_process && !IsWow64Process( dbg_curr_process->handle, &is_wow64 )) is_wow64 = FALSE; dbg_printf( "System information:\n" ); if (wine_get_build_id) dbg_printf( " Wine build: %s\n", wine_get_build_id() ); @@ -1000,7 +1000,8 @@ enum dbg_start dbg_active_auto(int argc, char* argv[]) } CloseHandle( input ); - dbg_curr_process->process_io->close_process(dbg_curr_process, TRUE); + if (dbg_curr_process) + dbg_curr_process->process_io->close_process(dbg_curr_process, TRUE); return start_ok; } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/3231
In theory, winedbg should fetch and display the exception that triggered the --auto. It looks like it gets the exception but keep on processing the other debug events until the exit-process one, which causes trouble. Can you send me the +winedbg trace. TIA. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/3231#note_37745
On Tue Jul 4 08:24:48 2023 +0000, eric pouech wrote:
In theory, winedbg should fetch and display the exception that triggered the --auto. It looks like it gets the exception but keep on processing the other debug events until the exit-process one, which causes trouble. Can you send me the +winedbg trace. TIA. Thanks for looking into it. I attached a trace to the bug. (+pid,+timestamp,+winedbg,+process, git 884cff821 plus trace in NtTerminateProcess)
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/3231#note_37754
On Tue Jul 4 08:24:48 2023 +0000, Bernhard Übelacker wrote:
Thanks for looking into it. I attached a trace to the bug. (+pid,+timestamp,+winedbg,+process, git 884cff821 plus trace in NtTerminateProcess) Thanks... in fact, the process (debuggee) terminates itself before the debuggee can push its exception... we don't have many tests for this situation, so starting to protect from a crash is a good starting point
But we could try to provide interesting information even in that case. The attached patch could potentially allow to show more information. [wd.patch](/uploads/d4a1bd6fa03a6c636bcd71bdfb4af184/wd.patch) -- https://gitlab.winehq.org/wine/wine/-/merge_requests/3231#note_37766
On Tue Jul 4 10:21:41 2023 +0000, eric pouech wrote:
Thanks... in fact, the process (debuggee) terminates itself before the debuggee can push its exception... we don't have many tests for this situation, so starting to protect from a crash is a good starting point But we could try to provide interesting information even in that case. The attached patch could potentially allow to show more information. [wd.patch](/uploads/d4a1bd6fa03a6c636bcd71bdfb4af184/wd.patch) With just your patch on top of 884cff821 the crash of winedbg is properly avoided.
It generates this output: [backtrace.txt](/uploads/1f20d0463d3ecd09842530784e8f85ae/backtrace.txt) -- https://gitlab.winehq.org/wine/wine/-/merge_requests/3231#note_37775
On Tue Jul 4 12:04:37 2023 +0000, Bernhard Übelacker wrote:
With just your patch on top of 884cff821 the crash of winedbg is properly avoided. It generates this output: [backtrace.txt](/uploads/1f20d0463d3ecd09842530784e8f85ae/backtrace.txt) thanks for testing... so we get at least some info about the crash
if ok with you, I'll create a MR with an updated version of the patch: make it clear we cannot get a backtrace as we're missing the first exception -- https://gitlab.winehq.org/wine/wine/-/merge_requests/3231#note_37780
On Tue Jul 4 13:10:56 2023 +0000, eric pouech wrote:
thanks for testing... so we get at least some info about the crash if ok with you, I'll create a MR with an updated version of the patch: make it clear we cannot get a backtrace as we're missing the first exception That would be great, sure I am ok with whatever you find suitable, thanks.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/3231#note_37814
On Tue Jul 4 16:04:14 2023 +0000, Bernhard Übelacker wrote:
That would be great, sure I am ok with whatever you find suitable, thanks. I added a small note and a modification to the kernel32 test to interactively demonstrate the issue.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/3231#note_37953
This merge request was closed by Bernhard Übelacker. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/3231
A proper fix got committed with https://gitlab.winehq.org/wine/wine/-/merge_requests/3246. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/3231#note_38403
participants (2)
-
Bernhard Übelacker -
eric pouech (@epo)