strace CVS access
Michal Ludvig
michal at logix.cz
Tue Oct 8 01:20:02 UTC 2002
On Fri, 4 Oct 2002, Heiko Carstens wrote:
> Ok, I attached the patch. Thanks for your offer!
Committed. Next time please provide a brief ChangeLog as well (at least
for bugfixes).
> We also have something here to make it possible to trace 32 bit programs
> with a 64 bit strace. I think you did the same with your new checkin.
> But actually it doesn't look to me as if you do pointer conversion from
> 32 bit to 64 bit. So I'm wondering how your approach can work with all
> system calls?!
Because 64b process doesn't care whether the traced program
is 64b or 32b. There is of course a different ABI/API used, but
on the low level there is no difference. I don't know what's the
difference between 32b and 64b mode on S390, but on AMD
x86-64 the 64b mode is only an extension of a 32b mode. So if
I know (32b ABI) that a syscall number is in a reg EAX (32b reg)
on i386, so I'll do a ptrace to fetch reg RAX (64b extension of EAX)
and it will be there. Regarding to a particular syscall I could realise
that first argument to this syscall is a pointer and i386 ABI says,
that first arg is in EBX - so I'll fetch RBX and find a valid address
there. To fetch for example the string on that address i'll simply
do PTRACE_PEEKDATA on that address and will get what expected. No
conversion is needed - all addresses I get via ptrace are perfectly
valid and I can use them in subsequent ptraces again.
So from 64b strace's point of view both modes are equivalent;
the only differ in an ABI and address space layout. So it's
easy to support both modes.
Michal Ludvig
More information about the Strace-devel
mailing list