I have a certain Linux executable that is called from a bigger application to perform some calculations. I want to modify the way the calculations are performed, for that I first need to understand how the executable is called and in what way the parameters and data are transferred.
So, I'd like to monitor the command line parameters, stdin and stdout if this executable is called. The normal operation of the executable should not be disturbed.
Is there an easy way to do that?
Update:
I tried the shell script placeholder idea to grab all the data using the following script:
#!/bin/bash
export LOGFILE=/tmp/logname
echo `env` > $LOGFILE-env
echo "$@" >> $LOGFILE-arguments
tee -a $LOGFILE-stdin | /path/to/real/executable 2>&1 | tee -a $LOGFILE-stdout
Unfortunately the executableThis works fine for test input, but it just hangs if it is called directly, in a way that does not work for shell scriptsreal. I get an error message that the executableProbably there is in ascii, soeven more going on than I need somehow to do the same thing in a compiled executablesuspected.