Setting Environment Variables and Altering Standard I/O
Use the Environment tab of the Debug New Program dialog (or related dialogs) to configure your environment or customize standard I/O.
Figure 11 – Setting Environment Variables and Altering Standard I/O
These options can also be set while TotalView is running, by selecting Process > Startup Parameters from the Process Window. This command launches these dialogs so you can edit any of these settings for any running debug session. When you restart your process, the settings are applied.
Environment Variables
The Program Environment area accepts additional environment variables that TotalView should pass to a process when it is launched.
Figure 12 – Setting environment variables
By default, a new process inherits TotalView environment variables, and a remote process inherits tvdsvr’s environment variables. Using this window, you can add new variables, change the value of existing variables, or delete a variable.
Place each argument on a separate line. If an argument contains spaces, enclose the entire argument in double-quotation marks.
At startup, TotalView reads in your environment variables to ensure that your program has access to them when the program begins executing. You can add additional environment variables or override values of existing variables.
NOTE >> TotalView does not display the variables that were passed to it when you started your debugging session. Instead, this area just displays the variables you added using this command.
The format for specifying an environment variable is name=value. For example, the following definition creates an environment variable named DISPLAY whose value is enterprise:0.0:
DISPLAY=enterprise:0.0
You can also enter this information using the Process Window’s Process > Startup Parameters command.
Standard I/O
The controls in the Input Processing and Standard and Error Output Processing area let you change how TotalView handles standard input (stdin), standard output (stdout), and standard error (stderr). Each is handled separately.
Figure 13 – Resetting Standard I/O
In all cases, name the file to which TotalView will write or from which TotalView will read information.
Other controls append output to an existing file if one exists instead of overwriting it, or merge standard out and standard error to the same stream.
If you want to use the default stdio, stdout, or stderr, you can clear the button that precedes the area.
Standard Input Redirection
Lets you name the file that will be connected to the process’s standard input (stdin) when it is next launched.
Processes running under TotalView control inherit standard input from TotalView. This field lets you set the target process’s standard input to be a file. You must do this before the process is created.
Redirect standard input from file
If your program should receive input from a file, either type the file name directly or use the Browse button to locate the file.
Standard Output/Error Redirection
You can choose to write standard output (stdout) and standard error (stderr) to the same file or different files, effective the next time your program is launched.
Do not redirect standard output or error
The output is written directly to the terminal by default.
Redirect standard output and error to the same file
If you want your program to send all stdout and stderr output to a file, either type the file name directly or use the Browse button to locate the file in the Output file field.
Redirect standard output and/or error to separate files
To redirect output to different files, define them here.
Standard output file: Name the file that will be connected to the process’s standard output (stdout) when it is next launched.
Processes running under TotalView inherit their standard output from TotalView. You must set this before the process is created.
stdout is buffered. If it is pointed to a file, the last few lines of the program’s output are not actually written to the file until the buffer is flushed. If the target process terminates abnormally or if TotalView deletes it, the last few lines of output may never be written to the file.
Standard error file: Name the file that will be connected to the process’s standard error (stderr) when it is next launched.
Processes running under TotalView inherit stderr from TotalView. This field lets you set the target process’s stderr to a file. You must do this before the process is created.
stderr is buffered. If it is pointed to a file, the last few lines of the program’s output are not actually written to the file until the buffer is flushed. If the target process terminates abnormally or if TotalView deletes it, the last few lines of output may never be written to the file.