From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 130298 invoked by alias); 14 Apr 2017 02:23:50 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 129983 invoked by uid 89); 14 Apr 2017 02:23:49 -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,KAM_STOCKGEN,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=Hardware, uiout X-HELO: gproxy3.mail.unifiedlayer.com Received: from gproxy3-pub.mail.unifiedlayer.com (HELO gproxy3.mail.unifiedlayer.com) (69.89.30.42) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 14 Apr 2017 02:23:46 +0000 Received: from cmgw4 (unknown [10.0.90.85]) by gproxy3.mail.unifiedlayer.com (Postfix) with ESMTP id 5E252402FE for ; Thu, 13 Apr 2017 20:23:46 -0600 (MDT) Received: from box522.bluehost.com ([74.220.219.122]) by cmgw4 with id 82Pj1v00G2f2jeq012PmmT; Thu, 13 Apr 2017 20:23:46 -0600 X-Authority-Analysis: v=2.2 cv=QdwWhoTv c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=AzvcPWV-tVgA:10 a=zstS-IiYAAAA:8 a=yIO5kCKxZ4EeCmykXuAA:9 a=4Mzr85z1l8AVDW22:21 a=v6Od-pzthp--gubq: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 1cyqti-0007Yc-Lv; Thu, 13 Apr 2017 20:23:43 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 2/5] More uses of ui_out_emit_tuple Date: Fri, 14 Apr 2017 02:23:00 -0000 Message-Id: <20170414022337.28368-3-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: 1cyqti-0007Yc-Lv 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: 3 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== X-SW-Source: 2017-04/txt/msg00454.txt.bz2 This patch adds a few more uses of ui_out_emit_tuple. In these cases a slightly more complicated change was needed. gdb/ChangeLog 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. --- gdb/ChangeLog | 6 +++ gdb/breakpoint.c | 22 ++++----- gdb/stack.c | 141 ++++++++++++++++++++++++++++--------------------------- 3 files changed, 88 insertions(+), 81 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 688d11f..1ec48a3 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,11 @@ 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. + +2017-04-13 Tom Tromey + * record-btrace.c (record_btrace_insn_history) (record_btrace_insn_history_range, record_btrace_call_history) (record_btrace_call_history_range): Use ui_out_emit_tuple. diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 2ff4406..269cddd 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -10778,37 +10778,37 @@ print_it_watchpoint (bpstat bs) static void print_mention_watchpoint (struct breakpoint *b) { - struct cleanup *ui_out_chain; struct watchpoint *w = (struct watchpoint *) b; struct ui_out *uiout = current_uiout; + const char *tuple_name; switch (b->type) { case bp_watchpoint: uiout->text ("Watchpoint "); - ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "wpt"); + tuple_name = "wpt"; break; case bp_hardware_watchpoint: uiout->text ("Hardware watchpoint "); - ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "wpt"); + tuple_name = "wpt"; break; case bp_read_watchpoint: uiout->text ("Hardware read watchpoint "); - ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "hw-rwpt"); + tuple_name = "hw-rwpt"; break; case bp_access_watchpoint: uiout->text ("Hardware access (read/write) watchpoint "); - ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "hw-awpt"); + tuple_name = "hw-awpt"; break; default: internal_error (__FILE__, __LINE__, _("Invalid hardware watchpoint type.")); } + ui_out_emit_tuple tuple_emitter (uiout, tuple_name); uiout->field_int ("number", b->number); uiout->text (": "); uiout->field_string ("exp", w->exp_string); - do_cleanups (ui_out_chain); } /* Implement the "print_recreate" breakpoint_ops method for @@ -10977,31 +10977,31 @@ print_mention_masked_watchpoint (struct breakpoint *b) { struct watchpoint *w = (struct watchpoint *) b; struct ui_out *uiout = current_uiout; - struct cleanup *ui_out_chain; + const char *tuple_name; switch (b->type) { case bp_hardware_watchpoint: uiout->text ("Masked hardware watchpoint "); - ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "wpt"); + tuple_name = "wpt"; break; case bp_read_watchpoint: uiout->text ("Masked hardware read watchpoint "); - ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "hw-rwpt"); + tuple_name = "hw-rwpt"; break; case bp_access_watchpoint: uiout->text ("Masked hardware access (read/write) watchpoint "); - ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "hw-awpt"); + tuple_name = "hw-awpt"; break; default: internal_error (__FILE__, __LINE__, _("Invalid hardware watchpoint type.")); } + ui_out_emit_tuple tuple_emitter (uiout, tuple_name); uiout->field_int ("number", b->number); uiout->text (": "); uiout->field_string ("exp", w->exp_string); - do_cleanups (ui_out_chain); } /* Implement the "print_recreate" breakpoint_ops method for diff --git a/gdb/stack.c b/gdb/stack.c index 32acca1..05081fa 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -224,7 +224,6 @@ static void print_frame_arg (const struct frame_arg *arg) { struct ui_out *uiout = current_uiout; - struct cleanup *old_chain; const char *error_message = NULL; string_file stb; @@ -237,77 +236,79 @@ print_frame_arg (const struct frame_arg *arg) annotate_arg_begin (); - old_chain = make_cleanup_ui_out_tuple_begin_end (uiout, NULL); - fprintf_symbol_filtered (&stb, SYMBOL_PRINT_NAME (arg->sym), - SYMBOL_LANGUAGE (arg->sym), DMGL_PARAMS | DMGL_ANSI); - if (arg->entry_kind == print_entry_values_compact) - { - /* It is OK to provide invalid MI-like stream as with - PRINT_ENTRY_VALUE_COMPACT we never use MI. */ - stb.puts ("="); - - fprintf_symbol_filtered (&stb, SYMBOL_PRINT_NAME (arg->sym), - SYMBOL_LANGUAGE (arg->sym), - DMGL_PARAMS | DMGL_ANSI); - } - if (arg->entry_kind == print_entry_values_only - || arg->entry_kind == print_entry_values_compact) - stb.puts ("@entry"); - uiout->field_stream ("name", stb); - annotate_arg_name_end (); - uiout->text ("="); - - if (!arg->val && !arg->error) - uiout->text ("..."); - else - { - if (arg->error) - error_message = arg->error; - else - { - TRY - { - const struct language_defn *language; - struct value_print_options opts; - - /* Avoid value_print because it will deref ref parameters. We - just want to print their addresses. Print ??? for args whose - address we do not know. We pass 2 as "recurse" to val_print - because our standard indentation here is 4 spaces, and - val_print indents 2 for each recurse. */ - - annotate_arg_value (value_type (arg->val)); - - /* Use the appropriate language to display our symbol, unless the - user forced the language to a specific language. */ - if (language_mode == language_mode_auto) - language = language_def (SYMBOL_LANGUAGE (arg->sym)); - else - language = current_language; - - get_no_prettyformat_print_options (&opts); - opts.deref_ref = 1; - opts.raw = print_raw_frame_arguments; - - /* True in "summary" mode, false otherwise. */ - opts.summary = !strcmp (print_frame_arguments, "scalars"); - - common_val_print (arg->val, &stb, 2, &opts, language); - } - CATCH (except, RETURN_MASK_ERROR) - { - error_message = except.message; - } - END_CATCH - } - if (error_message != NULL) - stb.printf (_(""), error_message); - } + { + ui_out_emit_tuple tuple_emitter (uiout, NULL); + fprintf_symbol_filtered (&stb, SYMBOL_PRINT_NAME (arg->sym), + SYMBOL_LANGUAGE (arg->sym), + DMGL_PARAMS | DMGL_ANSI); + if (arg->entry_kind == print_entry_values_compact) + { + /* It is OK to provide invalid MI-like stream as with + PRINT_ENTRY_VALUE_COMPACT we never use MI. */ + stb.puts ("="); - uiout->field_stream ("value", stb); + fprintf_symbol_filtered (&stb, SYMBOL_PRINT_NAME (arg->sym), + SYMBOL_LANGUAGE (arg->sym), + DMGL_PARAMS | DMGL_ANSI); + } + if (arg->entry_kind == print_entry_values_only + || arg->entry_kind == print_entry_values_compact) + stb.puts ("@entry"); + uiout->field_stream ("name", stb); + annotate_arg_name_end (); + uiout->text ("="); + + if (!arg->val && !arg->error) + uiout->text ("..."); + else + { + if (arg->error) + error_message = arg->error; + else + { + TRY + { + const struct language_defn *language; + struct value_print_options opts; + + /* Avoid value_print because it will deref ref + parameters. We just want to print their addresses. + Print ??? for args whose address we do not know. + We pass 2 as "recurse" to val_print because our + standard indentation here is 4 spaces, and + val_print indents 2 for each recurse. */ + + annotate_arg_value (value_type (arg->val)); + + /* Use the appropriate language to display our symbol, + unless the user forced the language to a specific + language. */ + if (language_mode == language_mode_auto) + language = language_def (SYMBOL_LANGUAGE (arg->sym)); + else + language = current_language; + + get_no_prettyformat_print_options (&opts); + opts.deref_ref = 1; + opts.raw = print_raw_frame_arguments; + + /* True in "summary" mode, false otherwise. */ + opts.summary = !strcmp (print_frame_arguments, "scalars"); + + common_val_print (arg->val, &stb, 2, &opts, language); + } + CATCH (except, RETURN_MASK_ERROR) + { + error_message = except.message; + } + END_CATCH + } + if (error_message != NULL) + stb.printf (_(""), error_message); + } - /* Also invoke ui_out_tuple_end. */ - do_cleanups (old_chain); + uiout->field_stream ("value", stb); + } annotate_arg_end (); } -- 2.9.3