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.

Why breakpoints<br />

don’t work<br />

(part 1)<br />

Why breakpoints<br />

don’t work<br />

(part 2)<br />

Why single<br />

stepping doesn’t<br />

work<br />

Why Barrier<br />

points work<br />

Using Barrier Points<br />

Manipulating Processes and Threads<br />

Held/Release State What Can Be Run Using Process > Go<br />

Go to the Threads menu. The button next to the Hold<br />

command isn’t selected. This is because the thread hold state<br />

is independent from the process hold state.<br />

Select it. The circle indicates that thread 1 is held. At this<br />

time, there are two different holds on thread 1. One is at the<br />

process level; the other is at thread level.<br />

Nothing will run when you select Process > Go.<br />

Select the Process > Hold command.<br />

Select Process > Go. The second and third threads run.<br />

Select Process > Release Threads. This releases the hold<br />

placed on the first thread by the Thread > Hold command.<br />

After you select Process > Go, all threads run.<br />

Because threads and processes are often executing different instructions,<br />

keeping threads and processes together is difficult. The best strategy is to<br />

define places where the program can run freely and places where you need<br />

control. This is where barrier points come in.<br />

To keep things simple, this section only discusses multi-process programs.<br />

You can do the same types of operations when debugging multi-threaded<br />

programs.<br />

If you set a breakpoint that stops all processes when it is hit and you let<br />

your processes run using the Group > Go command, you can get lucky and<br />

all of your threads will be at the breakpoint. What’s more likely is that some<br />

processes won’t have reached the breakpoint and <strong>TotalView</strong> will stop them<br />

wherever they happen to be. To get your processes synchronized, you need<br />

to find out which ones didn’t get there and then individually get them to<br />

the breakpoint using the Process > Go command. You can’t use the<br />

Group > Go command since this also runs the processes stopped at the<br />

breakpoint.<br />

If you set the breakpoint’s property so that only the process hitting the<br />

breakpoint stops, you have a better chance of getting processes there.<br />

However, you should not have other breakpoints between where the program<br />

is currently at and this breakpoint. If processes hit these breakpoints,<br />

you are once again left running individual processes to the breakpoint.<br />

Single stepping is just too tedious if you have a long way to go to get to<br />

your synchronization point, and stepping just won’t work if your processes<br />

don’t execute exactly the same code.<br />

If you use a barrier point, you can use the Group > Go command as many<br />

times as it takes to get all of your processes to the barrier, and you won’t<br />

have to worry about a process running past the barrier.<br />

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

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

Saved successfully!

Ooh no, something went wrong!