reduce backtrace size
This commit is contained in:
parent
9fb2eb492c
commit
c1f56293c7
3 changed files with 5 additions and 11 deletions
src
|
@ -579,7 +579,7 @@ static void UnitActionsEachCycle(UNITP_ITERATOR begin, UNITP_ITERATOR end)
|
|||
if (EnableDebugPrint) {
|
||||
fprintf(stderr, ", after: %x (unit: %d:%s, order: %d, refs: %d)\n", SyncHash,
|
||||
UnitNumber(unit), unit.Type->Ident.c_str(), unit.Orders.empty() ? -1 : unit.CurrentAction(), unit.Refs);
|
||||
print_backtrace();
|
||||
print_backtrace(8);
|
||||
fflush(stderr);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,13 +16,12 @@ inline void print_backtrace(int sz = 100) {
|
|||
|
||||
#elif defined(USE_WIN32)
|
||||
|
||||
#if 1 // the below would mean we give up XP support
|
||||
#include "windows.h"
|
||||
#include "winbase.h"
|
||||
#include "dbghelp.h"
|
||||
#include "process.h"
|
||||
|
||||
inline void print_backtrace(void) {
|
||||
inline void print_backtrace(int sz = 100) {
|
||||
unsigned int i;
|
||||
void *stack[100];
|
||||
unsigned short frames;
|
||||
|
@ -34,7 +33,7 @@ inline void print_backtrace(void) {
|
|||
|
||||
process = GetCurrentProcess();
|
||||
SymInitialize(process, NULL, TRUE);
|
||||
frames = CaptureStackBackTrace(0, 100, stack, NULL);
|
||||
frames = CaptureStackBackTrace(0, sz, stack, NULL);
|
||||
fprintf(stderr, "backtrace returned %d addresses\n", frames);
|
||||
symbol = (SYMBOL_INFO*)calloc(sizeof(SYMBOL_INFO) + 256 * sizeof(char), 1);
|
||||
symbol->MaxNameLen = 1024;
|
||||
|
@ -58,17 +57,12 @@ inline void print_backtrace(void) {
|
|||
}
|
||||
free(symbol);
|
||||
}
|
||||
#else
|
||||
inline void print_backtrace(void) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
inline void print_backtrace(void) {
|
||||
inline void print_backtrace(int sz = 100) {
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -87,7 +87,7 @@ int SyncRand()
|
|||
|
||||
if (EnableDebugPrint) {
|
||||
fprintf(stderr, "GameCycle: %lud, seed: %x, Sync rand: %d\n", GameCycle, SyncRandSeed, val);
|
||||
print_backtrace();
|
||||
print_backtrace(8);
|
||||
fflush(stderr);
|
||||
}
|
||||
return val;
|
||||
|
|
Loading…
Add table
Reference in a new issue