Fix compile time warning messages.
[deliverable/binutils-gdb.git] / gdb / rs6000-nat.c
index d109f3319e85e05378d670c0d37e1e10d0918bb1..f1ee4225fe58781266ac64294aec231e68d3c946 100644 (file)
 
 extern int errno;
 
-extern struct vmap *map_vmap PARAMS ((bfd * bf, bfd * arch));
+extern struct vmap *map_vmap (bfd * bf, bfd * arch);
 
 extern struct target_ops exec_ops;
 
-static void
-vmap_exec PARAMS ((void));
+static void vmap_exec (void);
 
-static void
-vmap_ldinfo PARAMS ((struct ld_info *));
+static void vmap_ldinfo (struct ld_info *);
 
-static struct vmap *
-  add_vmap PARAMS ((struct ld_info *));
+static struct vmap *add_vmap (struct ld_info *);
 
-static int
-objfile_symbol_add PARAMS ((char *));
+static int objfile_symbol_add (char *);
 
-static void
-vmap_symtab PARAMS ((struct vmap *));
+static void vmap_symtab (struct vmap *);
 
-static void
-fetch_core_registers PARAMS ((char *, unsigned int, int, CORE_ADDR));
+static void fetch_core_registers (char *, unsigned int, int, CORE_ADDR);
 
-static void
-exec_one_dummy_insn PARAMS ((void));
+static void exec_one_dummy_insn (void);
 
 extern void
-fixup_breakpoints PARAMS ((CORE_ADDR low, CORE_ADDR high, CORE_ADDR delta));
+fixup_breakpoints (CORE_ADDR low, CORE_ADDR high, CORE_ADDR delta);
 
 /* Conversion from gdb-to-system special purpose register numbers.. */
 
@@ -215,6 +208,8 @@ store_inferior_registers (regno)
 
   else if (regno < FP0_REGNUM) /* a GPR */
     {
+      if (regno == SP_REGNUM)
+       exec_one_dummy_insn ();
       ptrace (PT_WRITE_GPR, inferior_pid, (PTRACE_ARG3_TYPE) regno,
              *(int *) &registers[REGISTER_BYTE (regno)], 0);
     }
@@ -233,6 +228,11 @@ store_inferior_registers (regno)
              *(int *) &registers[REGISTER_BYTE (regno)], 0);
     }
 
+  else if (regno < NUM_REGS)
+    {
+      /* Ignore it.  */
+    }
+
   else
     fprintf_unfiltered (gdb_stderr,
                        "Gdb error: register no %d not implemented.\n",
@@ -350,9 +350,9 @@ vmap_symtab (vp)
 
   /* The symbols in the object file are linked to the VMA of the section,
      relocate them VMA relative.  */
-  ANOFFSET (new_offsets, SECT_OFF_TEXT) = vp->tstart - vp->tvma;
-  ANOFFSET (new_offsets, SECT_OFF_DATA) = vp->dstart - vp->dvma;
-  ANOFFSET (new_offsets, SECT_OFF_BSS) = vp->dstart - vp->dvma;
+  ANOFFSET (new_offsets, SECT_OFF_TEXT (objfile)) = vp->tstart - vp->tvma;
+  ANOFFSET (new_offsets, SECT_OFF_DATA (objfile)) = vp->dstart - vp->dvma;
+  ANOFFSET (new_offsets, SECT_OFF_BSS (objfile)) = vp->dstart - vp->dvma;
 
   objfile_relocate (objfile, new_offsets);
 }
@@ -632,29 +632,39 @@ void
 xcoff_relocate_symtab (pid)
      unsigned int pid;
 {
-#define        MAX_LOAD_SEGS 64        /* maximum number of load segments */
-
-  struct ld_info *ldi;
+  int load_segs = 64; /* number of load segments */
+  int rc;
+  struct ld_info *ldi = NULL;
 
-  ldi = (void *) alloca (MAX_LOAD_SEGS * sizeof (*ldi));
-
-  /* According to my humble theory, AIX has some timing problems and
-     when the user stack grows, kernel doesn't update stack info in time
-     and ptrace calls step on user stack. That is why we sleep here a little,
-     and give kernel to update its internals. */
-
-  usleep (36000);
+  do
+    {
+      ldi = (void *) xrealloc (ldi, load_segs * sizeof (*ldi));
 
-  errno = 0;
-  ptrace (PT_LDINFO, pid, (PTRACE_ARG3_TYPE) ldi,
-         MAX_LOAD_SEGS * sizeof (*ldi), (int *) ldi);
-  if (errno)
-    perror_with_name ("ptrace ldinfo");
+      /* According to my humble theory, AIX has some timing problems and
+         when the user stack grows, kernel doesn't update stack info in time
+         and ptrace calls step on user stack. That is why we sleep here a
+         little, and give kernel to update its internals. */
 
-  vmap_ldinfo (ldi);
+      usleep (36000);
 
-  /* relocate the exec and core sections as well. */
-  vmap_exec ();
+      errno = 0;
+      rc = ptrace (PT_LDINFO, pid, (PTRACE_ARG3_TYPE) ldi,
+                  load_segs * sizeof (*ldi), (int *) ldi);
+      if (rc == -1)
+        {
+          if (errno == ENOMEM)
+            load_segs *= 2;
+          else
+            perror_with_name ("ptrace ldinfo");
+        }
+      else
+       {
+          vmap_ldinfo (ldi);
+          vmap_exec (); /* relocate the exec and core sections as well. */
+       }
+    } while (rc == -1);
+  if (ldi)
+    free (ldi);
 }
 \f
 /* Core file stuff.  */
This page took 0.025919 seconds and 4 git commands to generate.