* linux-nat.c (linux_nat_do_thread_registers): Check for
authorDavid S. Miller <davem@redhat.com>
Sat, 6 May 2006 23:55:36 +0000 (23:55 +0000)
committerDavid S. Miller <davem@redhat.com>
Sat, 6 May 2006 23:55:36 +0000 (23:55 +0000)
NULL collect_regset method.

gdb/ChangeLog
gdb/linux-nat.c

index 9655109a36d2679488b0a0c637dcd6e8eb88012b..bc9ff0a6ad731834a871916429e949bcaaea38a0 100644 (file)
@@ -1,3 +1,8 @@
+2006-05-06  David S. Miller  <davem@sunset.davemloft.net>
+
+       * linux-nat.c (linux_nat_do_thread_registers): Check for
+       NULL collect_regset method.
+
 2006-05-06  Ulrich Weigand  <uweigand@de.ibm.com>
 
        * s390-tdep.c (s390_collect_regset): New function.
index 5a80311808d2fdf2d76f08d6e193b0080f7bc950..932119edfc58ce38fcb2954bc0948487f7ddc9fa 100644 (file)
@@ -2549,70 +2549,52 @@ linux_nat_do_thread_registers (bfd *obfd, ptid_t ptid,
   unsigned long lwp = ptid_get_lwp (ptid);
   struct gdbarch *gdbarch = current_gdbarch;
   const struct regset *regset;
-  int core_regset_p, record_reg_p;
+  int core_regset_p;
 
   core_regset_p = gdbarch_regset_from_core_section_p (gdbarch);
-  record_reg_p = 1;
-  if (core_regset_p)
-    {
-      regset = gdbarch_regset_from_core_section (gdbarch, ".reg",
-                                                sizeof (gregs));
-      if (regset)
-       regset->collect_regset (regset, current_regcache, -1,
-                               &gregs, sizeof (gregs));
-      else
-       record_reg_p = 0;
-    }
+  if (core_regset_p
+      && (regset = gdbarch_regset_from_core_section (gdbarch, ".reg",
+                                                    sizeof (gregs))) != NULL
+      && regset->collect_regset != NULL)
+    regset->collect_regset (regset, current_regcache, -1,
+                           &gregs, sizeof (gregs));
   else
     fill_gregset (&gregs, -1);
 
-  if (record_reg_p)
-    note_data = (char *) elfcore_write_prstatus (obfd,
-                                                note_data,
-                                                note_size,
-                                                lwp,
-                                                stop_signal, &gregs);
-
-  record_reg_p = 1;
-  if (core_regset_p)
-    {
-      regset = gdbarch_regset_from_core_section (gdbarch, ".reg2",
-                                                sizeof (fpregs));
-      if (regset)
-       regset->collect_regset (regset, current_regcache, -1,
-                               &fpregs, sizeof (fpregs));
-      else
-       record_reg_p = 0;
-    }
+  note_data = (char *) elfcore_write_prstatus (obfd,
+                                              note_data,
+                                              note_size,
+                                              lwp,
+                                              stop_signal, &gregs);
+
+  if (core_regset_p
+      && (regset = gdbarch_regset_from_core_section (gdbarch, ".reg2",
+                                                    sizeof (fpregs))) != NULL
+      && regset->collect_regset != NULL)
+    regset->collect_regset (regset, current_regcache, -1,
+                           &fpregs, sizeof (fpregs));
   else
     fill_fpregset (&fpregs, -1);
 
-  if (record_reg_p)
-    note_data = (char *) elfcore_write_prfpreg (obfd,
-                                               note_data,
-                                               note_size,
-                                               &fpregs, sizeof (fpregs));
+  note_data = (char *) elfcore_write_prfpreg (obfd,
+                                             note_data,
+                                             note_size,
+                                             &fpregs, sizeof (fpregs));
 
 #ifdef FILL_FPXREGSET
-  record_reg_p = 1;
-  if (core_regset_p)
-    {
-      regset = gdbarch_regset_from_core_section (gdbarch, ".reg-xfp",
-                                                sizeof (fpxregs));
-      if (regset)
-       regset->collect_regset (regset, current_regcache, -1,
-                               &fpxregs, sizeof (fpxregs));
-      else
-       record_reg_p = 0;
-    }
+  if (core_regset_p
+      && (regset = gdbarch_regset_from_core_section (gdbarch, ".reg-xfp",
+                                                    sizeof (fpxregs))) != NULL
+      && regset->collect_regset != NULL)
+    regset->collect_regset (regset, current_regcache, -1,
+                           &fpxregs, sizeof (fpxregs));
   else
     fill_fpxregset (&fpxregs, -1);
 
-  if (record_reg_p)
-    note_data = (char *) elfcore_write_prxfpreg (obfd,
-                                                note_data,
-                                                note_size,
-                                                &fpxregs, sizeof (fpxregs));
+  note_data = (char *) elfcore_write_prxfpreg (obfd,
+                                              note_data,
+                                              note_size,
+                                              &fpxregs, sizeof (fpxregs));
 #endif
   return note_data;
 }