On Tue, Apr 17, 2012 at 05:39:28PM -0700, H.J. Lu wrote: > On Tue, Apr 17, 2012 at 5:13 PM, Dmitry V. Levin <[email protected]> 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 <[email protected]> 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.
Converted those two "if" statements to a "switch" and applied. Thanks. -- ldv
pgpYq1OXdAWir.pgp
Description: PGP signature
------------------------------------------------------------------------------ Better than sec? Nothing is better than sec when it comes to monitoring Big Data applications. Try Boundary one-second resolution app monitoring today. Free. http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________ Strace-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/strace-devel
