diff options
author | Haruna <haru@dotalux.com> | 2015-05-30 21:27:19 +0200 |
---|---|---|
committer | Haruna <haru@dotalux.com> | 2015-05-30 21:27:19 +0200 |
commit | 4769ab782350323e5eee63a4df5e55f51eec6b85 (patch) | |
tree | 93231ea05f6b30310f343b9635da07da901b96bc | |
parent | daf5312ee4d1de6dd43b23f719e94427aeb33e5d (diff) | |
parent | c5ff02958806ea5a672dcc9371602a6c090c6758 (diff) | |
download | hercules-4769ab782350323e5eee63a4df5e55f51eec6b85.tar.gz hercules-4769ab782350323e5eee63a4df5e55f51eec6b85.tar.bz2 hercules-4769ab782350323e5eee63a4df5e55f51eec6b85.tar.xz hercules-4769ab782350323e5eee63a4df5e55f51eec6b85.zip |
Merge pull request #527 from 4144/dumpstack
Dump stack in nullpo*/Assert* function.
-rwxr-xr-x | configure | 3 | ||||
-rw-r--r-- | configure.in | 1 | ||||
-rw-r--r-- | src/common/nullpo.c | 17 |
3 files changed, 20 insertions, 1 deletions
@@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in 18c1133. +# From configure.in 3bd5d73. # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69. # @@ -4616,6 +4616,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu CFLAGS="$CFLAGS -pipe -ffast-math -Wall -Wextra -Wno-sign-compare" CPPFLAGS="$CPPFLAGS -I../common" +LDFLAGS="$LDFLAGS -rdynamic" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 diff --git a/configure.in b/configure.in index 9497ce6bc..d17f5b4a7 100644 --- a/configure.in +++ b/configure.in @@ -487,6 +487,7 @@ AC_LANG([C]) CFLAGS="$CFLAGS -pipe -ffast-math -Wall -Wextra -Wno-sign-compare" CPPFLAGS="$CPPFLAGS -I../common" +LDFLAGS="$LDFLAGS -rdynamic" AC_C_BIGENDIAN( diff --git a/src/common/nullpo.c b/src/common/nullpo.c index e61d52257..97b206835 100644 --- a/src/common/nullpo.c +++ b/src/common/nullpo.c @@ -8,7 +8,11 @@ #include <stdio.h> #include <stdarg.h> +#include <stdlib.h> #include <string.h> +#ifdef __GNUC__ +#include <execinfo.h> +#endif #include "../common/showmsg.h" @@ -24,6 +28,12 @@ struct nullpo_interface nullpo_s; * @param title Message title to display (i.e. failed assertion or nullpo info) */ void assert_report(const char *file, int line, const char *func, const char *targetname, const char *title) { +#ifdef __GNUC__ + void *array[10]; + int size; + char **strings; + int i; +#endif if (file == NULL) file = "??"; @@ -32,6 +42,13 @@ void assert_report(const char *file, int line, const char *func, const char *tar ShowError("--- %s --------------------------------------------\n", title); ShowError("%s:%d: '%s' in function `%s'\n", file, line, targetname, func); +#ifdef __GNUC__ + size = backtrace (array, 10); + strings = backtrace_symbols (array, size); + for (i = 0; i < size; i++) + ShowError("%s\n", strings[i]); + free (strings); +#endif ShowError("--- end %s ----------------------------------------\n", title); } |