Modernize the aix-thread later by getting rid of the base_target
[deliverable/binutils-gdb.git] / gdb / rs6000-nat.c
index 02a7946a241f335c6f958dadde582315081f315c..9f8a43f8d1be9d94b4363ecdaacf4b2fe45426ff 100644 (file)
@@ -1,7 +1,7 @@
 /* IBM RS/6000 native-dependent code for GDB, the GNU debugger.
 
    Copyright (C) 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
-   1998, 1999, 2000, 2001, 2002, 2003, 2004, 2007, 2008
+   1998, 1999, 2000, 2001, 2002, 2003, 2004, 2007, 2008, 2009
    Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -36,8 +36,8 @@
 #include "ppc-tdep.h"
 #include "rs6000-tdep.h"
 #include "exec.h"
-#include "gdb_stdint.h"
 #include "observer.h"
+#include "xcoffread.h"
 
 #include <sys/ptrace.h>
 #include <sys/reg.h>
@@ -130,7 +130,7 @@ static int objfile_symbol_add (void *);
 
 static void vmap_symtab (struct vmap *);
 
-static void exec_one_dummy_insn (void);
+static void exec_one_dummy_insn (struct gdbarch *);
 
 extern void fixup_breakpoints (CORE_ADDR low, CORE_ADDR high, CORE_ADDR delta);
 
@@ -140,9 +140,9 @@ extern void fixup_breakpoints (CORE_ADDR low, CORE_ADDR high, CORE_ADDR delta);
    ISFLOAT to indicate whether REGNO is a floating point register.  */
 
 static int
-regmap (int regno, int *isfloat)
+regmap (struct gdbarch *gdbarch, int regno, int *isfloat)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
   *isfloat = 0;
   if (tdep->ppc_gp0_regnum <= regno
@@ -155,7 +155,7 @@ regmap (int regno, int *isfloat)
       *isfloat = 1;
       return regno - tdep->ppc_fp0_regnum + FPR0;
     }
-  else if (regno == gdbarch_pc_regnum (current_gdbarch))
+  else if (regno == gdbarch_pc_regnum (gdbarch))
     return IAR;
   else if (regno == tdep->ppc_ps_regnum)
     return MSR;
@@ -218,7 +218,7 @@ fetch_register (struct regcache *regcache, int regno)
   /* Retrieved values may be -1, so infer errors from errno. */
   errno = 0;
 
-  nr = regmap (regno, &isfloat);
+  nr = regmap (gdbarch, regno, &isfloat);
 
   /* Floating-point registers. */
   if (isfloat)
@@ -279,7 +279,7 @@ store_register (const struct regcache *regcache, int regno)
   /* -1 can be a successful return value, so infer errors from errno. */
   errno = 0;
 
-  nr = regmap (regno, &isfloat);
+  nr = regmap (gdbarch, regno, &isfloat);
 
   /* Floating-point registers. */
   if (isfloat)
@@ -303,7 +303,7 @@ store_register (const struct regcache *regcache, int regno)
           Otherwise the following ptrace(2) calls will mess up user stack
           since kernel will get confused about the bottom of the stack
           (%sp). */
-       exec_one_dummy_insn ();
+       exec_one_dummy_insn (gdbarch);
 
       /* The PT_WRITE_GPR operation is rather odd.  For 32-bit inferiors,
          the register's value is passed by value, but for 64-bit inferiors,
@@ -334,7 +334,8 @@ store_register (const struct regcache *regcache, int regno)
    REGNO otherwise. */
 
 static void
