From patchwork Fri Apr 14 02:23:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 20042 Received: (qmail 130889 invoked by alias); 14 Apr 2017 02:23:52 -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 130339 invoked by uid 89); 14 Apr 2017 02:23:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=uiout X-HELO: gproxy6-pub.mail.unifiedlayer.com Received: from gproxy6-pub.mail.unifiedlayer.com (HELO gproxy6-pub.mail.unifiedlayer.com) (67.222.39.168) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with SMTP; Fri, 14 Apr 2017 02:23:46 +0000 Received: (qmail 11383 invoked by uid 0); 14 Apr 2017 02:23:46 -0000 Received: from unknown (HELO CMOut01) (10.0.90.82) by gproxy6.mail.unifiedlayer.com with SMTP; 14 Apr 2017 02:23:46 -0000 Received: from box522.bluehost.com ([74.220.219.122]) by CMOut01 with id 82Pj1v00J2f2jeq012Pm2J; Thu, 13 Apr 2017 20:23:46 -0600 X-Authority-Analysis: v=2.2 cv=cpDrqxwi c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=AzvcPWV-tVgA:10 a=zstS-IiYAAAA:8 a=F1lSa8JAR6sPveLVcpcA:9 a=IL2qWk69A7Ie__Nt:21 a=liF7A6D23NWnD5s_:21 a=4G6NA9xxw8l3yy4pmD5M:22 Received: from 75-166-65-226.hlrn.qwest.net ([75.166.65.226]:57026 helo=bapiya.Home) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87) (envelope-from ) id 1cyqtj-0007Yc-Ej; Thu, 13 Apr 2017 20:23:43 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 3/5] Use ui_out_emit_tuple in tracepoint.c Date: Thu, 13 Apr 2017 20:23:35 -0600 Message-Id: <20170414022337.28368-4-tom@tromey.com> In-Reply-To: <20170414022337.28368-1-tom@tromey.com> References: <20170414022337.28368-1-tom@tromey.com> X-BWhitelist: no X-Exim-ID: 1cyqtj-0007Yc-Ej X-Source-Sender: 75-166-65-226.hlrn.qwest.net (bapiya.Home) [75.166.65.226]:57026 X-Source-Auth: tom+tromey.com X-Email-Count: 4 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== This changes some code in tracepoint.c to use ui_out_emit_tuple. One of these involved removing an otherwise unrelated cleanup (changing type to std::string) and the other involved introducing a new block. gdb/ChangeLog 2017-04-13 Tom Tromey * tracepoint.c (tvariables_info_1) (print_one_static_tracepoint_marker): Use ui_out_emit_tuple. --- gdb/ChangeLog | 5 +++++ gdb/tracepoint.c | 42 ++++++++++++++++-------------------------- 2 files changed, 21 insertions(+), 26 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 1ec48a3..ba91cdc 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2017-04-13 Tom Tromey + * tracepoint.c (tvariables_info_1) + (print_one_static_tracepoint_marker): Use ui_out_emit_tuple. + +2017-04-13 Tom Tromey + * stack.c (print_frame_arg): Use ui_out_emit_tuple. * breakpoint.c (print_mention_watchpoint) (print_mention_masked_watchpoint): Use ui_out_emit_tuple. diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index c947c95..808afde 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -506,15 +506,12 @@ tvariables_info_1 (void) for (ix = 0; VEC_iterate (tsv_s, tvariables, ix, tsv); ++ix) { - struct cleanup *back_to2; const char *c; - char *name; - back_to2 = make_cleanup_ui_out_tuple_begin_end (uiout, "variable"); + ui_out_emit_tuple tuple_emitter (uiout, "variable"); - name = concat ("$", tsv->name, (char *) NULL); - make_cleanup (xfree, name); - uiout->field_string ("name", name); + std::string name = std::string ("$") + tsv->name; + uiout->field_string ("name", name.c_str ()); uiout->field_string ("initial", plongest (tsv->initial_value)); if (tsv->value_known) @@ -533,8 +530,6 @@ tvariables_info_1 (void) if (c) uiout->field_string ("current", c); uiout->text ("\n"); - - do_cleanups (back_to2); } do_cleanups (back_to); @@ -3841,7 +3836,6 @@ print_one_static_tracepoint_marker (int count, char wrap_indent[80]; char extra_field_indent[80]; struct ui_out *uiout = current_uiout; - struct cleanup *bkpt_chain; VEC(breakpoint_p) *tracepoints; struct symtab_and_line sal; @@ -3852,7 +3846,7 @@ print_one_static_tracepoint_marker (int count, tracepoints = static_tracepoints_here (marker->address); - bkpt_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "marker"); + ui_out_emit_tuple tuple_emitter (uiout, "marker"); /* A counter field to help readability. This is not a stable identifier! */ @@ -3919,24 +3913,22 @@ print_one_static_tracepoint_marker (int count, if (!VEC_empty (breakpoint_p, tracepoints)) { - struct cleanup *cleanup_chain; int ix; struct breakpoint *b; - cleanup_chain = make_cleanup_ui_out_tuple_begin_end (uiout, - "tracepoints-at"); - - uiout->text (extra_field_indent); - uiout->text (_("Probed by static tracepoints: ")); - for (ix = 0; VEC_iterate(breakpoint_p, tracepoints, ix, b); ix++) - { - if (ix > 0) - uiout->text (", "); - uiout->text ("#"); - uiout->field_int ("tracepoint-id", b->number); - } + { + ui_out_emit_tuple tuple_emitter (uiout, "tracepoints-at"); - do_cleanups (cleanup_chain); + uiout->text (extra_field_indent); + uiout->text (_("Probed by static tracepoints: ")); + for (ix = 0; VEC_iterate(breakpoint_p, tracepoints, ix, b); ix++) + { + if (ix > 0) + uiout->text (", "); + uiout->text ("#"); + uiout->field_int ("tracepoint-id", b->number); + } + } if (uiout->is_mi_like_p ()) uiout->field_int ("number-of-tracepoints", @@ -3945,8 +3937,6 @@ print_one_static_tracepoint_marker (int count, uiout->text ("\n"); } VEC_free (breakpoint_p, tracepoints); - - do_cleanups (bkpt_chain); } static void