mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 19:48:20 +02:00
Crash backtrace improvements
This commit is contained in:
parent
972c4764f0
commit
7c2ef7f709
2 changed files with 30 additions and 11 deletions
|
@ -34,8 +34,8 @@ add_definitions(
|
|||
-DBP_DYNAMIC
|
||||
)
|
||||
|
||||
INCLUDE(CheckIncludeFiles)
|
||||
CHECK_INCLUDE_FILES(backtrace.h HAVE_BACKTRACE_HEADERS)
|
||||
INCLUDE(CheckIncludeFileCXX)
|
||||
CHECK_INCLUDE_FILE_CXX(backtrace.h HAVE_BACKTRACE_HEADERS)
|
||||
if (HAVE_BACKTRACE_HEADERS)
|
||||
add_definitions(-DBFP_HAS_BACKTRACE)
|
||||
endif ()
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
#ifdef BFP_BACKTRACE_PATH
|
||||
#include BFP_BACKTRACE_PATH
|
||||
#else
|
||||
#elif BFP_HAS_BACKTRACE
|
||||
#include "backtrace.h"
|
||||
#include "backtrace-supported.h"
|
||||
#endif
|
||||
|
@ -45,6 +45,9 @@
|
|||
#define BFP_ERRPRINTF(...) fprintf (stderr, __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
//#include <cxxabi.h>
|
||||
//using __cxxabiv1::__cxa_demangle;
|
||||
|
||||
USING_NS_BF;
|
||||
|
||||
struct BfpPipeInfo
|
||||
|
@ -406,9 +409,14 @@ static _Unwind_Reason_Code UnwindHandler(struct _Unwind_Context* context, void*
|
|||
gUnwindExecStr += StrFormat(" %p", addr);
|
||||
#else
|
||||
Dl_info info;
|
||||
if (dladdr(addr, &info) && info.dli_sname)
|
||||
if (dladdr(addr, &info))
|
||||
{
|
||||
BFP_ERRPRINTF("0x%p %s\n", addr, info.dli_sname);
|
||||
if (info.dli_sname)
|
||||
BFP_ERRPRINTF("0x%p %s\n", addr, info.dli_sname);
|
||||
else if (info.dli_fname)
|
||||
BFP_ERRPRINTF("0x%p %s\n", addr, info.dli_fname);
|
||||
else
|
||||
BFP_ERRPRINTF("0x%p\n", addr);
|
||||
}
|
||||
#endif
|
||||
return _URC_NO_REASON;
|
||||
|
@ -503,9 +511,20 @@ BFP_EXPORT void BFP_CALLTYPE BfpSystem_Init(int version, BfpSystemInitFlags flag
|
|||
BfpSystem_FatalError(StrFormat("Bfp build version '%d' does not match requested version '%d'", BFP_VERSION, version).c_str(), "BFP FATAL ERROR");
|
||||
}
|
||||
|
||||
signal(SIGSEGV, SigHandler);
|
||||
signal(SIGFPE, SigHandler);
|
||||
signal(SIGABRT, SigHandler);
|
||||
//if (ptrace(PTRACE_TRACEME, 0, 1, 0) != -1)
|
||||
{
|
||||
//ptrace(PTRACE_DETACH, 0, 1, 0);
|
||||
//signal(SIGSEGV, SigHandler);
|
||||
//signal(SIGFPE, SigHandler);
|
||||
//signal(SIGABRT, SigHandler);
|
||||
|
||||
/*struct sigaction action;
|
||||
memset(&action, 0, sizeof(action));
|
||||
action.sa_sigaction = signal_segv;
|
||||
action.sa_flags = SA_SIGINFO;
|
||||
if(sigaction(SIGSEGV, &action, NULL) < 0)
|
||||
perror("sigaction");*/
|
||||
}
|
||||
}
|
||||
|
||||
BFP_EXPORT void BFP_CALLTYPE BfpSystem_SetCommandLine(int argc, char** argv)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue