Well we are getting somewhere
When my test application segfaults the debugger attaches and runs through a number of debug events eventually ariving at a segfault
strace:winedbg:dbg_handle_debug_event 00000008:00000009: loads DLL c: \windows\system\imm32.dll @7f440000 (0<0>) trace:winedbg:dbg_handle_debug_event 00000008:00000009: exception code=80000003
Now I added some instrumentation and find the following happens IE
trace:winedbg:dbg_handle_debug_event Continue on first exception is true trace:winedbg:dbg_handle_debug_event Breaking switch trace:winedbg:dbg_handle_debug_event Call ContinueDebugEvent trace:winedbg:dbg_handle_debug_event Continuing executio trace:winedbg:dbg_main_loop Wait for next debug event...
In this code at the top of dbg_main_loop if (dbg_curr_process) dbg_printf("WineDbg starting on pid 0x%lx\n", dbg_curr_pid);
/* wait for first exception */ while (WaitForDebugEvent(&de, INFINITE)) { WINE_TRACE("Calling handle_debug_event 2\n"); if (dbg_handle_debug_event(&de)) {WINE_TRACE("Event handled\n");break;} WINE_TRACE("Wait for next debug event...\n"); }
Problem is that the client program is stopped, probably on a segfault trace because I enable tracing (stops) on all machine faults and signals when I attached it (this allows my replacement for wait4 to find out if a fault or signal happened in the debuggee). Everything deadlocks then since the debugger never continues the program after the exception (Or perhaps the wineserver never gets a message to restart it)
Perhaps I don't understand the semantics of PTRACE wait4 interactions. Should I just let the app trap machine faults ?
All help appreciated
Bob