Lines 1-42
Link Here
|
1 |
--- debughelper.cpp.orig 2014-12-04 18:53:50 UTC |
|
|
2 |
+++ debughelper.cpp |
3 |
@@ -107,6 +107,7 @@ struct SimulatedCPU { |
4 |
//===========================CRASH HANDLER HEADER============================== |
5 |
|
6 |
#ifdef OS_IS_UNIX_LIKE |
7 |
+#include "signal.h" |
8 |
#include "unistd.h" |
9 |
#include "sys/wait.h" |
10 |
#define SAFE_INT volatile sig_atomic_t |
11 |
@@ -473,13 +474,25 @@ void print_backtrace(const QString& mess |
12 |
|
13 |
#define USE_SIGNAL_HANDLER |
14 |
#ifdef CPU_IS_X86_64 |
15 |
-#define PC_FROM_UCONTEXT(context) (context)->uc_mcontext.gregs[REG_RIP] |
16 |
-#define STACK_FROM_UCONTEXT(context) (context)->uc_mcontext.gregs[REG_RSP] |
17 |
-#define FRAME_FROM_UCONTEXT(context) (context)->uc_mcontext.gregs[REG_RBP] |
18 |
+ #if defined(__FreeBSD__) |
19 |
+ #define PC_FROM_UCONTEXT(context) (context)->uc_mcontext.mc_rip |
20 |
+ #define STACK_FROM_UCONTEXT(context) (context)->uc_mcontext.mc_rsp |
21 |
+ #define FRAME_FROM_UCONTEXT(context) (context)->uc_mcontext.mc_rbp |
22 |
+ #else |
23 |
+ #define PC_FROM_UCONTEXT(context) (context)->uc_mcontext.gregs[REG_RIP] |
24 |
+ #define STACK_FROM_UCONTEXT(context) (context)->uc_mcontext.gregs[REG_RSP] |
25 |
+ #define FRAME_FROM_UCONTEXT(context) (context)->uc_mcontext.gregs[REG_RBP] |
26 |
+ #endif |
27 |
#elif defined(CPU_IS_X86_32) |
28 |
-#define PC_FROM_UCONTEXT(context) (context)->uc_mcontext.gregs[REG_EIP] |
29 |
-#define STACK_FROM_UCONTEXT(context) (context)->uc_mcontext.gregs[REG_ESP] |
30 |
-#define FRAME_FROM_UCONTEXT(context) (context)->uc_mcontext.gregs[REG_EBP] |
31 |
+ #if defined(__FreeBSD__) |
32 |
+ #define PC_FROM_UCONTEXT(context) (context)->uc_mcontext.mc_eip |
33 |
+ #define STACK_FROM_UCONTEXT(context) (context)->uc_mcontext.mc_esp |
34 |
+ #define FRAME_FROM_UCONTEXT(context) (context)->uc_mcontext.mc_ebp |
35 |
+ #else |
36 |
+ #define PC_FROM_UCONTEXT(context) (context)->uc_mcontext.gregs[REG_EIP] |
37 |
+ #define STACK_FROM_UCONTEXT(context) (context)->uc_mcontext.gregs[REG_ESP] |
38 |
+ #define FRAME_FROM_UCONTEXT(context) (context)->uc_mcontext.gregs[REG_EBP] |
39 |
+ #endif |
40 |
#elif defined(CPU_IS_PPC) |
41 |
#define PC_FROM_UCONTEXT(context) (context)->uc_mcontext.gp_regs[32] |
42 |
#define STACK_FROM_UCONTEXT(context) (context)->uc_mcontext.gp_regs[1] |