Skip to main content

straceexec

Build Status PyPI version

straceexec is a python script that allows for playback and analysis of execve commands from strace logs. This is useful for debugging commands embedded several layers deep with significant automated setup. One specific use case would be debugging specific commands from a build system that setup many environment variables or have complex command line invocations.

Usage

# strace -f -v -s 10000 -o strace.log ninja
# straceexec strace.log
0: ninja -:ENV:- LANG=en_US.UTF-8 USERNAME=ddedrick SHELL=/bin/bash output=default GDM_LANG=en_US.UTF EDITOR=vimx PATH=/u
1: /bin/sh -c /usr/lib64/ccache/cc -Dfoo_EXPORTS  -fPIC -MD -MT CMakeFiles/foo.dir/foo.c.o -MF CMakeFiles/foo.dir/foo.c.o
2: /usr/lib64/ccache/cc -Dfoo_EXPORTS -fPIC -MD -MT CMakeFiles/foo.dir/foo.c.o -MF CMakeFiles/foo.dir/foo.c.o.d -o CMakeF
3: /bin/sh -c : && /usr/lib64/ccache/cc -fPIC    -shared -Wl,-soname,libfoo.so.0 -o libfoo.so.0.3.0 CMakeFiles/foo.dir/fo
4: /usr/lib64/ccache/cc -fPIC -shared -Wl,-soname,libfoo.so.0 -o libfoo.so.0.3.0 CMakeFiles/foo.dir/foo.c.o -:ENV:- LANG=
5: /usr/bin/cc -fPIC -shared -Wl,-soname,libfoo.so.0 -o libfoo.so.0.3.0 CMakeFiles/foo.dir/foo.c.o -:ENV:- LANG=en_US.UTF
6: /usr/libexec/gcc/x86_64-redhat-linux/8/collect2 -plugin /usr/libexec/gcc/x86_64-redhat-linux/8/liblto_plugin.so -plugi
7: /usr/bin/ld -plugin /usr/libexec/gcc/x86_64-redhat-linux/8/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/x86_64-redhat
8: /bin/sh -c /usr/bin/cmake -E cmake_symlink_library libfoo.so.0.3.0  libfoo.so.0 libfoo.so && : -:ENV:- LANG=en_US.UTF-
9: /usr/bin/cmake -E cmake_symlink_library libfoo.so.0.3.0 libfoo.so.0 libfoo.so -:ENV:- LANG=en_US.UTF-8 USERNAME=ddedri
Enter the number of the command you would like to execute
	Append an n to not copy the environment
	Append a p to print the full command and exit
	Append a g to run under gdb
Select: 1

strace output should be collected with -v to ensure that arguments are not left off and -s with a sufficiently large size so that they are not truncated.

By default the command will be run and will have the same environment setup as is found in the strace output. Several options are available for modifying this behavior. Appending an n will use the current environment instead of the one present in the strace log. Appending a p will not exec the command but instead print it in full along with its environment. Appending a g will start start up gdb with the executable, arguments, and environment already setup. Appending an s will generate a script named command.sh that will set the environment and run the the command.

Contributing

Contributions, issues, and feature requests are welcome. Feel free to open pull requests or issues as needed.

Author

Written by Dan Dedrick to simplify isolating, reproducing and tweaking build system issues.

License

straceexec is distributed under the MIT license. See the included LICENSE file for details.

Metadata

Release files for straceexec 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for straceexec 1.1.1
File Size Uploaded Provenance Actions
straceexec-1.1.1.tar.gz 4.4 kB Without provenance Details for straceexec-1.1.1.tar.gz

Release files / straceexec-1.1.1.tar.gz

Download URL straceexec-1.1.1.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
2446b3f6f25c77baf20b5d94afbb0d2ef9056168d4ce1a1362e66886faa670c3
BLAKE2b-256 checksum
How to use checksums
0e687c138475303d4fc0d56dfb76ed1e1c1233db13be8b3598755a3fa02a599e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.5.0.1 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.4

Security for straceexec 1.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page