[PATCH v3 0/3] [GSoC] Stop condition based on number of syscalls

Sahil Siddiq icegambit91 at gmail.com
Wed Mar 1 21:38:41 UTC 2023


This patch adds the feature to detach strace after capturing a specified
number of syscalls. I have added the three tests as well in this series of

On Sunday, 26 February 2023 02:34:31 IST Dmitry V. Levin wrote:
> When strace terminates, it detaches from all its tracees, but it also
> terminates the process it started.  Besides that, it doesn't try to
> terminate any other tracee.  See cleanup() for details.

I went through the relevant sections and based on what I have understood,
I have made some changes. I have made changes to strace.c so that strace
does not send SIGTERM to the tracee when detaching from it with the -l
option. Also, I later realised that the -l option wasn't working properly
with --status. Syscalls that were being filtered out with --status were
still being considered when updating the value of syscall_limit. I have
fixed that too.


v1: https://lists.strace.io/pipermail/strace-devel/2023-February/011155.html
Changes v1 -> v3:
 - Improved description of -l option in the man page.
 - Minor improvement in NEWS.

v2: https://lists.strace.io/pipermail/strace-devel/2023-February/011161.html
Changes v2 -> v3:
 - Add "syscall_limit" to defs.h so it can be accessed in other files.
 - Remove the static modifier for "syscall_limit" in strace.c.
 - Make changes in strace.c so that strace detaches cleanly from tracee
   killing it with SIGTERM.
 - Update "syscall_limit" in syscall_exiting_trace().

v1 (RFC: test): https://lists.strace.io/pipermail/strace-devel/2023-February/011168.html
Changes v1 (RFC: test) -> v3:
 - Add helper functions for -l with --trace-path and --status in strace--syscall-limit.c.
 - Add new files strace--syscall-limit-path.c and strace--syscall-limit-status.c.
 - Add Wno-error for old-style-definition in st_warn_cflags.m4.
 - Add rules to generate tests.
 - Add relevant names to Makefile.am.
 - Make relevant entries in .gitignore.

Sahil Siddiq (3):
  Stop condition based on number of syscalls
  Make relevant changes in NEWS and man page
  Add tests for the -l/--syscall-limit option

 NEWS                                 |   2 +
 doc/strace.1.in                      |   8 ++
 m4/st_warn_cflags.m4                 |   1 +
 src/defs.h                           |   1 +
 src/strace.c                         |  21 +++-
 src/syscall.c                        |   3 +
 tests/.gitignore                     |   3 +
 tests/Makefile.am                    |   3 +
 tests/gen_tests.in                   |   3 +
 tests/strace--syscall-limit-path.c   |   2 +
 tests/strace--syscall-limit-status.c |   2 +
 tests/strace--syscall-limit.c        | 153 +++++++++++++++++++++++++++
 12 files changed, 199 insertions(+), 3 deletions(-)
 create mode 100644 tests/strace--syscall-limit-path.c
 create mode 100644 tests/strace--syscall-limit-status.c
 create mode 100644 tests/strace--syscall-limit.c


More information about the Strace-devel mailing list