From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 91881 invoked by alias); 9 Sep 2017 15:35:57 -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 91561 invoked by uid 89); 9 Sep 2017 15:35:57 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.4 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= X-HELO: gproxy3-pub.mail.unifiedlayer.com Received: from gproxy3-pub.mail.unifiedlayer.com (HELO gproxy3-pub.mail.unifiedlayer.com) (69.89.30.42) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 09 Sep 2017 15:35:55 +0000 Received: from cmgw3 (unknown [10.0.90.84]) by gproxy3.mail.unifiedlayer.com (Postfix) with ESMTP id C60D240052 for ; Sat, 9 Sep 2017 09:35:53 -0600 (MDT) Received: from box522.bluehost.com ([74.220.219.122]) by cmgw3 with id 7Tbq1w00S2f2jeq01TbtEP; Sat, 09 Sep 2017 09:35:53 -0600 X-Authority-Analysis: v=2.2 cv=K/VSJ2eI c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=2JCJgTwv5E4A:10 a=zstS-IiYAAAA:8 a=IS9scY_LsgnkFvz8f1AA:9 a=sKCyBIvDjduDbgH-:21 a=AEv6IZUEGKnY0E1V:21 a=4G6NA9xxw8l3yy4pmD5M:22 Received: from 75-166-76-94.hlrn.qwest.net ([75.166.76.94]:59756 helo=bapiya.Home) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87) (envelope-from ) id 1dqhnS-00381I-7R; Sat, 09 Sep 2017 09:35:50 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 4/7] Use ui_out_emit_tuple in disasm.c Date: Sat, 09 Sep 2017 15:35:00 -0000 Message-Id: <20170909153540.15008-5-tom@tromey.com> In-Reply-To: <20170909153540.15008-1-tom@tromey.com> References: <20170909153540.15008-1-tom@tromey.com> X-BWhitelist: no X-Exim-ID: 1dqhnS-00381I-7R X-Source-Sender: 75-166-76-94.hlrn.qwest.net (bapiya.Home) [75.166.76.94]:59756 X-Source-Auth: tom+tromey.com X-Email-Count: 5 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== X-Local-Domain: yes X-SW-Source: 2017-09/txt/msg00230.txt.bz2 This changes one spot in disasm.c to use ui_out_emit_tuple. This patch required a large reindentation, so I've separated it out. ChangeLog 2017-09-09 Tom Tromey * disasm.c (gdb_pretty_print_disassembler::pretty_print_insn): Use ui_out_emit_tuple. --- gdb/ChangeLog | 5 ++ gdb/disasm.c | 164 +++++++++++++++++++++++++++++----------------------------- 2 files changed, 87 insertions(+), 82 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a52b1fb..bef61b4 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2017-09-09 Tom Tromey + * disasm.c (gdb_pretty_print_disassembler::pretty_print_insn): Use + ui_out_emit_tuple. + +2017-09-09 Tom Tromey + * target.c (flash_erase_command): Use ui_out_emit_tuple. * stack.c (print_frame): Use ui_out_emit_tuple. * spu-tdep.c (info_spu_event_command): Use ui_out_emit_tuple. diff --git a/gdb/disasm.c b/gdb/disasm.c index c3528e0..ad596f9 100644 --- a/gdb/disasm.c +++ b/gdb/disasm.c @@ -198,95 +198,95 @@ gdb_pretty_print_disassembler::pretty_print_insn (struct ui_out *uiout, int offset; int line; int size; - struct cleanup *ui_out_chain; char *filename = NULL; char *name = NULL; CORE_ADDR pc; struct gdbarch *gdbarch = arch (); - ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, NULL); - pc = insn->addr; - - if (insn->number != 0) - { - uiout->field_fmt ("insn-number", "%u", insn->number); - uiout->text ("\t"); - } - - if ((flags & DISASSEMBLY_SPECULATIVE) != 0) - { - if (insn->is_speculative) - { - uiout->field_string ("is-speculative", "?"); - - /* The speculative execution indication overwrites the first - character of the PC prefix. - We assume a PC prefix length of 3 characters. */ - if ((flags & DISASSEMBLY_OMIT_PC) == 0) - uiout->text (pc_prefix (pc) + 1); - else - uiout->text (" "); - } - else if ((flags & DISASSEMBLY_OMIT_PC) == 0) - uiout->text (pc_prefix (pc)); - else - uiout->text (" "); - } - else if ((flags & DISASSEMBLY_OMIT_PC) == 0) - uiout->text (pc_prefix (pc)); - uiout->field_core_addr ("address", gdbarch, pc); - - if (!build_address_symbolic (gdbarch, pc, 0, &name, &offset, &filename, - &line, &unmapped)) - { - /* We don't care now about line, filename and unmapped. But we might in - the future. */ - uiout->text (" <"); - if ((flags & DISASSEMBLY_OMIT_FNAME) == 0) - uiout->field_string ("func-name", name); - uiout->text ("+"); - uiout->field_int ("offset", offset); - uiout->text (">:\t"); - } - else - uiout->text (":\t"); - - if (filename != NULL) - xfree (filename); - if (name != NULL) - xfree (name); - - m_insn_stb.clear (); - - if (flags & DISASSEMBLY_RAW_INSN) - { - CORE_ADDR end_pc; - bfd_byte data; - int err; - const char *spacer = ""; - - /* Build the opcodes using a temporary stream so we can - write them out in a single go for the MI. */ - m_opcode_stb.clear (); - + { + ui_out_emit_tuple tuple_emitter (uiout, NULL); + pc = insn->addr; + + if (insn->number != 0) + { + uiout->field_fmt ("insn-number", "%u", insn->number); + uiout->text ("\t"); + } + + if ((flags & DISASSEMBLY_SPECULATIVE) != 0) + { + if (insn->is_speculative) + { + uiout->field_string ("is-speculative", "?"); + + /* The speculative execution indication overwrites the first + character of the PC prefix. + We assume a PC prefix length of 3 characters. */ + if ((flags & DISASSEMBLY_OMIT_PC) == 0) + uiout->text (pc_prefix (pc) + 1); + else + uiout->text (" "); + } + else if ((flags & DISASSEMBLY_OMIT_PC) == 0) + uiout->text (pc_prefix (pc)); + else + uiout->text (" "); + } + else if ((flags & DISASSEMBLY_OMIT_PC) == 0) + uiout->text (pc_prefix (pc)); + uiout->field_core_addr ("address", gdbarch, pc); + + if (!build_address_symbolic (gdbarch, pc, 0, &name, &offset, &filename, + &line, &unmapped)) + { + /* We don't care now about line, filename and unmapped. But we might in + the future. */ + uiout->text (" <"); + if ((flags & DISASSEMBLY_OMIT_FNAME) == 0) + uiout->field_string ("func-name", name); + uiout->text ("+"); + uiout->field_int ("offset", offset); + uiout->text (">:\t"); + } + else + uiout->text (":\t"); + + if (filename != NULL) + xfree (filename); + if (name != NULL) + xfree (name); + + m_insn_stb.clear (); + + if (flags & DISASSEMBLY_RAW_INSN) + { + CORE_ADDR end_pc; + bfd_byte data; + int err; + const char *spacer = ""; + + /* Build the opcodes using a temporary stream so we can + write them out in a single go for the MI. */ + m_opcode_stb.clear (); + + size = m_di.print_insn (pc); + end_pc = pc + size; + + for (;pc < end_pc; ++pc) + { + read_code (pc, &data, 1); + m_opcode_stb.printf ("%s%02x", spacer, (unsigned) data); + spacer = " "; + } + + uiout->field_stream ("opcodes", m_opcode_stb); + uiout->text ("\t"); + } + else size = m_di.print_insn (pc); - end_pc = pc + size; - for (;pc < end_pc; ++pc) - { - read_code (pc, &data, 1); - m_opcode_stb.printf ("%s%02x", spacer, (unsigned) data); - spacer = " "; - } - - uiout->field_stream ("opcodes", m_opcode_stb); - uiout->text ("\t"); - } - else - size = m_di.print_insn (pc); - - uiout->field_stream ("inst", m_insn_stb); - do_cleanups (ui_out_chain); + uiout->field_stream ("inst", m_insn_stb); + } uiout->text ("\n"); return size; -- 2.9.4