Skip to content

Commit

Permalink
fix for crash in report_failure function
Browse files Browse the repository at this point in the history
  • Loading branch information
anonymous committed Jan 11, 2011
1 parent 602a98f commit cbb9a46
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/exception.cc
Expand Up @@ -436,7 +436,7 @@ static _Unwind_Reason_Code trace(struct _Unwind_Context *context, void *c)
* If the failure happened by falling off the end of the stack without finding
* a handler, prints a back trace before aborting.
*/
static void report_failure(_Unwind_Reason_Code err, void *thrown_exception)
static void report_failure(_Unwind_Reason_Code err, __cxa_exception *thrown_exception)
{
switch (err)
{
Expand All @@ -453,7 +453,7 @@ static void report_failure(_Unwind_Reason_Code err, void *thrown_exception)

size_t bufferSize = 128;
char *demangled = (char*)malloc(bufferSize);
const char *mangled = __cxa_current_exception_type()->name();
const char *mangled = thrown_exception->exceptionType->name();
int status;
__cxa_demangle(mangled, demangled, &bufferSize, &status);
fprintf(stderr, " of type %s\n",
Expand Down Expand Up @@ -493,7 +493,7 @@ extern "C" void __cxa_throw(void *thrown_exception,
info->globals.uncaughtExceptions++;

_Unwind_Reason_Code err = _Unwind_RaiseException(&ex->unwindHeader);
report_failure(err, thrown_exception);
report_failure(err, ex);
}


Expand Down Expand Up @@ -536,7 +536,7 @@ extern "C" void __cxa_rethrow()
// will then run cleanup code and bounce the exception back with
// _Unwind_Resume().
_Unwind_Reason_Code err = _Unwind_Resume_or_Rethrow(&ex->unwindHeader);
report_failure(err, ex + 1);
report_failure(err, ex);
}

/**
Expand Down

0 comments on commit cbb9a46

Please sign in to comment.