Order Number: AA-PZ7EE-TE
March 1996
This manual describes how to use the Ladebug debugger (both the graphical user interface and the command-line interface) to debug applications written in the programming languages Ada, C, C++, COBOL, Fortran 77, and Fortran 90, on the Digital UNIX operating system.
The Ladebug debugger was formerly called DECladebug.
Revision /Update Information: | This is a revised manual. |
Product Version: | Digital UNIX Version 4.0 Ladebug Version 4.0 |
Digital Equipment Corporation
Maynard, Massachusetts
©Digital Equipment Corporation 1996…. All Rights Reserved.
1.2 Key Features of the Ladebug Debugger
1.4 Preparation for Debugging: Compiling and Linking a Program
1.5 Overview of the Two Debugger Interfaces
Part I Graphical User Interface
2 Introduction to the Ladebug Debugger: Graphical User Interface
2.2 Debugger Windows and Menus
2.2.1.2 Source View
2.2.1.3 Source View Context Panel
2.2.1.4 Push-Button Panel
2.2.1.5 Command Message View
2.2.2.2 Menus on Instruction View
2.3.2 Annotation Area Pop-Up Menu
2.3.3 Command Message View Pop-Up Menu
2.3.4 Browse Source Pop-Up Menu
2.3.5 Breakpoint View Pop-Up Menu
2.3.6 Monitor View and Local Variables View Pop-Up Menu
2.3.7 Register View Pop-Up Menu
2.3.8 Instruction View Pop-Up Menu
2.5 Displaying Online Help About the Debugger
2.5.2 Displaying Command-Oriented Help
3 Starting and Ending a Debugging Session: Graphical User Interface
3.2 Starting the Debugger from a Command-Line Prompt
3.3 When Your Program Completes Execution
3.4 Rerunning the Same Program from the Current Debugging Session
3.5 Running Another Program from the Current Debugging Session
3.6 Interrupting Program Execution and Aborting Debugger Operations
3.7 Ending a Debugging Session
4 Using the Debugger: Graphical User Interface
4.1.2 Making Source Code Available for Display
4.1.3 Specifying the Location of Source Files
4.3.2 Starting or Resuming Program Execution
4.3.3 Executing Your Program One Source Line at a Time
4.3.4 Stepping into a Called Routine
4.3.5 Returning from a Called Routine
4.4.2 Setting Breakpoints on Routines with Source Browser
4.4.3 Identifying the Currently Set Breakpoints
4.4.4 Deactivating, Activating, and Deleting Breakpoints
4.4.5 Setting and Modifying a Conditional Breakpoint
4.4.6 Setting and Modifying an Action Breakpoint
4.5.2 Selecting Variable Names from Windows
4.5.3 Displaying the Current Value of a Variable
4.5.3.2 Using the Print Button
4.5.3.3 Using the Monitor View
4.5.3.3.2 Monitoring a Pointer (Access) Variable
4.5.4.2 Changing the Value of a Variable with the Assign Dialog Box
4.6.2 How the Debugger Searches for Variables and Other Symbols
4.8 Displaying the Decoded Instruction Stream of Your Program
4.9 Customizing the Debugger's Window Interface
4.9.2 Displaying or Hiding Line Numbers by Default
4.9.3 Modifying, Adding, Removing, and Resequencing Push Buttons
4.9.3.2 Adding a New Button and Associated Command
4.9.3.3 Removing a Button
4.9.3.4 Resequencing a Button
5 Advanced Debugging Techniques
5.2 Attaching and Detaching a Process
5.3 Debugging a Multithreaded Application
5.3.2 Steps for Debugging a Multithreaded Application
6 Using Ladebug Within the DEC FUSE Environment
6.2 Differences in the DEC FUSE Debugger Main Window
7 Introduction to the Ladebug Debugger: Command Interface
7.1.2 Bringing a Program Under Debugger Control from the Ladebug Prompt
7.3 Customizing the Debugger Environment: Debugger Variables
7.4 Using Command Abbreviations: Aliases
7.5 Repeating Previously Used Commands: History
7.6 Executing System Commands from the Debugger
7.7 Using Command-Line Editing
7.8.2 Listing Source Code
7.8.3 Setting a Breakpoint
7.8.4 Running Your Program
7.8.5 Examining the Program State
7.8.6 Stepping Through Program Execution
7.8.7 Displaying a Stack Trace
7.8.8 Tracing a Variable: the trace Command
7.8.9 Attaching to a Running Process
7.8.10 Detaching from a Process
7.8.11 Terminating Processes
8 Examining Program Information
8.2 Displaying a Stack Trace: the where Command
8.3.2 The Current File Scope: the file Command
8.3.3 The Current Language Context: the $lang Debugger Variable
8.4.2 Dereferencing Pointers: the * Operator
8.4.3 Listing Variables: the dump Command
8.4.4 Displaying a Variable's Scope: the which and whereis Commands
8.4.5 Changing the Value of an Expression: the assign and patch Commands
9 Controlling Program Execution
9.2 Terminating Program Execution: the kill Command
9.3 Stepping Through Functions
9.3.2 The next Command
9.5 Branching to a Specified Line: the goto Command
9.6.1.2 The stopi at Command
9.6.1.3 The stop in Command
9.6.1.4 The stop and stopi Commands
9.6.1.5 The stop if and stopi if Commands
9.6.1.6 Combining Optional Conditions to Customize Breakpoint Command
9.7.2 Tracepoints That Notify You of a Variable Value Change
9.8.2 Disabling Breakpoints and Tracepoints: the disable Commands
9.8.3 Enabling Breakpoints and Tracepoints: the enable Commands
9.10 Calling Functions: the call Command
9.11 Unaligned Data Accesses: the catch and ignore Commands
9.13 Controlling the Debugging of Attached Processes: the attach and detach Commands
9.14 Debugging Programs with Stripped Images
9.15 Using Environment Variables Within the Debugger
Part III Language-Specific Topics
10.2 DEC C++ Flags for Debugging
10.3 Calling Overloaded Functions
10.5 Displaying Class Information
10.6 Displaying Object Information
10.7 Displaying Virtual and Inherited Class Information
10.8 Member Functions on the Stack Trace
10.9 Resolving Ambiguous References to Overloaded Functions
10.10 Setting Breakpoints
10.10.2 Setting Breakpoints in Overloaded Functions
10.10.3 Setting Breakpoints in Constructors and Destructors
10.12 Debugging C++ Exception Handlers
10.12.2 Examining and Modifying Variables in Exception Handlers
10.14 Limitations on Ladebug Support for C++
11 Debugging DEC Fortran and DEC Fortran 90 Programs
11.2 Fortran Flags for Debugging
11.3 Displaying Fortran Variables
11.3.2 Fortran Derived-Type Variables
11.3.3 Fortran Record Variables
11.3.4 Fortran Array Variables
11.3.4.2 Assignment to Arrays
11.3.6 DEC Fortran 90 Pointer Variables
11.3.7 Complex Variable Support
11.5 Use of Alternate Entry Points
11.6 Debugging Mixed-Language Programs
11.7 Debugging a Program That Generates an Exception
11.8 Debugging Optimized Programs
12.2 Compiling and Linking for Debugging
12.3 Debugging Multilanguage Programs
12.4 Using Case-Insensitive Commands and Variable Names
12.5 Printing ISO Latin-1 Characters
12.6 Displaying the Source Code of Generic Units
12.7 Debugging Multiple Units in One Source File
12.8 Debugging Ada Elaboration Code
12.9 Accessing Unconstrained Array Types
12.10 Accessing Incomplete Types Completed in Another Compilation Unit
12.11 Limitations on Ladebug Support for DEC Ada
12.11.2 Limitations in Data Types
12.11.3 Limitations for Tasking Programs
12.13 Debugging Optimized Programs
13 Debugging DEC COBOL Programs
13.2 DEC COBOL Flags for Debugging
13.3 Support for COBOL Identifiers
13.4 Debugging Mixed-Language Programs
13.5 Limitations on Assignment
13.6 Other Limitations
14.2 Core File Debugging Technique
14.3 Core Thread Debugging of Native Threads
15.2 Recording Debugger Sessions
15.3 Playing Back a Command Script
16.2 Listing the Shared Library Source Code
16.3 Setting Breakpoints in a Shared Library
16.4 Printing and Modifying Shared Library Variable Values
16.5 Stepping into Shared Library Functions
16.7 Accessing Shared Libraries on the Stack Trace
16.8 Disassembling a Memory Address in a Shared Library
17 Working with Limited Debugging Information
17.2 Example Debugging Sessions
17.2.1.2 Listing the Source Code
17.2.1.3 Displaying the Stack Trace
17.2.2.2 Listing the Source Code
17.2.2.3 Displaying the Stack Trace
17.2.3.2 Listing the Source Code
17.2.3.3 Displaying the Stack Trace
17.2.3.4 Printing Static and Local Variables
17.2.4.2 Listing the Source Code
17.2.4.3 Displaying the Stack Trace
17.2.4.4 Setting a Breakpoint on an Unknown Routine
18.1.2 Using Pointer Arithmetic
18.3 Stepping at the Machine Level
19 Debugging Multithreaded Applications
19.3 Thread Commands
19.3.2 Thread Control Commands
19.3.2.2 Setting Tracepoints in Multithreaded Applications
19.3.2.3 Stepping Individual Threads
19.3.2.4 Resuming Thread Execution
19.3.3.2 Condition Variable Queries (DECthreads Only)
19.3.3.3 Mutex Queries for DECthreads
20 Debugging Multiprocess Applications
20.2 Displaying a List of Processes
20.3 Setting the Current Process
20.4 Loading Image and Core Files
20.5 Removing Process Information from the Debugger
20.6 Sample Multiprocess Debugging Session
20.7 Debugging Programs That Fork and/or Exec
20.7.2 Debugging Programs That Fork Child Processes
20.7.2.2 Scenario for Debugging a Forked Process with the Parent Process Running
20.7.2.3 Scenario for Debugging a Forked Process with the Parent Process Stopped
21.2 Reasons for Remote Debugging
21.3 Client/Server Model for Remote Debugging
21.4 Tasks for Remote Debugging
21.4.2 Starting Ladebug
21.4.3 Debugging the User Program
21.4.4 Exiting the Debugger and Disconnecting from the Server
21.6 Example Remote Debugger Session Using the Evaluation Board Server
21.6.2 Loading the Executable File and Starting the Server
21.6.3 Starting Ladebug on the Host System
21.6.4 Special Conditions
22.2 Crash Dump Analysis
22.3 Remote Kernel Debugging with the kdebug Debugger
A.2 Invoking Ladebug Within emacs
B Writing a Remote Debugger Server
B.2 Alternatives to Using a Remote Debugger
B.3 The Structure of a Remote Debugger
B.4 Types of Targets
B.5 Ladebug as a Remote Debugger
B.5.2 The Protocol
B.5.3 Starting a Remote Debugger Session
B.5.4 Ending a Remote Debugger Session
B.6.2 Evaluation Board Server
B.6.3 Structure of the Servers
B.6.4 Creating a Server for a New Target
B.7.2 Digital UNIX Communicator
B.7.3 Evaluation Board Monitor
B.7.4 Porting the Communicators to Other Systems
B.9.2 Digital UNIX Server Debugger Kernel
B.9.3 Evaluation Board Server
B.9.3.2 Setting Breakpoints
B.9.3.3 Hitting a Breakpoint or an Exception
B.9.3.4 Receiving and Processing Commands
B.9.3.5 Continuing from a Breakpoint or Exception
B.9.3.6 Interrupt Handling
B.11 Ladebug Remote Debugger Protocol
B.11.1.2 Message Values
B.11.1.3 Load Process Request and Response
B.11.1.4 Responses to the Load Process Request
B.11.1.5 Connect to Process Request and Response
B.11.1.6 Connect to Process Insist Request and Response
B.11.1.7 Probe Process Request and Response
B.11.1.8 Disconnect from Process Request and Response
B.11.1.9 Stop Process Request and Response
B.11.1.10 Kill Process Request and Response
B.11.1.11 Continue Process Request and Response
B.11.1.12 Step Request and Response
B.11.1.13 Set Breakpoint Request and Response
B.11.1.14 Clear Breakpoint Request and Response
B.11.1.15 Get Next Breakpoint Request and Response
B.11.1.16 Get Registers Request and Response
B.11.1.17 Set Registers Request and Response
B.11.1.18 Read Request and Response
B.11.1.19 Write Request and Response
B.11.3 Recovering from Packet Loss
C Support for International Users
C.2 Support for Output of Local Language Characters
C.3 Support for Wide Character Type (wchar_t) in C and C++ Programs
Examples
7-2 Displaying and Redefining Debugger Variables
7-4 Defining an Alias with a Parameter
7-5 Nesting Aliases
7-6 Reentering Commands on the History List
7-7 Executing an Operating System Command
7-8 Displaying an Identifier Using an Operating System Command
7-9 Sample C Program, sample.c
7-10 Compiling and Executing the Sample C Program
7-11 Invoking the Debugger on Your Program
7-12 Listing a Program
7-13 Setting a Breakpoint
7-14 Running Your Program Under Debugger Control
7-15 Printing a Variable's Value
7-16 Stepping Through Program Execution
7-17 Stepping and Displaying a Stack Trace
7-18 Stepping Through the Sample Program
7-20 Tracing a Program Variable
7-21 Attaching to a Running Process
8-1 Listing Source Code in a Number Range
8-2 Listing Source Code By Counting from a Starting Line
8-3 Displaying the Stack Trace in a COBOL Program
8-6 Examining Data Items in a COBOL program
8-7 Determining the Type of a Variable
8-8 Printing Values of an Array
8-9 Printing Individual Values of an Array
8-11 Displaying Information on Each Activation Level
8-12 Displaying a Variable's Scope
8-13 Determining Overloaded Identifiers
8-14 Depositing a Value in an Expression
8-15 Assigning Values to a Variable and an Expression
9-1 Using run and rerun to Begin Program Execution
9-2 Stepping Through Program Execution
9-3 Continuing Program Execution
9-4 Branching to a Specified Line
9-5 Setting a Breakpoint at a Line in C Source Code
9-6 Setting a Breakpoint at an Address in the Source Code
9-7 Setting a Breakpoint in a Function
9-8 Setting a Breakpoint at the Start of an Ada Procedure
9-9 Setting a Breakpoint on a Variable
9-10 Setting a Conditional Breakpoint
9-11 Setting a Conditional Breakpoint in a Function
9-12 Setting a Breakpoint That Executes a Stack Trace
9-13 Setting a Breakpoint That Executes Multiple Commands
9-14 Setting a Tracepoint
9-15 Setting a Conditional Tracepoint
9-16 Tracing Variables
9-17 Using status to Display Breakpoints
9-18 Deleting Breakpoints
9-20 Enabling Breakpoints
9-22 Calling a Function from the Debugger Prompt
9-23 Embedding a Function Call in an Expression
9-25 Catching Unaligned Access
10-2 Displaying Class Information
10-3 Displaying Object Information
10-4 Resolving References to Objects of Multiple Inherited Classes
10-5 Resolving Overloaded Functions by Selection Menu
10-6 Resolving Overloaded Functions by Type Signature
10-7 Setting Breakpoints in Member Functions
10-8 Setting Breakpoints in Virtual Member Functions
10-9 Setting Breakpoints in Member Functions for a Specific Object
10-10 Setting Breakpoints in Specific Overloaded Functions
10-11 Setting Breakpoints in All Versions of an Overloaded Function
10-12 Setting Breakpoints in Overloaded Functions by Line Number
10-13 Setting Breakpoints in Constructors
10-14 Setting Breakpoints in Destructors
10-15 Example of a Function Template
10-16 Setting a Breakpoint in the Template Function
10-17 Displaying an Instantiated Class Template
10-18 Setting Current Class Scope to an Instantiated Class
10-19 Setting Breakpoints in Exception Handlers
10-20 Printing a Class Description in Verbose Mode
13-1 Sample COBOL Program
13-2 Sample COBOL Debugging Session
14-2 Debugging a Multithreaded Kernel Core File
15-2 Debugger Startup Using a .dbxinit File
15-3 Recording a Debugger Script
15-4 Executing a Debugger Script
16-1 Listing the Shared Library Source Code
16-2 Setting Breakpoints in a Shared Library
16-3 Printing and Modifying Shared Library Variable Values
16-4 Stepping into Shared Library Functions
16-6 Nesting Calls to Shared Libraries
16-7 Calling a System Library Function
16-8 Accessing Shared Libraries on the Stack Trace
16-9 Disassembling a Memory Address in a Shared Library
17-1 Setting Breakpoints in a C++ Program Compiled and Linked with -g2
17-2 Setting Breakpoints in a C++ Program Compiled with -g2 and Linked with -x
17-3 Listing the Source Code of a C++ Program Compiled and Linked with -g2
17-4 Displaying the Stack Trace of a C++ Program Compiled and Linked with -g2
17-5 Displaying the Stack Trace of a C++ Program Compiled with -g2 and Linked with -x
17-6 Setting Breakpoints on Routines in a C Program Compiled and Linked with -g2
17-7 Setting Breakpoints on Routines in a C Program Compiled with -g2 and Linked with -x
17-8 Listing the Source Code of a C Program Compiled and Linked with -g2
17-9 Listing the Source Code of a C Program Compiled with -g2 and Linked with -x
17-10 Displaying the Stack Trace of a C Program Compiled and Linked with -g2
17-11 Displaying the Stack Trace of a C Program Compiled with -g2 and Linked with -x
17-12 Setting Breakpoints on Static and Global Routines in a C++ Program Compiled and Linked with -g2 17-13 Setting Breakpoints on Static and Global Routines in a C++ Program Compiled with -g2 and Linked wit 17-14 Listing the Source Code of a C++ Program
17-15 Displaying the Stack Trace of a C++ Program Compiled and Linked with -g2
17-16 Displaying the Stack Trace of a C++ Program Compiled with -g2 and Linked with -x -r
17-17 Printing Variables of a C++ Program Compiled and Linked with -g2
17-18 Printing Variables of a C++ Program Compiled with -g2 and Linked with -x -r
17-19 Setting Breakpoints on Static and Global Routines in a C++ Program with Various -x and -r flags 17-20 Listing the Source Code of a C++ Program with Various -x and -r Flags
17-21 Displaying the Stack Trace of a C++ Program with Various -x and -r Flags
17-22 Setting a Breakpoint on an Unknown Routine in a C++ Program with Various -x and -r Flags
18-1 Disassembling Values Contained in a Range of Addresses
18-2 Using Pointer Arithmetic to Display and Change Values in Memory
18-3 Printing Machine Registers on the Digital UNIX Alpha Platform
18-4 Stepping Through Program Execution One Machine Instruction at a Time
19-1 Displaying Condition Variable Information
19-2 Displaying Mutex Information
20-1 Debugging a Multiprocess Application - Loading an Image File and Showing Processes
20-2 Debugging a Multiprocess Application - Switching Between Processes
20-3 Default Settings for Predefined Variables
20-4 Debugging a Forked Process - Showing the Child Process
20-5 Debugging a Forked Process - Changing the Process Context
20-6 Debugging a Forked Process - Rerunning the Program
20-7 Debugging a Forked Process with Parent and Child Processes Stopped
20-8 Debugging a Forked Process - Switching to the Parent Process
20-9 Debugging a Process That Execs
20-10 Debugging a Process That Execs - Setting Breakpoints
Figures
2-3 Menu Buttons on Source View Context Panel
2-4 Default Buttons in the Push-Button Panel
2-5 Breakpoint View
2-6 Monitor View
2-7 Register View
2-8 Instruction View
2-10 Menus on Optional Views Window
2-11 Menus on Instruction View
2-12 Command Prompt
3-1 CDE Application Manager Icon
3-2 CDE Developer's Toolkit Icon
3-3 CDE Ladebug Icon
3-4 Debugger Window at Startup
3-5 Running a Program by Specifying a Program File
3-6 Rerunning the Same Program
4-1 Source Display
4-2 Displaying Source Code in Another Routine
4-3 Editor Window
4-4 Setting a Breakpoint on a Source Line
4-5 Setting a Breakpoint on a Routine
4-6 Breakpoint View with Action and Condition
4-7 Setting a Conditional Breakpoint
4-8 Setting an Action Breakpoint
4-11 Expanded Aggregate Variable (Array) in Monitor View
4-12 Pointer Variable and Referenced Object in Monitor View
4-13 Typecasting the Value of a Variable
4-14 Changing the Value of a Monitored Variable
4-15 Changing the Value of a Component of an Aggregate Variable
4-16 Changing the Value of a Variable
4-17 Current Scope Set to a Calling Routine
4-18 Changing a Value in the Register View
4-19 Instruction View
4-20 Changing the Step Button Label to an Icon
4-21 Adding a Button for the up Command
5-1 Process Selection Dialog Box
10-1 A Stack Trace Displaying a Member Function
17-1 Example C++ Program Linked with -x -r
21-1 Client/Server Model with a Single or a Shared File System
21-2 Client/Server Model with Separate File Systems
Tables
2-3 Default Buttons in the Push-Button Panel
2-4 Optional Views
2-5 Menus in Optional Views Window
2-8 Annotation Area Pop-Up Menu
2-9 Message Region Pop-Up Menu
2-10 Source Browser Pop-Up Menu
2-11 Breakpoint View Pop-Up Menu
2-12 Monitor View and Local Variables View Pop-Up Menu
2-13 Register View Pop-Up Menu
2-14 Instruction View Pop-Up Menu
2-15 Instruction View Annotation Area Pop-Up Menu
4-1 Available Options for Selecting and Changing Variables and Values
9-1 Commands for Setting Breakpoints
11-1 Summary of Symbol Table Flags
12-1 Ada Expressions and Debugger Equivalents
13-1 Summary of Symbol Table Flags
18-1 Valid Memory Display Modes
21-1 Client/Server Concepts for Remote Debugging
21-2 Command Line Options for Remote Debugging
1 Functionally Related Sets of Ladebug Commands
2 Ladebug Commands: Individual Summary
B-1 Remote Debugger Protocol Client Requests
B-2 kernel Functions
B-3 Header Format
B-4 Message Table
B-5 Fields of the Load Process Request Message