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 ```
From: Bernhard Übelacker bernhardu@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; }
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.
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)
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)
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)
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
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.
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.
This merge request was closed by Bernhard Übelacker.
A proper fix got committed with https://gitlab.winehq.org/wine/wine/-/merge_requests/3246.