aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/error/assert.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/utils/error/assert.c')
-rw-r--r--src/backend/utils/error/assert.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/backend/utils/error/assert.c b/src/backend/utils/error/assert.c
index 2050b4355d1..1069bbee81c 100644
--- a/src/backend/utils/error/assert.c
+++ b/src/backend/utils/error/assert.c
@@ -18,6 +18,9 @@
#include "postgres.h"
#include <unistd.h>
+#ifdef HAVE_EXECINFO_H
+#include <execinfo.h>
+#endif
/*
* ExceptionalCondition - Handles the failure of an Assert()
@@ -42,6 +45,16 @@ ExceptionalCondition(const char *conditionName,
/* Usually this shouldn't be needed, but make sure the msg went out */
fflush(stderr);
+#ifdef HAVE_BACKTRACE_SYMBOLS
+ {
+ void *buf[100];
+ int nframes;
+
+ nframes = backtrace(buf, lengthof(buf));
+ backtrace_symbols_fd(buf, nframes, fileno(stderr));
+ }
+#endif
+
#ifdef SLEEP_ON_ASSERT
/*