[PATCH v5 0/4] Stage output and filter on syscall return statuses
paul.chaignon at gmail.com
Fri Jun 28 09:32:08 UTC 2019
This patchset adds a new -e status=set option to filter syscalls based on
their return statuses. It also introduces a new option -Z to trace failed
syscalls, as an alias to -e status=failed. When using the status
qualifier, the output is staged, using open_memstream, until the syscall
return status is known.
The first patch adds the -Z option; the second implements the output
staging; the third introduces the -e status=set option, and the last adds
five new test cases.
In addition to the test cases in this patchset, I performed several manual
tests over the entire test suite. First, I set -e status to default to
the empty set (using 'none') and checked that none of the existing tests
were returning syscalls. Second, I set -e status to default to the
complete set (explicitly, not using 'all') and checked that all tests were
succeeding. Finally, I added a dummy entry to the status set, set -e
status to default to the complete set minus that entry, and checked all
tests were succeeding again. This last test differs from the previous
because the output is only staged when the -e status set in incomplete.
With this third check, the threads-execve test failed because the syscalls
were printed out in a different order (expected and mentioned in the man
Changes in v5:
- Test case for status=detached.
- Print warning when both -Z and -z are used.
- Fix -z and -Z aliases to -estatus.
- Fix memory leak.
- Fix comment formatting, indentations, and list orderings.
- Refactor popcount functions.
- Rename __MAX_STATUS to NUMBER_OF_STATUSES.
- Fix man page formatting.
- Trace exit_group in multithreads test cases.
- Refactor test cases based on chdir(2).
Changes in v4:
- Title change from "Stage output for -z and new -Z options".
- Add -e status=set option.
- Fix for stage output under execve switch.
- Remove most HAVE_OPEN_MEMSTREAM guards.
- Fix for filtering in raw(tcp) case.
- Simplify test cases for failed and successful.
- Add test cases for all, none, and unfinished statuses.
Changes in v3:
- Refactor/rename functions in stage_output.c (use bool drop).
- Move staging start/end to func syscall_entering_trace/
- Add -z/-Z option to strace man page (strace.1.in).
- Rename test binaries to strace-z/strace-Z.
- Swap _NR_open to _NR_chdir for test cases.
Changes in v2:
- Fix stage_output.c added to wrong patch.
Paul Chaignon (4):
Option to print only failing syscalls
Stage output for -z and -Z options
Implement -e status=set option
tests: check status qualifier
Makefile.am | 1 +
configure.ac | 1 +
defs.h | 33 +++++++++++++++-
filter_qualify.c | 33 ++++++++++++++++
number_set.c | 17 ++++++++
number_set.h | 13 ++++++
signal.c | 19 ---------
stage_output.c | 64 ++++++++++++++++++++++++++++++
strace.1.in | 47 ++++++++++++++++++++++
strace.c | 70 +++++++++++++++++++++++++++------
syscall.c | 30 +++++++++-----
tests/.gitignore | 5 +++
tests/Makefile.am | 5 +++
tests/gen_tests.in | 5 +++
tests/pure_executables.list | 5 +++
tests/status-all.c | 25 ++++++++++++
tests/status-detached.expected | 1 +
tests/status-detached.test | 17 ++++++++
tests/status-failed.c | 25 ++++++++++++
tests/status-none.c | 65 ++++++++++++++++++++++++++++++
tests/status-successful.c | 25 ++++++++++++
tests/status-unfinished.c | 72 ++++++++++++++++++++++++++++++++++
tests/status.c | 22 +++++++++++
tests/tests.h | 3 ++
24 files changed, 560 insertions(+), 43 deletions(-)
create mode 100644 stage_output.c
create mode 100644 tests/status-all.c
create mode 100644 tests/status-detached.expected
create mode 100755 tests/status-detached.test
create mode 100644 tests/status-failed.c
create mode 100644 tests/status-none.c
create mode 100644 tests/status-successful.c
create mode 100644 tests/status-unfinished.c
create mode 100644 tests/status.c
More information about the Strace-devel