diff options
author | Ulrich Weigand <uweigand@de.ibm.com> | 2007-04-25 22:22:11 +0000 |
---|---|---|
committer | Ulrich Weigand <uweigand@de.ibm.com> | 2007-04-25 22:22:11 +0000 |
commit | dda0c97e687c8545e0feee0f4afe6b0041938ed7 (patch) | |
tree | b47a793a30f7b43946bba15bc3614d4271ce1fff /gdb | |
parent | 910122bf0a86e84e7dbd625c2164ae95f35ce24f (diff) | |
download | gdb-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')
-rw-r--r-- | gdb/ChangeLog | 16 | ||||
-rw-r--r-- | gdb/Makefile.in | 2 | ||||
-rw-r--r-- | gdb/mips-linux-nat.c | 78 | ||||
-rw-r--r-- | gdb/mips-linux-tdep.c | 107 |
4 files changed, 90 insertions, 113 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 50add55..bce1edd 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,21 @@ 2007-04-25 Ulrich Weigand <uweigand@de.ibm.com> + * 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. + +2007-04-25 Ulrich Weigand <uweigand@de.ibm.com> + * linux-nat.c (linux_register_u_offset): Remove. (linux_target_install_ops): New function. (linux_target): Use it. diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 7885934..927d87e 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -2341,7 +2341,7 @@ mips64obsd-tdep.o: mips64obsd-tdep.c $(defs_h) $(osabi_h) $(regcache_h) \ mips-irix-tdep.o: mips-irix-tdep.c $(defs_h) $(osabi_h) $(elf_bfd_h) mips-linux-nat.o: mips-linux-nat.c $(defs_h) $(mips_tdep_h) $(target_h) \ $(linux_nat_h) $(gdb_proc_service_h) $(mips_linux_tdep_h) \ - $(gdbcore_h) $(inferior_h) + $(inferior_h) mips-linux-tdep.o: mips-linux-tdep.c $(defs_h) $(gdbcore_h) $(target_h) \ $(solib_svr4_h) $(osabi_h) $(mips_tdep_h) $(gdb_string_h) \ $(gdb_assert_h) $(frame_h) $(regcache_h) $(trad_frame_h) \ 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); diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c index bf4c786..dec2f42 100644 --- a/gdb/mips-linux-tdep.c +++ b/gdb/mips-linux-tdep.c @@ -218,42 +218,6 @@ mips_fill_fpregset (mips_elf_fpregset_t *fpregsetp, int regno) } } -/* 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, CORE_ADDR blockend) -{ - 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; -} - /* Support for 64-bit ABIs. */ /* Figure out where the longjmp will land. @@ -487,42 +451,6 @@ mips64_fill_fpregset (mips64_elf_fpregset_t *fpregsetp, int regno) } -/* Map gdb internal register number to ptrace ``address''. - These ``addresses'' are normally defined in <asm/ptrace.h>. */ - -static CORE_ADDR -mips64_linux_register_addr (int regno, CORE_ADDR blockend) -{ - 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; -} - /* Use a local version of this function to get the correct types for regsets, until multi-arch core support is ready. */ @@ -584,35 +512,6 @@ static struct core_fns regset_core_fns = NULL /* next */ }; -/* Handle for obtaining pointer to the current register_addr() - function for a given architecture. */ -static struct gdbarch_data *register_addr_data; - -CORE_ADDR -register_addr (int regno, CORE_ADDR blockend) -{ - CORE_ADDR (*register_addr_ptr) (int, CORE_ADDR) = - gdbarch_data (current_gdbarch, register_addr_data); - - gdb_assert (register_addr_ptr != 0); - - return register_addr_ptr (regno, blockend); -} - -static void -set_mips_linux_register_addr (struct gdbarch *gdbarch, - CORE_ADDR (*register_addr_ptr) (int, - CORE_ADDR)) -{ - deprecated_set_gdbarch_data (gdbarch, register_addr_data, - register_addr_ptr); -} - -static void * -init_register_addr_data (struct gdbarch *gdbarch) -{ - return 0; -} /* Check the code at PC for a dynamic linker lazy resolution stub. Because they aren't in the .plt section, we pattern-match on the @@ -1139,7 +1038,6 @@ mips_linux_init_abi (struct gdbarch_info info, mips_linux_get_longjmp_target); set_solib_svr4_fetch_link_map_offsets (gdbarch, svr4_ilp32_fetch_link_map_offsets); - set_mips_linux_register_addr (gdbarch, mips_linux_register_addr); tramp_frame_prepend_unwinder (gdbarch, &mips_linux_o32_sigframe); tramp_frame_prepend_unwinder (gdbarch, &mips_linux_o32_rt_sigframe); break; @@ -1148,7 +1046,6 @@ mips_linux_init_abi (struct gdbarch_info info, mips_linux_get_longjmp_target); set_solib_svr4_fetch_link_map_offsets (gdbarch, svr4_ilp32_fetch_link_map_offsets); - set_mips_linux_register_addr (gdbarch, mips64_linux_register_addr); set_gdbarch_long_double_bit (gdbarch, 128); /* These floatformats should probably be renamed. MIPS uses the same 128-bit IEEE floating point format that IA-64 uses, @@ -1162,7 +1059,6 @@ mips_linux_init_abi (struct gdbarch_info info, mips64_linux_get_longjmp_target); set_solib_svr4_fetch_link_map_offsets (gdbarch, svr4_lp64_fetch_link_map_offsets); - set_mips_linux_register_addr (gdbarch, mips64_linux_register_addr); set_gdbarch_long_double_bit (gdbarch, 128); /* These floatformats should probably be renamed. MIPS uses the same 128-bit IEEE floating point format that IA-64 uses, @@ -1191,9 +1087,6 @@ _initialize_mips_linux_tdep (void) { const struct bfd_arch_info *arch_info; - register_addr_data = - gdbarch_data_register_post_init (init_register_addr_data); - for (arch_info = bfd_lookup_arch (bfd_arch_mips, 0); arch_info != NULL; arch_info = arch_info->next) |