|
Viewing a Core File |
How to View a Core File:
![]() |
Root Window > File Menu > New Program |
![]() |
Process Window > File Menu > New Program |
totalview executable corefile
Examine State:
Loading Executables |
When to Use:
How to Load a New Executable:
![]() |
Root Window > File Menu > New Program |
![]() |
Process Window > File Menu > New Program |
Reloading a Recompiled Executable:
Expression Evaluation and Code Fragments |
Code Fragments:
Using the Evaluate Window:
![]() |
Process Window > Tools Menu > Evaluate |
More on Action Points |
Types of Action Points:
Setting a Process Barrier Point:
Method 1:
![]() |
Process Window > Action Point Menu > Set Barrier |
Method 2:
![]() |
Process Window > Action Point Menu > Properties |
Then select the Barrier button in the resulting Action Point Properties Dialog Box.
Method 3: Right click on the source line and select Set Barrier from the resulting pop-up menu.
Setting an Evaluation Point:
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.
![]() | 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:
![]() |
Variable Window > Tools Menu > Create Watchpoint… |
Note: If watchpoints are not supported on your platform, this item will be "grayed out" and unable to be selected.
![]() | 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. |
Deleting Action Points:
Method 1: Right click on the source code line and then select Delete from the resulting pop-up menu.
Method 2:
![]() |
Process Window > Action Point Menu > Delete |
Method 3: Open an Action Point Properties Dialog Box (discussed earlier). Then select the Delete button.
![]() |
Process Window > Action Point Menu > Delete All |
Disabling / Enabling Action Points:
Method 1: Right click on the source code line and then select Disable or Enable from the resulting pop-up menu.
Method 2:
![]() |
Process Window > Action Point Menu > Disable or Enable |
Method 3: Open an Action Point Properties Dialog Box (discussed earlier). Then toggle the Enable action point button as desired.
Method 4: Left click on the desired action point icon in the Process Window's Action Points Pane.
![]() |
Process Window > Action Point Menu > Suppress All |
The Suppress All menu item will toggle between disabling (suppress) and enabling all action points.
Saving / Loading Action Points:
![]() |
Process Window > Action Point Menu > Save All |
The filename for the action points file will be something similar to what’s shown below (there is some variation in the actual naming format between different versions).
executable_name.TVD.v3breakpoints
![]() |
Process Window > Action Point Menu > Load All |
Attaching / Detaching Processes |
How to Attach to a Process:
If the New Program Dialog Box doesn’t automatically appear, then open one manually:
![]() |
Root Window > File Menu > New Program |
Note that you are also able to attach to processes on other machines through the on host: drop-down menu.
Detaching From a Process:
![]() |
Process Window > Process Menu > Detach |
![]() |
Process Window > Thread Menu > Continuation Signal |
A Continuation Signal Dialog Box will appear. Select the signal TotalView should send to the process when it detaches, such as SIGSTOP
Setting Executable Command Arguments |
How to Pass Arguments to Your Program:
![]() |
Process Window > Process Menu > Startup Parameters |
Setting Source Code Search Paths |
Purpose:
Default Behavior:
How to Add Additional Search Paths:
![]() |
Process Window > File Menu > Search Path… |
![]() |
Root Window > File Menu > Search Path… |
totalview*searchPath: dir1, \
dir2, dir3, \ dir4, dir5, dir6, \ dir7, dir8 |
Setting stdin, stdout, and stderr |
Default Behavior:
To Change the Defaults:
![]() |
Process Window > Process Menu > Startup Parameters… |
Signal Handling |
Purpose:
How to Modify TotalView's Signal Handling:
![]() |
Process Window > File Menu > Signals… |
![]() | 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 |
![]() |
Process Window > Tools Menu > Call Graph |
Debugging Memory Problems |
Overview:
Monitoring Memory Usage:
Process Window >
Tools
Menu > Memory Usage
Process Window >
Tools
Menu > Enable Memory Debugging
Setting Preferences |
About Preferences:
![]() |
Process Window > File Menu > Preferences… |
![]() |
Root Window > File Menu > Preferences… |
Preferences Dialog Box:
Visualizing Array Data |
The TotalView Visualizer:
Image adapted from TotalView Users Guide
C | Fortran |
---|---|
$visualize(matrixa) $visualize(matrixa,"[::2][10:15]") $visualize(matrixa,"[12][:]") |
$visualize(matrixb) $visualize(matrixb,'(11:16,::2)') $visualize(matrixb,'(:,12)') |
![]()
| ![]() |
Primary Visualizer Windows:
Dataset Window
![]() |
|
Surface View Window
|
Graph View Window:
|
![]() |
![]() |
Command Line Interpreter (CLI) |
What is the CLI?
Starting a CLI Debug Session:
![]() |
Process Window > Tools Menu > Command Line |
![]() |
Root Window > Tools Menu > Command Line |
CLI Command Summary:
Environment Commands | |
---|---|
alias | Creates or views user-defined commands. |
capture | Allows commands that print information to instead send their output to a string variable |
dgroups | Manipulates and manages groups |
dset | Changes or views values of CLI state variables |
dunset | Restores default settings of CLI state variables |
help | Displays help information |
stty | Sets terminal properties |
unalias | Removes a previously defined command |
dworker | Adds or removes a thread from a workers group |
CLI Initialization and Termination | |
dattach | Attaches to one or more processes currently executing in the normal run-time environment |
ddetach | Detaches from processes |
dkill | Kills existing user process, leaving debugging information in place |
dload | Loads debugging information about the target program into TotalView and prepares it for execution |
dreload | Reloads the current executable |
drerun | Restarts a process |
drun | Starts or restarts the execution of users processes under control of the CLI |
dstatus | Shows current status of processes and threads |
quit | Exits from the CLI, ending the debugging session |
Program Information | |
dassign | Changes the value of a scalar variable |
dlist | Browses source code relative to a particular file, procedure or line |
dmstat | Displays memory use information |
dprint | Evaluates an expression or program variable and displays the resulting value |
dptsets | Shows status of processes and threads |
dwhat | Determines what a name refers to |
dwhere | Prints information about the target thread's stack |
Execution Control | |
dcont | Continues execution of processes and waits for them |
dfocus | Changes the set of process, threads, or groups upon which a CLI command acts |
dgo | Resumes execution of processes (without blocking) |
dhalt | Suspends execution of processes |
dhold | Holds threads or processes |
dnext | Executes statements, moving into subfunctions if required |
dnexti | Executes machine instructions, stebbing over subfunctions |
dout | Runs out from the current subroutine |
dstep | Executes statements, moving into subfunctions if required |
dstepi | Executes machine instructions, moving into subfunctions if required |
dunhold | Releases a held process or thread |
duntil | Runs the process until a target place is reached |
dwait | Blocks command input until processes stop |
Action Points | |
dactions | Views information on action point definitions and their current status |
dbarrier | Defines a process or thread barrier breakpoint |
dbreak | Defines a breakpoint |
ddelete | Deletes an action point |
ddisable | Temporarily disables an action point |
denable | Reenables an action point that has been disabled |
dwatch | Defines a watchpoint |
Miscellaneous | |
dcache | Clears the remote library cache |
ddown | Moves down the call stack |
dflush | Unwinds stack from suspended computations |
dlappend | Appends list elements to a TotalView variable |
dup | Moves up the call stack |
First, make sure the CLI is in our path
% which totalviewcli
/usr/local/bin/totalviewcli
List the program. Note the bug.
% cat spinhung.c
/******************************************************************************
* FILE: spinhung.c
* DESCRIPTION:
* Simple example file
* Compile: cc -g spinhung.c -o spinhung
*
****************************************************************************/
main() {
int i, j, x;
i=99;
while (i < 100) {
x = 2*i;
j = i;
}
}
Start the CLI
% totalviewcli
AIX TotalView 7.1.0-1
Copyright 1999-2005 by Etnus, LLC. ALL RIGHTS RESERVED.
Copyright 1999 by Etnus, Inc.
Copyright 1996-1998 by Dolphin Interconnect Solutions, Inc.
Copyright 1989-1996 by BBN Inc.
d1.<>
Load the program
d1.<> dload spinhung
Reading symbols for process 1, executing "spinhung"
Library /g/g0/blaise/totalview/spinhung, with 2 asects, was linked at 0x100000000, and initially loaded at 0xff00000040000000
Reading and digesting 121 symbols...done
Library /usr/ccs/bin/usla64, with 2 asects, was linked at 0x9fffffff0000000, and initially loaded at 0xff00000040000c00
Reading and digesting 317 symbols...done
Library /usr/lib/libpthreads.a(shr_xpg5_64.o), with 2 asects, was linked at 0xfffffffffffffe00, and initially loaded at 0xff00000040008e00
Reading and digesting 3171 symbols...done
Library /usr/lib/libcrypt.a(shr_64.o), with 2 asects, was linked at 0xfffffffffffffe08, and initially loaded at 0xff000000400c2300
Reading and digesting 86 symbols...done
Library /usr/lib/libc.a(shr_64.o), with 2 asects, was linked at 0xfffffffffffffdc0, and initially loaded at 0xff000000400c3000
Reading and digesting 26540 symbols...done
1
d1.<>
List the program
d1.<> dlist
1 /******************************************************************************
2 * FILE: spinhung.c
3 * DESCRIPTION:
4 * Simple example file
5 * Compile: cc -g spinhung.c -o spinhung
6 *
7 ****************************************************************************/
8
9 main() {
10
11 int i, j, x;
12
13 i=99;
14 while (i < 100) {
15 x = 2*i;
16 j = i;
17 }
18
19 }
Display CLI settings
d1.<> dset
ARGS(1) {}
BARRIER_STOP_ALL process
BARRIER_STOP_WHEN_DONE group
CGROUP(1) 1
COMMAND_EDITING false
EXECUTABLE_PATH /g/g0/blaise/totalview/:.:/usr/global/docs/training/source/C/scatter/:/usr/local/share/source
GROUP(1) {control 1}
GROUP(2) {workers 1.1}
GROUP(3) {share 1}
GROUPS {1 2 3}
LINES_PER_SCREEN AUTO
MAX_LEVELS 512
MAX_LIST 20
PROMPT {[dfocus]> }
PTSET d1.<
SGROUP(1) 3
SHARE_ACTION_POINT true
STOP_ALL process
TAB_WIDTH 8
TOTALVIEW_ROOT_PATH /usr/local/tv/dflt/rs6000
TOTALVIEW_TCLLIB_PATH /usr/local/tv/dflt/lib
TOTALVIEW_VERSION {AIX TotalView 7.1.0-1}
VERBOSE info
WGROUP(1) 2
Set a breakpoint at line 15
d1.<> dbreak 15
1
Start the program
d1.<> drun
Thread 1.1 has appeared
Created process 1 (5124324), named "spinhung"
d1.<> Thread 1.1 has exited
Thread 1.1 has appeared
Thread 1.1 hit breakpoint 1 at line 15 in "main"
Display process status
d1.<>dstatus
1 (39754) Breakpoint [spinhung]
1.1 (39754/1) Breakpoint PC=0x10000340, [/g/g0/blaise/totalview/spinhung.c#15]
List the program again - note the breakpoint on line 15
d1.<> dlist 1 -n 20
1 /******************************************************************************
2 * FILE: spinhung.c
3 * DESCRIPTION:
4 * Simple example file
5 * Compile: cc -g spinhung.c -o spinhung
6 *
7 ****************************************************************************/
8
9 main() {
10
11 int i, j, x;
12
13 i=99;
14 while (i < 100) {
15@> x = 2*i;
16 j = i;
17 }
18
19 }
Display a variable value
d1.<> dprint i
i = 0x00000063 (99)
Query about action points
d1.<> dactions
1 shared action point for group 3:
1 [spinhung.c#15] Enabled
Step through program
d1.<> dstep
16 > j = i;
d1.<> dstep
14 > while (i < 100) {
Delete the breakpoint and then relist the program - note that
breakpoint is gone.
d1.<> ddelete 1
d1.<> dlist 1 -n 20
1 /******************************************************************************
2 * FILE: spinhung.c
3 * DESCRIPTION:
4 * Simple example file
5 * Compile: cc -g spinhung.c -o spinhung
6 *
7 ****************************************************************************/
8
9 main() {
10
11 int i, j, x;
12
13 i=99;
14 > while (i < 100) {
15 x = 2*i;
16 j = i;
17 }
18
19 }
Resume execution and note where program is hung
d1.<> dgo
d1.<> dwhere
> 0 main PC=0x10000340, FP=0x2ff22530 [/g/g0/blaise/totalview/spinhung.c#15]
1 .__start PC=0x100001d8, FP=0x2ff22580 [/g/g0/blaise/totalview/spinhung]
Halt the program and "fix" the bug
d1.<> dhalt
d1.<> Thread 1.1 stopped: Stop Signal
d1.<> dassign i 101
Resume execution and prove that the program exits to completion
d1.<> dgo
d1.<> Process 1 has exited
d1.<> dwhere
dwhere: Focus thread was not found in process 1
Quit the CLI and return to the shell
d1.<> quit
Do you really wish to exit TotalView? : y
%
This concludes TotalView Part 2
Where would you like to go now?