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.

}<br />

}<br />

Automatically Setting Breakpoints<br />

# If "*/" is found, add the text to "code",<br />

# then leave the loop. Otherwise, add the<br />

# text, and continue looping.<br />

if [regexp "(.*)\\*/" $interiorline \<br />

all interiorcode]{<br />

append code \n $interiorcode<br />

break<br />

} else {<br />

append code \n $interiorline<br />

}<br />

}<br />

dbreak $fname\#$bpline –e $code<br />

continue<br />

# Look for a breakpoint.<br />

if [regexp "/\\* STOP: .*" $line] {<br />

dbreak $fname\#$bpline<br />

continue<br />

}<br />

# Look for a command to be executed by Tcl.<br />

if [regexp "/\\* *CMD: *(.*)\\*/" $line all cmd] {<br />

puts "CMD: [set cmd]"<br />

eval $cmd<br />

}<br />

}<br />

close $fsource<br />

The only similarity between this macro and the previous three is that<br />

almost all of the statements are Tcl. The only purely CLI commands are the<br />

instances of the dbreak command that set eval points and breakpoints.<br />

The following excerpt from a larger program shows how to embed comments<br />

in a source file that is read by the make_actions macro:<br />

...<br />

struct struct_bit_fields_only {<br />

unsigned f3 : 3;<br />

unsigned f4 : 4;<br />

unsigned f5 : 5;<br />

unsigned f20 : 20;<br />

unsigned f32 : 32;<br />

} sbfo, *sbfop = &sbfo;<br />

...<br />

int main()<br />

{<br />

struct struct_bit_fields_only *lbfop = &sbfo;<br />

...<br />

int i;<br />

int j;<br />

sbfo.f3 = 3;<br />

sbfo.f4 = 4;<br />

sbfo.f5 = 5;<br />

sbfo.f20 = 20;<br />

sbfo.f32 = 32;<br />

...<br />

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

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

Saved successfully!

Ooh no, something went wrong!