* [PATCH]: Fix thread debugging on Sparc/Linux
@ 2006-04-02 7:12 David S. Miller
2006-04-04 21:54 ` David S. Miller
0 siblings, 1 reply; 12+ messages in thread
From: David S. Miller @ 2006-04-02 7:12 UTC (permalink / raw)
To: gdb-patches
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);
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH]: Fix thread debugging on Sparc/Linux
2006-04-02 7:12 [PATCH]: Fix thread debugging on Sparc/Linux David S. Miller
@ 2006-04-04 21:54 ` David S. Miller
2006-04-04 22:06 ` Daniel Jacobowitz
0 siblings, 1 reply; 12+ messages in thread
From: David S. Miller @ 2006-04-04 21:54 UTC (permalink / raw)
To: gdb-patches
From: "David S. Miller" <davem@davemloft.net>
Date: Sat, 01 Apr 2006 23:12:03 -0800 (PST)
> 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?
Since there were no objections, I've checked in the fix.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH]: Fix thread debugging on Sparc/Linux
2006-04-04 21:54 ` David S. Miller
@ 2006-04-04 22:06 ` Daniel Jacobowitz
2006-04-04 22:08 ` David S. Miller
0 siblings, 1 reply; 12+ messages in thread
From: Daniel Jacobowitz @ 2006-04-04 22:06 UTC (permalink / raw)
To: David S. Miller; +Cc: gdb-patches
On Tue, Apr 04, 2006 at 02:54:55PM -0700, David S. Miller wrote:
> From: "David S. Miller" <davem@davemloft.net>
> Date: Sat, 01 Apr 2006 23:12:03 -0800 (PST)
>
> > 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.
Yes, it looks like they will currently be used for core regsets on
SPARC. They shouldn't be; the Linux port could use an update to the
new regset mechanism, used by e.g. the BSDs. That could add
cross-debug support for core files also.
They are also used for thread debugging, but that's general
GDB-for-Linux lameness; that part of linux-thread-db.c needs to be
eliminated. It's on the todo list.
> > 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?
>
> Since there were no objections, I've checked in the fix.
Thanks. But, in the future, could you please wait for your patches to
be reviewed like everyone else (or ask to be the maintainer for this
port)?
You added includes to source files, so Makefile.in needs to be updated.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH]: Fix thread debugging on Sparc/Linux
2006-04-04 22:06 ` Daniel Jacobowitz
@ 2006-04-04 22:08 ` David S. Miller
2006-04-04 22:14 ` Daniel Jacobowitz
0 siblings, 1 reply; 12+ messages in thread
From: David S. Miller @ 2006-04-04 22:08 UTC (permalink / raw)
To: drow; +Cc: gdb-patches
From: Daniel Jacobowitz <drow@false.org>
Date: Tue, 4 Apr 2006 18:06:48 -0400
> > > 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?
> >
> > Since there were no objections, I've checked in the fix.
>
> Thanks. But, in the future, could you please wait for your patches to
> be reviewed like everyone else (or ask to be the maintainer for this
> port)?
There is no maintainer for this port, I'm pretty much the only
person who works on it actively. :)
> You added includes to source files, so Makefile.in needs to be updated.
I'll fix that up, thanks for mentioning.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH]: Fix thread debugging on Sparc/Linux
2006-04-04 22:08 ` David S. Miller
@ 2006-04-04 22:14 ` Daniel Jacobowitz
2006-04-04 22:22 ` David S. Miller
0 siblings, 1 reply; 12+ messages in thread
From: Daniel Jacobowitz @ 2006-04-04 22:14 UTC (permalink / raw)
To: David S. Miller; +Cc: gdb-patches
On Tue, Apr 04, 2006 at 03:08:59PM -0700, David S. Miller wrote:
> > Thanks. But, in the future, could you please wait for your patches to
> > be reviewed like everyone else (or ask to be the maintainer for this
> > port)?
>
> There is no maintainer for this port, I'm pretty much the only
> person who works on it actively. :)
I realize that, and I'm glad you do - Debian users still use it for
sure. I have a couple other SPARC-specific bugs I need to get back to.
But I just spent months of my life getting the GDB developers to agree
to a set of policies, and eventually succeeded. I'd really appreciate
it if you could follow them if you intend to contribute to GDB.
They're documented in gdb/MAINTAINERS and were announced on the GDB
lists.
> > You added includes to source files, so Makefile.in needs to be updated.
>
> I'll fix that up, thanks for mentioning.
Thanks.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH]: Fix thread debugging on Sparc/Linux
2006-04-04 22:14 ` Daniel Jacobowitz
@ 2006-04-04 22:22 ` David S. Miller
2006-04-04 22:43 ` Daniel Jacobowitz
0 siblings, 1 reply; 12+ messages in thread
From: David S. Miller @ 2006-04-04 22:22 UTC (permalink / raw)
To: drow; +Cc: gdb-patches
From: Daniel Jacobowitz <drow@false.org>
Date: Tue, 4 Apr 2006 18:14:48 -0400
> I'd really appreciate it if you could follow them if you intend to
> contribute to GDB.
Sure.
I'm just running through the entire testsuite right now on
sparc-*-linux* trying to fix every failure that shows up.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH]: Fix thread debugging on Sparc/Linux
2006-04-04 22:22 ` David S. Miller
@ 2006-04-04 22:43 ` Daniel Jacobowitz
2006-04-04 22:54 ` David S. Miller
0 siblings, 1 reply; 12+ messages in thread
From: Daniel Jacobowitz @ 2006-04-04 22:43 UTC (permalink / raw)
To: David S. Miller; +Cc: gdb-patches
On Tue, Apr 04, 2006 at 03:23:04PM -0700, David S. Miller wrote:
> I'm just running through the entire testsuite right now on
> sparc-*-linux* trying to fix every failure that shows up.
Great!
In that case, I can save you one bit of debugging: a lot of thread
tests are broken on SPARC, because linux_nat_thread_alive (or something
with a similar name) tries to use PTRACE_PEEKUSR to test whether a
thread is alive, but the SPARC ptrace interface doesn't implement that,
only PTRACE_GETREGS. I keep meaning to try changing that. Maybe to
something like reading memory, and allowing an actual memory access
error to be "yes, I'm alive" and ESRCH (is that the right error code?)
to mean "no, I'm gone".
This is in the Debian BTS, but I never fixed it. Bad me.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH]: Fix thread debugging on Sparc/Linux
2006-04-04 22:43 ` Daniel Jacobowitz
@ 2006-04-04 22:54 ` David S. Miller
2006-04-04 23:11 ` Daniel Jacobowitz
0 siblings, 1 reply; 12+ messages in thread
From: David S. Miller @ 2006-04-04 22:54 UTC (permalink / raw)
To: drow; +Cc: gdb-patches
From: Daniel Jacobowitz <drow@false.org>
Date: Tue, 4 Apr 2006 18:43:41 -0400
> In that case, I can save you one bit of debugging: a lot of thread
> tests are broken on SPARC, because linux_nat_thread_alive (or something
> with a similar name) tries to use PTRACE_PEEKUSR to test whether a
> thread is alive, but the SPARC ptrace interface doesn't implement that,
> only PTRACE_GETREGS.
I'm two shoelaces ahead of you.
I'm adding support for PTRACE_PEEKUSER with offset 0 in the kernel in
order to cure this. Linux/Sparc is the only platform that doesn't
support this and just returning a dummy zero value for this special
case is fine with me.
There are many more much deeper issues once you get past this, which
I plan to get to. I need reliable Linux thread debugging in gdb in
order to work on Mono.
The checkpoint/restart stuff is also non-functional on Linux/Sparc,
but I think that could be due to some bug in event message handling on
that platform.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH]: Fix thread debugging on Sparc/Linux
2006-04-04 22:54 ` David S. Miller
@ 2006-04-04 23:11 ` Daniel Jacobowitz
2006-04-04 23:12 ` David S. Miller
0 siblings, 1 reply; 12+ messages in thread
From: Daniel Jacobowitz @ 2006-04-04 23:11 UTC (permalink / raw)
To: David S. Miller; +Cc: gdb-patches
On Tue, Apr 04, 2006 at 03:54:56PM -0700, David S. Miller wrote:
> I'm adding support for PTRACE_PEEKUSER with offset 0 in the kernel in
> order to cure this. Linux/Sparc is the only platform that doesn't
> support this and just returning a dummy zero value for this special
> case is fine with me.
OK, that works too :-)
> The checkpoint/restart stuff is also non-functional on Linux/Sparc,
> but I think that could be due to some bug in event message handling on
> that platform.
Is gdb a 32-bit or 64-bit binary? I bet there's problems with a
32-bit binary. At least one is that the event message is
stored as a long.
Hmm, might want a compat_ptrace_request.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH]: Fix thread debugging on Sparc/Linux
2006-04-04 23:11 ` Daniel Jacobowitz
@ 2006-04-04 23:12 ` David S. Miller
2006-04-04 23:52 ` David S. Miller
0 siblings, 1 reply; 12+ messages in thread
From: David S. Miller @ 2006-04-04 23:12 UTC (permalink / raw)
To: drow; +Cc: gdb-patches
From: Daniel Jacobowitz <drow@false.org>
Date: Tue, 4 Apr 2006 19:11:02 -0400
> On Tue, Apr 04, 2006 at 03:54:56PM -0700, David S. Miller wrote:
> > The checkpoint/restart stuff is also non-functional on Linux/Sparc,
> > but I think that could be due to some bug in event message handling on
> > that platform.
>
> Is gdb a 32-bit or 64-bit binary? I bet there's problems with a
> 32-bit binary. At least one is that the event message is
> stored as a long.
Yep, that's exactly where I think the bug is, in the 32-bit
compat layer on sparc64.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH]: Fix thread debugging on Sparc/Linux
2006-04-04 23:12 ` David S. Miller
@ 2006-04-04 23:52 ` David S. Miller
2006-04-04 23:58 ` Michael Snyder
0 siblings, 1 reply; 12+ messages in thread
From: David S. Miller @ 2006-04-04 23:52 UTC (permalink / raw)
To: drow; +Cc: gdb-patches
From: "David S. Miller" <davem@davemloft.net>
Date: Tue, 04 Apr 2006 16:12:16 -0700 (PDT)
> From: Daniel Jacobowitz <drow@false.org>
> Date: Tue, 4 Apr 2006 19:11:02 -0400
>
> > On Tue, Apr 04, 2006 at 03:54:56PM -0700, David S. Miller wrote:
> > > The checkpoint/restart stuff is also non-functional on Linux/Sparc,
> > > but I think that could be due to some bug in event message handling on
> > > that platform.
> >
> > Is gdb a 32-bit or 64-bit binary? I bet there's problems with a
> > 32-bit binary. At least one is that the event message is
> > stored as a long.
>
> Yep, that's exactly where I think the bug is, in the 32-bit
> compat layer on sparc64.
I just confirmed that after fixing this in the kernel ptrace()
implementation, checkpointing works fine for 32-bit gdb running on
64-bit kernel for Linux/Sparc.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH]: Fix thread debugging on Sparc/Linux
2006-04-04 23:52 ` David S. Miller
@ 2006-04-04 23:58 ` Michael Snyder
0 siblings, 0 replies; 12+ messages in thread
From: Michael Snyder @ 2006-04-04 23:58 UTC (permalink / raw)
To: David S. Miller; +Cc: drow, gdb-patches
David S. Miller wrote:
> From: "David S. Miller" <davem@davemloft.net>
> Date: Tue, 04 Apr 2006 16:12:16 -0700 (PDT)
>
>
>>From: Daniel Jacobowitz <drow@false.org>
>>Date: Tue, 4 Apr 2006 19:11:02 -0400
>>
>>
>>>On Tue, Apr 04, 2006 at 03:54:56PM -0700, David S. Miller wrote:
>>>
>>>>The checkpoint/restart stuff is also non-functional on Linux/Sparc,
>>>>but I think that could be due to some bug in event message handling on
>>>>that platform.
>>>
>>>Is gdb a 32-bit or 64-bit binary? I bet there's problems with a
>>>32-bit binary. At least one is that the event message is
>>>stored as a long.
>>
>>Yep, that's exactly where I think the bug is, in the 32-bit
>>compat layer on sparc64.
>
>
> I just confirmed that after fixing this in the kernel ptrace()
> implementation, checkpointing works fine for 32-bit gdb running on
> 64-bit kernel for Linux/Sparc.
Cool!
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2006-04-04 23:58 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-02 7:12 [PATCH]: Fix thread debugging on Sparc/Linux David S. Miller
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox