linux-user: Add strace for shmat

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson 2024-02-22 15:46:43 -10:00
parent 01a721167a
commit 9f7c97324c
2 changed files with 25 additions and 1 deletions

View File

@ -670,6 +670,26 @@ print_semctl(CPUArchState *cpu_env, const struct syscallname *name,
} }
#endif #endif
static void
print_shmat(CPUArchState *cpu_env, const struct syscallname *name,
abi_long arg0, abi_long arg1, abi_long arg2,
abi_long arg3, abi_long arg4, abi_long arg5)
{
static const struct flags shmat_flags[] = {
FLAG_GENERIC(SHM_RND),
FLAG_GENERIC(SHM_REMAP),
FLAG_GENERIC(SHM_RDONLY),
FLAG_GENERIC(SHM_EXEC),
FLAG_END
};
print_syscall_prologue(name);
print_raw_param(TARGET_ABI_FMT_ld, arg0, 0);
print_pointer(arg1, 0);
print_flags(shmat_flags, arg2, 1);
print_syscall_epilogue(name);
}
#ifdef TARGET_NR_ipc #ifdef TARGET_NR_ipc
static void static void
print_ipc(CPUArchState *cpu_env, const struct syscallname *name, print_ipc(CPUArchState *cpu_env, const struct syscallname *name,
@ -683,6 +703,10 @@ print_ipc(CPUArchState *cpu_env, const struct syscallname *name,
print_ipc_cmd(arg3); print_ipc_cmd(arg3);
qemu_log(",0x" TARGET_ABI_FMT_lx ")", arg4); qemu_log(",0x" TARGET_ABI_FMT_lx ")", arg4);
break; break;
case IPCOP_shmat:
print_shmat(cpu_env, &(const struct syscallname){ .name = "shmat" },
arg1, arg4, arg2, 0, 0, 0);
break;
default: default:
qemu_log(("%s(" qemu_log(("%s("
TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld ","

View File

@ -1398,7 +1398,7 @@
{ TARGET_NR_sgetmask, "sgetmask" , NULL, NULL, NULL }, { TARGET_NR_sgetmask, "sgetmask" , NULL, NULL, NULL },
#endif #endif
#ifdef TARGET_NR_shmat #ifdef TARGET_NR_shmat
{ TARGET_NR_shmat, "shmat" , NULL, NULL, print_syscall_ret_addr }, { TARGET_NR_shmat, "shmat" , NULL, print_shmat, print_syscall_ret_addr },
#endif #endif
#ifdef TARGET_NR_shmctl #ifdef TARGET_NR_shmctl
{ TARGET_NR_shmctl, "shmctl" , NULL, NULL, NULL }, { TARGET_NR_shmctl, "shmctl" , NULL, NULL, NULL },