aboutsummaryrefslogtreecommitdiff
path: root/gdb/doc
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2021-08-12 18:24:59 +0100
committerAndrew Burgess <andrew.burgess@embecosm.com>2021-09-28 12:21:22 +0100
commit91f2597bd24d171c1337a4629f8237aa47c59082 (patch)
tree930307c3ee14c5578dc90785324c6a653e1109a6 /gdb/doc
parentabbbd4a3e0ca51132e7fb31a43f896d29894dae0 (diff)
downloadgdb-91f2597bd24d171c1337a4629f8237aa47c59082.zip
gdb-91f2597bd24d171c1337a4629f8237aa47c59082.tar.gz
gdb-91f2597bd24d171c1337a4629f8237aa47c59082.tar.bz2
gdb: print backtrace for internal error/warning
This commit builds on previous work to allow GDB to print a backtrace of itself when GDB encounters an internal-error or internal-warning. This fixes PR gdb/26377. There's not many places where we call internal_warning, and I guess in most cases the user would probably continue their debug session. And so, in order to avoid cluttering up the output, by default, printing of a backtrace is off for internal-warnings. In contrast, printing of a backtrace is on by default for internal-errors, as I figure that in most cases hitting an internal-error is going to be the end of the debug session. Whether a backtrace is printed or not can be controlled with the new settings: maintenance set internal-error backtrace on|off maintenance show internal-error backtrace maintenance set internal-warning backtrace on|off maintenance show internal-warning backtrace Here is an example of what an internal-error now looks like with the backtrace included: (gdb) maintenance internal-error blah ../../src.dev-3/gdb/maint.c:82: internal-error: blah A problem internal to GDB has been detected, further debugging may prove unreliable. ----- Backtrace ----- 0x5c61ca gdb_internal_backtrace_1 ../../src.dev-3/gdb/bt-utils.c:123 0x5c626d _Z22gdb_internal_backtracev ../../src.dev-3/gdb/bt-utils.c:165 0xe33237 internal_vproblem ../../src.dev-3/gdb/utils.c:393 0xe33539 _Z15internal_verrorPKciS0_P13__va_list_tag ../../src.dev-3/gdb/utils.c:470 0x1549652 _Z14internal_errorPKciS0_z ../../src.dev-3/gdbsupport/errors.cc:55 0x9c7982 maintenance_internal_error ../../src.dev-3/gdb/maint.c:82 0x636f57 do_simple_func ../../src.dev-3/gdb/cli/cli-decode.c:97 .... snip, lots more backtrace lines .... --------------------- ../../src.dev-3/gdb/maint.c:82: internal-error: blah A problem internal to GDB has been detected, further debugging may prove unreliable. Quit this debugging session? (y or n) y This is a bug, please report it. For instructions, see: <https://www.gnu.org/software/gdb/bugs/>. ../../src.dev-3/gdb/maint.c:82: internal-error: blah A problem internal to GDB has been detected, further debugging may prove unreliable. Create a core file of GDB? (y or n) n My hope is that this backtrace might make it slightly easier to diagnose GDB issues if all that is provided is the console output, I find that we frequently get reports of an assert being hit that is located in pretty generic code (frame.c, value.c, etc) and it is not always obvious how we might have arrived at the assert. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=26377
Diffstat (limited to 'gdb/doc')
-rw-r--r--gdb/doc/gdb.texinfo13
1 files changed, 13 insertions, 0 deletions
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index fcfdc26..d4e4174 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -39257,6 +39257,19 @@ demangler warnings always create a core file and this cannot be
disabled.
@end table
+@kindex maint set internal-error
+@kindex maint show internal-error
+@kindex maint set internal-warning
+@kindex maint show internal-warning
+@item maint set internal-error backtrace @r{[}on|off@r{]}
+@itemx maint show internal-error backtrace
+@itemx maint set internal-warning backtrace @r{[}on|off@r{]}
+@itemx maint show internal-warning backtrace
+When @value{GDBN} reports an internal problem (error or warning) it is
+possible to have a backtrace of @value{GDBN} printed to stderr. This
+is @samp{on} by default for @code{internal-error} and @samp{off} by
+default for @code{internal-warning}.
+
@kindex maint packet
@item maint packet @var{text}
If @value{GDBN} is talking to an inferior via the serial protocol,