aboutsummaryrefslogtreecommitdiff
path: root/gdb/disasm.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-08-11 15:17:26 -0600
committerTom Tromey <tom@tromey.com>2017-09-09 13:46:06 -0600
commit393702cd59d21237c7db99c26dd8c4737a3ae303 (patch)
tree302f46152d8b101e46d6f4d33aebcde9d27e10ff /gdb/disasm.c
parent76f9c9cfd42eb8df90ce8455a92109c0f71b41e1 (diff)
downloadgdb-393702cd59d21237c7db99c26dd8c4737a3ae303.zip
gdb-393702cd59d21237c7db99c26dd8c4737a3ae303.tar.gz
gdb-393702cd59d21237c7db99c26dd8c4737a3ae303.tar.bz2
Use ui_out_emit_tuple in disasm.c
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 <tom@tromey.com> * disasm.c (gdb_pretty_print_disassembler::pretty_print_insn): Use ui_out_emit_tuple.
Diffstat (limited to 'gdb/disasm.c')
-rw-r--r--gdb/disasm.c164
1 files changed, 82 insertions, 82 deletions
diff --git a/gdb/disasm.c b/gdb/disasm.c
index 8061b60..5f22e78 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;