mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-27 05:20:50 +00:00
linux-user: Update print_futex_op
Use a table for the names; print unknown values in hex, since the value contains flags. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20220829021006.67305-7-richard.henderson@linaro.org> [lv: update print_futex() according to "linux-user: Show timespec on strace for futex()"] Signed-off-by: Laurent Vivier <laurent@vivier.eu>
This commit is contained in:
parent
c72a90df47
commit
53b578f31f
@ -3710,44 +3710,37 @@ print_munmap(CPUArchState *cpu_env, const struct syscallname *name,
|
||||
#endif
|
||||
|
||||
#ifdef TARGET_NR_futex
|
||||
static void print_futex_op(abi_long tflag, int last)
|
||||
static void print_futex_op(int cmd, int last)
|
||||
{
|
||||
#define print_op(val) \
|
||||
if( cmd == val ) { \
|
||||
qemu_log(#val); \
|
||||
return; \
|
||||
}
|
||||
static const char * const futex_names[] = {
|
||||
#define NAME(X) [X] = #X
|
||||
NAME(FUTEX_WAIT),
|
||||
NAME(FUTEX_WAKE),
|
||||
NAME(FUTEX_FD),
|
||||
NAME(FUTEX_REQUEUE),
|
||||
NAME(FUTEX_CMP_REQUEUE),
|
||||
NAME(FUTEX_WAKE_OP),
|
||||
NAME(FUTEX_LOCK_PI),
|
||||
NAME(FUTEX_UNLOCK_PI),
|
||||
NAME(FUTEX_TRYLOCK_PI),
|
||||
NAME(FUTEX_WAIT_BITSET),
|
||||
NAME(FUTEX_WAKE_BITSET),
|
||||
NAME(FUTEX_WAIT_REQUEUE_PI),
|
||||
NAME(FUTEX_CMP_REQUEUE_PI),
|
||||
NAME(FUTEX_LOCK_PI2),
|
||||
#undef NAME
|
||||
};
|
||||
|
||||
int cmd = (int)tflag;
|
||||
#ifdef FUTEX_PRIVATE_FLAG
|
||||
if (cmd & FUTEX_PRIVATE_FLAG) {
|
||||
qemu_log("FUTEX_PRIVATE_FLAG|");
|
||||
cmd &= ~FUTEX_PRIVATE_FLAG;
|
||||
unsigned base_cmd = cmd & FUTEX_CMD_MASK;
|
||||
|
||||
if (base_cmd < ARRAY_SIZE(futex_names)) {
|
||||
qemu_log("%s%s%s",
|
||||
(cmd & FUTEX_PRIVATE_FLAG ? "FUTEX_PRIVATE_FLAG|" : ""),
|
||||
(cmd & FUTEX_CLOCK_REALTIME ? "FUTEX_CLOCK_REALTIME|" : ""),
|
||||
futex_names[base_cmd]);
|
||||
} else {
|
||||
qemu_log("0x%x", cmd);
|
||||
}
|
||||
#endif
|
||||
#ifdef FUTEX_CLOCK_REALTIME
|
||||
if (cmd & FUTEX_CLOCK_REALTIME) {
|
||||
qemu_log("FUTEX_CLOCK_REALTIME|");
|
||||
cmd &= ~FUTEX_CLOCK_REALTIME;
|
||||
}
|
||||
#endif
|
||||
print_op(FUTEX_WAIT)
|
||||
print_op(FUTEX_WAKE)
|
||||
print_op(FUTEX_FD)
|
||||
print_op(FUTEX_REQUEUE)
|
||||
print_op(FUTEX_CMP_REQUEUE)
|
||||
print_op(FUTEX_WAKE_OP)
|
||||
print_op(FUTEX_LOCK_PI)
|
||||
print_op(FUTEX_UNLOCK_PI)
|
||||
print_op(FUTEX_TRYLOCK_PI)
|
||||
#ifdef FUTEX_WAIT_BITSET
|
||||
print_op(FUTEX_WAIT_BITSET)
|
||||
#endif
|
||||
#ifdef FUTEX_WAKE_BITSET
|
||||
print_op(FUTEX_WAKE_BITSET)
|
||||
#endif
|
||||
/* unknown values */
|
||||
qemu_log("%d", cmd);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -3763,6 +3756,9 @@ print_futex(CPUArchState *cpu_env, const struct syscallname *name,
|
||||
switch (op) {
|
||||
case FUTEX_WAIT:
|
||||
case FUTEX_WAIT_BITSET:
|
||||
case FUTEX_LOCK_PI:
|
||||
case FUTEX_LOCK_PI2:
|
||||
case FUTEX_WAIT_REQUEUE_PI:
|
||||
print_timespec(arg3, 0);
|
||||
break;
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user