delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/10/23/16:31:16

From: newsham AT aloha DOT net (Tim Newsham)
Subject: crash dumps
23 Oct 1997 16:31:16 -0700 :
Message-ID: <199710232100.LAA24279.cygnus.gnu-win32@haleakala.aloha.net>
Mime-Version: 1.0
To: gnu-win32 AT cygnus DOT com

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 AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019