On 9/19/26 19:20, Warner Losh wrote:
Mirror what linux-user does around system calls.

Signed-off-by: Warner Losh <[email protected]>
---
  bsd-user/freebsd/os-syscall.c | 8 +++++++-
  1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/bsd-user/freebsd/os-syscall.c b/bsd-user/freebsd/os-syscall.c
index 7e400c89bc..38dc87f745 100644
--- a/bsd-user/freebsd/os-syscall.c
+++ b/bsd-user/freebsd/os-syscall.c
@@ -29,7 +29,7 @@
  #include <utime.h>
  #include <poll.h>
-#include "include/gdbstub/syscalls.h"
+#include "gdbstub/user.h"
#include "qemu.h"
  #include "signal-common.h"
@@ -1622,14 +1622,20 @@ abi_long do_freebsd_syscall(CPUArchState *env, int num, 
abi_long arg1,
                              abi_long arg5, abi_long arg6, abi_long arg7,
                              abi_long arg8)
  {
+    CPUState *cpu = env_cpu(env);
      abi_long ret;
if (do_strace) {
          print_freebsd_syscall(num, arg1, arg2, arg3, arg4, arg5, arg6);
      }
+ gdb_syscall_entry(cpu, num);
+
      ret = freebsd_syscall(env, num, arg1, arg2, arg3, arg4, arg5, arg6,
                            arg7, arg8);
+
+    gdb_syscall_return(cpu, num);
+
      if (do_strace) {
          print_freebsd_syscall_ret(num, ret);
      }


This isn't quite the same -- linux now has plugin support:

static void record_syscall_start(CPUState *cpu, int num,
                                 abi_long arg1, abi_long arg2,
                                 abi_long arg3, abi_long arg4,
                                 abi_long arg5, abi_long arg6,
                                 abi_long arg7, abi_long arg8)
{
    qemu_plugin_vcpu_syscall(cpu, num,
                             arg1, arg2, arg3, arg4,
                             arg5, arg6, arg7, arg8);
    gdb_syscall_entry(cpu, num);
}

static void record_syscall_return(CPUState *cpu, int num, abi_long ret)
{
    qemu_plugin_vcpu_syscall_ret(cpu, num, ret);
    gdb_syscall_return(cpu, num);
}

and they're strictly outside strace rather than interleaved.


r~

Reply via email to