diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2020-08-03 14:44:06 +0200 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2020-08-03 14:44:06 +0200 |
commit | 57325e470615e79f674d82b2d5b09f609508fc6a (patch) | |
tree | 7a2e84a6753a5a5592f44f96194ad7a551c4669f /mysys/stacktrace.c | |
parent | 706a7101bfacd29f4f5728034be92240e82df583 (diff) | |
parent | c32f71af7e4b747de223bf6b44e691941f5997cf (diff) | |
download | mariadb-git-57325e470615e79f674d82b2d5b09f609508fc6a.tar.gz |
Merge branch '10.3' into 10.4
Diffstat (limited to 'mysys/stacktrace.c')
-rw-r--r-- | mysys/stacktrace.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/mysys/stacktrace.c b/mysys/stacktrace.c index 2274c505195..d9009d874d2 100644 --- a/mysys/stacktrace.c +++ b/mysys/stacktrace.c @@ -34,19 +34,20 @@ #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 */ + void my_init_stacktrace() { -#if(defined HAVE_BSS_START) && !(defined __linux__) +#ifdef __linux__ heap_start = (char*) &__bss_start; -#endif +#endif /* __linux */ } #ifdef __linux__ @@ -149,15 +150,15 @@ static int safe_print_str(const char *addr, size_t max_len) int my_safe_print_str(const char* val, size_t 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)) { |