simplify
This commit is contained in:
@@ -60,34 +60,34 @@ void BacktraceNames::Demangle()
|
|||||||
|
|
||||||
void BacktraceNames::Demangle()
|
void BacktraceNames::Demangle()
|
||||||
{
|
{
|
||||||
/* demangle the name using __cxa_demangle() if needed */
|
/* demangle the name using __cxa_demangle() if needed */
|
||||||
if (Symbol.substr(0, 2) == "_Z")
|
if( Symbol.substr(0, 2) != "_Z" )
|
||||||
{
|
return;
|
||||||
int status = 0;
|
|
||||||
const char *name = abi::__cxa_demangle(Symbol, 0, 0, &status);
|
int status = 0;
|
||||||
if (name)
|
char *name = abi::__cxa_demangle( Symbol, 0, 0, &status );
|
||||||
Symbol = name;
|
if( name )
|
||||||
else
|
{
|
||||||
{
|
Symbol = name;
|
||||||
switch (status)
|
free( name );
|
||||||
{
|
return;
|
||||||
case 0:
|
}
|
||||||
fprintf(stderr, "Something went wrong, it returned success, but failed.\n");
|
|
||||||
break;
|
switch( status )
|
||||||
case -1:
|
{
|
||||||
fprintf(stderr, "Memory allocation failure.\n");
|
case -1:
|
||||||
break;
|
fprintf( stderr, "Out of memory\n" );
|
||||||
case -2:
|
break;
|
||||||
fprintf(stderr, "Invalid mangled name: %s.\n", Symbol.c_str());
|
case -2:
|
||||||
break;
|
fprintf( stderr, "Invalid mangled name: %s.\n", Symbol.c_str() );
|
||||||
case -3:
|
break;
|
||||||
fprintf(stderr, "Invalid arguments.\n");
|
case -3:
|
||||||
break;
|
fprintf( stderr, "Invalid arguments.\n" );
|
||||||
default:
|
break;
|
||||||
fprintf(stderr, "No idea what happened here.");
|
default:
|
||||||
}
|
fprintf( stderr, "Unexpected __cxa_demangle status: %i", status );
|
||||||
}
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
void BacktraceNames::Demangle() { }
|
void BacktraceNames::Demangle() { }
|
||||||
|
|||||||
Reference in New Issue
Block a user