HP/DDE Debugger User's Guide HP 9000 Series 700/800 Computers ABCDE HP Part No.
Legal Notices The information in this document is subject to change without notice. Hewlett-Packard makes no warranty of any kind with regard to this manual, including, but not limited to, the implied warranties of merchantability and tness for a particular purpose. Hewlett-Packard shall not be held liable for errors contained herein or direct, indirect, special, incidental or consequential damages in connection with the furnishing, performance, or use of this material. Warranty.
This software is based in part on the Fourth Berkeley Software Distribution under license from the Regents of the University of California. c Copyright 1980, 1984, 1986 Novell, Inc. c Copyright 1986-1992 Sun Microsystems, Inc. c Copyright 1985-86, 1988 Massachusetts Institute of Technology. c Copyright 1989-93 The Open Software Foundation, Inc. c Copyright 1986 Digital Equipment Corporation. c Copyright 1990 Motorola, Inc.
Printing History New editions of this manual will incorporate all material updated since the previous edition. We may issue a technical addendum or release notes as supplements. The software version number printed alongside the date indicates the version of HP/DDE at the time we issued the manual. B3476-90015 B3476-90011 B3476-90004 iv July 1996 June 1995 April 1994 Version 4.0 Version 3.2 Version 3.
Preface The HP/DDE Debugger User's Guide describes the HP Distributed Debugging Environment (HP/DDE), the high-level language debugger for the HP-UX operating system. HP/DDE is also the default SoftBench Program Debugger which runs on both HP-UX and Solaris systems. The debugger software consists of the main debugger and a set of managers. The main debugger provides such basic debugger functions as program control, process control, program and data monitoring, program information, and expression evaluation.
Audience Audience This manual is written for programmers in C, C++, FORTRAN, or Pascal.
Summary of Technical Changes Summary of Technical Changes This edition of the HP/DDE Debugger User's Guide documents the HP Distributed Debugging Environment (HP/DDE) Version 4.0 on HP-UX workstations. HP/DDE Version 4.0 provides the following new features and enhancements: A new and easier to use graphical user interface. Support of PA-RISC 2.0 assembly language. Enhanced debugging of optimized code in C. Support for ANSI C++, including: Allowing object speci c breakpoints.
Related Documentation Related Documentation For more information on HP-UX programming, refer to the following documents: Programming on HP-UX (B2355-90653) provides an overview of programming on HP-UX. It includes information about linking programs, creating and managing user libraries, optimizing programs, and porting programs. HP/PAK Performance Analysis Tools User's Guide (B3476-90016) describes the performance tools provided by the HP Program Analysis Kit (HP/PAK).
Related Documentation The Procedure Calling Conventions Reference Manual (09740-90015) describes procedure calling conventions on PA-RISC systems. The HP-UX Symbolic Debugger User's Guide (B2355-90044) describes the xdb debugger. The X Window System User's Guide , O'Reilly & Associates, Inc., provides information about the X Window System. To order manuals, call HP DIRECT at 1-800-637-7740. Outside the USA, please contact your local sales o ce.
Typographical Conventions Typographical Conventions computer font underlined text italic type boldface type [] fg j ... .. . 4key5 name (N) x Computer font indicates commands, keywords, options, literals, source code, system output, and path names. In syntax formats, computer font indicates commands, keywords, and punctuation that you must enter exactly as shown. In interactive examples, underlined text represents user input.
Typographical Conventions Menu:Item This notation indicates a choice from the menu bar. For example, since Quit is on the File menu, the menu bar selection is written as File:Quit.
In This Book In This Book The following is a brief description of the contents of this manual: Chapter 1 Presents an overview of the debugger's graphical user interface and online help system. Chapter 2 Describes how to compile, load, and execute a target program. Chapter 3 Describes how to use breakpoints, watchpoints, traces, and intercepts. Chapter 4 Describes how to view and manipulate target program data. Chapter 5 Describes how to use the debugger's command line.
Contents 1. Overview HP/DDE at a Glance . . . . . . . . . . . . . . . . . . . HP/DDE Online Help . . . . . . . . . . . . . . . . . . . Using HP/DDE Online Help . . . . . . . . . . . . . . . 2. Compiling, Loading, and Executing the Target Program Preparing the Target Program . . . . . . . . . . . . . Invoking the Debugger . . . . . . . . . . . . . . . . . Setting PATH and MANPATH Variables . . . . . . . . Stopping the Debugger . . . . . . . . . . . . . . .
Looking at the Call/Return Stack . . . . . . . . . . . . . . Using the tb Command . . . . . . . . . . . . . . . . . Using the environment Command . . . . . . . . . . . . . 2-18 2-19 2-19 3. Using Monitors (Breakpoints, Watchpoints, Traces, and Intercepts) Using Monitors . . . . . . . . . . . . . . . . . . . . . . Setting Breakpoints . . . . . . . . . . . . . . . . . . . . Using the Mouse . . . . . . . . . . . . . . . . . . . . Using the breakpoint Command . . . . . . . . . . . . . Specifying Locations . .
Examining Linked Lists Examining Bu ers . . Examining Registers . . . Using Register Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5. Using Debugger Commands Abbreviating Debugger Commands . . . . . . . . . . . . . Entering Multiple Debugger Commands on One Line . . . . . Using Command Lists . . . . . . . . . . . . . . . . . . . Continuing Commands on the Next Line . . . . . . . . . . .
7. Identifying Program Objects Understanding Blocks and Environments . . . . . . . . . . . Changing the Environment . . . . . . . . . . . . . . . . Overriding the Current Language . . . . . . . . . . . . . Applying Scope and Visibility Rules . . . . . . . . . . . . . Using Quali ed Names . . . . . . . . . . . . . . . . . . Block Quali ed Names . . . . . . . . . . . . . . . . . . Fully Quali ed Names . . . . . . . . . . . . . . . . . . Image Quali ed Names . . . . . . . . . . . . . . . . .
A. Line-Mode User Interface Invoking the Line-Mode User Interface The User Interface Startup File . . . Screen Display Conventions . . . . Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-2 A-3 A-4 A-5 B. Language Managers C Language Manager . . . . . . . . . . . C++ Language Manager . . . . . . . . . . FORTRAN Language Manager . . . . . . . HP Pascal Language Manager . . . . . . .
Figures 1-1. 1-2. 2-1. 2-2. 2-3. 3-1. 3-2. 3-3. 3-4. 3-5. 3-6. 3-7. 3-8. 4-1. 4-2. 6-1. 6-2. 7-1. 7-2. 7-3. 8-1. 8-2. 8-3. 8-4. 8-5. Debugger Main Window . . . . . . . . . . . . . The Introductory HP/DDE Help Screen . . . . . . Load/Rerun Dialog Box . . . . . . . . . . . . . Source File Display . . . . . . . . . . . . . . . Stack View Dialog Box . . . . . . . . . . . . . The Break Menu . . . . . . . . . . . . . . . . The Breakpoint Set/Change Dialog Box . . . . . . The Data Watchpoints Dialog Box . . . .
Tables 5-1. Reserved Identi ers and Special Macros . . . . . . . . . .
1 1 Overview The HP Distributed Debugging Environment (also referred to as \the debugger" or \HP/DDE") is a high-level language debugger for the HP-UX operating system. The debugger operates on object les generated by HP compilers and the HP assembler. The debugger provides a powerful graphical user interface based on OSF/Motif. For users without access to OSF/Motif, the debugger also provides a line-mode user interface.
In This Book HP/DDE at a Glance The debugger provides a powerful graphical user interface based on OSF/Motif. You control the debugger by executing commands from menus, from the command entry line, or from customizable command buttons. (The debugger also has a line-mode user interface which is described in Appendix A.) The main window of the debugger displays source code, debugger output, and program I/O.
1 In This Book Figure 1-1.
In This Book 5 Annotation Margin Shows source le line numbers. Click with the left mouse button on a line number to set a breakpoint. Click on the circled B symbol to delete the breakpoint. 6 An arrow indicates the current program counter location. Source File Display Area Clicking the right mouse button in this area invokes the Source Actions pop-up menu, which contains a number of program execution and monitoring commands. 7 To search for text strings in the source le, select Visit:Search .
1 In This Book This manual attempts to describe the most common alternatives for performing each task. In general, entering debugger commands in the command entry box provides the widest range of options and allows the greatest exibility and control. This manual shows only the more commonly used options to debugger commands. For complete information on a particular command, see Command Reference in the debugger's online help. You can also enter help command name on the debugger's command line.
In This Book HP/DDE Online Help The debugger has an extensive hypertext-based online help facility. You can use keyword searches or click on hyperlinks to navigate through the help system. Figure 1-2 shows the introductory help screen that you can invoke from the menu bar of the debugger's main window. Click on Help and then select Overview. You can also invoke the debugger's online help facility from the Top Level selection in the Help Manager, which is located on the Front Panel.
1 In This Book Figure 1-2. The Introductory HP/DDE Help Screen Using HP/DDE Online Help HP/DDE online help provides several ways to nd the topic you are looking for. Here are some of the methods you can use: Clicking on a hyperlink. Hyperlinks connect topics within and among the major divisions of the online help. Hyperlinks are displayed as underlined text. Searching for a keyword. Select the Index button to invoke a dialog box that allows you to search through the keyword index.
In This Book Pressing F1 to obtain context-sensitive help in dialog boxes and display windows. You can navigate through the HP/DDE online help using several methods, including: Clicking on an item from the topic hierarchy in the Help window to go to another topic. Clicking on an item in the history list to return to a previous topic. Select the History button from to invoke the a dialog box that shows a list of topics that you have visited. Selecting the Backtrack button to return to the previous topic.
2 2 Compiling, Loading, and Executing the Target Program This chapter describes: Preparing a program for debugging. Starting and stopping the debugger. Load and unloading a target program. Examining source les. Controlling the execution of the target program. Viewing the current execution call stack. For more information on the debugger commands mentioned in this chapter see the online command reference.
In This Book Preparing the Target Program To prepare a target program for debugging, compile the program using the compiler's option for debugging, usually -g. A compiler's debugging option causes it to add information needed by the debugger to the program's object le. For example: $ cc -g average.c You can nd average.c, a sample program that you can practice on, in the directory /opt/langtools/dde/examples. In that directory, you can also nd sources for average in FORTRAN, C++, and Pascal.
In This Book 2 Invoking the Debugger To invoke the debugger, enter the dde command in a shell process window. For detailed information on the dde command and its options, refer to the dde (1) man page. When you invoke the debugger, it rst executes a user interface startup le. Then, it executes any commands speci ed with the -do option.
In This Book Invoking and Loading a Target Program During Debugger Startup If you want the debugger to load the target program at startup, then enter the target program invocation as the last argument to the dde command. For example, if the target program name is test, enter $ dde test If the target program requires arguments, precede the target program and its arguments with a double hyphen (--).
In This Book 2 Invoking and Loading a Target Program From the Debugger You can invoke and load a target program from the File menu or by using the debug command. Using the File Menu Select File:Load Executable to invoke a target program. The Load/Rerun dialog box, shown in Figure 2-1, appears. The Load/Rerun dialog box allows: 1. Specifying the path name of the target program. (The 4...5 buttons invoke a dialog box containing a list of directories and le names under the current working directory.) 2.
In This Book Figure 2-1. Load/Rerun Dialog Box Using the debug Command To invoke a target program from the debugger command input box, enter the debug command followed by the target program invocation. For example, if the target program test takes the argument -F testfile, enter the following command: debug test -F testfile To redirect the target program's standard input and output, use the debug command's -input and -output options.
In This Book 2 Attaching the Debugger to a Running Process To debug a running process, you must either have the same user ID as the target program or you must be logged in as root. Using the File Menu To attach to a running process from the debugger menu bar: 1. If the debugger's current directory is not the same as the directory that contains the target process, change it using File:Change Working Directory. 2. Enter the name of the process in the (): parameter input box. 3.
In This Book the source code. Use the frame block quali er, `main(n ), from the traceback as an argument to the environment command. For example: debug -attach 1189 Attached to process 1189; initializing "/home/smith/progs/and". Stopped at: `va(800b8658) (800B8658) step (Warning) Unable to determine statement boundaries; stepping 1 instruction.
In This Book 2 Stopping the Target Program To terminate the target program, use the kill command or select File:Unload Executable. When the target program terminates, the debugger continues to run. Use quit or select File:Quit to terminate the debugger. Use the free command to detach the debugger from the target program while allowing the target program to continue executing.
In This Book Without options, the restart command restarts the target program using the same arguments speci ed in the previous invocation. Use the -args option if you want to specify di erent arguments in the target program invocation. For example, the following command restarts the currently running target program, replacing previously speci ed arguments with the argument -s: restart -args -s Interrupting a Running Program When the PC Location indication is Running . . .
In This Book doing this until your program returns to debuggable code. You could also set a breakpoint at some later point in debuggable code. If the nondebuggable code is in an in nite loop, or will not return for some other reason, you must kill or rerun the program.
In This Book Examining Source Files When you load a target program, the source le is displayed in the source le display area. See Figure 2-2. Figure 2-2. Source File Display An arrow symbol in the annotation margin indicates the current point of execution. The circled B symbol designates a breakpoint. Ordinarily, the debugger sets breakpoints at the program's entry and exit statements and executes the program up to its entry statement.
In This Book 2 object. Select File:Add Source Directories or use the property sdir command to put the source le in the debugger's search path. Also, the source will not appear if the main program is not debuggable (even if there are debuggable modules within the target program). A message like the following may appear during startup: (Warning) end.o has not been linked in. (Warning) Notification of dynamic loader events will be unavailable. Executing image in process 8981: "/home/smith/a.out".
In This Book Executing the Target Program The debugger can execute the target program by stepping through one or more statements at a time. The easiest method for stepping through a target program is to use one of the step or continue command buttons. They are located below the source le display area. The debugger commands go, step, and goto are useful when you want to implement more complicated stepping procedures.
In This Book 4Continue5 2 Execute until a breakpoint (or another event that halts execution) is encountered. When you select one of these buttons, the PC arrow moves to the next statement to be executed. Routines that are not debuggable, such as system library routines and routines that were not compiled with the -g option, will be stepped over even when using 4Step5. To pause at a speci c point in your program, see \Setting Breakpoints" in Chapter 3.
In This Book Using the step Command The step command advances target program execution one source code statement at a time. If you supply a numeric argument to the step command (for example, step 5), it will advance execution by the speci ed number of source code statements. If you specify step -instruction, execution advances one assembly instruction.
In This Book 2 Using the Mouse A number of execution commands are available by holding down the right mouse button in the source le display area. The Source Actions popup menu appears. For example, you can: 1. Scroll to a particular line number in the source le. 2. Position the cursor on the line. 3. Invoke the Continue Until command from the Source Actions menu and it will execute the target up to that line in the code.
In This Book Looking at the Call/Return Stack Select Show:Stack to display the Stack View dialog box. Figure 2-3. Stack View Dialog Box The Stack View dialog box, shown in Figure 2-3, contains: 1. Arrow buttons to move to the top of the stack, up one level, down one level, or to the bottom of the stack. The associated source code is displayed in the source le display area. (You can also use the arrow buttons above the source le display area.) 2. A scrollable listing of the call/return stack.
In This Book 2 Using the tb Command Use the tb command to display a traceback of the call/return stack in the debugger output area. The tb command numbers each frame in the stack using the notation `main(n ), where n increases in the direction of the most recent frame.
Using Monitors (Breakpoints, Watchpoints, 3 Traces, and Intercepts) This chapter describes the use of breakpoints, watchpoints, traces, and intercepts to monitor and control target program execution. Topics include: Using Monitors Setting Breakpoints Setting Watchpoints Setting Traces Setting Intercepts For more information on the debugger commands mentioned in this chapter see the online command reference.
In This Book Using Monitors Monitors are useful for stopping program execution at speci c statements, for tracing program execution, for watching variables for a change in value, and for intercepting program events. The debugger provides these types of monitors: A breakpoint stops execution at a speci ed source code statement, then reports the current target program location. Execution is resumed only when you enter another program execution command, such as go or step.
In This Book Setting Breakpoints Set breakpoints on lines in your code where you want execution to stop. When a breakpoint is set, a circled B symbol symbol appears next to the line number in the annotation margin. The target program stops just prior to the execution of the statement on which you have set a breakpoint. Each time execution stops at a breakpoint, the debugger output area displays the line number of the next statement that will execute.
In This Book Specifying Locations To set a breakpoint at a speci c program location, enter the breakpoint command. For example, breakpoint sum Sets a breakpoint at the rst executable statement in the procedure sum. breakpoint 16 Sets a breakpoint at the statement on line 16 of the source le. Specifying Actions If you want a speci c action to occur automatically when the target program encounters a breakpoint, use the -do option.
In This Book Using Breakpoints When Debugging Loops The breakpoint command option -after count is useful for debugging large loops in code. The -after count option speci es that the statement associated with the breakpoint must execute count times before execution is interrupted. This lets you control how many iterations of the loop occur before the debugger interrupts target program execution.
In This Book Figure 3-1. The Break Menu As Figure 3-1 shows, the Break menu is a Tear-o Menu. When you click on the dashed line at the top of the Break menu, the menu is displayed in its own window. The menu persists so that you can invoke commands from it without having to redisplay it. You can also move the menu to a convenient place in your workspace. Using the Breakpoint Set/Change Dialog Box The Breakpoint Set/Change dialog box allows you to specify all aspects of a breakpoint.
In This Book 3 Figure 3-2.
In This Book From the Breakpoint Set/Change dialog box, you can: 1. Select the type of breakpoint. 2. 3. 4. 5. 6. 7. The area directly under the Select Breakpoint Type radio buttons changes to re ect the information needed by the breakpoint type. Enter the appropriate information for the selected breakpoint type. Control whether or not messages appear when a breakpoint is hit. Temporarily disable or re-activate breakpoints.
In This Book the value of a variable is checked after every assembly instruction executes. Execution of the target program stops when the value changes. For performance purposes, you should set the granularity as coarsely as possible. For example, if you only need to know the value of the monitored expression each time you enter a procedure, there is no sense in monitoring it after every assembly instruction.
In This Book The Data Watchpoints dialog box shows detailed information on each watchpoint and it allows you to manipulate both the watchpoints and the display itself. Each watchpoint displays the variables or memory area it is attached to. The data display highlights when the data being watched is modi ed. Complete watchpoints can be hidden by selecting the 495 button next to the watchpoint. Select the button again (which is now 475) to redisplay the watchpoint.
In This Book left mouse button depressed. When you release the left mouse button, the expression appears in the ( ): input box. Use Options:User Configurable Buttons to modify the default behavior of the command buttons. Using the Watch Menu A variety of watchpoint commands are available from the Watch menu. Many entries on the Watch menu allow you to set a watchpoint associated with an expression entered in the ( ): input box. As Figure 3-4 shows, the Watch menu is a Tear-o Menu.
In This Book Using the Data Watchpoint Set/Change Dialog Box The Data Watchpoint Set/Change dialog box allows you to specify all aspects of a watchpoint. Invoke it by selecting Watch:Set. The dialog box in Figure 3-5 appears. Figure 3-5. The Data Watchpoint Set/Change Dialog Box From the Data Watchpoint Set/Change dialog box, you can: 1. Select the type of watchpoint. The area under the Select Watchpoint Type radio buttons changes to re ect the information needed by the watchpoint type.
In This Book Note that you use the 4Print ( )5 button on the expression &var to nd the address of the variable var . 2. Select the granularity (how often the value is checked). The default, Every Stop, causes the debugger to check values only when target program execution stops for some event like a breakpoint. 3 If you want target program execution to stop whenever the value changes, choose Statement granularity.
In This Book Setting Traces Traces are useful for monitoring the ow of a program. After setting a trace, for example, you can see when a particular function is called or when certain statements are executed. By default, setting a trace will display every statement, as it is executed, in the debugger output area. However, you can also set traces that stop execution or that execute debugger commands.
In This Book 3 Figure 3-6. The Trace Menu Using the Trace Menu A variety of trace commands are available from the Trace menu. Choose the appropriate option under Trace:Trace Every to enable tracing. As Figure 3-6 shows, the Trace menu is a Tear-o Menu. When you click on the dashed line at the top of the Trace menu, the menu is displayed in its own window. The menu persists so that you can invoke commands from it without having to redisplay it.
In This Book Figure 3-7. The Trace Set/Change Dialog Box Using the Trace Set/Change Dialog Box The Trace Set/Change dialog box allows you to specify all aspects of a trace. Invoke it by selecting Trace:Set. The dialog box in Figure 3-7 appears. From the Trace Set/Change dialog box, you can: 1. Select the granularity (how often the trace is triggered). 2. Restrict a trace to be active only in a speci ed block. 3. Specify how many levels of inherited data members should be included (for C++ programs). 4.
In This Book Using the trace Command The following example shows the result of invoking default tracing on the sample program average: trace go Trace Trace Trace . . .
In This Book Setting Intercepts Intercepts are like breakpoints that are set on signals and other events. For example, when a signal event occurs, target program execution stops, and a message is displayed indicating which signal was generated. Execution stops before the signal is delivered to the target program. By default, the debugger sets intercepts all HP-UX signals. It also sets, then suspends, intercepts on image loading and unloading, certain thread events, and exit events.
In This Book 3 Figure 3-8.
In This Book Using the intercept Command You can use the intercept command to create and control intercepts. In addition, you can use: list intercepts to show all intercept requests and the monitor number for each intercept. activate intercepts to restore suspended intercepts. suspend intercepts to suspend active intercepts. delete intercepts to remove intercepts. See the online command reference for more information on these commands.
Viewing and Manipulating Target Program 4 Data This chapter describes how to examine and change various types of target program data. Topics include: Examining variables and expressions Examinging registers 4 For more information on the debugger commands mentioned in this chapter see the online command reference. You can also invoke help on a particular command by entering help command name in the debugger command input box.
In This Book Examining Variables and Expressions Variables are evaluated in the scope of the current location, as indicated in the Current Location: line above the source le display. Usually the current location follows the PC (program counter) location, so variables are evaluated in the environment where your program is executing. For example, when you are single-stepping through your source, the current location is in the procedure you are stepping through.
In This Book Using Command Buttons There are two command buttons that allow you to display values of variables. The values are printed in the debugger output area. The following buttons are located below the source le display area: 4Print()5 Print the value of the contents of the ( ): input box. You can also evaluate expressions and assign values to expressions. For example, in C syntax, if n/2 is in the input box, the result of n divided by 2 is printed.
In This Book Using the Data Value Menu As shown in Figure 4-1, a number of print commands are available from the Data Value menu. Invoke it from Show:Data Value. Figure 4-1. The Data Value Tear-Off Menu The Data Value menu is a Tear-o Menu. When you click on the dashed line at the top, the menu is displayed in its own window The menu persists so that you can invoke commands from it without having to redisplay it. You can also move the menu to a convenient place in your workspace.
In This Book Assigns the value of y + z to x (using C syntax). Displays the result in the debugger output area. Assigns the value of y + z to x (using C syntax). Does not display the result in the debugger output area. Creates the temporary variable idx of type int (using C syntax). Show all user-de ned (temporary) variables.
In This Book To print a portion of an array, enter the range as the subscript. Specify a range in the form element ..element for C, C++, and Pascal, and as element :element for FORTRAN. For example, the following command prints list[1] through list[3] in the C language array list: print list[1..3] \\parray\list[1]: 4 \\parray\list[2]: 2 \\parray\list[3]: 0 To specify a limit on the number of elements the print command displays, use the property array_dim_max command.
In This Book For example, assume that C is the current language and that char_ptr points to the rst element in the string success: print char_ptr \\test_program\main\char_ptr: 7B03A541 *\\test_program\main\char_ptr: "success" print *char_ptr *\\test_program\main\char_ptr: 's' Instead of using language-speci c syntax, you can use the -indirect option to the print command as follows: -indirect all Follow all pointers encountered and show the value of the object pointed to.
In This Book To print all the records in a large linked list, you can make the debugger walk through the list and print each record separately. Use the while command, as shown in the following example: set item = first_item; \ while item != 0 -loop [print item -indirect 1; \ set item = item->next] >tmp.out The set command assigns the value of first_item to the pointer item. The while command then executes the commands between the brackets as long as item points to an address.
In This Book For large bu ers, the dump command is useful because you can use the -from and -to options to specify address ranges. Also, dump takes a number of options that allow you to format the output. The following example shows a sequence of commands that determine an address range in a bu er.
In This Book Examining Registers Select one of the Show:Registers menu items to display a dialog box that shows the contents of a group of hardware registers. Figure 4-2 shows a dialog box displaying general registers. You can also display oating point and special registers. From the Show Registers dialog box, you can: 1. View register contents. Register values that change during execution are highlighted. 2. Specify how the the register values are updated (similar to setting a watchpoint's granularity).
In This Book 4 Figure 4-2.
In This Book Using Register Commands Use the following commands to display the contents of groups of registers in the debugger output area: regs General registers cregs Control registers fregs Double-precision oating-point registers fsregs Single-precision oating-point registers fdregs Double-precision oating-point registers sregs Space registers The commands listed above are aliases for the dump command.
5 Using Debugger Commands This chapter describes the conventions you need to follow when you issue commands from the debugger command input box, in startup les, or as arguments to the dde command -do option.
In This Book Abbreviating Debugger Commands When you enter debugger commands, you can abbreviate any debugger command or command argument to its rst three characters. For example, des total is equivalent to describe total and bre 17 is equivalent to breakpoint 17. Entering Multiple Debugger Commands on One Line When you enter a single debugger command, terminate it with an end-of-line (EOL), which is usually done by pressing 4Return5.
In This Book Continuing Commands on the Next Line The continuation character, a backslash (\), lets you continue a command past the end of the line. The backslash must follow a space and must be the last character on the line. When you press 4Return5, the debugger echoes the backslash after the Debugger Input: prompt. Some debugger commands take a list of items separated by commas as an argument.
In This Book Resolving Case Sensitivity Debugger commands and options are not case sensitive. Arguments to commands are case sensitive. Therefore, the debugger considers the command debug -output temp my_prog to be the same as DEBUG -OUTPUT temp my_prog but di erent from debug -output temp MY_PROG Programming language expressions are case sensitive if the current language is case sensitive.
In This Book Editing the Command Line Choose Options:Command Input Mode to select an edit mode for the debugger command input box. The two choices are: Use Ksh Mode. This invokes a KornShell-like edit mode, which emulates either vi or emacs depending on the value of the EDITOR environment variable. Use Motif Mode. This invokes a simpli ed Motif edit mode, in which basic editing keys (Backspace, arrows) are active.
In This Book Recording Command Sequences for Later Playback The property record command is useful if you want to save debugger command sequences for reuse at another time. It records all commands whether they are invoked from menus, command buttons, or from the debugger command input box. The syntax is: property record {pathname [-append | -replace] | -on | -off } The pathname argument speci es the command le where the command sequences will be stored.
In This Book Invoking Shell Commands from the Debugger To invoke shell commands from the debugger command line, use the shell command. For example, the following command compiles the test program, average.c, for debugging: shell cc -g average.c The value of the SHELL environment variable determines which shell is invoked. Note Do not enter the shell command without an argument or invoke a command that expects standard input.
In This Book You cannot use parameters with input les. You can redirect debugger command output by issuing a command followed by I/O operators (similar to those found in most shells) from the command entry line. Output remains redirected until the command has been completed. cmd >pathname Redirect standard output to pathname . cmd >>pathname Redirect standard output and append it to pathname . cmd 2>pathname Redirect standard error output to pathname (Korn and Bourne shell notation).
In This Book Creating Alias and Define Macros You can use the alias and define commands to create two types of macros: An alias macro serves as a synonym for one or more debugger commands. The debugger expands alias macros only when the macro is at the beginning of a command line, or when the macro follows a semicolon in a line of commands. A de ne macro serves as a synonym for any string of text, including debugger commands.
In This Book Macro names may begin with a letter, a grave (`) accent, a hyphen (-) or an underscore (_). Macros accept parameters and are de ned like C language macros. See the descriptions of the alias and define commands in the online command reference for syntax details. You must delimit a macro name in a command string with characters not allowed in a macro name, such as the space character. For example: define X len De nes macro X as len. print X Expands to print len.
In This Book Using Reserved Identifiers and Special Macros The debugger reserves certain identi er and macro names for special purposes. Table 5-1 contains a complete list of reserved identi ers and special macros. You can use these reserved identi ers and special macros for several operations, including the following: Specifying commands that the debugger is to execute in speci c situations, such as after the invocation of the target program or after a fault occurs.
In This Book Table 5-1. Reserved Identifiers and Special Macros Function Reserved Identi ers and Special Macros `after_debug 1 Speci `after_fault 1 Speci `amb Identi es an overloaded C++ function. See online help on C++ debugging for details. `asm 1 Identi `command 1 Contains `cr 1 Speci `declared Speci es the outer block where the debugger stores variables that you create using the declare command. You can use `declared to refer explicitly to variables created with declare.
In This Book Table 5-1. Reserved Identifiers and Special Macros (continued) Reserved Identi ers and Special Macros Function `env(+n | -n ) If you do not specify n , `env refers to the current environment (that is, the target program procedure which the debugger refers to when evaluating expressions). If you do specify n , `env refers to an environment relative to the current environment. See Chapter 7 for more information. `image( name ) Associates a module name with a particular image.
In This Book Table 5-1. Reserved Identifiers and Special Macros (continued) Function Reserved Identi ers and Special Macros `predefined( lang obj type ) type, Speci es special blocks where the debugger stores names de ned by programming languages (lang type ) and object type (obj type ). You can use `predefined to refer explicitly to a language-de ned symbol name. See Appendix C and Appendix D for information on how to specify lang type and obj type .
In This Book Combining Debugger Commands Using Action Lists An action list is a series of debugger commands associated with a speci c breakpoint, watchpoint, intercept, or tracing request. The debugger executes an action list after executing to the breakpoint location, detecting a change in the watched value, receiving an intercept, or encountering a tracing event. (See the breakpoint, watchpoint, intercept, or trace command description in the online command reference for more information.
In This Book Creating Conditional Action Lists Use the if command to create conditional action lists. For example, the command breakpoint 18 -do [if i > 5 -then [print s] -else [go]] causes the debugger to invoke print s whenever i is greater than 5 at line 18. If i is 5 or less, the debugger invokes go. You can also add a return command to an action list if you want the debugger to exit from the action list under certain conditions.
In This Book The debugger executes in an arbitrary order the action lists that are eligible for execution at the same time. If two or more such action lists have an unrestricted go command (a go command with no arguments), the debugger executes all action lists up to the rst unrestricted go command it encounters, executes that go command, and then issues a warning that it discarded other go commands.
6 Customizing the Debugger This chapter describes methods for customizing the debugger to suit your own preferences and needs. Topics include: Customizations available from the debugger's Options menu Using startup command les Emulating the xdb or dbx debuggers The online help contains information about customizing the debugger's graphical user interface. Look for Customizing HP/DDE in the User Interface section.
In This Book Using the Options Menu Figure 6-1. The Options Menu A variety of customizations are available from the debugger's Options menu, shown in Figure 6-1. They include: Specifying the default program environment. Modifying breakpoint, watchpoint, and trace behavior for C++ programs. Changing the format and behavior of the stack display. Changing the format and behavior of the watchpoint display. Specifying the debugger's behavior when fork() calls are encountered.
In This Book Using Startup Command Files When you invoke the debugger, it executes three startup command les. Startup command les contain commands that de ne command aliases and commands that customize the debugging environment. The startup les and their order of execution are: 1. User interface manager startup le. Contains default de nitions for macros and for debugging environment settings.
In This Book Using a Personal Startup File to Customize the Debugger A personal startup le contains debugger commands that you want executed each time you invoke the debugger. To create a personal startup le, create a le called .dderc in either your current working directory or in your $HOME directory. In .dderc, place any commands that you want to execute at debugger startup. When you invoke the debugger, it searches for .dderc in the current working directory. If the debugger does not nd .
In This Book A Sample Personal Startup File The directory /opt/langtools/dde/contrib contains sample startup les that you can use as models for your own .dderc le. (On Solaris systems, the directory is /opt/softbench/dde/dde/contrib.
In This Book property array_dim_max 10 # Print a maximum of 10 # elements of an array. property echo -graphic # # # # # In the debugger output area, echo commands entered using dialog boxes, pop-up menus, or specially defined keys. alias so step -over # # # # Use "so" on an empty line to step execution, stepping over called routines. alias s step # Use "s" to step # execution, stepping into # called routines. alias gr go -return # Use "gr" to return to # the calling procedure.
In This Book # # # # # The following dump command aliases vary the format (hexadecimal, decimal, or character) used to display memory. "addr" is a memory address or mnemonic (such as PC) that you must supply as an argument when you invoke one of the aliases. alias Dh(addr) dump -from addr -bits 256 -hex alias Dd(addr) dump -from addr -bits 256 -decimal alias Da(addr) dump -from addr -bits 256 -character # # # # The following dump command aliases take two arguments: addr and n.
In This Book Emulating Other Debuggers The HP/DDE install area contains sets of macros that you can use if you prefer to use dbx or xdb commands in place of HP/DDE commands. Additionally, you can enter any dbx command without using macros if you pre x the command with dbx_. The following sections detail how to use dbx or xdb commands in place of HP/DDE commands.
In This Book Be aware that the macros a ect the input syntax of commands but have no e ect on the way the debugger formats its output. Debugger command output does not resemble xdb output. Compatibility with dbx The debugger provides a set of commands that make dbx and debugger commands compatible. Compatibility commands for dbx consist of the pre x dbx_ and standard dbx syntax. For example, the debugger command break 27 and the compatibility commands dbx_stop at 27 both set a breakpoint at line 27.
7 Identifying Program Objects This chapter describes the debugger's concept of environment, scope and visibility rules, and how you can refer to objects outside the scope of the current environment. Topics include: Understanding blocks and environments Changing the environment Overriding the current language Applying scope and visibility rules Using quali ed names The debugger's online help has more information on how to specify locations, blocks, and environments to the debugger.
In This Book Understanding Blocks and Environments A block is a program unit, such as a module, a main program, a subroutine, or a function. What constitutes a block depends on the language in which the program is written. Use the list blocks command to display the blocks in the program you are debugging. A block de nes and encloses a scope, the region of source code over which a name's declaration is active.
In This Book Changing the Environment Commonly, you may need to change environment because you cannot access a variable or expression from the current point of execution. For example, setting a watchpoint on a variable fails and a not found in current environment message is displayed. To change the environment, use one of the following methods: Invoke one of the selections under the Visit menu. You can specify a procedure name, a line number, or a le name.
In This Book Overriding the Current Language The debugger uses the source language of the current environment when evaluating expressions. You can use the property language command to change the language of evaluation, or you can use the print -language command to override the default language used to evaluate a single expression.
In This Book Note Special language-speci c search rules can also be used. For example, when debugging C++ programs, you can nd class members. Figure 7-1. Sample Module Illustrating Scope and Visibility In addition, you can explicitly reference symbols outside the scope of the current environment by using quali ed names. The following section describes the syntax for using quali ed names.
In This Book Using Qualified Names You can use quali ed names to have the debugger search in a speci c block, a top-level procedure or module, an executable image (a loaded object le or shared library), or a frame on the call/return stack. Block Qualified Names The debugger uses block quali ed names to refer to variables that are not visible from the current environment. A block quali ed name explicitly identi es the block enclosing the object and the object's name; the format is block \object name .
In This Book Fully Qualified Names A fully quali ed name identi es all blocks that enclose the object. To identify objects, the debugger uses fully quali ed names in the following format: nmodulen[block[nblock. . .]]nobject name where module is a module or a top-level name. In Pascal, module is speci ed by the module keyword. In C, module is the source le name with the .c extension removed. In FORTRAN, modules do not exist, so a top-level name is the routine name|MAIN, a program name, or a subroutine.
In This Book Figure 7-2. Sample Modules Illustrating Fully Qualified Names The following list shows how to reference each instance of the variable z by using fully quali ed names: \m2\z References the variable z de ned on line 3 of m2. \m2\procA\z References the variable z de ned on line 9 of m2. \m1\proc1\z References the variable z de ned on line 8 of m1. Note that fully quali ed names can be preceded by either a single backslash (\) or a double backslash (\\).
In This Book Image Qualified Names An image quali ed name may be necessary to eliminate ambiguity among module names when an application consists of more than one executable image (loaded object le or shared library). This occurs whenever an application contains a dynamically loaded library. More than one image may contain modules with the same name. An image quali ed name starts with the notation `image(image name ), where image name is the shortest unique path name of the object le.
In This Book You may explicitly refer to user-declared symbol names, created with the declare command, by using a block quali ed name of the form `declared\name . User-declared symbol names are de ned in an outer block named `declared. Since program symbol names visible from the current environment are searched before user-declared symbol names, user-declared symbol names may be hidden by program symbol names.
In This Book Figure 7-3. Sample Call/Return Stack and Program There are three ways to refer explicitly to symbols using a frame block quali er: main relative The notation is `main(n ) where n is the number of the frame counting from the least recent frame of the call/return stack to the desired frame. In the example in Figure 7-3, the frame with print_answer is `main(5). `main by itself refers to the oldest frame in the stack.
In This Book run relative environment relative The notation is `run(n ) where n is the number of the frame counting from the most recent frame in the program (that is, the location where the program is stopped). In Figure 7-3. the frame with print_answer is `run(2). `run by itself refers to the location where the program is stopped. The notation is `env(-n ) where n counts up (toward `main) from the current environment.
8 Debugging in Special Situations The HP/DDE debugger provides support for debugging in many di erent situations. This chapter describes the debugger's ability to: Examine core les Debug shared libraries Debug multi-threaded applications Debug assembly language code Debug optimized code Debug parent and child processes Debug applications that use ioctl or curses Run remotely For more information on the debugger commands mentioned in this chapter see the online command reference.
In This Book Examining Core Files You can use the debugger to diagnose some run-time errors after a program has aborted and produced a core le. The operating system generates a core le when a signal is not caught by the program. The core le records the state of the program at the time that the fatal error occurred. You can use the debugger to: Determine which signal or signals caused the failure. Trace back the call/return stack.
In This Book Core File Debugging When your program is rst loaded, the PC is set to the line that caused the core dump. The stack and all variables are as they were when the program was about to execute that line. Here are some useful actions that can help to locate problems: Examine the line in the Source File Edit Area that was responsible for the core dump to see if there is an obvious problem. Enter a local or global variable in the ( ): Input Box, then select 4Print ( )5 to examine its value.
In This Book Debugging Shared Libraries You can debug shared libraries that are either implicitly or explicitly loaded by your program. Implicitly loaded shared libraries are libraries that your program is linked against. Explicitly loaded shared libraries are loaded by calls within your program to shl load (3X). (On Solaris systems, shared libraries are loaded by calls to dlopen (3X).) To debug shared libraries, you must compile your main program debuggable (with the -g option).
In This Book 5. Load alternate debugging information for a program or library that has been compiled partly with and partly without debugging information, so that you can debug the routines compiled without debugging information (initialize -altdbinfo). In this unusual situation, you must issue the initialize command after the library is loaded. You may also nd the following command useful: list images This command gives you a list of the shared libraries your program uses.
In This Book Debugging Multi-Threaded Applications HP/DDE supports the debugging of multi-threaded applications that are implemented with HP DCE threads. (The Softbench version of the debugger for Solaris systems supports Solaris Threads.
In This Book Making libdce.sl Writable If your application uses /usr/lib/libdce.sl (the shared library version of HP DCE threads), you must make the shared library writable before you debug the application. The following command maps all shared libraries as writable: property flags tgt_shlib_debug You can place the command in your .dderc le. You can also invoke it from the debugger command line before you issue the debug command. When libdce.
In This Book Viewing and Manipulating Threads Choose Execution:Threads to display the Threads dialog box. The Threads dialog box, shown in Figure 8-1, displays a list of threads in your program. The list is automatically updated as threads are created or change status. Figure 8-1. The Threads Dialog Box Notice the following in the thread list: A numeric thread identi er is displayed for each thread. The thread number is assigned by the debugger.
In This Book Thread status is indicated with the labels RUNNING, READY, BLOCKED, and TERMINATED. Note that execution of TERMINATED threads has ended but the thread itself has not yet been deleted. The point where execution has stopped is indicated with the -> marker. You can also use the list threads command to display a list similar to the one in the Threads dialog box.
In This Book Environment in Multi-Threaded Applications When the target program is multi-threaded, the debugger includes a thread component in its concept of environment. (See Chapter 7 for more information on the debugger's general concept of environment.
In This Book refers to when evaluating expressions. It di ers from the running thread when you change environment from one thread to another. For example, you can use the thread speci er, `thread(n ) to change the current thread, in the following context: environment `thread(3) Notice that the call/return stack in multi-threaded applications includes a number of system calls. In Figure 8-2, the system call names begin with the cma__ pre x.
In This Book it alters the point of execution of the program. The debugger cannot ensure that the program state is valid following this transfer of control. The selected thread is the only one operated on by a step command. thread -disable prevents speci ed threads from running until they are enabled again using thread -enable. thread -enable allows the speci ed thread to run when you issue a go command. By default, all threads are enabled; ordinarily you use thread -enable to reactivate a disabled thread.
In This Book Assembly Level Debugging Although HP/DDE is intended as a high-level (source language) debugging tool, it also supports low-level (assembly language) debugging by using the machine code generated by the compiler. You can examine the machine code produced by the compiler for your program, and step your program at the assembly code level. You can set breakpoints on individual machine instructions, and you can also monitor virtual address ranges.
In This Book Figure 8-3. Assembly Instructions Dialog Box Use the 4Step Instruction5 button to step through your program one assembly instruction at a time. Use 4Step Over Instruction5 to step over routines called from the assembly code. The Assembly Tracing Active button enables updating of the Assembly Instructions window. If assembly tracing is disabled until you need it, your program might run faster.
In This Book For example: dump -from 2260 -to 227E -bits 16 -hex 00002260: 6BD8 3F29 2B7F FFFF 4821 0F58 8C20 2012 00002270: E800 0148 0800 025C E800 0122 23E1 0000 dump -from * -to 2284 -binary 00002280: 1110011111100000 0010011010101000 0000100000011111 The target manager startup le de nes aliases that dump the state of the machine registers and that monitor registers for changes. See the \Startup File" section in Appendix C.
In This Book You can use the `va function to refer to a speci c code location in any command that calls for a location speci er. Consider the following examples: break `va(00001FCC) Sets a breakpoint on a speci c machine address. goto `va(1FCC) Transfers control to a speci c machine address. You can also use the describe command with the `va function. For example: describe -location `va(1FCC) Finds the source statement that corresponds to a code location.
In This Book Debugging Optimized Code HP/DDE supports debugging of code compiled at optimization levels 2 and below. The following is a brief description of the compiler optimization options that are compatible with debugging: +O0 Minimal optimization. This is the default. +O1 Basic block level optimization. +O2 Full optimization within each procedure in a le. (Can also be invoked with the compiler option -O.) For more information about optimization levels, consult your compiler documentation.
In This Book Optimized Code and Unoptimized Code Source-level debugging of unoptimized code is relatively easy because there is a simple correspondence between source-code statements and the assembly-code instructions into which they are translated. Each statement is translated into a contiguous series of instructions, which are executed in sequence. The source and object code are isomorphic: they have essentially the same form.
In This Book Figure 8-4. Unoptimized Code: Statement-to-Instruction Mapping This means that even though it is the object code that is being executed and not the source code, a view of the source code in the debugger can still give you an accurate view of what the object code is doing. For example, when you step from statement 1 to statement 2, instructions 1 through 5 are executed in order, and the current location is now instruction 6, corresponding to statement 2.
In This Book Figure 8-5. Optimized Code: Statement-to-Instruction Mapping For all of these reasons, the order in which instructions are executed no longer corresponds to the ordering of the source-code statements. In the example, instructions 9 through 14 come from lines 11, 12, 10, 13, 10, 14, and 13. Some source-code statements, such as line 19 in the example, have no corresponding object code at all.
In This Book You can examine the current state of program data, because variables are stored in memory and their values are always accessible. The reason for this is that in unoptimized code, when you step from one statement to the next in the source code, what the debugger actually does is to step from one group of assembly instructions to the next; but because the assembly instruction groups correspond exactly to the source statements, it looks as if it is the source code itself that is executing.
In This Book Debugging Parent and Child Processes Select Options:Fork Behavior or use the property fork command to specify the process to be debugged when the target program forks. You have the following options when debugging programs that fork child processes: Ignore the child process and continue to debug the parent (property fork -parent). Free the parent process and debug the child (property fork -child). Debug both the child and the parent process (property fork -parent -child).
In This Book Debugging Applications That Use ioctl or curses Programs that use ioctl (2) or curses (3x) do not run in the User Program I/O Area as they would in a terminal window. The User Program I/O Area is not designed as a fully functional terminal emulator. However, you can still debug these types of programs with HP/DDE. One method is to run the program in a terminal window and then attach the debugger to the process.
In This Book Running the Debugger Remotely You can use resources provided by the X Window System to run the debugger on one machine while displaying the user interface on another. To run a debugging session over two machines in a network, you must: 1. Provide display access to the machine that will run the user interface.
A Line-Mode User Interface This appendix describes the components and operation of the debugger's line-mode user interface. The user interface manages all input and output and displays information about the target program during a debugging session. You need to use this interface if your system does not have OSF/Motif installed. You may also use it if you prefer a simple line-based interface. You can run the debugger's line-mode user interface under Emacs Version 18.
In This Book Invoking the Line-Mode User Interface You invoke the line-mode user interface by specifying the option -ui line to the dde command. When the debugger starts, a dde> prompt appears. At the prompt, you can enter most of the commands described in the online command reference.
In This Book The User Interface Startup File The le /opt/langtools/dde/ui/nls/C/ui_line.startup contains several macros that may save you some typing: Use w to display the 10 lines immediately surrounding the current source line. The w command is an alias for view -5 -lines 10. Use l to display the 10 lines immediately following the current source line. The l command is an alias for view -0 -lines 10.
In This Book Screen Display Conventions Letters and symbols in the margin of the transcript area indicate the following: > Current point of execution (the equivalent of the arrow) B Breakpoint (the equivalent of the stop sign) b Suspended breakpoint * Watched variable whose value has changed = Current environment (the equivalent of the horizontal bar) V Location requested by the view command The following symbols are used when debugging optimized code: ) Midline PC location marker # Variable whose value is
In This Book Examples The following examples illustrate some of the capabilities of the line-mode user interface. Invoke the debugger to debug the program average. $ dde -ui ui_line average Executing image in process 23640: "/home/smith/average". Break at: \\average\main\44 Source File: /home/smith/average.c 44 B> print_average (my_list, first, last); Print source lines and assembly code in the transcript area.
In This Book Use the prede ned alias w to print the 10 source lines surrounding the current line. dde> w 26 V int list[], low, high; 27 #endif 28 { 29 int total, num_elements, average; 30 total = sum(list, low, high); 31 > num_elements = high - low; 32 33 average = total / num_elements; 34 printf("%10.d\n", average); 35 } Print source, assembly, watched variables, and traceback in the transcript area.
In This Book Use the prede ned alias up to walk up the stack.
B B Language Managers Whenever the debugger performs a language-speci c operation, a language manager provides the necessary language-speci c information. This chapter describes the language managers that enable the debugger to evaluate expressions and declarations in di erent languages. Consult this chapter for information speci c to the language managers, such as the value of the language type argument to the print command's -language option.
In This Book Syntax Describes the syntax of debugger command arguments such as expression , declaration , and address that vary among the managers. The manager option argument represents options you can specify with the property flags command to change the behavior of a manager. Currently, the language managers do not o er any options through the manager option argument. You can use type names or synonyms wherever the syntax of a debugger command calls for a type, such as language type .
B C Language Manager C Language Manager Type Name lang_c Title ANSI C Description In general, this manager supports the C expressions and declarations described in the C language reference manual for your system, plus the debugging extensions listed under \Syntax." Syntax declaration Declaration of a type or variable, restricted to the following syntax: type ref id , . . .
C Language Manager enum id type ref * typeof(identi er) unsigned signed id expression A C expression constructed from the comments, operators, identi ers, constants, type cast, and extensions listed in this section.
B C Language Manager Constants Integer j j j j j j j j j digits [L l U u] (decimal) 0xdigits [L l U u] (hexadecimal) 0digits [L l U u] (octal) For example, 0xFu speci es an unsigned hexadecimal number. Float String Wide string For specifying a long long, any combination of two L's is acceptable (LL, ll, Ll, lL). digits .digits [ E e [+ -]digits ][F f L l] digits .[ E e [+ -]digits ][F f L l] .digits [ E e [+ -]digits ][F f L l] f jg j f j g j f j g j j j j j j j j j j For example, 2.
C Language Manager typeof(identi er ) Array slices language type f lang_c j c j cc g manager option None. Startup File None. Related Managers None. B-6 Language Managers The type of identi er ; can be used to refer to anonymous types In place of an array subscript, you can give a range of elements: * Lower bound to upper bound expression ..expression Given range *..expression Lower bound to given expression expression ..* Given expression to upper bound Example: print table[*, 100..
B C++ Language Manager C++ Language Manager Type Name lang_c++ Title C++ Description In general, this manager supports the C++ expressions and declarations described in your C++ reference manual, and the debugger extensions listed under \Syntax." Function overloading is permitted, and modules may contain identically named functions. Identically named functions are speci ed by name and parameters that identify them using the syntax `amb(function name,parameter type,parameter type,...
C++ Language Manager `amb(sum,int,int,...) refers to all functions named sum in the current environment that take at least two parameters, the rst two being integers. Also note that, in the examples above, the syntax relates to the use of `amb to specify a location. You can also use `amb as a part of a quali ed name to identify objects or variables. An example of the syntax is: \module\`amb(function name,parameter type,...
B C++ Language Manager long short float double long double void class id struct id union id enum id type ref * typeof(identi er) unsigned signed id The following are also available with the HP ANSI CC compiler: bool long long expression A C++ expression constructed from the comments, operators, identi ers, constants, and extensions listed in this section.
C++ Language Manager Conditional Sequential evaluation Size Type conversion Array indexing Member reference Grouping Scope resolution ?: , sizeof (type ) or simple type (expr ) [,] ->, ., .
B C++ Language Manager Wide string L"string " L'character ' L'\nnn ' Debugger Extensions location \identi er `va(address ) `amb(function name , parameter type , parameter type , . . .
C++ Language Manager Startup File None. Related Managers None.
B FORTRAN Language Manager FORTRAN Language Manager Type Name lang_ftn Title FORTRAN Description In general, this manager supports the FORTRAN expressions and declarations described in the FORTRAN language reference manual for your system, plus the debugging extensions listed under \Syntax." Syntax declaration A declaration of a variable, restricted to the following syntax: [external] type name identi er [(integer )] , . . .
FORTRAN Language Manager LOGICAL*1 LOGICAL*2 LOGICAL*4 BYTE CHARACTER CHARACTER*nnn A declaration of a record variable whose form was previously declared in a STRUCTURE statement: RECORD/struc name/[variable name | array name | array declarator] A declaration of a derived type whose form was previously declared in a TYPE de nition: TYPE(dtype name)[, attribute list ::] entity list expression A FORTRAN expression constructed from the operators, identi ers, constants, intrinsic functions, and extensions
B FORTRAN Language Manager Constants Integer Real Complex Logical digits (decimal) [radix #]digits [ KS ](radix = 2, 8, 10, 16; KS = 1, 2, 4, 8) For example, 16#1c6 speci es a hexadecimal integer. digits .digits [ KS ][E[+ -]digits ](KS = 4,8,16) digits .digits [ D Q [+ -]digits ] digits .[ KS ][E[+ -]digits ](KS = 4,8,16) digits .[ D Q [+ -]digits ] .digits [ KS ][E[+ -]digits ] .digits [ D Q [+ -]digits ] f f j g f j g j j g j j j j j For example, 3.5D0 speci es a double-precision number.
FORTRAN Language Manager IDNINT IFIX INT LOC MOD NINT REAL SNGL Debugger Extensions `long(expression ) Address Name identi er visible from the scope location Virtual address address Type conversion Cast the resulting value of expression to type `short(expression ) Cast the resulting value of expression to type Array slices In place of an array subscript, you can give a range of elements: : Lower bound to upper bound expr1 :expr2 Given range :expr Lower bound to given expr expr : Given expr to upper
B FORTRAN Language Manager expr1 :expr2 :expr3 :expr2 :expr3 expr1 ::expr3 Given range, stride of expr3 Lower bound to expr2 , stride of expr3 Given expr1 to upper bound, stride of expr3 Example: print table(::, 30:60:5) language type f lang_ftn j fortran j ftn j f77 j f90 g manager option None. Startup File None. Related Managers None.
HP Pascal Language Manager Type Name lang_pas_hp Title HP Pascal Description In general, this manager supports a subset of the Pascal expressions and declarations described in the HP Pascal reference manual for your system, plus the debugger extensions listed under \Syntax." Syntax declaration A declaration of a type or variable, restricted to the following syntax: type identi er [, identi er ] . . . = type reference var identi er [, identi er ] . . .
B HP Pascal Language Manager char string globalanyptr ^type reference array [bound..bound, ...] of type reference set of type reference typeof([location\]identi er) expression A Pascal expression constructed from the comments, operators, identi ers, literals, predeclared functions, type cast, and extensions listed in this section.
HP Pascal Language Manager Literals Integer Real Character String Boolean Pointer digits (decimal) digits .digits digits [.digits ]E[+ -]digits j For example, 5.48E-11 is a valid real number.
B HP Pascal Language Manager typeof (identi er ) Array slices The type of identi er ; can be used to refer to anonymous types In place of an array subscript, you can give a range of elements: * Lower bound to upper bound expression ..expression Given range *..expression Lower bound to given expression expression ..* Given expression to upper bound Example: print table[*, 100..110] language type f lang_pas_hp j lang_pas j pascal j pc j hppas j hppascal g manager option None. Startup File None.
HP-UX PA-RISC Assembly Language Manager Type Name lang_asm_pa Title HP-UX PA-RISC assembler Description This manager supports simple PA-RISC assembly language expressions as described in \Syntax." Syntax declaration None. expression An assembly language expression constructed from the reserved names, constants, operators, and address expressions listed in this section. Reserved Names r0 - r31 fr0l, fr0r, fr1l, . . .
B HP-UX PA-RISC Assembly Language Manager iva eiem itmr pcsq, pcoq (or pcspace, npcspace) iir, isr, ior ipsw eirr tr0 - tr7, ppda, hta rp t1 - t4 arg0 - arg3 dp ret0 ret1, sl sp mrp sret, sarg farg0 - farg3 fret sflags Constants Integer Float Character Interruption vector address External interrupt enable mask Interval timer Interruption instruction address space and o set queues Interruption parameter registers Interruption processor status word External interrupt request register Temporary registers
HP-UX PA-RISC Assembly Language Manager Operators Assignment Arithmetic Mod Shift Logical Grouping = +, -, *, / % <<, >> &, |, ^, ~ (and, or, xor, not) {} Address Expressions [location ]identi er Rn [expression ] (expression ) (expression , expression ) expression1 (expression2 ) expression .B expression .W expression .
B Solaris SPARC Assembly Language Manager Solaris SPARC Assembly Language Manager Type Name lang_asm_sparc Title SPARC assembler Description This manager supports simple assembly language expressions as described in \Syntax". Syntax declaration None. expression An assembly language expression constructed from the reserved names, constants, operators, and address expressions listed in this section.
Solaris SPARC Assembly Language Manager Multiply/divide register Window invalid mask Trap base register y wim tbr Constants Integer Float digits (decimal) (for example, 9876) 0digits (octal) (for example, 05376) 0xdigits (hexadecimal) (for example, 0x2F) B'digits (binary) (for example, B'10001111) Q'digits (octal) (for example, Q'71035) O'digits (octal) (for example, O'71035) D'digits (decimal) (for example, D'9876) H'digits (hexadecimal) (for example, H'2F) X'digits (hexadecimal) (for example, X'2F) R
B Solaris SPARC Assembly Language Manager expression .C expression .H expression .L 8 bits as a char 16 bits 32 bits Hexadecimal is the default input and output radix. language type f lang_asm_sparc j asm_sparc g manager option None. Startup File None. Related Managers None.
C C Target Managers This chapter describes the debugger target managers, which perform all operations that depend on the target hardware, operating system, or run-time environment. On HP-UX systems, the HP-UX PA-RISC target manager is installed. On Solaris systems, the Solaris SPARC target manager is installed. This chapter provides the following information about each manager: Type Name Identi es the name used for the manager as installed. Title Contains the name that the manager uses to identify itself.
In This Book You can create a new synonym for a target type name by creating a link to the target type name in the directory /opt/langtools/dde/tgt. For example, to make hppa a valid target type, enter the following commands (as superuser): cd /opt/langtools/dde/tgt ln -s tgt_hpux_pa hppa Startup File Related Managers Describes the startup le that executes when the debugger loads the manager. Lists other types of managers related to this manager.
HP-UX PA-RISC Target Manager C HP-UX PA-RISC Target Manager Type Name tgt_hpux_pa Title HP-UX PA-RISC Description This manager supports the HP PA-RISC processors running HP-UX and the HP SOM (Spectrum Object Module) object le format. Syntax address A hexadecimal integer or one of the following register names: r0 - r31 General registers fr0l, fr0r, fr1l, . . .
HP-UX PA-RISC Target Manager ipsw eirr tt0 - tr7, ppda, hta rp t1 - t4 arg0 - arg3 dp ret0 ret1, sl sp mrp sret, sarg farg0 - farg3 fret sflags Interruption processor status word External interrupt request register Temporary registers (usable only by code executing at the most privileged level) Return link Temporary registers Argument words Data pointer Return value Return value, static link Stack pointer Millicode return link Return value, argument Floating arguments Return value Status ag The register
HP-UX PA-RISC Target Manager C signal A UNIX signal number (integer 32) or one of the following UNIX signal names (the numeric equivalent of each is also shown): SIGHUP SIGINT SIGQUIT SIGILL SIGTRAP SIGABRT SIGEMT SIGFPE SIGKILL SIGBUS SIGSEGV SIGSYS SIGPIPE SIGALRM SIGTERM SIGUSR1 SIGUSR2 SIGCHLD SIGPWR SIGVTALRM SIGPROF SIGIO SIGWINCH SIGSTOP SIGTSTP SIGCONT SIGTTIN SIGTTOU SIGURG SIGLOST SIGRESERVE SIGDIL 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 l8 19 20 21 22 23 24 25 26 27 28 29 30 31 3
HP-UX PA-RISC Target Manager target type f tgt_hpux_pa j pa g target command One of the following arguments to the command target command: dump proc [full] Prints a list of known target processes help Lists and describes the supported target commands Startup File The startup le /opt/langtools/dde/tgt/tgt_hpux_pa.
Solaris SPARC Target Manager C Solaris SPARC Target Manager Type Name tgt_solaris_sparc Title Solaris 2.x SPARC Description This manager supports SPARC processors running Solaris 2.x using the ELF object le format.
Solaris SPARC Target Manager process id A UNIX pid (integer). program invocation A program invocation of the form program path [program arguments ].
Solaris SPARC Target Manager C Related Managers lang_asm_sparc obj_elfstabs Use to support simple assembly language expressions. Use to support ELF object format and STAB style debug information.
D Object Managers This chapter describes the debugger object managers, which allow the debugger to handle object and debug formats. The object managers process the debugging information in executable les. On HP-UX systems, the debugger uses the HP SOM object manager. On Solaris systems, the debugger uses the Solaris SPARC object manager. This chapter provides the following information about each manager: Type Name Identi es the name used for the manager as installed.
In This Book Startup File Related Managers Currently, the object managers do not o er any options through the manager option argument. Describes the startup le that executes when the debugger loads the manager. The object managers do not use a startup le. Lists other types of managers related to this manager. Names, titles, and syntax speci c to the object managers are described in the following section.
HP SOM Object Manager HP SOM Object Manager Type Name D obj_som_som Title HP SOM Description This manager supports the object format produced by the HP C, HP C++, HP FORTRAN, and HP Pascal, and the HP-UX PA-RISC assembler. The object and debug format is the Spectrum Object Module (SOM) format. Syntax object type f obj_som_som j som g manager option None. Startup File None. Related Manager tgt_hpux_pa Use to debug programs on HP PA-RISC machines running HP-UX.
Solaris SPARC Object Manager Type Name obj_elfstabs Title Solaris ELF with STABs Description This manager supports the ELF object format and STAB style debug information produced by the SunPro C and C++ compilers. Both the SC2.X and SC3.X versions are supported. Syntax object type f obj_elfstabs j elfstabs g manager option None. Startup File None. Related Manager tgt_solaris_sparc D-4 Object Managers Use to support SPARC processors using the ELF object le format.
E User Interface Managers This chapter describes the managers that enable the debugger to provide di erent user interfaces. Consult this chapter for information speci c to the user interface managers, such as the value of the ui type argument to the dde command option -ui. The debugger supports the graphical user interface, line-mode user interface, and SoftBench managers. This chapter provides the following information about each manager: Type Name Identi es the name used for the manager as installed.
In This Book property flags command to change the behavior of the manager. Currently, the user interface managers do not o er any options through the manager option argument. You can use type names or synonyms wherever the syntax of a debugger command calls for a type, such as ui type . For example, the following dde command speci es gui as the ui type : dde -ui gui a.
Graphical User Interface Manager Graphical User Interface Manager Type Name ui_gui Title GUI-Mode UI E Description This manager supports the graphical user interface and the HP/DDE command language, both of which are described in the HP/DDE online help. In addition, this manager provides compatibility with the dbx command syntax through the macros in /opt/langtools/dde/contrib/dbx_macros. Syntax ui type f ui_gui j gui g manager option None.
Line-Mode User Interface Manager Type Name ui_line Title Line-Mode UI Description This manager supports the line-mode user interface (described in Appendix A) and the HP/DDE command language (described in the HP/DDE online help). In addition, this manager provides compatibility with the dbx command syntax through the macros in /opt/langtools/dde/contrib/dbx_macros. Syntax ui type f ui_line j line g manager option None. Startup File The startup le /opt/langtools/dde/ui/nls/C/ui_line.
SoftBench User Interface Manager SoftBench User Interface Manager Type Name ui_softdde Title Softbench Softdebug UI E Description This manager supports the Softbench Softdebug tool. When using this UI manager, all communication (input, output, error) with HP/DDE is done via Softbench messaging technology. All communication (input, output, error) with the target program is also done via Softbench messaging. The message protocol for this manager can be found in the softdebug (1) man page.
Glossary accelerator An OSF/Motif shortcut for choosing a selection from the menu bar or from a pull-down menu. An accelerator for a menu item is indicated by name after the menu item name. Unlike a mnemonic, an accelerator can invoke a command when the name of the command is not visible. action list Glossary A series of debugger commands that is associated with a speci c breakpoint, intercept, watchpoint, or trace request.
In This Book annotation margin An area next to the Source File Area that contains line numbers, breakpoint symbols, and an arrow that indicates the current program counter location. archive library A library that contains one or more object les and is created with the ar command. When linking an object le with an archive library, ld searches the library for global de nitions that match up with external references in the object le.
In This Book breakpoint A monitor that, when encountered during program execution, stops execution and transfers control back to the debugger. A breakpoint is always associated with a particular address, which is either speci ed explicitly or implied by its association with a location. bu er An area in memory used as a temporary storage area. button In OSF/Motif, an icon, usually accessible by a mouse pointer, that starts an action.
In This Book critical point The instruction in the object code at which the most important action accomplished by a given source statement takes place. The critical point instruction is usually the instruction where a data value may change. Not every source code statement has a critical point; some statements have more than one critical point. Statements likely to have a critical point include assignment statements and function calls.
In This Book debugging information Name, type, source le, and source-line-to-address mapping information generated by the compiler for use by the debugger. This information can signi cantly increase the size of an executable le. All debugger information is preprocessed (and reduced in size) when the program is linked. `declared block Outer debugger block used to contain de nitions of user-declared symbol names.
In This Book environment A concept used by the debugger to determine what source code to display, what language to use when parsing expressions, and what blocks to search for objects. The run environment is the block containing the current point of execution. The current environment (also called the Current Location) is the run environment by default, but you can use the environment command to change the current environment to any block within the program.
In This Book and block enclosing the object and the object's name; the format is \\module \block \object name . HP Help System The online help system provided on HP-UX systems. You can obtain online help for the debugger by selecting the \Help" menu item. If you are not using the debugger, you can obtain help by clicking on the bookshelf icon on the front panel, then clicking on the Top Level icon to bring up the Help Manager window, and then selecting the debugger help.
In This Book The \Debugger Input:" Input Box is a text area in the main debugger window in which you enter commands to the debugger from the keyboard. intercept A monitor that stops program execution when a speci ed program event occurs. Events that can be intercepted include operating-system signals, the loading or removing of images from a program's address space, and the termination of the program. By default, all operating-system signals are intercepted. location A unique position in the user program.
In This Book mnemonic In OSF/Motif, an underscored letter in a menu name. You can bring up the associated menu by pressing Alt and the mnemonic. monitor A software \trigger," such as a breakpoint, that interrupts target program execution and optionally describes the state of the target program after the interrupt. See breakpoint, trace, watchpoint, and intercept. mouse button A key on the mouse that has some action associated with it when clicked.
In This Book quali ed name The name of a variable, speci ed in a format that allows you to refer to variables in any scope. See block quali ed name, frame block quali ed name, fully quali ed name, and image quali ed name. radio buttons An X construct consisting of several buttons representing several choices. Only one button may be selected at a time. When a button is selected, all other buttons are automatically deselected. registers Hardware registers.
In This Book library. The actual linkage does not occur until the program is run. Shared libraries can be implicitly or explicitly loaded. shell An HP-UX command interpreter (Bourne, Korn, Key, Posix or C), providing a working environment interface for the user. The shell takes command input from the keyboard and interprets it for the operating system. signal A software interrupt sent from the operating system to a program. This can inform the program of any asynchronous event.
In This Book a stack trace (generated by the tb command) displays information contained in each stack frame. standard input The source of input data for a program. The standard input le is often called stdin, and is automatically opened by the shell for reading on le descriptor 0 for every command invoked. standard output The destination of output data from a program.
In This Book to when evaluating expressions. The selected thread is the thread that was running when execution stopped. the selected thread di ers from the current thread when you change environments with the thread speci er `thread(n ). trace A monitor that stops execution momentarily, reports the current program location, then continues target program execution. You can specify whether a trace is in e ect at every source statement, at every instruction, or only at routine entry and/or exit points.
In This Book window A frame-de ned, rectangular area of the screen used by the X Window System to contain a particular application or a command line. Windows can be moved, resized, iconized, and manipulated.
Index Index Special characters "", 5-10 (), 5-2, 5-3, 5-10 ():, 1-2 ,, 5-3 .
B C backslash double (\\), 7-8 single (\), 5-3, 7-8 basic debugging tasks, 1-6 block quali ed names, 7-6 blocks, 7-2 inactive, 7-10 scope and visibility, 7-4 braces ({}), 5-2, 5-3, 5-10 brackets ([]), 5-2, 5-3, 5-10 Break menu, 3-5 Set, 3-6 Show, 3-8 breakpoint command, 3-3 -after option, 3-5 -do option, 3-4 -in option, 3-4 breakpoints, 3-2.
Index executing after invoking target program, 6-4 free, 2-9 go, 2-15, 5-17 history, 5-5 if, 5-16 initialize -altdbinfo, 2-2, 8-4 input, 5-7 intercept, 3-20, 8-12 intercept load, 8-4 kill, 2-9 list blocks, 7-9 list images, 8-5 list intercepts, 3-20 list threads, 8-9 multiple on one line, 5-2 print, 4-4, 4-8 property abort, 5-7 property array_dim_max, 4-6 property flags tgt_shlib_debug, 8-4, C-4 property property property property property property pxdb, 2-7 quit, 2-3 fork, 8-22 language, 5-4, 7-4 libra
loading xdb macros, 6-8 dderc_xdb startup le, 6-8 debug command, 2-6, 8-2 -attach option, 2-7 debugger attaching to a running process, 2-7 basic tasks, 1-6 command input box, 1-4 command line conventions, 5-1 command reference, 1-6 customizing, 1-6, 6-1 declaring temporary variables, 4-4 executing a target program, 2-14 information generated by compiler, 2-2 invoking, 2-3 invoking remotely, 8-24 language managers, B-1 line-mode user interface, A-2 looking at call/return stack, 2-18 man page, 2-3 MANPATH va
Index dump command, 4-8, 4-12 and assembly language code, 8-15 dumping memory, 8-15 registers, 4-12, 8-15, C-6, C-8 dynamically loaded code, 8-4 E editing changing modes, 6-2 Debugger Input command line, 5-5 EDITOR environment variable, 5-5 ELF object manager, D-4 eliminating quali ers, 4-2 Enable Images/Libraries Execution menu choice, 2-16, 8-4 ending a debugging session, 2-3 environment changing, 7-3 current, 7-2 overriding current language, 7-4 run, 7-2 environment command, 2-7, 2-12, 2-19, 7-3, 7-1
Options menu choice, 8-22 forked processes, 8-22 specifying debugger behavior, 6-2 FORTRAN language manager, B-13 frame block quali ers, 7-10 environment relative, 7-12 main relative, 7-12 run relative, 7-12 free command, 2-9 fregs macro, 4-12, C-6, C-8 freg_update macro, C-6 fsregs macro, 4-12, C-6 fsreg_update macro, C-6 fully quali ed names, 7-7 G -g compiler option, 2-2 general registers displaying, 4-12, C-6 monitoring for changes, C-6 specifying, C-6 global symbol search, 7-4 go command, 2-15 action
Index L M `label reserved identi er, 5-13 macros language, changing, 7-4 language managers, B-1 C, B-3 C++, B-7 FORTRAN, B-13 HP Pascal, B-18 HP-UX PA-RISC assembly language, B-22 SPARC assembly language manager, B-25 -language option, 5-4, 7-4 lexical block search, 7-4 libdce.
monitors. See breakpoints, intercepts, traces, watchpoints action lists and, 5-15 using, 3-2 Motif Mode command line editor, 5-5 mounting le systems, 2-8 mouse execution commands, 2-17 multiple action lists, 5-16 multiprocess debugging, 8-22 multi-threaded applications.
Index `predefined block search, 7-4 `predefined reserved identi er, 5-14, 7-9 preparing target program, 2-2 preserving breakpoints and watchpoints, 2-9 print command, 4-4, 4-8 Print() command button, 4-3 Print*() command button, 4-3 Procedure() Visit menu choice, 4-2 process, attaching to, 2-7 program counter arrow, 2-10, 2-14, 4-2 location, 2-10 specifying, C-6 program environment specifying defaults, 6-2 program execution beginning or continuing, 2-15 stepping, 2-16 property abort command, 5-7 property
S sample program, 2-2 scope, 7-2 rules, 7-4 Search Visit menu choice, 2-12 searching for text strings, 2-12 search rules, 7-4 semicolon (;), 5-2 Set Break menu choice, 3-6 Trace menu choice, 3-16 Watch menu choice, 3-12 setting breakpoints, 3-3 intercepts, 3-18 traces, 3-14 watchpoints, 3-8, 3-13 shared libraries debugging, 8-4 shell command, 5-7 shl load (3X), 8-4 `short reserved identi er, 5-14 Show Break menu choice, 3-8 Trace menu choice, 3-16 Watch menu choice, 3-13 Show menu Assembly Instructions
Index action lists, 5-17 Step command button, 2-14 Step Over command button, 2-14 stepping into system or library calls, 2-16 program execution, 2-14, 2-16 stopping debugger, 2-3 target program, 2-9 suspend intercepts command, 3-20 symbols naming, 7-4, 7-6 scope of, 7-4 user-declared, 7-10 visibility, 7-4 syntax command line, 5-3 expression, 5-3 resolving con icts, 5-3 system libraries, 2-10 T target managers HP-UX PA-RISC, C-3 Solaris SPARC, C-7 target program changing environment variables, 2-5 execut
user interface graphical, 1-2 line-mode, A-1 remotely invoking, 8-24 user interface managers, E-1 line-mode, E-4 OSF/Motif, E-3 SoftBench, E-5 use source command, 2-2 V Values Display Watch menu choice, 3-9 `va reserved identi er, 5-14, 8-15 variables assigning values to, 4-4 declaring, 4-4 examining, 4-2 external, 7-10 printing values of, 4-4 visibility rules, 7-4 Visit menu, 7-3 File(), 2-12 Procedure(), 4-2 Search, 2-12 Index-12 W Watch() command button, 3-10 Watch*() command button, 3-10 Watch menu