aboutsummaryrefslogtreecommitdiff
path: root/gdb/disasm.c
diff options
context:
space:
mode:
authorAndrew Burgess <aburgess@broadcom.com>2011-01-12 15:02:12 +0000
committerAndrew Burgess <aburgess@broadcom.com>2011-01-12 15:02:12 +0000
commitb716877b54891ba162293f5ec6b6cd222f711e4d (patch)
tree3ff206d4d5431c44ee4327eeac78a40d2567248f /gdb/disasm.c
parent13fd8b81f0460839d154c769d8ef004f41b29c55 (diff)
http://sourceware.org/ml/gdb-patches/2010-12/msg00299.html
gdb/ * disasm.c (dump_insns): Support dumping opcodes for MI. * mi/mi-cmd-disas.c (mi_cmd_disassemble): Allow mode to control dumping of instruction opcodes. gdb/doc/ * gdb.texinfo (GDB/MI Data Manipulation): Update to reflect changes in mi/mi-cmd-disas.c gdb/testsuite/ * gdb.mi/mi-disassemble.exp, gdb.mi/mi2-disassemble.exp: Update expected output to reflect changes in gdb/mi/mi-cmd-disas.c and add new tests for opcode dumping.
Diffstat (limited to 'gdb/disasm.c')
-rw-r--r--gdb/disasm.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/gdb/disasm.c b/gdb/disasm.c
index 096cec4342..9180bc578e 100644
--- a/gdb/disasm.c
+++ b/gdb/disasm.c
@@ -143,6 +143,13 @@ dump_insns (struct gdbarch *gdbarch, struct ui_out *uiout,
CORE_ADDR old_pc = pc;
bfd_byte data;
int status;
+ const char *spacer = "";
+
+ /* Build the opcodes using a temporary stream so we can
+ write them out in a single go for the MI. */
+ struct ui_stream *opcode_stream = ui_out_stream_new (uiout);
+ struct cleanup *cleanups =
+ make_cleanup_ui_out_stream_delete (opcode_stream);
pc += gdbarch_print_insn (gdbarch, pc, di);
for (;old_pc < pc; old_pc++)
@@ -150,9 +157,14 @@ dump_insns (struct gdbarch *gdbarch, struct ui_out *uiout,
status = (*di->read_memory_func) (old_pc, &data, 1, di);
if (status != 0)
(*di->memory_error_func) (status, old_pc, di);
- ui_out_message (uiout, 0, " %02x", (unsigned)data);
+ fprintf_filtered (opcode_stream->stream, "%s%02x",
+ spacer, (unsigned) data);
+ spacer = " ";
}
+ ui_out_field_stream (uiout, "opcodes", opcode_stream);
ui_out_text (uiout, "\t");
+
+ do_cleanups (cleanups);
}
else
pc += gdbarch_print_insn (gdbarch, pc, di);