aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2020-06-01 20:58:18 +0200
committerMattias Andrée <maandree@kth.se>2020-06-01 20:58:18 +0200
commitb03959e8c78b9303eff117e7350cece73c9c34dd (patch)
tree9ad3c6b6cc44d9591b3ae2d169aa1029ef2636b3
parentMakefile: install and uninstall man page (diff)
downloadsctrace-b03959e8c78b9303eff117e7350cece73c9c34dd.tar.gz
sctrace-b03959e8c78b9303eff117e7350cece73c9c34dd.tar.bz2
sctrace-b03959e8c78b9303eff117e7350cece73c9c34dd.tar.xz
Minor output improvements
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r--print.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/print.c b/print.c
index 3ed0a5a..8c572a8 100644
--- a/print.c
+++ b/print.c
@@ -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':