]> git.proxmox.com Git - mirror_qemu.git/commit
linux-user: Extend strace support to enable argument printing after syscall execution
authorFilip Bozuta <Filip.Bozuta@syrmia.com>
Fri, 19 Jun 2020 12:33:26 +0000 (14:33 +0200)
committerLaurent Vivier <laurent@vivier.eu>
Mon, 29 Jun 2020 11:08:48 +0000 (13:08 +0200)
commitc84be71f685436fd7216a159528421c3d7af8d05
tree9793f686d74f24853b626be49529b42826979d99
parente865b97ff4d924a81c28b9d9f3d6fe3e198bcdb9
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>
linux-user/qemu.h
linux-user/strace.c
linux-user/syscall.c