alias
Creates or views pseudonyms for commands
Format
Creates a new user-defined pseudonym for a command
alias alias-name defn-body
Views previously defined aliases
alias [ alias-name ]
Arguments
alias-name
The name of the command pseudonym being defined.
defn-body
The text that Tcl substitutes when it encounters alias-name. Often this is just a command name.
Description
The alias command associates a specified name with some defined text. This text can contain one or more commands. You can use an alias in the same way as a native TotalView or Tcl command. In addition, you can include an alias as part of the definition of another alias.
If you do not enter an alias-name argument, the CLI displays the names and definitions of all aliases. If you specify only an alias-name argument, the CLI displays the definition of the alias.
Because the alias command can contain Tcl commands, defn-body must comply with all Tcl expansion, substitution, and quoting rules.
The TotalView global startup file, tvdinit.tvd, defines a set of default one or two-letter aliases for all common commands. To see a list of these commands, type alias with no argument in the CLI -window.
You cannot use an alias to redefine the name of a CLI-defined command. You can, however, redefine a built-in CLI command by creating your own Tcl procedure. For example, the following procedure disables the built-in
dwatch command. When a user types
dwatch, the CLI executes this code instead of the built-in CLI code.
proc dwatch {} {
puts "The dwatch command is disabled"
}
NOTE: Be aware that you can potentially create aliases that are nonsensical or incorrect because the CLI does not parse defn-body (the command’s definition) until it is used. The CLI detects errors only when it tries to execute your alias.
When you obtain help for any command, the help text includes any TotalView predefined aliases.
To delete an alias, use the
unalias command.
Examples
alias nt dnext
Defines a command called
nt that executes the
dnext command.
alias nt
Displays the definition of the nt alias.
alias
Displays the definitions of all aliases.
alias m {dlist main}
Defines an alias called m that lists the source code of function main().
alias step2 {dstep; dstep}
Defines an alias called
step2 that does two
dstep commands. This new command applies to the focus that exists when this alias is used.
alias step2 {s ; s}
Creates an alias that performs the same operations as that in the previous example, differing in that it uses the alias for dstep. You could also create the following alias which does the same thing: alias step2 {s 2}.
alias step1 {f p1. dstep}
Defines an alias called step1 that steps the first user thread in process 1. All other threads in the process run freely while TotalView steps the current line in your program.
Related Topics