backtrace.c: add flags to open() so that the log file is opened user-r/w.

This way, crashlogs will really be appended. Additionally, print a time
 at the end of each backtrace.

winlayer.c: load ebacktrace1.dll instead of the old one
Makefile.common: when building with DEBUGANYWAY=1, don't omit frame pointers
 This will let us get a stack trace for crashes with the release build code.

git-svn-id: https://svn.eduke32.com/eduke32@2040 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2011-09-22 16:52:55 +00:00
parent 98ac0c2edc
commit 86345f2b00
3 changed files with 23 additions and 3 deletions

View File

@ -78,7 +78,10 @@ endif
ifneq (0,$(RELEASE))
# Debugging disabled
debug=-fomit-frame-pointer -funswitch-loops -O$(OPTLEVEL)
debug=-funswitch-loops -O$(OPTLEVEL)
ifeq (0,$(DEBUGANYWAY))
debug+= -fomit-frame-pointer
endif
ifneq (0,$(LTO))
LIBS+= -flto
debug+= -flto

View File

@ -32,6 +32,9 @@
#include <string.h>
#include <stdbool.h>
#include <sys/stat.h>
#include <time.h>
#define BUFFER_MAX (16*1024)
struct bfd_ctx {
@ -315,13 +318,22 @@ exception_filter(LPEXCEPTION_POINTERS info)
SymCleanup(GetCurrentProcess());
}
int logfd = open("eduke32_or_mapster32.crashlog", O_APPEND | O_CREAT | O_WRONLY);
int logfd = open("eduke32_or_mapster32.crashlog", O_APPEND | O_CREAT | O_RDWR, S_IRUSR | S_IWUSR);
int written;
if (logfd) {
while ((written = write(logfd, g_output, strlen(g_output)))) {
g_output += written;
}
time_t curtime = time(NULL);
struct tm *curltime = localtime(&curtime);
const char *theasctime = curltime ? asctime(curltime) : NULL;
const char *finistr = "---------------\n";
if (theasctime)
write(logfd, theasctime, strlen(theasctime));
write(logfd, finistr, strlen(finistr));
close(logfd);
}

View File

@ -363,7 +363,12 @@ int32_t WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, in
#endif
#ifdef DEBUGGINGAIDS
LoadLibraryA("backtrace.dll");
LoadLibraryA("ebacktrace1.dll");
/*
wm_msgbox("boo","didn't load backtrace DLL (code %d)\n", (int)GetLastError());
else
wm_msgbox("yay","loaded backtrace DLL\n");
*/
#endif
hdc = GetDC(NULL);