+2001-09-05 Elena Zannoni <ezannoni@redhat.com>
+
+ * gdbarch.sh: Move include of dis-asm.h so it is generated earlier
+ in gdbarch.h.
+ (TARGET_PRINT_INSN): Multiarch.
+ * gdbarch.h: Regenerate.
+ * gdbarch.c: Regenerate.
+
+ * arch-utils.c (legacy_print_insn): New function.
+ * arch-utils.h (legacy_print_insn): Export.
+
+ * cris-tdep.c (cris_delayed_get_disassembler): Use
+ TARGET_PRINT_INSN, instead of tm_print_insn.
+ * d10v-tdep.c (print_insn): Ditto.
+ * d30v-tdep.c (print_insn): Ditto.
+ * m32r-tdep.c (dump_insn): Ditto.
+ * v850-tdep.c (v850_scan_prologue): Ditto.
+ * mcore-tdep.c (mcore_dump_insn): Ditto.
+ * sh-tdep.c (sh_gdbarch_init): Set print_insn gdbarch field.
+
2001-09-05 Jim Blandy <jimb@redhat.com>
* gdbtypes.h (struct type): Doc fix.
#endif
}
+/* New/multi-arched targets should use the correct gdbarch field
+ instead of using this global pointer. */
+int
+legacy_print_insn (bfd_vma vma, disassemble_info *info)
+{
+ return (*tm_print_insn) (vma, info);
+}
/* Helper functions for INNER_THAN */
/* Map onto old REGISTER_NAMES. */
extern char *legacy_register_name (int i);
+/* Accessor for old global function pointer for disassembly. */
+extern int legacy_print_insn (bfd_vma vma, disassemble_info *info);
+
/* Backward compatible call_dummy_words. */
extern LONGEST legacy_call_dummy_words[];
extern int legacy_sizeof_call_dummy_words;
cris_delayed_get_disassembler (bfd_vma addr, disassemble_info *info)
{
tm_print_insn = cris_get_disassembler (exec_bfd);
- return (*tm_print_insn) (addr, info);
+ return TARGET_PRINT_INSN (addr, info);
}
void
tm_print_insn_info.endian = BFD_ENDIAN_BIG;
else
tm_print_insn_info.endian = BFD_ENDIAN_LITTLE;
- return (*tm_print_insn) (memaddr, &tm_print_insn_info);
+ return TARGET_PRINT_INSN (memaddr, &tm_print_insn_info);
}
static void
tm_print_insn_info.endian = BFD_ENDIAN_BIG;
else
tm_print_insn_info.endian = BFD_ENDIAN_LITTLE;
- return (*tm_print_insn) (memaddr, &tm_print_insn_info);
+ return TARGET_PRINT_INSN (memaddr, &tm_print_insn_info);
}
void
gdbarch_convert_from_func_ptr_addr_ftype *convert_from_func_ptr_addr;
gdbarch_addr_bits_remove_ftype *addr_bits_remove;
gdbarch_software_single_step_ftype *software_single_step;
+ gdbarch_print_insn_ftype *print_insn;
gdbarch_skip_trampoline_code_ftype *skip_trampoline_code;
};
0,
0,
0,
+ 0,
/* startup_gdbarch() */
};
gdbarch->extra_stack_alignment_needed = 1;
gdbarch->convert_from_func_ptr_addr = core_addr_identity;
gdbarch->addr_bits_remove = core_addr_identity;
+ gdbarch->print_insn = legacy_print_insn;
gdbarch->skip_trampoline_code = generic_skip_trampoline_code;
/* gdbarch_alloc() */
/* Skip verify of convert_from_func_ptr_addr, invalid_p == 0 */
/* Skip verify of addr_bits_remove, invalid_p == 0 */
/* Skip verify of software_single_step, has predicate */
+ /* Skip verify of print_insn, invalid_p == 0 */
/* Skip verify of skip_trampoline_code, invalid_p == 0 */
}
"SOFTWARE_SINGLE_STEP(sig, insert_breakpoints_p)",
XSTRING (SOFTWARE_SINGLE_STEP (sig, insert_breakpoints_p)));
#endif
+#ifdef TARGET_PRINT_INSN
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "TARGET_PRINT_INSN(vma, info)",
+ XSTRING (TARGET_PRINT_INSN (vma, info)));
+#endif
#ifdef SKIP_TRAMPOLINE_CODE
fprintf_unfiltered (file,
"gdbarch_dump: %s # %s\n",
(long) current_gdbarch->software_single_step
/*SOFTWARE_SINGLE_STEP ()*/);
#endif
+#ifdef TARGET_PRINT_INSN
+ if (GDB_MULTI_ARCH)
+ fprintf_unfiltered (file,
+ "gdbarch_dump: TARGET_PRINT_INSN = 0x%08lx\n",
+ (long) current_gdbarch->print_insn
+ /*TARGET_PRINT_INSN ()*/);
+#endif
#ifdef SKIP_TRAMPOLINE_CODE
if (GDB_MULTI_ARCH)
fprintf_unfiltered (file,
gdbarch->software_single_step = software_single_step;
}
+int
+gdbarch_print_insn (struct gdbarch *gdbarch, bfd_vma vma, disassemble_info *info)
+{
+ if (gdbarch->print_insn == 0)
+ internal_error (__FILE__, __LINE__,
+ "gdbarch: gdbarch_print_insn invalid");
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_print_insn called\n");
+ return gdbarch->print_insn (vma, info);
+}
+
+void
+set_gdbarch_print_insn (struct gdbarch *gdbarch,
+ gdbarch_print_insn_ftype print_insn)
+{
+ gdbarch->print_insn = print_insn;
+}
+
CORE_ADDR
gdbarch_skip_trampoline_code (struct gdbarch *gdbarch, CORE_ADDR pc)
{
#ifndef GDBARCH_H
#define GDBARCH_H
+#include "dis-asm.h" /* Get defs for disassemble_info, which unfortunately is a typedef. */
+
struct frame_info;
struct value;
#endif
#endif
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (TARGET_PRINT_INSN)
+#define TARGET_PRINT_INSN(vma, info) (legacy_print_insn (vma, info))
+#endif
+
+typedef int (gdbarch_print_insn_ftype) (bfd_vma vma, disassemble_info *info);
+extern int gdbarch_print_insn (struct gdbarch *gdbarch, bfd_vma vma, disassemble_info *info);
+extern void set_gdbarch_print_insn (struct gdbarch *gdbarch, gdbarch_print_insn_ftype *print_insn);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (TARGET_PRINT_INSN)
+#error "Non multi-arch definition of TARGET_PRINT_INSN"
+#endif
+#if GDB_MULTI_ARCH
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (TARGET_PRINT_INSN)
+#define TARGET_PRINT_INSN(vma, info) (gdbarch_print_insn (current_gdbarch, vma, info))
+#endif
+#endif
+
/* Default (function) for non- multi-arch platforms. */
#if (!GDB_MULTI_ARCH) && !defined (SKIP_TRAMPOLINE_CODE)
#define SKIP_TRAMPOLINE_CODE(pc) (generic_skip_trampoline_code (pc))
/* The target-system-dependent disassembler is semi-dynamic */
-#include "dis-asm.h" /* Get defs for disassemble_info */
-
extern int dis_asm_read_memory (bfd_vma memaddr, bfd_byte *myaddr,
unsigned int len, disassemble_info *info);
extern int (*tm_print_insn) (bfd_vma, disassemble_info*);
extern disassemble_info tm_print_insn_info;
-#ifndef TARGET_PRINT_INSN
-#define TARGET_PRINT_INSN(vma, info) (*tm_print_insn) (vma, info)
-#endif
#ifndef TARGET_PRINT_INSN_INFO
#define TARGET_PRINT_INSN_INFO (&tm_print_insn_info)
#endif
# FIXME/cagney/2001-01-18: The logic is backwards. It should be asking if the target can
# single step. If not, then implement single step using breakpoints.
F:2:SOFTWARE_SINGLE_STEP:void:software_single_step:enum target_signal sig, int insert_breakpoints_p:sig, insert_breakpoints_p::0:0
+f:2:TARGET_PRINT_INSN:int:print_insn:bfd_vma vma, disassemble_info *info:vma, info:::legacy_print_insn::0
f:2:SKIP_TRAMPOLINE_CODE:CORE_ADDR:skip_trampoline_code:CORE_ADDR pc:pc:::generic_skip_trampoline_code::0
EOF
}
#ifndef GDBARCH_H
#define GDBARCH_H
+#include "dis-asm.h" /* Get defs for disassemble_info, which unfortunately is a typedef. */
+
struct frame_info;
struct value;
/* The target-system-dependent disassembler is semi-dynamic */
-#include "dis-asm.h" /* Get defs for disassemble_info */
-
extern int dis_asm_read_memory (bfd_vma memaddr, bfd_byte *myaddr,
unsigned int len, disassemble_info *info);
extern int (*tm_print_insn) (bfd_vma, disassemble_info*);
extern disassemble_info tm_print_insn_info;
-#ifndef TARGET_PRINT_INSN
-#define TARGET_PRINT_INSN(vma, info) (*tm_print_insn) (vma, info)
-#endif
#ifndef TARGET_PRINT_INSN_INFO
#define TARGET_PRINT_INSN_INFO (&tm_print_insn_info)
#endif
{
printf_filtered (" %s %08x %08x ",
commnt, (unsigned int) pc, (unsigned int) insn);
- (*tm_print_insn) (pc, &tm_print_insn_info);
+ TARGET_PRINT_INSN (pc, &tm_print_insn_info);
printf_filtered ("\n");
}
#define insn_debug(args) { printf_filtered args; }
{
printf_filtered ("MCORE: %s %08x %08x ",
commnt, (unsigned int) pc, (unsigned int) insn);
- (*tm_print_insn) (pc, &tm_print_insn_info);
+ TARGET_PRINT_INSN (pc, &tm_print_insn_info);
printf_filtered ("\n");
}
}
#define XMALLOC(TYPE) ((TYPE*) xmalloc (sizeof (TYPE)))
void (*sh_show_regs) (void);
-int (*print_sh_insn) (bfd_vma, disassemble_info*);
CORE_ADDR (*skip_prologue_hard_way) (CORE_ADDR);
void (*do_pseudo_register) (int);
set_gdbarch_use_struct_convention (gdbarch, sh_use_struct_convention);
set_gdbarch_extract_struct_value_address (gdbarch, sh_extract_struct_value_address);
set_gdbarch_pop_frame (gdbarch, sh_pop_frame);
- print_sh_insn = gdb_print_insn_sh;
+ set_gdbarch_print_insn (gdbarch, gdb_print_insn_sh);
skip_prologue_hard_way = sh_skip_prologue_hard_way;
do_pseudo_register = sh_do_pseudo_register;
set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
set_gdbarch_believe_pcc_promotion (gdbarch, 1);
set_gdbarch_ieee_float (gdbarch, 1);
- tm_print_insn = print_sh_insn;
return gdbarch;
}
#ifdef DEBUG
printf_filtered ("0x%.8lx ", (long) current_pc);
- (*tm_print_insn) (current_pc, &tm_print_insn_info);
+ TARGET_PRINT_INSN (current_pc, &tm_print_insn_info);
#endif
insn = read_memory_unsigned_integer (current_pc, 2);