mirror of https://github.com/citusdata/citus.git
show backtrace in assert failure and not abort
parent
1b3f4d79fe
commit
ea83823437
|
@ -8,7 +8,6 @@
|
||||||
|
|
||||||
#include "postgres.h"
|
#include "postgres.h"
|
||||||
#include "backtrace.h"
|
#include "backtrace.h"
|
||||||
// #include "backtrace-supported.h"
|
|
||||||
#include "lib/stringinfo.h"
|
#include "lib/stringinfo.h"
|
||||||
|
|
||||||
#include "distributed/backtrace.h"
|
#include "distributed/backtrace.h"
|
||||||
|
@ -54,6 +53,11 @@ Backtrace(int elevel)
|
||||||
errdetail("%s", GenerateBackTrace());
|
errdetail("%s", GenerateBackTrace());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AssertBacktrace(void) {
|
||||||
|
const char * backtrace = GenerateBackTrace();
|
||||||
|
ereport(ERROR, (errmsg("%s", backtrace)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
GenerateBackTrace(void)
|
GenerateBackTrace(void)
|
||||||
|
|
|
@ -12,5 +12,6 @@
|
||||||
#define CITUS_BACKTRACE_H
|
#define CITUS_BACKTRACE_H
|
||||||
|
|
||||||
void Backtrace(int elevel);
|
void Backtrace(int elevel);
|
||||||
|
void AssertBacktrace(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -66,4 +66,14 @@ extern char * HashLogMessage(const char *text);
|
||||||
ereport_domain(elevel, TEXTDOMAIN, rest); \
|
ereport_domain(elevel, TEXTDOMAIN, rest); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
#undef Trap
|
||||||
|
#define Trap(condition, errorType) \
|
||||||
|
do { \
|
||||||
|
if (condition) { \
|
||||||
|
AssertBacktrace(); \
|
||||||
|
ExceptionalCondition(CppAsString(condition), (errorType), \
|
||||||
|
__FILE__, __LINE__); \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
#endif /* LOG_UTILS_H */
|
#endif /* LOG_UTILS_H */
|
||||||
|
|
Loading…
Reference in New Issue