[PATCH] Use PTRACE_GETREGS on i386

Dmitry V. Levin ldv at altlinux.org
Fri Aug 26 22:56:47 UTC 2011


On Fri, Aug 26, 2011 at 03:56:15PM -0400, Mike Frysinger wrote:
> On Friday, August 26, 2011 13:32:17 Denys Vlasenko wrote:
> > 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:
> > > > +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.
> 
> i think this is a structure problem with the strace code base in general.  
> it'd be nice if we had all the arch-cruft in an arch-specific subdir instead 
> of sprinkling ifdefs everywhere.  changing the variable names is a very poor-
> man's solution.

I definitely agree.  Tidying this mess up would be a herculean task, though:

$ git grep -c I386 -- *.h linux/*.h *.c
defs.h:3
linux/dummy.h:1
linux/syscall.h:1
mem.c:1
process.c:9
signal.c:5
syscall.c:10
util.c:1

$ git grep -c X86_64 -- *.h linux/*.h *.c
defs.h:6
file.c:4
ipc.c:1
linux/syscall.h:1
mem.c:1
process.c:7
resource.c:3
signal.c:3
syscall.c:10
util.c:3


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20110827/b78d4f16/attachment.bin>


More information about the Strace-devel mailing list