2004-04-21 Andrew Cagney <cagney@redhat.com>
[deliverable/binutils-gdb.git] / gdb / rs6000-nat.c
index e825529ba95876f257149662828946ccb7574a17..02bb2e2d414438fb9aac63e059379dd59e9b0b84 100644 (file)
@@ -1,7 +1,8 @@
 /* IBM RS/6000 native-dependent code for GDB, the GNU debugger.
-   Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
-   1998, 1999, 2000, 2001, 2002
-   Free Software Foundation, Inc.
+
+   Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996,
+   1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
+   Foundation, Inc.
 
    This file is part of GDB.
 
@@ -34,6 +35,7 @@
 #include "arch-utils.h"
 #include "language.h"          /* for local_hex_string().  */
 #include "ppc-tdep.h"
+#include "exec.h"
 
 #include <sys/ptrace.h>
 #include <sys/reg.h>
@@ -71,7 +73,7 @@
 #ifndef ARCH3264
 # define ARCH64() 0
 #else
-# define ARCH64() (REGISTER_RAW_SIZE (0) == 8)
+# define ARCH64() (DEPRECATED_REGISTER_RAW_SIZE (0) == 8)
 #endif
 
 /* Union of 32-bit and 64-bit ".reg" core file sections. */
@@ -127,8 +129,6 @@ typedef union {
 
 extern struct vmap *map_vmap (bfd * bf, bfd * arch);
 
-extern struct target_ops exec_ops;
-
 static void vmap_exec (void);
 
 static void vmap_ldinfo (LdInfo *);
@@ -251,7 +251,7 @@ fetch_register (int regno)
             even if the register is really only 32 bits. */
          long long buf;
          rs6000_ptrace64 (PT_READ_GPR, PIDGET (inferior_ptid), nr, 0, (int *)&buf);
-         if (REGISTER_RAW_SIZE (regno) == 8)
+         if (DEPRECATED_REGISTER_RAW_SIZE (regno) == 8)
            memcpy (addr, &buf, 8);
          else
            *addr = buf;
@@ -320,7 +320,7 @@ store_register (int regno)
          /* PT_WRITE_GPR requires the buffer parameter to point to an 8-byte
             area, even if the register is really only 32 bits. */
          long long buf;
-         if (REGISTER_RAW_SIZE (regno) == 8)
+         if (DEPRECATED_REGISTER_RAW_SIZE (regno) == 8)
            memcpy (&buf, addr, 8);
          else
            buf = *addr;
@@ -646,7 +646,7 @@ vmap_secs (struct vmap *vp, LdInfo *ldi, int arch64)
 static void
 vmap_symtab (struct vmap *vp)
 {
-  register struct objfile *objfile;
+  struct objfile *objfile;
   struct section_offsets *new_offsets;
   int i;
 
@@ -664,7 +664,9 @@ vmap_symtab (struct vmap *vp)
     /* If symbols are not yet loaded, offsets are not yet valid. */
     return;
 
-  new_offsets = (struct section_offsets *) alloca (SIZEOF_SECTION_OFFSETS);
+  new_offsets =
+    (struct section_offsets *)
+    alloca (SIZEOF_N_SECTION_OFFSETS (objfile->num_sections));
 
   for (i = 0; i < objfile->num_sections; ++i)
     new_offsets->offsets[i] = ANOFFSET (objfile->section_offsets, i);
@@ -718,7 +720,7 @@ static struct vmap *
 add_vmap (LdInfo *ldi)
 {
   bfd *abfd, *last;
-  register char *mem, *objname, *filename;
+  char *mem, *objname, *filename;
   struct objfile *obj;
   struct vmap *vp;
   int fd;
@@ -757,7 +759,7 @@ add_vmap (LdInfo *ldi)
       last = 0;
       /* FIXME??? am I tossing BFDs?  bfd? */
       while ((last = bfd_openr_next_archived_file (abfd, last)))
-       if (STREQ (mem, last->filename))
+       if (DEPRECATED_STREQ (mem, last->filename))
          break;
 
       if (!last)
@@ -801,7 +803,7 @@ static void
 vmap_ldinfo (LdInfo *ldi)
 {
   struct stat ii, vi;
-  register struct vmap *vp;
+  struct vmap *vp;
   int got_one, retried;
   int got_exec_file = 0;
   uint next;
@@ -841,8 +843,8 @@ vmap_ldinfo (LdInfo *ldi)
 
          /* The filenames are not always sufficient to match on. */
 
-         if ((name[0] == '/' && !STREQ (name, vp->name))
-             || (memb[0] && !STREQ (memb, vp->member)))
+         if ((name[0] == '/' && !DEPRECATED_STREQ (name, vp->name))
+             || (memb[0] && !DEPRECATED_STREQ (memb, vp->member)))
            continue;
 
          /* See if we are referring to the same file.
@@ -878,8 +880,8 @@ vmap_ldinfo (LdInfo *ldi)
 
          /* Announce new object files.  Doing this after symbol relocation
             makes aix-thread.c's job easier. */
-         if (target_new_objfile_hook && vp->objfile)
-           target_new_objfile_hook (vp->objfile);
+         if (deprecated_target_new_objfile_hook && vp->objfile)
+           deprecated_target_new_objfile_hook (vp->objfile);
 
          /* There may be more, so we don't break out of the loop.  */
        }
@@ -939,17 +941,17 @@ vmap_exec (void)
 
   for (i = 0; &exec_ops.to_sections[i] < exec_ops.to_sections_end; i++)
     {
-      if (STREQ (".text", exec_ops.to_sections[i].the_bfd_section->name))
+      if (DEPRECATED_STREQ (".text", exec_ops.to_sections[i].the_bfd_section->name))
        {
          exec_ops.to_sections[i].addr += vmap->tstart - vmap->tvma;
          exec_ops.to_sections[i].endaddr += vmap->tstart - vmap->tvma;
        }
-      else if (STREQ (".data", exec_ops.to_sections[i].the_bfd_section->name))
+      else if (DEPRECATED_STREQ (".data", exec_ops.to_sections[i].the_bfd_section->name))
        {
          exec_ops.to_sections[i].addr += vmap->dstart - vmap->dvma;
          exec_ops.to_sections[i].endaddr += vmap->dstart - vmap->dvma;
        }
-      else if (STREQ (".bss", exec_ops.to_sections[i].the_bfd_section->name))
+      else if (DEPRECATED_STREQ (".bss", exec_ops.to_sections[i].the_bfd_section->name))
        {
          exec_ops.to_sections[i].addr += vmap->dstart - vmap->dvma;
          exec_ops.to_sections[i].endaddr += vmap->dstart - vmap->dvma;
@@ -1000,6 +1002,7 @@ set_host_arch (int pid)
 
   gdbarch_info_init (&info);
   info.bfd_arch_info = bfd_get_arch_info (&abfd);
+  info.abfd = exec_bfd;
 
   if (!gdbarch_update_p (info))
     {
@@ -1065,7 +1068,7 @@ xcoff_relocate_symtab (unsigned int pid)
 void
 xcoff_relocate_core (struct target_ops *target)
 {
-  sec_ptr ldinfo_sec;
+  struct bfd_section *ldinfo_sec;
   int offset = 0;
   LdInfo *ldi;
   struct vmap *vp;
@@ -1159,8 +1162,8 @@ xcoff_relocate_core (struct target_ops *target)
 
       vmap_symtab (vp);
 
-      if (target_new_objfile_hook && vp != vmap && vp->objfile)
-       target_new_objfile_hook (vp->objfile);
+      if (deprecated_target_new_objfile_hook && vp != vmap && vp->objfile)
+       deprecated_target_new_objfile_hook (vp->objfile);
     }
   while (LDI_NEXT (ldi, arch64) != 0);
   vmap_exec ();
@@ -1220,5 +1223,5 @@ _initialize_core_rs6000 (void)
      starting a child process. */
   rs6000_set_host_arch_hook = set_host_arch;
 
-  add_core_fns (&rs6000_core_fns);
+  deprecated_add_core_fns (&rs6000_core_fns);
 }
This page took 0.029383 seconds and 4 git commands to generate.