HPlogo HP/DDE Debugger User's Guide: HP 9000 Series 700/800 Computers > Chapter 2 Compiling, Loading, and Executing the Target Program

Preparing the Target Program

» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Glossary

 » Index

To prepare a target program for debugging, compile the program using the compiler's option for debugging, usually -g. A compiler's debugging option causes it to add information needed by the debugger to the program's object file. For example:

$ cc -g average.c

You can find average.c, a sample program that you can practice on, in the directory /opt/langtools/dde/examples. In that directory, you can also find sources for average in FORTRAN, C++, and Pascal.

If you attempt to debug a program that was compiled without the debugging option, the debugger displays a message similar to the following:

(Warning) Object file has no debug information.
Limited debugging will be available.

Some of the limitations on debugging code compiled without the -g option are:

  • You can access the values of global variables but not their descriptions.

  • Line numbers are not available in the Assembly Instructions dialog box.

  • You can set breakpoints on entry points using procedure names, entry point names, and virtual addresses. However, if some modules were compiled with -g and some were compiled without -g, you must use the initialize -altdbinfo command to set breakpoints on those modules compiled without -g. (Use of the initialize -altdbinfo command is not necessary on Solaris systems.)

  • The debugger will not automatically display source code. You can use the use source command to display source code. However, you cannot follow program execution or invoke debugger commands in the source file display area.

Shared libraries, which are often compiled without -g, are a special case. See “Debugging Shared Libraries ” for more information.