summaryrefslogtreecommitdiffstats
path: root/include/exec/user
diff options
context:
space:
mode:
authorFilip Bozuta2020-06-19 14:47:27 +0200
committerLaurent Vivier2020-07-04 18:08:51 +0200
commit79482e5987c824086d8824ebcf95a0c8c9c16cd7 (patch)
tree38db55f8feb76e9dea3bf4d01526bd842131c623 /include/exec/user
parentlinux-user: Add thunk argument types for SIOCGSTAMP and SIOCGSTAMPNS (diff)
downloadqemu-79482e5987c824086d8824ebcf95a0c8c9c16cd7.tar.gz
qemu-79482e5987c824086d8824ebcf95a0c8c9c16cd7.tar.xz
qemu-79482e5987c824086d8824ebcf95a0c8c9c16cd7.zip
linux-user: Add strace support for printing arguments of ioctl()
This patch implements functionality for strace argument printing for ioctls. When running ioctls through qemu with "-strace", they get printed in format: "ioctl(fd_num,0x*,0x*) = ret_value" where the request code an the ioctl's third argument get printed in a hexadicemal format. This patch changes that by enabling strace to print both the request code name and the contents of the third argument. For example, when running ioctl RTC_SET_TIME with "-strace", with changes from this patch, it gets printed in this way: "ioctl(3,RTC_SET_TIME,{12,13,15,20,10,119,0,0,0}) = 0" In case of IOC_R type ioctls, the contents of the third argument get printed after the return value, and the argument inside the ioctl call gets printed as pointer in hexadecimal format. For example, when running RTC_RD_TIME with "-strace", with changes from this patch, it gets printed in this way: "ioctl(3,RTC_RD_TIME,0x40800374) = 0 ({22,9,13,11,5,120,0,0,0})" In case of IOC_RW type ioctls, the contents of the third argument get printed both inside the ioctl call and after the return value. Implementation notes: Functions "print_ioctl()" and "print_syscall_ret_ioctl()", that are defined in "strace.c", are listed in file "strace.list" as "call" and "result" value for ioctl. Structure definition "IOCTLEntry" as well as predefined values for IOC_R, IOC_W and IOC_RW were cut and pasted from file "syscall.c" to file "qemu.h" so that they can be used by these functions to print the contents of the third ioctl argument. Also, the "static" identifier for array "ioctl_entries[]" was removed and this array was declared as "extern" in "qemu.h" so that it can also be used by these functions. To decode the structure type of the ioctl third argument, function "thunk_print()" was defined in file "thunk.c" and its definition is somewhat simillar to that of function "thunk_convert()". Signed-off-by: Filip Bozuta <Filip.Bozuta@syrmia.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20200619124727.18080-3-filip.bozuta@syrmia.com> [lv: fix close-bracket] Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Diffstat (limited to 'include/exec/user')
-rw-r--r--include/exec/user/thunk.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/exec/user/thunk.h b/include/exec/user/thunk.h
index eae2c27f99..7992475c9f 100644
--- a/include/exec/user/thunk.h
+++ b/include/exec/user/thunk.h
@@ -73,6 +73,7 @@ void thunk_register_struct_direct(int id, const char *name,
const StructEntry *se1);
const argtype *thunk_convert(void *dst, const void *src,
const argtype *type_ptr, int to_host);
+const argtype *thunk_print(void *arg, const argtype *type_ptr);
extern StructEntry *struct_entries;