diff options
| author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2019-11-08 15:44:20 -0300 |
|---|---|---|
| committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2019-11-08 15:44:20 -0300 |
| commit | 71a8a4f6e36547bb060dbcc961ea9b57420f7190 (patch) | |
| tree | 3abd0dc46c18cc7400933fb2ef3f19d3e8f3f28a /src/include/utils | |
| parent | 3dcffb381c81c9c8f8254100feacac256b9e75a6 (diff) | |
Add backtrace support for error reporting
Add some support for automatically showing backtraces in certain error
situations in the server. Backtraces are shown on assertion failure;
also, a new setting backtrace_functions can be set to a list of C
function names, and all ereport()s and elog()s from the mentioned
functions will have backtraces generated. Finally, the function
errbacktrace() can be manually added to an ereport() call to generate a
backtrace for that call.
Authors: Peter Eisentraut, Álvaro Herrera
Discussion: https://postgr.es/m//5f48cb47-bf1e-05b6-7aae-3bf2cd01586d@2ndquadrant.com
Discussion: https://postgr.es/m/CAMsr+YGL+yfWE=JvbUbnpWtrRZNey7hJ07+zT4bYJdVp4Szdrg@mail.gmail.com
Diffstat (limited to 'src/include/utils')
| -rw-r--r-- | src/include/utils/elog.h | 3 | ||||
| -rw-r--r-- | src/include/utils/guc.h | 2 |
2 files changed, 5 insertions, 0 deletions
diff --git a/src/include/utils/elog.h b/src/include/utils/elog.h index 47412a831f0..9ab4b5470b7 100644 --- a/src/include/utils/elog.h +++ b/src/include/utils/elog.h @@ -189,6 +189,8 @@ extern int errcontext_msg(const char *fmt,...) pg_attribute_printf(1, 2); extern int errhidestmt(bool hide_stmt); extern int errhidecontext(bool hide_ctx); +extern int errbacktrace(void); + extern int errfunction(const char *funcname); extern int errposition(int cursorpos); @@ -392,6 +394,7 @@ typedef struct ErrorData char *detail_log; /* detail error message for server log only */ char *hint; /* hint message */ char *context; /* context message */ + char *backtrace; /* backtrace */ const char *message_id; /* primary message's id (original string) */ char *schema_name; /* name of schema */ char *table_name; /* name of table */ diff --git a/src/include/utils/guc.h b/src/include/utils/guc.h index 9aa3d025965..50098e63fea 100644 --- a/src/include/utils/guc.h +++ b/src/include/utils/guc.h @@ -256,6 +256,8 @@ extern int log_min_duration_statement; extern int log_temp_files; extern double log_statement_sample_rate; extern double log_xact_sample_rate; +extern char *backtrace_functions; +extern char *backtrace_symbol_list; extern int temp_file_limit; |
