From be99497d39a0ccc59cde4d21bbd307767ab3860c Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 13 Feb 2013 16:10:10 +0100 Subject: [PATCH] Decode struct iov in PTRACE_GET/SETREGSET * process.c (sys_ptrace): Decode struct iov in PTRACE_GET/SETREGSET. Signed-off-by: Denys Vlasenko --- process.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/process.c b/process.c index 4cec1124..e4d491a2 100644 --- a/process.c +++ b/process.c @@ -2260,9 +2260,11 @@ sys_ptrace(struct tcb *tcp) if (entering(tcp)) { printxval(ptrace_cmds, tcp->u_arg[0], "PTRACE_???"); tprintf(", %lu, ", tcp->u_arg[1]); + addr = tcp->u_arg[2]; if (tcp->u_arg[0] == PTRACE_PEEKUSER - || tcp->u_arg[0] == PTRACE_POKEUSER) { + || tcp->u_arg[0] == PTRACE_POKEUSER + ) { for (x = struct_user_offsets; x->str; x++) { if (x->val >= addr) break; @@ -2275,9 +2277,15 @@ sys_ptrace(struct tcb *tcp) } else tprintf("%s, ", x->str); - } - else - tprintf("%#lx, ", tcp->u_arg[2]); + } else +#ifdef PTRACE_GETREGSET + //if (tcp->u_arg[0] == PTRACE_GET/SETREGSET) { + // TODO: show tcp->u_arg[2] as "NT_xxx, " + //} else +#endif + tprintf("%#lx, ", addr); + + switch (tcp->u_arg[0]) { #ifndef IA64 case PTRACE_PEEKDATA: @@ -2314,6 +2322,13 @@ sys_ptrace(struct tcb *tcp) case PTRACE_GETSIGINFO: /* Don't print anything, do it at syscall return. */ break; +#endif +#ifdef PTRACE_GETREGSET + case PTRACE_GETREGSET: + break; + case PTRACE_SETREGSET: + tprint_iov(tcp, /*len:*/ 1, tcp->u_arg[3], /*as string:*/ 0); + break; #endif default: tprintf("%#lx", tcp->u_arg[3]); @@ -2343,6 +2358,11 @@ sys_ptrace(struct tcb *tcp) printsiginfo(&si, verbose(tcp)); break; } +#endif +#ifdef PTRACE_GETREGSET + case PTRACE_GETREGSET: + tprint_iov(tcp, /*len:*/ 1, tcp->u_arg[3], /*as string:*/ 0); + break; #endif } } -- 2.50.1