* 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.
+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-02 Andrew Cagney <cagney@redhat.com>
* std-regs.c (value_of_builtin_frame_pc_reg): Delete #ifdef
$(gdb_string_h) $(value_h) $(inferior_h) $(dis_asm_h) $(symfile_h) \
$(objfiles_h) $(language_h) $(arch_utils_h) $(regcache_h) \
$(remote_h) $(floatformat_h) $(gdb_sim_d10v_h) $(sim_regno_h) \
- $(gdb_assert_h)
+ $(gdb_assert_h) $(disasm_h)
dbug-rom.o: dbug-rom.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \
$(serial_h) $(regcache_h) $(m68k_tdep_h)
dbxread.o: dbxread.c $(defs_h) $(gdb_string_h) $(gdb_obstack_h) \
$(gdb_string_h) $(regcache_h) $(serial_h)
mcore-tdep.o: mcore-tdep.c $(defs_h) $(frame_h) $(symtab_h) $(value_h) \
$(gdbcmd_h) $(regcache_h) $(symfile_h) $(gdbcore_h) $(inferior_h) \
- $(arch_utils_h) $(gdb_string_h)
+ $(arch_utils_h) $(gdb_string_h) $(disasm_h)
mdebugread.o: mdebugread.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(gdbcore_h) \
$(symfile_h) $(objfiles_h) $(gdb_obstack_h) $(buildsym_h) \
$(stabsread_h) $(complaints_h) $(demangle_h) $(gdb_assert_h) \
$(gdbtypes_h) $(value_h) $(language_h) $(expression_h) $(gdbcore_h) \
$(gdbcmd_h) $(target_h) $(breakpoint_h) $(demangle_h) $(valprint_h) \
$(annotate_h) $(symfile_h) $(objfiles_h) $(completer_h) $(ui_out_h) \
- $(gdb_assert_h) $(block_h)
+ $(gdb_assert_h) $(block_h) $(disasm_h)
proc-api.o: proc-api.c $(defs_h) $(gdbcmd_h) $(completer_h) $(gdb_wait_h) \
$(proc_utils_h)
proc-events.o: proc-events.c $(defs_h)
#include "floatformat.h"
#include "gdb/sim-d10v.h"
#include "sim-regno.h"
+#include "disasm.h"
#include "gdb_assert.h"
printf_filtered (":");
printf_filtered ("\t");
wrap_here (" ");
- next_address += TARGET_PRINT_INSN (next_address,
- &deprecated_tm_print_insn_info);
+ next_address += gdb_print_insn (next_address, gdb_stdout);
printf_filtered ("\n");
gdb_flush (gdb_stdout);
}
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;
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);
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);
+}
+
\f
/* FIXME: cagney/2003-04-28: This global deprecated_tm_print_insn_info
is going away. */
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;
int line_num,
int mixed_source_and_assembly,
int how_many, CORE_ADDR low, CORE_ADDR high);
+
+/* Print the instruction at address MEMADDR in debugged memory, on
+ STREAM. Returns length of the instruction, in bytes. */
+
+extern int gdb_print_insn (CORE_ADDR memaddr, struct ui_file *stream);
+
#endif
#include "inferior.h"
#include "arch-utils.h"
#include "gdb_string.h"
+#include "disasm.h"
/* Functions declared and used only in this file */
{
printf_filtered ("MCORE: %s %08x %08x ",
commnt, (unsigned int) pc, (unsigned int) insn);
- TARGET_PRINT_INSN (pc, &deprecated_tm_print_insn_info);
+ gdb_print_insn (pc, gdb_stdout);
printf_filtered ("\n");
}
}
#include "ui-out.h"
#include "gdb_assert.h"
#include "block.h"
+#include "disasm.h"
extern int asm_demangle; /* Whether to demangle syms in asm printouts */
extern int addressprint; /* Whether to print hex addresses in HLL " */
static struct format_data decode_format (char **, int, int);
-static int print_insn (CORE_ADDR, struct ui_file *);
-
static void sym_info (char *, int);
\f
/* We often wrap here if there are long symbolic names. */
wrap_here (" ");
next_address = VALUE_ADDRESS (val)
- + print_insn (VALUE_ADDRESS (val), stream);
+ + gdb_print_insn (VALUE_ADDRESS (val), stream);
next_section = VALUE_BFD_SECTION (val);
break;
do_cleanups (old_cleanups);
}
-/* Print the instruction at address MEMADDR in debugged memory,
- on STREAM. Returns length of the instruction, in bytes. */
-
-/* FIXME: cagney/2003-04-28: Should instead be using the generic
- disassembler but first need to clean that up and stop it trying to
- access the exec file. */
-
-static int
-print_insn (CORE_ADDR memaddr, struct ui_file *stream)
-{
- if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
- deprecated_tm_print_insn_info.endian = BFD_ENDIAN_BIG;
- else
- deprecated_tm_print_insn_info.endian = BFD_ENDIAN_LITTLE;
-
- if (TARGET_ARCHITECTURE != NULL)
- deprecated_tm_print_insn_info.mach = TARGET_ARCHITECTURE->mach;
- /* else: should set .mach=0 but some disassemblers don't grok this */
-
- deprecated_tm_print_insn_info.stream = stream;
-
- return TARGET_PRINT_INSN (memaddr, &deprecated_tm_print_insn_info);
-}
-\f
-
void
_initialize_printcmd (void)
{
+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.
+
2003-04-30 Andrew Cagney <cagney@redhat.com>
* tuiDisassem.c (tui_disassemble): Use
tui_disassemble (struct tui_asm_line* lines, CORE_ADDR pc, int count)
{
struct ui_file *gdb_dis_out;
- disassemble_info asm_info;
/* now init the ui_file structure */
gdb_dis_out = tui_sfileopen (256);
- /* FIXME: cagney/2003-04-28: Should instead be using the generic
- disassembler but first need to clean that up and stop it trying
- to access the exec file. */
-
- memcpy (&asm_info, &deprecated_tm_print_insn_info, sizeof (asm_info));
- asm_info.stream = gdb_dis_out;
-
- if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
- asm_info.endian = BFD_ENDIAN_BIG;
- else
- asm_info.endian = BFD_ENDIAN_LITTLE;
-
- if (TARGET_ARCHITECTURE != NULL)
- asm_info.mach = TARGET_ARCHITECTURE->mach;
-
/* Now construct each line */
for (; count > 0; count--, lines++)
{
ui_file_rewind (gdb_dis_out);
- pc = pc + TARGET_PRINT_INSN (pc, &asm_info);
+ pc = pc + gdb_print_insn (pc, gdb_dis_out);
lines->insn = xstrdup (tui_file_get_strbuf (gdb_dis_out));
int insn2 = -1; /* dummy value */
#ifdef DEBUG
- printf_filtered ("0x%.8lx ", (long) current_pc);
- TARGET_PRINT_INSN (current_pc, &deprecated_tm_print_insn_info);
+ fprintf_filtered (gdb_stdlog, "0x%.8lx ", (long) current_pc);
+ gdb_print_insn (current_pc, gdb_stdlog);
#endif
insn = read_memory_unsigned_integer (current_pc, 2);