- when disabling backtrace ensure console output only shows direct errors without backtrace

This commit is contained in:
Mark Vejvoda 2012-07-03 00:19:23 +00:00
parent 3ec510fa17
commit a8af70cee1
4 changed files with 15 additions and 3 deletions

View File

@ -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);

View File

@ -41,6 +41,7 @@ public:
class PlatformExceptionHandler {
public:
static string application_binary;
static bool disableBacktrace;
static string getStackTrace();
virtual ~PlatformExceptionHandler() {}

View File

@ -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";

View File

@ -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;