forked from 0ad/0ad
debug, wdbg: fix skip accounting for debug_dump_stack if context was passed
win: fix typo causing pre_main functions not to be called This was SVN commit r2430.
This commit is contained in:
parent
52c44f7225
commit
634b09dec7
@ -478,7 +478,9 @@ ErrorReaction display_error(const wchar_t* description, int flags,
|
|||||||
static const wchar_t fmt[] = L"%s\r\n\r\nCall stack:\r\n\r\n";
|
static const wchar_t fmt[] = L"%s\r\n\r\nCall stack:\r\n\r\n";
|
||||||
int len = swprintf(text, MAX_CHARS, fmt, description);
|
int len = swprintf(text, MAX_CHARS, fmt, description);
|
||||||
|
|
||||||
debug_dump_stack(text+len, MAX_CHARS-len, skip+1, context);
|
if(!context)
|
||||||
|
skip++; // skip this frame
|
||||||
|
debug_dump_stack(text+len, MAX_CHARS-len, skip, context);
|
||||||
// in-place
|
// in-place
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -907,7 +907,7 @@ static const wchar_t* get_exception_locus(const EXCEPTION_POINTERS* ep)
|
|||||||
// real location.
|
// real location.
|
||||||
|
|
||||||
wchar_t buf[32000];
|
wchar_t buf[32000];
|
||||||
const wchar_t* stack_trace = debug_dump_stack(buf, ARRAY_SIZE(buf), +0, ep->ContextRecord);
|
const wchar_t* stack_trace = debug_dump_stack(buf, ARRAY_SIZE(buf), 1, ep->ContextRecord);
|
||||||
|
|
||||||
const size_t MAX_LOCUS_CHARS = 256;
|
const size_t MAX_LOCUS_CHARS = 256;
|
||||||
static wchar_t locus[MAX_LOCUS_CHARS];
|
static wchar_t locus[MAX_LOCUS_CHARS];
|
||||||
@ -990,12 +990,13 @@ LONG WINAPI wdbg_exception_filter(EXCEPTION_POINTERS* ep)
|
|||||||
|
|
||||||
wchar_t func_name[DBG_SYMBOL_LEN]; char file[DBG_FILE_LEN] = {0}; int line = 0; wchar_t fmt[50];
|
wchar_t func_name[DBG_SYMBOL_LEN]; char file[DBG_FILE_LEN] = {0}; int line = 0; wchar_t fmt[50];
|
||||||
swprintf(fmt, ARRAY_SIZE(fmt), L"%%%ds %%%dhs (%%d)", DBG_SYMBOL_LEN, DBG_FILE_LEN);
|
swprintf(fmt, ARRAY_SIZE(fmt), L"%%%ds %%%dhs (%%d)", DBG_SYMBOL_LEN, DBG_FILE_LEN);
|
||||||
|
// bake in the string limits (future-proof)
|
||||||
if(swscanf(locus, fmt, func_name, file, &line) != 3)
|
if(swscanf(locus, fmt, func_name, file, &line) != 3)
|
||||||
debug_warn("error extracting file/line from exception locus");
|
debug_warn("error extracting file/line from exception locus");
|
||||||
|
|
||||||
wchar_t buf[500];
|
wchar_t buf[500];
|
||||||
const wchar_t* msg_fmt =
|
const wchar_t* msg_fmt =
|
||||||
L"Much to our regret we must report the program has encountered an error and cannot continue.\r\n"
|
L"Much to our regret we must report the program has encountered an error.\r\n"
|
||||||
L"\r\n"
|
L"\r\n"
|
||||||
L"Please let us know at http://bugs.wildfiregames.com/ and attach the crashlog.txt and crashlog.dmp files.\r\n"
|
L"Please let us know at http://bugs.wildfiregames.com/ and attach the crashlog.txt and crashlog.dmp files.\r\n"
|
||||||
L"\r\n"
|
L"\r\n"
|
||||||
@ -1004,7 +1005,7 @@ LONG WINAPI wdbg_exception_filter(EXCEPTION_POINTERS* ep)
|
|||||||
int flags = 0;
|
int flags = 0;
|
||||||
if(ep->ExceptionRecord->ExceptionFlags & EXCEPTION_NONCONTINUABLE)
|
if(ep->ExceptionRecord->ExceptionFlags & EXCEPTION_NONCONTINUABLE)
|
||||||
flags = DE_NO_CONTINUE;
|
flags = DE_NO_CONTINUE;
|
||||||
ErrorReaction er = display_error(buf, flags, 0, ep->ContextRecord, file, line);
|
ErrorReaction er = display_error(buf, flags, 1, ep->ContextRecord, file, line);
|
||||||
assert(er > 0);
|
assert(er > 0);
|
||||||
|
|
||||||
wdbg_write_minidump(ep);
|
wdbg_write_minidump(ep);
|
||||||
|
@ -523,7 +523,7 @@ _PIFV pre_libc_begin[] = { 0 };
|
|||||||
_PIFV pre_libc_end[] = { 0 };
|
_PIFV pre_libc_end[] = { 0 };
|
||||||
#pragma data_seg(WIN_CALLBACK_PRE_MAIN(a))
|
#pragma data_seg(WIN_CALLBACK_PRE_MAIN(a))
|
||||||
_PIFV pre_main_begin[] = { 0 };
|
_PIFV pre_main_begin[] = { 0 };
|
||||||
#pragma data_seg(WIN_CALLBACK_PRE_MAIN(a))
|
#pragma data_seg(WIN_CALLBACK_PRE_MAIN(z))
|
||||||
_PIFV pre_main_end[] = { 0 };
|
_PIFV pre_main_end[] = { 0 };
|
||||||
#pragma data_seg(WIN_CALLBACK_POST_ATEXIT(a))
|
#pragma data_seg(WIN_CALLBACK_POST_ATEXIT(a))
|
||||||
_PIFV shutdown_begin[] = { 0 };
|
_PIFV shutdown_begin[] = { 0 };
|
||||||
|
@ -432,8 +432,8 @@ extern void win_free(void* p);
|
|||||||
|
|
||||||
#define WIN_REGISTER_FUNC(func) static int func(void); static int(*p##func)(void) = func
|
#define WIN_REGISTER_FUNC(func) static int func(void); static int(*p##func)(void) = func
|
||||||
|
|
||||||
#define WIN_CALLBACK_PRE_LIBC(group) ".LIB$WC" #group
|
#define WIN_CALLBACK_PRE_LIBC(group) ".LIB$WC" #group
|
||||||
#define WIN_CALLBACK_PRE_MAIN(group) ".LIB$WI" #group
|
#define WIN_CALLBACK_PRE_MAIN(group) ".LIB$WI" #group
|
||||||
#define WIN_CALLBACK_POST_ATEXIT(group) ".LIB$WT" #group
|
#define WIN_CALLBACK_POST_ATEXIT(group) ".LIB$WT" #group
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user