]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
2003-05-03 Andrew Cagney <cagney@redhat.com>
authorAndrew Cagney <cagney@redhat.com>
Sat, 3 May 2003 19:13:04 +0000 (19:13 +0000)
committerAndrew Cagney <cagney@redhat.com>
Sat, 3 May 2003 19:13:04 +0000 (19:13 +0000)
* 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.

gdb/ChangeLog
gdb/Makefile.in
gdb/d10v-tdep.c
gdb/disasm.c
gdb/disasm.h
gdb/mcore-tdep.c
gdb/printcmd.c
gdb/tui/ChangeLog
gdb/tui/tuiDisassem.c
gdb/v850-tdep.c

index d32da66ffdda9b5023bfeff1b64dd7833423701e..5b0739a6398fac479841d0914aae3f935fa15e14 100644 (file)
@@ -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
index 6cce6542cecfa79d7912cb68c258106de59e7922..2ee3e4538ac9434469a58f00ec45becfea9c913a 100644 (file)
@@ -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)
index 5f054d5c321b4e9210b2beab4acd82b9efca3992..227e0320dd1133877a683a7822a3cedf89fe7d27 100644 (file)
@@ -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);
        }
index 44ad5459925cd0fb3a086153f1a2b159a248c98d..c8a2029bae8ed31858435bc888b80d9929809c90 100644 (file)
@@ -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);
+}
+
 \f
 /* 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;
index 6a6df7e0b57378bbef27ebac95bfa9cee5e857ac..e4674d87d2d7fc3ddb37bb2a3d6fc79cd1c1e005 100644 (file)
@@ -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
index b80152b09f8ebdb92b11d47674f355ae561a1be8..bc6e47553e458a3094bf70956ec60e6addcc85a1 100644 (file)
@@ -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");
     }
 }
index 4f3202677bd3d90abbee857535d00d898e990780..018d7731548ff03b3962358d697aff3e590149ae 100644 (file)
@@ -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);
 \f
 
@@ -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);
-}
-\f
-
 void
 _initialize_printcmd (void)
 {
index 3de897386654cfb260d54efc76dddf02cc5d76c4..0da559109b4e31d6ab11664d1f8253fe7c36abb5 100644 (file)
@@ -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
index eaf75df0c9138ee4bb040028ef0cada1200f207c..0ddf32c1b9946e699ab17193a5add5056cad957b 100644 (file)
@@ -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));
 
index a5b5fc6bf4fb64ae1fc8a0551dbc40f50a3ec272..edfec0729790a0be371d54ff1ca0768db8a47d72 100644 (file)
@@ -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);