Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: "David S. Miller" <davem@davemloft.net>
To: drow@false.org
Cc: mark.kettenis@xs4all.nl, gdb@sources.redhat.com
Subject: Re: core regs vs. proc-service regs mess
Date: Thu, 06 Apr 2006 13:15:00 -0000	[thread overview]
Message-ID: <20060405.220644.04932953.davem@davemloft.net> (raw)
In-Reply-To: <20060405132258.GA28872@nevyn.them.org>

From: Daniel Jacobowitz <drow@false.org>
Date: Wed, 5 Apr 2006 09:23:00 -0400

> On Wed, Apr 05, 2006 at 10:25:21AM +0200, Mark Kettenis wrote:
> > >  This is completely contradictory, and I don't have any idea how to
> > >  cleanly resolve this outside of duplicating the entirety of
> > >  linux_nat_make_corefile_notes() on Linux/Sparc which is silly.
> > >
> > >  Daniel any ideas? :-) Maybe we can have a "linux_tdep" struct where we
> > >  can place a "->to_fill_core_gregset()" type method or similar?
> > 
> > What really should happen is to convert linux_nat_make_corefile_notes() to
> > use the regset_from_core_section() interface.  Unfortunately that is quite
> > a bit of work since most Linux targets don't provide that interface yet.
> 
> Shouldn't this be pretty simple: gdbarch_regset_from_core_section_p?

So something like the following patch?  I didn't know what to do with
the fpxregset stuff, I guess we'll just have to pick some random
string for that?  I couldn't find a ELF section name string assigned
to that stuff.

I tested this patch along with Linux/Sparc regset_from_core_section()
support, and it all seems to work fine.

--- linux-nat.c.~1~	2006-04-05 18:08:11.000000000 -0700
+++ linux-nat.c	2006-04-05 18:41:57.000000000 -0700
@@ -36,6 +36,7 @@
 #include "gdbthread.h"
 #include "gdbcmd.h"
 #include "regcache.h"
+#include "regset.h"
 #include "inf-ptrace.h"
 #include "auxv.h"
 #include <sys/param.h>		/* for MAXPATHLEN */
@@ -2529,15 +2530,33 @@
   gdb_fpxregset_t fpxregs;
 #endif
   unsigned long lwp = ptid_get_lwp (ptid);
+  struct gdbarch *gdbarch = current_gdbarch;
+  const struct regset *regset;
 
-  fill_gregset (&gregs, -1);
+  if (gdbarch && gdbarch_regset_from_core_section_p (gdbarch)
+      && (regset = gdbarch_regset_from_core_section (gdbarch, ".reg",
+						     sizeof gregs)) != NULL)
+    {
+      regset->collect_regset (regset, current_regcache, -1,
+			      &gregs, sizeof gregs);
+    }
+  else
+    fill_gregset (&gregs, -1);
   note_data = (char *) elfcore_write_prstatus (obfd,
 					       note_data,
 					       note_size,
 					       lwp,
 					       stop_signal, &gregs);
 
-  fill_fpregset (&fpregs, -1);
+  if (gdbarch && gdbarch_regset_from_core_section_p (gdbarch)
+      && (regset = gdbarch_regset_from_core_section (gdbarch, ".reg2",
+						     sizeof fpregs)) != NULL)
+    {
+      regset->collect_regset (regset, current_regcache, -1,
+			      &fpregs, sizeof fpregs);
+    }
+  else
+    fill_fpregset (&fpregs, -1);
   note_data = (char *) elfcore_write_prfpreg (obfd,
 					      note_data,
 					      note_size,


  parent reply	other threads:[~2006-04-06  5:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-05  7:07 David S. Miller
2006-04-05  8:25 ` Mark Kettenis
2006-04-05 13:23   ` Daniel Jacobowitz
2006-04-06  1:10     ` David S. Miller
2006-04-06 13:15     ` David S. Miller [this message]
2006-04-06 13:38       ` Daniel Jacobowitz
2006-04-07  0:35         ` 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=20060405.220644.04932953.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=drow@false.org \
    --cc=gdb@sources.redhat.com \
    --cc=mark.kettenis@xs4all.nl \
    /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