mirror of
https://github.com/unknownworlds/NS.git
synced 2024-11-15 09:11:55 +00:00
42 lines
1.7 KiB
C
42 lines
1.7 KiB
C
|
// ZASSERT AND STACKTRACE are an improved assertion system which augments
|
||
|
// the WIN32 assert.h standard _assert.
|
||
|
// (c) 1999 Zachary B. Simpson
|
||
|
// Code may be used and distributed freely as long as all
|
||
|
// changes are noted appropriately.
|
||
|
|
||
|
#ifndef STACKTRACE_H
|
||
|
#define STACKTRACE_H
|
||
|
|
||
|
char *stackTrace( int skipAssert );
|
||
|
// This function traces up the stack and creates a useful
|
||
|
// stack dump good for printing after an assert of fatal.
|
||
|
// It parses the symbol tables inside of the exe file
|
||
|
// in order to print a useful report. However, it
|
||
|
// only understands COFF format debugging. You must enable
|
||
|
// COFF in the Project Settings Linker Options. You may,
|
||
|
// if you choose, enable both COFF and MS formats.
|
||
|
// If COFF data is not available, it will print out using
|
||
|
// a hex dump, and may print more information than is valid.
|
||
|
// The traversal of the stack is predicated on assumptions
|
||
|
// about non-optimized MSVC stack frames. Thus, if optimizations
|
||
|
// are on, results may not be predicatble.
|
||
|
// If the skipAssert flag is true, it will not dump
|
||
|
// and functions with the word assert in them. Useful
|
||
|
// for ignoring the call to assert which is not helpful.
|
||
|
|
||
|
#ifdef WIN32
|
||
|
char *demangleMSDEVFuncName(
|
||
|
char *mangledName,
|
||
|
char funcName[], int funcNameMax,
|
||
|
char args[], int maxArgs,
|
||
|
int &numArgs
|
||
|
);
|
||
|
#endif
|
||
|
// This function is used by the stackTrace function in
|
||
|
// order to deceipher the mangled C++ function names
|
||
|
// generated by MSDEV in order to determine the argument list.
|
||
|
// The parser for this is very complicated and unfortunately
|
||
|
// may not be able to parse all names. In these cases,
|
||
|
// stackTrace should resort to printing a hex dump.
|
||
|
|
||
|
#endif
|