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.

Compiling Programs<br />

The first step in getting a program ready for debugging is to add your compiler’s<br />

–g debugging command-line option. This option tells your compiler<br />

to generate symbol table debugging information; for example:<br />

cc –g –o executable source_program<br />

You can also debug programs that you did not compile using the –g option,<br />

or programs for which you do not have source code. For more information,<br />

see “Viewing the Assembler Version of Your Code” on page 171.<br />

The following table presents some general considerations “Compilers and<br />

Platforms in the <strong>TotalView</strong> Reference <strong>Guide</strong> contains additional considerations.<br />

Compiler Option or Library What It Does When to Use It<br />

Debugging symbols option<br />

(usually –g)<br />

Optimization option<br />

(usually –O)<br />

multi-process programming<br />

library (usually dbfork)<br />

Using File Extensions<br />

Generates debugging<br />

information in the symbol<br />

table.<br />

Rearranges code to<br />

optimize your program’s<br />

execution.<br />

Some compilers won’t<br />

let you use the –O option<br />

and the –g option at the<br />

same time.<br />

Even if your compiler<br />

lets you use the –O option,<br />

don’t use it when debugging<br />

your program, since strange<br />

results often occur.<br />

Uses special versions of the<br />

fork() and execve() system<br />

calls.<br />

In some cases, you<br />

need to use the –lpthread<br />

option.<br />

For more information<br />

about dbfork, see “Linking<br />

with the dbfork Library”<br />

contained in the “Compilers<br />

and Platforms” Chapter of<br />

the <strong>TotalView</strong> Reference<br />

<strong>Guide</strong>.<br />

Before debugging any<br />

program with <strong>TotalView</strong>.<br />

After you finish<br />

debugging your program.<br />

Before debugging a multiprocess<br />

program that<br />

explicitly calls fork() or<br />

execve().<br />

See “Debugging<br />

Processes That Call the fork()<br />

Function” on page 361 and<br />

“Debugging Processes that<br />

Call the execve() Function”<br />

on page 361.<br />

When <strong>TotalView</strong> opens a file, it uses the file's extension to determine which<br />

programming language you used. If you are using an unusual extension, you<br />

can manually associate your extension with a programming language by setting<br />

the TV::suffixes variable in a startup file. For more information, see the<br />

“<strong>TotalView</strong> Variables” chapter in the <strong>TotalView</strong> Reference <strong>Guide</strong>.<br />

Your installation may have its own guidelines for compiling programs. Your<br />

site administrator may have made a

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

Saved successfully!

Ooh no, something went wrong!