Startup Example
The following is a very small CLI script:
#
source make_actions.tcl
#
dload fork_loop
dset ARGS_DEFAULT {0 4 -wp}
catch {make_actions fork_loop.cxx} msg
puts $msg
This script begins by loading and interpreting the make_actions.tcl file, which was described in Chapter 20, Seeing the CLI at Work . It then loads the fork_loop executable, sets its default startup arguments, and steps one source-level statement.
If you stored this in a file named fork_loop.tvd, you can tell TotalView to start the CLI and execute this file by entering the following command:
totalviewcli -s fork_loop.tvd
The following example places a similar set of commands in a file that you invoke from the shell:
#!/bin/sh
# Next line executed by shell, but ignored by Tcl because: \
exec totalviewcli -s "$0" "$@"
#
source make_actions.tcl
#
dload fork_loop
dset ARGS_DEFAULT {0 4 -wp}
dstep
catch {make_actions fork_loop.cxx} msg
puts $msg
The only real difference between the last two examples is the first few lines in the file. In this second example, the shell ignores the backslash continuation character; Tcl processes it. This means that the shell executes the exec command while Tcl will ignore it.