[PATCH v4 0/4] Stage output and filter on syscall return statuses
paul.chaignon at gmail.com
Sat Jun 15 17:27:43 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 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 | 11 +++++-
filter_qualify.c | 33 +++++++++++++++++
number_set.c | 32 +++++++++++++++++
number_set.h | 13 +++++++
stage_output.c | 66 ++++++++++++++++++++++++++++++++++
strace.1.in | 41 +++++++++++++++++++++
strace.c | 57 ++++++++++++++++++++++-------
syscall.c | 25 +++++++------
tests/.gitignore | 5 +++
tests/Makefile.am | 2 ++
tests/gen_tests.in | 5 +++
tests/pure_executables.list | 5 +++
tests/status-all.c | 29 +++++++++++++++
tests/status-failed.c | 33 +++++++++++++++++
tests/status-none.c | 65 +++++++++++++++++++++++++++++++++
tests/status-successful.c | 33 +++++++++++++++++
tests/status-unfinished.c | 71 +++++++++++++++++++++++++++++++++++++
19 files changed, 505 insertions(+), 23 deletions(-)
create mode 100644 stage_output.c
create mode 100644 tests/status-all.c
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
More information about the Strace-devel