diff options
author | Mattias Andrée <maandree@kth.se> | 2020-06-01 20:58:18 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2020-06-01 20:58:18 +0200 |
commit | b03959e8c78b9303eff117e7350cece73c9c34dd (patch) | |
tree | 9ad3c6b6cc44d9591b3ae2d169aa1029ef2636b3 | |
parent | Makefile: install and uninstall man page (diff) | |
download | sctrace-b03959e8c78b9303eff117e7350cece73c9c34dd.tar.gz sctrace-b03959e8c78b9303eff117e7350cece73c9c34dd.tar.bz2 sctrace-b03959e8c78b9303eff117e7350cece73c9c34dd.tar.xz |
Minor output improvements
Signed-off-by: Mattias Andrée <maandree@kth.se>
-rw-r--r-- | print.c | 23 |
1 files changed, 16 insertions, 7 deletions
@@ -473,9 +473,12 @@ printf_systemcall(struct process *proc, const char *scall, const char *fmt, ...) if (*fmt == 'p') { p_fmt: - if (input && get_struct_or_null(proc->pid, arg, &arg, sizeof(void *), &err)) { - tprintf(proc, "%s", err); - goto next; + if (input) { + if (get_struct_or_null(proc->pid, arg, &arg, sizeof(void *), &err)) { + tprintf(proc, "%s", err); + goto next; + } + tprintf(proc, "&"); } if (arg) tprintf(proc, "%p", (void *)arg); @@ -495,9 +498,12 @@ printf_systemcall(struct process *proc, const char *scall, const char *fmt, ...) tprintf(proc, "%s", str ? str : err); free(str); } else if (*fmt == 'F') { - if (input && get_struct_or_null(proc->pid, arg, &arg, sizeof(int), &err)) { - tprintf(proc, "%s", err); - goto next; + if (input) { + if (get_struct_or_null(proc->pid, arg, &arg, sizeof(int), &err)) { + tprintf(proc, "%s", err); + goto next; + } + tprintf(proc, "&"); } if ((int)arg == AT_FDCWD) tprintf(proc, "AT_FDCWD"); @@ -519,6 +525,7 @@ printf_systemcall(struct process *proc, const char *scall, const char *fmt, ...) tprintf(proc, "%s", err); goto next; } + tprintf(proc, "&"); } value = arg; if (size < sizeof(long long int)) @@ -979,8 +986,10 @@ print_systemcall_exit(struct process *proc) case 'p': if (get_struct_or_null(proc->pid, proc->args[i], buf, sizeof(void *), &err)) tprintf(proc, "%s\n", err); - else + else if (*(void **)buf) tprintf(proc, "%p\n", *(void **)buf); + else + tprintf(proc, "NULL\n"); break; case 'm': |