diff options
| author | Konstantin Belousov <kib@FreeBSD.org> | 2017-06-12 21:16:37 +0000 |
|---|---|---|
| committer | Konstantin Belousov <kib@FreeBSD.org> | 2017-06-12 21:16:37 +0000 |
| commit | 965ee74955c3f27a4595c98c3f05c48b204b5c0a (patch) | |
| tree | cc6fab9576ca84a332c6d8592abbdfb038ffc998 | |
| parent | b43ce76c770f4c3728b6918f7d4cf175296753ff (diff) | |
Notes
| -rw-r--r-- | tools/test/ptrace/scescx.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tools/test/ptrace/scescx.c b/tools/test/ptrace/scescx.c index 17a60fd686034..782a43d69bf47 100644 --- a/tools/test/ptrace/scescx.c +++ b/tools/test/ptrace/scescx.c @@ -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"); } |
