diff options
author | celest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2005-03-09 11:54:32 +0000 |
---|---|---|
committer | celest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2005-03-09 11:54:32 +0000 |
commit | 114199854324d9d3ef203fecc6969c747e22404d (patch) | |
tree | a91065ffff014a11cdc594e0c391d787b4ae8a51 /src/common/core.c | |
parent | 7a225e1139fe4629be5493fcf87c3ba4d4a3c6a2 (diff) | |
download | hercules-114199854324d9d3ef203fecc6969c747e22404d.tar.gz hercules-114199854324d9d3ef203fecc6969c747e22404d.tar.bz2 hercules-114199854324d9d3ef203fecc6969c747e22404d.tar.xz hercules-114199854324d9d3ef203fecc6969c747e22404d.zip |
* 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
Diffstat (limited to 'src/common/core.c')
-rw-r--r-- | src/common/core.c | 12 |
1 files changed, 7 insertions, 5 deletions
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 <signal.h> #include <string.h> #ifdef DUMPSTACK - #ifndef _WIN32 // HAVE_EXECINFO_H + #ifndef CYGWIN // HAVE_EXECINFO_H #include <execinfo.h> #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]; |