aboutsummaryrefslogtreecommitdiff
path: root/linux-user/syscall.c
diff options
context:
space:
mode:
authorFilip Bozuta <Filip.Bozuta@syrmia.com>2020-06-19 14:33:26 +0200
committerLaurent Vivier <laurent@vivier.eu>2020-06-29 13:08:48 +0200
commitc84be71f685436fd7216a159528421c3d7af8d05 (patch)
tree9793f686d74f24853b626be49529b42826979d99 /linux-user/syscall.c
parente865b97ff4d924a81c28b9d9f3d6fe3e198bcdb9 (diff)
linux-user: Extend strace support to enable argument printing after syscall execution
Structure "struct syscallname" in file "strace.c" is used for "-strace" to print arguments and return values of syscalls. The last field of this structure "result" represents the calling function that prints the return values. This field was extended in this patch so that this function takes all syscalls arguments beside the return value. In this way, it enables "-strace" to print arguments of syscalls that have changed after the syscall execution. This extension will be useful as there are many syscalls that return values inside their arguments (i.e. listxattr() that returns the list of extended attributes inside the "list" argument). Implementation notes: Since there are already three existing "print_syscall_ret*" functions inside "strace.c" ("print_syscall_ret_addr()", "print_syscall_ret_adjtimex()", "print_syscall_ret_newselect()"), they were changed to have all syscall arguments beside the return value. This was done so that these functions don't cause build errors (even though syscall arguments are not used in these functions). There is code repetition in these functions for checking the return value and printing the approppriate error message (this code is also located in print_syscall_ret() at the end of "strace.c"). That is the reason why a function "syscall_print_err()" was added for this code and put inside these functions. Functions "print_newselect()" and "print_syscall_ret_newselect()" were changed to use this new implemented functionality and not store the syscall argument values in separate static variables. Signed-off-by: Filip Bozuta <Filip.Bozuta@syrmia.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20200619123331.17387-2-filip.bozuta@syrmia.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Diffstat (limited to 'linux-user/syscall.c')
-rw-r--r--linux-user/syscall.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 17ed7f8d6b..1b971c06b2 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -12565,7 +12565,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
arg5, arg6, arg7, arg8);
if (unlikely(qemu_loglevel_mask(LOG_STRACE))) {
- print_syscall_ret(num, ret);
+ print_syscall_ret(num, ret, arg1, arg2, arg3, arg4, arg5, arg6);
}
record_syscall_return(cpu, num, ret);