diff --git a/source/glest_game/main/main.cpp b/source/glest_game/main/main.cpp index d74b8dd3..77957272 100644 --- a/source/glest_game/main/main.cpp +++ b/source/glest_game/main/main.cpp @@ -2986,6 +2986,7 @@ int glestMain(int argc, char** argv) { if(hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_DISABLE_BACKTRACE]) == true) { disableBacktrace = true; } + PlatformExceptionHandler::disableBacktrace= disableBacktrace; // UErrorCode status = U_ZERO_ERROR; // u_init(&status); diff --git a/source/shared_lib/include/platform/sdl/platform_util.h b/source/shared_lib/include/platform/sdl/platform_util.h index 2e773e68..94a45ebf 100644 --- a/source/shared_lib/include/platform/sdl/platform_util.h +++ b/source/shared_lib/include/platform/sdl/platform_util.h @@ -41,6 +41,7 @@ public: class PlatformExceptionHandler { public: static string application_binary; + static bool disableBacktrace; static string getStackTrace(); virtual ~PlatformExceptionHandler() {} diff --git a/source/shared_lib/sources/platform/sdl/platform_util.cpp b/source/shared_lib/sources/platform/sdl/platform_util.cpp index 66fea022..d8d7ca42 100644 --- a/source/shared_lib/sources/platform/sdl/platform_util.cpp +++ b/source/shared_lib/sources/platform/sdl/platform_util.cpp @@ -32,6 +32,7 @@ using namespace std; namespace Shared{ namespace Platform{ string PlatformExceptionHandler::application_binary=""; +bool PlatformExceptionHandler::disableBacktrace = false; // This was the simplest, most portable solution i could find in 5 mins for linux int MessageBox(int handle, const char *msg, const char *title, int buttons) { @@ -161,11 +162,16 @@ static int getFileAndLine(char *function, void *address, char *file, size_t flen #endif string PlatformExceptionHandler::getStackTrace() { - string errMsg = ""; + string errMsg = "\nStack Trace:\n"; + if(PlatformExceptionHandler::disableBacktrace == true) { + errMsg += "disabled..."; + return errMsg; + } + //#if defined(__GNUC__) && !defined(__MINGW32__) && !defined(__FreeBSD__) && !defined(BSD) #if defined(HAS_GCC_BACKTRACE) // if(disableBacktrace == false && sdl_quitCalled == false) { - errMsg = "\nStack Trace:\n"; + //errMsg = "\nStack Trace:\n"; //errMsg += "To find line #'s use:\n"; //errMsg += "readelf --debug-dump=decodedline %s | egrep 0xaddress-of-stack\n"; diff --git a/source/shared_lib/sources/platform/win32/platform_util.cpp b/source/shared_lib/sources/platform/win32/platform_util.cpp index 86d589af..eaddbcff 100644 --- a/source/shared_lib/sources/platform/win32/platform_util.cpp +++ b/source/shared_lib/sources/platform/win32/platform_util.cpp @@ -31,6 +31,7 @@ namespace Shared { namespace Platform { // class PlatformExceptionHandler // ===================================================== string PlatformExceptionHandler::application_binary=""; +bool PlatformExceptionHandler::disableBacktrace = false; PlatformExceptionHandler *PlatformExceptionHandler::thisPointer= NULL; // Constructs object and convert lpaszString to Unicode @@ -152,7 +153,10 @@ void PlatformExceptionHandler::install(string dumpFileName){ string PlatformExceptionHandler::getStackTrace() { string result = "\nStack Trace:\n"; - + if(PlatformExceptionHandler::disableBacktrace == true) { + result += "disabled..."; + return result; + } #ifndef __MINGW32__ /* unsigned int i;