From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@adacore.com>
Subject: [PATCH] Move finish_print out of value_print_options
Date: Mon, 6 Jun 2022 10:11:56 -0600 [thread overview]
Message-ID: <20220606161156.3073171-1-tromey@adacore.com> (raw)
'finish_print' does not really belong in value_print_options -- this
is consulted only when deciding whether or not to print a value, and
never during the course of printing. This patch removes it from the
structure and makes it a static global in infcmd.c instead.
Tested on x86-64 Fedora 34.
---
gdb/infcmd.c | 15 ++++++++++-----
gdb/valprint.c | 1 -
gdb/valprint.h | 3 ---
3 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index e909d4d4c81..d4a8e021edc 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -98,6 +98,11 @@ enum stop_stack_kind stop_stack_dummy;
int stopped_by_random_signal;
+
+/* Whether "finish" should print the value. */
+
+static bool finish_print = true;
+
\f
static void
@@ -1524,17 +1529,17 @@ print_return_value_1 (struct ui_out *uiout, struct return_value_info *rv)
{
if (rv->value != NULL)
{
- struct value_print_options opts;
-
/* Print it. */
uiout->text ("Value returned is ");
uiout->field_fmt ("gdb-result-var", "$%d",
rv->value_history_index);
uiout->text (" = ");
- get_user_print_options (&opts);
- if (opts.finish_print)
+ if (finish_print)
{
+ struct value_print_options opts;
+ get_user_print_options (&opts);
+
string_file stb;
value_print (rv->value, &stb, &opts);
uiout->field_stream ("return-value", stb);
@@ -3354,7 +3359,7 @@ List all available info about the specified process."),
&info_proc_cmdlist);
add_setshow_boolean_cmd ("finish", class_support,
- &user_print_options.finish_print, _("\
+ &finish_print, _("\
Set whether `finish' prints the return value."), _("\
Show whether `finish' prints the return value."), NULL,
NULL,
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 47114676934..941746d35c5 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -120,7 +120,6 @@ struct value_print_options user_print_options =
0, /* summary */
1, /* symbol_print */
PRINT_MAX_DEPTH_DEFAULT, /* max_depth */
- 1 /* finish_print */
};
/* Initialize *OPTS to be a copy of the user print options. */
diff --git a/gdb/valprint.h b/gdb/valprint.h
index ff536fbe4f0..8ebe1a41521 100644
--- a/gdb/valprint.h
+++ b/gdb/valprint.h
@@ -100,9 +100,6 @@ struct value_print_options
/* Maximum print depth when printing nested aggregates. */
int max_depth;
-
- /* Whether "finish" should print the value. */
- bool finish_print;
};
/* Create an option_def_group for the value_print options, with OPTS
--
2.34.1
next reply other threads:[~2022-06-06 16:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-06 16:11 Tom Tromey [this message]
2022-06-20 15:10 ` 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=20220606161156.3073171-1-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).