From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9557 invoked by alias); 29 Nov 2006 21:00:41 -0000 Received: (qmail 9540 invoked by uid 22791); 29 Nov 2006 21:00:38 -0000 X-Spam-Check-By: sourceware.org Received: from mtagate3.de.ibm.com (HELO mtagate3.de.ibm.com) (195.212.29.152) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 29 Nov 2006 21:00:29 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate3.de.ibm.com (8.13.8/8.13.8) with ESMTP id kATL0LLV176292 for ; Wed, 29 Nov 2006 21:00:21 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.6/8.13.6/NCO v8.1.1) with ESMTP id kATL3xUB3289148 for ; Wed, 29 Nov 2006 22:03:59 +0100 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id kATL0K3M003348 for ; Wed, 29 Nov 2006 22:00:20 +0100 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with SMTP id kATL0KRR003342 for ; Wed, 29 Nov 2006 22:00:20 +0100 Message-Id: <200611292100.kATL0KRR003342@d12av02.megacenter.de.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Wed, 29 Nov 2006 22:00:20 +0100 Subject: [RFA/RFC] (Mostly) clean up PowerPC TM files To: gdb-patches@sourceware.org Date: Wed, 29 Nov 2006 21:00:00 -0000 From: "Ulrich Weigand" X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-11/txt/msg00408.txt.bz2 Hello, here's my attempt to clean up the various TM files under config/rs6000 and config/powerpc. As pointed out in http://sources.redhat.com/ml/gdb/2006-11/msg00206.html it appears that the rs6000- targets are already broken anyway; in this patch I'm assuming I don't really need to care about them. Now, here's a summary of the configurations that are affected by the TM files under config/rs6000 and config/powerpc, both target and native: target: rs6000-*-lynxos* rs6000lynx.mt rm-rs6000ly.h -> tm-rs6000.h rs6000-tdep ppc-sysv-tdep rs6000-*-aix4* aix4.mt tm-rs6000.h rs6000-tdep ppc-sysv-tdep AIX?? rs6000-*-* rs6000.mt tm-rs6000.h rs6000-tdep ppc-sysv-tdep AIX?? powerpc-*-netbsd nbsd.mt tm-ppc-eabi.h -> tm-rs6000.h rs6000-tdep ppc-sysv-tdep ppcnbsd-tdep powerpc-*-openbsd obsd.mt tm-ppc-eabi.h -> tm-rs6000.h rs6000-tdep ppc-sysv-tdep ppcobsd-tdep powerpc[64]-*-linux linux.mt tm-linux.h -> tm-ppc-eabi.h -> tm-rs6000.h rs6000-tdep ppc-sysv-tdep ppc-linux-tdep powerpc-*-aix* aix.mt tm-rs6000.h rs6000-tdep ppc-sysv-tdep rs6000-aix-tdep powerpc*-*-* ppc-eabi.mt tm-ppc-eabi.h -> tm-rs6000.h ppc-sim.mt rs6000-tdep ppc-sysv-tdep native: rs6000-*-lynxos* rs6000ly.mh config/nm-lynx.h lynx-nat rs6000-*-aix4* aix4.mh nm-rs6000.h rs6000-nat rs6000-*-* rs6000.mh nm-rs6000.h rs6000-nat powerpc-*-netbsd nbsd.mh - ppcobsd-nat powerpc-*-openbsd obsd.mh - ppcnbsd-nat powerpc[64]-*-linux linux.mh nm-linux.h -> config/nm-linux.h ppc-linux-nat.o powerpc-*-aix* aix.mh nm-aix.h -> config/rs6000/nm-rs6000.h rs6000-nat.o Based on this, I've looked at the current contents of the TM files, and for the vast majority of settings found a way to move them out without changing the behaviour of any configuration (except maybe the rs6000- ones). tm-rs6000.h: - TEXT_SEGMENT_BASE Valid for rs6000-*-*, rs6000-*-aix4*, rs6000-*-lynxos*, powerpc-*-aix*. Undef'd in tm-ppc-eabi.h (Even though it today affects LynxOS, that's probably broken!) Used in rs6000-nat.c and rs6000-tdep.c. -> Should go to gdbarch_tdep. Defined in rs6000-aix-tdep.c init_osabi. - IN_SOLIB_RETURN_TRAMPOLINE Valid for all targets. GDBARCH callback. -> Should be installed in rs6000-tdep.c init_gdbarch. - SKIP_TRAMPOLINE_CODE Valid for all targets except Linux; undef'd in tm-linux.h. GDBARCH callback. -> Should be installed in rs6000-tdep.c init_gdbarch. (Linux already overrides in init_osabi.) - CHILD_SPECIAL_WAITSTATUS ??? Really a NATIVE property; used in store_waitstatus. ??? Should be defined for AIX only. -> Move to nm-rs6000.h - PROCESS_LINENUMBER_HOOK ??? Should be handled in common code - FP0_REGNUM Valid for all targets. GDBARCH callback. -> Should be installed in rs6000-tdep.c init_gdbarch. - TARGET_CREATE_INFERIOR_HOOK ??? Implementation in rs6000-tdep.c calls rs6000_set_host_arch_hook, which is non-NULL only on AIX native configurations. -> Move to nm-rs6000.h; directly call rs6000-nat.c implementation. - rs6000_set_host_arch_hook No longer used (see TARGET_CREATE_INFERIOR_HOOK). -> Remove. - rs6000_find_toc_address_hook Used only to communicate between rs6000-nat.c and rs6000-tdep.c. -> Move to rs6000-tdep.h. tm-ppc-eabi.h: - #include "rs6000/tm-rs6000.h" #undef PROCESS_LINENUMBER_HOOK -> Since tm-rs6000.h now only defines PROCESS_LINENUMBER_HOOK, this is a no-op. - TEXT_SEGMENT_BASE -> Handled via gdbarch_tdep. See above. - SOFUN_ADDRESS_MAYBE_MISSING ??? Unclear how to handle this one tm-linux.h: - #include "powerpc/tm-ppc-eabi.h" - #undef SKIP_TRAMPOLINE_CODE -> no longer necessary since tm-rs6000.h no longer defines it - DEPRECATED_IN_SIGTRAMP ??? this is a no-op anyway. Already handled via sniffers. -> remove - SOFUN_ADDRESS_MAYBE_MISSING ??? duplicate to definition in tm-ppc-eabi.h -> remove The end result of those changes is the following set of TM files: - tm-rs6000.h Only contains PROCESS_LINENUMBER_HOOK - tm-ppc-eabi.h Only contains SOFUN_ADDRESS_MAYBE_MISSING - tm-linux.h No longer needed; use tm-ppc-eabi.h instead. Not fully perfect, but a lot better than before ... To test this patch I've done a full regression test on powerpc64-linux, and in addition built cross-GDBs to rs6000-aix, rs6000-lynxos, powerpc-aix, powerpc-elf, powerpc-linux, powerpc-netbsd, and powerpc-openbsd. OK? Bye, Ulrich ChangeLog: * 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. diff -urN gdb-orig/gdb/config/powerpc/linux.mt gdb-head/gdb/config/powerpc/linux.mt --- gdb-orig/gdb/config/powerpc/linux.mt 2005-02-09 16:58:51.000000000 +0100 +++ gdb-head/gdb/config/powerpc/linux.mt 2006-11-28 23:57:41.000000000 +0100 @@ -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 -urN gdb-orig/gdb/config/powerpc/tm-linux.h gdb-head/gdb/config/powerpc/tm-linux.h --- gdb-orig/gdb/config/powerpc/tm-linux.h 2006-11-28 21:46:03.000000000 +0100 +++ gdb-head/gdb/config/powerpc/tm-linux.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,45 +0,0 @@ -/* Definitions to target GDB to GNU/Linux on PowerPC. - - Copyright 1992, 1993, 2000, 2002 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 -urN gdb-orig/gdb/config/powerpc/tm-ppc-eabi.h gdb-head/gdb/config/powerpc/tm-ppc-eabi.h --- gdb-orig/gdb/config/powerpc/tm-ppc-eabi.h 2006-11-24 18:06:51.000000000 +0100 +++ gdb-head/gdb/config/powerpc/tm-ppc-eabi.h 2006-11-29 18:31:07.844293752 +0100 @@ -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 -urN gdb-orig/gdb/config/rs6000/nm-rs6000.h gdb-head/gdb/config/rs6000/nm-rs6000.h --- gdb-orig/gdb/config/rs6000/nm-rs6000.h 2004-06-08 21:58:14.000000000 +0200 +++ gdb-head/gdb/config/rs6000/nm-rs6000.h 2006-11-29 00:06:24.000000000 +0100 @@ -63,3 +63,22 @@ /* 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 -urN gdb-orig/gdb/config/rs6000/tm-rs6000.h gdb-head/gdb/config/rs6000/tm-rs6000.h --- gdb-orig/gdb/config/rs6000/tm-rs6000.h 2006-11-24 18:05:44.000000000 +0100 +++ gdb-head/gdb/config/rs6000/tm-rs6000.h 2006-11-29 18:31:28.146270888 +0100 @@ -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 @@ #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 -urN gdb-orig/gdb/Makefile.in gdb-head/gdb/Makefile.in --- gdb-orig/gdb/Makefile.in 2006-11-28 21:46:14.000000000 +0100 +++ gdb-head/gdb/Makefile.in 2006-11-29 18:36:48.772262744 +0100 @@ -2550,7 +2550,7 @@ 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) \ @@ -2559,7 +2559,8 @@ $(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 -urN gdb-orig/gdb/ppc-tdep.h gdb-head/gdb/ppc-tdep.h --- gdb-orig/gdb/ppc-tdep.h 2006-04-18 21:20:06.000000000 +0200 +++ gdb-head/gdb/ppc-tdep.h 2006-11-29 18:21:42.236257424 +0100 @@ -183,6 +183,9 @@ 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 -urN gdb-orig/gdb/rs6000-aix-tdep.c gdb-head/gdb/rs6000-aix-tdep.c --- gdb-orig/gdb/rs6000-aix-tdep.c 2006-02-10 21:56:14.000000000 +0100 +++ gdb-head/gdb/rs6000-aix-tdep.c 2006-11-29 18:23:13.878308040 +0100 @@ -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 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 -urN gdb-orig/gdb/rs6000-nat.c gdb-head/gdb/rs6000-nat.c --- gdb-orig/gdb/rs6000-nat.c 2006-04-18 21:20:06.000000000 +0200 +++ gdb-head/gdb/rs6000-nat.c 2006-11-29 18:24:16.344265936 +0100 @@ -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 @@ 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 @@ /* 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 @@ 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 @@ 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 -urN gdb-orig/gdb/rs6000-tdep.c gdb-head/gdb/rs6000-tdep.c --- gdb-orig/gdb/rs6000-tdep.c 2006-11-19 02:35:30.000000000 +0100 +++ gdb-head/gdb/rs6000-tdep.c 2006-11-29 18:25:04.954333272 +0100 @@ -115,11 +115,6 @@ 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 @@ 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 @@ /* 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 @@ default: return -1; } - return (dest < TEXT_SEGMENT_BASE) ? safety : dest; + return (dest < gdbarch_tdep (current_gdbarch)->text_segment_base) ? safety : dest; } @@ -2315,14 +2310,6 @@ return 0; } -/* 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). @@ -3301,6 +3288,7 @@ 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); @@ -3461,6 +3449,11 @@ /* 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 -urN gdb-orig/gdb/rs6000-tdep.h gdb-head/gdb/rs6000-tdep.h --- gdb-orig/gdb/rs6000-tdep.h 2006-11-19 02:35:30.000000000 +0100 +++ gdb-head/gdb/rs6000-tdep.h 2006-11-29 00:08:35.000000000 +0100 @@ -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); + -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com