Fri Apr 7 13:44:38 2000 glen mccready <gkm@pobox.com>
authorGlen McCready <gkm@pobox.com>
Thu, 20 Apr 2000 23:54:45 +0000 (23:54 +0000)
committerGlen McCready <gkm@pobox.com>
Thu, 20 Apr 2000 23:54:45 +0000 (23:54 +0000)
        * rs6000-nat.c (xcoff_relocate_symtab): Grow buffer if ptrace()
          fails due to lack of space.

gdb/ChangeLog
gdb/rs6000-nat.c

index 740a3adaa4c8be96f0f481bee1f9f650e4cecb49..8d59e85e48037bb5fe2f4b2e211800e4b4ed722e 100644 (file)
@@ -1,3 +1,8 @@
+Fri Apr  7 13:44:38 2000  glen mccready  <gkm@pobox.com>
+
+        * rs6000-nat.c (xcoff_relocate_symtab): Grow buffer if ptrace()
+          fails due to lack of space.
+
 Fri Mar 24 12:10:38 2000  glen mccready  <gkm@pobox.com>
 
         * command.c, command.h (help_all): Add functionality to display
index 63fadcf9616e90e5baad7521c38231a6b2c6a59e..f4b2831708c0943f276f0157bb9b6cd52e8b2265 100644 (file)
@@ -639,11 +639,16 @@ void
 xcoff_relocate_symtab (pid)
      unsigned int pid;
 {
-#define        MAX_LOAD_SEGS 64        /* maximum number of load segments */
+  int load_segs = 64; /* number of load segments */
 
+  do
+    {
   struct ld_info *ldi;
+      int rc;
 
-  ldi = (void *) alloca (MAX_LOAD_SEGS * sizeof (*ldi));
+      ldi = (void *) alloca (load_segs * sizeof (*ldi));
+      if (ldi == 0)
+       perror_with_name ("xcoff_relocate_symtab");
 
   /* According to my humble theory, AIX has some timing problems and
      when the user stack grows, kernel doesn't update stack info in time
@@ -653,15 +658,21 @@ xcoff_relocate_symtab (pid)
   usleep (36000);
 
   errno = 0;
-  ptrace (PT_LDINFO, pid, (PTRACE_ARG3_TYPE) ldi,
-         MAX_LOAD_SEGS * sizeof (*ldi), (int *) ldi);
-  if (errno)
+      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);
-
-  /* relocate the exec and core sections as well. */
-  vmap_exec ();
+         vmap_exec (); /* relocate the exec and core sections as well. */
+       }
+    } while (rc == -1);
 }
 \f
 /* Core file stuff.  */
This page took 0.027142 seconds and 4 git commands to generate.