+2017-05-24 Yao Qi <yao.qi@linaro.org>
+
+ * alpha-tdep.c (alpha_gdbarch_init): Don't call
+ set_gdbarch_print_insn.
+ * arc-tdep.c (arc_gdbarch_init): Likewise.
+ * arch-utils.c: include dis-asm.h.
+ (default_print_insn): New function.
+ * arch-utils.h (default_print_insn): Declare.
+ * avr-tdep.c (avr_gdbarch_init): Don't call set_gdbarch_print_insn.
+ * bfin-tdep.c (bfin_gdbarch_init): Likewise.
+ * cris-tdep.c (cris_delayed_get_disassembler): Remove.
+ (cris_gdbarch_init): Don't call set_gdbarch_print_insn.
+ * frv-tdep.c (frv_gdbarch_init): Likewise.
+ * ft32-tdep.c (ft32_gdbarch_init): Likewise.
+ * gdbarch.sh (print_insn): Use default_print_insn.
+ * gdbarch.c: Regenerated.
+ * hppa-tdep.c (hppa_gdbarch_init): Likewise.
+ * iq2000-tdep.c (iq2000_gdbarch_init): Likewise.
+ * lm32-tdep.c (lm32_gdbarch_init): Likewise.
+ * m32c-tdep.c (m32c_gdbarch_init): Likewise.
+ * m32r-tdep.c (m32r_gdbarch_init): Likewise.
+ * m68hc11-tdep.c (gdb_print_insn_m68hc11): Remove.
+ (m68hc11_gdbarch_init): Don't call set_gdbarch_print_insn.
+ * m68k-tdep.c (m68k_gdbarch_init): Likewise.
+ * m88k-tdep.c (m88k_gdbarch_init): Likewise.
+ * microblaze-tdep.c (microblaze_gdbarch_init): Likewise.
+ * mn10300-tdep.c (mn10300_gdbarch_init): Likewise.
+ * moxie-tdep.c (moxie_gdbarch_init): Likewise.
+ * msp430-tdep.c (msp430_gdbarch_init): Likewise.
+ * mt-tdep.c (mt_gdbarch_init): Likewise.
+ * nds32-tdep.c (nds32_gdbarch_init): Likewise.
+ * nios2-tdep.c (nios2_print_insn): Remove.
+ (nios2_gdbarch_init): Don't call set_gdbarch_print_insn.
+ * rx-tdep.c (rx_gdbarch_init): Likewise.
+ * s390-linux-tdep.c (s390_gdbarch_init): Likewise.
+ * score-tdep.c (score_print_insn): Remove.
+ (score_gdbarch_init): Don't call set_gdbarch_print_insn.
+ * sh-tdep.c (sh_gdbarch_init): Likewise.
+ * sh64-tdep.c (sh64_gdbarch_init): Likewise.
+ * sparc-tdep.c (sparc32_gdbarch_init): Likewise.
+ * tic6x-tdep.c (tic6x_print_insn): Remove.
+ (tic6x_gdbarch_init): Don't call set_gdbarch_print_insn.
+ * tilegx-tdep.c (tilegx_gdbarch_init): Likewise.
+ * v850-tdep.c (v850_gdbarch_init): Likewise.
+ * vax-tdep.c (vax_gdbarch_init): Likewise.
+ * xstormy16-tdep.c (xstormy16_gdbarch_init): Likewise.
+ * xtensa-tdep.c (xtensa_gdbarch_init): Likewise.
+
2017-05-23 John Baldwin <jhb@FreeBSD.org>
* mips-fbsd-tdep.c (MIPS_PC_REGNUM): Remove.
/* Prologue heuristics. */
set_gdbarch_skip_prologue (gdbarch, alpha_skip_prologue);
- /* Disassembler. */
- set_gdbarch_print_insn (gdbarch, print_insn_alpha);
-
/* Call info. */
set_gdbarch_return_value (gdbarch, alpha_return_value);
set_gdbarch_frame_align (gdbarch, arc_frame_align);
- set_gdbarch_print_insn (gdbarch, arc_delayed_print_insn);
-
set_gdbarch_cannot_step_breakpoint (gdbarch, 1);
/* "nonsteppable" watchpoint means that watchpoint triggers before
#include "floatformat.h"
+#include "dis-asm.h"
struct displaced_step_closure *
simple_displaced_step_copy_insn (struct gdbarch *gdbarch,
regcache_raw_supply (regcache, pc_regno, regs);
}
+int
+default_print_insn (bfd_vma memaddr, disassemble_info *info)
+{
+ disassembler_ftype disassemble_fn;
+
+ if (exec_bfd != NULL)
+ {
+ gdb_assert (info->arch == bfd_get_arch (exec_bfd));
+ gdb_assert (info->endian == (bfd_big_endian (exec_bfd)
+ ? BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE));
+ gdb_assert (info->mach == bfd_get_mach (exec_bfd));
+ }
+ disassemble_fn = disassembler (info->arch, info->endian == BFD_ENDIAN_BIG,
+ info->mach, exec_bfd);
+
+ gdb_assert (disassemble_fn != NULL);
+ return (*disassemble_fn) (memaddr, info);
+}
+
/* -Wmissing-prototypes */
extern initialize_file_ftype _initialize_gdbarch_utils;
struct regcache *regcache,
CORE_ADDR addr);
+extern int default_print_insn (bfd_vma memaddr, disassemble_info *info);
+
#endif
set_gdbarch_pseudo_register_write (gdbarch, avr_pseudo_register_write);
set_gdbarch_return_value (gdbarch, avr_return_value);
- set_gdbarch_print_insn (gdbarch, print_insn_avr);
set_gdbarch_push_dummy_call (gdbarch, avr_push_dummy_call);
set_gdbarch_frame_args_skip (gdbarch, 8);
set_gdbarch_unwind_pc (gdbarch, bfin_unwind_pc);
set_gdbarch_frame_align (gdbarch, bfin_frame_align);
- set_gdbarch_print_insn (gdbarch, print_insn_bfin);
/* Hook in ABI-specific overrides, if they have been registered. */
gdbarch_init_osabi (info, gdbarch);
}
}
-/* This wrapper is to avoid cris_get_assembler being called before
- exec_bfd has been set. */
-
-static int
-cris_delayed_get_disassembler (bfd_vma addr, struct disassemble_info *info)
-{
- int (*print_insn) (bfd_vma addr, struct disassemble_info *info);
-
- print_insn = cris_get_disassembler (exec_bfd);
- gdb_assert (print_insn != NULL);
- return print_insn (addr, info);
-}
-
/* Originally from <asm/elf.h>. */
typedef unsigned char cris_elf_greg_t[4];
/* Hook in ABI-specific overrides, if they have been registered. */
gdbarch_init_osabi (info, gdbarch);
- /* FIXME: cagney/2003-08-27: It should be possible to select a CRIS
- disassembler, even when there is no BFD. Does something like
- "gdb; target remote; disassmeble *0x123" work? */
- set_gdbarch_print_insn (gdbarch, cris_delayed_get_disassembler);
-
return gdbarch;
}
break;
}
- set_gdbarch_print_insn (gdbarch, print_insn_frv);
if (frv_abi (gdbarch) == FRV_ABI_FDPIC)
set_gdbarch_convert_from_func_ptr_addr (gdbarch,
frv_convert_from_func_ptr_addr);
set_gdbarch_unwind_pc (gdbarch, ft32_unwind_pc);
- set_gdbarch_print_insn (gdbarch, print_insn_ft32);
-
/* Hook in ABI-specific overrides, if they have been registered. */
gdbarch_init_osabi (info, gdbarch);
gdbarch->stabs_argument_has_addr = default_stabs_argument_has_addr;
gdbarch->convert_from_func_ptr_addr = convert_from_func_ptr_addr_identity;
gdbarch->addr_bits_remove = core_addr_identity;
+ gdbarch->print_insn = default_print_insn;
gdbarch->skip_trampoline_code = generic_skip_trampoline_code;
gdbarch->skip_solib_resolver = generic_skip_solib_resolver;
gdbarch->in_solib_return_trampoline = generic_in_solib_return_trampoline;
/* Skip verify of addr_bits_remove, invalid_p == 0 */
/* Skip verify of software_single_step, has predicate. */
/* Skip verify of single_step_through_delay, has predicate. */
- if (gdbarch->print_insn == 0)
- log.puts ("\n\tprint_insn");
+ /* Skip verify of print_insn, invalid_p == 0 */
/* Skip verify of skip_trampoline_code, invalid_p == 0 */
/* Skip verify of skip_solib_resolver, invalid_p == 0 */
/* Skip verify of in_solib_return_trampoline, invalid_p == 0 */
M;int;single_step_through_delay;struct frame_info *frame;frame
# FIXME: cagney/2003-08-28: Need to find a better way of selecting the
# disassembler. Perhaps objdump can handle it?
-f;int;print_insn;bfd_vma vma, struct disassemble_info *info;vma, info;;0;
+f;int;print_insn;bfd_vma vma, struct disassemble_info *info;vma, info;;default_print_insn;;0
f;CORE_ADDR;skip_trampoline_code;struct frame_info *frame, CORE_ADDR pc;frame, pc;;generic_skip_trampoline_code;;0
/* Helper for function argument information. */
set_gdbarch_fetch_pointer_argument (gdbarch, hppa_fetch_pointer_argument);
- set_gdbarch_print_insn (gdbarch, print_insn_hppa);
-
/* When a hardware watchpoint triggers, we'll move the inferior past
it by removing all eventpoints; stepping past the instruction
that caused the trigger; reinserting eventpoints; and checking
set_gdbarch_frame_args_skip (gdbarch, 0);
set_gdbarch_skip_prologue (gdbarch, iq2000_skip_prologue);
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
- set_gdbarch_print_insn (gdbarch, print_insn_iq2000);
set_gdbarch_register_type (gdbarch, iq2000_register_type);
set_gdbarch_frame_align (gdbarch, iq2000_frame_align);
set_gdbarch_unwind_sp (gdbarch, iq2000_unwind_sp);
set_gdbarch_push_dummy_call (gdbarch, lm32_push_dummy_call);
set_gdbarch_return_value (gdbarch, lm32_return_value);
- /* Instruction disassembler. */
- set_gdbarch_print_insn (gdbarch, print_insn_lm32);
-
lm32_add_reggroups (gdbarch);
set_gdbarch_register_reggroup_p (gdbarch, lm32_register_reggroup_p);
/* Register set. */
make_regs (gdbarch);
- /* Disassembly. */
- set_gdbarch_print_insn (gdbarch, print_insn_m32c);
-
/* Breakpoints. */
set_gdbarch_breakpoint_kind_from_pc (gdbarch, m32c_breakpoint::kind_from_pc);
set_gdbarch_sw_breakpoint_from_kind (gdbarch, m32c_breakpoint::bp_from_kind);
/* Return the unwound PC value. */
set_gdbarch_unwind_pc (gdbarch, m32r_unwind_pc);
- set_gdbarch_print_insn (gdbarch, print_insn_m32r);
-
/* Hook in ABI-specific overrides, if they have been registered. */
gdbarch_init_osabi (info, gdbarch);
if (flags & STO_M68HC12_INTERRUPT)
MSYMBOL_SET_RTI (msym);
}
-
-static int
-gdb_print_insn_m68hc11 (bfd_vma memaddr, disassemble_info *info)
-{
- if (info->arch == bfd_arch_m68hc11)
- return print_insn_m68hc11 (memaddr, info);
- else
- return print_insn_m68hc12 (memaddr, info);
-}
-
\f
/* 68HC11/68HC12 register groups.
m68hc11_breakpoint::kind_from_pc);
set_gdbarch_sw_breakpoint_from_kind (gdbarch,
m68hc11_breakpoint::bp_from_kind);
- set_gdbarch_print_insn (gdbarch, gdb_print_insn_m68hc11);
m68hc11_add_reggroups (gdbarch);
set_gdbarch_register_reggroup_p (gdbarch, m68hc11_register_reggroup_p);
set_gdbarch_return_in_first_hidden_param_p (gdbarch,
m68k_return_in_first_hidden_param_p);
-
- /* Disassembler. */
- set_gdbarch_print_insn (gdbarch, print_insn_m68k);
-
#if defined JB_PC && defined JB_ELEMENT_SIZE
tdep->jb_pc = JB_PC;
tdep->jb_elt_size = JB_ELEMENT_SIZE;
set_gdbarch_iterate_over_regset_sections
(gdbarch, m88k_iterate_over_regset_sections);
- set_gdbarch_print_insn (gdbarch, print_insn_m88k);
-
set_gdbarch_skip_prologue (gdbarch, m88k_skip_prologue);
/* Stack grows downward. */
set_gdbarch_frame_args_skip (gdbarch, 8);
- set_gdbarch_print_insn (gdbarch, print_insn_microblaze);
-
set_gdbarch_write_pc (gdbarch, microblaze_write_pc);
set_gdbarch_unwind_pc (gdbarch, microblaze_unwind_pc);
set_gdbarch_sw_breakpoint_from_kind (gdbarch,
mn10300_breakpoint::bp_from_kind);
/* decr_pc_after_break? */
- /* Disassembly. */
- set_gdbarch_print_insn (gdbarch, print_insn_mn10300);
/* Stage 2 */
set_gdbarch_return_value (gdbarch, mn10300_return_value);
set_gdbarch_unwind_pc (gdbarch, moxie_unwind_pc);
- set_gdbarch_print_insn (gdbarch, print_insn_moxie);
-
/* Hook in ABI-specific overrides, if they have been registered. */
gdbarch_init_osabi (info, gdbarch);
msp430_breakpoint::bp_from_kind);
set_gdbarch_decr_pc_after_break (gdbarch, 1);
- /* Disassembly. */
- set_gdbarch_print_insn (gdbarch, print_insn_msp430);
-
/* Frames, prologues, etc. */
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
set_gdbarch_skip_prologue (gdbarch, msp430_skip_prologue);
set_gdbarch_sw_breakpoint_from_kind (gdbarch, mt_sw_breakpoint_from_kind);
set_gdbarch_decr_pc_after_break (gdbarch, 0);
set_gdbarch_frame_args_skip (gdbarch, 0);
- set_gdbarch_print_insn (gdbarch, print_insn_mt);
set_gdbarch_register_type (gdbarch, mt_register_type);
set_gdbarch_register_reggroup_p (gdbarch, mt_register_reggroup_p);
set_gdbarch_frame_align (gdbarch, nds32_frame_align);
frame_base_set_default (gdbarch, &nds32_frame_base);
- set_gdbarch_print_insn (gdbarch, print_insn_nds32);
-
/* Handle longjmp. */
set_gdbarch_get_longjmp_target (gdbarch, nds32_get_longjmp_target);
}
}
-/* Implement the print_insn gdbarch method. */
-
-static int
-nios2_print_insn (bfd_vma memaddr, disassemble_info *info)
-{
- if (info->endian == BFD_ENDIAN_BIG)
- return print_insn_big_nios2 (memaddr, info);
- else
- return print_insn_little_nios2 (memaddr, info);
-}
-
-
/* Implement the frame_align gdbarch method. */
static CORE_ADDR
frame_base_set_default (gdbarch, &nios2_frame_base);
- set_gdbarch_print_insn (gdbarch, nios2_print_insn);
-
/* Enable inferior call support. */
set_gdbarch_push_dummy_call (gdbarch, nios2_push_dummy_call);
set_gdbarch_sw_breakpoint_from_kind (gdbarch, rx_breakpoint::bp_from_kind);
set_gdbarch_skip_prologue (gdbarch, rx_skip_prologue);
- set_gdbarch_print_insn (gdbarch, print_insn_rx);
-
set_gdbarch_unwind_pc (gdbarch, rx_unwind_pc);
set_gdbarch_unwind_sp (gdbarch, rx_unwind_sp);
break;
}
- set_gdbarch_print_insn (gdbarch, print_insn_s390);
-
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
/* Enable TLS support. */
}
#endif
-static int
-score_print_insn (bfd_vma memaddr, struct disassemble_info *info)
-{
- if (info->endian == BFD_ENDIAN_BIG)
- return print_insn_big_score (memaddr, info);
- else
- return print_insn_little_score (memaddr, info);
-}
-
static inst_t *
score7_fetch_inst (struct gdbarch *gdbarch, CORE_ADDR addr, gdb_byte *memblock)
{
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
set_gdbarch_unwind_sp (gdbarch, score_unwind_sp);
set_gdbarch_unwind_pc (gdbarch, score_unwind_pc);
- set_gdbarch_print_insn (gdbarch, score_print_insn);
switch (target_mach)
{
set_gdbarch_breakpoint_kind_from_pc (gdbarch, sh_breakpoint_kind_from_pc);
set_gdbarch_sw_breakpoint_from_kind (gdbarch, sh_sw_breakpoint_from_kind);
- set_gdbarch_print_insn (gdbarch, print_insn_sh);
set_gdbarch_register_sim_regno (gdbarch, legacy_register_sim_regno);
set_gdbarch_return_value (gdbarch, sh_return_value_nofpu);
set_gdbarch_breakpoint_kind_from_pc (gdbarch, sh64_breakpoint_kind_from_pc);
set_gdbarch_sw_breakpoint_from_kind (gdbarch, sh64_sw_breakpoint_from_kind);
-
- set_gdbarch_print_insn (gdbarch, print_insn_sh);
set_gdbarch_register_sim_regno (gdbarch, legacy_register_sim_regno);
set_gdbarch_return_value (gdbarch, sh64_return_value);
set_gdbarch_frame_args_skip (gdbarch, 8);
- set_gdbarch_print_insn (gdbarch, print_insn_sparc);
-
set_gdbarch_software_single_step (gdbarch, sparc_software_single_step);
set_gdbarch_write_pc (gdbarch, sparc_write_pc);
return tdep->breakpoint;
}
-/* This is the implementation of gdbarch method print_insn. */
-
-static int
-tic6x_print_insn (bfd_vma memaddr, disassemble_info *info)
-{
- return print_insn_tic6x (memaddr, info);
-}
-
static void
tic6x_dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum,
struct dwarf2_frame_state_reg *reg,
/* Single stepping. */
set_gdbarch_software_single_step (gdbarch, tic6x_software_single_step);
- set_gdbarch_print_insn (gdbarch, tic6x_print_insn);
-
/* Call dummy code. */
set_gdbarch_frame_align (gdbarch, tic6x_frame_align);
tilegx_breakpoint::bp_from_kind);
set_gdbarch_return_value (gdbarch, tilegx_return_value);
- set_gdbarch_print_insn (gdbarch, print_insn_tilegx);
-
gdbarch_init_osabi (info, gdbarch);
dwarf2_append_unwinders (gdbarch);
set_gdbarch_push_dummy_call (gdbarch, v850_push_dummy_call);
set_gdbarch_skip_prologue (gdbarch, v850_skip_prologue);
- set_gdbarch_print_insn (gdbarch, print_insn_v850);
-
set_gdbarch_frame_align (gdbarch, v850_frame_align);
set_gdbarch_unwind_sp (gdbarch, v850_unwind_sp);
set_gdbarch_unwind_pc (gdbarch, v850_unwind_pc);
set_gdbarch_deprecated_function_start_offset (gdbarch, 2);
set_gdbarch_believe_pcc_promotion (gdbarch, 1);
- set_gdbarch_print_insn (gdbarch, print_insn_vax);
-
set_gdbarch_unwind_pc (gdbarch, vax_unwind_pc);
frame_base_set_default (gdbarch, &vax_frame_base);
set_gdbarch_skip_trampoline_code (gdbarch, xstormy16_skip_trampoline_code);
- set_gdbarch_print_insn (gdbarch, print_insn_xstormy16);
-
gdbarch_init_osabi (info, gdbarch);
dwarf2_append_unwinders (gdbarch);
frame_unwind_append_unwinder (gdbarch, &xtensa_unwind);
dwarf2_append_unwinders (gdbarch);
- set_gdbarch_print_insn (gdbarch, print_insn_xtensa);
-
set_gdbarch_have_nonsteppable_watchpoint (gdbarch, 1);
xtensa_add_reggroups (gdbarch);