Start-up Example
Here is a very small CLI script:
#
source make_actions.tcl
#
dload fork_loop
dset ARGS_DEFAULT { 0 4 -wp}
dstep
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 2. It then loads the fork_loop executable, sets its default startup arguments, then steps one source-level statement.
If this were stored in a file named fork_loop.tvd, here is how you would tell TotalView to start the CLI and execute this file:
totalviewcli -s fork_loop.tvd
Information on options and X resources can be found in the TotalView User's Guide.
The following example shows how you would place a similar set of commands in a file that you would invoke from the shell:
#!/bin/sh
# Next line executed by shell, but ignored by Tcl because of: \
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
Notice that the only difference is the first few lines in the file. In the second line, the continuation character is ignored by the shell. It is, however, processed by Tcl. This means that the shell will execute the command while Tcl will ignore it.