[PATCH] Use PTRACE_GETREGS on i386

Denys Vlasenko dvlasenk at redhat.com
Fri Aug 26 17:32:17 UTC 2011


On Fri, 2011-08-26 at 20:36 +0400, Dmitry V. Levin wrote:
> On Thu, Aug 25, 2011 at 12:10:06PM +0200, Denys Vlasenko wrote:
> >  #ifdef LINUX
> >  # if defined (I386)
> > -static long eax;
> > +struct i386_user_regs_struct {
> > +	long ebx;
> > +	long ecx;
> > +	long edx;
> > +	long esi;
> > +	long edi;
> > +	long ebp;
> > +	long eax;
> > +	long xds;
> > +	long xes;
> > +	long xfs;
> > +	long xgs;
> > +	long orig_eax;
> > +	long eip;
> > +	long xcs;
> > +	long eflags;
> > +	long esp;
> > +	long xss;
> > +	/* Just in case we forgot a few fields and kernel would write more... */
> > +	long paranoia[8];
> > +};
> > +static struct i386_user_regs_struct i386_regs;
> 
> strace is not going to call PTRACE_GETREGS with different regs structures,
> so is there any use to include the architecture name to the structure
> name?

There *is* a reason to name it i386_regs: it makes it possible
to easily find its uses.

For example,  Alpha, Blackfin and SH all have "static long r0". How can
I quickly find only Alpha's usages of r0? There is no easy way to do it.
I'd rather have them named alpha_r0, bfin_r0, sh_r0.

Same problem with variables named r10, a3 - several arches have them.
"struct <something> regs" is used by FOUR architectures.

Variable pc is unique to S390, but it has such a short name that grep
finds a lot of stray matches. Again, s390_pc would be much nicer.

-- 
vda






More information about the Strace-devel mailing list