HomeContentsPreviousNextIndex

Debugging a Program With dbx Sun Microsystems

Contents

 Preface

1.  Starting dbx

Starting a Debugging Session
Debugging an Existing Core File
Using the Process ID
The dbx Start-up Sequence
Setting Startup Properties
Mapping With the pathmap Command
Setting Environment Variables With the dbxenv Command
Creating Your Own dbx Commands Using the alias Command
Compiling a Program for Debugging
Debugging Optimized Code
Code Compiled Without the -g Option
Shared Libraries Require the -g Option for Full dbx Support
Completely Stripped Programs
Quitting Debugging
Stopping a Process Execution
Detaching a Process From dbx
Killing a Program Without Terminating the Session
Saving and Restoring a Debugging Run
Using the save Command
Saving a Series of Debugging Runs as Checkpoints
Restoring a Saved Run
Saving and Restoring Using replay

2.  Customizing dbx

Using the .dbxrc File
Creating a .dbxrc File
Initialization File Sample
The dbx Environment Variables and the Korn Shell
Customizing dbx in Sun WorkShop
Setting Debugging Options
Maintaining a Unified Set of Options
Maintaining Two Sets of Options
Storing Custom Buttons
Setting dbx Environment Variables With the dbxenv Command

3.  Viewing and Visiting Code

Mapping to the Location of the Code
Visiting Code
Visiting a File
Visiting Functions
Printing a Source Listing
Walking the Call Stack to Visit Code
Qualifying Symbols With Scope Resolution Operators
Backquote Operator
C++ Double Colon Scope Resolution Operator
Block Local Operator
Linker Names
Scope Resolution Search Path
Locating Symbols
Printing a List of Occurrences of a Symbol
Determining Which Symbol dbx Uses
Viewing Variables, Members, Types, and Classes
Looking Up Definitions of Variables, Members, and Functions
Looking Up Definitions of Types and Classes
Using the Auto-Read Facility
Debugging Without the Presence of .o Files
Listing Debugging Information for Modules
Listing Modules

4.  Controlling Program Execution

Running a Program
Attaching dbx to a Running Process
Detaching dbx From a Process
Stepping Through a Program
Single Stepping
Continuing Execution of a Program
Calling a Function
Using Ctrl+C to Stop a Process

5.  Setting Breakpoints and Traces

Setting Breakpoints
Setting a stop Breakpoint at a Line of Source Code
Setting a stop Breakpoint in a Function
Setting a when Breakpoint at a Line
Setting a Breakpoint in a Dynamically Linked Library
Setting Multiple Breaks in C++ Programs
Tracing Code
Setting a Trace
Controlling the Speed of a Trace
Listing and Clearing Event Handlers
Listing Breakpoints and Traces
Deleting Specific Breakpoints Using Handler ID Numbers
Watchpoints
Faster modify Event
Setting Breakpoint Filters
Efficiency Considerations

6.  Event Management

Event Handlers
Creating Event Handlers
Manipulating Event Handlers
Using Event Counters
Setting Event Specifications
Breakpoint Event Specifications
Watchpoint Event Specifications
System Event Specifications
Execution Progress Event Specifications
Other Event Specifications
Event Specification Modifiers
Parsing and Ambiguity
Using Predefined Variables
Variables Valid for when Command
Variables Valid for Specific Events
Setting Event Handler Examples
Setting a Watchpoint for Store to an Array Member
Implementing a Simple Trace
Enabling a Handler While Within a Function (in func)
Determining the Number of Lines Executed
Determining the Number of Instructions Executed by a Source Line
Enabling a Breakpoint After An Event Occurs
Resetting Application Files for replay
Checking Program Status
Catch Floating Point Exceptions

7.  Using the Call Stack

Finding Your Place on the Stack
Walking the Stack and Returning Home
Moving Up and Down the Stack
Moving Up the Stack
Moving Down the Stack
Moving to a Specific Frame
Popping the Call Stack
Hiding Stack Frames

8.  Evaluating and Displaying Data

Evaluating Variables and Expressions
Verifying Which Variable dbx Uses
Variables Outside the Scope of the Current Function
Printing the Value of a Variable or an Expression
Printing C++
Dereferencing Pointers
Monitoring Expressions
Turning Off Display (Undisplay)
Assigning a Value to a Variable
Evaluating Arrays
Array Slicing
Slices
Strides

9.  Using Runtime Checking

