|There's more than one way to do things|
Re: Can't trigger system debugger to dump core when Cygwin's Perl launches program with backticksby bulk88 (Priest)
|on Sep 15, 2013 at 03:22 UTC||Need Help??|
I have registered a perl script as crash handler with the operating system
I am curious, how did you do that?
The problem: When I use Cygwin’s Perl implementation, the program crash never triggers the crash handler. My suspicion is that Perl is catching the problem and silently dropping it. All works fine with a Perl from ActiveState.So when crasher is launched from AS Perl, does the crash handler get called? The 2 paragraphs are contradictory.
Be aware, that on Cygwin, Cygwin executables will never "crash" with a popup. They generate SIGSEGV/SIGBUS signals. I dont know what happens when a Win32 executable launched from Cygwin crashes.
Update: the logic of what to run when an app crashes lives in a key called HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug and value called "Debugger". I am using 32 bit Windows for this discussion. Debugger value is queried from _UnhandledExceptionFilter@4 which is in kernel32.dll. The ReactOS version is more simple than on real Windows, and says DPRINT1("Debugging is not implemented yet\n");. Using VS Debugger, you will normally never see _UnhandledExceptionFilter@4 unless you put a breakpoint at its very beginning because when a crash happens, it DOESNT catch the crash if there is a debugger attached to the process and passes the SEH exception to the next handler by returning EXCEPTION_CONTINUE_SEARCH, and there is none except for the VS debugger.
The callstack that gives the popup (the ok or cancel popup window actually is owned by csrss.exe) after stepping _UnhandledExceptionFilter and tricking it to think there is no C debugger attached to the process. kernel32.dll!_BaseProcessStart@4() + 0x29a68 is the SEH catch block for BaseProcessStart.
The event handle passed on the command line to the debugger is to keep around the crashed process. When that event handle becomes signaled, UnhandledExceptionFilter cleans up its resources and returns EXCEPTION_CONTINUE_SEARCH. I'll guess otherwise the crashed process will exit before the new C debugger process can register itself with Windows and get a handle to the crashed process to keep it alive.
Also welcome to perlmonks. I see you've taken 9 years to make your first post.