Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "David S. Miller" <davem@davemloft.net>
To: drow@false.org
Cc: uweigand@de.ibm.com, gdb-patches@sourceware.org
Subject: Re: [committed] Fix gcore crashes on s390
Date: Sat, 06 May 2006 06:30:00 -0000	[thread overview]
Message-ID: <20060505.233000.75792293.davem@davemloft.net> (raw)
In-Reply-To: <20060506015642.GB12668@nevyn.them.org>

From: Daniel Jacobowitz <drow@false.org>
Date: Fri, 5 May 2006 21:56:42 -0400

> I guess we're going to have to check the collect_regset function
> pointer for NULL then.  David, would you mind making that change?

I'll note in passing that we're back to the original patch
I wrote :-)

Ok to commit?

2006-05-05  David S. Miller  <davem@sunset.davemloft.net>

	* linux-nat.c (linux_nad_do_thread_registers): Check for
	NULL collect_regset method.

Index: linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/linux-nat.c,v
retrieving revision 1.46
diff -u -p -r1.46 linux-nat.c
--- linux-nat.c	5 May 2006 23:48:28 -0000	1.46
+++ linux-nat.c	6 May 2006 06:27:37 -0000
@@ -2549,70 +2549,52 @@ linux_nat_do_thread_registers (bfd *obfd
   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;
 }


  reply	other threads:[~2006-05-06  6:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-06  1:18 Ulrich Weigand
2006-05-06  1:35 ` David S. Miller
2006-05-06  1:56   ` Daniel Jacobowitz
2006-05-06  6:30     ` David S. Miller [this message]
2006-05-06 15:16       ` Daniel Jacobowitz
2006-05-06  8:31     ` Mark Kettenis
2006-05-06  8:26   ` Mark Kettenis
2006-05-06 15:19     ` Daniel Jacobowitz
2006-05-06 18:29       ` Mark Kettenis
2006-05-06 23:56         ` David S. Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060505.233000.75792293.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=drow@false.org \
    --cc=gdb-patches@sourceware.org \
    --cc=uweigand@de.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox