This is the mail archive of the
cygwin@sourceware.cygnus.com
mailing list for the Cygwin project.
crash dumps
- To: gnu-win32 at cygnus dot com
- Subject: crash dumps
- From: Tim Newsham <newsham at aloha dot net>
- Date: Thu, 23 Oct 1997 11:00:33 -1000 (HST)
Hi,
Having the exceptions (and stack trace) dumped to stderr is
usually of little use to me (especially when lots of programs
are running at once in the background), so I patched cygwin.dll
to dump the stack trace to the more traditional file
<progname>.core. This way I can look around the filesystem
for .core files to see if things crashed while I wasn't paying
attention or had stderr redirected someplace else. I think
this is the sensible way to handle this and would like it
if cygwin adopted this technique :)
The patch is included below. You may do what you want with
it, I release any rights to the code.
Tim N.
*** winsup.970904t/exceptions.cc Fri Oct 03 16:52:01 1997
--- winsup.970904t2/exceptions.cc Thu Oct 23 10:56:50 1997
***************
*** 580,585 ****
--- 593,610 ----
}
else
{
+ /* write to progname.core if possible */
+ char corename[MAX_PATH], *p;
+ p = strrchr(u->self->progname, '\\');
+ p = p ? p + 1 : u->self->progname;
+ sprintf(corename, "%.*s.core", MAX_PATH - sizeof ".core", p);
+ HANDLE h = CreateFile(corename, GENERIC_WRITE, 0, 0,
+ CREATE_ALWAYS, 0, 0);
+ if(h != INVALID_HANDLE_VALUE) {
+ system_printf("Dumping stack trace to %s\n", corename);
+ SetStdHandle(STD_ERROR_HANDLE, h);
+ }
+
traced = 1;
dump_status (e, in);
__stack_trace ();
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".