public inbox for linux-sh@vger.kernel.org
 help / color / mirror / Atom feed
* strace not working with latest git
@ 2008-09-10 15:52 Nylund, Martin
  2008-09-11  9:43 ` AW: " Nylund, Martin
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Nylund, Martin @ 2008-09-10 15:52 UTC (permalink / raw)
  To: linux-sh

Hello all,

I haven't bee able to get strace working on my sh7722 target:

$> uname -a
Linux 192.168.105.52 2.6.27-rc6-00008-g3ed6d13-dirty #184 Wed Sep 10
17:31:44 CEST 2008 sh4al-dsp unknown

$> strace ls
restart_syscall(<... resuming interrupted call ...>) = 0
.
. <repeating many times>
.
restart_syscall(<... resuming interrupted call ...>) = 0
restart_syscall(<... resuming interrupted call ...>) = 0
bin      etc      linuxrc  mplayer  sbin     tmp
restart_syscall(<... resuming interrupted call ...>) = 0
boot     include  man      opt      share    usr
restart_syscall(<... resuming interrupted call ...>) = 0
dev      lib      mnt      proc     sys      var
restart_syscall(<... resuming interrupted call ...>) = 0
~ #                            


I traced the problem a bit and in strace sources, the ptrace call
PTRACE_PEEKUSR always returns 0 when fetching the syscall number. I also
added a printk to PTRACE_PEEKUSR in arch/sh/kernel/ptrace_32.c and the
returned value is always 0. 

What might be wrong here?

Martin

^ permalink raw reply	[flat|nested] 6+ messages in thread

* AW: strace not working with latest git
  2008-09-10 15:52 strace not working with latest git Nylund, Martin
@ 2008-09-11  9:43 ` Nylund, Martin
  2008-09-11 14:00 ` Nylund, Martin
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Nylund, Martin @ 2008-09-11  9:43 UTC (permalink / raw)
  To: linux-sh

> Hello all,
> 
> I haven't bee able to get strace working on my sh7722 target:
> 
> $> uname -a
> Linux 192.168.105.52 2.6.27-rc6-00008-g3ed6d13-dirty #184 Wed 
> Sep 10 17:31:44 CEST 2008 sh4al-dsp unknown
> 
> $> strace ls
> restart_syscall(<... resuming interrupted call ...>) = 0
> .
> . <repeating many times>
> .
> restart_syscall(<... resuming interrupted call ...>) = 0 
> restart_syscall(<... resuming interrupted call ...>) = 0
> bin      etc      linuxrc  mplayer  sbin     tmp
> restart_syscall(<... resuming interrupted call ...>) = 0
> boot     include  man      opt      share    usr
> restart_syscall(<... resuming interrupted call ...>) = 0
> dev      lib      mnt      proc     sys      var
> restart_syscall(<... resuming interrupted call ...>) = 0
> ~ #                            
> 
> 
> I traced the problem a bit and in strace sources, the ptrace 
> call PTRACE_PEEKUSR always returns 0 when fetching the 
> syscall number. I also added a printk to PTRACE_PEEKUSR in 
> arch/sh/kernel/ptrace_32.c and the returned value is always 0. 
> 
> What might be wrong here?
> 
> Martin

I got strace now working with following hack. Still don't know why this
is needed though. get_stack_long() seemst to read data from wrong
offset...

diff --git a/arch/sh/kernel/ptrace_32.c b/arch/sh/kernel/ptrace_32.c
index 035cb30..7be388a 100644
--- a/arch/sh/kernel/ptrace_32.c
+++ b/arch/sh/kernel/ptrace_32.c
@@ -107,6 +107,7 @@ long arch_ptrace(struct task_struct *child, long
request, long addr, long data)
        struct user * dummy = NULL;
        int ret;

+       addr=(addr+0x34);
        switch (request) {
        /* read the word at location addr in the USER area. */
        case PTRACE_PEEKUSR: {
  

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* AW: strace not working with latest git
  2008-09-10 15:52 strace not working with latest git Nylund, Martin
  2008-09-11  9:43 ` AW: " Nylund, Martin
@ 2008-09-11 14:00 ` Nylund, Martin
  2008-09-12  9:35 ` Paul Mundt
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Nylund, Martin @ 2008-09-11 14:00 UTC (permalink / raw)
  To: linux-sh


