From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@adacore.com>
Subject: [PATCH 1/2] Use common_val_print_checked in print_variable_and_value
Date: Thu, 1 Apr 2021 11:58:30 -0600 [thread overview]
Message-ID: <20210401175831.3373671-2-tromey@adacore.com> (raw)
In-Reply-To: <20210401175831.3373671-1-tromey@adacore.com>
GDB was crashing in "bt full" for a large Ada program. I tracked this
down to a combination of bugs.
The first bug, fixed here, is that print_variable_and_value calls
common_val_print. Normally only the value-printing implementation
should call this; from the top level, common_val_print_checked is
preferred, because it correctly handles values that are wholly
optimized out.
I wasn't able to write a test case for this.
gdb/ChangeLog
2021-04-01 Tom Tromey <tromey@adacore.com>
* printcmd.c (print_variable_and_value): Use
common_val_print_checked.
---
gdb/ChangeLog | 5 +++++
gdb/printcmd.c | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index c82f709136f..a4f62f207d0 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -2387,7 +2387,7 @@ print_variable_and_value (const char *name, struct symbol *var,
val = read_var_value (var, NULL, frame);
get_user_print_options (&opts);
opts.deref_ref = 1;
- common_val_print (val, stream, indent, &opts, current_language);
+ common_val_print_checked (val, stream, indent, &opts, current_language);
/* common_val_print invalidates FRAME when a pretty printer calls inferior
function. */
--
2.26.2
next prev parent reply other threads:[~2021-04-01 17:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-01 17:58 [PATCH 0/2] Fix crash in 'bt' with Ada Tom Tromey
2021-04-01 17:58 ` Tom Tromey [this message]
2021-04-16 10:45 ` [PATCH 1/2] Use common_val_print_checked in print_variable_and_value Tom de Vries
2021-04-16 20:11 ` Tom Tromey
2021-04-17 12:38 ` Tom de Vries
2021-04-01 17:58 ` [PATCH 2/2] Avoid crash in Ada value printing with optimized-out array Tom Tromey
2021-04-15 16:08 ` [PATCH 0/2] Fix crash in 'bt' with Ada Tom Tromey
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=20210401175831.3373671-2-tromey@adacore.com \
--to=tromey@adacore.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).