After about 20 years of intimate life with Linux I barely dare to ask such a basic question - is it somehow possible log everything what's happening when I run a process regarding working directories and process calls (with arguments)?
I have the following scenario: I run a build tool which runs processes which run processes and one of these produces an error. Even with environment variables and the usual --verbose
argument I don't get enough information to manually 'replay' what's happening in order to even identify the misbehaving process.
I know set -x
but as far as I know it only affects the current bash
/sh
instance, while the process I start runs a Python script which runs a Python script which would run configure
at some place, maybe make
, etc. At least it didn't help me much yet.
I also know strace
which might be of some help but is there a way to extract process calls and working directories? In my experience it produces so much output that it's barely possible to find the spot I have to start grep
ing around..
What I'm currently dreaming of would be something like
precord python3 buildme.py
which would give me at least something like
python3 buildme.py --verbose (/home/me/project/root)
├── /usr/bin/mkdir build (/home/me/project/root)
├── make all (/home/me/project/root/build)
│ ├── g++ -O2 -o bla.o bla.cpp
. ├── ...
.
(please ignore the fact that the process tree above would not make any sense - it's about the idea)
This question is not about solving only this riddle but I'm looking for a general approach.
I'm desperately hoping that this was one of the first Unix tools being invented for obvious reasons and somehow I just missed it until now..