This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Implement 'catch syscall' for gdbserver

On Thu, Oct 29, 2015 at 6:52 PM, Josh Stone <> wrote:
> This adds a new QCatchSyscalls packet to enable 'catch syscall', and new
> stop reasons "syscall_entry" and "syscall_return" for those events.  It
> is currently only supported on Linux x86 and x86_64.
> Based on work from Philippe Waroquiers <>.
> Beyond simple rebasing, I've also updated it to store the syscall catch
> lists uniquely to each target process, and updated entry/return logic
> from checking ENOSYS to now matching gdb's current Linux logic.
> gdb/ChangeLog:
> 2015-10-29  Josh Stone  <>
>         * NEWS (Changes since GDB 7.10): Mention QCatchSyscalls and new
>         GDBserver support for catch syscall.
>         * remote.c (PACKET_QCatchSyscalls): New enum.
>         (remote_set_syscall_catchpoint): New function.
>         (remote_protocol_features): New element for QCatchSyscalls.
>         (remote_parse_stop_reply): Parse syscall_entry/return stops.
>         (init_remote_ops): Install remote_set_syscall_catchpoint.
>         (_initialize_remote): Config QCatchSyscalls.
> gdb/doc/ChangeLog:
> 2015-10-29  Josh Stone  <>
>         * gdb.texinfo (Remote Configuration): List the QCatchSyscalls packet.
>         (Stop Reply Packets): List the syscall entry and return stop reasons.
>         (General Query Packets): Describe QCatchSyscalls, and add it to the
>         table and detailed list of stub features.
> gdb/gdbserver/ChangeLog:
> 2015-10-29  Josh Stone  <>
>         * inferiors.h: Include "gdb_vecs.h".
>         (struct process_info): Add syscalls_to_catch.
>         * inferiors.c (remove_process): Free syscalls_to_catch.
>         * remote-utils.c (prepare_resume_reply): Report syscall_entry and
>         syscall_resume stops.
>         * server.h (UNKNOWN_SYSCALL, ANY_SYSCALL): Define.
>         * server.c (handle_general_set): Handle QCatchSyscalls.
>         (handle_query): Report support for QCatchSyscalls.
>         * target.h (struct target_ops): Add supports_catch_syscall.
>         (target_supports_catch_syscall): New macro.
>         * linux-low.h (struct linux_target_ops): Add get_syscall_trapinfo.
>         (struct lwp_info): Add syscall_state.
>         * linux-low.c (SYSCALL_SIGTRAP): Define.
>         (handle_extended_wait): Mark syscall_state like an entry.
>         (get_syscall_trapinfo): New function, proxy to the_low_target.
>         (linux_low_ptrace_options): Enable PTRACE_O_TRACESYSGOOD.
>         (linux_low_filter_event): Set ptrace options even before arch-specific
>         setup.  Either toggle syscall_state entry/return or set ignored.
>         (gdb_catching_syscalls_p): New function.
>         (gdb_catch_this_syscall_p): New function.
>         (linux_wait_1): Handle SYSCALL_SIGTRAP.
>         (linux_resume_one_lwp_throw): Add PTRACE_SYSCALL possibility.
>         (linux_supports_catch_syscall): New function.
>         (linux_target_ops): Install it.
>         * linux-x86-low.c (x86_get_syscall_trapinfo): New function.
>         (the_low_target): Install it.
>         * nto-low.c (nto_target_ops): Install NULL supports_catch_syscall.
>         * spu-low.c (spu_target_ops): Likewise.
>         * win32-low.c (win32_target_ops): Likewise.
> gdb/testsuite/ChangeLog:
> 2015-10-29  Josh Stone  <>
>         * gdb.base/catch-syscall.exp: Enable testing for x86 and x86_64 linux
>         remote targets.
>         (do_syscall_tests): Only test mid-vfork on local or extended-remote.

Hi. I haven't reviewed the patch completely yet, but one comment.
We generally have a convention for recording all significant authors
of a patch in the ChangeLog entry.
If Philippe doesn't want his name in the c/l entry that's cool,
but if there is a significant amount of his work here we should note
it in the c/l entry.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]