From owner-svn-src-head@freebsd.org Mon Jun 12 21:16:38 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5E295C7885A; Mon, 12 Jun 2017 21:16:38 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2EE6D7FCA5; Mon, 12 Jun 2017 21:16:38 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5CLGbaP096573; Mon, 12 Jun 2017 21:16:37 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5CLGbPx096572; Mon, 12 Jun 2017 21:16:37 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201706122116.v5CLGbPx096572@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 12 Jun 2017 21:16:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r319876 - head/tools/test/ptrace X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jun 2017 21:16:38 -0000 Author: kib Date: Mon Jun 12 21:16:37 2017 New Revision: 319876 URL: https://svnweb.freebsd.org/changeset/base/319876 Log: Update scescx test to print syscall number and arguments. Sponsored by: The FreeBSD Foundation MFC after: 3 weeks Modified: head/tools/test/ptrace/scescx.c Modified: head/tools/test/ptrace/scescx.c ============================================================================== --- head/tools/test/ptrace/scescx.c Mon Jun 12 21:15:43 2017 (r319875) +++ head/tools/test/ptrace/scescx.c Mon Jun 12 21:16:37 2017 (r319876) @@ -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"); }