From patchwork Mon Apr 30 14:07:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 27037 Received: (qmail 22773 invoked by alias); 30 Apr 2018 14:07:39 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 22561 invoked by uid 89); 30 Apr 2018 14:07:38 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Initial X-HELO: gateway33.websitewelcome.com Received: from gateway33.websitewelcome.com (HELO gateway33.websitewelcome.com) (192.185.146.85) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 30 Apr 2018 14:07:37 +0000 Received: from cm13.websitewelcome.com (cm13.websitewelcome.com [100.42.49.6]) by gateway33.websitewelcome.com (Postfix) with ESMTP id A8DE119321A for ; Mon, 30 Apr 2018 09:07:35 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id D9SpfpscHQUwqD9SpfZsuj; Mon, 30 Apr 2018 09:07:35 -0500 X-Authority-Reason: nr=8 Received: from 97-122-176-117.hlrn.qwest.net ([97.122.176.117]:38138 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89_1) (envelope-from ) id 1fD9Sp-003cQs-FG; Mon, 30 Apr 2018 09:07:35 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 4/6] Remove a use of is_mi_like_p from tracepoint.c Date: Mon, 30 Apr 2018 08:07:30 -0600 Message-Id: <20180430140732.21601-5-tom@tromey.com> In-Reply-To: <20180430140732.21601-1-tom@tromey.com> References: <20180430140732.21601-1-tom@tromey.com> X-BWhitelist: no X-Source-L: No X-Exim-ID: 1fD9Sp-003cQs-FG X-Source-Sender: 97-122-176-117.hlrn.qwest.net (bapiya.Home) [97.122.176.117]:38138 X-Source-Auth: tom+tromey.com X-Email-Count: 5 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes This removes a use of is_mi_like_p and changes a printf_filtered into a call to ui_out::text. 2018-04-29 Tom Tromey * tracepoint.c (tvariables_info_1): Remove use of is_mi_like_p. --- gdb/ChangeLog | 4 +++ gdb/tracepoint.c | 75 ++++++++++++++++++++++++++++---------------------------- 2 files changed, 41 insertions(+), 38 deletions(-) diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 7e173ce75d..f40fb048d8 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -420,51 +420,50 @@ tvariables_info_1 (void) { struct ui_out *uiout = current_uiout; - if (tvariables.empty () && !uiout->is_mi_like_p ()) - { - printf_filtered (_("No trace state variables.\n")); - return; - } - /* Try to acquire values from the target. */ for (trace_state_variable &tsv : tvariables) tsv.value_known = target_get_trace_state_variable_value (tsv.number, &tsv.value); - ui_out_emit_table table_emitter (uiout, 3, tvariables.size (), - "trace-variables"); - uiout->table_header (15, ui_left, "name", "Name"); - uiout->table_header (11, ui_left, "initial", "Initial"); - uiout->table_header (11, ui_left, "current", "Current"); + { + ui_out_emit_table table_emitter (uiout, 3, tvariables.size (), + "trace-variables"); + uiout->table_header (15, ui_left, "name", "Name"); + uiout->table_header (11, ui_left, "initial", "Initial"); + uiout->table_header (11, ui_left, "current", "Current"); - uiout->table_body (); + uiout->table_body (); - for (const trace_state_variable &tsv : tvariables) - { - const char *c; - - ui_out_emit_tuple tuple_emitter (uiout, "variable"); - - uiout->field_string ("name", std::string ("$") + tsv.name); - uiout->field_string ("initial", plongest (tsv.initial_value)); - - if (tsv.value_known) - c = plongest (tsv.value); - else if (uiout->is_mi_like_p ()) - /* For MI, we prefer not to use magic string constants, but rather - omit the field completely. The difference between unknown and - undefined does not seem important enough to represent. */ - c = NULL; - else if (current_trace_status ()->running || traceframe_number >= 0) - /* The value is/was defined, but we don't have it. */ - c = ""; - else - /* It is not meaningful to ask about the value. */ - c = ""; - if (c) - uiout->field_string ("current", c); - uiout->text ("\n"); - } + for (const trace_state_variable &tsv : tvariables) + { + const char *c; + + ui_out_emit_tuple tuple_emitter (uiout, "variable"); + + uiout->field_string ("name", std::string ("$") + tsv.name); + uiout->field_string ("initial", plongest (tsv.initial_value)); + + if (tsv.value_known) + c = plongest (tsv.value); + else if (uiout->is_mi_like_p ()) + /* For MI, we prefer not to use magic string constants, but rather + omit the field completely. The difference between unknown and + undefined does not seem important enough to represent. */ + c = NULL; + else if (current_trace_status ()->running || traceframe_number >= 0) + /* The value is/was defined, but we don't have it. */ + c = ""; + else + /* It is not meaningful to ask about the value. */ + c = ""; + if (c) + uiout->field_string ("current", c); + uiout->text ("\n"); + } + } + + if (tvariables.empty ()) + uiout->text (_("No trace state variables.\n")); } /* List all the trace state variables. */