Reference Guide New Features Installation, Transformations, Release Notes

What About Print Statements?

Most programmers learned to debug by using print statements. That is, you load your program with printf() or PRINT statements and then inspect what gets written. There's a problem with this. Every time you want to add a new statement, you've got to recompile your program. What's worse is that in a multiprocess, multithreaded program, what you want printed may not print in the right order. While TotalView is much more sophisticated than this about showing your data (as you'll soon see), you can even use print statements simply.

In TotalView, breakpoints are called "action points". This is because they can be much more powerful than what you're used to. So, if you don't want to change the way you've been debugging, you can add your breakpoints easily. The following figure shows the Action Point Properties Dialog Box. The easiest way to display this dialog box is to right-click on a line and then select Properties in the context menu. This menu is shown in the previous figure.

Action Point Properties Dialog Box

After clicking on the Evaluate radio button, you can add any code you want to a breakpoint. Because there's code associated with this breakpoint, it is now called an "eval point." Here's where TotalView does things a little differently. When the eval point is reached, TotalView executes the code, which prints the value of i. Eval points do exactly what you tell them to do. In this case, because you didn't tell TotalView to stop executing, it keeps on going. In other words, you don't have to stop program execution just to see data. You can, of course, tell TotalView to stop. Here are two evaluation points that stop execution. (One of them does something else as well.)

More Conditions

The one in the foreground uses a programming language statements and a built-in TotalView function to stop a loop every 100 iterations. It also prints what the value of i is. The one in the background just stops the program every 100 times a statement gets executed.

Evaluation points even allow you to patch your programs and route around code that you want replaced. The evaluation point shown in the following figure tells TotalView to execute three statements and then skip to line 658.  

Patching Using an Evaluation Point

 
 
 
Select a section: 
 
documentation@etnus.com
Copyright © 2003, Etnus, Inc. All rights reserved.
Version 6.2