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.

Using Watchpoints<br />

Platform Assembler Code<br />

IBM AIX .csect .data{RW}, 3<br />

.globl TVDB_patch_base_address<br />

.globl TVDB_patch_end_address<br />

TVDB_patch_base_address:<br />

.space PATCH_SIZE<br />

TVDB_patch_end_address:<br />

SGI IRIX .data<br />

.align 3<br />

.globl TVDB_patch_base_address<br />

.globl TVDB_patch_end_address<br />

TVDB_patch_base_address:<br />

.space PATCH_SIZE<br />

TVDB_patch_end_address:<br />

To use the static patch space assembler code:<br />

1 Use an AS<strong>CI</strong>I editor and place the assembler code into a file named<br />

tvdb_patch_space.s.<br />

2 Replace the PATCH_SIZE tag with the decimal number of bytes you want.<br />

This value must be a multiple of 8.<br />

3 Assemble the file into an object file by using a command such as:<br />

cc –c tvdb_patch_space.s<br />

On SGI IRIX, use –n32 or –64 to create the correct object file type.<br />

4 Link the resulting tvdb_patch_space.o into your program.<br />

Using Watchpoints<br />

<strong>TotalView</strong> lets you monitor the changes that occur to memory locations by<br />

creating a special type of action point called a watchpoint. You most often<br />

use watchpoints to find a statement in your program that is writing to<br />

places to which it shouldn’t be writing. This can occur, for example, when<br />

processes share memory and more than one process writes to the same<br />

location. It can also occur when your program writes off the end of an array<br />

or when your program has a dangling pointer.<br />

Topics in this section are:<br />

� “Using Watchpoints on Different Architectures” on page 374<br />

� “Creating Watchpoints” on page 375<br />

� “Watching Memory” on page 377<br />

� “Triggering Watchpoints” on page 377<br />

� “Using Conditional Watchpoints” on page 378<br />

<strong>TotalView</strong> watchpoints are called modify watchpoints because <strong>TotalView</strong> only<br />

triggers a watchpoint when your program modifies a memory location. If a<br />

program writes a value into a location that is the same as what is already<br />

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

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

Saved successfully!

Ooh no, something went wrong!