Line 0
Link Here
|
|
|
1 |
--- mysys/stacktrace.c.orig 2018-03-26 16:41:18 UTC |
2 |
+++ mysys/stacktrace.c |
3 |
@@ -34,19 +34,19 @@ |
4 |
#include <execinfo.h> |
5 |
#endif |
6 |
|
7 |
+#ifdef __linux__ |
8 |
#define PTR_SANE(p) ((p) && (char*)(p) >= heap_start && (char*)(p) <= heap_end) |
9 |
- |
10 |
static char *heap_start; |
11 |
- |
12 |
-#if(defined HAVE_BSS_START) && !(defined __linux__) |
13 |
extern char *__bss_start; |
14 |
-#endif |
15 |
+#else |
16 |
+#define PTR_SANE(p) (p) |
17 |
+#endif /* __linux */ |
18 |
|
19 |
void my_init_stacktrace() |
20 |
{ |
21 |
-#if(defined HAVE_BSS_START) && !(defined __linux__) |
22 |
+#ifdef __linux__ |
23 |
heap_start = (char*) &__bss_start; |
24 |
-#endif |
25 |
+#endif /* __linux__ */ |
26 |
} |
27 |
|
28 |
#ifdef __linux__ |
29 |
@@ -149,15 +149,16 @@ static int safe_print_str(const char *ad |
30 |
|
31 |
int my_safe_print_str(const char* val, int max_len) |
32 |
{ |
33 |
+#ifdef __linux__ |
34 |
+/* Only needed by the linux version of PTR_SANE */ |
35 |
char *heap_end; |
36 |
|
37 |
-#ifdef __linux__ |
38 |
// Try and make use of /proc filesystem to safely print memory contents. |
39 |
if (!safe_print_str(val, max_len)) |
40 |
return 0; |
41 |
-#endif |
42 |
|
43 |
heap_end= (char*) sbrk(0); |
44 |
+#endif |
45 |
|
46 |
if (!PTR_SANE(val)) |
47 |
{ |