User`s guide

1
Chapter 1
1. Getting Started With dbx
You can use dbx to trace problems in a program at the source code level,
rather than at the machine code level. dbx enables you to control a program’s
execution, symbolically monitoring program control flow, variables, and
memory locations. You can also use dbx to trace the logic and flow of control
to acquaint yourself with a program written by someone else.
This chapter introduces some basic dbx commands and discusses some tips
about how to approach a debugging session. Specifically, this chapter covers:
“Examining Core Dumps to Determine Cause of Failure”
“Debugging Your Programs”
“Studying a New Program”
“Avoiding Common Pitfalls”
Examining Core Dumps to Determine Cause of Failure
Even if your program compiles successfully, it still can crash when you try
to run it. When a program crashes, it generates a terminating signal that
instructs the system to write out to a core file. The core file is the memory
image of the program at the time it crashed.
You can examine the core file with dbx to determine at what point your
program crashed. To determine the point of failure, follow these steps:
1. If the core file is not in the current directory, specify the pathname of the
core file on the dbx command line.
Note: If the source code for the program is on a different machine or the
source was moved, provide dbx with the pathname to search for source
code (also see “Specifying Source Directories” on page 13).