HP WDB GUI Reference Manual HP-UX 11i v1, HP-UX 11iv2, and HP-UX 11i v3 Edition 11 Manufacturing Part Number: 5992-0595 February 2008 Printed in the United States © Copyright 2008 Hewlett-Packard Development Company, L.P.
Legal Notices Copyright 2008 Hewlett-Packard Development Company, L.P. Confidential computer software. Valid license from HP 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. The information contained herein is subject to change without notice.
1. WDB GUI Overview Summary of Features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 2. Installing WDB GUI Installation Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Supported Configurations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Disk Space Requirements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Removing breakpoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Viewing and modifying breakpoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . To bring up the Breakpoints dialog box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . To view attributes of a breakpoint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . To modify attributes of a breakpoint . . . . . . . . . . . . . .
To enter program input. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Changing the Working Directory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . To set the current working directory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Tips. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Setting source paths. . . . . . . . .
Viewing source code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . To view your source code in the source view . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . To use the pop-up menu in the Source View . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Viewing assembly code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . To view code in the Disassembly View . . . . . . . . . . . . . .
Support for info mutex and info mutex . . . . . . . . . . . . . . . . . . . . . . . . . . Support for info rwlock and info rwlock . . . . . . . . . . . . . . . . . . . . . . . . . Support for info condvar and info condvar . . . . . . . . . . . . . . . . . . . . . . Debugging Inline Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Using Inline Debugging Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
viii
1 WDB GUI Overview The HP WDB GUI is a Graphical User Interface (GUI) designed by Hewlett-Packard for HP WDB. HP WDB (Wildebeest Debugger) is the HP implementation of the open source debugger GDB.
WDB GUI Overview systems running HP-UX 11i v1, HP-UX 11i v2, or HP-UX 11i v3.
WDB GUI Overview Summary of Features Summary of Features WDB GUI includes the following features: • Support for graphical display of batch RTC reports HP WDB GUI 5.8 and later versions provide graphical representation of batch RTC reports. HP WDB GUI displays: — Batch RTC reports on the basis of function names instead of block or byte — Leak/Heap/Corruption reports — Data for Heaps or Leak in the form of Pie Charts — Corruption Reports in tabular form — Data which you can sort on the basis of No.
WDB GUI Overview Summary of Features • Support for Viewing the Execution Path Entries HP WDB GUI 5.7 and later versions provide support to view the execution path for programs running on Integrity systems. This feature is supported only for compiler versions A.06.15 and later. • Support for viewing information on the state of pthread primitives HP WDB GUI 5.6 and later, provide support to view extended information on the state of threads, mutexes, read-write locks, and condition variables.
WDB GUI Overview Summary of Features The register view of the HP WDB GUI, is updated everytime the debugged program stops due to some event. • Support for viewing array contents added to HP WDB GUI The user can view the values for part of an array by defining the limits. The array contents are displayed for specific limits only. However, by default the entire array is displayed.
WDB GUI Overview Summary of Features • Single precision registers - fr7L = 26.1749401 fr7R Double precision register - fr7 = 1.5000000000000016 = 0 Enhanced support for debugging terminal user interface based applications : WDB GUI supports a new command-line option -tui to support debugging terminal user interface based applications (for example vim). • Customized display of Program Console: WDB-GUI supports a command line option -d to customize WDB GUI Program Console display.
WDB GUI Overview Summary of Features This feature allows the user to transparently debug PA-RISC applications and core files on Itanium-based systems in compatibility mode under Aries. When a executable is loaded and if the debug target is a PA-RISC binary then WDB GUI automatically changes the debugger flavor to PA-RISC version of HP WDB.
WDB GUI Overview Summary of Features • WDB-GUI enables you to debug your applications in the Command window using the command-line interface. • Hexadecimal and Decimal display in Dwell: This feature allows you to view the hexadecimal and decimal values of the variables. When you dwell on a variable, the value of the variable is displayed in decimal and hexadecimal formats as a tooltip in the Source view of the WDB GUI.
WDB GUI Overview Summary of Features • Point and click breakpoints editing: Click on the left of Source view or Disassembly view to set or delete a breakpoint. Click on a breakpoint symbol to bring up a dialog box that lets you modify the breakpoint attributes. • Program consoles: The program consoles supported are xterm, dtterm, hpterm. • Debugging an executable file or a core file produced by an aborted program • Attaching to a running process. • Debugging 32-bit programs.
WDB GUI Overview Summary of Features 18 Chapter 1
2 Installing WDB GUI This chapter discusses the installation information for HP WDB GUI.
Installing WDB GUI Installation Overview Installation Overview The following sections describe the requirement for installing WDB GUI: Supported Configurations HP WDB GUI 5.7 supports the debugging of programs written in HP C, HP aC++, and Fortran 90 on Integrity systems running HP-UX 11i v2 or HP-UX 11i v3, and HP 9000 systems running HP-UX 11i v1, HP-UX 11i v2, or HP-UX 11i v3.
Installing WDB GUI Installation Overview • Manuals contain one fileset: WDB-GUI-MAN NOTE Chapter 2 Selecting the WDB GUI product will automatically select only the Runtime subproduct of the WDB product. When you install the WDB GUI with swinstall, select both the WDB GUI and WDB products. If you select only the WDB GUI product, the WDB documentation does not load automatically.
Installing WDB GUI Installation Overview 22 Chapter 2
3 Debugging with WDB GUI This chapter describes how to use HP WDB GUI for debugging applications.
Debugging with WDB GUI Loading a Program and Changing Program Settings Loading a Program and Changing Program Settings You can set the following options for the debug sessions: • Run options • Environment variables • Standard input/output redirection NOTE When you click OK in the Load Program dialog box, any settings that you have specified in the Command view will be overridden.
Debugging with WDB GUI Loading a Program and Changing Program Settings Setting Run Options In the Load Program dialog box, use the Run tab to set options that specify the executable name, program arguments, core file name, and existing process to be used for the current debug session. To specify an executable: 1. On the File menu, click Load Program, then click the Run tab. 2. In the Executable Name box, type the path and name of the executable. To browse for the file, click the Browse button. a.
Debugging with WDB GUI Loading a Program and Changing Program Settings Set desired breakpoints at this stage because once you continue executing the process, you will not have control of execution until a breakpoint has been reached. NOTE • You can debug executables that are stored on NFS-mounted file systems, but you cannot attach to an existing process if the executable that you run resides on an NFS-mounted file system rather than on the local machine’s file system.
Debugging with WDB GUI Loading a Program and Changing Program Settings To view current environment variables 1. On the File menu, click Load Program, then click the Environment tab. 2. Check the Debug Environment Variables list box for a list of current environment variables. 3. Click OK. NOTE Chapter 3 • The Load Program dialog box does not display the environment variables that you specify using the Command view.
Debugging with WDB GUI Loading a Program and Changing Program Settings To set new environment variables 1. On the File menu, click Load Program, then click the Environment tab. 2. In the Variable box on the Add/Modify Environment Variable section, type the name of the variable you want to set. 3. In the Value box, type the value that you want to assign to the specified variable.
Debugging with WDB GUI Loading a Program and Changing Program Settings To redirect standard input and output information 1. On the File menu, click Load Program. 2. Click the Input/Output tab. 3. In the Stdin box, type the name of the file or browse to the file that you want to specify for standard input. 4. In the Stdout box, type or browse to the file that you want to specify for standard output.
Debugging with WDB GUI Starting and Stopping the Debug Process Tips: To save the program settings that you set in the Load Program dialog box, click Save Session on the File menu and make sure that the Program Settings (Load Program) check box is checked. Starting and Stopping the Debug Process You can use the commands in this section to control the execution of the program in the debugger. The Go and Restart options provide two ways to start the debugging process.
Debugging with WDB GUI Starting and Stopping the Debug Process To restart the debug process 1. On the Debug menu, click Restart. 2. Or, click the Restart button in the toolbar: Stopping a debug session The Stop Debugging command stops executing the current program and enables loading of a new executable. The program is still loaded in the debugger, but no process is running. All views except the Source view are cleared and initialized.
Debugging with WDB GUI Using Breakpoints Using Breakpoints You can set breakpoints that pause program execution prior to the breakpoint location. In this way, you can evaluate variables, set breakpoints, view the call stack, or perform other debug actions at specific locations during the debug process.
Debugging with WDB GUI Using Breakpoints Table 3-1 Breakpoint dialog box description (Continued) Field/Button Action Number of breakpoint hits to ignore before stopping text box Type the number of times you want to skip the selected breakpoint. This means that during execution, the WDB GUI will ignore the breakpoint “n” times and then pause at the breakpoint before executing “n+1.” Breakpoints list Displays all breakpoints that you have set.
Debugging with WDB GUI Using Breakpoints • Right-click in either the Source or Disassembly view, and on the pop-up menu, click Insert Breakpoint. • Or, click the toolbar button. Inserting breakpoints To insert a breakpoint 1. On the left side of the text in the Source or Disassembly view, place your cursor at the line where you want to insert a breakpoint. 2. Click M1. A breakpoint marker (a solid red octagon) appears in the left margin of the view, indicating that the breakpoint is set. Or 1.
Debugging with WDB GUI Using Breakpoints 4. Click OK. Viewing and modifying breakpoints The Breakpoints dialog box allows you to view and modify breakpoint attributes. You can also use this dialog box to add and remove breakpoints. To bring up the Breakpoints dialog box 1. Place the cursor on a breakpoint symbol. 2. Click M2. The Breakpoints dialog appears with the breakpoint you clicked on selected. Or 1. On the Edit menu, click Breakpoints. 2.
Debugging with WDB GUI Using Breakpoints Indicates an enabled breakpoint. Indicates a disabled breakpoint. • To break at a location only once, check the Temporary check box. Once a temporary breakpoint has been reached, it is removed automatically from the list. • To execute WDB commands when a breakpoint is reached, enter the commands in the Enter WDB commands to invoke at breakpoint text area. Type each command on a separate line.
Debugging with WDB GUI Advancing Through Your Program • You can automatically set breakpoints every time the WDB GUI starts by specifying them in the .gdbinit file. To automatically load breakpoints, add the following line to the .gdbinit file: break function_call • You can save the breakpoints you have set by saving the debug session. You can later restore the breakpoints you have saved by restoring the debug session.
Debugging with WDB GUI Advancing Through Your Program Stepping over functions The Step Over command provides a single step execution of the current instruction, unless the instruction is a function call. If the instruction is a function call, Step Over executes the entire function, then pauses at the instruction immediately following the function call. Program execution also pauses at breakpoints that are set in a function.
Debugging with WDB GUI Advancing Through Your Program If steplast is not meaningful at the current line, gdb will display the following warning message: “Steplast is not meaningful for the current line; behaviour undefined.” In C++, the steplast command is helpful while debugging heavy templated functions, because it directly steps into the call, thus skipping the constructor calls, if any. This behaviour is unlike the step command that steps into the constructor itself. To step last a function 1.
Debugging with WDB GUI Setting Signal Handling Setting the next statement to execute The Set Next Statement command sets the program counter at the current cursor location. The program begins execution from the newly set statement instead of from the previous program counter location. You can use the Set Next Statement command to change the flow of execution if you want to re-execute or skip a portion of the program. To set the next statement to execute 1.
Debugging with WDB GUI Setting Signal Handling Table 3-2 Columns and descriptions Column Description Signal Name of the signal Stop Indicates whether or not to halt execution on signal. Print Indicates whether or not to announce the signal Pass Indicates whether or not to pass the signal to the program. Passing the signal allows the program to handle the signal. Description A description of the signal.
Debugging with WDB GUI Setting Signal Handling Table 3-3 Buttions and descriptions Button Description OK Click to apply changes you have made and exit this dialog box. Apply Click to apply the changes that you have made. Cancel Click to exit this dialog box. Changes that were not applied will be lost. Viewing signal handling To view how signals are handled 1. On the Edit menu, click Signals. 2. When you are finished, click Cancel to close the dialog box.
Debugging with WDB GUI Browsing Functions Browsing Functions WDB GUI makes it easy to lookup and visit functions in your source code. You can specify a regular expression filter to control which functions are listed, and you can visit the source of a listed function simply by clicking on the name in the list. The function browser is in the tool bar at the top of the debugger’s main window. Viewing source for a function The most direct way to view source for a function is to: 1.
Debugging with WDB GUI Using the Program Console Function filters are regular expressions. This allows you to, for example, precede an expression with ‘^’ to match the beginning of a function name, or follow the expression with ‘$’ to match the end of a function name. NOTE Unless you specify otherwise, “.*” is assumed to precede and follow the filter you enter. Examples: • “foo” is equivalent to “.*foo.*” • “^foo” is equivalent to “^foo.*” • “foo$” is equivalent to “.
Debugging with WDB GUI Using the Program Console See Setting Program Input/Output Redirection in the Loading a Program and Changing Program Settings topic for more information on standard input/output redirection. NOTE Unless the debugger is attached to an existing process, standard output and standard error are merged in the Program Console. You cannot redirect standard error. Viewing program output To open the program console 1. On the View menu, click Program Console.
Debugging with WDB GUI Changing the Working Directory • To redirect standard error output, start your program in a terminal window outside of the WDB GUI and then attach to the process. This gives you direct control of standard error output. Changing the Working Directory The current working directory is the directory where the debugger runs. This is where the debugger looks for your program executable and core file. This is also one of the places the debugger looks for your source files.
Debugging with WDB GUI Setting source paths Setting source paths You can set source paths so that the WDB GUI can locate the source files for the currently loaded executable. You can also delete and change the order of priority for the source paths that you have set. Adding and deleting source paths To add a source path 1. On the Edit menu, click Source File Paths. 2. Click the Browse... button in the Source File Paths dialog box. 3.
Debugging with WDB GUI Setting source paths 4. When the proper path appears in the Selection box, click Add. 5. In the Source File Paths dialog box, verify that the source paths you selected appear in the Source File Paths list. Click OK. To delete a source path 1. From the Edit menu, click Source File Paths. 2. In the Source File Paths list, select the source path you want to delete. 3. Click Delete. The selected source path disappears from the Source File Paths list. 4. Click OK.
Debugging with WDB GUI Setting Object Paths To move a source path down 1. On the Edit menu, click Source File Paths. 2. In the Source File Paths list, select the source path you want to move down. 3. Click Move Down until the path is where you want it in the list. 4. Click OK. Tips • One way to save your source path information is to save your debug session. • You can automatically set source file paths every time WDB starts by specifying paths in the .gdbinit file.
Debugging with WDB GUI Setting Object Paths Adding and deleting object paths To add an object path 1. On the Edit menu, click Object File Paths. 2. Click the Browse... button in the Object File Paths dialog box. 3. In the Add Object File Path dialog box, double-click in the Directories list to select the appropriate path. 4. When the proper path appears in the Selection box, click Add. 5. Repeat steps 3 and 4 to add as many paths as you want. Click Close.
Debugging with WDB GUI Setting Object Paths 6. In the Object File Paths dialog box, verify that the object paths you selected appear in the Object File Paths list. 7. Click OK. To delete an object path 1. On the Edit menu, click Object File Paths. 2. In the Object File Paths list, select the object path you want to delete. 3. Click Delete. The selected object path disappears from the Object File Paths list. 4. Click OK. To replace an object path 1. On the Edit menu, click Object File Paths. 2.
Debugging with WDB GUI Setting Object Paths 3. Click Move Up until the path is where you want it in the list. 4. Click OK. To move an object path down 1. On the Edit menu, click Object File Paths. 2. In the Object File Paths list, select the object path you want to move down. 3. Click Move Down until the path is in the place where you want it to be in the list. 4. Click OK. Tips • One way to save your object path information is to save your debug session.
Debugging with WDB GUI Setting Pathmap Setting Pathmap You can set pathmap so that WDB GUI can locate the object files for the currently loaded executable, which are spread over many directories. The Pathmap ’From’ and ’To’ dialog box lets you define a list of substitution rules that need to be applied to the path names to identify the object files and the corresponding source files. In this dialog box, you can add, delete, and change the priority order of pathmap.
Debugging with WDB GUI Setting Pathmap Adding and Deleting Pathmap Using the Pathmap dialog box, you can add and delete pathmaps. To add a pathmap 1. On the Edit menu, click Pathmap. 2. In the Pathmap dialog box, click the Browse button. 3. In the From-Add Pathmap File Path and To-Add Pathmap File Path dialog box, double-click in the Directories list to select the appropriate ’From’ and ’To’ paths. 4.
Debugging with WDB GUI Opening Source Files • the directory that you want to replace is highlighted in the Pathmap- From and To text box. • the new directory that you selected appears in the directory edit box (to the left of the Browse button). 6. Click Replace. 7. Click OK. Changing the Order of Pathmap In the Pathmap list, the paths are searched in the order in which they are listed, that is, the WDB GUI will map the first pathmap listed, then the second path, and so on. To move a pathmap up 1.
Debugging with WDB GUI Opening Source Files To open a source file 1. On the File menu, click Open File. 2. In the Directories list, double-click to select the appropriate directory. 3. Select the Open in debugger toggle (this is the default). You have the option of opening a file in an external editor. This is useful when you want to edit a file in an external editor, but you also want the debugger to monitor the file for changes, and rebuild the file if changes are detected.
Debugging with WDB GUI Viewing Code Tips • Click the toolbar button to open the Open File dialog box: • To change the size of the Recent Files list on the File menu, click Preferences on the Edit menu, and then change the value of Recent files list, maximum size. • You can open another tab for a file in the Source view by choosing Edit File from the Source view pop-up menu (press M3).
Debugging with WDB GUI Viewing Code The dwell feature allows you to quickly view the value of a variable or expression. It is available from both the Source view and Disassembly view. WDB GUI provides support for the Mouse Scroll Wheel in Source Views and Disassembly Views. Viewing source code Before you can view your source code, you must have an executable loaded and running in the WDB GUI. Once you have loaded a file, you can use the Source view to see and manipulate your source code.
Debugging with WDB GUI Viewing Code • See a stack marker that indicates the current context, determined by the stack frame selected in the Call Stack view. • Access the pop-up menu to perform actions that will affect how the code executes. • Use dwell to quickly view the value of a variable or expression. To view your source code in the source view 1. In the main window, click the Source tab. 2. View the file’s source path by looking below the Source tab label. 3.
Debugging with WDB GUI Viewing Code • See the assembly code associated with the currently executing function. • See the instruction that corresponds to the current location of the program counter. The program counter is set to the point in your program where the debugger will begin executing. • See the location and status of breakpoints. • See a stack marker that indicates the current context, determined by the stack frame selected in the Call Stack view.
Debugging with WDB GUI Viewing Code • Open Separate View • Close Viewing variables using Dwell The dwell feature displays the value of the variable or expression on which the mouse pointer is paused. Dwell works in both the Source view and the Disassembly view. Dwell gives you quick information about a variable. For more detailed information, use Quick Watch, Watch view, or Local Variables view. To view the value of a variable or expression 1. Use the mouse to position the pointer over a variable.
Debugging with WDB GUI Fixing the Code from within the Debugger • If a is an array, dwelling on a displays the text [...]. This indicates that the variable is an array and cannot be viewed with dwell. You can use dwell to view the value of individual elements within an array. • Dwelling on i displays the value of i. • Dwelling on [ displays the value of a[i].
Debugging with WDB GUI Fixing the Code from within the Debugger NOTE Changes made to an executable during a debugging session are not saved when you exit the debugger. To apply the changes outside the debugger, you must rebuild your executable. There are a number of restrictions on the changes you can make to your program while it is being debugged. See Restrictions on Fixing Code from within the Debugger for details. Fixing code and continuing your program To edit your source code in the debugger 1.
Debugging with WDB GUI Fixing the Code from within the Debugger 3. Select the Open in debugger toggle (this is the default).If you prefer, you can choose to open the file in an external editor. 4. Make changes to the source file or files. 5. If you’re using an external editor, save your changes when you have completed them. 6. Click on one of the following toolbar buttons: • Step Into • Step Over • Step Out • Step Last • Go • Restart 7. WDB GUI asks you if you want to apply the source changes.
Debugging with WDB GUI Fixing the Code from within the Debugger 2. Click Browse... to display the Name of File to Fix dialog box. 3. In the dialog box, choose a file to add to the fix list. 4. Click OK to close the dialog box. The file you selected appears in the Add/Delete Fix List Files dialog. 5. When you are finished adding files to the fix list, Click OK.All files in the list will be monitored for changes. To request an immediate rebuild of a specific file 1. On the Edit menu, click Fix List....
Debugging with WDB GUI Finding Specific Text in Your Code Additionally, the debugger has these limitations in how it handles changed code: • With the exception of the routine at the top of the stack, new code will not be executed for a routine currently on the stack until that routine is popped off the stack and program execution reenters that routine.
Debugging with WDB GUI Finding Specific Text in Your Code Find Next searches for the next occurrence of the text or regular expression specified the last time you used Find. To find text or a regular expression 1. On the Edit menu, click Find. 2. In the Find box, type the text or regular expression that you want to find. If you use regular expressions, ensure that the Regular Expression check box is selected.
Debugging with WDB GUI Finding Specific Text in Your Code To find the next match On the Edit menu, click Find Next. The cursor is moved to the next match in the file, and the matching text is highlighted. Tips • Click the toolbar button to open the Find dialog box: • The last text string for which you searched is entered in the Find text box. • To find text in a specific view, click in that view.
Debugging with WDB GUI Displaying Memory Layout Displaying Memory Layout To display the memory contents for a specific address, complete the following steps 1. Click View -> Memory Layout The Memory Layout tab is dynamically added in the Debug view of the main screen. 2. Enter a valid address in the Address field and click Enter Data is displayed in tabular format in the Memory Layout tab. By default, the value of the Display Format is set to hexadecimal with the byte size. NOTE 3.
Debugging with WDB GUI Viewing Assembly Instruction Description Viewing Assembly Instruction Description To view a brief description of the assembly instructions in the Disassembly view, complete the following steps: 1. Load the program using the Load Program option from the main screen 2. Start the debugging session for the program 3. Click the Disassembly tab on the main screen. The assembly dump for the loaded program is displayed. 4.
Debugging with WDB GUI Saving and Restoring Debug Sessions Saving and Restoring Debug Sessions The Save Debug Session dialog box Chapter 3 71
Debugging with WDB GUI Saving and Restoring Debug Sessions The Restore Debug Session dialog box You can save and restore the following debug session attributes: • Current working directory • Program settings • Source paths • Object paths • Pathmap • How signals are handled • Current breakpoints • Window layout 72 Chapter 3
Debugging with WDB GUI Saving and Restoring Debug Sessions • Debugger preferences To save a debug session 1. On the File menu, click Save Session. 2. In the Save Debug Session dialog box, enter the name of the file where you want the session to be saved. You can type or browse for the file name. 3. Check the types of session data you want to save. 4. Click OK. Restoring a debug session 1. On the File menu, click Restore Session. 2.
Debugging with WDB GUI Debugging Memory Problems Debugging Memory Problems WDB GUI provides support to debug memory-related errors. Before debugging memory-related errors in a program, you must preload the librtc.[sl|so] runtime library for the required program. You can use the LD_PRELOAD environment variable or the +mem_check option for the chatr command to preload librtc.[sl|so]. To enable memory debugging, select Tools ->Memory Check. The Memory Check dialog window is dynamically displayed.
Debugging with WDB GUI Debugging Memory Problems When this setting is turned on, WDB scrambles the space and overwrites it with a specific pattern when a memory block is allocated or deallocated. This change to the memory content, increases the chance that erroneous behaviors will cause the program to fail. • Stop if the following block address is allocated or deallocated This option can be turned on to stop a program whenever a block at a specified address is allocated or deallocated.
Debugging with WDB GUI Debugging Memory Problems Viewing Memory Leaks and Heap Usage To view the leak report and heap report using HP WDB GUI, complete the following steps: 1. Load the application to the debugger by selecting File->Load Program. In the Load Program dialog-box, enter the executable name to load the executable or use the PID to attach the process for debugging. 2.
Debugging with WDB GUI Debugging Memory Problems • Load the program to WDB GUI. • Select the Incremental Heap Check Settings option while setting the memory debugging preferences in the Memory Check window. • Select Tools->Memory Check. • Enter Heap Check Interval and Heap Check Repeat Count in the Memory Check window. • Run the program after setting the required breakpoints. • Select View->Memory Usage->Incremental Heap to view the incremental heap profile.
Debugging with WDB GUI Debugging Memory Problems To view Batch RTC Reports, complete the following steps: • Select View->Memory Usage->Batch Report. The Batch RTC Report Viewer(Function-based) screen appears. • Enter a valid Batch RTC generated file (*.leaks/*.heap/*.mem) as Input file. Alternately, use the Browse button to locate the file from disk. • Press Enter key. The Batch RTC report appears in graphical format. There is a Pie Chart depiction of the leak and heap data.
Debugging with WDB GUI Debugging Memory Problems The summary information for the selected Arena ID is displayed in the Arena ID Summary frame. Block Details To view the block level details in an arena, select Block Details after selecting the required Arena ID in the Arenas list menu. The block distribution in the arena is displayed in the Arenas Block Distribution window. The Arenas Block Distribution window displays the block level space distribution graph for an arena.
Debugging with WDB GUI Debugging Memory Problems • The byte distribution for the used ordinary blocks, the used small blocks, the free ordinary blocks, and the free small blocks across the arenas is displayed in a pie chart. This information is also displayed in a table. • The number of blocks that are distributed across the used ordinary blocks, the used small blocks, the free ordinary blocks, and the free small blocks are displayed for each arena.
Debugging with WDB GUI Enabling and Disabling Specific Threads Enabling and Disabling Specific Threads You can explicitly enable or disable the execution of specific threads when debugging multi-threaded applications. The following steps discuss how to enable or disable the execution of specific threads: 1. Select the Threads tab to enable the Threads View. The Threads View displays the current threads that are active in the program that is being debugged. 2.
Debugging with WDB GUI Advanced Thread Debugging Support Advanced Thread Debugging Support WDB GUI 5.6 and later versions provide advanced thread debugging support to view the state of pthread primitives in applications running on 11i v2, or 11i v3 operating systems. You can view extended information on the state of threads, read-write locks, mutexes and conditional variables.
Debugging with WDB GUI Advanced Thread Debugging Support 1. To view information about the threads, select the Threads tab. This displays all the current threads in the application that is being debugged. 2. To enable advanced thread debugging, right click on the Threads view and select the Advanced Thread View option. This dynamically adds the Mutex tab, the R/W Locks tab, and the Cond Var tab to the debug view. You can also select Tools->Advanced Thread View to enable advanced thread debugging.
Debugging with WDB GUI Advanced Thread Debugging Support Support for info condvar and info condvar The Advanced Thread View must be enabled before loading the application for viewing extended information on conditional variables. To view information on the state of the current conditional variables in the application, complete the following steps: 1. To view information about conditional variables, select the Cond Var tab.
Debugging with WDB GUI Debugging Inline Functions Debugging Inline Functions HP WDB GUI 5.6 and later versions provide inline debugging support for debugging applications running on Integrity and HP 9000 systems. To enable inline debugging in HP 9000 systems, the applications must be compiled with the +inline_debug option (added in the A.03.65 and later versions of the HP aC++ compiler). In Integrity systems, the applications that are compiled with the -g option support inline debugging by default.
Debugging with WDB GUI Debugging Inline Functions breakpoint occurrences. You can set or modify individual breakpoints at specific instances of the inline function, while retaining the breakpoints in other instances of the specified inline function. This option must be enabled before loading the application for debugging. This option is not available for HP 9000 systems. Setting Breakpoints on Inline Functions To set breakpoints on Inline Functions,complete the following steps: 1.
Debugging with WDB GUI Viewing the Execution Path Entries Viewing the Execution Path Entries HP WDB GUI 5.7 and later versions of the debugger enable you to view the execution path entries for programs running on Integrity systems. This feature enables the display of the execution path taken across branched modules. Compiler Dependencies This feature is supported only for compiler versions A.06.15 and later. You must compile the program with +pathtrace compiler option to view the execution path entries.
Debugging with WDB GUI Viewing the Execution Path Entries The LEPT frame displays the following information: — The serial number for each local execution path entry — The corresponding PC address for the first instruction in each branch that is executed within the current function — The branch ID is displayed exclusively for each branch module that is executed. However, all the branch modules within the function are assigned an branch ID.
Debugging with WDB GUI Viewing the Execution Path Entries If the number of global execution path entries exceed 200, all the entries are not displayed in the same GEPT frame. You can click on First, Next, Previous,and Last to traverse and view all the global execution path entries NOTE Chapter 3 WDB GUI truncates the filename and function name to a maximum of 20 characters.
Debugging with WDB GUI Viewing the Execution Path Entries 90 Chapter 3
4 Troubleshooting WDB GUI This chapter discusses the troubleshooting information for HP WDB GUI.
Troubleshooting WDB GUI Error Messages Error Messages The following table explains the causes and solutions for the various error messages that the system displays while you work with WDB GUI: Table 4-1 Error Message descriptions Message Failed to find debugger Cause 1.If gdb is not in the default path /opt/langtools/bin/ 2. If GDB_SERVER is not set to a valid path Solution 1. Export GDB_SERVER= 2. Export GDB_SERVER to valid path (pointing to gdb).
Troubleshooting WDB GUI Error Messages Table 4-1 Error Message descriptions (Continued) Message Unable to make request -- gdb not connected Cause The gdb backend is not connected to the WDB GUI because: • The backend is in the process of connecting to the WDB GUI. • Or the backend has unexpectedly gone away Solution Wait until the backend is finished connecting to the WDB GUI. Or restart the WDB GUI. Unable to open slave pty.
Troubleshooting WDB GUI Error Messages Table 4-1 Error Message descriptions (Continued) Message Cause Solution Unrecognized file format. The Session or Preferences file cannot be parsed. The file is probably not a session file or has been overwritten by some other application. Choose a different session file. If you see this during startup, delete the Preferences file, $HOME/.wdbguirc. Wrong version of the file format. The Session or Preferences file has a format that cannot be parsed.
Troubleshooting WDB GUI Troubleshooting Tips Troubleshooting Tips Debugging executables over NFS You can debug executables that are stored on NFS-mounted file systems. However, you cannot attach to an existing process if the executable you are running resides on an NFS-mounted file system instead of on your local machine’s file system.
Troubleshooting WDB GUI Troubleshooting Tips Problems with keyboard shortcuts or mneumonics If you have problems with keyboard shortcuts or mneumonics, check if the CAPS LOCK or NUM LOCK key is active. These modifier keys disable most shortcut and mneumonic features. To use the short cuts and mneumonics, be sure that these two modifier keys are de-activated.
Troubleshooting WDB GUI Known Problems Known Problems • Problem:gdb prompt gets disabled in WDB-GUI Workaround:Giving a on gdb prompt in WDB-GUI, and disables gdb prompt. • Problem:WDB GUI Opens Multiple Windows Workaround:WDB GUI opens the same source file twice in the source window, when TERM the working directory is changed to an NFS mounted directory which has a canonical reference. For example, /tmp can canonically refer to /disk3/tmp.
Troubleshooting WDB GUI Known Problems If you modify and save the source file in one window, the changes will not be visible in the second window. If you then modify the source file in the second window, WDB GUI will display this warning: The file has been modified since opened or last saved. Save anyway? This happens only for an NFS mounted filesystem that has a canonical reference and you do a cd to that directory from within the debugger. • Problem:Terminal Window Sometimes Fails to Start on 10.
Troubleshooting WDB GUI Known Problems 1. If you have a read command in the .cshrc file and if you have not specified the absolute path for the Program Console (ie) TERM=dtterm, and if you try to open the Program Console, the GUI will hang or will dump core. When there is no full path specified for the dtterm/ hpterm/xterm, WDB GUI will use the which command to find the path for these terminals. which executes the .cshrc file and the read in .cshrc waits for some input .
Troubleshooting WDB GUI Using Online Documentation Another possible cause of coredump might be the absence of the motif patches PHSS_22947 and PHSS_23823. You can install these patches as well, to solve the coredump problem. • Problem:Support of FORTRAN array slices 0 Workaround:HP WDB-GUI 3.1.5 or higher does not support FORTRAN array slice feature in the Local Variables, Watch, and Quick Watch windows. The HP WDB 3.1.5 or higher command-line supports this feature.
Troubleshooting WDB GUI Using Online Documentation 4. Click OK. The new browser command is stored in the file $HOME/.wdbguirc when the WDB GUI exits normally. Locating information Table of Contents To find information, browse the Table of Contents in the left column of each page. It lists all of the documents available in WDB GUI Help. When you click on a document, it expands to list all of the topics it contains.
Troubleshooting WDB GUI Getting Support Takes you to the WDB GUI keyword index. Printing Topics You can print any HTML topic using the print command in your Web browser. Getting Support If you have a support contract, call the HP Response Center at 800-633-3600 (North America) or contact your Country Response Center. You will need the software system identifier (system handle) associated with your support contract. HP WDB is covered under the support contract for your HP compiler.