PATCH: Add ia32 support to x32 strace

H.J. Lu hjl.tools at gmail.com
Wed Apr 18 00:39:28 UTC 2012


On Tue, Apr 17, 2012 at 5:13 PM, Dmitry V. Levin <ldv at altlinux.org> wrote:
> On Tue, Apr 17, 2012 at 05:03:20PM -0700, H.J. Lu wrote:
>> On Tue, Apr 17, 2012 at 4:58 PM, Dmitry V. Levin <ldv at altlinux.org> wrote:
>> > On Tue, Apr 17, 2012 at 11:05:04AM -0700, H.J. Lu wrote:
>> >> Hi,
>> >>
>> >> This patch adds ia32 support to x32 strace.  Tested on Linux/x32.
>> > [...]
>> >> @@ -868,15 +874,14 @@ get_scno(struct tcb *tcp)
>> >>       }
>> >>  # endif
>> >>  # ifdef X32
>> >> -     if (currpers == 0 || currpers == 1) {
>> >> -             fprintf(stderr, "syscall_%lu (...) in unsupported %s "
>> >> -                     "mode of process PID=%d\n", scno,
>> >> -                     currpers == 0 ? "64-bit" : "32-bit", tcp->pid);
>> >> +     if (currpers == 0) {
>> >> +             fprintf(stderr, "syscall_%lu (...) in unsupported 64-bit "
>> >> +                     "mode of process PID=%d\n", scno, tcp->pid);
>> >>               return 0;
>> >>       }
>> >> -# else
>> >> -     update_personality(tcp, currpers);
>> >> +     else if (currpers == 1)
>> >>  # endif
>> >> +     update_personality(tcp, currpers);
>> >>  #elif defined(IA64)
>> >>  #    define IA64_PSR_IS      ((long)1 << 34)
>> >>       if (upeek(tcp, PT_CR_IPSR, &psr) >= 0)
>> >
>> > This part of the change seems to be wrong: if strace supports two personalities
>> > on X32, it should be able to switch to any of them, not just to
>> > currpers == 1.  Looks like additional currpers translation is needed for
>> > the X32 case.
>>
>> currpers is set the same value for both x32 and x86-64 strace,
>>
>> 0: x86-64
>> 1: ia32
>> 2. x32
>>
>> For x32 strace, when currpers == 1, we call update_personality to update
>> personality.  When currpers == 2, we do nothing since the current
>> personality is x32.
>
> We have to handle the case when currpers == 2 and current_personality == 1.
> Supposing that currpers == 2 on X32 translates to current_personality == 0,
> we have to call update_personality(tcp, 0) in that case.
>

Here is the updated patch to set currpers == 0 for x32.

Thanks.

-- 
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: strace-ia32-2.patch
Type: application/octet-stream
Size: 9515 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20120417/7e2da406/attachment.obj>


More information about the Strace-devel mailing list