30.01.2013 Views

TotalView Users Guide - CI Wiki

TotalView Users Guide - CI Wiki

TotalView Users Guide - CI Wiki

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Using the Evaluate Window<br />

Using the Evaluate Window<br />

<strong>TotalView</strong> lets you open a window to evaluate expressions in the context of<br />

a particular process and evaluate them in C, Fortran, or assembler.<br />

Not all platforms let you use assembler constructs. See “Architectures” in the <strong>TotalView</strong><br />

Reference <strong>Guide</strong> for details.<br />

You can use the Tools > Evaluate Dialog Box in many different ways. The<br />

following are two examples:<br />

� Expressions can contain loops, so you can use a for loop to search an<br />

array of structures for an element set to a certain value. In this case, you<br />

use the loop index at which the value is found as the last expression in<br />

the expression field.<br />

� Because you can call subroutines, you can test and debug a single routine<br />

in your program without building a test program to call it.<br />

Although the CLI does not have an evaluate command, the information in the following<br />

sections does apply to the expression argument of the dbreak, dbarrier, dprint, and<br />

dwatch commands.<br />

To evaluate an expression: Display the Evaluate Dialog Box by selecting the<br />

Tools > Evaluate command.<br />

An Evaluate Dialog Box appears. If your program hasn’t yet been created,<br />

you won’t be able to use any of the program’s variables or call any of its<br />

functions.<br />

1 Select a button for the programming language you’re writing the expression<br />

in (if it isn’t already selected).<br />

2 Move to the Expression field and enter a code fragment. For a description<br />

of the supported language constructs, see “Using Built-in Variables and<br />

Statements” on page 394.<br />

The following figure shows a sample expression. The last statement in this<br />

example assigns the value of my_var1-3 back to my_var1. Because this is<br />

the last statement in the code fragment, the value placed in the Result<br />

field is the same as if you had just typed my_var1-3. (See Figure 242 on<br />

page 390.)<br />

3 Click the Evaluate button.<br />

If <strong>TotalView</strong> finds an error, it places the cursor on the incorrect line and<br />

displays an error message. Otherwise, it interprets (or on some platforms,<br />

compiles and executes) the code, and displays the value of the last<br />

expression in the Result field.<br />

While the code is being executed, you can’t modify anything in the dialog<br />

box. <strong>TotalView</strong> might also display a message box that tells you that it is<br />

waiting for the command to complete. (See Figure 243 on page 390.)<br />

<strong>TotalView</strong> <strong>Users</strong> <strong>Guide</strong>: version 8.7 389

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!