30.01.2013 Views

TotalView Users Guide - CI Wiki

TotalView Users Guide - CI Wiki

TotalView Users Guide - CI Wiki

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Setting the Program Counter<br />

some code again after changing certain variables, or restart a thread that is<br />

in an error state.<br />

Setting the PC can be crucial when you want to restart a thread that is in an<br />

error state. Although the PC symbol in the line number area points to the<br />

source statement that caused the error, the PC actually points to the failed<br />

machine instruction in the source statement. You need to explicitly reset<br />

the PC to the correct instruction. (You can verify the actual location of the<br />

PC before and after resetting it by displaying it in the Stack Frame Pane, or<br />

displaying both source and assembler code in the Source Pane.)<br />

In <strong>TotalView</strong>, you can set the PC of a stopped thread to a selected source<br />

line or a selected instruction. When you set the PC to a selected line, the<br />

PC points to the memory location where the statement begins. For most<br />

situations, setting the PC to a selected line of source code is all you need<br />

to do.<br />

To set the PC to a selected line:<br />

1 If you need to set the PC to a location somewhere in a line of source code,<br />

select the View > Source As > Both command.<br />

<strong>TotalView</strong> responds by displaying assembler code.<br />

2 Select the source line or instruction in the Source Pane.<br />

<strong>TotalView</strong> highlights the line.<br />

3 Select the Thread > Set PC command.<br />

<strong>TotalView</strong> asks for confirmation, resets the PC, and moves the PC symbol<br />

to the selected line.<br />

When you select a line and ask <strong>TotalView</strong> to set the PC to that line,<br />

<strong>TotalView</strong> attempts to force the thread to continue execution at that statement<br />

in the currently selected stack frame. If the currently selected stack<br />

frame is not the top stack frame, <strong>TotalView</strong> asks if it can unwind the stack:<br />

This frame is buried. Should we attempt to unwind the<br />

stack?<br />

If you select Yes, <strong>TotalView</strong> discards deeper stack frames (that is, all stack<br />

frames that are more deeply nested than the selected stack frame) and<br />

resets the machine registers to their values for the selected frame. If you<br />

select No, <strong>TotalView</strong> sets the PC to the selected line, but it leaves the stack<br />

and registers in their current state. Since you can’t assume that the stack<br />

and registers have the right values, selecting No is almost always the wrong<br />

thing to do.<br />

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

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

Saved successfully!

Ooh no, something went wrong!