> I haven't bee able to get strace working on my sh7722 target:
> 
> $> uname -a
> Linux 192.168.105.52 2.6.27-rc6-00008-g3ed6d13-dirty #184 Wed 
> Sep 10 17:31:44 CEST 2008 sh4al-dsp unknown
> 
> $> strace ls
> restart_syscall(<... resuming interrupted call ...>) = 0
> .
> . <repeating many times>
> .
> restart_syscall(<... resuming interrupted call ...>) = 0 
> restart_syscall(<... resuming interrupted call ...>) = 0
> bin      etc      linuxrc  mplayer  sbin     tmp
> restart_syscall(<... resuming interrupted call ...>) = 0
> boot     include  man      opt      share    usr
> restart_syscall(<... resuming interrupted call ...>) = 0
> dev      lib      mnt      proc     sys      var
> restart_syscall(<... resuming interrupted call ...>) = 0
> ~ #                            
> 
> 
> I traced the problem a bit and in strace sources, the ptrace 
> call PTRACE_PEEKUSR always returns 0 when fetching the 
> syscall number. I also added a printk to PTRACE_PEEKUSR in 
> arch/sh/kernel/ptrace_32.c and the returned value is always 0. 
> 

I got strace now working with following hack. Still don't know why this
is needed though. get_stack_long() seemst to read data from wrong
offset...

diff --git a/arch/sh/kernel/ptrace_32.c b/arch/sh/kernel/ptrace_32.c
index 035cb30..950b7e2 100644
--- a/arch/sh/kernel/ptrace_32.c
+++ b/arch/sh/kernel/ptrace_32.c
@@ -107,6 +107,9 @@ long arch_ptrace(struct task_struct *child, long
request, long addr, long data)
        struct user * dummy = NULL;
        int ret;

