On 01/11, CAI Qian wrote:
>
> Looks like the following patch from Oleg has not been checked in
> ptrace testsuite yet.
> ...
> > --- step-jump-cont.c~       2009-12-09 12:17:04.367733643 -0500
> > +++ step-jump-cont.c        2009-12-09 13:12:50.708535770 -0500
> > @@ -153,12 +153,19 @@ raise_sigusr2 (void)
> >    assert (0);
> >  }
> >
> > +typedef struct {
> > +        unsigned long entry;
> > +        unsigned long toc;
> > +        unsigned long env;
> > +} func_descr_t;
> > +
> >  int main (void)
> >  {
> >    long l;
> >    int status;
> >    pid_t pid;
> >    REGS_TYPE (regs);
> > +  func_descr_t *fp;
> >
> >    setbuf (stdout, NULL);
> >    atexit (cleanup);
> > @@ -214,7 +221,12 @@ int main (void)
> >  #elif defined __x86_64__
> >    REGS_ACCESS (regs, rip) = (unsigned long) raise_sigusr2;
> >  #elif defined __powerpc__
> > -  REGS_ACCESS (regs, nip) = (unsigned long) raise_sigusr2;
> > +
> > +  fp = (void*)raise_sigusr2;
> > +
> > +  REGS_ACCESS(regs, nip)    = fp->entry;
> > +  REGS_ACCESS(regs, gpr[2]) = fp->toc;
> > +

My patch was a quick and dirty hack, afaics Jan has commited the right
change, step-jump-cont.c does:

        #elif defined __powerpc64__
          {
            /* ppc64 `raise_sigusr2' resolves to the function descriptor.  */
            union
              {
                void (*f) (void);
                struct
                  {
                    void *entry;
                    void *toc;
                  }
                *p;
              }
            const func_u = { raise_sigusr2 };

            REGS_ACCESS (regs, nip) = (unsigned long) func_u.p->entry;
            REGS_ACCESS (regs, gpr[2]) = (unsigned long) func_u.p->toc;
          }
        #elif defined __powerpc__

Oleg.

Reply via email to