From b03959e8c78b9303eff117e7350cece73c9c34dd Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Mon, 1 Jun 2020 20:58:18 +0200 Subject: Minor output improvements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- print.c | 23 ++++++++++++++++------- 1 file 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': -- cgit v1.2.3-70-g09d2