TotalView Part 2:
Common Functions

Author: Blaise Barney, Lawrence Livermore National Laboratory UCRL-MI-133316

Part 2 Contents

  1. Viewing a Core File
  2. Loading Executables
  3. Expression Evaluation and Code Fragments
  4. More on Action Points
  5. Attaching / Detaching Processes
  6. Setting Executable Command Arguments
  7. Setting Source Code Search Paths
  8. Setting stdin and stdout
  9. Signal Handling
  10. Displaying Your Program's Call Graph
  11. Debugging Memory Problems
  12. Setting Preferences
  13. Visualizing Array Data
  14. Command Line Interpreter (CLI)
  15. Exercise 2

Viewing a Core File

A Word About Core Files at LC:

How to View a Core File:

Examine State:

Core File Size:

Loading Executables

When to Use:

How to Load a New Executable:

  1. Use either:

    Root Window  >  File Menu  >  Debug New Program 
    Process Window >  File Menu  >  Debug New Program 

  2. The Program Session Dialog Box will appear (below). Enter the name of the executable in the box provided, and click OK. A Process Window containing the newly loaded process will then appear allowing you to debug as usual.

Reloading a Recompiled Executable:

Expression Evaluation and Code Fragments

Code Fragments:

Using the Evaluate Window:

  1. Make sure that a process has run to a meaningful point, particularly if you intend to use variables that are part of your program.

  2. Open an Evaluate Window (shown below) as follows:

    Process Window  >  Tools Menu  >  Evaluate 

  3. In the Evaluate Window, select the language of choice (C, Fortran, Assembler) if needed.

  4. Enter your code fragment in the Expression box.

  5. Click on the Evaluate button. The expression will be evaluated and its value will appear in the Result box. Note that the value that appears relates to the last expression in the code fragment, in this case "sum".

More on Action Points

Types of Action Points:

Setting a Process Barrier Point:

Setting an Evaluation Point:

  1. First, make sure that the program is stopped.

  2. Open an Action Point Properties Dialog Box by either of these methods:

    Method 1:

    Process Window  >  Action Point Menu  >  Properties 

    Method 2: Right click on the source line and select Properties from the resulting pop-up menu.

  3. In the Action Point Properties Dialog Box, do the following:
    1. Click on the Evaluate button
    2. Select the button for the correct language if needed
    3. Enter your code fragment in the expression box - an example is shown below. (Expressions were covered previously under Expression Evaluation).
    4. Click on the OK button when finished.

  4. The source line should now display an EVAL icon:

  5. At runtime, the entered expression will be evaluated when it is encountered by a process or thread. Evaluation Point expressions are evaluated before the source code line.

Note: Depending upon your platform, TotalView can either compile or interpret expressions, with the expected implications to performance. See the TotalView documentation for details.

Setting a Watchpoint:

It is essential to consult the TotalView documentation before attempting to use watchpoints. There are numerous platform issues, restrictions and important details not mentioned here. For example, under Linux a watchpoint can't be larger than 4 bytes!

Deleting Action Points:

Disabling / Enabling Action Points:

Saving / Loading Action Points:

Attaching / Detaching Processes

How to Attach to a Process:

Detaching From a Process:

Setting Executable Command Arguments

How to Pass Arguments to Your Program:

Setting Source Code Search Paths


Default Behavior:

How to Add Additional Search Paths:

  1. Select either:

    Process Window  >  File Menu  >  Search Path 
    Root Window  >  File Menu  >  Search Path 

  2. In the Search Path Dialog Box (shown below), click on the Sources tab and then enter the directories that should be searched, in order. They can be separated with a space or a new line. Relative path names are permitted (relative to the current working directory).

  3. To browse for directories to add, click on the Insert button to open a Select Directory Dialog Box.

  4. Note that these paths will be persistent from session to session.

Setting stdin, stdout, and stderr

Default Behavior:

To Change the Defaults:

Signal Handling


How to Modify TotalView's Signal Handling:

Note: TotalView uses the SIGTRAP and SIGSTOP signals internally. If either occurs, TotalView neither stops the process with an error or has the signal sent back to the program. This behavior cannot be changed.

Displaying Your Program's Call Graph

Debugging Memory Problems


Starting MemoryScape:

Some Example MemoryScape Displays:

Setting Preferences

About Preferences:

Preferences Dialog Box:

Visualizing Array Data

The TotalView Visualizer:

Getting Started:
  1. Run your program in TotalView to a breakpoint where you know the array of interest will have relevant data.

  2. Dive on the array variable. A Variable Window will then open, showing the contents of the array.

  3. Select Visualize from the Variable Window's Tools Menu. Shown at right.

  4. The Dataset Window will then appear, as will a Graph View Window or Surface View Window of your array data (depending upon which view the visualizer thinks is best). Examples of all three windows are shown below.

Primary Visualizer Windows:

Command Line Interpreter (CLI)

What is the CLI?

Starting an Interactive CLI Debug Session:

CLI Commands:

Example Interactive TotalView CLI Debug Session:

This concludes TotalView Part 2

Where would you like to go now?