Allow building with backtrace symbols.

This commit is contained in:
Jason Felds
2015-10-08 19:46:52 -04:00
parent c05e38c0aa
commit f372df0d2c
3 changed files with 43 additions and 43 deletions
+4 -4
View File
@@ -97,7 +97,7 @@ RString BacktraceNames::Format() const
#if defined(BACKTRACE_LOOKUP_METHOD_DLADDR) #if defined(BACKTRACE_LOOKUP_METHOD_DLADDR)
/* This version simply asks libdl, which is more robust. */ /* This version simply asks libdl, which is more robust. */
#include <dlfcn.h> #include <dlfcn.h>
void BacktraceNames::FromAddr( const void *p ) void BacktraceNames::FromAddr( void * const p )
{ {
Address = (intptr_t) p; Address = (intptr_t) p;
@@ -222,7 +222,7 @@ static const char *osx_find_link_edit( const struct mach_header *header )
return NULL; return NULL;
} }
void BacktraceNames::FromAddr( const void *p ) void BacktraceNames::FromAddr( void * const p )
{ {
Address = (intptr_t) p; Address = (intptr_t) p;
@@ -294,7 +294,7 @@ void BacktraceNames::FromAddr( const void *p )
#elif defined(BACKTRACE_LOOKUP_METHOD_BACKTRACE_SYMBOLS) #elif defined(BACKTRACE_LOOKUP_METHOD_BACKTRACE_SYMBOLS)
/* This version parses backtrace_symbols(), an doesn't need libdl. */ /* This version parses backtrace_symbols(), an doesn't need libdl. */
#include <execinfo.h> #include <execinfo.h>
void BacktraceNames::FromAddr( const void *p ) void BacktraceNames::FromAddr( void * const p )
{ {
Address = (intptr_t) p; Address = (intptr_t) p;
@@ -342,7 +342,7 @@ void BacktraceNames::FromString( RString s )
} }
#else #else
#warning Undefined BACKTRACE_LOOKUP_METHOD_* #warning Undefined BACKTRACE_LOOKUP_METHOD_*
void BacktraceNames::FromAddr( const void *p ) void BacktraceNames::FromAddr( void * const p )
{ {
Address = intptr_t(p); Address = intptr_t(p);
Offset = 0; Offset = 0;
+1 -1
View File
@@ -6,7 +6,7 @@ struct BacktraceNames
RString Symbol, File; RString Symbol, File;
intptr_t Address; intptr_t Address;
int Offset; int Offset;
void FromAddr( const void *p ); void FromAddr( void * const p );
void FromString( RString str ); void FromString( RString str );
void Demangle(); void Demangle();
RString Format() const; RString Format() const;
+1 -1
View File
@@ -46,7 +46,7 @@ static void output_stack_trace( FILE *out, const void **BacktracePointers )
for( int i = 0; BacktracePointers[i]; ++i) for( int i = 0; BacktracePointers[i]; ++i)
{ {
BacktraceNames bn; BacktraceNames bn;
bn.FromAddr( BacktracePointers[i] ); bn.FromAddr( const_cast<void *>(BacktracePointers[i]) );
bn.Demangle(); bn.Demangle();
/* Don't show the main module name. */ /* Don't show the main module name. */