Openvms Debugger Manual
Total Page:16
File Type:pdf, Size:1020Kb
OpenVMS Debugger Manual Order Number: AA–QSBJD–TE April 2001 This manual explains the features of the OpenVMS Debugger for programmers in high-level languages and assembly language. Revision/Update Information: This manual supersedes the OpenVMS Debugger Manual, Version 7.2. Software Version: OpenVMS Alpha Version 7.3 OpenVMS VAX Version 7.3 Compaq Computer Corporation Houston, Texas © 2001 Compaq Computer Corporation Compaq, VAX, VMS, and the Compaq logo Registered in the U.S. Patent and Trademark Office. OpenVMS is a trademark of Compaq Information Technologies Group, L.P. in the United States and other countries. Microsoft, Windows, and Windows NT are trademarks of Microsoft Corporation in the United States and other countries. Intel is a trademark of Intel Corporation in the United States and other countries. Motif, Open Software Foundation, OSF/1, and UNIX are trademarks of The Open Group in the United States and other countries. All other product names mentioned herein may be the trademarks of their respective companies. Confidential computer software. Valid license from Compaq required for possession, use, or copying. Consistent with FAR 12.211 and 12.212, Commercial Computer Software, Computer Software Documentation, and Technical Data for Commercial Items are licensed to the U.S. Government under vendor’s standard commercial license. Compaq shall not be liable for technical or editorial errors or omissions contained herein. The information in this document is provided "as is" without warranty of any kind and is subject to change without notice. The warranties for Compaq products are set forth in the express limited warranty statements accompanying such products. Nothing herein should be construed as constituting an additional warranty. ZK4538 The Compaq OpenVMS documentation set is available on CD-ROM. This document was prepared using DECdocument, Version 3.3-1b. Contents Preface ............................................................ xxv Part I Introduction to the Debugger 1 Introduction to the Debugger 1.1 Overview of the Debugger ..................................... 1–1 1.1.1 Functional Features ....................................... 1–2 1.1.2 Convenience Features ..................................... 1–4 1.2 Preparing an Executable Image for Debugging ..................... 1–6 1.2.1 Compiling a Program for Debugging . ....................... 1–6 1.2.2 Linking a Program for Debugging ............................ 1–7 1.2.3 Controlling Debugger Activation with the LINK and RUN Commands ....................................................... 1–7 1.3 Debugging a Program with the Kept Debugger ..................... 1–8 1.3.1 Starting the Kept Debugger . ................................ 1–9 1.3.2 When Your Program Completes Execution ...................... 1–12 1.3.3 Rerunning the Same Program from the Kept Debugger ........... 1–12 1.3.4 Running Another Program from the Kept Debugger .............. 1–13 1.4 Interrupting Program Execution and Aborting Debugger Commands .... 1–13 1.5 Pausing and Resuming a Debugging Session....................... 1–13 1.6 Starting the Debugger by Running a Program ..................... 1–14 1.7 Starting the Debugger After Interrupting a Running Program . ....... 1–15 1.8 Ending a Debugging Session . ................................ 1–16 1.9 Debugging a Program on a Workstation Running DECwindows Motif .... 1–16 1.10 Debugging a Program from a PC Running the Debug Client . ....... 1–17 1.11 Debugging Detached Processes That Run with No CLI ............... 1–18 1.12 Debugger Command Summary . ................................ 1–18 1.12.1 Starting and Ending a Debugging Session ...................... 1–18 1.12.2 Controlling and Monitoring Program Execution . ............... 1–19 1.12.3 Examining and Manipulating Data ........................... 1–19 1.12.4 Controlling Type Selection and Radix . ....................... 1–20 1.12.5 Controlling Symbol Searches and Symbolization . ............... 1–20 1.12.6 Displaying Source Code . ................................ 1–21 1.12.7 Using Screen Mode ....................................... 1–21 1.12.8 Editing Source Code ...................................... 1–21 1.12.9 Defining Symbols ........................................ 1–22 1.12.10 Using Keypad Mode ...................................... 1–22 1.12.11 Using Command Procedures, Log Files, and Initialization Files ..... 1–22 1.12.12 Using Control Structures . ................................ 1–22 1.12.13 Debugging Multiprocess Programs ........................... 1–23 1.12.14 Additional Commands ..................................... 1–23 iii Part II Command Interface 2 Getting Started with the Debugger 2.1 Entering Debugger Commands and Accessing Online Help ........... 2–1 2.2 Displaying Source Code . .................................... 2–4 2.2.1 Noscreen Mode ........................................... 2–4 2.2.2 Screen Mode . ............................................ 2–5 2.3 Controlling and Monitoring Program Execution . ................... 2–6 2.3.1 Starting or Resuming Program Execution . ................... 2–6 2.3.2 Executing the Program by Step Unit .......................... 2–7 2.3.3 Determining Where Execution Is Paused ....................... 2–7 2.3.4 Suspending Program Execution with Breakpoints ................ 2–8 2.3.5 Tracing Program Execution with Tracepoints ................... 2–9 2.3.6 Monitoring Changes in Variables with Watchpoints ............... 2–10 2.4 Examining and Manipulating Program Data ....................... 2–11 2.4.1 Displaying the Value of a Variable ............................ 2–12 2.4.2 Assigning a Value to a Variable . ............................ 2–13 2.4.3 Evaluating Language Expressions ............................ 2–13 2.5 Controlling Access to Symbols in Your Program . ................... 2–14 2.5.1 Setting and Canceling Modules . ............................ 2–14 2.5.2 Resolving Symbol Ambiguities . ............................ 2–15 2.6 Sample Debugging Session . .................................... 2–15 3 Controlling and Monitoring Program Execution 3.1 Commands Used to Execute the Program ......................... 3–1 3.2 Executing the Program by Step Unit . ............................ 3–2 3.2.1 Changing the STEP Command Behavior ....................... 3–2 3.2.2 Stepping Into and Over Routines . ............................ 3–3 3.3 Suspending and Tracing Execution with Breakpoints and Tracepoints . 3–4 3.3.1 Setting Breakpoints or Tracepoints on Individual Program Locations . ............................................ 3–6 3.3.1.1 Specifying Symbolic Addresses ............................ 3–6 3.3.1.2 Specifying Locations in Memory ........................... 3–7 3.3.1.3 Obtaining and Symbolizing Memory Addresses ............... 3–8 3.3.2 Setting Breakpoints or Tracepoints on Lines or Instructions ........ 3–8 3.3.3 Setting Breakpoints on Emulated Instructions (Alpha Only) ........ 3–9 3.3.4 Controlling Debugger Action at Breakpoints or Tracepoints ........ 3–9 3.3.5 Setting Breakpoints or Tracepoints on Exceptions ................ 3–10 3.3.6 Setting Breakpoints or Tracepoints on Events .................. 3–10 3.3.7 Deactivating, Activating, and Canceling Breakpoints or Tracepoints ....................................................... 3–11 3.4 Monitoring Changes in Variables and Other Program Locations ........ 3–11 3.4.1 Deactivating, Activating, and Canceling Watchpoints . ........... 3–14 3.4.2 Watchpoint Options . .................................... 3–14 3.4.3 Watching Nonstatic Variables . ............................ 3–14 3.4.3.1 Execution Speed . .................................... 3–15 3.4.3.2 Setting a Watchpoint on a Nonstatic Variable ................ 3–15 3.4.3.3 Options for Watching Nonstatic Variables ................... 3–16 3.4.3.4 Setting Watchpoints in Installed Writable Shareable Images . 3–16 iv 4 Examining and Manipulating Program Data 4.1 General Concepts ............................................ 4–1 4.1.1 Accessing Variables While Debugging . ....................... 4–1 4.1.2 Using the EXAMINE Command ............................. 4–2 4.1.3 Using the DUMP Command . ................................ 4–3 4.1.4 Using the DEPOSIT Command .............................. 4–3 4.1.5 Address Expressions and Their Associated Types . ............... 4–4 4.1.6 Evaluating Language Expressions ............................ 4–5 4.1.6.1 Using Variables in Language Expressions ................... 4–6 4.1.6.2 Numeric Type Conversion by the Debugger . ............... 4–7 4.1.7 Address Expressions Compared to Language Expressions . ....... 4–8 4.1.8 Specifying the Current, Previous, and Next Entity ............... 4–9 4.1.9 Language Dependencies and the Current Language .............. 4–10 4.1.10 Specifying a Radix for Entering or Displaying Integer Data . ....... 4–11 4.1.11 Obtaining and Symbolizing Memory Addresses . ............... 4–13 4.2 Examining and Depositing into Variables . ....................... 4–15 4.2.1 Scalar Types ............................................. 4–15 4.2.2 ASCII String Types ....................................... 4–16 4.2.3 Array Types ............................................. 4–17 4.2.4 Record Types ............................................ 4–18 4.2.5 Pointer (Access) Types ..................................... 4–19 4.3 Examining and Depositing Instructions ........................... 4–20 4.3.1 Examining Instructions .................................... 4–20 4.3.2 Depositing Instructions