Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Jul 2017 18:14:07 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r321346 - stable/11/tools/test/ptrace
Message-ID:  <201707211814.v6LIE7ut054742@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Fri Jul 21 18:14:06 2017
New Revision: 321346
URL: https://svnweb.freebsd.org/changeset/base/321346

Log:
  MFC r319876:
  Update scescx test to print syscall number and arguments.

Modified:
  stable/11/tools/test/ptrace/scescx.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/tools/test/ptrace/scescx.c
==============================================================================
--- stable/11/tools/test/ptrace/scescx.c	Fri Jul 21 18:12:35 2017	(r321345)
+++ stable/11/tools/test/ptrace/scescx.c	Fri Jul 21 18:14:06 2017	(r321346)
@@ -181,12 +181,33 @@ get_pathname(pid_t pid)
 static void
 wait_info(int pid, int status, struct ptrace_lwpinfo *lwpinfo)
 {
+	long *args;
+	int error, i;
 
 	printf(TRACE "pid %d wait %s", pid,
 	    decode_wait_status(status));
 	if (lwpinfo != NULL) {
 		printf(" event %s flags %s",
 		    decode_pl_event(lwpinfo), decode_pl_flags(lwpinfo));
+		if ((lwpinfo->pl_flags & (PL_FLAG_SCE | PL_FLAG_SCX)) != 0) {
+			printf(" sc%d", lwpinfo->pl_syscall_code);
+			args = calloc(lwpinfo->pl_syscall_narg, sizeof(long));
+			error = ptrace(PT_GET_SC_ARGS, lwpinfo->pl_lwpid,
+			    (caddr_t)args, lwpinfo->pl_syscall_narg *
+			    sizeof(long));
+			if (error == 0) {
+				for (i = 0; i < (int)lwpinfo->pl_syscall_narg;
+				    i++) {
+					printf("%c%#lx", i == 0 ? '(' : ',',
+					    args[i]);
+				}
+			} else {
+				fprintf(stderr, "PT_GET_SC_ARGS failed: %s",
+				    strerror(errno));
+			}
+			printf(")");
+			free(args);
+		}
 	}
 	printf("\n");
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201707211814.v6LIE7ut054742>