Debugging a Program With dbx | ![]() ![]() ![]() ![]() ![]() |
Preface
dbx
is an interactive, source-level, command-line debugging tool. Debugging a Program With dbx is intended for programmers with a working knowledge of Fortran, C, or C++, and some understanding of the SolarisTM operating environment and UNIX® commands, who want to debug an application usingdbx
commands. It includes references to how the same debugging operations can be performed using the Sun WorkShop Debugging window.Multiplatform Release
This Sun WorkShop release supports versions 2.6, 7, and 8 of the SolarisTM SPARCTM Platform Edition and Solaris Intel Platform Edition Operating Environments.
Note The term "x86" refers to the Intel 8086 family of microprocessor chips, including the Pentium, Pentium Pro, and Pentium II processors and compatible microprocessor chips made by AMD and Cyrix. In this document, the term "x86" refers to the overall platform architecture, whereas "Intel Platform Edition" appears in the product name.
Access to Sun WorkShop Development Tools
Because Sun WorkShop product components and man pages do not install into the standard
/usr/bin/
and/usr/share/man
directories, you must change yourPATH
andMANPATH
environment variables to enable access to Sun WorkShop compilers and tools.To determine if you need to set your
PATH
environment variable:1. Display the current value of thePATH
variable by typing:
%
echo $PATH
2. Review the output for a string of paths containing/opt/SUNWspro/bin/
.
- If you find the paths, your
PATH
variable is already set to access Sun WorkShop development tools. If you do not find the paths, set yourPATH
environment variable by following the instructions in this section.To determine if you need to set your
MANPATH
environment variable:1. Request theworkshop
man page by typing:
%
man workshop
2. Review the output, if any.
- If the
workshop
(1) man page cannot be found or if the man page displayed is not for the current version of the software installed, follow the instructions in this section for setting yourMANPATH
environment variable.
Note The information in this section assumes that your Sun WorkShop 6 products were installed in the/opt
directory. Contact your system administrator if your Sun WorkShop software is not installed in/opt
.
The
PATH
andMANPATH
variables should be set in your home.cshrc
file if you are using the C shell or in your home.profile
file if you are using the Bourne or Korn shells:
- To use Sun WorkShop commands, add the following to your
PATH
variable:
/opt/SUNWspro/bin
- To access Sun WorkShop man pages with the
man
command, add the following to yourMANPATH
variable:
/opt/SUNWspro/man
For more information about the
PATH
variable, see the csh(1), sh(1), and ksh(1) man pages. For more information about theMANPATH
variable, see the man(1) man page. For more information about setting yourPATH
andMANPATH
variables to access this release, see the Sun WorkShop 6 Installation Guide or your system administrator.How This Book Is Organized
Debugging a Program With dbx contains the following chapters and appendixes:
Chapter 1, "Starting dbx," describes how to start a debugging session, discusses compilation options, and tells you how to save all or part of session and replay it later.
Chapter 2, "Customizing dbx," describes how to set
dbx
environment variables to customize 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," tells you about visiting source files and functions; locating symbols; and looking up variables, members, types, and classes.
Chapter 4, "Controlling Program Execution," describes how to run, attach to, detach from, continue execution of, stop, and rerun a program under
dbx
. It also tells you 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," tells you how to manage events, and describes how
dbx
can perform specific actions when specific events occur in the program you are debugging.Chapter 7, "Using the Call Stack," tells you how to examine the call stack and how to debug a core file.
Chapter 8, "Evaluating and Displaying Data," shows you how to evaluate data; display the values of expressions, variables, and other data structures; and assign values to variables.
Chapter 9, "Using Runtime Checking," describes how to use runtime checking to detect memory leak and memory access errors in your program automatically.
Chapter 10, "Data Visualization," tells you how to display your data graphically as you debug your program.
Chapter 11, "Fixing and Continuing," describes the fix and continue feature of dbx that allows you to modify and recompile a source file and continue executing without rebuilding your entire program.
Chapter 12, "Debugging Multithreaded Applications," tells you how to find information about threads.
Chapter 13, "Debugging Child Processes," describes several
dbx
facilities that help you debug child processes.Chapter 14, "Working With Signals," tells you how to use
dbx
to work with signals.Chapter 15, "Debugging C++," describes dbx support of C++ templates, and the commands available for handling C++ exceptions and how
dbx
handles these exceptions.Chapter 16, "Debugging Fortran Using dbx,"introduces some of the
dbx
facilities you can use to debug a Fortran program.Chapter 17, "Debugging at the Machine-Instruction Level," tells you how to use event management and execution control command at the machine-instruction level, how to display the contents of memory at specific addresses, and how to display source code lines along with their corresponding machine instructions.
Chapter 18, "Using dbx With the Korn Shell," explains the differences between ksh-88 and
dbx
commands.Chapter 19, "Debugging Shared Libraries," describes
dbx
support for program that use dynamically linked, shared libraries.Appendix A, "Modifying a Program State," focuses on
dbx
commands that change your program or its behavior when you run it underdbx
.Typographic Conventions
TABLE P-1
shows the typographic conventions that are used in Sun WorkShop documentation.
Shell Prompts
TABLE P-2 shows the default system prompt and superuser prompt for the C shell, Bourne shell, and Korn shell.
TABLE P-2 Shell Prompts C shell %
Bourne shell and Korn shell $
C shell, Bourne shell, and Korn shell superuser #
Related Documentation
You can access documentation related to the subject matter of this book in the following ways:
- Through the Internet at the
docs.sun.com
sm Web site. You can search for a specific book title or you can browse by subject, document collection, or product at the following Web site:
http://docs.sun.com
- Through the installed Sun WorkShop products on your local system or network. Sun WorkShop 6 HTML documents (manuals, online help, man pages, component readme files, and release notes) are available with your installed Sun WorkShop 6 products. To access the HTML documentation, do one of the following:
- In any Sun WorkShop or Sun WorkShopTM TeamWare window, choose Help
About Documentation.
- In your NetscapeTM Communicator 4.0 or compatible version browser, open the following file:
- (Contact your system administrator if your Sun WorkShop software is not installed in the
/opt
directory.) Your browser displays an index of Sun WorkShop 6 HTML documents. To open a document in the index, click the document's title.TABLE P-3 lists related Sun WorkShop 6 manuals by document collection.
TABLE P-4 describes related Solaris documentation available through the
docs.sun.com
Web site.
Sun Microsystems, Inc. Copyright information. All rights reserved. Feedback |
Library | Contents | Previous | Next | Index |