Capabilities of Runtime Checking
When to Use Runtime Checking
Runtime Checking Requirements
Limitations
Using Runtime Checking
Turning On Memory Use and Memory Leak Checking
Turning On Memory Access Checking
Turning On All Runtime Checking
Turning Off Runtime Checking
Running Your Program
Using Access Checking (SPARC only)
Understanding the Memory Access Error Report
Memory Access Errors
Using Memory Leak Checking
Detecting Memory Leak Errors
Possible Leaks
Checking for Leaks
Understanding the Memory Leak Report
Fixing Memory Leaks
Using Memory Use Checking
Suppressing Errors
Types of Suppression
Suppressing Error Examples
Default Suppressions
Using Suppression to Manage Errors
Using Runtime Checking on a Child Process
Using Runtime Checking on an Attached Process
Using Fix and Continue With Runtime Checking
Runtime Checking Application Programming Interface
Using Runtime Checking in Batch Mode
bcheck Syntax
bcheck Examples
Enabling Batch Mode Directly From dbx
Troubleshooting Tips
Runtime Checking's 8 Megabyte Limit
Runtime Checking Errors
Access Errors
Memory Leak Errors

10.  Data Visualization

Specifying Proper Array Expressions
Graphing an Array
Getting Ready
Multiple Ways to Graph an Array
Automatic Updating of Array Displays
Changing Your Display
Analyzing Visualized Data
Scenario 1: Comparing Different Views of the Same Data
Scenario 2: Updating Graphs of Data Automatically
Scenario 3: Comparing Data Graphs at Different Points in a Program
Scenario 4: Comparing Data Graphs from Different Runs of the Same Program
Fortran Program Example
C Program Example

11.  Fixing and Continuing

Using Fix and Continue
How fix and continue Operates
Modifying Source Using Fix and Continue
Fixing Your Program
Continuing After Fixing
Changing Variables After Fixing
Modifying a Header File
Fixing C++ Template Definitions

12.  Debugging Multithreaded Applications

Understanding Multithreaded Debugging
Thread Information
Viewing the Context of Another Thread
Viewing the Threads List
Resuming Execution
Understanding LWP Information

13.  Debugging Child Processes

Attaching to Child Processes
Following the exec Function
Following the fork Function
Interacting with Events

14.  Working With Signals

Understanding Signal Events
Catching Signals
Changing the Default Signal Lists
Trapping the FPE Signal
Sending a Signal in a Program
Automatically Handling Signals

15.  Debugging C++

Using dbx with C++
Exception Handling in dbx
Commands for Handling Exceptions
Examples of Exception Handling
Debugging With C++ Templates
Template Example
Commands for C++ Templates

16.  Debugging Fortran Using dbx

Debugging Fortran
Current Procedure and File
Uppercase Letters
Optimized Programs
Sample dbx Session
Debugging Segmentation Faults
Using dbx to Locate Problems
Locating Exceptions
Tracing Calls
Working With Arrays
Fortran 95 Allocatable Arrays
Showing Intrinsic Functions
Showing Complex Expressions
Showing Logical Operators
Viewing Fortran 95 Derived Types
Pointer to Fortran 95 Derived Type

17.  Debugging at the
Machine-Instruction Level

Examining the Contents of Memory
Using the examine or x Command
Using the dis Command
Using the listi Command
Stepping and Tracing at Machine-Instruction Level
Single Stepping at the Machine-Instruction Level
Tracing at the Machine-Instruction Level
Setting Breakpoints at the Machine-Instruction Level
Setting a Breakpoint at an Address
Using the adb Command
Using the regs Command
Platform-Specific Registers
Intel Register Information

18.  Using dbx With the Korn Shell

ksh-88 Features Not Implemented
Extensions to ksh-88
Renamed Commands

19.  Debugging Shared Libraries

Dynamic Linker
Link Map
Startup Sequence and .init Sections
Procedure Linkage Tables
Debugging Support for Preloaded Shared Objects
Fix and Continue
Setting a Breakpoint in a Dynamically Linked Library

A.  Modifying a Program State

Impacts of Running a Program Under dbx
Commands That Alter the State of the Program
assign Command
pop Command
call Command
print Command
when Command
fix Command
cont at Command

 Index


Sun Microsystems, Inc.
Copyright information. All rights reserved.
Feedback
Library   |   Contents   |   Previous   |   Next   |   Index