Totalview® for HPC User Guide : PART IV Advanced Tools and Customization : Chapter 22 Controlling fork, vfork, and execve Handling : The exec_handling and fork_handling Command Options and State Variables : Example
Example
It’s important to properly construct the exec-handling-list and fork-handling-list list of pairs, so that the list is properly quoted for Tcl or the shell. Generally, enclose the list in curly braces in the CLI, and enclose it in single quotes in the shell.
Note that the regular expressions are not anchored, so you must use "^" and "$" to match the beginning or end of the process name.
Calling exec:
This example configures TotalView to automatically continue the process (without asking) when bash calls exec, but to ask when other processes call exec, using the following dset CLI command or totalview command option:
 
dset TV::exec_handling {{{^bash$} go} {. ask}}
totalview -exec_handling '{{^bash$} go} {. ask}'
Above, the regexp is wrapped in an extra set of curly braces to make sure that Tcl does not process the "$" as a variable reference.
Calling fork:
This example configures TotalView to attach to the child process when a process containing the name "tx_fork_exec" calls fork, but to detach from other forked processes, using the following dset CLI command or totalview command option:
 
dset TV::fork_handling {{tx_fork_exec attach} {. detach}}
totalview -fork_handling '{tx_fork_exec attach} {. detach}'
An example session:
 
% totalviewcli -verbosity errors \
-exec_handling '{{^bash$} go} {. ask}' \
-fork_handling '{tx_fork_exec attach} {. detach}' \
-args \
bash -c 'tx_fork_exec tx_hello'
d1.<> co
Parent done ....
Child is calling execve ...
Process bash<tx_fork_exec>.1 has exec'd /path/to/tx_hello.
Do you want to stop it now?
: yes
d1.<> ST
1 (0) Nonexistent [bash]
2 (20053) Stopped [bash<tx_fork_exec><tx_hello>.1]
2.1 (20053/20053) Stopped PC=0x7f70517dd210
d1.<>