aboutsummaryrefslogtreecommitdiff
path: root/gdb/disasm.c
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2003-05-03 19:13:04 +0000
committerAndrew Cagney <cagney@redhat.com>2003-05-03 19:13:04 +0000
commit92bf2b80f20268d032bb7f55103514324ff939b9 (patch)
tree073b7936e0f7136bc12cee866383c3f68b2cf627 /gdb/disasm.c
parent633a0b73d4990a24384ff4fe24c04e22b5e1204e (diff)
downloadgdb-92bf2b80f20268d032bb7f55103514324ff939b9.zip
gdb-92bf2b80f20268d032bb7f55103514324ff939b9.tar.gz
gdb-92bf2b80f20268d032bb7f55103514324ff939b9.tar.bz2
2003-05-03 Andrew Cagney <cagney@redhat.com>
* disasm.h (print_insn): Declare. * disasm.c (init_gdb_disassemble_info): New function. (gdb_disassembly): Call init_gdb_disassemble_info. (gdb_print_insn): New function. * v850-tdep.c (v850_scan_prologue): Call gdb_print_insn, instead of TARGET_PRINT_INSN. Send debug info to "gdb_stdlog". * mcore-tdep.c: Include "disasm.h" (mcore_dump_insn): Call gdb_print_insn, instead of TARGET_PRINT_INSN. * d10v-tdep.c: Include "disasm.h". (display_trace): Call gdb_print_insn, instead of print_insn. (print_insn): Delete function. * printcmd.c: Include "disasm.h". (print_insn): Delete function. (print_formatted): Call gdb_print_insn, instead of print_insn. * Makefile.in (printcmd.o): Update dependencies. (mcore-tdep.o, d10v-tdep.o): Ditto. 2003-05-03 Andrew Cagney <cagney@redhat.com> * tuiDisassem.c (tui_disassemble): Call gdb_print_insn, instead of TARGET_PRINT_INSN. Do not initialize a disassemble_info object.
Diffstat (limited to 'gdb/disasm.c')
-rw-r--r--gdb/disasm.c52
1 files changed, 36 insertions, 16 deletions
diff --git a/gdb/disasm.c b/gdb/disasm.c
index 44ad545..c8a2029 100644
--- a/gdb/disasm.c
+++ b/gdb/disasm.c
@@ -307,22 +307,14 @@ do_assembly_only (struct ui_out *uiout, disassemble_info * di,
do_cleanups (ui_out_chain);
}
-void
-gdb_disassembly (struct ui_out *uiout,
- char *file_string,
- int line_num,
- int mixed_source_and_assembly,
- int how_many, CORE_ADDR low, CORE_ADDR high)
+/* Initialize the disassemble info struct ready for the specified
+ stream. */
+
+static disassemble_info
+gdb_disassemble_info (struct gdbarch *gdbarch, struct ui_file *file)
{
- struct ui_stream *stb = ui_out_stream_new (uiout);
- struct cleanup *cleanups = make_cleanup_ui_out_stream_delete (stb);
disassemble_info di;
- /* To collect the instruction outputted from opcodes. */
- struct symtab *symtab = NULL;
- struct linetable_entry *le = NULL;
- int nlines = -1;
-
- INIT_DISASSEMBLE_INFO_NO_ARCH (di, stb->stream,
+ INIT_DISASSEMBLE_INFO_NO_ARCH (di, file,
(fprintf_ftype) fprintf_unfiltered);
di.flavour = bfd_target_unknown_flavour;
di.memory_error_func = dis_asm_memory_error;
@@ -336,8 +328,25 @@ gdb_disassembly (struct ui_out *uiout,
Further, it has been supperseeded by trust-read-only-sections
(although that should be superseeded by target_trust..._p()). */
di.read_memory_func = dis_asm_read_memory;
- di.mach = gdbarch_bfd_arch_info (current_gdbarch)->mach;
- di.endian = gdbarch_byte_order (current_gdbarch);
+ di.mach = gdbarch_bfd_arch_info (gdbarch)->mach;
+ di.endian = gdbarch_byte_order (gdbarch);
+ return di;
+}
+
+void
+gdb_disassembly (struct ui_out *uiout,
+ char *file_string,
+ int line_num,
+ int mixed_source_and_assembly,
+ int how_many, CORE_ADDR low, CORE_ADDR high)
+{
+ struct ui_stream *stb = ui_out_stream_new (uiout);
+ struct cleanup *cleanups = make_cleanup_ui_out_stream_delete (stb);
+ disassemble_info di = gdb_disassemble_info (current_gdbarch, stb->stream);
+ /* To collect the instruction outputted from opcodes. */
+ struct symtab *symtab = NULL;
+ struct linetable_entry *le = NULL;
+ int nlines = -1;
/* Assume symtab is valid for whole PC range */
symtab = find_pc_symtab (low);
@@ -361,6 +370,16 @@ gdb_disassembly (struct ui_out *uiout,
gdb_flush (gdb_stdout);
}
+/* Print the instruction at address MEMADDR in debugged memory,
+ on STREAM. Returns length of the instruction, in bytes. */
+
+int
+gdb_print_insn (CORE_ADDR memaddr, struct ui_file *stream)
+{
+ disassemble_info di = gdb_disassemble_info (current_gdbarch, stream);
+ return TARGET_PRINT_INSN (memaddr, &di);
+}
+
/* FIXME: cagney/2003-04-28: This global deprecated_tm_print_insn_info
is going away. */
@@ -371,6 +390,7 @@ extern void _initialize_disasm (void);
void
_initialize_disasm (void)
{
+
INIT_DISASSEMBLE_INFO_NO_ARCH (deprecated_tm_print_insn_info, gdb_stdout,
(fprintf_ftype)fprintf_filtered);
deprecated_tm_print_insn_info.flavour = bfd_target_unknown_flavour;