aboutsummaryrefslogtreecommitdiff
path: root/gdb/mips-linux-nat.c
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2007-04-25 22:22:11 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2007-04-25 22:22:11 +0000
commitdda0c97e687c8545e0feee0f4afe6b0041938ed7 (patch)
treeb47a793a30f7b43946bba15bc3614d4271ce1fff /gdb/mips-linux-nat.c
parent910122bf0a86e84e7dbd625c2164ae95f35ce24f (diff)
downloadgdb-dda0c97e687c8545e0feee0f4afe6b0041938ed7.zip
gdb-dda0c97e687c8545e0feee0f4afe6b0041938ed7.tar.gz
gdb-dda0c97e687c8545e0feee0f4afe6b0041938ed7.tar.bz2
* mips-linux-nat.c: No longer include "gdbcore.h".
(mips_linux_register_addr): Move from mips-linux-tdep.c. (mips64_linux_register_addr): Likewise. (mips_linux_register_u_offset): Call mips_linux_register_addr or mips64_linux_register_addr instead of register_addr. * mips-linux-tdep.c (mips_linux_register_addr, mips64_linux_register_addr): Move to mips-linux-nat.c. (register_addr): Remove. (register_addr_data, init_register_addr_data): Remove. (_initialize_mips_linux_tdep): Do not initialize register_addr_data. (set_mips_linux_register_addr): Remove. (mips_linux_init_abi): Do not call set_mips_linux_register_addr. * Makefile.in (mips-linux-nat.o): Update dependencies.
Diffstat (limited to 'gdb/mips-linux-nat.c')
-rw-r--r--gdb/mips-linux-nat.c78
1 files changed, 73 insertions, 5 deletions
diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c
index d5a1202..b4c275a 100644
--- a/gdb/mips-linux-nat.c
+++ b/gdb/mips-linux-nat.c
@@ -26,7 +26,6 @@
#include "target.h"
#include "linux-nat.h"
#include "mips-linux-tdep.h"
-#include "gdbcore.h"
#include "gdb_proc_service.h"
@@ -87,6 +86,75 @@ mips_linux_cannot_store_register (int regno)
return 1;
}
+/* Map gdb internal register number to ptrace ``address''.
+ These ``addresses'' are normally defined in <asm/ptrace.h>. */
+
+static CORE_ADDR
+mips_linux_register_addr (int regno)
+{
+ int regaddr;
+
+ if (regno < 0 || regno >= NUM_REGS)
+ error (_("Bogon register number %d."), regno);
+
+ if (regno < 32)
+ regaddr = regno;
+ else if ((regno >= mips_regnum (current_gdbarch)->fp0)
+ && (regno < mips_regnum (current_gdbarch)->fp0 + 32))
+ regaddr = FPR_BASE + (regno - mips_regnum (current_gdbarch)->fp0);
+ else if (regno == mips_regnum (current_gdbarch)->pc)
+ regaddr = PC;
+ else if (regno == mips_regnum (current_gdbarch)->cause)
+ regaddr = CAUSE;
+ else if (regno == mips_regnum (current_gdbarch)->badvaddr)
+ regaddr = BADVADDR;
+ else if (regno == mips_regnum (current_gdbarch)->lo)
+ regaddr = MMLO;
+ else if (regno == mips_regnum (current_gdbarch)->hi)
+ regaddr = MMHI;
+ else if (regno == mips_regnum (current_gdbarch)->fp_control_status)
+ regaddr = FPC_CSR;
+ else if (regno == mips_regnum (current_gdbarch)->fp_implementation_revision)
+ regaddr = FPC_EIR;
+ else
+ error (_("Unknowable register number %d."), regno);
+
+ return regaddr;
+}
+
+static CORE_ADDR
+mips64_linux_register_addr (int regno)
+{
+ int regaddr;
+
+ if (regno < 0 || regno >= NUM_REGS)
+ error (_("Bogon register number %d."), regno);
+
+ if (regno < 32)
+ regaddr = regno;
+ else if ((regno >= mips_regnum (current_gdbarch)->fp0)
+ && (regno < mips_regnum (current_gdbarch)->fp0 + 32))
+ regaddr = MIPS64_FPR_BASE + (regno - FP0_REGNUM);
+ else if (regno == mips_regnum (current_gdbarch)->pc)
+ regaddr = MIPS64_PC;
+ else if (regno == mips_regnum (current_gdbarch)->cause)
+ regaddr = MIPS64_CAUSE;
+ else if (regno == mips_regnum (current_gdbarch)->badvaddr)
+ regaddr = MIPS64_BADVADDR;
+ else if (regno == mips_regnum (current_gdbarch)->lo)
+ regaddr = MIPS64_MMLO;
+ else if (regno == mips_regnum (current_gdbarch)->hi)
+ regaddr = MIPS64_MMHI;
+ else if (regno == mips_regnum (current_gdbarch)->fp_control_status)
+ regaddr = MIPS64_FPC_CSR;
+ else if (regno == mips_regnum (current_gdbarch)->fp_implementation_revision)
+ regaddr = MIPS64_FPC_EIR;
+ else
+ error (_("Unknowable register number %d."), regno);
+
+ return regaddr;
+}
+
/* Fetch the thread-local storage pointer for libthread_db. */
ps_err_e
@@ -253,10 +321,10 @@ mips64_linux_store_registers (int regnum)
static CORE_ADDR
mips_linux_register_u_offset (int regno)
{
- /* FIXME drow/2005-09-04: The hardcoded use of register_addr should go
- away. This requires disentangling the various definitions of it
- (particularly alpha-nat.c's). */
- return register_addr (regno, 0);
+ if (mips_abi_regsize (current_gdbarch) == 8)
+ return mips64_linux_register_addr (regno);
+ else
+ return mips_linux_register_addr (regno);
}
void _initialize_mips_linux_nat (void);