From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id 84F243858C2C; Mon, 20 Jun 2022 15:16:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 84F243858C2C Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom Tromey To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Move finish_print out of value_print_options X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: 0d02e70b197c786f26175b9a73f94e01d14abdab X-Git-Newrev: 5ffa6ca3e553563004bd9d306bef38e2bee6fecc Message-Id: <20220620151640.84F243858C2C@sourceware.org> Date: Mon, 20 Jun 2022 15:16:40 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jun 2022 15:16:40 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D5ffa6ca3e553= 563004bd9d306bef38e2bee6fecc commit 5ffa6ca3e553563004bd9d306bef38e2bee6fecc Author: Tom Tromey Date: Mon Jun 6 10:01:40 2022 -0600 Move finish_print out of value_print_options =20 '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. =20 Tested on x86-64 Fedora 34. Diff: --- 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 18590259339..17d15534356 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -98,6 +98,11 @@ enum stop_stack_kind stop_stack_dummy; =20 int stopped_by_random_signal; =20 + +/* Whether "finish" should print the value. */ + +static bool finish_print =3D true; + =0C =20 static void @@ -1524,17 +1529,17 @@ print_return_value_1 (struct ui_out *uiout, struct = return_value_info *rv) { if (rv->value !=3D 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 (" =3D "); - get_user_print_options (&opts); =20 - 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); @@ -3351,7 +3356,7 @@ List all available info about the specified process."= ), &info_proc_cmdlist); =20 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 e63ec30f4c7..f873e12d0ca 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -121,7 +121,6 @@ struct value_print_options user_print_options =3D 0, /* summary */ 1, /* symbol_print */ PRINT_MAX_DEPTH_DEFAULT, /* max_depth */ - 1 /* finish_print */ }; =20 /* Initialize *OPTS to be a copy of the user print options. */ diff --git a/gdb/valprint.h b/gdb/valprint.h index d6ad45d7580..2e12eaadf93 100644 --- a/gdb/valprint.h +++ b/gdb/valprint.h @@ -103,9 +103,6 @@ struct value_print_options =20 /* Maximum print depth when printing nested aggregates. */ int max_depth; - - /* Whether "finish" should print the value. */ - bool finish_print; }; =20 /* Create an option_def_group for the value_print options, with OPTS