The SGI ProDev WorkShop Debugger is a UNIX source-level debugging tool for SGI MIPS systems. It displays program data and execution status in real time. This tool can be used to debug Ada (1.4.2 and older versions), C, C++, FORTRAN 77, and Fortran 90 programs.
For an introductory tutorial to the principles of debugging, particularly with the WorkShop Debugger, see Chapter 2, “Basic Debugger Usage”.
This chapter presents an overview of the WorkShop Debugger and is divided into the following sections:
The following sections outline the primary features and functions of the WorkShop Debugger and include references to comprehensive information found throughout this manual:
When you start the Debugger with an executable file, the Main View window displays, loaded with source code, ready to execute your program with your specified arguments. Most of your debugging work takes place in the Main View window, which includes the following:
A menu bar for performing debugger functions.
A control panel for specifying and controlling program execution.
A source code display area which displays the code for the program you are debugging.
A source filename field which tells gives you the path to the file displayed in the source code display area.
A status area for viewing the current status of the program.
The major areas of the Main View window are shown in Figure 1-1. For a comprehensive description of the Main View window, see the ProDev WorkShop: Debugger Reference Manual.
Part of the debugging process requires that you inspect data at various points during program execution. A trap is a mechanism for gathering this data. Traps are also referred to as breakpoints, watchpoints, samples, signals, and system calls. There are two categories of traps:
The Debugger lets you set traps at the following points:
At a line in a file (a breakpoint). These are the most commonly used stop traps. You can set them by clicking in the annotation column to the left of an executable statement in the source code display panel. (See the annotation column in Figure 1-1.)
At an instruction address.
On entry to or exit from a function.
For more information on traps, refer to Chapter 5, “Setting Traps (Breakpoints)”.
Register View: this option allows you to inspect registers.
You can also view data by using the data diving techniques described in “Using the Mouse for Data Diving”.
You can run the Performance Analyzer from the Main View window as follows:
The Performance Analyzer window will display your results. For more information about the Performance Analyzer, see the ProDev Workshop: Performance Analyzer User's Guide.
Select Perf -> Select Task -> Task in List from the menu bar.
Click on the Run button in the Control Panel. The executable is run.
Select Perf -> Examine Results from the menu bar.
The Static Analyzer displays information that makes it easier to determine where to set traps in your source code. To launch the Static Analyzer, select Admin -> Launch Tool -> Static Analyzer from the menu bar.
For more information about the Static Analyzer, see the ProDev Workshop: Static Analyzer User's Guide.
After you have isolated your code problem with the WorkShop tools, you will want to correct and recompile your source. WorkShop offers several ways to do this:
You can select the following from the Source Menu to make code changes in the source pane of the Main View window:
Select Source > Make Editable. Make your changes accordingly. (Make Editable toggles with Make Read Only.)
Select Source > Save to save your changes.
Select Source > Recompile to recompile your changed code.
You can invoke an editor from the Views menu that is a separate window in which to edit your code: Views -> Source View (you must select Make Editable from the File menu at this point to proceed).
You can call up a fork editor window to launch your own editor by using Source -> Fork Editor (first path).
You can call up a fork editor window to launch your own editor by using Views -> Source View (second path) . Then, from the Source View window select File -> Fork Editor.
If you use ClearCase (an SGI product), RCS, or SCCS for configuration management, you can integrate the tool into the WorkShop environment by entering the following command:
% cvconfig [clearcase | rcs | sccs]
This will allow you to use Versioning source control (from the Source menu) to check files in and out.
You can recompile your code from the Build View window, accessible from the menu bar by using Source -> Recompile.
For general information on the Build Manager tools, see Appendix A, “Using the Build Manager”.
Dynamic menus are available in all of the Debugger views and windows. To access the dynamic menus, position the mouse over the item you are interested in and click the right mouse button. A menu of actions that can be done with that object is displayed.
Data diving is available in several debugger views and screens. Click the right mouse button over any item and a default action occurs (when appropriate).
Depending on the cursor location, the result of a mouse action will vary:
In the Source View, a click of the mouse button over a variable displays the variable in the Data View window. Holding a mouse button down brings up a menu of available actions.
Holding a mouse button down over a blank area in a view brings up a menu that allows you to Jump To the selected line or Continue To the selected line.
When in the icon canvas area (the part of the screen to the left of the source code listing), holding a mouse button down provides a list of actions that can be performed against that line of code (for example, set and delete traps, enable or disable traps, or access the trap manager). Clicking the mouse in the icon canvas area sets or deletes a breakpoint.
A right mouse button click on a user function in the Source View displays the source for that function.
You can use the data diving feature described previously to obtain information about arrays in your program. When you dive on an array, the Data View window appears. From this window you can view statistics for the array (dimensions, total number of elements, maximum and minimum value), show the entire array, and 'slice' the array.
Fix+Continue gives you the ability to make changes to a program written in C or C++ without having to recompile and link the entire program before continuing to debug the code. With Fix+Continue, you can edit a function, parse the new functions, and continue execution of the program being debugged. Fix+Continue commands may be issued from the Fix+Continue window, which you launch from the Fix+Continue item on the Main View menu bar.
You can also issue Fix+Continue commands from the Debugger's command line.
See Chapter 8, “Debugging with Fix+Continue”, for a comprehensive description of the theory and operation of Fix+Continue, including a short tutorial.
The X/Motif Analyzer provides specific debugging support for X/Motif applications. The X/Motif analyzer is integrated with the Debugger. You issue X/Motif analyzer commands graphically from the X/Motif analyzer subwindow of the Debugger Main View. Select Views -> X/Motif Analyzer from the Main View window to access this subwindow.
See Chapter 11, “X/Motif Analyzer” for a comprehensive description of the theory and operation of the X/Motif Analyzer, including a short tutorial.
WorkShop provides you with a number of ways that you can customize your Debugger as best suited to the needs of your development environment.
See Chapter 12, “Customizing the Debugger”, for more tips on customizing the Debugger to your specific needs.