[PATCH] tests/ipc_sem: don't match address of sem buffer

Dmitry V. Levin ldv at altlinux.org
Wed Mar 11 16:17:47 UTC 2015


On Wed, Mar 11, 2015 at 01:07:15PM +0100, Andreas Schwab wrote:
> On architectures where the semctl call is implemented by the ipc syscall
> the glibc wrapper passes a pointer to a local variable, so the value of
> the fourth argument is unknown.

Wouldn't it be better to fix the parser, e.g.

--- a/ipc.c
+++ b/ipc.c
@@ -281,7 +281,16 @@ int sys_semctl(struct tcb *tcp)
 	if (entering(tcp)) {
 		tprintf("%lu, %lu, ", tcp->u_arg[0], tcp->u_arg[1]);
 		PRINTCTL(semctl_flags, tcp->u_arg[2], "SEM_???");
-		tprintf(", %#lx", tcp->u_arg[3]);
+		tprints(", ");
+		if (indirect_ipccall(tcp)) {
+			if (current_wordsize == sizeof(int)) {
+				printnum_int(tcp, tcp->u_arg[3], "%#x");
+			} else {
+				printnum_long(tcp, tcp->u_arg[3], "%#lx");
+			}
+		} else {
+			tprintf("%#lx", tcp->u_arg[3]);
+		}
 	}
 	return 0;
 }


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20150311/9079fc8e/attachment.bin>


More information about the Strace-devel mailing list