Debugging a Program With dbx

Preface

This manual describes how to use dbx utility to accomplish debugging tasks from the command line.

Who Should Use This Book

This manual is intended for programmers with a working knowledge of Fortran, C, or C++, and some understanding of the Solaris(TM) operating environment and UNIX\256 commands, who want to debug an application uaing dbx commands rather than the Sun(TM) WorkShop(TM) Debugging graphical user interface (GUI). For a discussion of the main development features of Sun WorkShop, including the basics of the Debugging GUI, see Using Sun WorkShop.

How This Book Is Organized

Debugging a Program With dbx contains the following chapters:

Chapter 1, Starting dbx" describes how to start and stop a debugging session, discusses compiling options, and describes how to save all or part of a debugging run and replay it later.

Chapter 2, Customizing dbx" describes how to adjust dbx environment variables to customize certain attributes of your debugging environment, and how to use the initialization file, .dbxrc, to preserve changes and adjustments from session to session.

Chapter 3, Viewing and Visiting Code" covers visiting code, visiting functions, locating symbols and looking up variables, members, types, and classes.

Chapter 4, Controlling Program Execution" describes how to run, attach to, continue, stop, and rerun a program in dbx, and how to single-step through program code.

Chapter 5, Setting Breakpoints and Traces" describes how to set, clear, and list breakpoints and traces, and how to use watchpoints.

Chapter 6, Event Management" describes how to manage events, and describes the general capability of dbx to perform certain actions when certain events take place in the program being debugged.

Chapter 7, Examining the Call Stack" describes how to examine the call stack, and how to debug a core file with the where command

Chapter 8, Evaluating and Displaying Data" shows you how to evaluate data, display the value of expressions, variables, and other data structures, and how to assign a value to an expression."

Chapter 9, Using Runtime Checking" describes how to use runtime checking (RTC), which enables you to automatically detect runtime errors in an application during the development phase.

Chapter 10, Data Visualization" Tells you how to to display your data graphically as you debug your program from Sun WorkShop.

Chapter 11, Fixing and Continuing" describes the fix and continue feature that allows you to modify and recompile a source file and continue executing without rebuilding the entire program.

Chapter 12, Debugging Multithreaded Applications" describes how to find information about threads by using the dbx thread commands.

Chapter 13, Debugging Child Processes" describes several dbx facilities to help you debug processes that create children.

Chapter 14, Working With Signals" describes how to use dbx to work with signals.

Chapter 15, Collecting Data" describes the dbx collector commands you can use to collect performance data.

Chapter 16, Debugging C++" describes dbx's support of C++ templates, and discusses the commands that are available for handling C++ exceptions, and how dbx handles these exceptions.

Chapter 17, Debugging Fortran Using dbx" introduces some dbx features to be used with Fortran.

Chapter 18, Debugging at the Machine-Instruction Level" describes how to use event management and process control commands at the machine-instruction level, how to display the contents of memory at specified addresses, and how to display source lines along with their corresponding machine instructions.

Chapter 19, Using dbx With the Korn Shell" explains differences between ksh-88 and dbx command language.

Chapter 20, Debugging Shared Libraries" describes dbx's debugging support for programs that use dynamically-linked, shared libraries.

Appendix A, Modifying a Program State" focuses on dbx usage and commands that change your program or change the behavior of your program as compared to running it without dbx.

Appendix B, Incremental Link Editor (ild)" describes incremental linking, ild-specific features, example messages, and ild options.

Appendix C, User Tips"provides tips on using various facilities in dbx more effectively.

Multi-Platform Release


Note -

The name of the latest Solaris operating environment release is Solaris 7 but code and path or package path names may use Solaris 2.7 or SunOS 5.7.


The Sun(TM) WorkShop(TM) documentation applies to Solaris 2.5.1, Solaris 2.6, and Solaris 7 operating environments on:

Related Books

The following Sun manuals and guides provide additional useful information.

Other Sun WorkShop Books

Other Programming Books

Solaris Books

The following Solaris manuals and guides provide additional useful information:

Ordering Sun Documents

The SunDocsSM program provides more than 250 manuals from Sun Microsystems, Inc. If you live in the United States, Canada, Europe, or Japan, you can purchase documentation sets or individual manuals using this program.

For a list of documents and how to order them, see the catalog section of the SunExpress(TM) Internet site at http://www.sun.com/sunexpress.

Accessing Sun Documents Online

Sun WorkShop documentation is available online from several sources:

Using the docs.sun.com Web site

The docs.sun.com Web site enables you to access Sun technical documentation online. You can browse the docs.sun.com archive or search for a specific book title or subject. The URL is http://docs.sun.com.

Accessing AnswerBook2 Collections

The Sun WorkShop documentation is also available using AnswerBook2 software. To access the AnswerBook2 collections, your system administrator must have installed the AnswerBook2 documents during the installation process (if the documents are not installed, see your system administrator or Chapter 3 of Sun WorkShop Quick Install for installation instructions). For information about accessing AnswerBook2 documents, see Chapter 6 of Sun WorkShop Quick Install, Solaris installation documentation, or your system administrator.


Note -

To access AnswerBook2 documents, Solaris 2.5.1 users must first download AnswerBook2 documentation server software from a Sun Web page. For more information, see Chapter 6 of Sun WorkShop Quick Install.


Accessing HTML Documents

The following Sun Workshop documents are available online only in HTML format:

To access these HTML documents:

  1. Open the following file through your HTML browser:

    install-directory/SUNWspro/DOC5.0/lib/locale/C/html/index.html

    Replace install-directory with the name of the directory where your Sun WorkShop software is installed (the default is /opt).

    The browser displays an index of the HTML documents for the Sun WorkShop products that are installed.

  2. Open a document in the index by clicking the document's title.

Accessing Sun WorkShop Online Help and Release Notes

This release of Sun WorkShop includes an online help system as well as online manuals. To find out more see:

What Typographic Changes Mean

The following table describes the typographic changes used in this book.

Table P-1 Typographic Conventions

Typeface or Symbol 

Meaning 

Example 

AaBbCc123

The names of commands, files, and directories; on-screen computer output 

Edit your .login file.

Use ls -a to list all files.

machine_name% You have mail.

 

AaBbCc123

What you type, contrasted with on-screen computer output 

machine_name% su

Password:

AaBbCc123

Command-line placeholder: 

replace with a real name or value 

To delete a file, type rm filename.

AaBbCc123

Book titles, new words or terms, or words to be emphasized 

Read Chapter 6 in User's Guide. These are called class options.

You must be root to do this.

Shell Prompts in Command Examples

The following table shows the default system prompt and superuser prompt for the C shell, Bourne shell, and Korn shell.

Table P-2 System Prompts

Shell 

Prompt 

C shell prompt 

machine_name%

C shell superuser prompt 

machine_name#

Bourne shell and Korn shell prompt 

$

Bourne shell and Korn shell superuser prompt 

#