Command-Line Utilities
Contents
Preface
1. A dbx Overview
2. Starting dbx
- Basic Concepts
- Starting a Debugging Session
- dbx Start-up Sequence
- If a Core File Exists
- Process ID
- Setting Startup Properties
- pathmap
- dbxenv
- alias
- Debugging Optimized Code
- Compiling with the -g Option
- Code Compiled Without the -g Option
- Shared Libraries Need -g for Full dbx Support
- C++ Support and the -g Option
- Completely Stripped Programs
- Quitting Debugging
- Stopping Execution
- Detaching a Process From dbx
- Killing a Program Without Terminating the Session
- Saving and Restoring a Debugging Run
- save
- Saving a Series of Debugging Runs as Checkpoints
- Restoring a Saved Run
- Saving and Restoring using replay
- Command Reference
- Syntax
- Start-up Options
3. Viewing and Visiting Code
- Basic Concepts
- 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 Types and Classes
- Using the Auto-Read Facility
- Disabling Auto-Read with the -xs Compiler Option
- Listing Modules
- Command Reference
- modules
- whatis
- list
4. Controlling Program Execution
- Basic Concepts
- Running a Program in dbx
- Attaching dbx to a Running Process
- Detaching a Process from dbx
- Executing a Program
- Calling a Function
- Continuing a Program
- Using Ctrl+C to Stop a Process
- Command Summary
- run
- rerun
- next
- cont
- step
- debug
- detach
5. Examining the Call Stack
- Basic Concepts
- Finding Your Place on the Stack
- Walking the Stack and Returning Home
- Moving Up and Down the Stack
- Command Reference
- where
- hide/unhide
6. Evaluating and Displaying Data
- Basic Concepts
- Evaluating Variables and Expressions
- Verifying Which Variable dbx Uses
- Variables Outside the Scope of the Current Function
- Printing C++
- Dereferencing Pointers
- Monitoring Expressions
- Turning Off Display (Undisplay)
- Assigning a Value to a Variable
- Evaluating Arrays
- Array Slicing for Arrays
- Syntax for Array Slicing and Striding
- Command Reference
- print
7. Setting Breakpoints and Traces
- Basic Concepts
- Setting Breakpoints
- Setting a stop Breakpoint at a Line of Source Code
- Setting a when Breakpoint at a Line
- Setting a Breakpoint in a Dynamically Linked Library
- Setting Multiple Breaks in C++ Programs
- Tracing Code
- Setting trace Commands
- Controlling the Speed of a Trace
- Listing and Clearing Event Handlers
- Listing Breakpoints and Traces
- Deleting Specific Breakpoints Using Handler ID Numbers
- Watchpoints
- The Faster modify Event
- Setting Breakpoint Filters
- Efficiency Considerations
8. Event Management
- Basic Concepts
- Creating Event Handlers
- when
- stop
- trace
- Manipulating Event Handlers
- Using Event Counters
- Setting Event Specifications
- Event Specifications
- Event Specification Modifiers
- Parsing and Ambiguity
- Using Predefined Variables
- Event-Specific Variables
- Valid Variables
- Examples
- Set Watchpoint for Store to Array Member
- Simple Trace
- Enable Handler While Within the Given Function (in func)
- Determine the Number of Lines Executed in a Program
- Determine the Number of Instructions Executed by a Source Line
- Enable Breakpoint after Event Occurs
- Set Automatic Breakpoints for dlopen Objects
- Reset Application Files for replay
- Check Program Status
- Catch Floating Point Exceptions
- Command Reference
- when
- stop
- step
- cancel
- status
- delete
- clear
- handler
9. Using Runtime Checking
- Basic Concepts
- When to Use RTC
- Requirements
- Limitations
- Using RTC
- 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
- Default Suppressions
- Using Suppression to Manage Errors
- Using RTC on a Child Process
- Using RTC on an Attached Process
- Using Fix & Continue With RTC
- Runtime Checking Application Programming Interface
- Using RTC in Batch Mode
- Troubleshooting Tips
- RTC's 8 Megabyte Limit
- rtc_patch_area
- Command Reference
- check|uncheck
- showblock
- showleaks
- showmemuse
- suppress|unsuppress
- Error Type Location Specifier
- RTC Errors
- dbxenv Variables
10. Using fix and continue
- Basic Concepts
- How fix and continue Operates
- Modifying Source Using fix and continue
- Fixing Your Program
- Continuing after Fixing
- Changing Variables after Fixing
- Command Reference
11. Collecting Data
- Basic Concepts
- Using the Collector
- Profiling
- Collecting Data for Multithreaded Applications
- Command Reference
12. Debugging Multithreaded Applications
- Basic Concepts
- Understanding Multithreaded Debugging
- Thread Information
- Viewing the Context of Another Thread
- Viewing the Threads List
- Resuming Execution
- Understanding LWP Information
- Command Reference
- thread
- threads
- Thread and LWP States
13. Customizing dbx
- Using .dbxrc
- A Sample Initialization File
- Command Reference
14. Debugging at the Machine-Instruction Level
- Examining the Contents of Memory
- Using the examine or x Command
- Addresses
- Formats
- Count
- Examples
- Using the dis Command
- Using the listi Command
- Stepping and Tracing at Machine-Instruction Level
- Single-Stepping the Machine-Instruction Level
- Tracing at the Machine-Instruction Level
- Setting Breakpoints at Machine-Instruction Level
- Setting a Breakpoint at an Address
- Using the adb Command
- Using the regs Command
- Platform-specific Registers
- SPARC Register Information
- Intel Register Information
- PowerPC Register Information
15. Debugging Child Processes
- Attaching to Child Processes
- Following the exec
- Following fork
- Interacting with Events
16. 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
17. Debugging C++
- Using dbx with C++
- Exception Handling in dbx
- Debugging With C++ Templates
- Template Example
- Command Reference
- Commands for Handling Exceptions
- Commands for C++ Exceptions
18. Debugging Fortran Using dbx
- Debugging Fortran
- Current Procedure and File
- Uppercase Letters (Fortran 77 only)
- Optimized Programs
- Sample dbx Session
- Debugging Segmentation Faults
- Using dbx to Locate Problems
- Locating Exceptions
- Tracing Calls
- Working With Arrays
- Fortran 90 Allocatable Arrays
- Slicing Arrays
- dbxShowing Intrinsic Functions
- dbxShowing Complex Expressions
- dbxShowing Logical Operators
- Viewing Fortran 90 Derived Types
- Pointer to Fortran 90 Derived Type
- Fortran 90 Generic Functions
19. dbx and the Dynamic Linker
- Basic Concepts
- Debugging Support for Shared Objects
- Startup Sequence
- Startup Sequence and .init Sections
- dlopen() and dlclose()
- fix and continue
- Procedure Linkage Tables (PLT)
- Setting a Breakpoint in a Dynamically Linked Library
- Three Exceptions
20. Using the KornShell
- Features of ksh-88 not Implemented
- Extensions to ksh-88
- Renamed Commands
21. Modifying a Program State
- Basic Concepts
- Using Commands
- assign
- pop
- call
- print
- when
- fix
- cont at
22. User Tips
- Using dbx Equivalents for Common GDB Commands
- Reviewing dbx Changes
- Using the .dbxinit File
- Alias Definition
- The Symbols / and ?
- Embedded Slash Command
- Using assign Instead of set
- Enabling Command-Line Editing
- Being In Scope
- Locating Files
- Reaching Breakpoints
- C++ member and whatis Command
- Runtime Checking 8Megabyte Limit
- Locating Floating-Point Exceptions with dbx
- Using dbx with Multithreaded Programs
- Thread Numbering
- LWP Numbering
- Breakpoints on a Specific Thread
- dbx Identification of Multithreaded Applications
- The Collector, RTC, fix and continue, and Watchpoints
- Multithreaded Pitfalls
- Sleeping Threads
- thr_join, thr_create(),and thr_exit
23. Using LoopReport
- Basic Concepts
- Setting Up Your Environment
- Creating a Loop Timing File
- Starting LoopReport
- Timing File
- Other Compilation Options
- -xexplicitpar
- -xloopinfo
- Fields in the Loop Report
- Understanding Compiler Hints
- Compiler Optimizations and How They Affect Loops
- Inlining
- Loop Transformations -- Unrolling, Jamming, Splitting, and Transposing
- Parallel Loops Nested Inside Serial Loops
24. Using LockLint
- Basic Concepts
- LockLint Overview
- Collecting Information for LockLint
- LockLint User Interface
- How to Use LockLint
- Managing LockLint's Environment
- Compiling Code
- LockLint Subcommands
- Suggested Approach for Checking an Application
- Program Knowledge Management
- Analysis
- Limitations of LockLint
- Source Code Annotations
- Assertions and NOTEs
- Why Use Source Code Annotations?
- The Annotations Scheme
- LockLint NOTEs
- Assertions Recognized by LockLint
- Command Reference
- Subcommand Summary
- Exit Status of LockLint Subcommands
- Naming Conventions
- LockLint Subcommands
- Inversions
25. Browsing Source With sbquery
- Basic Concepts
- Command Reference
- Filter Language Options
- Focus Options
- Environment Variables
26. Controlling the Browser Database With .sbinit
- Basic Concepts
- Moving the .sbinit File
- File Commands
- Command Reference
- import
- export
- replacepath
- automount-prefix
- cleanup-delay
27. Collecting Browsing Information With sbtags
- Basic Concepts
- Generating an sbtags Database
28. Using twmerge
- Understanding Merging
- Starting twmerge
- Loading Two Files at Startup
- Loading Three Files at Startup
- Loading Files from a List File
- Working with Differences
- Current, Next, and Previous Difference
- Resolved and Remaining Difference
- Moving Between Differences
- Resolving Differences
- Understanding Glyphs
- Comparing Three Input Files
- Merging Automatically
- Saving the Output File
- Command Reference
- Usage
- Options
Index