From 36482093be91e14938ad5a9a200b0b9f1263953b Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Thu, 28 Aug 2003 03:03:44 +0000 Subject: [PATCH] 2003-08-27 Andrew Cagney * Makefile.in (cris-tdep.o): Update dependencies. * cris-tdep.c: Include "gdb_assert.h". (cris_gdbarch_init): Set print_insn. (_initialize_cris_tdep): Do not set deprecated_tm_print_insn. (cris_delayed_get_disassembler): Simplify, directly call the disassembler returned by cris_get_disassembler. * hppa-tdep.c (hppa_gdbarch_init): Set print_insn. (_initialize_hppa_tdep): Do not set deprecated_tm_print_insn. * ns32k-tdep.c (ns32k_gdbarch_init): Set print_insn. (_initialize_ns32k_tdep): Do not set deprecated_tm_print_insn. * mn10300-tdep.c (mn10300_gdbarch_init): Set print_insn. (_initialize_mn10300_tdep): Do not set deprecated_tm_print_insn. * mcore-tdep.c (mcore_gdbarch_init): Set print_insn. (_initialize_mcore_tdep): Do not set deprecated_tm_print_insn. * frv-tdep.c (frv_gdbarch_init): Set print_insn. (_initialize_frv_tdep): Do not set deprecated_tm_print_insn. * sparc-tdep.c (sparc_gdbarch_init): Set print_insn. (gdb_print_insn_sparc): Delete function. (_initialize_sparc_tdep): Do not set deprecated_tm_print_insn or deprecated_tm_print_insn_info. * v850-tdep.c (v850_gdbarch_init): Set print_insn. (_initialize_v850_tdep): Do not set deprecated_tm_print_insn. (v850_gdbarch_init): Do not set deprecated_tm_print_insn_info. * xstormy16-tdep.c (xstormy16_gdbarch_init): Set print_insn. (_initialize_xstormy16_tdep): Do not set deprecated_tm_print_insn. * s390-tdep.c (gdb_print_insn_s390): Delete function. (_initialize_s390_tdep): Do not set deprecated_tm_print_insn. (s390_gdbarch_init): Set print_insn. --- gdb/ChangeLog | 31 +++++++++++++++++++++++++++++++ gdb/Makefile.in | 2 +- gdb/cris-tdep.c | 19 ++++++++++++++----- gdb/frv-tdep.c | 4 ++-- gdb/hppa-tdep.c | 3 ++- gdb/mcore-tdep.c | 4 ++-- gdb/mn10300-tdep.c | 4 ++-- gdb/ns32k-tdep.c | 3 ++- gdb/s390-tdep.c | 24 ++---------------------- gdb/sparc-tdep.c | 14 ++------------ gdb/v850-tdep.c | 4 ++-- gdb/xstormy16-tdep.c | 3 ++- 12 files changed, 64 insertions(+), 51 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f1be370..3cf4010 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,36 @@ 2003-08-27 Andrew Cagney + * Makefile.in (cris-tdep.o): Update dependencies. + * cris-tdep.c: Include "gdb_assert.h". + (cris_gdbarch_init): Set print_insn. + (_initialize_cris_tdep): Do not set deprecated_tm_print_insn. + (cris_delayed_get_disassembler): Simplify, directly call the + disassembler returned by cris_get_disassembler. + * hppa-tdep.c (hppa_gdbarch_init): Set print_insn. + (_initialize_hppa_tdep): Do not set deprecated_tm_print_insn. + * ns32k-tdep.c (ns32k_gdbarch_init): Set print_insn. + (_initialize_ns32k_tdep): Do not set deprecated_tm_print_insn. + * mn10300-tdep.c (mn10300_gdbarch_init): Set print_insn. + (_initialize_mn10300_tdep): Do not set deprecated_tm_print_insn. + * mcore-tdep.c (mcore_gdbarch_init): Set print_insn. + (_initialize_mcore_tdep): Do not set deprecated_tm_print_insn. + * frv-tdep.c (frv_gdbarch_init): Set print_insn. + (_initialize_frv_tdep): Do not set deprecated_tm_print_insn. + * sparc-tdep.c (sparc_gdbarch_init): Set print_insn. + (gdb_print_insn_sparc): Delete function. + (_initialize_sparc_tdep): Do not set deprecated_tm_print_insn or + deprecated_tm_print_insn_info. + * v850-tdep.c (v850_gdbarch_init): Set print_insn. + (_initialize_v850_tdep): Do not set deprecated_tm_print_insn. + (v850_gdbarch_init): Do not set deprecated_tm_print_insn_info. + * xstormy16-tdep.c (xstormy16_gdbarch_init): Set print_insn. + (_initialize_xstormy16_tdep): Do not set deprecated_tm_print_insn. + * s390-tdep.c (gdb_print_insn_s390): Delete function. + (_initialize_s390_tdep): Do not set deprecated_tm_print_insn. + (s390_gdbarch_init): Set print_insn. + +2003-08-27 Andrew Cagney + * ppc-linux-tdep.c (ppc64_call_dummy_address): Delete function. (ppc_linux_init_abi): For PPC64, do not set call_dummy_address. * infcall.c (call_function_by_hand): Convert the entry point diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 67594df..5223997 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -1666,7 +1666,7 @@ cp-valprint.o: cp-valprint.c $(defs_h) $(gdb_obstack_h) $(symtab_h) \ cris-tdep.o: cris-tdep.c $(defs_h) $(frame_h) $(symtab_h) $(inferior_h) \ $(gdbtypes_h) $(gdbcore_h) $(gdbcmd_h) $(target_h) $(value_h) \ $(opcode_cris_h) $(arch_utils_h) $(regcache_h) $(symfile_h) \ - $(solib_h) $(solib_svr4_h) $(gdb_string_h) + $(solib_h) $(solib_svr4_h) $(gdb_string_h) $(gdb_assert_h) c-typeprint.o: c-typeprint.c $(defs_h) $(gdb_obstack_h) $(bfd_h) $(symtab_h) \ $(gdbtypes_h) $(expression_h) $(value_h) $(gdbcore_h) $(target_h) \ $(language_h) $(demangle_h) $(c_lang_h) $(typeprint_h) $(cp_abi_h) \ diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c index 3c7bf60..81a80d8 100644 --- a/gdb/cris-tdep.c +++ b/gdb/cris-tdep.c @@ -31,6 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "opcode/cris.h" #include "arch-utils.h" #include "regcache.h" +#include "gdb_assert.h" /* To get entry_point_address. */ #include "symfile.h" @@ -3540,8 +3541,14 @@ cris_gdb_func (enum cris_op_type op_type, unsigned short inst, static int cris_delayed_get_disassembler (bfd_vma addr, disassemble_info *info) { - deprecated_tm_print_insn = cris_get_disassembler (exec_bfd); - return TARGET_PRINT_INSN (addr, info); + int (*print_insn) (bfd_vma addr, disassemble_info *info); + /* 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? */ + gdb_assert (exec_bfd != NULL); + print_insn = cris_get_disassembler (exec_bfd); + gdb_assert (print_insn != NULL); + return print_insn (addr, info); } /* Copied from . */ @@ -3854,9 +3861,6 @@ _initialize_cris_tdep (void) gdbarch_register (bfd_arch_cris, cris_gdbarch_init, cris_dump_tdep); - /* Used in disassembly. */ - deprecated_tm_print_insn = cris_delayed_get_disassembler; - /* CRIS-specific user-commands. */ c = add_set_cmd ("cris-version", class_support, var_integer, (char *) &usr_cmd_cris_version, @@ -4304,5 +4308,10 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_solib_svr4_fetch_link_map_offsets (gdbarch, cris_linux_svr4_fetch_link_map_offsets); + /* 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; } diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c index 9828b90..4a7a1f1 100644 --- a/gdb/frv-tdep.c +++ b/gdb/frv-tdep.c @@ -1140,6 +1140,8 @@ frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) break; } + set_gdbarch_print_insn (gdbarch, print_insn_frv); + return gdbarch; } @@ -1147,8 +1149,6 @@ void _initialize_frv_tdep (void) { register_gdbarch_init (bfd_arch_frv, frv_gdbarch_init); - - deprecated_tm_print_insn = print_insn_frv; } diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index 699cd74..c5b010c 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -5203,6 +5203,8 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Helper for function argument information. */ set_gdbarch_fetch_pointer_argument (gdbarch, hppa_fetch_pointer_argument); + set_gdbarch_print_insn (gdbarch, print_insn_hppa); + /* Hook in ABI-specific overrides, if they have been registered. */ gdbarch_init_osabi (info, gdbarch); @@ -5224,7 +5226,6 @@ _initialize_hppa_tdep (void) void break_at_finish_at_depth_command (char *arg, int from_tty); gdbarch_register (bfd_arch_hppa, hppa_gdbarch_init, hppa_dump_tdep); - deprecated_tm_print_insn = print_insn_hppa; add_cmd ("unwind", class_maintenance, unwind_command, "Print unwind table entry at given address.", diff --git a/gdb/mcore-tdep.c b/gdb/mcore-tdep.c index 3c4e7e7..a8381ed 100644 --- a/gdb/mcore-tdep.c +++ b/gdb/mcore-tdep.c @@ -1119,6 +1119,8 @@ mcore_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Should be using push_dummy_call. */ set_gdbarch_deprecated_dummy_write_sp (gdbarch, deprecated_write_sp); + set_gdbarch_print_insn (gdbarch, print_insn_mcore); + return gdbarch; } @@ -1133,9 +1135,7 @@ extern initialize_file_ftype _initialize_mcore_tdep; /* -Wmissing-prototypes */ void _initialize_mcore_tdep (void) { - extern int print_insn_mcore (bfd_vma, disassemble_info *); gdbarch_register (bfd_arch_mcore, mcore_gdbarch_init, mcore_dump_tdep); - deprecated_tm_print_insn = print_insn_mcore; #ifdef MCORE_DEBUG add_show_from_set (add_set_cmd ("mcoredebug", no_class, diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c index 7e84eb9..be9bf97 100644 --- a/gdb/mn10300-tdep.c +++ b/gdb/mn10300-tdep.c @@ -1218,6 +1218,8 @@ mn10300_gdbarch_init (struct gdbarch_info info, /* Should be using push_dummy_call. */ set_gdbarch_deprecated_dummy_write_sp (gdbarch, deprecated_write_sp); + set_gdbarch_print_insn (gdbarch, print_insn_mn10300); + return gdbarch; } @@ -1226,7 +1228,5 @@ _initialize_mn10300_tdep (void) { /* printf("_initialize_mn10300_tdep\n"); */ - deprecated_tm_print_insn = print_insn_mn10300; - register_gdbarch_init (bfd_arch_mn10300, mn10300_gdbarch_init); } diff --git a/gdb/ns32k-tdep.c b/gdb/ns32k-tdep.c index 7bad91d..f5fae7b 100644 --- a/gdb/ns32k-tdep.c +++ b/gdb/ns32k-tdep.c @@ -606,6 +606,8 @@ ns32k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Should be using push_dummy_call. */ set_gdbarch_deprecated_dummy_write_sp (gdbarch, deprecated_write_sp); + set_gdbarch_print_insn (gdbarch, print_insn_ns32k); + /* Hook in OS ABI-specific overrides, if they have been registered. */ gdbarch_init_osabi (info, gdbarch); @@ -619,5 +621,4 @@ _initialize_ns32k_tdep (void) { gdbarch_register (bfd_arch_ns32k, ns32k_gdbarch_init, NULL); - deprecated_tm_print_insn = print_insn_ns32k; } diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c index 0f3bd41..1234bbb 100644 --- a/gdb/s390-tdep.c +++ b/gdb/s390-tdep.c @@ -1971,26 +1971,6 @@ s390_store_return_value (struct type *valtype, char *valbuf) value, arglen); } } -static int -gdb_print_insn_s390 (bfd_vma memaddr, disassemble_info * info) -{ - bfd_byte instrbuff[S390_MAX_INSTR_SIZE]; - int instrlen, cnt; - - instrlen = s390_readinstruction (instrbuff, (CORE_ADDR) memaddr, info); - if (instrlen < 0) - { - (*info->memory_error_func) (instrlen, memaddr, info); - return -1; - } - for (cnt = 0; cnt < instrlen; cnt++) - info->fprintf_func (info->stream, "%02X ", instrbuff[cnt]); - for (cnt = instrlen; cnt < S390_MAX_INSTR_SIZE; cnt++) - info->fprintf_func (info->stream, " "); - instrlen = print_insn_s390 (memaddr, info); - return instrlen; -} - /* Not the most efficent code in the world */ @@ -2722,6 +2702,8 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Should be using push_dummy_call. */ set_gdbarch_deprecated_dummy_write_sp (gdbarch, deprecated_write_sp); + set_gdbarch_print_insn (gdbarch, print_insn_s390); + return gdbarch; } @@ -2735,6 +2717,4 @@ _initialize_s390_tdep (void) /* Hook us into the gdbarch mechanism. */ register_gdbarch_init (bfd_arch_s390, s390_gdbarch_init); - if (!deprecated_tm_print_insn) /* Someone may have already set it */ - deprecated_tm_print_insn = gdb_print_insn_s390; } diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index 13d006f..970d953 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -2139,16 +2139,6 @@ sparc_do_registers_info (int regnum, int all) // OBSOLETE } #endif - -static int -gdb_print_insn_sparc (bfd_vma memaddr, disassemble_info *info) -{ - /* It's necessary to override mach again because print_insn messes it up. */ - info->mach = TARGET_ARCHITECTURE->mach; - return print_insn_sparc (memaddr, info); -} - - #define SPARC_F0_REGNUM FP0_REGNUM /* %f0 */ #define SPARC_F1_REGNUM (FP0_REGNUM + 1)/* %f1 */ #define SPARC_O0_REGNUM O0_REGNUM /* %o0 */ @@ -2559,8 +2549,6 @@ _initialize_sparc_tdep (void) /* Hook us into the gdbarch mechanism. */ gdbarch_register (bfd_arch_sparc, sparc_gdbarch_init, sparc_dump_tdep); - deprecated_tm_print_insn = gdb_print_insn_sparc; - deprecated_tm_print_insn_info.mach = TM_PRINT_INSN_MACH; /* Selects sparc/sparclite */ /* OBSOLETE target_architecture_hook = sparc_target_architecture_hook; */ } @@ -3577,6 +3565,8 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) break; } + set_gdbarch_print_insn (gdbarch, print_insn_sparc); + /* Hook in OS ABI-specific overrides, if they have been registered. */ gdbarch_init_osabi (info, gdbarch); diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c index 19bdec3..2705804 100644 --- a/gdb/v850-tdep.c +++ b/gdb/v850-tdep.c @@ -1215,7 +1215,6 @@ v850_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) if (v850_processor_type_table[i].mach == info.bfd_arch_info->mach) { v850_register_names = v850_processor_type_table[i].regnames; - deprecated_tm_print_insn_info.mach = info.bfd_arch_info->mach; break; } } @@ -1288,6 +1287,8 @@ v850_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Should be using push_dummy_call. */ set_gdbarch_deprecated_dummy_write_sp (gdbarch, deprecated_write_sp); + set_gdbarch_print_insn (gdbarch, print_insn_v850); + return gdbarch; } @@ -1296,6 +1297,5 @@ extern initialize_file_ftype _initialize_v850_tdep; /* -Wmissing-prototypes */ void _initialize_v850_tdep (void) { - deprecated_tm_print_insn = print_insn_v850; register_gdbarch_init (bfd_arch_v850, v850_gdbarch_init); } diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c index 076bd23..f6d8fcc 100644 --- a/gdb/xstormy16-tdep.c +++ b/gdb/xstormy16-tdep.c @@ -1114,6 +1114,8 @@ xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Should be using push_dummy_call. */ set_gdbarch_deprecated_dummy_write_sp (gdbarch, deprecated_write_sp); + set_gdbarch_print_insn (gdbarch, print_insn_xstormy16); + return gdbarch; } @@ -1129,5 +1131,4 @@ _initialize_xstormy16_tdep (void) extern int print_insn_xstormy16 (); register_gdbarch_init (bfd_arch_xstormy16, xstormy16_gdbarch_init); - deprecated_tm_print_insn = print_insn_xstormy16; } -- 2.7.4