> It's certainly possible that we broke something along the way. Do you
> have anything more specific about which ptrace call is failing or
> misbehaving, and in what way?
Some times the ptrace'd process seems to get whacked with SIGSEGV
around the time it is being ptrace-POKE_USR'd.
But there's something else I don't understand. On x86 and amd64,
the child's registers are set by filling in a "struct vki_user_regs_struct
regs" and doing ptrace(SETREGS) on it. On ppc32/64, there are a whole
sequence of PTRACE_POKEUSRs, one for each register. I don't know
why it is done differently. Is it you that wrote this code originally
(in your 2.2.0/2.4.0-ppc variants)?
I changed the code to use SETREGS, as shown below, and now that ptrace fails
thusly:
ptrace(PTRACE_SETREGS, 32331, 0, 0x46c1a2c) = -1 EFAULT (Bad address)
I checked for an obvious snafu, that "struct vki_user_regs_struct"
(defined in Valgrind's include/vki/vki-ppc32-linux.h) is identical to
"struct pt_regs" (in linux-2.6.23/include/asm-powerpc/ptrace.h) and
it does seem identical.
So, I dunno. The code below seems reasonable. Why would the kernel
EFAULT it? Do some of the not-filled-in fields (which are memset-0'd)
need to be filled in? I think these are: msr mq trap dar dsisr result.
J
#elif defined(VGP_ppc32_linux)
Int rc;
struct vki_user_regs_struct regs;
VG_(memset)(®s, 0, sizeof(regs));
regs.gpr[0 ] = vex->guest_GPR0;
regs.gpr[1 ] = vex->guest_GPR1;
regs.gpr[2 ] = vex->guest_GPR2;
regs.gpr[3 ] = vex->guest_GPR3;
regs.orig_gpr3 = vex->guest_GPR3;
regs.gpr[4 ] = vex->guest_GPR4;
regs.gpr[5 ] = vex->guest_GPR5;
regs.gpr[6 ] = vex->guest_GPR6;
regs.gpr[7 ] = vex->guest_GPR7;
regs.gpr[8 ] = vex->guest_GPR8;
regs.gpr[9 ] = vex->guest_GPR9;
regs.gpr[10] = vex->guest_GPR10;
regs.gpr[11] = vex->guest_GPR11;
regs.gpr[12] = vex->guest_GPR12;
regs.gpr[13] = vex->guest_GPR13;
regs.gpr[14] = vex->guest_GPR14;
regs.gpr[15] = vex->guest_GPR15;
regs.gpr[16] = vex->guest_GPR16;
regs.gpr[17] = vex->guest_GPR17;
regs.gpr[18] = vex->guest_GPR18;
regs.gpr[19] = vex->guest_GPR19;
regs.gpr[20] = vex->guest_GPR20;
regs.gpr[21] = vex->guest_GPR21;
regs.gpr[22] = vex->guest_GPR22;
regs.gpr[23] = vex->guest_GPR23;
regs.gpr[24] = vex->guest_GPR24;
regs.gpr[25] = vex->guest_GPR25;
regs.gpr[26] = vex->guest_GPR26;
regs.gpr[27] = vex->guest_GPR27;
regs.gpr[28] = vex->guest_GPR28;
regs.gpr[29] = vex->guest_GPR29;
regs.gpr[30] = vex->guest_GPR30;
regs.gpr[31] = vex->guest_GPR31;
regs.nip = vex->guest_CIA;
regs.ccr = LibVEX_GuestPPC32_get_CR(vex);
regs.link = vex->guest_LR;
regs.ctr = vex->guest_CTR;
regs.xer = LibVEX_GuestPPC32_get_XER(vex);
rc = VG_(ptrace)(13 /*VKI_PTRACE_SETREGS*/, pid, NULL, ®s);
VG_(printf)("SETREGS got %d\n", rc);
return rc;
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Valgrind-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-developers