Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "David S. Miller" <davem@davemloft.net>
To: gdb-patches@sources.redhat.com
Subject: [PATCH]: Fix thread debugging on Sparc/Linux
Date: Sun, 02 Apr 2006 07:12:00 -0000	[thread overview]
Message-ID: <20060401.231203.48434968.davem@davemloft.net> (raw)


Normally the {supply,fill}_{gregset,fpregset}() functions don't
get used on Sparc/Linux because all of the register stuff does
ptrace() inside of sparc-nat.c

However, for proc-service.c thread debugging (and I think also
for core files) these routines do get used.

Currently, we're linking in sparc-sol2-nat.o but that doesn't
work so well because it hardcodes using the sparc_sol2_gregset
which causes no end of troubles if used on another native Sparc
platform.

Any objections to the following fix?

Thanks.

2006-04-01  David S. Miller  <davem@davemloft.net>

	* config/linux.mh (NATDEPFILES): Remove sparc-sol2-nat.o
	* config/linux64.h (NATDEPFILES): Likewise
	* sparc-linux-nat.c (supply_gregset, supply_fpregset, fill_gregset,
	fill_fpregset): New.
	* sparc64-linux-nat.c (supply_gregset, supply_fpregset, fill_gregset,
	fill_fpregset): New.

--- ./config/sparc/linux.mh.~1~	2006-02-25 15:05:04.000000000 -0800
+++ ./config/sparc/linux.mh	2006-04-01 22:51:27.000000000 -0800
@@ -1,6 +1,6 @@
 # Host: GNU/Linux SPARC
 NAT_FILE= nm-linux.h
-NATDEPFILES= sparc-nat.o sparc-sol2-nat.o sparc-linux-nat.o \
+NATDEPFILES= sparc-nat.o sparc-linux-nat.o \
 	corelow.o core-regset.o fork-child.o inf-ptrace.o \
 	proc-service.o linux-thread-db.o \
 	gcore.o linux-nat.o linux-fork.o
--- ./config/sparc/linux64.mh.~1~	2006-02-25 15:05:04.000000000 -0800
+++ ./config/sparc/linux64.mh	2006-04-01 22:51:35.000000000 -0800
@@ -1,6 +1,6 @@
 # Host: GNU/Linux UltraSPARC
 NAT_FILE= nm-linux.h
-NATDEPFILES= sparc-nat.o sparc64-nat.o sparc-sol2-nat.o sparc64-linux-nat.o \
+NATDEPFILES= sparc-nat.o sparc64-nat.o sparc64-linux-nat.o \
 	corelow.o core-regset.o \
 	fork-child.o inf-ptrace.o \
 	proc-service.o linux-thread-db.o \
--- ./sparc-linux-nat.c.~1~	2006-04-01 16:55:17.000000000 -0800
+++ ./sparc-linux-nat.c	2006-04-01 22:55:15.000000000 -0800
@@ -20,10 +20,41 @@
    Boston, MA 02110-1301, USA.  */
 
 #include "defs.h"
+#include "regcache.h"
+
+#include <sys/procfs.h>
+#include "gregset.h"
+
+#include "sparc-tdep.h"
+#include "sparc-nat.h"
 #include "inferior.h"
 #include "target.h"
 #include "linux-nat.h"
 
+void
+supply_gregset (prgregset_t *gregs)
+{
+  sparc32_supply_gregset (sparc_gregset, current_regcache, -1, gregs);
+}
+
+void
+supply_fpregset (prfpregset_t *fpregs)
+{
+  sparc32_supply_fpregset (current_regcache, -1, fpregs);
+}
+
+void
+fill_gregset (prgregset_t *gregs, int regnum)
+{
+  sparc32_collect_gregset (sparc_gregset, current_regcache, regnum, gregs);
+}
+
+void
+fill_fpregset (prfpregset_t *fpregs, int regnum)
+{
+  sparc32_collect_fpregset (current_regcache, regnum, fpregs);
+}
+
 void _initialialize_sparc_linux_nat (void);
 
 void
--- ./sparc64-linux-nat.c.~1~	2006-04-01 16:55:17.000000000 -0800
+++ ./sparc64-linux-nat.c	2006-04-01 22:55:30.000000000 -0800
@@ -20,8 +20,13 @@
    Boston, MA 02110-1301, USA.  */
 
 #include "defs.h"
+#include "regcache.h"
+
+#include <sys/procfs.h>
+#include "gregset.h"
 
 #include "sparc64-tdep.h"
+#include "sparc-tdep.h"
 #include "sparc-nat.h"
 #include "inferior.h"
 #include "target.h"
@@ -41,6 +46,30 @@ static const struct sparc_gregset sparc6
 };
 \f
 
+void
+supply_gregset (prgregset_t *gregs)
+{
+  sparc64_supply_gregset (sparc_gregset, current_regcache, -1, gregs);
+}
+
+void
+supply_fpregset (prfpregset_t *fpregs)
+{
+  sparc64_supply_fpregset (current_regcache, -1, fpregs);
+}
+
+void
+fill_gregset (prgregset_t *gregs, int regnum)
+{
+  sparc64_collect_gregset (sparc_gregset, current_regcache, regnum, gregs);
+}
+
+void
+fill_fpregset (prfpregset_t *fpregs, int regnum)
+{
+  sparc64_collect_fpregset (current_regcache, regnum, fpregs);
+}
+
 /* Provide a prototype to silence -Wmissing-prototypes.  */
 void _initialize_sparc64_linux_nat (void);
 


             reply	other threads:[~2006-04-02  7:12 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-02  7:12 David S. Miller [this message]
2006-04-04 21:54 ` David S. Miller
2006-04-04 22:06   ` Daniel Jacobowitz
2006-04-04 22:08     ` David S. Miller
2006-04-04 22:14       ` Daniel Jacobowitz
2006-04-04 22:22         ` David S. Miller
2006-04-04 22:43           ` Daniel Jacobowitz
2006-04-04 22:54             ` David S. Miller
2006-04-04 23:11               ` Daniel Jacobowitz
2006-04-04 23:12                 ` David S. Miller
2006-04-04 23:52                   ` David S. Miller
2006-04-04 23:58                     ` Michael Snyder

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=20060401.231203.48434968.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=gdb-patches@sources.redhat.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