[PUSHED 6/6] gdb: print backtrace for internal error/warning
Eli Zaretskii
eliz@gnu.org
Tue Sep 28 12:26:47 GMT 2021
> From: Andrew Burgess <andrew.burgess@embecosm.com>
> Date: Tue, 28 Sep 2021 12:26:24 +0100
>
> ../../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
> ---
> gdb/NEWS | 8 ++
> gdb/doc/gdb.texinfo | 13 ++
> .../gdb.base/bt-on-error-and-warning.exp | 118 ++++++++++++++++++
> gdb/testsuite/gdb.base/bt-on-fatal-signal.exp | 36 ------
> gdb/utils.c | 36 +++++-
> 5 files changed, 174 insertions(+), 37 deletions(-)
> create mode 100644 gdb/testsuite/gdb.base/bt-on-error-and-warning.exp
>
> diff --git a/gdb/NEWS b/gdb/NEWS
> index d7c29c82edb..1e25cb8cc36 100644
> --- a/gdb/NEWS
> +++ b/gdb/NEWS
> @@ -19,6 +19,14 @@ show source open
> to open and read source code files, which can be useful if the files
> are located over a slow network connection.
>
> +maint set internal-error backtrace on|off
> +maint show internal-error backtrace
> +maint set internal-warning backtrace on|off
> +maint show internal-warning backtrace
> + GDB can now print a backtrace of itself when it encounters either an
> + internal-error, or an internal-warning. This is on by default for
> + internal-error and off by default for internal-warning.
Does this depend on libbacktrace? If so, should that be mentioned in
the documentation?
> +When @value{GDBN} reports an internal problem (error or warning) it is
> +possible to have a backtrace of @value{GDBN} printed to stderr. This
I suggest "standard error stream" instead of "stderr".
The documentation parts are okay with these nits taken care of.
Thanks.
More information about the Gdb-patches
mailing list