From 114199854324d9d3ef203fecc6969c747e22404d Mon Sep 17 00:00:00 2001 From: celest Date: Wed, 9 Mar 2005 11:54:32 +0000 Subject: * Some changes in sig_dump to allow Cygwin produce stackdumps upon crash again * Changed the default stackdump creation folder from /save to /log git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1221 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/common/core.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/common/core.c') diff --git a/src/common/core.c b/src/common/core.c index 948355469..37a46825b 100644 --- a/src/common/core.c +++ b/src/common/core.c @@ -9,7 +9,7 @@ #include #include #ifdef DUMPSTACK - #ifndef _WIN32 // HAVE_EXECINFO_H + #ifndef CYGWIN // HAVE_EXECINFO_H #include #endif #endif @@ -100,6 +100,9 @@ static void sig_proc(int sn) * Dumps the stack using glibc's backtrace *----------------------------------------- */ +#ifdef CYGWIN + #define sig_dump SIG_DFL // allow cygwin's default dumper utility to handle this +#else static void sig_dump(int sn) { #ifdef DUMPSTACK @@ -113,7 +116,7 @@ static void sig_dump(int sn) // search for a usable filename do { - sprintf(tmp,"save/stackdump_%04d.txt", ++no); + sprintf(tmp,"log/stackdump_%04d.txt", ++no); } while((fp = fopen(tmp,"r")) && (fclose(fp), no < 9999)); // dump the trace into the file if ((fp = fopen (tmp,"w")) != NULL) { @@ -122,11 +125,8 @@ static void sig_dump(int sn) fprintf(fp,"Stack trace:\n"); size = backtrace (array, 20); stack = backtrace_symbols (array, size); - for (no = 0; no < size; no++) { - fprintf(fp, "%s\n", stack[no]); - } fprintf(fp,"End of stack trace\n"); @@ -134,10 +134,12 @@ static void sig_dump(int sn) aFree(stack); } #endif + //cygwin_stackdump (); // When pass the signal to the system's default handler compat_signal(sn, SIG_DFL); raise(sn); } +#endif int get_svn_revision(char *svnentry) { // Warning: minor syntax checking char line[1024]; -- cgit v1.2.3-70-g09d2