I am trying to dump a variable from a syscall probe in a systemtap script:
probe syscall.execve
{
printf("ARGS: %s\n", argstr)
print($envp)
print("\n")
}
After running a program under systemtap like this
sudo stap -vv -W script.stp -c ./run.sh -o log.txt
I get something similar to the following (in log.txt
):
ARGS: "some-binary-name", ["arg1", "arg2"], [/* 6 vars */]
140089557153664
Unfortunately, the [/* 6 vars */]
string is literally what I get in the log instead of the actual contents of $envp
. And when I try to output $envp
using print
, I get some numeric value (which is probably the address of the array) instead of the array elements.
How do I dump the actual strings that are stored in $envp
?