errbacktrace
Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2019-06-25T11:08:21Z
Lists: pgsql-hackers
Attachments
- v2-0001-Add-errbacktrace-and-backtrace_function-GUC.patch (text/plain) patch v2-0001
New thread continuing from <https://www.postgresql.org/message-id/d4903af2-e7b7-b551-71f8-3e4a6bdc2e73@2ndquadrant.com>. Here is a extended version of Álvaro's patch that adds an errbacktrace() function. You can do two things with this: - Manually attach it to an ereport() call site that you want to debug. - Set a configuration parameter like backtrace_function = 'int8in' to debug ereport()/elog() calls in a specific function. There was also mention of settings that would automatically produce backtraces for PANICs etc. Those could surely be added if there is enough interest. For the implementation, I support both backtrace() provided by the OS as well as using libunwind. The former seems to be supported by a number of platforms, including glibc, macOS, and FreeBSD, so maybe we don't need the libunwind suport. I haven't found any difference in quality in the backtraces between the two approaches, but surely that is highly dependent on the exact configuration. I would welcome testing in all direction with this, to see how well it works in different circumstances. -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Commits
-
Remove debugging aid
- 45ff049e288b 13.0 landed