+       if(addr<0xff)
+           addr=(addr+0x34);
+
        switch (request) {
        /* read the word at location addr in the USER area. */
        case PTRACE_PEEKUSR: {


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: strace not working with latest git
  2008-09-10 15:52 strace not working with latest git Nylund, Martin
  2008-09-11  9:43 ` AW: " Nylund, Martin
  2008-09-11 14:00 ` Nylund, Martin
@ 2008-09-12  9:35 ` Paul Mundt
  2008-09-12  9:54 ` AW: " Nylund, Martin
  2008-09-12 10:39 ` Paul Mundt
  4 siblings, 0 replies; 6+ messages in thread
From: Paul Mundt @ 2008-09-12  9:35 UTC (permalink / raw)
  To: linux-sh

On Thu, Sep 11, 2008 at 04:00:16PM +0200, Nylund, Martin wrote:
> 
> > I haven't bee able to get strace working on my sh7722 target:
> > 
> > $> uname -a
> > Linux 192.168.105.52 2.6.27-rc6-00008-g3ed6d13-dirty #184 Wed 
> > Sep 10 17:31:44 CEST 2008 sh4al-dsp unknown
> > 
> > $> strace ls
> > restart_syscall(<... resuming interrupted call ...>) = 0
> > .
> > . <repeating many times>
> > .
> > restart_syscall(<... resuming interrupted call ...>) = 0 
> > restart_syscall(<... resuming interrupted call ...>) = 0
> > bin      etc      linuxrc  mplayer  sbin     tmp
> > restart_syscall(<... resuming interrupted call ...>) = 0
> > boot     include  man      opt      share    usr
> > restart_syscall(<... resuming interrupted call ...>) = 0
> > dev      lib      mnt      proc     sys      var
> > restart_syscall(<... resuming interrupted call ...>) = 0
> > ~ #                            
> > 
> > 
> > I traced the problem a bit and in strace sources, the ptrace 
> > call PTRACE_PEEKUSR always returns 0 when fetching the 
> > syscall number. I also added a printk to PTRACE_PEEKUSR in 
> > arch/sh/kernel/ptrace_32.c and the returned value is always 0. 
> > 
> 
> I got strace now working with following hack. Still don't know why this
> is needed though. get_stack_long() seemst to read data from wrong
> offset...
> 
> diff --git a/arch/sh/kernel/ptrace_32.c b/arch/sh/kernel/ptrace_32.c
> index 035cb30..950b7e2 100644
> --- a/arch/sh/kernel/ptrace_32.c
> +++ b/arch/sh/kernel/ptrace_32.c
> @@ -107,6 +107,9 @@ long arch_ptrace(struct task_struct *child, long
> request, long addr, long data)
>         struct user * dummy = NULL;
>         int ret;
> 
> +       if(addr<0xff)
> +           addr=(addr+0x34);
> +
>         switch (request) {
>         /* read the word at location addr in the USER area. */
>         case PTRACE_PEEKUSR: {
> 
This looks very much like the sizeof struct pt_dspregs. What is your
CONFIG_SH_DSP setting? Have you tried changing it and comparing?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* AW: strace not working with latest git
  2008-09-10 15:52 strace not working with latest git Nylund, Martin
                   ` (2 preceding siblings ...)
  2008-09-12  9:35 ` Paul Mundt
@ 2008-09-12  9:54 ` Nylund, Martin
  2008-09-12 10:39 ` Paul Mundt
  4 siblings, 0 replies; 6+ messages in thread
From: Nylund, Martin @ 2008-09-12  9:54 UTC (permalink / raw)
  To: linux-sh

> On Thu, Sep 11, 2008 at 04:00:16PM +0200, Nylund, Martin wrote:
> > 
> > > I haven't bee able to get strace working on my sh7722 target:
> > > 
> > > $> uname -a
> > > Linux 192.168.105.52 2.6.27-rc6-00008-g3ed6d13-dirty #184 Wed
> > > Sep 10 17:31:44 CEST 2008 sh4al-dsp unknown
> > > 
> > > $> strace ls
> > > restart_syscall(<... resuming interrupted call ...>) = 0
> > > .
> > > . <repeating many times>
> > > .
> > > restart_syscall(<... resuming interrupted call ...>) = 0
> > > restart_syscall(<... resuming interrupted call ...>) = 0
> > > bin      etc      linuxrc  mplayer  sbin     tmp
> > > restart_syscall(<... resuming interrupted call ...>) = 0
> > > boot     include  man      opt      share    usr
> > > restart_syscall(<... resuming interrupted call ...>) = 0
> > > dev      lib      mnt      proc     sys      var
> > > restart_syscall(<... resuming interrupted call ...>) = 0
> > > ~ #                            
> > > 
> > > 
> > > I traced the problem a bit and in strace sources, the ptrace
> > > call PTRACE_PEEKUSR always returns 0 when fetching the 
> > > syscall number. I also added a printk to PTRACE_PEEKUSR in 
> > > arch/sh/kernel/ptrace_32.c and the returned value is always 0. 
> > > 
> > 
> > I got strace now working with following hack. Still don't know why 
> > this is needed though. get_stack_long() seemst to read data 
> from wrong 
> > offset...
> > 
> > diff --git a/arch/sh/kernel/ptrace_32.c 
> b/arch/sh/kernel/ptrace_32.c 
> > index 035cb30..950b7e2 100644
> > --- a/arch/sh/kernel/ptrace_32.c
> > +++ b/arch/sh/kernel/ptrace_32.c
> > @@ -107,6 +107,9 @@ long arch_ptrace(struct task_struct 
> *child, long 
> > request, long addr, long data)
> >         struct user * dummy = NULL;
> >         int ret;
> > 
> > +       if(addr<0xff)
> > +           addr=(addr+0x34);
> > +
> >         switch (request) {
> >         /* read the word at location addr in the USER area. */
> >         case PTRACE_PEEKUSR: {
> > 
> This looks very much like the sizeof struct pt_dspregs. What 
> is your CONFIG_SH_DSP setting? Have you tried changing it and 
> comparing?

Yes I had CONFIG_SH_DSP set. I now switched it off and strace works
without the above offset hack.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: strace not working with latest git
  2008-09-10 15:52 strace not working with latest git Nylund, Martin
                   ` (3 preceding siblings ...)
  2008-09-12  9:54 ` AW: " Nylund, Martin
@ 2008-09-12 10:39 ` Paul Mundt
  4 siblings, 0 replies; 6+ messages in thread
From: Paul Mundt @ 2008-09-12 10:39 UTC (permalink / raw)
  To: linux-sh

On Fri, Sep 12, 2008 at 11:54:48AM +0200, Nylund, Martin wrote:
> > On Thu, Sep 11, 2008 at 04:00:16PM +0200, Nylund, Martin wrote:
> > > diff --git a/arch/sh/kernel/ptrace_32.c 
> > b/arch/sh/kernel/ptrace_32.c 
> > > index 035cb30..950b7e2 100644
> > > --- a/arch/sh/kernel/ptrace_32.c
> > > +++ b/arch/sh/kernel/ptrace_32.c
> > > @@ -107,6 +107,9 @@ long arch_ptrace(struct task_struct 
> > *child, long 
> > > request, long addr, long data)
> > >         struct user * dummy = NULL;
> > >         int ret;
> > > 
> > > +       if(addr<0xff)
> > > +           addr=(addr+0x34);
> > > +
> > >         switch (request) {
> > >         /* read the word at location addr in the USER area. */
> > >         case PTRACE_PEEKUSR: {
> > > 
> > This looks very much like the sizeof struct pt_dspregs. What 
> > is your CONFIG_SH_DSP setting? Have you tried changing it and 
> > comparing?
> 
> Yes I had CONFIG_SH_DSP set. I now switched it off and strace works
> without the above offset hack.

That's interesting. It looks like CONFIG_SH_DSP needs some more attention
for SH4AL-DSP anyways. I'm currently rewriting the ptrace bits for
tracehook/regset conversion anyways, so we should get this fixed properly
there.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-09-12 10:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-10 15:52 strace not working with latest git Nylund, Martin
2008-09-11  9:43 ` AW: " Nylund, Martin
2008-09-11 14:00 ` Nylund, Martin
2008-09-12  9:35 ` Paul Mundt
2008-09-12  9:54 ` AW: " Nylund, Martin
2008-09-12 10:39 ` Paul Mundt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox