* config/powerpc/linux.mt (DEPRECATED_TM_FILE): Set to tm-ppc-eabi.h.
authorUlrich Weigand <uweigand@de.ibm.com>
Tue, 27 Feb 2007 23:04:28 +0000 (23:04 +0000)
committerUlrich Weigand <uweigand@de.ibm.com>
Tue, 27 Feb 2007 23:04:28 +0000 (23:04 +0000)
* 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.

12 files changed:
gdb/ChangeLog
gdb/Makefile.in
gdb/config/powerpc/linux.mt
gdb/config/powerpc/tm-linux.h [deleted file]
gdb/config/powerpc/tm-ppc-eabi.h
gdb/config/rs6000/nm-rs6000.h
gdb/config/rs6000/tm-rs6000.h
gdb/ppc-tdep.h
gdb/rs6000-aix-tdep.c
gdb/rs6000-nat.c
gdb/rs6000-tdep.c
gdb/rs6000-tdep.h

index 252a97ec8af303efdb2e90a4b23bd426caceaabb..15f4eb901a6aea41a61cf75efc3a5e6aca5a2aa7 100644 (file)
@@ -1,3 +1,43 @@
+2007-02-28  Ulrich Weigand  <uweigand@de.ibm.com>
+
+       * 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  <brobecker@adacore.com>
 
        * buildsym.c (record_producer): Do nothing if no producer is provided.
index be270da3b2a1c3a57bba0651e3f3c195859028f5..cfc805f22ad880cac24ef0340f82b8549fabc6c1 100644 (file)
@@ -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) \
index 949659c8c3566b60ca8cbfdb9d8a0e61f6db8ba4..752a9379ea48ad3aeb14b6bc1a2d6ee84cf666c8 100644 (file)
@@ -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 (file)
index 5639344..0000000
+++ /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 */
index 028d2b5965be01751a919e8db18a6f522540c6fb..a1e2a0998848aeae45d95dd428683e25c56aad4f 100644 (file)
 #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
index 3203c607e47de78942949daa4f7a3294ca740eba..15d589e19c92f84b22b06cfe9f498d2cf41e2c2d 100644 (file)
@@ -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);
+
index f6cf70fe5acddbfb80c14b3e9897f2b9ba6e4bb5..7656747e5ed7198454bb779b49f593e1ddaf145b 100644 (file)
    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);
-
index 38a4cb7bc8669f74d2e4eb1b182916fb720de180..8d1c8a223a8bdcb2b4e9b43e9c20137c9fdeaebf 100644 (file)
@@ -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;
 };
 
 
index 573c5e8819cfccd1e9831aa0789690840ad2efc7..6e195a23eed174fc965f4a68fba597f2703814ea 100644 (file)
@@ -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
index 07147a19347ba3dc58948ce705a38635787425ee..97a53aafcffe21d43cef4203801866d968f5502b 100644 (file)
@@ -35,6 +35,7 @@
 #include "regcache.h"
 #include "arch-utils.h"
 #include "ppc-tdep.h"
+#include "rs6000-tdep.h"
 #include "exec.h"
 
 #include <sys/ptrace.h>
@@ -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"));
 }
 
 \f
@@ -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);
 }
index 6e358876dc290b165b04f954990d2728115aa83d..25fa5508f6438a3c052f90cd1f32c51625e0d1a2 100644 (file)
@@ -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);
-}
 \f
 /* 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);
 
index 834c425366f0f910588730067bed2cd886d3fb13..f655f6312762fd795dcb88495effb4d7e881c126 100644 (file)
@@ -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);
+