summaryrefslogtreecommitdiff
path: root/gdb/mips-tdep.c
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2008-09-05 11:43:10 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2008-09-05 11:43:10 +0000
commit353b8d5350d9b8c2becf5eb6efb53919b77f9ef4 (patch)
treedf53f36c542cc1399dd9247fc68165e675a13846 /gdb/mips-tdep.c
parent186aa2d4e31af63b2cceff185331c4e039286171 (diff)
downloadgdb-353b8d5350d9b8c2becf5eb6efb53919b77f9ef4.tar.gz
* m68hc11-tdep.c (gdb_print_insn_m68hc11): Use info->arch
instead of current_gdbarch. * sh64-tdep.c (gdb_print_insn_sh64): Remove. (sh64_gdbarch_init): Install print_insn_sh64 directly. * sh-tdep.c (gdb_print_insn_sh): Remove. (sh_gdbarch_init): Install print_insn_sh directly. * mips-tdep.c (gdb_print_insn_mips): Do not check mips_abi from current_gdbarch. (gdb_print_insn_mips_n32, gdb_print_insn_mips_n64): New functions. (mips_gdbarch_init): Install them instead of gdb_print_insn_mips depending on mips_abi.
Diffstat (limited to 'gdb/mips-tdep.c')
-rw-r--r--gdb/mips-tdep.c43
1 files changed, 29 insertions, 14 deletions
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 4d908431edb..14e21fb4568 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -4907,8 +4907,6 @@ reinit_frame_cache_sfunc (char *args, int from_tty,
static int
gdb_print_insn_mips (bfd_vma memaddr, struct disassemble_info *info)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
-
/* FIXME: cagney/2003-06-26: Is this even necessary? The
disassembler needs to be able to locally determine the ISA, and
not rely on GDB. Otherwize the stand-alone 'objdump -d' will not
@@ -4920,17 +4918,7 @@ gdb_print_insn_mips (bfd_vma memaddr, struct disassemble_info *info)
memaddr &= (info->mach == bfd_mach_mips16 ? ~1 : ~3);
/* Set the disassembler options. */
- if (tdep->mips_abi == MIPS_ABI_N32 || tdep->mips_abi == MIPS_ABI_N64)
- {
- /* Set up the disassembler info, so that we get the right
- register names from libopcodes. */
- if (tdep->mips_abi == MIPS_ABI_N32)
- info->disassembler_options = "gpr-names=n32";
- else
- info->disassembler_options = "gpr-names=64";
- info->flavour = bfd_target_elf_flavour;
- }
- else
+ if (!info->disassembler_options)
/* This string is not recognized explicitly by the disassembler,
but it tells the disassembler to not try to guess the ABI from
the bfd elf headers, such that, if the user overrides the ABI
@@ -4945,6 +4933,28 @@ gdb_print_insn_mips (bfd_vma memaddr, struct disassemble_info *info)
return print_insn_little_mips (memaddr, info);
}
+static int
+gdb_print_insn_mips_n32 (bfd_vma memaddr, struct disassemble_info *info)
+{
+ /* Set up the disassembler info, so that we get the right
+ register names from libopcodes. */
+ info->disassembler_options = "gpr-names=n32";
+ info->flavour = bfd_target_elf_flavour;
+
+ return gdb_print_insn_mips (memaddr, info);
+}
+
+static int
+gdb_print_insn_mips_n64 (bfd_vma memaddr, struct disassemble_info *info)
+{
+ /* Set up the disassembler info, so that we get the right
+ register names from libopcodes. */
+ info->disassembler_options = "gpr-names=64";
+ info->flavour = bfd_target_elf_flavour;
+
+ return gdb_print_insn_mips (memaddr, info);
+}
+
/* This function implements gdbarch_breakpoint_from_pc. It uses the program
counter value to determine whether a 16- or 32-bit breakpoint should be used.
It returns a pointer to a string of bytes that encode a breakpoint
@@ -5872,7 +5882,12 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_print_registers_info (gdbarch, mips_print_registers_info);
- set_gdbarch_print_insn (gdbarch, gdb_print_insn_mips);
+ if (mips_abi == MIPS_ABI_N32)
+ set_gdbarch_print_insn (gdbarch, gdb_print_insn_mips_n32);
+ else if (mips_abi == MIPS_ABI_N64)
+ set_gdbarch_print_insn (gdbarch, gdb_print_insn_mips_n64);
+ else
+ set_gdbarch_print_insn (gdbarch, gdb_print_insn_mips);
/* FIXME: cagney/2003-08-29: The macros HAVE_STEPPABLE_WATCHPOINT,
HAVE_NONSTEPPABLE_WATCHPOINT, and HAVE_CONTINUABLE_WATCHPOINT