-rs6000_fetch_inferior_registers (struct regcache *regcache, int regno)
+rs6000_fetch_inferior_registers (struct target_ops *ops,
+                                struct regcache *regcache, int regno)
 {
   struct gdbarch *gdbarch = get_regcache_arch (regcache);
   if (regno != -1)
@@ -376,7 +377,8 @@ rs6000_fetch_inferior_registers (struct regcache *regcache, int regno)
    Otherwise, REGNO specifies which register (so we can save time).  */
 
 static void
-rs6000_store_inferior_registers (struct regcache *regcache, int regno)
+rs6000_store_inferior_registers (struct target_ops *ops,
+                                struct regcache *regcache, int regno)
 {
   struct gdbarch *gdbarch = get_regcache_arch (regcache);
   if (regno != -1)
@@ -518,7 +520,8 @@ rs6000_xfer_partial (struct target_ops *ops, enum target_object object,
    the status in *OURSTATUS.  */
 
 static ptid_t
-rs6000_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
+rs6000_wait (struct target_ops *ops,
+            ptid_t ptid, struct target_waitstatus *ourstatus)
 {
   pid_t pid;
   int status, save_errno;
@@ -526,7 +529,6 @@ rs6000_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
   do
     {
       set_sigint_trap ();
-      set_sigio_trap ();
 
       do
        {
@@ -535,7 +537,6 @@ rs6000_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
        }
       while (pid == -1 && errno == EINTR);
 
-      clear_sigio_trap ();
       clear_sigint_trap ();
 
       if (pid == -1)
@@ -547,7 +548,7 @@ rs6000_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
          /* Claim it exited with unknown signal.  */
          ourstatus->kind = TARGET_WAITKIND_SIGNALLED;
          ourstatus->value.sig = TARGET_SIGNAL_UNKNOWN;
-         return minus_one_ptid;
+         return inferior_ptid;
        }
 
       /* Ignore terminated detached child processes.  */
@@ -576,9 +577,9 @@ rs6000_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
    including u_area. */
 
 static void
-exec_one_dummy_insn (void)
+exec_one_dummy_insn (struct gdbarch *gdbarch)
 {
-#define        DUMMY_INSN_ADDR gdbarch_tdep (current_gdbarch)->text_segment_base+0x200
+#define        DUMMY_INSN_ADDR AIX_TEXT_SEGMENT_BASE+0x200
 
   int ret, status, pid;
   CORE_ADDR prev_pc;
@@ -967,17 +968,18 @@ vmap_exec (void)
 /* Set the current architecture from the host running GDB.  Called when
    starting a child process. */
 
-static void (*super_create_inferior) (char *exec_file, char *allargs,
-                                     char **env, int from_tty);
+static void (*super_create_inferior) (struct target_ops *,char *exec_file, 
+                                     char *allargs, char **env, int from_tty);
 static void
-rs6000_create_inferior (char *exec_file, char *allargs, char **env, int from_tty)
+rs6000_create_inferior (struct target_ops * ops, char *exec_file,
+                       char *allargs, char **env, int from_tty)
 {
   enum bfd_architecture arch;
   unsigned long mach;
   bfd abfd;
   struct gdbarch_info info;
 
-  super_create_inferior (exec_file, allargs, env, from_tty);
+  super_create_inferior (ops, exec_file, allargs, env, from_tty);
 
   if (__power_rs ())
     {
@@ -1192,16 +1194,15 @@ static CORE_ADDR
 find_toc_address (CORE_ADDR pc)
 {
   struct vmap *vp;
-  extern CORE_ADDR get_toc_offset (struct objfile *);  /* xcoffread.c */
 
   for (vp = vmap; vp; vp = vp->nxt)
     {
       if (pc >= vp->tstart && pc < vp->tend)
        {
          /* vp->objfile is only NULL for the exec file.  */
-         return vp->dstart + get_toc_offset (vp->objfile == NULL
-                                             ? symfile_objfile
-                                             : vp->objfile);
+         return vp->dstart + xcoff_get_toc_offset (vp->objfile == NULL
+                                                   ? symfile_objfile
+                                                   : vp->objfile);
        }
     }
   error (_("Unable to find TOC entry for pc %s."), hex_string (pc));
This page took 0.027285 seconds and 4 git commands to generate.