JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle Solaris Studio 12.2: Debugging a Program With dbx
search filter icon
search icon

Document Information

Preface

1.  Getting Started With dbx

2.  Starting dbx

3.  Customizing dbx

4.  Viewing and Navigating To Code

Navigating To Code

Navigating To a File

Navigating To Functions

Selecting From a List of C++ Ambiguous Function Names

Choosing Among Multiple Occurrences

Printing a Source Listing

Walking the Call Stack to Navigate To Code

Types of Program Locations

Program Scope

Variables That Reflect the Current Scope

Visiting Scope

Components of the Visiting Scope

Changing the Visiting Scope

Qualifying Symbols With Scope Resolution Operators

Backquote Operator

C++ Double Colon Scope Resolution Operator

Block Local Operator

Linker Names

Locating Symbols

Printing a List of Occurrences of a Symbol

Determining Which Symbol dbx Uses

Scope Resolution Search Path

Relaxing the Scope Lookup Rules

Viewing Variables, Members, Types, and Classes

Looking Up Definitions of Variables, Members, and Functions

Looking Up Definitions of Types and Classes

Debugging Information in Object Files and Executables

Object File Loading

Listing Debugging Information for Modules

Listing Modules

Finding Source and Object Files

5.  Controlling Program Execution

6.  Setting Breakpoints and Traces

7.  Using the Call Stack

8.  Evaluating and Displaying Data

9.  Using Runtime Checking

10.  Fixing and Continuing

11.  Debugging Multithreaded Applications

12.  Debugging Child Processes

13.  Debugging OpenMP Programs

14.  Working With Signals

15.  Debugging C++ With dbx

16.  Debugging Fortran Using dbx

17.  Debugging a Java Application With dbx

18.  Debugging at the Machine-Instruction Level

19.  Using dbx With the Korn Shell

20.  Debugging Shared Libraries

A.  Modifying a Program State

B.  Event Management

C.  Command Reference

Index

Finding Source and Object Files

dbx must know the location of the source code files associated with a program. The default directory for the source files is the one they were in when last compiled. If you move the source files, or copy them to a new location, you must either relink the program, change to the new location before debugging, or use the pathmap command.

Under the stabs format used by dbx in Sun Studio 11 and earlier releases, debugging information in dbx sometimes uses object files to load additional debugging information. Source files are used when dbx displays source code.

Symbolic information, including paths to source files, is contained within the executable file. When dbx needs to display source lines, it reads as much symbolic information as necessary to locate the source file, and read and display the lines from it.

The symbolic information includes the full pathname of a source file, but when you type dbx commands, you typically use only the basename of a file. For example:

stop at test.cc:34

dbx searches for a matching file in the symbolic information.

If you have removed source files, dbx cannot show you source lines from those files, but you can display stack traces, print variable values, and even know what source line you are on.

If you have moved the source files since you compiled and linked the program, you can add their new location to the search path. The pathmap command creates a mapping from your current view of the file system to the name in the executable image. The mapping is applied to source paths and object file paths.

To establish a new mapping from the directory from to the directory to:

(dbx) pathmap [-c] from to

If -c is used, the mapping is applied to the current working directory as well.

The pathmap command is also useful for dealing with automounted and explicit NFS mounted file systems with different base paths on differing hosts. Use -c when you try to correct problems due to the automounter because current working directories are inaccurate on automounted file systems.

The mapping of /tmp_mnt to / exists by default.

For more information, see pathmap Command.