浏览代码

* 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://svn.code.sf.net/p/rathena/svn/branches/stable@1221 54d463be-8e91-2dee-dedb-b68131a5f0ec

celest 20 年之前
父节点
当前提交
b8d5acfd82
共有 2 个文件被更改,包括 10 次插入5 次删除
  1. 3 0
      Changelog-SVN.txt
  2. 7 5
      src/common/core.c

+ 3 - 0
Changelog-SVN.txt

@@ -1,6 +1,9 @@
 Date	Added
 
 03/09
+        * Some changes in sig_dump to allow Cygwin produce stackdumps upon crash again,
+          thanks to Ser [celest]
+        * Changed the default stackdump creation folder from /save to /log [celest]
         * Fixed a typo in TXT login server logging, thanks to Skyer / eAthenaC [celest]
         * Added HP and SP rate underflow checking [celest]
         * Added stop auto attacking if no arrows were equipped [celest]

+ 7 - 5
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];