From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-il1-x131.google.com (mail-il1-x131.google.com [IPv6:2607:f8b0:4864:20::131]) by sourceware.org (Postfix) with ESMTPS id 80A07385736A for ; Mon, 6 Jun 2022 16:12:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 80A07385736A Received: by mail-il1-x131.google.com with SMTP id r3so12270680ilt.8 for ; Mon, 06 Jun 2022 09:12:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=J5Am6rpU9udWp0QWR9SfODgX4BHGgZT0mz+aZVNmjhs=; b=baoynwP1guRHslJQtmoNVZGUNhzEp+ae6uXJW1z+Hlm+lZ01E0h/dj7GaoN6UbXuTv 8sfa+NT6c0I4wojWAq2EEzHl0w5vYJ+ebJYOCrvYRnNRsuxdcep3Sms9CMdb4z0IzEvI n3IE3vsBMDsp06dJV8JWkwtDvUjxLZp2hgstG5kgmSLrPkBsrkfKzBbumIeCZQ8D+889 XwdKs+/xHRmLWdidyB1wksR9QfiAi1/gY2KsSRA5+qxZEWDjDBL8so5IO3TiX1Kqi1H6 hH651psV6iorvfcofaaNFxXuXIg2N65Y6mklArFqF17PybpqGmUFK9CWttT3IF8/4YFy 6LTw== X-Gm-Message-State: AOAM5311fIriyU3xPMldkoeXP4M/3wXk3UVNiOOpf6on8gMDH7BtCdIS tSCnLqP5siB8Cba/YA926HQXT0CFar43qg== X-Google-Smtp-Source: ABdhPJw5LBhbpQYu7mkPiR0kLCDWhuwVsiC11fU1J+NPNEnZMr+0dOHuHMdJAb1eJRBUp8OuK6Sx6w== X-Received: by 2002:a05:6e02:4a1:b0:2d3:a778:f0f1 with SMTP id e1-20020a056e0204a100b002d3a778f0f1mr14313894ils.212.1654531920812; Mon, 06 Jun 2022 09:12:00 -0700 (PDT) Received: from murgatroyd.Home (71-211-171-143.hlrn.qwest.net. [71.211.171.143]) by smtp.gmail.com with ESMTPSA id bt12-20020a056638430c00b0032e4d3933bcsm5690980jab.122.2022.06.06.09.11.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 09:12:00 -0700 (PDT) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Move finish_print out of value_print_options Date: Mon, 6 Jun 2022 10:11:56 -0600 Message-Id: <20220606161156.3073171-1-tromey@adacore.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Jun 2022 16:12:03 -0000 '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; + 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