Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP Itanium-based Systems: HP aC++/HP C Programmer's Guide > Chapter 2 Command-Line Options

Debugging Options

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Glossary

 » Index

Debugging options enable you to use the HP WDB debugger.

Information on HP WDB is available at this location: http://www.hp.com/go/wdb

+d

The +d option prevents the expansion of inline functions. It is useful when you debug code because breakpoints cannot be set at inline functions. Using the +d option disables all inlining. It is mapped to the +inline_level 0 option.

+expand_types_in_diag

The +expand_types_in_diag option expands typedefs in diagnostics so that both the original and final types are present.

-g

The -g option causes the compiler to generate minimal information for the debugger. It uses an algorithm that attempts to reduce duplication of debug information.

To suppress expansion of inline functions, use the +d option.

-g0

The -g0 option causes the compiler to generate full debug information for the debugger.

To suppress expansion of inline functions, use the +d option.

-g1

Like the -g option, the -g1 option causes the compiler to generate minimal information for the debugger. It uses an algorithm that attempts to reduce duplication of debug information. To suppress expansion of inline functions, use the +d option.

Differences Between -g, -g0, and -g1 Options

The -g, -g0, and -g1 options generate debug information. The difference is that the -g0 option emits full debug information about every class referenced in a file, which can result in some redundant information.

The -g and -g1 options emit a subset of this debug information, thereby decreasing the size of your object file. If you compile your entire application with -g or -g1, no debugger functionality is lost.

NOTE: If you compile part of an application with -g or -g1 and part with debug off, (that is, with neither the -g, the -g0, nor the -g1 option) the resulting executable may not contain complete debug information. You will still be able to run the executable, but in the debugger, some classes may appear to have no members.

When to use -g, -g0, and -g1

Use -g or -g1 when you are compiling your entire application with debug on and your application is large, for example, greater than 1 MB.

Use -g0 when either of the following is true:

  • You are compiling only a portion of your application with debug on, for example, a subset of the files in your application.

  • You are compiling your entire application with debug on and your application is not very large, for example, less than 1 MB.

-g, -g1 Algorithm

In general, the compiler looks for the first non-inline, non-pure (non-zero) virtual function in order to emit debug information for a class.If there are no virtual member functions, the compiler looks for the first non-inline member function.

If there are no non-inline member functions, debug information is always generated.

A problem occurs if all functions are inline; in this case, no debug information is generated.

+macro_debug

This option controls the emission of macro debug information into the object file.

Set +macro_debug to one of the following required options:

ref

Emits debug information only for referenced macros. This is the default for -g, -g1, or -g0.

all

Emits debug information for all macros. This option can cause a significant increase in object file size.

none

Does not emit any macro debug information.

One of the -g options (-g, -g0, or -g1) must be used to enable the +macro_debug option.

+[no]objdebug

The +objdebug option generates debug information in object files and not in the executable. The HP WDB debugger then reads the object files to construct debugging information; they must be present when debugging.

The +noobjdebug option generates debug information in object files which the linker places into the executable. The HP WDB debugger then reads the executable to construct debugging information.

NOTE: With +objdebug, the object files or archive libraries must not be removed.

+objdebug is default at link time and at compile time. If +noobjdebug is used at link time, all debug information goes into the executable, even if some objects were compiled with +objdebug.

If +objdebug is used at compile time, extra debug information is placed into each object file to help the debugger locate the object file and to quickly find global types and constants.

Usage:

Use +objdebug option to enable faster links and smaller executable file sizes for large applications, rather than +noobjdebug where debug information is written to the executable.

Use +noobjdebug with the -g, -g0, or -g1 option when using +ild.

+pathtrace

+pathtrace[=kind]

The +pathtrace option provides a mechanism to record program execution control flow into global and/or local path tables. The saved information can be used by the HP WDB debugger to assist with crash path recovery from the core file, or to assist when debugging the program by showing the executed branches.

Currently only if, else, switch-case-default, and try-catch execution paths are recorded in the path table. If there is no condition statement inside a for, while, or do-while loop, then no excution path is recorded.

Usage:

The defined values for kind are:

local

Generates a local path table and records basic block-execution information in it at runtime.

global

Generates a global path table and records basic block-execution information in it at runtime.

global_fixed_size

Generates a fixed-size (65536 items) global path table and records basic block-execution information in it at runtime.

This form differs from +pathtrace=global because the size of the table cannot be configured at runtime, and the contents cannot be dumped to a file. The fixed-size global path table has better runtime performance than the configurable global path table. The performance difference varies depending on the optimization level and how the program is written.

none

Disables generation of both the global and local path tables.

The values can be combined by joining them with a colon. For example:

+pathtrace=global:local

The global_fixed_size and global values are mutually exclusive. If more than one of them are specified on the command line, the last one takes precedence. The same is true for the none value.

+pathtrace with no values is equivalent to +pathtrace=global_fixed_size:local.

The use of this option and the -mt option must be consistent for all compilation and link steps. That means if -mt is used with +pathtrace at compile time, it should also be used at link time; if -mt is not used with +pathtrace at compile time, it should not be used at link time. Otherwise, a link-time error can occur.

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© Hewlett-Packard Development Company, L.P.