diff options
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 19 | ||||
-rw-r--r-- | gdb/Makefile.in | 6 | ||||
-rw-r--r-- | gdb/d10v-tdep.c | 4 | ||||
-rw-r--r-- | gdb/disasm.c | 52 | ||||
-rw-r--r-- | gdb/disasm.h | 6 | ||||
-rw-r--r-- | gdb/mcore-tdep.c | 3 | ||||
-rw-r--r-- | gdb/printcmd.c | 30 | ||||
-rw-r--r-- | gdb/tui/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/tui/tuiDisassem.c | 18 | ||||
-rw-r--r-- | gdb/v850-tdep.c | 4 |
10 files changed, 78 insertions, 69 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d32da66..5b0739a 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,22 @@ +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 diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 6cce654..2ee3e45 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -1640,7 +1640,7 @@ d10v-tdep.o: d10v-tdep.c $(defs_h) $(frame_h) $(frame_unwind_h) \ $(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) \ @@ -1945,7 +1945,7 @@ mcore-rom.o: mcore-rom.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_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) \ @@ -2061,7 +2061,7 @@ printcmd.o: printcmd.c $(defs_h) $(gdb_string_h) $(frame_h) $(symtab_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) diff --git a/gdb/d10v-tdep.c b/gdb/d10v-tdep.c index 5f054d5..227e032 100644 --- a/gdb/d10v-tdep.c +++ b/gdb/d10v-tdep.c @@ -43,6 +43,7 @@ #include "floatformat.h" #include "gdb/sim-d10v.h" #include "sim-regno.h" +#include "disasm.h" #include "gdb_assert.h" @@ -1361,8 +1362,7 @@ display_trace (int low, int high) 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); } 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; diff --git a/gdb/disasm.h b/gdb/disasm.h index 6a6df7e..e4674d8 100644 --- a/gdb/disasm.h +++ b/gdb/disasm.h @@ -28,4 +28,10 @@ extern void gdb_disassembly (struct ui_out *uiout, 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 diff --git a/gdb/mcore-tdep.c b/gdb/mcore-tdep.c index b80152b..bc6e475 100644 --- a/gdb/mcore-tdep.c +++ b/gdb/mcore-tdep.c @@ -28,6 +28,7 @@ #include "inferior.h" #include "arch-utils.h" #include "gdb_string.h" +#include "disasm.h" /* Functions declared and used only in this file */ @@ -163,7 +164,7 @@ mcore_dump_insn (char *commnt, CORE_ADDR pc, int insn) { 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"); } } diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 4f32026..018d773 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -42,6 +42,7 @@ #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 " */ @@ -175,8 +176,6 @@ static void print_formatted (struct value *, int, int, struct ui_file *); static struct format_data decode_format (char **, int, int); -static int print_insn (CORE_ADDR, struct ui_file *); - static void sym_info (char *, int); @@ -310,7 +309,7 @@ print_formatted (struct value *val, register int format, int size, /* 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; @@ -2240,31 +2239,6 @@ printf_command (char *arg, int from_tty) 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); -} - - void _initialize_printcmd (void) { diff --git a/gdb/tui/ChangeLog b/gdb/tui/ChangeLog index 3de8973..0da5591 100644 --- a/gdb/tui/ChangeLog +++ b/gdb/tui/ChangeLog @@ -1,3 +1,8 @@ +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 diff --git a/gdb/tui/tuiDisassem.c b/gdb/tui/tuiDisassem.c index eaf75df..0ddf32c 100644 --- a/gdb/tui/tuiDisassem.c +++ b/gdb/tui/tuiDisassem.c @@ -68,26 +68,10 @@ static CORE_ADDR 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++) { @@ -102,7 +86,7 @@ tui_disassemble (struct tui_asm_line* lines, CORE_ADDR pc, int count) 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)); diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c index a5b5fc6..edfec07 100644 --- a/gdb/v850-tdep.c +++ b/gdb/v850-tdep.c @@ -613,8 +613,8 @@ v850_scan_prologue (CORE_ADDR pc, struct prologue_info *pi) 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); |