mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +00:00
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:
parent
98ac0c2edc
commit
86345f2b00
3 changed files with 23 additions and 3 deletions
|
@ -78,7 +78,10 @@ endif
|
||||||
|
|
||||||
ifneq (0,$(RELEASE))
|
ifneq (0,$(RELEASE))
|
||||||
# Debugging disabled
|
# 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))
|
ifneq (0,$(LTO))
|
||||||
LIBS+= -flto
|
LIBS+= -flto
|
||||||
debug+= -flto
|
debug+= -flto
|
||||||
|
|
|
@ -32,6 +32,9 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
#define BUFFER_MAX (16*1024)
|
#define BUFFER_MAX (16*1024)
|
||||||
|
|
||||||
struct bfd_ctx {
|
struct bfd_ctx {
|
||||||
|
@ -315,13 +318,22 @@ exception_filter(LPEXCEPTION_POINTERS info)
|
||||||
SymCleanup(GetCurrentProcess());
|
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;
|
int written;
|
||||||
|
|
||||||
if (logfd) {
|
if (logfd) {
|
||||||
while ((written = write(logfd, g_output, strlen(g_output)))) {
|
while ((written = write(logfd, g_output, strlen(g_output)))) {
|
||||||
g_output += written;
|
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);
|
close(logfd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -363,7 +363,12 @@ int32_t WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, in
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUGGINGAIDS
|
#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
|
#endif
|
||||||
|
|
||||||
hdc = GetDC(NULL);
|
hdc = GetDC(NULL);
|
||||||
|
|
Loading…
Reference in a new issue