diff options
Diffstat (limited to 'mysys/stacktrace.c')
-rw-r--r-- | mysys/stacktrace.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/mysys/stacktrace.c b/mysys/stacktrace.c index 91cddb6dbad..b47afe522f0 100644 --- a/mysys/stacktrace.c +++ b/mysys/stacktrace.c @@ -34,23 +34,21 @@ #include <execinfo.h> #endif +#ifdef __linux__ #define PTR_SANE(p) ((p) && (char*)(p) >= heap_start && (char*)(p) <= heap_end) - static char *heap_start; - -#if(defined HAVE_BSS_START) && !(defined __linux__) extern char *__bss_start; -#endif +#else +#define PTR_SANE(p) (p) +#endif /* __linux */ + +#ifdef __linux__ void my_init_stacktrace() { -#if(defined HAVE_BSS_START) && !(defined __linux__) heap_start = (char*) &__bss_start; -#endif } -#ifdef __linux__ - static void print_buffer(char *buffer, size_t count) { const char s[]= " "; @@ -149,15 +147,15 @@ static int safe_print_str(const char *addr, int max_len) int my_safe_print_str(const char* val, int max_len) { +#ifdef __linux__ char *heap_end; -#ifdef __linux__ // Try and make use of /proc filesystem to safely print memory contents. if (!safe_print_str(val, max_len)) return 0; -#endif heap_end= (char*) sbrk(0); +#endif if (!PTR_SANE(val)) { |