public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: Andrew Burgess <andrew.burgess@embecosm.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 6/6] gdb: print backtrace for internal error/warning
Date: Thu, 19 Aug 2021 15:01:11 -0400	[thread overview]
Message-ID: <a9b22059-852f-d6aa-97b2-5712fdc79adb@polymtl.ca> (raw)
In-Reply-To: <04cfbd78745b617540a7686ba29f940be8a55fcb.1629366146.git.andrew.burgess@embecosm.com>

On 2021-08-19 5:49 a.m., Andrew Burgess wrote:
> This commit builds on previous work to allow GDB to print a backtrace
> of itself when GDB encounters an internal-error or internal-warning.
> 
> 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.

Thanks for doing this, I think it will be very useful.

Simon

  reply	other threads:[~2021-08-19 19:01 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 [this message]
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
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=a9b22059-852f-d6aa-97b2-5712fdc79adb@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=andrew.burgess@embecosm.com \
    --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).