From 6f7f3f0da4e5202ebe8722ea0464ca35f937b206 Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Tue, 27 Feb 2007 23:04:28 +0000 Subject: [PATCH] * config/powerpc/linux.mt (DEPRECATED_TM_FILE): Set to tm-ppc-eabi.h. * config/powerpc/tm-linux.h: Delete file. * config/powerpc/tm-ppc-eabi.h: Do not include "rs6000/tm-rs6000.h". (PROCESS_LINENUMBER_HOOK): Do not undefine. (TEXT_SEGMENT_BASE): Do not redefine. * config/rs6000/nm-rs6000.h (CHILD_SPECIAL_WAITSTATUS): Move here from config/rs6000/tm-rs6000.h. (TARGET_CREATE_INFERIOR_HOOK, rs6000_create_inferior): Likewise. * config/rs6000/tm-rs6000.h (struct frame_info): Remove declaration. (TEXT_SEGMENT_BASE): Remove. (IN_SOLIB_RETURN_TRAMPOLINE): Remove. (rs6000_in_solib_return_trampoline): Remove. (SKIP_TRAMPOLINE_CODE): Remove. (rs6000_skip_trampoline_code): Remove. (CHILD_SPECIAL_WAITSTATUS): Move to config/rs6000/nm-rs6000.h. (TARGET_CREATE_INFERIOR_HOOK, rs6000_create_inferior): Likewise. (FP0_REGNUM): Remove. (rs6000_find_toc_address_hook): Move to rs6000-tdep.h. (rs6000_set_host_arch_hook): Remove. * Makefile.in (rs6000-nat.o): Add dependency on $(rs6000_tdep_h). (rs6000-aix-tdep.o): Add dependency on $(ppc_tdep_h). * ppc-tdep.h (struct gdbarch_tdep): Add field text_segment_base. * rs6000-aix-tdep.c: Include "ppc-tdep.h". (rs6000_aix_init_osabi): Set text_segment_base tdep field. * rs6000-nat.c: Include "rs6000-tdep.h". (exec_one_dummy_insn): Replace TEXT_SEGMENT_BASE by tdep field. (set_host_arch): Rename to ... (rs6000_create_inferior): ... this. Make public. (_initialize_core_rs6000): Do not set rs6000_set_host_arch_hook. * rs6000-tdep.c (rs6000_set_host_arch_hook): Remove. (rs6000_create_inferior): Remove. (branch_dest): Replace TEXT_SEGMENT_BASE by tdep field. (rs6000_gdbarch_init): Call set_gdbarch_fp0_regnum, set_gdbarch_in_solib_return_trampoline, and set_gdbarch_skip_trampoline_code. * rs6000-tdep.h (rs6000_find_toc_address_hook): Move here from config/rs6000/tm-rs6000.h. --- gdb/ChangeLog | 40 +++++++++++++++++++++ gdb/Makefile.in | 5 +-- gdb/config/powerpc/linux.mt | 2 +- gdb/config/powerpc/tm-linux.h | 45 ------------------------ gdb/config/powerpc/tm-ppc-eabi.h | 8 ----- gdb/config/rs6000/nm-rs6000.h | 19 ++++++++++ gdb/config/rs6000/tm-rs6000.h | 60 -------------------------------- gdb/ppc-tdep.h | 3 ++ gdb/rs6000-aix-tdep.c | 4 +++ gdb/rs6000-nat.c | 13 +++---- gdb/rs6000-tdep.c | 25 +++++-------- gdb/rs6000-tdep.h | 5 +++ 12 files changed, 89 insertions(+), 140 deletions(-) delete mode 100644 gdb/config/powerpc/tm-linux.h diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 252a97ec8af..15f4eb901a6 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,43 @@ +2007-02-28 Ulrich Weigand + + * config/powerpc/linux.mt (DEPRECATED_TM_FILE): Set to tm-ppc-eabi.h. + * config/powerpc/tm-linux.h: Delete file. + * config/powerpc/tm-ppc-eabi.h: Do not include "rs6000/tm-rs6000.h". + (PROCESS_LINENUMBER_HOOK): Do not undefine. + (TEXT_SEGMENT_BASE): Do not redefine. + * config/rs6000/nm-rs6000.h (CHILD_SPECIAL_WAITSTATUS): Move here + from config/rs6000/tm-rs6000.h. + (TARGET_CREATE_INFERIOR_HOOK, rs6000_create_inferior): Likewise. + * config/rs6000/tm-rs6000.h (struct frame_info): Remove declaration. + (TEXT_SEGMENT_BASE): Remove. + (IN_SOLIB_RETURN_TRAMPOLINE): Remove. + (rs6000_in_solib_return_trampoline): Remove. + (SKIP_TRAMPOLINE_CODE): Remove. + (rs6000_skip_trampoline_code): Remove. + (CHILD_SPECIAL_WAITSTATUS): Move to config/rs6000/nm-rs6000.h. + (TARGET_CREATE_INFERIOR_HOOK, rs6000_create_inferior): Likewise. + (FP0_REGNUM): Remove. + (rs6000_find_toc_address_hook): Move to rs6000-tdep.h. + (rs6000_set_host_arch_hook): Remove. + * Makefile.in (rs6000-nat.o): Add dependency on $(rs6000_tdep_h). + (rs6000-aix-tdep.o): Add dependency on $(ppc_tdep_h). + * ppc-tdep.h (struct gdbarch_tdep): Add field text_segment_base. + * rs6000-aix-tdep.c: Include "ppc-tdep.h". + (rs6000_aix_init_osabi): Set text_segment_base tdep field. + * rs6000-nat.c: Include "rs6000-tdep.h". + (exec_one_dummy_insn): Replace TEXT_SEGMENT_BASE by tdep field. + (set_host_arch): Rename to ... + (rs6000_create_inferior): ... this. Make public. + (_initialize_core_rs6000): Do not set rs6000_set_host_arch_hook. + * rs6000-tdep.c (rs6000_set_host_arch_hook): Remove. + (rs6000_create_inferior): Remove. + (branch_dest): Replace TEXT_SEGMENT_BASE by tdep field. + (rs6000_gdbarch_init): Call set_gdbarch_fp0_regnum, + set_gdbarch_in_solib_return_trampoline, and + set_gdbarch_skip_trampoline_code. + * rs6000-tdep.h (rs6000_find_toc_address_hook): Move here + from config/rs6000/tm-rs6000.h. + 2007-02-27 Joel Brobecker * buildsym.c (record_producer): Do nothing if no producer is provided. diff --git a/gdb/Makefile.in b/gdb/Makefile.in index be270da3b2a..cfc805f22ad 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -2576,7 +2576,7 @@ rom68k-rom.o: rom68k-rom.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \ rs6000-nat.o: rs6000-nat.c $(defs_h) $(inferior_h) $(target_h) $(gdbcore_h) \ $(xcoffsolib_h) $(symfile_h) $(objfiles_h) $(libbfd_h) $(bfd_h) \ $(exceptions_h) $(gdb_stabs_h) $(regcache_h) $(arch_utils_h) \ - $(ppc_tdep_h) $(exec_h) $(gdb_stat_h) + $(ppc_tdep_h) $(rs6000_tdep_h) $(exec_h) $(gdb_stat_h) rs6000-tdep.o: rs6000-tdep.c $(defs_h) $(frame_h) $(inferior_h) $(symtab_h) \ $(target_h) $(gdbcore_h) $(gdbcmd_h) $(objfiles_h) $(arch_utils_h) \ $(regcache_h) $(regset_h) $(doublest_h) $(value_h) $(parser_defs_h) \ @@ -2585,7 +2585,8 @@ rs6000-tdep.o: rs6000-tdep.c $(defs_h) $(frame_h) $(inferior_h) $(symtab_h) \ $(coff_xcoff_h) $(libxcoff_h) $(elf_bfd_h) $(solib_svr4_h) \ $(ppc_tdep_h) $(gdb_assert_h) $(dis_asm_h) $(trad_frame_h) \ $(frame_unwind_h) $(frame_base_h) $(rs6000_tdep_h) -rs6000-aix-tdep.o: rs6000-aix-tdep.c $(defs_h) $(osabi_h) $(rs6000_tdep_h) +rs6000-aix-tdep.o: rs6000-aix-tdep.c $(defs_h) $(osabi_h) $(rs6000_tdep_h) \ + $(ppc_tdep_h) s390-nat.o: s390-nat.c $(defs_h) $(regcache_h) $(inferior_h) \ $(s390_tdep_h) $(target_h) $(linux_nat_h) s390-tdep.o: s390-tdep.c $(defs_h) $(arch_utils_h) $(frame_h) $(inferior_h) \ diff --git a/gdb/config/powerpc/linux.mt b/gdb/config/powerpc/linux.mt index 949659c8c35..752a9379ea4 100644 --- a/gdb/config/powerpc/linux.mt +++ b/gdb/config/powerpc/linux.mt @@ -1,7 +1,7 @@ # Target: Motorola PPC on Linux TDEPFILES= rs6000-tdep.o ppc-linux-tdep.o ppc-sysv-tdep.o solib.o \ solib-svr4.o solib-legacy.o corelow.o symfile-mem.o -DEPRECATED_TM_FILE= tm-linux.h +DEPRECATED_TM_FILE= tm-ppc-eabi.h SIM_OBS = remote-sim.o SIM = ../sim/ppc/libsim.a diff --git a/gdb/config/powerpc/tm-linux.h b/gdb/config/powerpc/tm-linux.h deleted file mode 100644 index 563934402d3..00000000000 --- a/gdb/config/powerpc/tm-linux.h +++ /dev/null @@ -1,45 +0,0 @@ -/* Definitions to target GDB to GNU/Linux on PowerPC. - - Copyright 1992, 1993, 2000, 2002, 2007 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#ifndef TM_LINUX_H -#define TM_LINUX_H - -#include "powerpc/tm-ppc-eabi.h" - -/* We've multi-arched these. */ -#undef SKIP_TRAMPOLINE_CODE - -/* Make sure nexti gets the help it needs for debugging assembly code - without symbols */ - -extern int ppc_linux_in_sigtramp (CORE_ADDR pc, char *func_name); -#undef DEPRECATED_IN_SIGTRAMP -#define DEPRECATED_IN_SIGTRAMP(pc,func_name) ppc_linux_in_sigtramp (pc,func_name) - -#if 0 -#define CANNOT_FETCH_REGISTER(regno) ((regno) >= MQ_REGNUM) -#define CANNOT_STORE_REGISTER(regno) ((regno) >= MQ_REGNUM) -#endif - -/* N_FUN symbols in shared libaries have 0 for their values and need - to be relocated. */ -#define SOFUN_ADDRESS_MAYBE_MISSING - -#endif /* #ifndef TM_LINUX_H */ diff --git a/gdb/config/powerpc/tm-ppc-eabi.h b/gdb/config/powerpc/tm-ppc-eabi.h index 028d2b5965b..a1e2a099884 100644 --- a/gdb/config/powerpc/tm-ppc-eabi.h +++ b/gdb/config/powerpc/tm-ppc-eabi.h @@ -22,14 +22,6 @@ #ifndef TM_PPC_EABI_H #define TM_PPC_EABI_H -/* Use generic RS6000 definitions. */ -#include "rs6000/tm-rs6000.h" - -#undef PROCESS_LINENUMBER_HOOK - -#undef TEXT_SEGMENT_BASE -#define TEXT_SEGMENT_BASE 1 - /* The value of symbols of type N_SO and N_FUN maybe null when it shouldn't be. */ #define SOFUN_ADDRESS_MAYBE_MISSING diff --git a/gdb/config/rs6000/nm-rs6000.h b/gdb/config/rs6000/nm-rs6000.h index 3203c607e47..15d589e19c9 100644 --- a/gdb/config/rs6000/nm-rs6000.h +++ b/gdb/config/rs6000/nm-rs6000.h @@ -63,3 +63,22 @@ extern int kernel_u_size (void); /* Flag for machine-specific stuff in shared files. FIXME */ #define DEPRECATED_IBM6000_TARGET + +/* AIX has a couple of strange returns from wait(). */ + +#define CHILD_SPECIAL_WAITSTATUS(ourstatus, hoststatus) ( \ + /* "stop after load" status. */ \ + (hoststatus) == 0x57c ? (ourstatus)->kind = TARGET_WAITKIND_LOADED, 1 : \ + \ + /* signal 0. I have no idea why wait(2) returns with this status word. */ \ + /* It looks harmless. */ \ + (hoststatus) == 0x7f ? (ourstatus)->kind = TARGET_WAITKIND_SPURIOUS, 1 : \ + \ + /* A normal waitstatus. Let the usual macros deal with it. */ \ + 0) + +/* Notice when a new child process is started. */ + +#define TARGET_CREATE_INFERIOR_HOOK rs6000_create_inferior +extern void rs6000_create_inferior (int); + diff --git a/gdb/config/rs6000/tm-rs6000.h b/gdb/config/rs6000/tm-rs6000.h index f6cf70fe5ac..7656747e5ed 100644 --- a/gdb/config/rs6000/tm-rs6000.h +++ b/gdb/config/rs6000/tm-rs6000.h @@ -22,38 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -struct frame_info; - -/* Minimum possible text address in AIX */ - -#define TEXT_SEGMENT_BASE 0x10000000 - -/* Return whether PC in function NAME is in code that should be skipped when - single-stepping. */ - -#define IN_SOLIB_RETURN_TRAMPOLINE(pc, name) \ - rs6000_in_solib_return_trampoline (pc, name) -extern int rs6000_in_solib_return_trampoline (CORE_ADDR, char *); - -/* If PC is in some function-call trampoline code, return the PC - where the function itself actually starts. If not, return NULL. */ - -#define SKIP_TRAMPOLINE_CODE(pc) rs6000_skip_trampoline_code (pc) -extern CORE_ADDR rs6000_skip_trampoline_code (CORE_ADDR); - -/* AIX has a couple of strange returns from wait(). */ - -#define CHILD_SPECIAL_WAITSTATUS(ourstatus, hoststatus) ( \ - /* "stop after load" status. */ \ - (hoststatus) == 0x57c ? (ourstatus)->kind = TARGET_WAITKIND_LOADED, 1 : \ - \ - /* signal 0. I have no idea why wait(2) returns with this status word. */ \ - /* It looks harmless. */ \ - (hoststatus) == 0x7f ? (ourstatus)->kind = TARGET_WAITKIND_SPURIOUS, 1 : \ - \ - /* A normal waitstatus. Let the usual macros deal with it. */ \ - 0) - /* In xcoff, we cannot process line numbers when we see them. This is mainly because we don't know the boundaries of the include files. So, we postpone that, and then enter and sort(?) the whole line table at @@ -62,31 +30,3 @@ extern CORE_ADDR rs6000_skip_trampoline_code (CORE_ADDR); #define PROCESS_LINENUMBER_HOOK() aix_process_linenos () extern void aix_process_linenos (void); -/* Register numbers of various important registers. - Note that some of these values are "real" register numbers, - and correspond to the general registers of the machine, - and some are "phony" register numbers which are too large - to be actual register numbers as far as the user is concerned - but do serve to get the desired values when passed to read_register. */ - -/* Don't use this in code specific to the RS6000 and its descendants; - use tdep->ppc_fp0_regnum instead. FP0_REGNUM will be deprecated - soon, but we still need to define it here for the uses in - architecture-independent code. */ -#define FP0_REGNUM 32 /* Floating point register 0 */ - -/* Notice when a new child process is started. */ - -#define TARGET_CREATE_INFERIOR_HOOK rs6000_create_inferior -extern void rs6000_create_inferior (int); - -/* Hook in rs6000-tdep.c for determining the TOC address when - calling functions in the inferior. */ - -extern CORE_ADDR (*rs6000_find_toc_address_hook) (CORE_ADDR); - -/* Hook in rs6000-tdep.c to set the current architecture when starting a - child process. */ - -extern void (*rs6000_set_host_arch_hook) (int); - diff --git a/gdb/ppc-tdep.h b/gdb/ppc-tdep.h index 38a4cb7bc86..8d1c8a223a8 100644 --- a/gdb/ppc-tdep.h +++ b/gdb/ppc-tdep.h @@ -183,6 +183,9 @@ struct gdbarch_tdep register number for GDB register number I, or -1 if the simulator does not implement that register. */ int *sim_regno; + + /* Minimum possible text address. */ + CORE_ADDR text_segment_base; }; diff --git a/gdb/rs6000-aix-tdep.c b/gdb/rs6000-aix-tdep.c index 573c5e8819c..6e195a23eed 100644 --- a/gdb/rs6000-aix-tdep.c +++ b/gdb/rs6000-aix-tdep.c @@ -24,6 +24,7 @@ #include "defs.h" #include "osabi.h" #include "rs6000-tdep.h" +#include "ppc-tdep.h" static enum gdb_osabi rs6000_aix_osabi_sniffer (bfd *abfd) @@ -40,6 +41,9 @@ rs6000_aix_init_osabi (struct gdbarch_info info, struct gdbarch *gdbarch) { /* RS6000/AIX does not support PT_STEP. Has to be simulated. */ set_gdbarch_software_single_step (gdbarch, rs6000_software_single_step); + + /* Minimum possible text address in AIX. */ + gdbarch_tdep (gdbarch)->text_segment_base = 0x10000000; } void diff --git a/gdb/rs6000-nat.c b/gdb/rs6000-nat.c index 07147a19347..97a53aafcff 100644 --- a/gdb/rs6000-nat.c +++ b/gdb/rs6000-nat.c @@ -35,6 +35,7 @@ #include "regcache.h" #include "arch-utils.h" #include "ppc-tdep.h" +#include "rs6000-tdep.h" #include "exec.h" #include @@ -525,7 +526,7 @@ child_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, static void exec_one_dummy_insn (void) { -#define DUMMY_INSN_ADDR (TEXT_SEGMENT_BASE)+0x200 +#define DUMMY_INSN_ADDR gdbarch_tdep (current_gdbarch)->text_segment_base+0x200 int ret, status, pid; CORE_ADDR prev_pc; @@ -993,8 +994,8 @@ vmap_exec (void) /* Set the current architecture from the host running GDB. Called when starting a child process. */ -static void -set_host_arch (int pid) +void +rs6000_create_inferior (int pid) { enum bfd_architecture arch; unsigned long mach; @@ -1037,7 +1038,7 @@ set_host_arch (int pid) if (!gdbarch_update_p (info)) internal_error (__FILE__, __LINE__, - _("set_host_arch: failed to select architecture")); + _("rs6000_create_inferior: failed to select architecture")); } @@ -1248,9 +1249,5 @@ _initialize_core_rs6000 (void) when calling functions in the inferior. */ rs6000_find_toc_address_hook = find_toc_address; - /* Initialize hook in rs6000-tdep.c to set the current architecture - when starting a child process. */ - rs6000_set_host_arch_hook = set_host_arch; - deprecated_add_core_fns (&rs6000_core_fns); } diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 6e358876dc2..25fa5508f64 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -115,11 +115,6 @@ struct reg CORE_ADDR (*rs6000_find_toc_address_hook) (CORE_ADDR) = NULL; -/* Hook to set the current architecture when starting a child process. - rs6000-nat.c sets this. */ - -void (*rs6000_set_host_arch_hook) (int) = NULL; - /* Static function prototypes */ static CORE_ADDR branch_dest (int opcode, int instr, CORE_ADDR pc, @@ -655,7 +650,7 @@ branch_dest (int opcode, int instr, CORE_ADDR pc, CORE_ADDR safety) something like 0x3c90. The current frame is a signal handler caller frame, upon completion of the sigreturn system call execution will return to the saved PC in the frame. */ - if (dest < TEXT_SEGMENT_BASE) + if (dest < gdbarch_tdep (current_gdbarch)->text_segment_base) { struct frame_info *fi; @@ -673,7 +668,7 @@ branch_dest (int opcode, int instr, CORE_ADDR pc, CORE_ADDR safety) /* If we are about to execute a system call, dest is something like 0x22fc or 0x3b00. Upon completion the system call will return to the address in the link register. */ - if (dest < TEXT_SEGMENT_BASE) + if (dest < gdbarch_tdep (current_gdbarch)->text_segment_base) dest = read_register (gdbarch_tdep (current_gdbarch)->ppc_lr_regnum) & ~3; } else @@ -683,7 +678,7 @@ branch_dest (int opcode, int instr, CORE_ADDR pc, CORE_ADDR safety) default: return -1; } - return (dest < TEXT_SEGMENT_BASE) ? safety : dest; + return (dest < gdbarch_tdep (current_gdbarch)->text_segment_base) ? safety : dest; } @@ -2342,14 +2337,6 @@ rs6000_dwarf2_reg_to_regnum (int num) } } -/* Hook called when a new child process is started. */ - -void -rs6000_create_inferior (int pid) -{ - if (rs6000_set_host_arch_hook) - rs6000_set_host_arch_hook (pid); -} /* Support for CONVERT_FROM_FUNC_PTR_ADDR (ARCH, ADDR, TARG). @@ -3332,6 +3319,7 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_pc_regnum (gdbarch, 64); set_gdbarch_sp_regnum (gdbarch, 1); set_gdbarch_deprecated_fp_regnum (gdbarch, 1); + set_gdbarch_fp0_regnum (gdbarch, 32); set_gdbarch_register_sim_regno (gdbarch, rs6000_register_sim_regno); if (sysv_abi && wordsize == 8) set_gdbarch_return_value (gdbarch, ppc64_sysv_abi_return_value); @@ -3478,6 +3466,11 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Helpers for function argument information. */ set_gdbarch_fetch_pointer_argument (gdbarch, rs6000_fetch_pointer_argument); + /* Trampoline. */ + set_gdbarch_in_solib_return_trampoline + (gdbarch, rs6000_in_solib_return_trampoline); + set_gdbarch_skip_trampoline_code (gdbarch, rs6000_skip_trampoline_code); + /* Hook in ABI-specific overrides, if they have been registered. */ gdbarch_init_osabi (info, gdbarch); diff --git a/gdb/rs6000-tdep.h b/gdb/rs6000-tdep.h index 834c425366f..f655f631276 100644 --- a/gdb/rs6000-tdep.h +++ b/gdb/rs6000-tdep.h @@ -24,3 +24,8 @@ extern void rs6000_software_single_step (enum target_signal signal, int insert_breakpoints_p); +/* Hook in rs6000-tdep.c for determining the TOC address when + calling functions in the inferior. */ + +extern CORE_ADDR (*rs6000_find_toc_address_hook) (CORE_ADDR); + -- 2.30.2