diff options
author | Filip Bozuta <Filip.Bozuta@syrmia.com> | 2020-07-23 23:02:33 +0200 |
---|---|---|
committer | Laurent Vivier <laurent@vivier.eu> | 2020-08-27 12:29:50 +0200 |
commit | 888468db949e8ea1641c33d97e70b70f57eb69e9 (patch) | |
tree | 31d78bb4d6b0991ba71475cc68a10f396e69d8a4 /linux-user/qemu.h | |
parent | c218b4ede4f9f8bdd210233f24ab2356f0e04d49 (diff) | |
download | qemu-888468db949e8ea1641c33d97e70b70f57eb69e9.zip qemu-888468db949e8ea1641c33d97e70b70f57eb69e9.tar.gz qemu-888468db949e8ea1641c33d97e70b70f57eb69e9.tar.bz2 |
linux-user: Add strace support for printing arguments for ioctls used for terminals and serial lines
Functions "print_ioctl()" and "print_syscall_ret_ioctl()" are used
to print arguments of "ioctl()" with "-strace". These functions
use "thunk_print()", which is defined in "thunk.c", to print the
contents of ioctl's third arguments that are not basic types.
However, this function doesn't handle ioctls of group ioctl_tty which
are used for terminals and serial lines. These ioctls use a type
"struct termios" which thunk type is defined in a non standard
way using "STRUCT_SPECIAL()". This means that this type is not decoded
regularly using "thunk_convert()" and uses special converting functions
"target_to_host_termios()" and "host_to_target_termios()", which are defined
in "syscall.c" to decode it's values.
For simillar reasons, this type is also not printed regularly using
"thunk_print()". That is the reason why a separate printing function
"print_termios()" is defined in file "strace.c". This function decodes
and prints flag values of the "termios" structure.
Implementation notes:
Function "print_termios()" was implemented in "strace.c" using
an existing function "print_flags()" to print flag values of
"struct termios" fields. Also, recently implemented function
"print_enums()" was also used to print enumareted values which
are contained in the fields of 'struct termios'.
These flag values were defined using an existing macro "FLAG_TARGET()"
that generates aproppriate target flag values and string representations
of these flags. Also, the recently defined macro "ENUM_TARGET()" was
used to generate aproppriate enumarated values and their respective
string representations.
Function "print_termios()" was declared in "qemu.h" so that it can
be accessed in "syscall.c". Type "StructEntry" defined in
"exec/user/thunk.h" contains information that is used to decode
structure values. Field "void print(void *arg)" was added in this
structure as a special print function. Also, function "thunk_print()"
was changed a little so that it uses this special print function
in case it is defined. This printing function was instantiated with
the defined "print_termios()" in "syscall.c" in "struct_termios_def".
Signed-off-by: Filip Bozuta <Filip.Bozuta@syrmia.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20200723210233.349690-4-Filip.Bozuta@syrmia.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Diffstat (limited to 'linux-user/qemu.h')
-rw-r--r-- | linux-user/qemu.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/linux-user/qemu.h b/linux-user/qemu.h index f431805..a69a0bd 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -706,6 +706,7 @@ static inline uint64_t target_offset64(uint64_t word0, uint64_t word1) } #endif /* TARGET_ABI_BITS != 32 */ +void print_termios(void *arg); /* ARM EABI and MIPS expect 64bit types aligned even on pairs or registers */ #ifdef TARGET_ARM |