public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Burgess <andrew.burgess@embecosm.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: gdb-patches@sourceware.org
Subject: Re: [PUSHED 6/6] gdb: print backtrace for internal error/warning
Date: Wed, 29 Sep 2021 09:34:44 +0100	[thread overview]
Message-ID: <20210929083444.GL1900093@embecosm.com> (raw)
In-Reply-To: <83ee98khrs.fsf@gnu.org>

* Eli Zaretskii <eliz@gnu.org> [2021-09-28 15:26:47 +0300]:

> > 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?

I'm not sure.  libbacktrace is now included within the binutils-gdb
repository, so it's not like this is a dependency that users will need
to hunt down and install on their own.

It is true that libbacktrace could potentially not be supported/built
on a particular target, but then GDB falls back to the libc
backtrace() API, so libbacktrace isn't a hard requirement for getting
such a backtrace, it's just one possible requirement.

Would you suggest that this dependency situation be described in the
actual .texinfo docs?  Or just mentioned in the NEWS file?

If you can give some more guidance, I'll try to draft some suitable
words.

> 
> > +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".

Thanks, I fixed the two places I said 'stderr' with the patch below
which I pushed.

Thanks,
Andrew

---

commit 4180173142185f0967dfefb131e4843a17779c86
Author: Andrew Burgess <andrew.burgess@embecosm.com>
Date:   Wed Sep 29 09:25:03 2021 +0100

    gdb/doc: use 'standard error stream' instead of 'stderr' in some places
    
    With this commit:
    
      commit 91f2597bd24d171c1337a4629f8237aa47c59082
      Date:   Thu Aug 12 18:24:59 2021 +0100
    
          gdb: print backtrace for internal error/warning
    
    I included some references to 'stderr', which, it was pointed out,
    would be better written as 'standard error stream'.  See:
    
      https://sourceware.org/pipermail/gdb-patches/2021-September/182225.html
    
    This commit replaces the two instances of 'stderr' that I introduced.

diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index d4e4174be5d..c156a1d6739 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -39266,9 +39266,9 @@
 @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}.
+possible to have a backtrace of @value{GDBN} printed to the standard
+error stream.  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}
@@ -39768,9 +39768,9 @@
 @itemx maint show backtrace-on-fatal-signal
 When this setting is @code{on}, if @value{GDBN} itself terminates with
 a fatal signal (e.g.@: SIGSEGV), then a limited backtrace will be
-printed to stderr.  This backtrace can be used to help diagnose
-crashes within @value{GDBN} in situations where a user is unable to
-share a corefile with the @value{GDBN} developers.
+printed to the standard error stream.  This backtrace can be used to
+help diagnose crashes within @value{GDBN} in situations where a user
+is unable to share a corefile with the @value{GDBN} developers.
 
 If the functionality to provide this backtrace is not available for
 the platform on which GDB is running then this feature will be

  reply	other threads:[~2021-09-29  8:34 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-19  9:49 [PATCH 0/6] Display GDB backtrace for internal errors Andrew Burgess
2021-08-19  9:49 ` [PATCH 1/6] gdb: use bool instead of int in struct internal_problem Andrew Burgess
2021-08-19 18:33   ` Simon Marchi
2021-09-07 14:11     ` Andrew Burgess
2021-08-19  9:49 ` [PATCH 2/6] gdb: make use of std::string in utils.c Andrew Burgess
2021-08-19 18:41   ` Simon Marchi
2021-09-07 14:12     ` Andrew Burgess
2021-08-19  9:49 ` [PATCH 3/6] gdb: Add a dependency between gdb and libbacktrace Andrew Burgess
2021-08-19 18:43   ` Simon Marchi
2021-08-27 17:44     ` Tom Tromey
2021-08-30 20:33       ` Andrew Burgess
2021-08-19  9:49 ` [PATCH 4/6] Copy in libbacktrace from gcc Andrew Burgess
2021-08-27 17:46   ` Tom Tromey
2021-08-30 20:34     ` Andrew Burgess
2021-08-19  9:49 ` [PATCH 5/6] gdb: use libbacktrace to create a better backtrace for fatal signals Andrew Burgess
2021-08-19 18:58   ` Simon Marchi
2021-08-19  9:49 ` [PATCH 6/6] gdb: print backtrace for internal error/warning Andrew Burgess
2021-08-19 19:01   ` Simon Marchi
2021-08-30 14:16 ` [PATCH 0/6] Display GDB backtrace for internal errors Tom de Vries
2021-08-30 20:35   ` Andrew Burgess
2021-08-31 11:17 ` Florian Weimer
2021-09-28 11:26 ` [PUSHED " Andrew Burgess
2021-09-28 11:26   ` [PUSHED 1/6] top-level configure: setup target_configdirs based on repository Andrew Burgess
2021-09-28 11:26   ` [PUSHED 2/6] gdb: Add a dependency between gdb and libbacktrace Andrew Burgess
2021-09-28 11:26   ` [PUSHED 4/6] src-release.sh: add libbacktrace to GDB_SUPPORT_DIRS Andrew Burgess
2021-09-28 11:26   ` [PUSHED 5/6] gdb: use libbacktrace to create a better backtrace for fatal signals Andrew Burgess
2021-09-28 18:55     ` Pedro Alves
2021-09-29  8:21       ` Andrew Burgess
2021-09-29  3:09     ` Simon Marchi
2021-09-29  9:56       ` Andrew Burgess
2021-09-28 11:26   ` [PUSHED 6/6] gdb: print backtrace for internal error/warning Andrew Burgess
2021-09-28 12:26     ` Eli Zaretskii
2021-09-29  8:34       ` Andrew Burgess [this message]
2021-09-28 12:20   ` [PUSHED 3/6] Copy in libbacktrace from gcc Andrew Burgess

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210929083444.GL1900093@embecosm.com \
    --to=andrew.burgess@embecosm.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).