Home

Developer MagicTM: Debugger User's Guide

image

Contents

1. 0 Stop at file usr demos WorkShop jello jello c line 778 eS Sample all exit main file usr demos WorkShop jello jello c 2 Stop watch address 0x00400304 size 4 for write access Resulting command line 3 cv ee Stop at file usr demos WorkShop jello jello c line 912 display in Main View Figure 28 Trap Examples 5 3 1 1 Syntaxes Specific command syntaxes that may be entered in the Trap text field are shown in the following sections Note A backslash shown at the end of a line in these examples indicates that the command is continued Do not enter a backslash in the text field 5 3 1 1 1 Setting aTrap in filename at line number stop sample a11 pgrp at file filename line line number This command sets a trap at the specified line in the specified file for example Trap stop at 1449 78 007 2579 005 Setting Traps 5 5 3 1 1 2 Setting aTrap on instruction address stop sample all pgrp addr instruction address This command sets a trap on the specified instruction address Instruction addresses may be obtained from the Disassembly View window which is brought up from the Views submenu on the Main View window menu bar The addresses may be entered as shown such as 0af8cbb8 X or as Ox0af8cbb8 For example Trap stop addr 0x0af8cbb8 5 3 1 1 3 Setting a Trap on Entry to function stop sample all pgrp entry function file filename stop
2. 31 Step 1 Use lint Any a Be os it ee e Mae Gere Be BS oe ee Ae dae Se yt Som 32 Step 2 Check for Out of Bounds Array Accesses we ee es 32 Step 3 Check for Uninitialized Variables Being Used in Calculations 34 Step 4 Find Divisions by Zero and Overflows Ma ee SS ee ee ee ee Me ag a 35 Step 5 Perform Core File Analysis bP ee th oie FP ot I ae he eS Ge ke io 36 Step 6 Troubleshoot Incorrect Answers 2 1 we we ee 37 Selecting Source Files 3 39 How to Load Source Files 2 2 ee 39 Load Directly into the Main View Window 2 6 wee 39 Load from the File Browser Dialog Box ww we ee 40 iv 007 2579 005 Load from the Open Dialog Box Path Remapping Case Example for Path Remapping Tutorial The jello Program 4 Starting the Debugger Run the jello Program Perform a Search Edit Your Source Code Setting Traps Examining Data Exiting the Debugger Setting Traps 5 Traps Terminology Trap Triggers Trap Types Setting Traps Setting Traps with the Mouse Setting Traps Using the cvd gt Command Line Setting Traps Using the Traps Menu in the Main View Window Setting Traps in the Trap Manager Window Setting Single Process and Multiprocess Traps Syntaxes Setting a Trap Condition Setting a Trap Cycle Count Setting a Trap with the Traps Menu Moving around the Trap Display Area Enabling and Disabling Traps 007 2579 005 Contents Page 41 43 45 47 47 48 51 53 54 58 67 69 7
3. Figure 69 Callback Breakpoints Examiner The Callback Breakpoints examiner contains the following items Widget text field Allows you to choose a widget to examine by entering the widget address Name text field Allows you to choose a widget to examine by entering the widget name Class text field Allows you to choose a widget to examine by entering the widget s class Leave the field blank or enter Any to select all widgets Parent text field Allows you to move to the parent of the currently selected widget Previous button Moves you to the previously selected widget 007 2579 005 Children button Select button Breakpoint Type option button Clear button Callback Name text field Client_Data text field A 4 2 2 Event Handler Breakpoints Examiner 007 2579 005 Debugger Reference A Shows you the widget s children it is grayed out if the selected widget cannot have children Allows you to select the widget in the target process Allows you to select the type of breakpoint you wish to set In this section Callback is selected Clears all the current breakpoint selections and text fields Allows you to set the Name of the callback for the breakpoint Allows you to pass and get back pointer values for Client_Data When the Event Handler option of the Breakpoint Type option button in the Breakpoint Examiner is selected the examiner appears as shown in Figure 70 page 232
4. Decimal notation for line numbers Figure 123 Trap Manager Window with Redefined Function A 9 Debugger Command Line You can debug programs by entering dbx style commands at the cvd gt prompt found at the bottom of the Main View window see Figure 57 page 184 For more information refer to the dbx User s Guide A 9 1 Syntax for dbx style Commands The syntax for the debugging commands is as follows add_source filename line_number For C and C only when compiled with 032 Prompts you to add source code lines for example add_source fmain c 15 2 line_number must be within the body of a function Entering a period specifies the end of your input The source lines you provide are added after the specified line This command returns an ID existing or new depending on whether the function affected has already been changed or not The resulting new definition of the function is executed on its 312 007 2579 005 Debugger Reference A 007 2579 005 entry next time See also delete_source and replace_source alias shortform command Lists all aliases without arguments With arguments it assigns command to shortform assign expression1 expression2 g Assigns expression2 to expression1 attach pid Attaches to specified process ID pid call function_name argument Executes the specified function with any arguments supplied catch signal_name all With no arg
5. Specifies a pattern to clear the data if MALLOC_CLEAR_FREE is enabled The default pattern is Oxcafebeef for the 32 bit version and Oxcafebeefcafebeef for the 64 bit versions Only full words double words for 64 bits are cleared to the pattern MALLOC_CLEAR_MALLOC Clears data in any memory allocation returned by malloc It requires that MALLOC_FASTCHK be set MALLOC_CLEAR_MALLOC_PATTERN pattern Specifies a pattern to clear the data if MALLOC_CLEAR_MALLOC is enabled The default pattern is Oxfacebeef for the 32 bit version and 0xfacebeeffacebeef for the 64 bit versions Only full words double words for 64 bits are cleared to the pattern MALLOC_FASTCHK Enables additional corruption checks when you call the routines in this library Error detection is done by allocating a space larger than the requested area and putting specific patterns in front of and behind the area returned to the caller When free or realloc is called on a block the patterns are checked and if the area was overwritten an error message is printed to stderr using an internal call to the routine ssmalloc_error Under the Debugger a trap may be set at exit from this routine to catch the program at the error 127 Developer Magic Debugger User s Guide MALLOC_MAXMALLOC n Where n is an integer in any base sets a maximum size for any malloc or realloc allocation Any request exceeding that size is flagged as an error and
6. ProfilingiPC Sampling ser TimelCalistack Sampling ideal TimelPixie Floating Point Exception Trace HO Trace Memory Leak Trace Bi0k Hardware Counters Custom Configuration dialog E Examine Results x evmain r Follow exec Verbose Y Follow fork to exec General CallStack PC Sampling Experiment Directory testaa File Basename Follow fork Reuse File Descriptors Y Follow sproc W Compress Experiment Data Y Follow system L Disable Stack Unwind Disable Signal Handlers HWC Spec CaliperPoint Signal PollPoint Caliper Interval seconds __ Y AutoLaunch Analyser Ideal Tracing Data Runtime Figure 59 Perf Menu and Subwindows Launches the Performance Analyzer For complete information about the Performance Analyzer see the Developer Magic Performance Analyzer User s Guide Brings up the configuration dialog open to the Runtime tab as shown in Figure 59 page 198 The dialog opens with the Experiment Directory text field filled in with a default 007 2579 005 A 1 7 Traps Menu Debugger Reference A value The Performance Analyzer provides a default directory named test0000 If you use the default or any other name that ends in four digits the four digits are used as a counter and will be incremented automatically for each sub
7. B 9 Build Graph Control Area 338 The build graph control area contains a row of graph control buttons similar to the ones in the WorkShop Static Analyzer and the Call Graph View in the Performance Analyzer The Overview button is particularly useful in the Build Analyzer because it helps you quickly find obsolete files where a lot of dependencies are involved The build graph control area is shown in Figure 130 page 338 ae a Overview button Multiple Arcs button disabled Figure 130 Build Graph Control Area 007 2579 005 Using the Build Manager B B 9 1 Build Analyzer Overview Window Since build graphs can get quite complicated an overview mode similar to those in Static Analyzer and Profiling View is supplied that lets you view the entire graph at a reduced scale To display the overview window you click the overview icon see Figure 130 page 338 Figure 131 page 339 shows a typical Build Analyzer Overview window with the resulting graph The window has a movable viewport that lets you select the portion of the build graph displayed in Build Analyzer Source files that have changed and derived files needing recompilation are highlighted for easy detection In this particular color scheme the Build Analyzer Overview window displays normal source files in turquoise checked out source files in pink current derived files in dark blue and obsolete derived files in yellow Arcs appear only in black in this w
8. Chapter 2 page 11 outlines principles and procedures of the debugging process and how to approach them using the WorkShop Debugger Chapter 3 page 39 describes how to manage source files Chapter 4 page 47 presents a short Debugger tutorial based on demonstration programs provided with your WorkShop tools Chapter 5 page 69 describes how to set various types of traps Chapter 6 page 87 describes methods for controlling process execution Chapter 7 page 93 explains how to examine Debugger data Chapter 8 page 107 presents a short tutorial using Fix and Continue Chapter 9 page 125 describes heap corruption problems and how to detect them Chapter 10 page 135 describes debugging multiprocess programs Chapter 11 page 159 presents a short tutorial using the X Motif Analyzer Chapter 12 page 177 gives you tips on how you can customize the Debugger to the requirements of your working environment Appendix A page 183 describes all of the Debugger windows menus and other features in detail Appendix B page 329 describes the use of the Build Manager xxi Developer Magic Debugger User s Guide Related Publications The following documents contain additional information that may be helpful Obtaining Publications Conventions xxii C Language System Library C Language System Overview C Language System Release 3 0 1 Product Reference Manual C Programmer s Guide Developer Magic Perf
9. Hex Float Exponential Char String 14 phe Column sash Figure 107 Variable Browser with Menus Displayed A 6 6 2 Changing Variable Column Widths By using the sash between the columns you can adjust the relative widths of the Variable and Result columns see Figure 107 page 289 For example you may wish to adjust for short variable names and long result values A 6 6 3 Viewing Variable Changes The Debugger views that are involved with variables that is the Variable Browser and Expression View have indicators that show when the variable has changed since the last breakpoint If you click the indicator you can view the previous value The variable change indicators for a Variable Browser window are shown in Figure 108 page 290 007 2579 005 289 Developer Magic Debugger User s Guide Variable Browser pid 2024 Admin Variable Result Change indicator current value Change indicator former value 21 A 1 12183877e 44 2 52485 1432 28 7 4829338e 43 H 7 4829338e 43 hH 5 99037491e 39 No change indicator unchanged value a Figure 108 Typical Variable Change Indicators A 7 Machine level Debugging Windows The Debugger offers three views useful in debugging at the machine level the Disassembly View Register View and Memory View A 7 1 The Disassembly View Window
10. iconic Normat Detail Minimize Maximize State Baise Geometry Lower Select Formatting Parents Children Ancestors Dereference Pirs Descendants Family Alf Pattern Layout Bemove Figure 104 Node Menu Descriptions for these menu items are as follows State Controls the display of nodes There are three options e Iconic Displays the node header only e Normal Uses the default chart display but hides those fields selected to be invisible e Detail Uses the default chart display and shows all fields 282 007 2579 005 Debugger Reference A Geometry Manages graphical objects in the display area There are four options Minimize Sets the vertical size of an object to the default minimum number of fields The initial default is four fields but can be changed through either the Formatting selection from the Node menu or the Preferences selection from the Config menu Maximize Displays the object as large vertically as necessary to fit all of the fields Raise Raises the selected object s to the top of the display Lower Lowers the selected object s to the bottom of the display Select Allows you to select objects in various ways There are six options 007 2579 005 Parents Selects all objects that have pointers pointing to a selected object Children Selects all objects pointed to by any fields in a selected object Ancestors
11. Arg Values Arg Names LI Arg Types Location aec Admin Config Display Heip Stack sping jello c 779 frames main arge 1 argv Ox7fffaf44 jello c 34C __start ert1text s 133 Figure 33 Call Stack View Window The Call Stack View window lets you see the argument names values types and locations of functions as well as the program counter PC If symbolic information for the arguments has been stripped from the executable file the label lt st ripped gt appears in place of the arguments By default call stack depth is set to 10 but you can reset the depth of the Call Stack View by selecting the following from the Main View window Config gt Preferences To move through the call stack double click a frame in the stack The frame becomes highlighted to indicate the current context The source display in the 007 2579 005 007 2579 005 Viewing Program Data 7 Main View or Source View windows scrolls automatically to the location where the function was called and any other active views update The source display has two special annotations e The location of the current program state is indicated by a large arrow This represents the PC program counter e The location of the call to the function selected in the Call Stack View window is indicated by a smaller arrow This represents the current context and the source line is highlighted Figure 34 page 96 illustrates the c
12. Error Messages window contains a list of errors and other system messages that pertain to your source modifications parses and attempts to run your modified source You can highlight the source line where the error occurred by double clicking the appropriate line in the window The Fix Continue Error Messages window contains the following buttons Clear Next Rescan Clears all the parsing errors and warnings Puts a check mark on the next unchecked error warning entry in the parse messages It displays the corresponding file and line in the Source view highlighting it according to the type of error or warning The Next option does not work after all the entries in the messages are ticked Erases all the ticks so that you can rescan all the error warnings from the beginning The Admin menu allows you to perform either of the following operations Clear All Close Clears all messages in the window Closes the window The View menu allows you to set any of the following toggles Show Warnings Append Parse Messages Append Load Messages Causes compile warnings to be displayed in the parse errors list Causes parse messages to be appended to the parse errors list Causes load messages to be appended to the load errors list 307 Developer Magic Debugger User s Guide A 8 3 Fix Continue Build Environment Window This section describes the Fix Continue Build Environment window see
13. Note To see all of the stack frames select the following from the Menu Bar Views gt Call Stack View 6 1 2 Execution Control Buttons The execution control buttons enable you to control program execution Most of these buttons are not active until the Run button has been selected and the program is executed Note The Print button does not affect program execution It is described in Appendix A page 183 Run Creates a new process for your program and starts its execution The Run button is also used to re run a program Kill Kills the active process Continue Resumes program execution after a halt and continues until a breakpoint or other event stops execution Stop Stops execution of your program When program execution stops the current source line is highlighted in the Main View window and annotated with an arrow Step Into Steps to the next source line and into function or subroutine calls To step a specific number of lines right click on the button This displays the pop up menu shown in Figure 31 page 89 You can select one of the fixed values or enter your own number of steps by selecting N Selecting N displays the dialog box shown at the right in Figure 31 page 89 88 007 2579 005 Controlling Program Execution 6 Figure 31 Pop up Menu and Step Into Dialog Step Over Steps over function or subroutine calls to the next source line To step a specific number of lines right click on t
14. Selection Detail Breakpoints Trace Widget Tree Figure 77 Trace Examiner The Trace examiner contains the following items Collect Trace toggle Allows you to turn the tracing on and off File text field Allows you to select the file name for the trace If no file is selected a default filename for the trace is chosen 007 2579 005 241 Developer Magic Debugger User s Guide Search text field Allows you to perform an incremental textural search for the trace list Filter button Launches a dialog that allows you to select the trace entry types you want displayed in the list Clear File button Erases the trace file Any subsequent trace information goes to the beginning of the file A 4 4 Widget Examiner The Widget examiner see Figure 78 displays the internal Xt widget structure as well as the Xt inheritance implementation using nested C constructs Class XmPushButtonGadget pos a Expr Figure 78 Widget Examiner 242 007 2579 005 Debugger Reference A A 4 5 Tree Examiner 007 2579 005 The Widget examiner contains the following items Widget text field Name text field Parent button Previous button Children button Select button Allows you to choose a widget to examine by entering the widget address Allows you to choose a widget to examine by entering the widget name Allows you to move the parent of the currently selected widget Moves you to
15. The Disassembly View window allows you to look at machine level code rather than source level code A typical Disassembly View window is brought by selecting the following from the Main View window menu bar Views gt Assembly View The window is shown in Figure 109 page 291 with the Disassemble menu displayed 290 007 2579 005 Debugger Reference A Address Function Fife Admin Config Disassemble Display fraps PC Heip Continue Step Into Step Over Return Kit Run spin iL Process control buttons jello c 77 jello c 7 1 Display area jello c 772 jello c 73 spin 773 x 8403f74 lui spin 773 Bx00403f78 addiu spin 773 x 8483f c addu spin 773 Bx00403f80 addiu spin 773 x 0403f84 sw spin 773 x80483f88 sw jello c 7 4 gp 8xfc JP JP 17228 gp gp t9 Sp sp 56 ra 28 sp Annotation column gp 24 sp PC indicator jellosc 775 jello c 776 jello c 777 static int a b 2 float ea eb Sc ca ch CGS gl_sincos a amp sa amp ca jello c 778 it i spin 78 x 84 3f8c lw a 32732 gp t9 32544 gp a 1692 a8 al sp 52 rajts spin 778 x 0403f90 lw spin 778 x88483f94 lw spin 778 x 84a3f98 spin 778 x 8483f9c addiu jalr Figure 109 The Disassembly View Window with the Disassembly Menu Displayed A 7 1 1 Similarities with Main View Window 007 2579 005
16. sample all pgrp in function file filename This command sets a trap on entry to the specified function For example Trap stop entry anneal or Trap stop in anneal If the filename is given the function is assumed to be in that file s scope 5 3 1 1 4 Setting a Trap on Exit from function stop sample all pgrp exit function file filename This command sets a trap on exit from the specified function For example Trap stop exit anneal file generic c If the filename is given the function is assumed to be in that file s scope 007 2579 005 79 Developer Magic Debugger User s Guide 5 3 1 1 5 Setting a Watchpoint on Specified expression stop sample all pgrp watch expression for read write execute access This command sets a watchpoint on the specified expression using the address and size of the expression for the watchpoint span The watchpoint may be specified to fire on write read or execute or some combination thereof If not specified the write condition is assumed This syntax has no provision for looking on only a portion of an array The next syntax item can handle such a request For example Trap stop watch x for write 5 3 1 1 6 Setting a Watchpoint for address and size 80 stop sample all pgrp watch addrless address size size for read write execute access This command sets a watchpoint fo
17. 2 build results 2 enabled timel C Time printTime void Note 2 in these messages is the redefined function ID You will use this ID in the procedure in Section 8 3 5 1 page 121 The new function value is not active until the function is called 7 Continue execution by entering the following command at the cvd gt prompt cvd gt continue The following displays in the Execution View window Second printing of time 8 20 50 KKKKKK KKK KKK KKK 007 2579 005 117 Developer Magic Debugger User s Guide 8 3 2 3 Saving Changes If you prefer to use the command line experiment with add_source and other commands that give you the same functionality described for the menu commands For details on each command see Section A 9 page 312 Your original source files are not updated until the changed source file is saved You could save redefined function changes to the time1 C file However if you did the file would not match the tutorial So perform the following steps 1 Enter the following command cvd gt func Time printTime Select the following from the menu bar Fix Continue gt Save As A file_name dialog box opens The dialog box enables you to save your file changes back to the original source files or save them to a different file However since you do not want to save your changes press the Cancel button on the bottom of the dialog box Note You usually want to wait until
18. 231 Developer Magic Debugger User s Guide 232 Figure 70 Event Handler Breakpoints Examiner The Event Handler Breakpoints examiner contains the following items Widget text field Name text field Class text field Parent text field Previous button Allows you to choose a widget to examine by entering the widget address Allows you to choose a widget to examine by entering the widget name Allows you to choose a widget to examine by entering the widget s class Leave the field blank or enter Any to select all widgets Allows you to move the parent of the currently selected widget Moves you to the previously selected widget 007 2579 005 Children button Select button Breakpoint Type option button Clear button Event Type option button Client_Data text field A 4 2 3 Resource Change Breakpoints Examiner Debugger Reference A Shows you the widget s children it is grayed out if the selected widget cannot have children Allows you to select the widget in the target process Allows you to select the type of breakpoint you wish to set In this section Event Handler is selected Clears all the current breakpoint selections and text fields Allows you to set the event type for a given breakpoint Allows you to pass and get back pointer values for the Client_Data When the Resourc Change option of the Breakpoint Type option button in the Bre
19. 321 saving changes to source file Fix Continue tutorial 118 scheduling anomalies and pthreads 153 scientific programs checking for out of bounds array accesses 32 checking for uninitialized variables used in calculations 34 core file analysis for 36 finding divisions by zero and overflows 35 suggestions for debugging serial execution of 31 using lint for debugging 32 scripts for customizing the debugger 177 Search field in trap manager 84 Search window 27 Search selection in structure browser display menu 281 Search selection in Source menu 195 searching for character strings 27 searching in the jello tutorial 52 select syscall that blocks continued pthreads 327 Select selection in structure browser node menu 283 selection 224 selection in structure browser display menu 280 semctl syscall that blocks continued pthreads 327 semget syscall that blocks continued pthreads 327 semop syscall that blocks continued pthreads 327 send syscall that blocks continued pthreads 327 sendmsg syscall that blocks continued pthreads 327 sendto syscall that blocks continued pthreads 327 Session submenu 305 Set Trap selection in Traps menu 74 Set trap selection in traps menu 199 200 354 setbuildenv dbx style command 321 setting traps in jello tutorial 55 introduction 20 setting traps at the cvd gt command line 73 setting traps with the mouse 73 setting traps with the Traps menu 73 sginap sysca
20. 327 recvfrom 327 recvmsg 327 select 327 semctl 327 semget 327 356 semop 327 send 327 sendmsg 327 sendto 327 sginap 327 which block continued pthreads 326 write 327 writev 327 system calls traps 4 which block continued pthreads 326 T tab overflow area 172 tabs 173 tabs X Motif Analyzer examiner 225 Task View admin menu active toggle 217 clone 217 close 218 save as text 218 Task View config menu 218 Task View display menu 218 Task View layout menu 218 Task View window description 216 Task View selection in views menu 193 timeout procedure breakpoints examiner 234 tools integration 5 trace dbx style command 324 trace examiner 240 tracking program output 110 trap actions 70 trap condition 82 trap examples 77 trap icons 75 Trap Manager in jello tutorial 56 Trap manager menus 76 Trap Manager Window introduction to 76 007 2579 005 Trap Manager with Fix Continue 311 Trap Manager selection in views menu 193 trap triggers 70 trap types 71 traps 3 adding a breakpoint for a widget 167 all trap debugger command option 77 C exception trap 72 command syntaxes for 78 descriptive overview 69 disabling in jello tutorial 57 enabling and disabling 84 for multiprocesses 138 how to set 72 in jello tutorial 55 introduction 20 multiprocess traps 77 one time 91 pending trap 71 pgrp trap debugger command option 77 removing with mouse 73 sample trap 72
21. At the top of the window are the same process control buttons as those in the Main View window They behave the same way except for Step Into and Step Over which do machine level instruction stepping instead of source level Remember that you can select the number of steps by holding down the right mouse button over the Step Into and Step Over buttons The Admin Display Traps and PC items on the menu bar basically work same as their counterparts in the Main View window The exception is that the PC submenu selections Continue To and Jump To are based on machine level instructions rather than source level steps The Disassemble menu is discussed in Section A 7 1 2 page 292 The Preferences selection from the Config menu is discussed in Section A 7 1 3 page 294 291 Developer Magic Debugger User s Guide You can set traps either by using the Traps menu or by clicking in the annotation column to the left of the source display area that contains the disassembled code A 7 1 2 The Disassemble Menu The Disassemble menu allows you to display disassembled code It contains the following items Address Allows you to disassemble a specified number of lines starting from a specified source line address see Figure 110 Disassemble From Address Address G xG64Gd7 c Number of Instructions 26 OK Cancel Help Figure 110 The Disassemble From Address Dialog Function Allows you to disassemble
22. Debugger Reference A A 6 2 1 Config Menu The Config menu contains the following option Preferences Launches the Call Stack View Preferences dialog that allows you the option of setting the maximum depth of the Call Stack View A 6 2 2 Display Menu The Display menu contains the following toggles which change what is displayed in each entry of the Call Stack View in addition to the subroutine function name Arg Values Allows you to display argument values Default is on Arg Names Allows you to display argument names Default is on Arg Types Allows you to display argument types Default is off Location Allows you to display function location Default is on PC Allows you to display the program counter PC Default is off A 6 3 Expression View Window The Expression View window is shown in Figure 99 page 274 Expression View displays a collection of expressions that are evaluated each time the process stops or the context changes 007 2579 005 273 Developer Magic Debugger User s Guide Admin Config Display Heip Expression lfar Inear jello_conec b 3688 c 3688 Result 832387 1 8x 16883818 eria conec pa 3594 b 3586 4 Figure 99 Expression View In addition to the items on the menu bar the window has two pop up menus the Language menu and the Format menu The Admin menu is the same as that described in Section A 3 1 1 page 217 The Help menu is
23. Fortran 105 External Editor Command text field in Fix Continue Preferences dialog 203 fentl syscall that blocks continued pthreads 326 fibo program Fibonacci program used in multiprocess tutorial 140 File Browser for locating and loading files 40 File Browser selection in views menu 193 file dbx style command 317 File Difference Tool text field in Fix Continue Preferences dialog 203 File menu source view 211 347 Developer Magic Debugger User s Guide File selection in disassemble menu 293 files source loading 39 managing 39 files comparing source code with xdiff 124 files finding for Fix Continue 110 finding files for Fix Continue 110 Fix continue change id 109 Fix Continue Build environment window 308 comparing original to redefined code 121 Error message window 307 GUI 301 keyboard accelerators 205 menu selections and operations 201 Session 305 Show Difference submenu 202 Status window 302 switching between compiled and redefined code 121 tutorial 111 View submenu 203 Fix continue basic cycle description 107 breakpoints 118 build path 109 changing code tutorial 115 changing code from the command line 116 deleting changed code tutorial 116 editing a function tutorial 113 functionality and features 107 interface description 109 introduction and tutorial 107 overview 8 redefining function 112 redefining functions with 107 restrictions 110 sampl
24. Return button A 4 2 Breakpoints Examiner 226 The Breakpoints examiner is not really an examiner but a control area where you can set widget level breakpoints The breakpoints examiner is divided into three areas see Figure 68 page 228 e The widget specification area that contains the same information as that in the Widget examiner You can select a widget address name or class in this area as well as move to the widgets parents or children or select a widget in the application In cases where the breakpoint type does not apply to widgets for example input handler breakpoints this area is blank e The parameter specification area the contents of which vary according to the type of breakpoint you are setting For example for callback breakpoints this area contains the callback name and client data for event handler breakpoints it contains the event type and the client data and so on 007 2579 005 007 2579 005 Debugger Reference A The breakpoint area which contains the breakpoint name a search field and the Add Modify Delete and Step To buttons Since the Search text field and the four buttons appearing in the Breakpoints area function the same way no matter which Breakpoint Type is selected descriptions for these items are included here and will not be described in each of the eight remaining subsections These are Search text field Add button Modify button Delete button Step To button Al
25. The Process menu has the following options Change focus to this entry Create a new window Goto Opens a dialog that allows you to switch the process or thread currently focused on in the Main View window to the process or thread selected in the Multiprocess View window Selecting a call stack entry changes the Main View window s focus to that process or thread and positions the cvmain window at the offset of the selected call stack Brings up a new Main View window for the selected process or thread Opens a dialog box that allows you to enter the name of a thread on which focus should be switched This is useful when multiple threads all at the same location are collapsed into a 215 Developer Magic Debugger User s Guide Add Remove A 3 Ada specific Windows A 3 1 Task View 216 single line While Change focus to this entry always takes you to the first thread Goto allows you to jump to any thread Opens a dialog in which you can select from a list of process ids Selecting a process id PID in the dialog and pressing OK will cause the process to be attached and added into the Multiprocess View window s list of processes After you select a process thread by highlighting it click on Remove to remove it from the list of processes in the Multiprocess View window Note A process in a sproc share group cannot be removed from the process group This section discusses t
26. User Level Continue of Single 6 5 POSIX Pthread Scheduling Anomalies Blocking Anomalies How to Continue a Single POSIX 6 5 Pthread Other Pthread Debugging Hints Differences between 6 4 and 6 5 Pthreads viii Page 128 129 135 136 137 137 138 138 138 139 139 139 139 141 142 144 146 146 146 148 152 153 153 155 155 156 156 007 2579 005 Pthread Debugging Session X Motif Analyzer 11 Introduction to the X Motif Analyzer Examiners Overview Examiners and Selections Inspecting Data Inspecting the Control Flow Tracing the Execution Restrictions and Limitations X Motif Analyzer Tutorial Setting up the Sample Session Launching the X Motif Analyzer Navigating the Widget Structure Examining Widgets Setting Callback Breakpoints Using Additional Features of the Analyzer Ending the Session Customizing the Debugger 12 Customizing the Debugger with Scripts Using a Startup File Implementing User Defined Buttons Changing X Window System Resources DUMPCORE Environment Variable Appendix A Debugger Reference Main View Window Admin Menu Views Menu 007 2579 005 Contents Page 157 159 159 159 160 160 160 161 161 161 162 163 163 166 168 172 175 177 177 177 178 180 182 183 183 190 192 ix Developer Magic Debugger User s Guide Page Query Menu by ee ee a Oh ee Set soy et to ae A es oe ee ee ee a G 194 Source Menu te i ge in Ge oe ae Sa
27. for information Switches the window view to the X graphics context examiner see Section A 4 9 page 248 for information Switches the window view to the X pixmap examiner see Section A 4 10 page 249 for information In addition to access through the Examine menu each examiner can be accessed through a tab at the bottom of each view see Figure 67 2rehotts_ Trace Z Widget J Tree K Even K Cabai 7777 Figure 67 Examiner Tabs When first launched the X Motif Analyzer has the following four tabs from left to right e Breakpoints e Trace e Widget e Tree 225 Developer Magic Debugger User s Guide A 4 1 4 Return Button As you select other examiners through the Examine menu new tabs are added for the new examiners To delete a tab 1 Select the tab you want to delete 2 Right click and select Remove Examiner from the pop up menu The selected tab will disappear Note You can not remove the first four tabs The X Motif Analyzer will also bring up new examiner windows whenever they are needed see Chapter 11 page 159 for more information Click on the collapsed tabs to the right to display them Both the Widget and Name text fields have return buttons see Figure 68 page 228 just to the right Clicking these buttons causes the X Motif Analyzer to respond exactly as if you had pressed Return on your keyboard Note Only the Breakpoint Examiner and Widget Examiner havea
28. pane of the Main View window This chapter provides an introduction to the Fix Continue functionality as well as a tutorial to demonstrate many of the Fix Continue functions 8 1 Introduction to Fix Continue The following sections give you an overview to Fix Continue functionality 8 1 1 Fix Continue Functionality 007 2579 005 Fix Continue lets you perform the following activities e Redefine existing function definitions e Disable re enable save and delete redefinitions e Set breakpoints in redefined code e Single step within redefined code e View the status of changes e Examine differences between original and redefined functions A typical Fix Continue cycle proceeds as follows 1 You redefine a function with Fix Continue When you continue executing the program the Debugger attempts to call the redefined function If it cannot an information pop up window appears and the redefined function will be executed the next time the program calls that function 107 Developer Magic Debugger User s Guide 2 You redefine other functions alternating between debugging disabling re enabling and deleting redefinitions You might save function redefinitions to their own files or save files to a different name to be used later with the present or with other programs During debugging you can review the status of changes by listing them showing specific changes or looking at the Fix Continue Status View You can
29. sample trap command 77 set at signal name 81 set at time interval 82 set for C exception 82 set in filename at line number 78 set on entry to function 79 set on entry to sys call name 81 set on exit from function 79 set on exit from sys call name 81 set on instruction address 79 setting a watchpoint for address and size 80 setting a watchpoint on specified expression 80 setting at the cvd gt command line 73 setting conditions 82 setting cycle count 83 setting with mouse 73 setting with the Traps menu 73 83 Signal panel 84 stop trap 71 stop trap command 77 007 2579 005 Index Syscall panel 84 trap examples 78 triggering 70 traps definition 70 Traps Manager Traps menu options At Source Line 254 Entry Function 254 Exit Function 254 Group Trap Default 254 Sample Trap Default 254 Stop All Default 254 Stop Trap Default 254 Traps menu in the Main View window 74 Traps menu in trap manager 76 83 traps terminology 70 traps setting Fix Continue tutorial 118 tree examiner 166 243 Tree selection in structure browser display submenu 281 trigger traps term 70 triggering traps 70 true multiprocess program 135 tutorials debugging a multiprocess C program 139 Fix Continue 111 fortran multiprocess debugging session 146 heap corruption tutorial 129 how to load source files 39 introductory C code 15 introductory Fortran 90 13 jello program 47 path remapping 45 start
30. the relationships of the data within them It displays complex data structures as separate graphical objects using arrows to indicate relationships A sample Structure Browser is shown in Figure 102 page 278 with the Config Display Node and Format menus displayed 007 2579 005 277 Developer Magic Debugger User s Guide 278 Load Formatting Save Formatting Load Expressions Save Expressions Preferences Expression field Display Arrange Search Update Show Overview Clear Alf State Geometry Select Formatting Dereference Pirs Pattern Layout Bemove Display area Structure header jello_conec struct conec_struct J Field name column Result column Figure 102 Structure Browser with Menus Displayed The structure name is entered in the ore 0x100031a8 0x10003800 Li Default Vakie Type Address OF amp Bit Size Expression field It then appears as an object or set of objects in the display area in the lower portion of the window Each structure has a header identifying the structure color coded by data type Below the header are two columns the left displays the field name and the right displays the field s value If a displayed structure exceeds the size of the Structure Browser window scroll bars appear While the Admin menu contains options for selecting the active structure cloning struct
31. this is a non deterministic decision which depends on a large number of variables that is number or cpu s and so on The OS kernel creates a new OS kernel thread for the child pthread and engages it the child to that new OS kernel thread However marriage of the OS kernel thread and the new child pthread cannot occur until the new OS kernel thread actually runs This never occurs because in allowing the single parent 6 5 pthread to continue or run free it was requested that only one user pthread be run the parent If the parent however is using pthread_cond_wait to monitor the new life of its child then it the parent is parked on a mutex waiting for the child to run This is a Catch 22 The parent awaits the child but the child cannot run because only one pthread the parent has been requested to run The debugger user meanwhile is not amused The debugger displays running as the overall status and this is because no events of interest are occurring Everybody is waiting on everybody else Things are not working 154 007 2579 005 10 4 1 2 Blocking Anomalies Multiple Process Debugging 10 Blocking anomalies occur when the single 6 5 POSIX thread which is being continued or free run encounters a blocking condition in the course of its running The notion of blocking has three distinct flavors Blocking syscalls in the OS kernel see Section A 10 page 326 for a list When one of these kernel syscalls is b
32. 6 Troubleshoot Incorrect Answers 007 2579 005 Assume that the preceding steps have been taken and that all detected problems have been corrected Your program now completes execution but obtains incorrect answers What you do at this point will likely depend on special circumstances The following is a list of some commonly used debugging tips that may or may not apply to your situation 1 Try running your program on a very small size problem where you can easily obtain intermediate results Run your program under cvd on this small problem and compare with the known correct results 2 If you know that a certain answer being calculated is not correct set breakpoints in your program so you can monitor the value of the answer at various points in your program 37 Developer Magic Debugger User s Guide 38 3 You may want to set breakpoints on each call to a selected function or subroutine where you suspect there may be problems SeeSection 2 1 6 page 20 for suggested methods Debug COMMON blocks and EQUIVALENCE statements in Fortran Variables used in these statements must have the same type and dimension everywhere they appear and they must occur in the same order Normally ftnchek for FORTRAN 77 programs and cflint for Fortran 90 programs will find these errors However for FORTRAN 77 programs it is best to use an include statement for each COMMON block For Fortran 90 programs it is best to use
33. 74 43 4c BxBB403F c ff 6xG6403T84 f oo 6x86403f 8c 80 6x80483F94 oo coum rl Figure 116 The Memory View Window with the Mode Submenu Displayed A 7 3 1 Viewing a Portion of Memory 300 To view a portion of memory enter the beginning memory location in the Address field You can enter the literal value or an expression that evaluates to an integer address These address specifications must be in the language of the current process as indicated by the call stack frame The syntax of this expression depends upon the language of the program For example you can enter 0x7 4000 4 as the memory address when stopped in a C function or enter 7 4000 4 as the equivalent for a Fortran routine Press Enter while the cursor is in the field or click the View button to display the contents of that location and the subsequent locations in the display area This also displays the contents of the first address in the Value field where it can be modified The memory display area shows the contents of individual byte addresses The column at the left of the display shows the first address in the row The contents at that address are shown immediately to its right followed by the 007 2579 005 Debugger Reference A contents of the next seven byte locations If you enlarge the Memory View window you can see additional rows of memory A 7 3 2 Changing the Contents of a Memory Loc
34. A 1 4 Source Menu 194 X Motif Analyzer Provides you with specific debugging support for X Motif applications There are various examiners for different X Motif objects such as widgets and X graphics contexts that might be difficult or impossible to inspect using ordinary Debugger functionality The Query menu allows you to perform some of the queries available in the Static Analyzer These queries are convenient if you have previously built a cvstatic fileset However if you need to build the fileset from scratch the process becomes more involved For complete information about using the Static Analyzer refer to the Developer Magic Static Analyzer User s Guide and the cvstatic 1 man page With a current fileset you can double click any defined entity in the source code select the Where Defined option from the submenu appropriate to its type and the source code display area will scroll to the location where the item is defined The Source menu in the Main View window provides the following selections to manage source code files Open Loads a source file Open Recent Provides you with a popup dialog that gives you a selection of recently opened files from which to choose Save Records changes made during the debugging session to the source file You must first select Make Editable which appears in the Source menu when the file is read only Save As Records changes made during the debugging session to the s
35. Array Browser Window Array Browser Graphic Modes Examiner Viewer with Controls and Menus Examiner Viewer Preference Sheet Dialog Call Stack View Expression View Expression View Format Popup with Submenus File Browser Window Structure Browser with Menus Displayed Tree and Linked List Arrangements of Structures Node Menu Structure Browser Preferences Dialog Structure Browser Type Formatting Dialog Variable Browser with Menus Displayed Typical Variable Change Indicators The Disassembly View Window with the Disassembly Menu Displayed The Disassemble From Address Dialog The Disassemble Function Dialog The Disassemble File Dialog Page 251 252 255 256 258 259 261 262 264 265 267 270 272 274 275 277 278 281 282 284 286 289 290 291 292 293 294 007 2579 005 Contents Page Figure 113 The Disassembly View Preferences Dialog with Display Format Menu 295 Figure 114 The Register View Window a a a a 297 Figure 115 The Register View Preferences Dialog ee a e a r a 299 Figure 116 The Memory View Window with the Mode Submenu Displayed ba et ey 300 Figure 117 Fix Continue Status Window ew ee 303 Figure 118 Fixt tContinue Status Window Menus Re seh ee ea a WE ae ae A 304 Figure 119 Fix Continue Build Environment Window ED nies Se WoC Sh a 308 Figure 120 Debugger Main View Window tm tho ge ee en ie ee A a e A 310 Figure 121 Command Line Interface with Redefined Funct
36. Browser accepts any valid expression If the result type is simple a structure displays showing the type and value If the result type is a pointer it is automatically de referenced until a non pointer type is reached If the result type is a structure or union an object is displayed showing the structures fields and their values After the expression is entered the Expression field clears The Structure Browser can display unrelated structures at the same time you simply enter new structures by using the Expression field The Expression field is also used to enter strings used in searches A 6 5 3 Working in the Structure Browser Display Area 007 2579 005 Within the display area you select objects by clicking in the node headers Shift clicks add the selected object to the current selection You can drag selected objects using the middle mouse button 279 Developer Magic Debugger User s Guide Clicking the right button while the cursor is in the right column of an object displays the Format menu which is used to change the display You can set a default format or request that results be displayed by value type address or size in bits Holding down the right button in the header of an object brings up the Node pop up menu which is the same as the Node menu in the menu bar It is used to change the way selected objects are displayed When you left click in the header of an object it turns on the resizer which a
37. C exceptions or exceptions that throw the base type item stop sample exception unexpected all item item Stops on all C exceptions that have either no handler or are caught by an unexpected handler If you specify item stops on executions that throw the base type item 5 3 2 Setting a Trap Condition 82 The Condition field in the Trap Manager window lets you specify the condition necessary for the trap to be fired A condition can be any legal expression and is considered to be true if it returns a nonzero value when the corresponding trap is encountered The expression must be valid in the context in which it will be evaluated For example a Fortran condition like a gt 2 cannot be evaluated if it is tested while the program is stopped in a C function 007 2579 005 Setting Traps 5 There are two possible sequences for entering a trap with a condition 1 Define the trap 2 Define the condition 3 Click Add or 1 Define the trap Click Add 2 3 Define the condition 4 Click Modify or press Enter An example of a trap with a condition is shown in Figure 28 page 78 The expression i 1 has been entered in the Condition field If you were debugging in Fortran you would use the Fortran expression i eq 1 rather than i 1 After the trap has been entered the condition appears as part of the trap definition in the display area During execution any requirements set by the trigger mus
38. Command Line Interface 310 The Debugger command line interface accepts Fix Continue commands and reports status involving redefined functions or files Figure 121 page 311 shows a function successfully redefined using the command line Change id 1 was previously redefined and assigned the number 1 007 2579 005 Debugger Reference A Specify function with cvd gt redefine 1 Change id 1 d2 people cgeary interp fermat d2 people cgeary interp fermat o 18 1 gt ent Sel gh os ake d2 people cgeary interp fermat c 18 3 gt int result 1 d2 people cgeary interp fermat c 18 4 gt for i i lt n i d2 people cgeary interp fermat c 18 5 gt result a d2 people cgeary interp fermat c 18 6 gt return result d2 people cgeary interp fermat c 18 7 gt d2 people cgeary interp fermat c 18 8 gt Change id 1 redefined 1 enabled d2 people cgeary interp fermat c Change id 1 activated cvd gt Figure 121 Command Line Interface with Redefined Function A 8 4 3 Call Stack View The Call Stack View recognizes redefined functions It uses the decimal notation for line numbers as shown in Figure 122 Decimal notation for line number Figure 122 Call Stack View A 8 4 4 Trap Manager The Trap Manager recognizes redefined functions It uses the decimal notation for line numbers as shown in Figure 123 page 312 007 2579 005 311 Developer Magic Debugger User s Guide
39. Developer Magic Debugger User s Guide A 6 1 6 Examiner Viewer Controls 266 Note The Examiner Viewer is available only if you are have a Silicon Graphics workstation with Open Inventor installed on it The graphical display uses controls and menus from Examiner Viewer Examiner Viewer is based on a camera metaphor and borrows terms from the film industry such as zoom and dolly in naming its controls The graphical display area of the window is shown in Figure 96 page 267 with its main controls and menus Note that the buttons on the upper right side of the graphical display area may not be visible if the area is too small you can expose them by moving either the upper or lower sash to enlarge the display area The lines between the window panes include a small box to the right Click drag this box to change the size of the panes Examiner Viewer provides these controls for viewing the graph The right side buttons provide the following actions view mode Toggles between a view only mode closed eye and manipulation mode open eye In view only mode the cursor appears as an arrow and the graph cannot be moved Clicking on a portion of the graph selects the corresponding array element in the spreadsheet In manipulation mode the cursor appears as a hand and you can move the graph Dragging the graph with the left mouse button down moves the graph in any direction as if it were in a trackball a quick movement spins the
40. Figure 119 page 308 The Fix Continue Build Environment window provides you with the build information for your source code in your current environment It displays the command that was used to build your executable and the name of the file that contains the function that you currently have selected Bulid Environment Setting Tear off Default File specific f l Build Environment Setting Selected File l Compile directory Compile command wi E oe Selection aA I ok ener cance f aad o a Clear button Set button Cancel button Unset button Filter button Done button OK button Figure 119 Fix tContinue Build Environment Window 308 007 2579 005 Debugger Reference A The compiler and associated flags that were used to compile the file are normally gathered from the target You can use this window to make any changes to these flags The window allows you to select your build environment setting through the Build Environment Setting toggle that contains the following two options Default File Specific The Fixt Continue Build following buttons Select File Clear Set Unset Done A 8 4 Changes to Debugger Views Sets the build environment to default that is displayed in the window Sets the build environment to that of the file that contains the currently selected function You can change the file by clicking the Select
41. File button which launches the File dialog Environment window also contains the Launches the File dialog and allows you to select a file from which to set the build environment Clears the window Sets the build environment to what is displayed in the window Unsets the build environment Dismisses the window When you use Fix Continue views change to show redefined functions or stopped lines containing redefined functions A 8 4 1 Main View All Fix Continue actions are available through the Fix Continue menu on the Main View window See Figure 120 page 310 for details 007 2579 005 309 Developer Magic Debugger User s Guide Source view Editable function Decimal notation Fix and Admin Continue menu Annotated scroll bar 4 35 1 35 2 35 3 35 4 35 5 35 6 35 7 35 8 35 9 Source code status indicator Figure 120 Debugger Main View Window You can select commands from the Fix Continue menu or enter them at the Debugger command line The source code status is Read Only Color coding shows the differences between editable code enabled redefinitions disabled definitions and breakpoints Line numbers in redefined functions have decimal notation that is used for every reference to the line number The integer portion of the decimal is the same as the first line of the function This ensures that compiled source code line numbers remain unchanged A 8 4 2
42. Launches the Task View Preference dialog that allows you to set maximum call stack depth shown in Task View Default depth is 32 frames The Layout menu contains the following toggles Task List Causes only the CallStack View to be shown Single Task Causes only the Process Display to be shown The Display menu is divided into the Task List Format and Callstack Format sections The Task List Format toggle buttons control which buttons appear in the toggle sort list as well as what information is displayed in the Process Display area The Callstack Format toggles control the amount of information to be displayed in the Callstack Display area of theTask View window The Task View Display menu contains the following toggles Thread task Displays thread task number This toggle is active by default Status Displays process status This toggle is active by default PID Displays PID number Location Displays routine name and location in the current source file Arg Values Allows you to set the argument values in the Callback Display This toggle is active by default 007 2579 005 A 3 2 Exception View 007 2579 005 Arg Names Arg Types BC Debugger Reference A Allows you to set the argument names in the Callback Display This toggle is active by default Allows you to display argument types in the Callback Display Allows you to set the program counter PC in Task View In addition to menus Task View also co
43. Prev button You can also click an indicator with the middle mouse button to scroll to that point Clicking Reset removes the search target indicators 007 2579 005 A 2 4 Process Meter 007 2579 005 Go To Line Debugger Reference A Launches the Go To Line dialog that allows you to go to a specific line in the source You can type in the line or select the line number via the slider bar Versioning Provides access to the configuration management tool if you have designated one The cvconfig script allows you to designate ClearCase RCS or SCCS Type the following usr sbin cvconfig res sccs ptools clearcase Versioning submenu Close You must have root permissions to run cvconfig Selecting any option displays a shell in which you can access the configuration management tool The selections in the submenu are Contains the following options e CheckIn Saves the source file and checks it into the database as a new version e CheckOut Recalls the source file from the tool s database if you have the proper authority locks it and makes it editable e UncheckOut Cancels the checkout with no changes registered Dismisses the Source View window The Process Meter window is brought up by choosing the following from the Main View menu bar Views gt Process Meter The Process Meter monitors resource usage of a running process without saving the data Figure 62 page 214
44. Selects all objects pointed to a selected object or pointing to an object that has a descendant pointing to a selected object Descendant Selects all objects pointed to by any fields in a selected object or pointed to by any children of a selected object Family Selects all ancestors and descendants of a selected object A11 Selects all objects 283 Developer Magic Debugger User s Guide Formatting Brings up the type formatting dialog for this type Dereference Ptrs Dereferences any pointers in selected objects Pattern Layout Displays selected structures that are connected by pointers to position related structures in the same way Remove Removes selected object from the display A 6 5 6 Formatting Fields Each field in a data structure has certain display characteristics These can be specified for all objects in the Structure Browser Preferences dialog box or for type specific objects only in the Structure Browser Type Formatting dialog box To display the Structure Browser Preferences dialog box select Preferences from the Config menu see Figure 105 a Structure Browser Preferences ja iO Default Structure Field Count 4 Default Structure Width 229 Default Iconic Width 110 Automatic Dereference Limit 5 Dereference Ptrs By Default pr OK Cancel Help Figure 105 Structure Browser Preferences Dialog 284 007 2579 005 Debugger Reference A The dialog has the
45. a module for each COMMON block It is best not to use EQUIVALENCE statements Save local data that is otherwise not saved In Fortran values of local variables are not guaranteed to be saved from one execution of the subprogram to the next unless they are either initialized in their declarations or they are declared to have the SAVE attribute Some compilers and machines automatically give all local variables the SAVE attribute so moving a working program from one compiler or machine to a compiler or machine that does not do this may cause this bug to manifest The Fortran standards require that you give all uninitialized local variables the SAVE attribute if you would like their values saved 007 2579 005 Selecting Source Files 3 This chapter shows you how to select source files for the source pane of the Main View window of the Debugger see Figure 1 page 3 It covers the following topics e How to load source files Section 3 1 page 39 e Path Remapping Section 3 2 page 43 3 1 How to Load Source Files The following sections show you the three ways you can load source files for debugging Note For demonstration purposes before you begin this section perform the following from your shell oe mkdir demos mkdir demos Jjello cd demos jello cp usr demos WorkShop jello make cvd amp JP oe 3 1 1 Load Directly into the Main View Window Perform the following s
46. a particular condition Executes the code involving a single source line of the current process If a function is encountered in the source line or is the source line is a subroutine call the process will step into a function or subroutine call and stop at the first executable line in the function or subroutine The Step Over button can be used to continue to the next source line in the current file If a trap is encountered while executing the step into command the process is stopped where the trap was fired The Step Into button is active only after the running process es has stopped otherwise the button is grayed out When you click right on the Step Into button a menu pops up to allow you to choose the number of source lines to be stepped If you choose the N menu entry a dialog window is opened to allow you to enter a step value Executes the code involving a single source line of the current process The current process continues to the next source line in the current file and does not count any statements in functions that may be encountered in the source line If the source line is a subrouting call the process will stop at the next source line in the current file The Step Into button can be used to step into a function or subroutine call and stop at the first executable line in the function or subroutine If a trap is encountered while executing the step over command the process is stopped where the trap was fired
47. a specified number of lines starting from the beginning address of a specified function name see Figure 111 page 293 292 007 2579 005 Debugger Reference A Disassemble Function Function Main Number of Instructions all OK Cancel Help Figure 111 The Disassemble Function Dialog File Allows you to disassemble a specified number of lines starting from the address corresponding to a specified line number in a specified file refer to Figure 112 page 294 If you have a current selection in the Main View window or the Source View window its file and cursor position are used as the default file name and line number respectively 007 2579 005 293 Developer Magic Debugger User s Guide Filename a Start Line Number of Instructions OK Cancel Help Figure 112 The Disassemble File Dialog A 7 1 3 The Config Menu Preferences Dialog Selecting Preferences from the Config menu brings up the Disassembly View Preferences dialog box shown in Figure 113 page 295 so that you can select the display preferences you desire 294 007 2579 005 Debugger Reference A 007 2579 005 Disassembiy View Preferences Number of instructions to disassemble Minimum lines around current instruction 1 Hardware Register name display format Compiler Compiler Display Options Assembler tf Show embedded source annotation L Show source file and line
48. analyzer tutorial 174 catch dbx style command 313 change id 109 change values in Array Browser 26 changing code from the command line 116 checking for out of bounds array accesses 32 checking for uninitialized variabled used in calculations 34 classes examining widget 168 Clear all selection in structure browser display menu 282 Clear button in Trap Manager in jello tutorial 57 Clear trap selection in Traps menu 75 clearcalls dbx style command 313 ClearCase 7 Click for help selection in help menu 205 Click To Evaluate viewing variables with 22 Click to Evaluate viewing variables with 97 344 clone current window 217 224 close current window 218 224 close syscall that blocks continued pthreads 326 Close selection in admin menu 192 code redefined vs compiled 108 code changing tutorial 115 code changing from command line 116 code comparing original to redefined 121 code deleting changed 116 code switching between compiled and redefined in Fix Continue 121 Col button in Array Browser in jello tutorial 65 Column width selection in array browser display menu 261 Combine threads at same location Multiprocess View preferences option 210 Command field in the Main View window 87 command line interface with Fix Continue 310 command syntaxes for traps 78 comparing code original vs redefined 121 comparing function definitions in Fix Continue tutorial 122 compiled code distinguis
49. and features for debugging 11 ioctl syscall that blocks continued pthreads 326 jello program 48 Jump To selection in PC menu 91 Jump to selection in disassembly view pc menu 292 Jump to selection in pc menu 201 K keyboard accelerators in Fix Continue 205 Keys amp shortcuts selection in help menu 205 Kill button description 19 Kill button in the Main View window 88 kill dbx style command 317 L Language menu in Expression View 99 in jello tutorial 61 Language menu in expression view 274 275 349 Developer Magic Debugger User s Guide Language menu in variable browser 288 Launch selection in admin menu 192 launching debugger in Multiprocess View 141 launching the X Motif analyzer 8 launching X Motif analyzer 163 Levels to open Multiprocess View preferences option 209 Library search path dialog box 190 Linked list selection in structure browser display menu 281 lint option for debugging scientific programs 32 list dbx style command 317 list_changes dbx style command 318 Imalloc_ss library for finding heap corruption problems 126 Load expressions selection in Expression View gt Config menu 102 load files directly into the Main View window 39 through the File Browser Window 40 through the Open dialog box 41 with File Browser 41 Load settings selection in admin menu 191 Load traps selection in config menu in trap manager 84 loading source files 39 locall
50. at that address Note Use the address from your system not the one shown here stop watch address O0x7fffaef4 for write 133 Developer Magic Debugger User s Guide 13 Click the Add button 14 Click the Run button and observe the Main View window The process stops at the point where the bogus variable receives a bad value Details of the error display in the Main View window s Status field 134 007 2579 005 Multiple Process Debugging 10 007 2579 005 The WorkShop Debugger supports the debugging of programs that use multiple processes spawned by fork or sproc as well as threaded applications The Debugger allows you to control a single process at a time or all members of a process group You can attach child processes automatically You can also specify that spawned processes inherit traps from the parent process The Trap Manager provides special commands to facilitate debugging multiple processes by setting traps that apply to the entire process group WorkShop supports performance analysis and debugging of multiprocess applications including processes spawned either with fork or sproc and threaded applications You can perform process control operations on a single process or on all members of a process group You can attach WorkShop automatically to child processes You can also specify spawned processes to inherit traps The Trap Manager provides special trap commands to facilitate debugging multiple process
51. can enter or select using the Save As Text dialog Records information in the display area as a text file the name of which you can enter or select using the Save As Text dialog Launches the Open Separate dialog that allows you to create anew Source View with the contents of a different source file Inserts the text of a file within your current file This item description is available only if the file is editable The Make Editable item description from this File menu can be used to switch the file from read only Clones the current window Starts your default editor on the current file The default editor is determined by the editorCommand resource in the app defaults file The value of this resource defaults to wsh c vi d which means run vi in a wsh window and scroll to the current line If the editor allows you to specify a starting line enter d in the resource to indicate the new line number Displays the Build View window that allows you to compile the source code associated with the current executable Toggles the source code displayed between Read Only and Editable so that you can edit your code Searches for a literal case sensitive literal case insensitive or regular expression After you have set your target and clicked Apply or pressed Enter each instance is marked by a search target indicator in the scroll bar You can search forward or backward in the file by clicking the Next or the
52. cause a trap created to have the A11 option A 5 4 Display Menu The Display menu contains the following item Delete All Deletes all traps from the trap list A 5 5 Signal Panel The Signal Panel displays the signals that can occur You can specify which signals trigger traps and which are to be ignored The Signal Panel is shown in Figure 88 page 255 254 007 2579 005 Debugger Reference A Admin Trap Signal J ad r ad lari lf laf laf J laf lari lari lari lari laf lari mmm Figure 88 Signal Panel The Signal Panel contains an Admin menu described in Section A 3 1 1 page 217 and a Help menu described in Section A 1 10 page 205 Each signal trigger trap in the display has a toggle associated with it In addition the panel has a Search text field Note When debugging IRIX 6 5 pthreads the Signal Panel is inaccessible if more than one thread is active A 5 6 Syscall Panel The Syscall Panel allows you to set traps at the entry to or exit from system calls The Syscall Panel is shown in Figure 89 page 256 007 2579 005 255 Developer Magic Debugger User s Guide e i g LLL LL Lei OU WO oo m J J J L L LOUL HUUU Figure 89 Syscall Panel The Syscall Panel contains an Admin menu described in Section A 3 1 1 page 217 and a Help menu described in Section A 1 10 page 205 Each system call in the display has two toggles associated with it
53. command 317 GLdebug 191 GLdebug selection in admin menu 191 Go to line selection in Source menu 195 goto dbx style command 317 Goto dialog box 195 graphics context GC examiner 248 grelnotes release notes 9 Group Trap Default toggle 75 Group Trap Default Traps menu option 254 H heap corruption access to freed memory 125 access to uninitialized memory 125 boundary overrun definition 125 boundary underrun definition 125 compiling with malloc library 126 detection 125 double frees 125 erroneous frees 125 how to find heap corruption errors 126 trapping errors using the malloc library 128 typical problems 125 Help menu 205 Hide Icons selection in Display menu 197 Hide Line Numbers selection in display menu 197 Iconic selection in structure browser submenu 282 Iconify selection in admin menu 191 identifying functions 109 ignore dbx style command 317 007 2579 005 Index include files and Fix Continue 110 index identifiers in array browser 260 index maximum specification in array browser 260 index minimum specification in array browser 260 index sliders in array browser 260 index values in array browser 260 Index selection in help menu 205 Indexing expression field in array browser 259 input handler breakpoints examiner 235 Insert source selection in Source menu 195 integration of MIPSpro WorkShop tools 5 interface command line 310 introductory tips
54. compare changes to an individual function or to an entire file with the compiled versions When you are satisfied with the behavior of your application save the changed file as a replacement for the compiled source 8 1 2 Fix Continue Integration with Debugger Views Fix Continue interacts with the following Views e The Views main view the Source View and Fix Continue Status windows distinguish between compiled and redefined code and allow editing in redefined code e The following status windows elements work with redefined code Call Stack window Trap Manager Debugger command line 8 1 3 How Redefined Code Is Distinguished from Compiled Code 108 Redefined functions have an identification number and special line numbers They are color coded according to their state that is edited parsed and so on Line numbers in the compiled file stay the same no matter how redefined functions change However when you begin editing a function the line numbers of the function body are represented in decimal notation n 1 n 2 n m where n is the compiled line number where the function body begins and m is the line number relative to the beginning of the function body starting with the number 1 The Call Stack window and the Trap Manager functions both use function relative decimal notation when referring to a line number within the body of a redefined function The Debugger command line reports ongoing status In
55. created Obsolete files appear in the same color as current derived files but with a colored outline e Dependency relationship current or obsolete Current means that the derived file is up to date with the source files Note that a relationship can be current even if both files are obsolete This happens when a file on which both files are dependent has been modified Current arcs are black Obsolete means that the source file has changed and the derived file has not been updated accordingly Obsolete arcs appear as colored arrows Some typical build graph icons are shown in Figure 129 page 338 337 Developer Magic Debugger User s Guide Derived file normal state Source file normal state main c E AET ay a out Dependency arc obsolete state Source file checked out state _wam c g b Dependency arc current state Derived files obsolete state reli oon Figure 129 Build Graph Icons The main c and hello h source files are in their normal state The source files warn ct and foo h are checked out and thus appear highlighted and with dropped shadows The derived file main o is current since it has not changed since the last compile The black dependency arcs indicate that the source and derived files at either end are current with each other When an arc is highlighted it indicates that the source has changed since the last compile The derived files warn o and a out are obsolete because warn c has changed
56. eA Se Se Ga Bok GS a be a 194 Display Menu eI ive eam Be ae a ee ee GE a ce os wt Gee et ee Pe 197 Perf Menu Se Ee GR a Op a a OR we a 197 Traps Men o saa 2 4 a ae le AS ae a A a ak Ge a ak Ge ea BG 199 PC Menu bh as we wine ok Se Bo yest a Be ek sete cae ot tN Bema Je y he te cap 201 PixtContinu Menu 4 aD a a a abe oe ie Oe Sem ee Oe ee ay a 201 Show Difference Submenu ee 202 View Submenu a me Oe ee A BA a we OS BO He we 203 Preferences Submenu eA wt te ee og Boog BP GR Ob Gy 2 ch om OA aa 203 Keyboard Accelerators aie qe we ane SI ate A en to ce nes a ho A 205 Help Menu pg te oe we Gel te we Bu om oh Oe ee A he oe A ae i a ai 205 Some Additional Views He 9p eo he he ede ate dk els ge oe ck g Ge a Le be A 206 BMECUETON View s us fe ade OR Ge UE eo Se oe a al a Se Oe Ole ga a a a 206 Wltiprocess View o ie p so a decks a ce HS om aa 40g amp 2k Ae amp hee 206 Status of Processes www a 207 Multiprocess View Control Buttons de ey we he ty a ee GS a a ee a 208 Multiprocess View Administrative Functions BANG Oe Gh eat ok 1g Sa a tas ae 208 Controlling Preferences 6 ww we 209 Source View 62 eb oe wit SR Se sae MS Ske a h oa a ee tae Jee as Be ee UA ee 210 Process Meter Bid um sie oe Meee Oe a th eee i Re ae ae a Ba 213 Charts M nu 2 og be oes od ee zh Se oe ee eo OR Ce ACH Wk a 4 214 Scale Menu ba fe Se He GR ke ge in we ee te rae ek s Te Oe be hk Y 215 Controlling M
57. examiner appears as shown in Figure 71 Breakpoint Type Active Breakpoints a v srl Breakpoints Figure 71 Timeout Procedure Breakpoints Examiner 234 007 2579 005 Debugger Reference A The Timeout Procedure Breakpoints examiner contains the following items Breakpoint Type Allows you to select the type of breakpoint you option button wish to set In this section Timeout Procedure is selected Clear button Clears all the current breakpoint selections and text fields Client_Data text field Allows you to pass in and get back pointer values for the Client_Data A 4 2 5 Input Handler Breakpoints Examiner When the Input Handler option of the Breakpoint Type option button in the Breakpoint Examiner is selected the examiner appears as shown in Figure 72 Breakpoint Type Active Breakpoints a a srl Breakpoints Figure 72 Input Handler Breakpoints Examiner 007 2579 005 235 Developer Magic Debugger User s Guide The Input Handler Breakpoints examiner contains the following items Breakpoint Type Allows you to select the type of breakpoint you option button wish to set In this section Input Handler is selected Clear button Clears all the current breakpoint selections and text fields Q lient_Data text field Allows you to pass in and get back pointer values for the Client_Data A 4 2 6 State Change Breakpoints Examiner When the State Change
58. example as the Fortran 90 example in Section 2 1 2 page 13 but it is written in C Use this example to see how the Debugger can be used to view C structures e The C code in the file prog c is as follows include lt stdio h gt define N 3 double dot double v double wl int m void main 16 ine Jy double a N N x N y N sum xydot struct node int value struct node next list start Initialize arrays for i 0 1 lt N i x i 2 ylil i for j 0 j lt N j ali j i 3j i Compute the dot product x and y xydot dot x y N printf dot product of x amp y f n xydot Compute y ax for i 0 i lt N i sum 0 for j 0 J lt N j sumt a i j x j i yli sum printf y for i 0 i lt N j printf sf ylil 007 2579 005 Basic Debugger Usage 2 printf n Built list start value 1 list amp start for i 1 1i lt N i list gt next struct node malloc sizeof struct node list list gt next list gt value i list gt next NULL printf list list amp start for i 0 1 lt N i printf Sd list gt value list list gt next printf n e It includes function dot in file dot c as follows double dot double v double w int m int i double sum for i 0 i lt m i t sumt t v i w i return sum Perform the following
59. for 177 user defined buttons 178 with scripts 177 cvd Main View window X Motif analyzer tutorial 162 cvd gt command line viewing variables with 21 evdre file for customizing the debugger 177 Cycle Count field in Trap Manager in jello tutorial 58 Cycle count field in trap manager 83 007 2579 005 Index D data structures 4 dbx commands 312 Debugger Call Stack View with Fix Continue 311 changes to views with Fix Continue 309 command line interface with Fix Continue 310 exiting 67 how to start 47 Main View window with Fix Continue 309 program execution control 87 Trap Manager with Fix Continue 311 debugger how to customize 177 Main View window X Motif analyzer tutorial 162 Debugger Command Line 312 Debugger command line 2 Debugger main features 1 Debugger views 93 271 Debugger with Fix Continue support Fix continue debugger support with 109 debugging debugging a multiprocess C program 139 debugging a multiprocess fortran program 146 fortran multiprocess debugging session 146 general fortran debugging hints 146 tips and features 11 debugging with the X Motif analyzer 8 Default field count field in structure browser type formatting 286 Default iconic width field in structure browser preferences box 285 Default iconic width field in structure browser type formatting box 286 Default state field in structure browser type formatting box 286 Default structure field count field i
60. graph Dragging the graph with the left mouse button and the Ctrl key rolls rotates the graph in the plane of the screen Dragging the graph with the middle mouse button moves it without changing the viewing angle If you drag the graph with both the left and middle mouse buttons down the graph will appear to move into or out of the window this is the same as the dolly thumbwheel which is described in this section 007 2579 005 Debugger Reference A View mode Help Home Set home View all Seek Dolly control Help Home Rot Roty 71 Zoom e a Set Home View Ali Seek x rotation y rotation Zoom control mannana Copy View control control and readout Examiner Viewer Paste View Functions Draw Style Viewing Decoration hidden line Headlight no texture PEENES i tow resolution wireframe points gt bounding box no depth move same as stili move no texture move low res move wireframe move iow res wireframe ne depth move points move low res points no depth move bounding box no depth single buffer double buffer interactive buffer Figure 96 Examiner Viewer with Controls and Menus 007 2579 005 267 Developer Magic Debugger User s Guide A 6 1 7 1 help home set home view all seek Runs a special help system containing Inventor Viewer information Repositions the graph in its original viewing position Changes the home original v
61. have the same effect as clicking the corresponding button in the Main View window of each individual process For definitions of the buttons see Section A 2 2 2 page 208 10 1 4 Multiprocess Traps As discussed in Chapter 5 page 69 Setting Traps the trap qualifiers a11 and pgrp are used in multiprocess analysis The a11 entry stops or samples all processes when a trap fires The pgrp entry sets the trap in all processes within the process group that contains the trap location The qualifiers can be entered by default by using the Stop All Default and Group Trap Default selections respectively in the Traps menu of Trap Manager The Trap Manager is brought up from the Views menu of the Main View window 10 1 5 Viewing Pthreaded Applications The Multiprocess View supports a hierarchical view of your pthreaded applications Select the folder icons of your choosing to get more information about a process or thread Perform the following from within the Multiprocess View window to get additional information about a process or thread 1 Double click on a folder icon The process display expands to show its pthreads 2 Double click to select the pthread of your choosing The call stack for that thread displays 138 007 2579 005 Multiple Process Debugging 10 10 1 6 Adding and Removing Processes To add a process select Add from the Process menu In the Switch Dialog dialog window select one of the listed process
62. its center pane If you want to see the line numbers for your program select the following from the Main View window menu bar Display gt Show Line Numbers At the bottom of the Main View window there is a window with the cvd gt prompt from which you can enter all dbx commands to the Debugger The Debugger allows you to run your program and stop at selected places so you can view current values of program variables to help you find bugs in your program To stop at a selected statement in your program you may either set a breakpoint also called a stop trap at the desired statement or set a breakpoint prior to the desired statement and then use either the Step Into or Step Over buttons to reach the desired stopping point The statement where your program has stopped is indicated in green A statement highlighted in red indicates that a breakpoint has been set on this line When the Debugger causes your program to stop at a breakpoint that you have set the executable statement immediately prior to the breakpoint has been executed and the executable statement on which the breakpoint has been set has yet to be executed Note Programs featured in this chapter are located in the following directory usr demos WorkShop getstarted 007 2579 005 Basic Debugger Usage 2 2 1 2 Fortran 90 Code Example and Short Tutorial 007 2579 005 Use the Fortran 90 files prog f and dot f in usr demos WorkShop getstarted to demonstrate the Debugge
63. mp Compile fibo c by entering the following command cc g fibo c o fibo Invoke the Debugger on fibo as follows cvd fibo amp 6 141 Developer Magic Debugger User s Guide 4 Call up the Multiprocess View by selecting the following from the Main View menu bar Admin gt Multiprocess View The next section uses the fibo program to illustrate some of the functionality of the Multiprocess window 10 2 2 Using Multiprocess View to Control Execution 142 To examine each process as it is created you must set preferences so that each child process created stops immediately after being created The following steps show how this can be done 1 Select the following from the menu bar in the Multiprocess View window Config gt Preferences Toggle off Resume child after attach on sproc in the Multiprocess View Preferences window Toggle off Copy traps to sproc d processes so you can experiment with setting traps later Click on the OK button to accept the changes Click on the Run button in the Main View window to execute the fibo program Watch the Multiprocess View window You will see the main process appear and spawn a child process which stops as soon as it appears This is because you turned off the Resume child after attach on sproc option Notice also that the Main View window switched to the stopped child process Click on the Stop A11 button in the Multip
64. next step is to look at aggregate with the Debugger Compile the program with g option as follows 77 g mp total f o total If your debugging session is not running on a multiprocessor machine you can force the creation of two threads for example purposes by setting an environment variable If you use the C shell type setenv MP_SET_NUMTHREADS 2 Is you use the Korn or Bourne shell type MP_SET_NUMTHREADS 2 export MP _SET_NUMTHREADS Enter the following to start the Debugger cvd total amp The Main View window displays Select the following from the Main View menu bar to show the line numbers Display gt Show Line Numbers Select the following from the Main View menu bar Source gt Go To Line And enter 44 Line 44 is as follows aggregate ii jj aggregate ii jj inew i j You will now set a stop trap at this line so you can see what each thread is doing with aggregate ii and jj You want this trap to affect all threads of the process group One way to do this is to turn on trap inheritance in the Multiprocess View Preferences dialog To open this dialog 149 Developer Magic Debugger User s Guide 150 11 12 select the following from the Main View menu bar to open the Multiprocess View window gt Admin gt Multiprocess View Then select the following from within the Multiprocess View window Config gt Preferences Another way is to use the
65. o E Min 8 Max 3 Step rr ee ee TL Subscript Controls Panel in Array Browser Window The row and column toggles indicate whether a particular dimension of the array appears as a row column or not at all in the spreadsheet area Although an array may be of 1 to 6 dimensions you can view only one or two dimensions at a time The index values shown as Min and Max initially exhibit the lower and upper bounds of the dimension indicated The values may be changed to allow the user to display a subset of the available index range in that dimension The index sliders let you move the focus cell along the particular dimension The focus cell may also be changed by selecting a cell with the left mouse button The index slider for a dimension whose row and column toggles are both off may be used to select a different two dimensional plane of a multidimensional array Use the horizontal and vertical scroll bars to expose hidden portions of the Array Browser window Select Surface from the Render menu The Render menu displays the data from the selected array variable graphically in this case as a three dimensional surface The selected cell is highlighted by a rectangular prism The selected subscripts correspond to the x and y axes in the rendering with the corresponding value plotted on the z axis The data can be rendered as a surface bar chart multiple lines or points 007 2579 005 Tutorial The jello Program 4 4 7 Exiting
66. of 1 displays consecutive data Specifying some n greater than 1 allows you to display every n element in a vector Allows you to expose hidden portions of the subscript control area if your window is not large enough for viewing all of the controls The spreadsheet area is where numeric data is displayed It can show two dimensions at a time indicated in the upper left corner of the matrix The column indexes run along the top of the matrix and the row indexes are displayed along the left column The spreadsheet area has scroll bars for viewing data elements not currently visible in the viewing area Figure 92 page 261 shows a close up of the spreadsheet area 007 2579 005 Current element value field Current element identifier Column indexes Current element Row indexes Element values Debugger Reference A shadow 1 Figure 92 Array Browser Spreadsheet Area The current element is highlighted by a colored rectangle in the spreadsheet area Its corresponding expression is shown in the current element identifier field and the value is shown in the current element value field A 6 1 1 Spreadsheet Menu 007 2579 005 The Spreadsheet menu allows you to change the appearance of data in the spreadsheet area It provides these selections Column Width Wrapped Display Allows you to specify the width of the spreadsheet cells in terms of characters For instance a value of 12 indicate
67. one to set a trap on entry one to set a trap on exit In addition the panel has a Search text field A 6 Data Examination Windows There are several windows that are used primarily to examine your program s data e Array Browser Window Section A 6 1 page 257 e Call Stack View Window Section A 6 2 page 271 e Expression View Window Section A 6 3 page 273 256 007 2579 005 Debugger Reference A e File Browser Window Section A 6 4 page 276 e Structure Browser Window Section A 6 5 page 277 e Variable Browser Window Section A 6 6 page 288 A 6 1 Array Browser Window 007 2579 005 To examine numeric pointer or character string data in an array variable select Array Browser from the Views menu at a point in the process where the variable is present The Array Browser allows you to view elements in a multi dimensional array up to 100 x 100 elements presented in a spreadsheet and graphically if desired 257 Developer Magic Debugger User s Guide Hue Ramp Points Multi Line Clone Save As Text a Close Cire Indexing Expression shadow i j k Array specification Subscript Controls area Subscript control area Graphical display area Spreadsheet area Current element Figure 90 Array Browser with Display Menu Options Note The Render Color and Scale tear off menus are available only if you are have a Silicon Graphics workst
68. polyhedron s shadow on the cube The Array Browser template should resemble Figure 23 page 65 but with different data values If any areas are hidden hold down the left mouse button and drag the sash buttons at the lower right of the array specification and subscript control areas to expose the area 007 2579 005 Tutorial The jello Program 4 Admin Bender f eler Seale Format Spreadsheet arga Indexing Expression shadow i j k F Subscript controls Subscript Controls area Spreadsheet area 1 99999997e 07 al al al al 605 054138 Figure 23 Array Browser Window for shadow Matrix 17 Select the Col button next to the k index in the Subscript Controls pane you may need to scroll down to it The Array Browser can handle matrices containing up to six dimensions but displays only two dimensions at a time Selecting the Col button for k has the effect of switching from a display of i by j to a display of i by k Figure 24 page 66 shows a close up view of the subscript control area 007 2579 005 65 Developer Magic 66 Row column toggles Index identifiers Index values Index sliders Index minimums Index maximums Horizontal scroll bar Step indicators Vertical scroll bar Figure 24 Subscript Controls 18 Debugger User s Guide Row Col i i Min 8 Max 5 Step Row Col j 5 E Min a Max 3 Step Row Col k
69. pops up a warning dialog before a run if you have unfinished edits e Warn Unfinished Edits Before Continue toggle pops up a warning dialog before a continue if you have unfinished edits e Save deactivated code during File Save toggle save old code The Fix Continue file save substitutes new definitions in place of old ones If you want to save your original functions in the same file this switch allows you to save the old original or compiled code under an ifdef When you compile the old code will not get compiled You can manually edit the source to use the old definition in any way you desire 204 007 2579 005 Debugger Reference A Reset To Factory Defaults Save Preferences Load Preferences A 1 9 4 Keyboard Accelerators Sets preferences to the installed defaults Brings up the File dialog that allows you to save your preferences to a file Brings up the File dialog that allows you to load preferences from a file Use the accelerators in Table 3 to issue Fix Continue commands directly from the keyboard The accelerators are listed alphabetically by command Table 3 Fix Continue Keyboard Accelerators Command Cancel Edit Edit Parse And Load A 1 10 Help Menu Key Sequence Alt Ctrl q Alt Ctrl Alt Ctrl1l x The Help menu provides the following options Click for Help Overview Index Keys amp Shortcuts Product Information 007 2579 0
70. returns a NULL pointer MALLOC_NO_REUSE Specifies that no area that has been freed can be reused With this option enabled no actual free calls are made and process space and swap requirements can grow quite large MALLOC_TRACING Prints out all malloc events including address and size of the malloc or free When running a trace in the course of a performance experiment you need not set this variable because running the experiment automatically enables it If the option is enabled when the program is run independently and the MALLOC_VERBOSEenvironment variable is set to 2 or greater trace events and program call stacks are written to stderr MALLOC_VERBOSE Controls message output If set to 1 minimal output displays if set to 2 full output displays For further information see the malloc_ss 3 man page 9 2 3 Trapping Heap Errors Using the Malloc Library 128 If you are using the lmalloc_ss library you can use the Trap Manager to set a stop trap at the exit from the function ssmalloc_error that is called when an error is detected Errors are detected only during calls to heap management routines such as malloc and free Some kinds of errors such as overruns are not detected until the block is freed or realloced When you run the program the program halts at the stop trap if a heap corruption error is detected The error and the address are displayed in Execution View You
71. steps with this file to demonstrate Debugger features 1 Enter the following command in the usr demos WorkShop getstarted directory to produce the executable program cc g o proge prog c dot c This produces the executable progce 007 2579 005 17 Developer Magic Debugger User s Guide 2 Launch the WorkShop Debugger with your newly compiled executable as follows o cvd proge amp The WorkShop Debugger Main View displays the source for your prog c file see Example 2 page 16 3 Select the following from the Main View menu bar to turn on file line numbering Display gt Show Line Numbers The line numbers will display to the left of the code source window 4 Enter a breakpoint at line 23 as follows at the cvd gt prompt at the bottom of the Main View window This will enable you to execute up to the end of the y array for the sample code cvd gt stop at 23 Line 23 is highlighted in red and a stop icon appears in the left column 5 Run the program There are two ways that you can do this a Click on the Run button at the top of the Main View window OR b Enter the following at the cvd gt prompt cvd gt run The program executes up to Line 23 and waits for further instruction 6 Enter the following command at the cvd gt prompt to print the y array for this example cvd gt print y 18 007 2579 005 Basic Debugger Usage 2 The following displays in the cvd gt command pane 0000000
72. the Debugger 007 2579 005 There are several ways to exit the Debugger Select Exit from the Admin menu Type quit at the Debugger command line as follows cvd gt quit Double click on the icon in the upper left corner of the Main View window Press Ctrl c in the same window where you entered the cvd command 67 Setting Traps 5 Setting traps often referred to as breakpoints is one of the most valuable functions of a debugger or performance analyzer A trap enables you to select a location or condition within your program at which you can stop the execution of the process or collect performance data and continue execution You can set or clear traps from the Main View window or the Trap Manager window You can also specify traps in the Debugger command line at the bottom of the Main View window For signal traps you can also use the Signal Panel window and for system call traps use the Syscall Panel window When you are debugging a program you typically set a trap in your program to determine if there is a problem at that point The Debugger lets you inspect the call stack examine variable values or perform other procedures to get information about the state of your program Traps are also useful for analyzing program performance They let you collect performance data at the selected point in your program Program execution continues after the data is collected This chapter covers the following topics e Trap T
73. the Main View window 007 2579 005 119 Developer Magic Debugger User s Guide The following figure shows how the breakpoint has been reached in the redefined code WorkShop Debugger pid 1842 dmin Views Query Source play Perf fraps PC Ebo Continue Heip Command Debug Only Continue r Status time in military format HH MM rintTime Read Only ral cvd gt stop at 23 6 1 Stop at file home poppy S bab demos timel timel C line 23 6 1 Process 1842 stopped at timel 0 23 6 xSffa 96c cvd gt Figure 40 Stopping after Breakpoints in Redefined Code 9 Select the following from the menu bar to see the results of continuing to the breakpoint Views gt Call Stack 120 007 2579 005 Debugging with Fix Continue 8 10 Select the following from the menu bar to view the locations of the breakpoints Views gt Trap Manager 11 Remove the breakpoint by clicking on the source annotation column to the right of line 23 6 8 3 4 Viewing Status To view status select the following from the menu bar Fix Continue gt View gt Status Window The Fix Continue Status window opens 8 3 5 Comparing Original and Redefined Code You can use Fix Continue to compare original code with and modified code This section shows you several ways to view your changes 8 3 5 1 Switching between Compiled and Redefined Code Follow these steps to see how the redefined code affects your executab
74. the current window in a set of cloned windows In the current release this toggle is always active Clone Creates a clone of the current window This action is not supported in the current release and the option is grayed out Save As Text Launches the Save Text dialog This dialog allows you to save your current session as text in a file you designate Note This selection is not available for examiners that are graphical displays such as the Breakpoints Examiner the Tree Examiner and the Pixmap Examiner Close Closes the current window The Examine menu offers the following options Selection Selects the currently highlighted object for examination Note You must first highlight the name of an object before you select this option Widget Uses the current selection as input to the widget examiner then opens that examiner see Section A 4 4 page 242 for information Widget Tree Switches the window view to the widget tree examiner see Section A 4 5 page 243 for information 007 2579 005 A 4 1 3 Examiner Tabs 007 2579 005 Widget Class Window X Event X Graphics Context X Pixmap Debugger Reference A Switches the window view to the widget class examiner see Section A 4 11 page 250 for information Switches the window view to the window examiner see Section A 4 7 page 247 for information Switches the window view to the X Event examiner see Section A 4 8 page 248
75. the value type address or size of the result You can further specify the display format for the value and address 61 Developer Magic Debugger User s Guide Decimal Unsigned Octal Hex Float Char String Format Default Value Type Decimal Address Of Octal Bit Size Hex Column sash Figure 20 Expression View with Language and Format Menus Displayed 9 10 11 62 Click on the first Expression field in the Expression View window Then enter a 1 gt 3600 in the field and press Enter This is a test performed in jello to ensure that the value of a is less than 3600 This uses the variable a that was displayed previously in Variable Browser After you press Enter the result is displayed in the right column 0 signifies FALSE Select the following from the Expression View window menu bar to close that window Admin gt Close Select the following from the Main View window to open the Structure Browser Views gt Structure Browser 007 2579 005 Tutorial The jello Program 4 12 Enter jello_conec in the Expression field and press Enter The Structure Browser window displays the structure for the given expression field names are displayed in the left column and values in the right column If only pointers are available the Structure Browser will de reference the pointers auto
76. to bring up a Project View to manage your work on a project by project basis You can also Iconify or Raise windows Remap paths and Exit the project Closes the Main View window Closes all views in the session and terminates the session The Views menu in Main View window provides the following selections for viewing the process es and their corresponding data Array Browser Call Stack Disassembly View Exception View Execution View Expression View Displays values from an array or array slice in a two dimensional spreadsheet and optionally in a three dimensional representation that is a bar graph surface multiple lines or points in space These help you pick out bad data more readily Arrays can contain up to 100 x 100 elements Displays the call stack along with parameters to the calls If you double click an entry in the stack you switch the current context to that entry and you can check the state of variables Displays assembly code corresponding to the source code Displays an Ada specific window used for exception handling Displays the iconified Execution View window which handles the input and output of the target process Evaluates expressions in Fortran C or C To enter an expression select it in the source code display and paste it into the Expression View field using the middle mouse button 007 2579 005 File Browser Memory View Process Meter Register Vi
77. to cast the address of the variable to a pointer that points to the correct type For example the global variable _environ should be of type char You can see its value by evaluating char amp _environ After you display the current value of the expression you may find it useful to leave the window open so that you can trace the expression as it changes value from trap to trap or when you change the current context by double clicking in the call stack Like other views involved with variables Expression View has variable change indicators for value fields that let you see previous values as shown in the following figure Admin Config Display Expression lfar lnear Result 8323071 jello_conec 4x 18883618 a 3608 9590 4 b 3688 3594 4 c 3688 3586 Help Figure 36 Change Indicators in 007 2579 005 Change indicators Expression View 101 Developer Magic Debugger User s Guide Another useful technique is to save your expressions to a file for later reuse To save expressions select the following from the Main View menu bar Config gt Save Expressions To load expressions select the following from the Main View menu bar Config gt Load 7 3 2 Assigning Values to Variables Expressions To assign a value to a variable click the left column of the Expression View window and enter the variable name T
78. traps also called breakpoints stop program execution at a specified line in the code This allows you to track the progress of your program and to check the values of variables at that point Typically you set breakpoints in your 54 007 2579 005 007 2579 005 Tutorial The jello Program 4 program prior to running it under the Debugger For more information on traps refer to Chapter 5 page 69 In this part of the tutorial you set a breakpoint at the spin function 1 Click the Run button to run the jello executable The demo window will display Click the left mouse button in the Main View source code annotation column next to the line containing if at 1 gt 3600 a 3600 or if at 1 gt 3000 a 3000 if you are proceeding from the previous section A stop trap indicator appears in the annotation column as shown in Figure 15 page 56 Right click on the jello window and select spin from the pop up menu The program runs up to your stop trap and halts at the beginning of the next call to the spin function When the process stops an icon appears and the line is highlighted Note that theStatus field indicates the line at which the stop occurs 55 Developer Magic Debugger User s Guide 56 Figure 15 Stop Trap Indicator 4 Click the Continue button at the upper left corner of the Main View window several times Observe that the jello window goes through a spi
79. types of registers are to be displayed by default 298 007 2579 005 Debugger Reference A Register Display Display toggle ore ivf Show Special Registers it Show Float Registers wt Show Double Registers Register Formatting Register Default Default Default Default formatting _ area Default 3 Default Default Default Default Default m Figure 115 The Register View Preferences Dialog The register formatting area allows you to select formats for any of the registers The default fields in the top row let you change defaults for the four major types which are set as follows e General registers hexadecimal e Special registers hexadecimal e Float registers floating point e Double registers floating point The rows in the register formatting area let you change the modes for the individual registers A 7 3 The Memory View Window The Memory View window allows you to examine and modify memory A typical Memory View window appears in Figure 116 page 300 007 2579 005 299 Developer Magic Debugger User s Guide field Display control buttons Admin Mode Help Current address Address 0x00403f84 View Up Page Up Current address Value Bxat Modify Down Page Down value field Memory display area Memory address Memory contents BxBB403T
80. upper right area of the 10 1 window This brings up the Widget Examiner that displays the Run widget structure Notice that the parent text area displays the name of the current widget s parent which is control Click on the word control displayed on the Parent button at the top of the Widget Examiner in the X Motif Analyzer window This switches the view to the Run widget s parent the control object as shown in the Name field And the Widget Examiner displays the Control widget structure You can now navigate through the widget hierarchy using either the Widget Examiner or the Tree Examiner Note This section follows from the previous section In the Widget Examiner click on the Children button to see the menu and select Run from that menu The Run widget structure displays in the examiner Select the following from the Bounce window Actors gt Add Red Ball You should see a bouncing red ball Enter stop in Clock timeout at the cvd gt prompt in the Main View window After you press ENTER the red ball will stop bouncing Select Continue in the Main View window a few times to observe the behavior of bounce with this breakpoint added Select the Breakpoints tab in the X Motif Analyzer window This calls up the Breakpoints Examiner which allows you to set widget level breakpoints 007 2579 005 X Motif Analyzer 11 6 In the Callback Name text field enter activateCal
81. you are finished with Fix Continue before you save your changes In addition to the method described above you can also save your changes by selecting the following Fix Continue gt Save All Files 8 3 3 Setting Breakpoints in Redefined Code 118 To see how the Debugger works with traps in redefined code this section shows you how to set breakpoints run the Debugger and view the results Figure 40 page 120 1 Reset to the beginning of program execution by entering the following at the cvd gt prompt cvd gt kill cvd gt run 007 2579 005 Debugging with Fix Continue 8 2 Bring up the time1 C source file by entering the following at the cvd gt prompt cvd gt func Time printTime 3 Select the following from the menu bar Fix Continue gt Edit Note You can also use the Alt Ctrl1 e accelerator to perform this task 4 Enter the following after line 23 4 in the source pane of the Main View window cout lt lt AM lt lt endl 5 Select the following from the menu bar Fix Continue gt Parse and Load 6 Bring up the time1 C source file again by entering the following command at the cvd gt prompt cvd gt func Time printTime 7 Set a breakpoint at line 23 6 by entering the following message at the cvd gt prompt cvd gt stop at 23 6 The following message appears in the Command Message pane 2 Stop at file pathfname time1 C line 23 6 8 Click on the Continue button in
82. 0 70 71 72 73 73 73 76 77 78 82 83 83 84 84 v Developer Magic Debugger User s Guide Saving and Reusing Trap Sets Setting Traps by Using Signal Panel and System Call Panel Controlling Program Execution 6 The Main View Window Control Panel Features of the Main View Window Control Panel Execution Control Buttons Controlling Program Execution Using the PC Menu Execution View Viewing Program Data 7 Traceback through Call Stack View Options for Viewing Variables Using the cvd gt Command Line Using Click to Evaluate Using the Array Browser Using the Structure Browser Using the Variable Browser Using the Expression View Evaluating Expressions Expression View Window Assigning Values to Variables Evaluating Expressions in C C Function Calls Evaluating Expressions in C Limitations Evaluating Expressions in Fortran Fortran Variables Fortran Function Calls vi Page 84 84 87 87 87 88 91 92 93 93 96 97 97 97 97 98 98 99 99 102 103 104 104 104 105 106 106 007 2579 005 Debugging with Fix Continue 8 Introduction to Fix Continue Fix Continue Functionality Fix Continue Integration with Debugger Views How Redefined Code Is Distinguished from Compiled Code The Fix Continue Interface Debugger with Fix Continue Support Change ID Build Path and Other Concepts Restrictions on Fix Continue Fix Continue Tutorial Se
83. 000000000e 00 7 At this point you can experiment with other command described in this chapter notably the execution control buttons described in Section 2 1 4 page 19 8 Select the following to end this tutorial for the C demo program Admin gt Exit 2 1 4 Options for Controlling Program Execution There are a number of buttons in the Main View window that allow you to control the execution of your program The following summarizes their functions e Run creates a new process to execute your program and starts execution It can also be used to rerun your program e Kill kills the active process that is executing your program e Stop stops execution of your program The first executable statement after the statement where your program has stopped is highlighted e Continue continues program execution until a breakpoint or some other event stops execution or program execution terminates See also Section 10 4 1 3 page 155 e Step Into steps to the next executable statement and into function and subroutine calls Thus if you set a breakpoint at a subroutine call click on the Run button so the call to the subroutine is highlighted in green then click on the Step Into button to step into this subroutine source code for this subroutine will automatically be displayed in the Main View window 007 2579 005 19 Developer Magic Debugger User s Guide 2 1 5 Setting Traps By clicking the right mouse button o
84. 05 Provides information on the selected window or menu Provides general information on the current tool Displays the entire list of help topics alphabetically hierarchically or graphically Lists the keys and shortcuts for the current tool Provides copyright and version number information on the tool 205 Developer Magic Debugger User s Guide A 2 Some Additional Views A 2 1 Execution View This section discusses some of the additional views available through the Debugger the Execution View Multiprocess View Source View and Process Meter The Execution View window is a simple shell that allows you to set environment variables and inspect error messages If your program is designed to be interactive using standard I O this interaction will take place in the Execution View window Any standard I O that is not redirected by your Target command is displayed in the Execution View window Execution View is launched and iconified automatically with the Debugger A 2 2 Multiprocess View 206 WorkShop supports debugging of multiprocess applications including pthreaded programs and processes spawned with either fork or sproc commands Multiprocess debugging is supported primarily through the Multiprocess View window To display this window select Multiprocess View from the Admin menu of the Main View window Multiprocess View displays a hierarchical view of your pthreaded application Pthrea
85. 05 WorkShop Debugger Overview 1 4 You can call up a fork editor window to launch your own editor as follows second path Views gt Source View Then from the Source View window select the following File gt Fork Editor 1 1 4 4 Accessing Configuration Management Tools If you use ClearCase a Silicon Graphics product RCS or SCCS for configuration management you can integrate the tool into the WorkShop environment by entering the following command evconfig clearcase res sccs This will allow you to use Versioning source control from the Source menu to check files in and out 1 1 4 5 Recompiling from the Main View Window 007 2579 005 You can recompile your code from the Build View window accessible from the menu bar as follows Source gt Recompile For more on the Build View window see Section B 1 page 329 To examine build dependencies for your code launch the Build Analyzer from the menu bar as follows Admin gt Launch Tool gt Build Analyzer For more on the Build Analyzer window see Section B 6 page 335 For general information on the Build Manager tools see Appendix B page 329 Developer Magic Debugger User s Guide 1 2 Debugging with Fix Continue 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 func
86. 2 Select the following option from the menu bar to parse the modified function and load it for execution Fix Continue gt Parse and Load An icon for the Fix Continue Error Messages window displays and the following message appears in the cvd gt field Change id 1 modified Note You can also use Alt Ctrl x to perform this task If there are errors a Go to the error location s by double clicking the related message line in the Fix Continue Error Messages window b Correct the errors c Repeat steps 1 and 2 Continue to step 3 when you see the change ID and the following messages Change id 1 redefined Change id 1 saved func Change id 1 file not saved Change id 1 modified Note The new function value is not active until the function is called 115 Developer Magic Debugger User s Guide 3 Click on the Continue button to continue program execution The following output appears in the Execution View window Second printing of time 8 20 50 KKKKKK KKK KKK KKK Notice how the time printout has changed from 08 20 50 to 8 20 50 8 3 2 2 1 Deleting Changed Code To cancel any of your changes you must bring up the source file in which the change was made and perform the following steps 1 Enter the following at the cvd gt prompt cvd gt func Time printTime Select the following option from the menu bar to delete your changes Fixt Continue gt Delete Edits The
87. 2 displays window attributes for an X window and the parent and children window IDs These attributes are returned by XGetWindowAttributes with decoding of the visual structure enums and masks Figure 82 Window Examiner The Window examiner contains the Window text field that displays the address of the window that is being examined You may change to a different window by entering a new address and pressing Enter 007 2579 005 247 Developer Magic Debugger User s Guide A 4 8 Event Examiner The Event examiner see Figure 83 displays the event structure for an XEvent pointer The proper XEvent union member is used and enums and masks are decoded Figure 83 Event Examiner The Event examiner contains the X Event text field which displays the address of the X event that is being examined You may change to a different X event by entering a new address and pressing Enter A 4 9 Graphics Context Examiner The Graphics Context examiner see Figure 84 page 249 displays the X graphics context attributes that are cached by Xlib in the form of an XGCValues structure Enums and masks are decoded 248 007 2579 005 Debugger Reference A X Motif Analyzer pid 14150 Admin Examine Gc 4x 16866588 x10006580 gt struct X1ib_XGC ext_data x 880800 gid 4108007418 kects 3 dashes False dirty 11 values struct XGCValues function GXclear plane_mask x10006248 foregro
88. 51 displays the xt widget class structure as well as the Xt inheritance implementation using nested C constructs 250 007 2579 005 Debugger Reference A Admin Examine a W Class x5fe 9ab4 xSfeB9bb4 gt struct XmPushButtonGadgetClassRec rect_class struct RectObjClassPart superclass x5fe 7 2dc class_name xSfdfa614 XmPushButtonGadget widget_size 168 class_initialize x5fc8f274 class_part_initialize x5fc8f4c4 class_inited 3 initialize x5fc fgad initialize_hook rectl rect2 rect3 resources x18026898 num_resources 28 xrm_class 343 rect4 True rectS 3 rect6 True rect False destroy x5fc91414 resize x5fdb6184 expose x5fc92858 set_values x5fc98938 set_values_hook Figure 86 Widget Class Examiner The Widget Class examiner contains the W Class text field which displays the address of the widget class that is being examined You may change to a different widget class by entering a new address and pressing Enter A 5 Trap Manager Windows In addition to setting traps by using the command line the View menu of the Main View window provides you with three views specific to trap management 007 2579 005 Trap Manager Signal Syscal Panel ll Panel 251 Developer Magic Debugger User s Guide A 5 1 Trap Manager 252 Call up the Trap Manager window from the Main View window menu ba
89. 7 CmdInterface executeCmdCallback __P270357536 Ox10028bd0 clientData Ox10024b08 _ P2703577 xtCallCallbackList widget 0x10028bd0 callbacks 0x10027210 call_data Ox fff2a90 Callback c 672z Activate pb 0x10028bd0 event Ox fff2b1c PushBG c 831 Figure 55 Breakpoint Results Displayed by the Call Stack View 15 16 17 174 In the Call Stack View double click the Cmdinterface activate line Gust below Xt Set Sensitive This is where the sensitive resource was changed In the Widget Examiner window double click the widget address in the Widget text field press backspace enter _w and press ENTER The X Motif Analyzer displays the Run widget which is the widget currently being changed Click Continue in the Main View window The status will update to Stopped in the SetValues routine since the breakpoint set in the previous step was reached again 007 2579 005 X Motif Analyzer 11 18 In the Call Stack View double click on the Cmdinterface activate line just below XtSetSensitive 19 Perform the following sub steps a Double click in Widget text field of the Widget Examiner b Press backspace c Enter vw d Press ENTER The X Motif Analyzer window displays the Step widget which is the widget currently being changed 11 3 7 Ending the Session Select the following to close the X Motif Analyzer Admin gt Close Select the following to exit the Debugge
90. Also the rhost files on the machines must allow rsh commands to operate between them The executable_file argument is the name of the executable file for the process or processes you want to run This file is produced when you compile with the g option which disables optimization and produces the symbolic information necessary to debug with WorkShop The g option is most commonly used but it is optional if you wish you can invoke the Debugger first and specify the name of the executable file later Sometimes when a file is being executed a core file is produced its default name is core Use the following command to determine why a program crashed and produced the core file cvd executable_file core See Section 4 2 for more information 4 2 Run the jello Program 48 In this part of the tutorial you invoke the Debugger and start a typical process running The jello program simulates an elastic polyhedron bouncing around inside of a revolving cube The program s functionality is mainly contained in a single loop that calculates the acceleration velocity and position of the polyhedron s vertices Enter the following commands to run the jello program 1 Go to the directory with the jello demo program gt ed usr demos WorkShop jello 007 2579 005 Tutorial The jello Program 4 2 List the contents of this directory gt 1ls 3 Enter the following to make the program if jello is not listed from Step 2
91. Developer Magic Debugger User s Guide Document Number 007 2579 005 St Peter s Basilica image courtesy of ENEL SpA and InfoByte SpA Disk Thrower image courtesy of Xavier Berenguer Animatica Copyright 1996 1999 Silicon Graphics Inc All Rights Reserved This manual or parts thereof may not be reproduced in any form unless permitted by contract or by written permission of Silicon Graphics Inc LIMITED AND RESTRICTED RIGHTS LEGEND Use duplication or disclosure by the Government is subject to restrictions as set forth in the Rights in Data clause at FAR 52 227 14 and or in similar or successor clauses in the FAR or in the DOD DOE or NASA FAR Supplements Unpublished rights reserved under the Copyright Laws of the United States Contractor manufacturer is Silicon Graphics Inc 1600 Amphitheatre Pkwy Mountain View CA 94043 1351 IRIS IRIX and Silicon Graphics are registered trademarks and Developer Magic and the Silicon Graphics logo are trademarks of Silicon Graphics Inc Open Software Foundation Motif OSF OSF Motif are trademarks of the Open Software Foundation Inc PostScript is a trademark of Adobe Systems Inc UNIX is a registered trademark in the United States and other countries licensed exclusively through X Open Company Limited X Open is a trademark of X Open Company Ltd The X device is a trademark of the Open Group New Features Developer Magic Debugger User s Guide 007 2579 005 This rev
92. Exit Sample Display Perf Fraps Tearcor Set Trap Clear frap e Fraps PC Fix Continue Help Figure 25 Traps Menu in the Main View Window For a trap at the beginning or end of a function highlight the function name in the source code display area and select one of the following from the Traps gt Set Traps submenu as is appropriate to your needs e Stop At Function Entry e Stop At Function Exit e Sample At Function Entry e Sample At Function Exit Traps are indicated by icons in the source annotation column and also appear in the Trap Manager window if you have it open Figure 26 page 75 shows some typical trap icons Sampling is indicated by a dot in the center of the icon Traps appear in normal color or grayed out depending on whether they are active or inactive A transcript of the trap activity appears in the Debugger command line area The active inactive nature of traps is discussed in Section 5 3 6 page 84 74 007 2579 005 Annotation column Active stop trap Inactive stop trap Active sample trap Inactive sample trap Debugger command line transcript 007 2579 005 Setting Traps 5 The Clear Trap selection in the Traps menu deletes the trap on the line containing the cursor You must designate a Stop or Sample trap type since both types can exist at the same location appearing superimposed on each other When the Group Trap Default toggle is chec
93. Figure 53 Window Attributes Displayed by the Window Examiner 007 2579 005 171 Developer Magic Debugger User s Guide 11 3 6 Using Additional Features of the Analyzer The following steps demonstrate additional Analyzer features 1 2 172 In the X Motif Analyzer window click the Widget tab Double click the widget_class value on the fourth line to highlight it Pull down the following Examine gt Widget Class The X Motif Analyzer window displays the class record for the XmPushButtonGadget routine Notice that the Widget Class tab for the widget class examiner is added to the tab list Again the same action can be accomplished by triple clicking the widget_class value in the Widget Examiner This time we used the triple click shortcut to select the correct examiner Triple click the superclass value on the third line The X Motif Analyzer window displays the class record for XnLabelGadget the superclass of XmPushButtonGadget Triple click the superclass value on the right side of the third line The X Motif Analyzer window displays the class record for XmGadget the superclass of XnLabelGadget Select the Widget tab to change to the Widget Examiner Triple click the parent value on the fifth line The X Motif Analyzer window displays the control widget the parent of Run This action produces the same results as selecting the control text in the Parent text box Right click o
94. Left click in a field in the Expression column The cursor appear in the field 3 Middle click your mouse The desired value appears in the field 24 007 2579 005 Basic Debugger Usage 2 2 1 6 5 Viewing Variables Using the Array Browser To view array values select the following from the Main View window menu bar to call up the Array Browser Views gt Array Browser Admin Render format Spreadsheet Figure 4 Array Browser Window 007 2579 005 25 Developer Magic Debugger User s Guide To view the values of an array in the Array Browser 1 Enter the name of this array in the Array field 2 Press ENTER Here the current values of at most two dimensions of the array will display in the lower pane of the Array Browser window The values of the array will be updated to their current values as you step through your program 2 1 6 5 1 Subscript Controls Field If the array is large or has more than two dimensions the Subscript Controls panel in the middle of the Array Browser window allows you to specify portions of the array for viewing You may also use the slide bars at the bottom and right of the window to view hidden portions of an array 2 1 6 5 2 How to Change Values 26 Perform the following to change values of array elements 1 Click on the box with the array value in the lower portion of the Array Browser window Note Once the element is selected the array index and va
95. Lists number of fields to be displayed initially for objects of that type Displays the width in pixels of the object Displays the width in pixels of the object when it is in iconic form Brings up a pop up menu that allows you to specify whether structures are first displayed as icons Iconic with the minimum number of fields displayed Normal or with all fields displayed Detail 007 2579 005 Debugger Reference A 007 2579 005 Type Color Provides a submenu for color coding It allows you to select a color for the header and overview rectangles for objects of a given type For structure and union types the list box shows all the fields with their types For each field you can change the result format to one of the following types Default Decimal Unsigned Octal Hex Float Exponential Char String Wide Character Type Dec addr Oct addr Hex addr Bit Size You can also specify whether a field is visible in normal state and if it is a pointer field whether it should be automatically dereferenced 287 Developer Magic Debugger User s Guide Once you specify the format for this type you can apply it to any combination of the following through the toggle buttons in the bottom left portion of the window e Selected instances e All existing instances e Any future instances of this type A 6 6 Variable Browser Window The Variable Browser window allows you to view and change the values of loc
96. OSIX Pthread The ability to continue or free run a single POSIX pthread under IRIX 6 5 is available at the user level with WorkShop release 2 8 However use of this new debugging feature can in certain specific circumstances lead to anomalous and possibly confusing behavior Such behavior occurs when the single thread that is continued or free run encounters either a blocking or scheduling situation in the operating system or the pthreads library When such situations arise the operating system or in some cases the pthreads library must take action to dispose of the single continued or free run thread and possibly newly created threads In the course of this action the debugging user will see things occur with both the single continued or free run thread as well as all other threads that will be perplexing because complex thread scheduling algorithms are invoked by both the operating system and the pthreads library to recover from the original blocking or scheduling incident This note attempts to provide information which might lessen frustration on the part of the debugging user in the face of blocking or scheduling incidents Debugging true POSIX pthreads is tricky business and users of this new feature allowing a continue or free run of a single 6 5 POSIX pthread will gain even more appreciation of this fact This feature has been used internally for some time by the WorkShop debugger The continue or free run
97. Performance Data window clicking produces a sample trap otherwise a stop trap is entered To determine if data collection is on look at the upper right corner of the Main View window to see which debugging option is selected Debug Only Performance or Purify When the trap is set a trap icon appears 5 2 2 Setting Traps Using the cvd gt Command Line The cvd gt command line is discussed in stop commands similar to those found in dbx or as documented in Section 5 3 1 page 77 may be entered into the command line portion of the Main View window as an alternative way to set traps 5 2 3 Setting Traps Using the Traps Menu in the Main View Window 007 2579 005 To set a trap using the Traps menu you first need to know which type of trap you wish to set then select the location in your program at which to set the trap To set a stop trap or sample trap at a line displayed in the Main View window or the Source View window click in the source code display area next to the desired line in the source code or click drag to highlight the line Then select either of the following from the menu bar Traps gt Set Trap gt Stop or Traps gt Set Trap gt Sample 73 Developer Magic Debugger User s Guide The Traps menu in the Main View window is shown in Figure 25 Admin Views Query Source Stop Stop At Function Entry Stop At Function Exit Sample Sample At Function Eniry Sample At Function
98. Request A 4 2 1 Callback Breakpoints Examiner Debugger Reference A Resource change caused by Xt Set Values or XtVaSetValues Parameters include resource name and resource value both strings See Section A 4 2 3 page 233 for more information Timeout callback installed by XtAppAddTimeOut Parameters include client_data XtPointer value See Section A 4 2 4 page 234 for more information Input callback installed by XtAppAddInput Parameters include client_data XtPointer value See Section A 4 2 5 page 235 for more information Various widget state changes for example managed or realized Parameters include widget state See Section A 4 2 6 page 236 for more information X event received by target application Parameters include X event type See Section A 4 2 7 page 237 for more information X request received by target application Parameters include X request type See Section A 4 2 8 page 239 for more information When the Callback option of the Breakpoint Type option button in the Breakpoints Examiner is selected the Callback Breakpoints Examiner is displayed 007 2579 005 229 Developer Magic Debugger User s Guide 230 X Motif Analyzer pid 669320 Admin Examine Widget Fy Class Name Fy Parent none BL Previous Breakpoint Type Callback Clear Callback Name Client_Data Active Breakpoints Search Add Step To Breakpoints Trace Widget Tree
99. The Step Over button is active only 007 2579 005 Return al1 Sample Print Kill a11 007 2579 005 Debugger Reference A after the running process es has stopped otherwise the button is grayed out When you right click on the Step Over button a menu pops up to allow you to choose the number of source lines to be stepped If you choose the N menu entry a dialog window is opened to allow you to enter a step value Continues execution of the process until the current function being executed returns The process is stopped immediately upon returning to the calling function All code within the current function is executed as usual If a breakpoint is encountered the action is canceled and the process is stopped where the breakpoint was fired You can use this button only after the running process es has stopped otherwise the button is grayed out This action is not allowed if the executable is instrumented for performance analysis Note For IRIX 6 5 this command button always returns all pthreads Allows you to collect process state data to be used by the Performance Analyzer for program evaluation You can use this button only when the process es is running and the Enable Data Collection mode is set on the Performance panel otherwise the button is grayed out See Developer Magic Performance Analyzer User s Guide for more information Prints in the Source View window the value of any highlight
100. The lower list is for specifying files to appear in the graph The Query menu lets you request information about the build graph The following selections are available Why Is This File Identifies the source files requiring this file to be Out Of Date recompiled This query only applies to derived files What Will Changing Shows all derived files dependent on this source This File Affect file 341 Index A accept syscall that blocks continued pthreads 326 access to freed memory 125 access to uninitialized memory 125 action traps term 70 Active selection in Admin menu described in jello tutorial 59 active toggle 217 224 Ada windows description Task View 216 Ada specific windows description 216 add_source filename dbx style command 312 adding a breakpoint in X Motif analyzer tutorial 167 Address selection in disassemble menu 292 Admin menu 304 general description 190 Library search path 190 admin menu active toggle 224 clone 224 alias dbx style command 313 all trap debugger command option 77 AllowPending Traps Xdefaults variable 71 arguments command line 87 Arrange selection in structure browser display menu 280 Array Browser subscript controls 66 viewing variables with 25 97 Views menu option 4 Array browser general description 258 Array Browser selection in Views menu in jello tutorial 64 Array Browser selection in views menu 192 007 2579 005 Array field in a
101. Trap Manager to specify group traps as follows a Select the following from the Main View window menu bar to open the Trap Manager Views gt Trap Manager b Select the following from the Trap Manager window Traps gt Group Trap Default Click drag to select line 44 in the Main View window Open the Trap Manager window from the Main View window menu bar as follows Views gt Trap Manager Then select the following from the the Trap Manager window Traps gt At Source Line This sets a stop trap that reads as follows in the cvd gt pane of the Main View window Stop pgrp at file usr demos WorkShop mp total f line 44 007 2579 005 Multiple Process Debugging 10 13 Select the following from the menu bar in the Main View window to monitor status of the two processes Admin gt Multiprocess View You are now ready to run the program 14 Click the Run button in the Main View window As you watch the Multiprocess View you see the two processes appear run and stop in the function _mpdo_total_1 It is unclear however if the Main View window is now relative to the master process or that it has switched to the slave process 15 Right click on the name of the slave process in the Multiprocess View window and select the following Process gt Create a new window A new window is displayed that launches a debug session for the process Now both master and slave processes should display in respecti
102. Verify before deleting dialog displays Click OK in the Verify before deleting dialog Your deletion is complete 8 3 2 2 2 Changing Code from the Debugger Command Line You can redefine a C class member function from the Debugger command line as follows 1 2 116 Click on the Kill button in the Main View window Click on the Run button to re run the program Choose a class member function in this case printTime to edit by entering the following at the cvd gt command line cvd gt func Time printTime 007 2579 005 Debugging with Fix Continue 8 4 Use the redefine command to edit the function cvd gt redefine Time printTime Note the results as shown in Figure 39 page 115 Here line numbers have changed to decimal notation based on the first line number of the function body Note also that the command line prompt has changed 5 Enter the following at the prompt path name timel C 23 1 gt 6 Change the function source by entering the following at the command line cvd gt replace_source timel C 23 2 timel C 23 2 gt cout lt lt hour lt 10 lt lt hour lt lt timel C 23 3 gt Parse and Load is executed at this point You exit ouf of the function edit mode are return to the main source code The following messages appear in the command message pane Change id 2 redefined Change id 2 save func Change id 2 file not saved Change id 2 modified Change id
103. View Window 7 Debugging with Fix Continue 8 Debugging with the X Motif Analyzer 8 Customizing the Debugger 8 Additional Information 9 Basic Debugger Usage 2 11 Getting Started with the Debugger ww a a a a 11 Basic Tips and Features 00a a a 11 007 2579 005 iii Developer Magic Debugger User s Guide Page Fortran 90 Code Example and Short Tutorial a a an ae a E a E a a oE E 13 Example 1 Fortran 90 Example a a a 13 C Code Example and Short Tutorial 2 a a 15 Example 2 C Code Example a a 16 Options for Controlling Program Execution ptas pi na a ee p a a aO de A 19 petting Traps van 25 aga ade ah aa 8 Ge ed See ee oF ee Sag TA A ey A 20 Options for Viewing Variables hn hs Gee a 9 ek OH Se Oe at ee EK oe EY 20 Viewing Variables Using the cvd gt Command Line in ise See BOS Ay es oy oh 21 Viewing Variables Using Click To Evaluate be wm 4 eB 2 MB 4 28 22 Viewing Variables Using the Variable Browser ae a e e e 23 Viewing Variables Using the Expression View Window aa a gA gh a ag OM a 23 Viewing Variables Using the Array Browser a a a a a 25 Viewing Variables Using the Structure Browser Window a et a Ze as dS 27 Searching ao ti Lal dy Ta Oe Gee Se Gy et Ge ee a ee 27 Using the Call Stack View ie Rite gad ht kee Bye eu Re a BR a we a Ve oh ter Y 28 Stopping at Functions or Subroutines bee 4 TS iia FI A ge a a Se Ge 30 Suggestions for Debugging for Serial Execution of Scientific Programs
104. _control Instead it goes to the pthread_scheduler in the pthread library for the disposition of the associated OS kernel thread The pthread_scheduler then reassigns the associated OS kernel thread to another user pthread and unexpected things could start running 10 4 1 3 How to Continue a Single POSIX 6 5 Pthread 007 2579 005 To continue or free run a single POSIX 6 5 pthread simply click on the Continue button in the Main View window Note that this is different from the function of the Continue button in the Multiprocess View window which continues all threads 155 Developer Magic Debugger User s Guide 10 4 2 Other Pthread Debugging Hints Observe the following guidelines when debugging pthreaded programs e C exception handling works per process not per thread e Using the step over function on a pthread_exit may produce unexpected results 10 4 3 Differences between 6 4 and 6 5 Pthreads The following differences exist between the IRIX 6 4 and the IRIX 6 5 implementation of pthreads e In the IRIX 6 5 implementation many user threads are serviced by a few kernel micro threads This can result in the following problems After stopping at a breakpoint a pthreaded program may abort with a Trace BPT trap error when you try to use the continue function Data race problems may occur as kernel micro threads switch from one user pthread to another You can alleviate these problems with the following command
105. addition to providing the same commands available from the menu edit commands allow you to 007 2579 005 Debugging with Fix Continue 8 add replace or delete lines from files Therefore you can operate on several files at once 8 1 4 The Fix Continue Interface You can access Fix Continue through the Fix Continue menu It includes three supporting windows Status Message and Build Environment These windows are part of Fix Continue and do not operate unless it is installed 8 1 5 Debugger with Fix Continue Support Without Fix Continue the Debugger source views are Read Only by default That is so you can examine your files with no risk of changing them When you select Edit from the Fix Continue menu the Debugger source code status indicator in the lower right corner of the Debugger window remains Read Only This is because edits made using Fix Continue are saved in an intermediate state Instead you must choose Save File gt Fixes As to save your edits When you edit a function it is highlighted in color and if you switch to the compiled version of your code the color changes to show that the function has been redefined If you try to edit the compiled version of your code the Debugger beeps indicating Read Only status When you have completed your edits and want to see the results select Parse and Load When the parse and load has executed successfully the color changes again If the color does not chan
106. ain View window to call up the Variable Browser Views gt Variable Browser The Variable Browser automatically displays values of all variables valid within the routine in which you have stopped as well as the address location for each array Values of variables can be changed by typing in their new value in the Result column and then hitting the ENTER key or RETURN key for some keyboards the Expression View Window Expression View window allows you to enter the variables and or expressions for which you would like to know values 1 007 2579 005 Select the following from the Main View window menu bar to display the Expression View window Views gt Expression View 23 Developer Magic Debugger User s Guide Admin Contig Display Heip Expression Result Figure 3 Expression View Window 2 To view for example the value component of the structure start in prog c enter the following in the Expression column start value As you step through your program for example with Step Over the values of all the entries in this window will be updated to their current values Values of variables can be changed by typing in their new value in the Result column and then pressing ENTER To enter an expression from your source code into the Expression View window 1 Left click and drag on the expression in your source code The expression is highlighted 2
107. akpoint Examiner is selected the examiner appears as shown in Figure 68 page 228 The Resource Change Breakpoints examiner contains the following items Widget text field Name text field Class text field Parent text field Previous button Children button Select button 007 2579 005 Allows you to choose a widget to examine by entering the widget address Allows you to choose a widget to examine by entering the widget name Allows you to choose a widget to examine by entering the widget s class Leave the field blank or enter Any to select all widgets Allows you to move the parent of the currently selected widget Moves you to the previously selected widget Shows you the widget s children it is grayed out if the selected widget cannot have children Allows you to select the widget in the target process 233 Developer Magic Debugger User s Guide Breakpoint Type Allows you to select the type of breakpoint you option button wish to set In this section Resource Change is selected Clear button Clears all the current breakpoint selections and text fields Resource Name text Allows you to set the resource name for the field breakpoint Resource Value text Allows you to set the resource value for the field breakpoint A 4 2 4 Timeout Procedure Breakpoints Examiner When the Timeout Procedure option of the Breakpoint Type option button in the Breakpoint Examiner is selected the
108. al variables and arguments at a specific point in a process Global variables can be viewed or changed using Expression View or the Evaluate Expression selection from the Data menu for one shot evaluations In addition to providing values the Variable Browser is useful for getting a quick list of the local variables in a scope without having to search for their names A sample Variable Browser window with the Language and Format menus displayed is shown in Figure 107 page 289 Typically you inspect variable values at the following points e Ata breakpoint e Ata frame in a call stack e As you step through a process A useful technique is to set a trap at the entry to a function and inspect the values of the variables there Some variables may be in an uninitialized state at that point You can then step through the function and make sure that no uninitialized variables are used inadvertently Note In programs compiled by using the n32 g compiler options you cannot click on or print an unused variable as you could when using the 032 g options A 6 6 1 Entering Variable Values The Variable Browser allows you to change the values of variables in the window You simply enter the new value in the result column and press Enter Thus you can force new values into the process and see their effect 288 007 2579 005 Debugger Reference A Decimat Unsigned gt Octal Variable Browser pid 2024 a X
109. alized value as a pointer value bogus 007 2579 005 129 Developer Magic Debugger User s Guide 130 To start the tutorial 1 Enter the following mkdir demos mkdir demos mallocbug cd demos mallocbug cp usr demos WorkShop mallocbug JP all Invoke the Debugger by typing cvd corrupt amp The Main View window displays with corrupt as the target executable Open the Execution View window if it is minimized and set the _SSMALLOC_FASTCHK and _SSMALLOC_CLEAR_ MALLOC environment variables If you are using the C shell type setenv _SSMALLOC_FASTCHK setenv _SSMALLOC_CLEAR_MALLOC If you are using the Korn or Bourne shell type _SSMALLOC_FASTCHK _SSMALLOC_CLEAR_MALLOC export _SSMALLOC_FASTCHK _SSMALLOC_CLEAR_MALLOC To trap any malloc corruption problems you must enter the following at the cvd gt prompt cvd gt set pendingtraps true cvd gt stop exit ssmalloc_error A stop trap is set at the exit from the malloc library ssmalloc_error Enter the following at the cvd gt prompt cvd gt run The program executes Observe Execution View as the program executes A heap corruption is detected and the process stops at one of the traps The type of error and its address display in Execution View see example in Figure 42 page 131 007 2579 005 007 2579 005 Detecting Heap Corruption 9 laboi 1 LLOL HK Close Help Figur
110. all stack at the breakpoints Expression View This option allows you to inspect the value of specified expressions Variable Browser This option allows you to inspect the values types or addresses of variables Structure Browser This option allows you to inspect data structures Multiprocess View This option allows you to inspect the values of multiple and or pthreaded processes Array Browser This option allows you to inspect the values of an array variable 007 2579 005 WorkShop Debugger Overview 1 Memory View This option allows you to inspect the values in specified memory locations Register View This option allows you to inspect registers Disassembly View This option allows you to inspect the disassembled code 1 1 4 Integrating the Debugger with Other WorkShop Tools MIPSpro WorkShop tools are designed so that you can move easily between them in a work session 1 1 4 1 Accessing the Performance Analyzer from the Main View Window 007 2579 005 You can run the Performance Analyzer from the Main View window as follows Note If you are in the middle of a run you must first terminate it 1 Select the following from the menu bar Perf gt Select Task gt Task in List Click on the RUN button in the Control Panel The executable is run Select the following from the menu bar Perf gt Examine Results The Performance Analyzer window will display your results For more infor
111. ange the settings The following preferences are available through the dialog e External Editor Command text field that allows you to choose your text editor The default is vi e File Difference Tool text field allows you to choose the tool to use when comparing code The default is xdiff e Copy Traps On Previous Definition toggle allows you to edit and parse code When Fix Continue copies traps from the old definition to the new one by mapping old lines to new lines This mapping is the same as what can be generated using the UNIX diff utility If Copy Traps On Previous Definition is on and the mapped line the new definition is modified then Fix Continue will look at the switch 203 Developer Magic Debugger User s Guide e Copy Traps Even On Changed Lines toggle causes the debugger to copy traps onto a mapped line e Continue Even If Line Has Changed toggle allows you to edit and compile code in which your program is currently stopped Fix Continue can continue in the new definition provided some conditions are satisfied The line from which the program continues depending on the mapping from the line in which it stopped In case it can continue in the new definition from a line which you have modified Fix Continue consults this toggle to determine whether to continue in the new or old definition This toggle allows you to override the default behavior e Warn Unfinished Edits Before Run toggle
112. as compiled code You request builds in Build Analyzer by either e Double clicking a derived module e Making a selection from the Build menu You access Build Analyzer from WorkShop by selecting Launch Tool from the Admin menu in Main View Outside of WorkShop you can access Build Analyzer by typing cvbuild at the command line A typical Build Analyzer window appears in Figure 128 page 336 with the menus displayed 335 Developer Magic Debugger User s Guide Refresh Graph Display Build Default Target Select Files To Display Why fs This File Out Of Date What Wili Changing This File Affect Launch Toot Build Selected Target s Project Show Build Rule Exit S E Admin Build Filter Query Build specification area Directory fusr demos WorkShop jello Makefile Makefile Targets Build graph area default allo fa all jello_u clobber clean Build graph control area 700 Figure 128 Build Analyzer Window B 7 Build Specification Area The three fields in the build specification area identify the working directory makefile script and target file s for compilation You can edit the Directory Makefile and Target s fields directly The Target s field also lets you specify a search string for locating a file in the build graph B 8 Build Graph Area The build graph area displays the specified source and derived files and their dependency relationships Files are depicted as rectangles
113. ation To change the contents of a memory location you select the address to be changed either by direct entry or by clicking on the byte value in the display area You can enter a single value or a sequence of hex byte values separated by spaces for example 00 3a 07 b2 in the Value field You can also enter a quoted string to change a consecutive range of values to the ASCII values of that string Pressing Enter while the cursor is in the Valuefield or clicking the Modify button substitutes the new value s starting at the specified location A 7 3 3 Changing the Memory Display Format The Mode menu allows you to change the format of the value field and byte locations to either decimal octal hex or ASCII A 7 3 4 Moving around the Memory View Display Area The four control buttons at the upper right of the window help you move around the display area These buttons are Up Moves displayed bytes up a single row Down Moves displayed bytes down a single row Page Up Moves displayed bytes upward by as many rows as are currently displayed Page Down Moves displayed bytes downward by as many rows as are currently displayed A 8 Fix Continue Windows 007 2579 005 The Fix Continue utility interacts with several Debugger windows The Main View and Source View windows access the Fix Continue utility from the menu bars The standard output results of running redefined code are displayed in the Execution View window refer to Sectio
114. ation with Open Inventor installed on it The array specification area allows you to specify the variable and its dimensions It consists of the following fields Array Allows you to enter the name of the array variable This entry is language dependent 258 007 2579 005 Debugger Reference A For Fortran the expression may be an array or a dummy array variable name If the last dimension of the array is unspecified a subscript value of 1 is assumed initially For C and C the entry may be an array or a pointer If pointers are used the expression is treated as though it were a single element in which case you need to use the subscript controls to see more than the first element Indexing The expression used to view an element in the Expression array It is filled in automatically when you specify an array to view The expression supplied is language specific It represents the indexing expression used in the language to access a particular element The subscripts are specified by special indexing variables i j k and so forth that can be manipulated in the subscript controls area The Subscript Controls area allows you to control which elements in the variable are displayed and allows you to shift the current element The number of dimensions in the array governs the number of controls that are displayed A close up view of the subscript controls area appears in Figure 91 Subscript Controls Row Col
115. bar Views gt Call Stack View Here you will see that many routines have been called Double click on the routine closest to the top of the displayed list that is not a system routine You will probably recognize the name of this source file This will bring up the source code for this routine and the line where the first uninitialized variable subject to the above mentioned conditions was used You can now examine 007 2579 005 Basic Debugger Usage 2 the values of the indices which caused the problem using any of the methods described in Section 2 1 6 page 20 Note You cannot use cvd to detect the use of uninitialized INTEGER variables 2 2 4 Step 4 Find Divisions by Zero and Overflows 007 2579 005 If you are using a csh or tsch shell perform the following to find floating point divisions by zero and overflows 1 Enter the following setenv TRAP_FPE ON Note For other shells see their man pages Compile your program using the following options g lfpe Enter the following cvd executable In the cvd command message pane enter cvd gt stop in _catch Click on the RUN button Select the following from the Main View window Views gt Call Stack View Double click on the routine closest to the top of the displayed list that is not a system routine You will probably recognize the name of this source file The line where execution stopped is highlighted in the source code dis
116. below These options and submenus are active on the item you select in the source pane of the Main View window Before using this menu you should select an item by clicking on it The following options and submenus are available External Editor Parse And Load Update All Files Show Difference submenu Enable submenu 007 2579 005 Allows you to edit with an external editor such as vi rather than the Debugger s default editor Parses your modified code and loads it for execution You can execute the modified code by clicking on the Run or Continue command buttons in the Main View window Launches the Save File Fixes As dialog that allows you to update the current session while saving all the modifications to the appropriate files Allows you to show the difference between the original source and your modified code You can show the difference in the code in one of the two following ways e For Function Shows the differences for the current function only e For File Shows the differences for the entire file that contains the current function Allows you to enable the changes in your modified code in one of the following ways e Function Enables the changes in the current function e Functions in File Enables the changes to the current function in its own file e All Functions Enables the changes to all functions in the modified code 305 Developer Magic Debugger Us
117. ber when the process stops Removes the expression from the display list unsetbuildenv filename For C and C only when compiled with 032 Disregards the default build environment flags if specified earlier For all functions in files that don t have an overriding build environment unsetbuildenv passes only the c and g flags If filename is given this command disregards the build environment flags specified for the file earlier Further redefinition of the functions in the file use the default build environment flags if set See also setbuildenv 324 007 2579 005 007 2579 005 Debugger Reference A up number Moves up the specified number of frames in the call stack up moves in the direction of the caller use path Uses the specified path to search for source files watch identifier write read Causes program to stop when the identifier is written or read depending on whether write or read is specified If neither is specified the default is write whatis identifier Displays all the qualifications of the specified variable when at filename line number command command When your program reaches the specified line_number the commands specified are executed before the program resumes execution when in filename function_name command command When your program enters the specified function the commands specified are executed before the program resumes executio
118. bug will be run On the machine where your program will be running enter the following echo SDISPLAY The machine_name of your workstation should appear followed by 0 0 If it does not enter the following on the machine where your program will run if you are using the csh or tcsh shells setenv DISPLAY machine_name 0 0 For other shells see their respective man pages 2 1 1 Basic Tips and Features 007 2579 005 Note You can find short Debugger tutorials in Section 2 1 2 page 13 and Section 2 1 3 page 15 for Fortran 90 and C respectively See also Appendix A page 183 for a comprehensive description of Debugger functions 11 Developer Magic Debugger User s Guide 12 To provide debugging information to the Debugger compile your program with the g option this disables optimization and produces information for symbolic debugging To begin a Debugger session enter scvd executable amp The Debugger Main View window will automatically appear along with an icon for the Execution View window If your program requires data to be read from a file named input for example then type the following in the command cvd gt pane of the Main View window cvd gt run lt input See Figure 1 page 3 The Execution View window receives all the output from running your program that would normally go directly to your screen The Main View window controls your Debugger session displaying your source code in
119. build and view the status See Figure 124 Admin Heip Build command directory Directory usr demos WorkShop jello Build in Completed at 16 02 38 al hA Target directory Build process control buttons Status field Figure 124 Build Process Control Area in Build View Window The directory in which the build will run displays in the Directory field at the top of the area The current directory displays by default You can specify the build using make smake pmake clearmake or any other builder and any flags or options that the builder understands see Section B 5 1 page 332 and Section B 5 2 page 333 The target to be built is specified in the Target s field The build process control buttons let you control the build process The following buttons are available Build Runs or reruns a build If you have modified any files you will be prompted to save the new versions prior to the compile Interrupt Stops a build Suspend Stops a build temporarily Resume Restarts a suspended build The status field is to the right of the build process control buttons It indicates the progress of the build 007 2579 005 Using the Build Manager B B 3 Transcript Area 007 2579 005 The transcript area displays the verbatim output from the build The vertical scroll bar lets you go through the list the horizontal scroll bar lets you see long messages obscured from
120. can also examine the Call Stack View at this point to get stack information To find the next error click the Continue button If you need more information to isolate the error set a watchpoint trap to detect a write at the displayed address Then rerun your program Use MALLOC_CLEAR_FREE and MALLOC_CLEAR_MALLOC to catch problems from attempts to access uninitialized or freed memory 007 2579 005 Detecting Heap Corruption 9 Note You can run programs linked with the l1malloc_ss library outside of the Debugger The trade off is that you have to browse through the stderr messages and catch any errors through visual inspection 9 3 Heap Corruption Detection Tutorial This tutorial demonstrates how to detect corruption errors by using the corrupt program The corrupt program has already been linked with the SpeedShop malloc library libmalloc_ss The corrupt program listing is as follows include lt string h gt void main int argc char argv char str int array bogus value Let us malloc 3 bytes str char malloc strlen bad The following statement writes 0 to the 4th byte strcepy str bad y free str Let us malloc 100 bytes str char malloc 100 array int str Get an uninitialized value bogus array 0 free str The following is a double free free str The following statement uses the uniniti
121. ccall pthread_setconcurrency n Where n is the number of kernel micro threads made available to service user threads In this manner you can increase the number of kernel micro threads available However you must not specify a value for n that is greater than the number of physical CPUs on your system e The Multiprocess View window shows different sets of threads processes depending on which version of IRIX you are running This is because in IRIX releases before IRIX 6 5 threads are handled as sprocs not as threads 156 007 2579 005 Multiple Process Debugging 10 10 4 4 Pthread Debugging Session Pthread debugging is highly variable not only from environment to environment from from IRIX release to IRIX release Because of this it is not possible to provide a representative pthread debugging tutorial that can be used by all users See Section 10 4 1 page 153 Theory of 6 5 Pthreads for an in depth description of current pthread implementation in IRIX 007 2579 005 157 X Motif Analyzer 11 This chapter provides an introduction to the X Motif Analyzer as well as a tutorial to demonstrate most of the Analyzer functions The chapter contains the following sections Motif is a library of routines that enable you to create user interfaces in an X environment The Motif libraries handle most of the low level event handling tasks common to any GUI system This way you can create sophisticated interfaces without having t
122. ce View Window Process Meter Process Menu Task View Window Exception View Launching the X Motif Analyzer Window Examiner Tabs Breakpoints Examiner Display in the X Motif Analyzer Window Callback Breakpoints Examiner Event Handler Breakpoints Examiner Timeout Procedure Breakpoints Examiner Input Handler Breakpoints Examiner State Change Breakpoints Examiner X Event Breakpoints Examiner X Request Breakpoints Examiner Request Type Selection Dialog Trace Examiner Widget Examiner Tree Examiner Tree Examiner Window Graphical Buttons Callback Examiner Window Examiner Event Examiner Graphics Context Examiner Pixmap Examiner 007 2579 005 Contents Page 198 207 211 214 215 217 220 223 225 228 230 232 234 235 236 238 239 240 241 242 244 245 246 247 248 249 250 xvii Developer Magic Debugger User s Guide Figure 86 Figure 87 Figure 88 Figure 89 Figure 90 Figure 91 Figure 92 Figure 93 Figure 94 Figure 95 Figure 96 Figure 97 Figure 98 Figure 99 Figure 100 Figure 101 Figure 102 Figure 103 Figure 104 Figure 105 Figure 106 Figure 107 Figure 108 Figure 109 Figure 110 Figure 111 Figure 112 xviii Widget Class Examiner Trap Manager Window Signal Panel Syscall Panel Array Browser with Display Menu Options Subscript Controls Area in the Array Browser Array Browser Spreadsheet Area Example of Wrapped Array Color Exception Portion of
123. checking cannot be performed in subprograms if arrays passed to a subprogram are declared with extents of 1 or instead of passing in their sizes and using this information in their declarations An example of how the declarations should be written to allow for bounds checking is n UBROUTINE SUB A LDA N TEGER LDA N EAL A LDA N H 2 2 2 3 Step 3 Check for Uninitialized Variables Being Used in Calculations 34 To find uninitialized REAL variables being used in floating point calculations compile your program with the following g DEBUG trap_uninitialized ON This will force all uninitialized stack automatic and dynamically allocated variables to be initialized with 0xFFFA5A5A When this value is used as a floating point variable involving a floating point calculation it is treated as a floating point NaN and it will cause a floating point trap When it is used as a pointer or as an address a segmentation violation may occur For example if x and y are real variables and the program is compiled as described previously x y will not be detected when y is uninitialized since no floating point calculations are being done However the following will be detected x y 1 0 After you compile your program with the preceding options enter the following cvd executable Then click the RUN button To find out where your program has stopped select the following from the Main View window menu
124. ck context For example the Callback Examiner appears only when a process is stopped somewhere in a widget callback 11 1 2 Examiners and Selections 11 1 3 Inspecting Data If you select text in one examiner and then choose another examiner by using the Examine menu the new examiner is brought up and the text is used as an expression for it If you selected text that is an inappropriate object for the new examiner an error is generated Alternatively you can select text pull down the Examine menu and choose Selection Here the X Motif Analyzer attempts to select an appropriate examiner for the text If the type of text is unknown the following message displays Couldn t examine selection in more detail Otherwise the appropriate examiner is chosen and the text is evaluated You can also accomplish this by triple clicking on a line of text If the type of text is unknown nothing happens Otherwise the appropriate examiner is chosen and the text is evaluated X Motif applications consist of collections of objects that is Motif widgets and make extensive use of X resources such as windows graphics context and so on The construction model of an X window system hinders you from inspecting the internal structures of widgets and X resources because you are presented with ID values The X Motif Analyzer lets you to see the data structures behind the ID values 11 1 4 Inspecting the Control Flow 160 Traditional debugg
125. context in which the expression is evaluated is not that of the throw the context is the exception handling of the C runtime library Therefore only global variables have unambiguous interpretation in the if clause You should not include complex expressions involving operators such as and amp in your type specification for an exception trap If you create an exception trap with a specific base type however you will also stop your program on throws of pointer reference const and volatile types For example if cvd gt stop exception char then your program will stop at type char char char amp const chars and so forth You can set traps directly in the Main View window by using the Traps menu or by clicking the mouse in the source annotation column You can also specify traps at the Debugger cvd gt command line The following sections describe the ways that traps can be set Section 5 2 1 page 73 Setting Traps Using the Mouse Section 5 2 2 page 73 Setting Traps Using the cvd gt Command Line Section 5 2 3 page 73 Setting Traps Using the Traps Menu in the Main View Window 007 2579 005 Setting Traps 5 5 2 1 Setting Traps with the Mouse The following lists ways to set traps by using your mouse e The quickest way to set a trap is to click in the source annotation column in the Main View or Source View windows A subsequent click removes the trap e If data collection mode has been specified in the
126. controls how the graph is displayed The top group of options from as is to bounding box no depth control how the graph is displayed when it is static These override any Render menu selections The middle move group of options control how the graph is displayed while in motion The last three option single double and interactive refer to buffering techniques used in moving the graph These affect the smoothness of the movement The same as the view mode button described in the previous section When it is off you can select points from the graph to display in the spreadsheet but cannot move the graph When on it allows you to manipulate the graph Displays the right side buttons when it is on and hides them when it is off Controls the shadow effect on the graph When it is on the light appears to come from the camera Causes the Examiner Viewer Preferences Sheet dialog to display 269 Developer Magic Debugger User s Guide 270 Examiner Viewer Preference Sheet a fj Seek animation time 2 88 seconds Seek to point object Seek distance COOL 5 46 percentage absolute Camera Zoom n 148 6 Zoom slider ranges from 1 4 to 148 0 F Auto clipping planes F Stereo Viewing camera rotation mAT 3 8088 Enable spin animation E Show point of rotation axes Figure 97 Examiner Viewer Preference Sheet Dialog The Examiner Viewer Preference Sheet dialog provide
127. croll bar You can search forward or backward in the file by clicking the Next and Prev buttons You can also click an indicator with the middle mouse button to scroll to that point Clicking Reset removes the search target indicators Allows you to scroll to a position in the source code by specifying a line number Go to Line brings up a dialog box You can enter a line number or use the slider at the top of the box to select a line number You do not have to display line numbers to use this feature 195 Developer Magic Debugger User s Guide 196 Versioning Provides access to the configuration management tool if you have designated one Type the following at the 1 prompt usr sbin cvconfig res sccs ptools clear Execution View case Note You must have root permissions to run cvconfig The Versioning submenu appears Selecting any submenu option displays a shell in which you can access the configuration management tool The following selections are available on the submenu e CheckIn Saves the source file and checks it into the database as a new version e Checkout Recalls the source file from the tool s database if you have the proper authority locks it and makes it editable e UncheckOut Cancels the checkout with no changes registered 007 2579 005 Debugger Reference A A 1 5 Display Menu The Display menu in the Main View window provides
128. d 221 Developer Magic Debugger User s Guide In the un labeled text field at the bottom right of the window you can enter a single fully qualified Ada exception name or a single fully qualified Ada unit name Depending on whether the add remove or find mode is active pressing Enter will cause one of the following actions to occur e add mode Single exception Adds single exception to the exception list Library unit name Adds all exceptions found in that library unit name to the exception list e remove mode Single exception Removes single exception from the exception list Library unit name removes all exceptions found in that library unit name from the exception list e set mode e clear mode e find mode Single exception positions top of the exception list to single exception Library unit name positions top of the exception list to the first exception found in given library unit name A 4 X Motif Analyzer Windows 222 The X Motif Analyzer provides specific debugging support for X Motif applications There are various examiners for different X Motif objects such as widgets and X Window System graphics context that might be difficult or impossible to inspect using ordinary debugger functionality See Chapter 11 page 159 for a comprehensive discussion and tutorial regarding the X Motif Analyzer To access the X Motif Analyzer window pull down the Views menu and select X Motif Analyzer s
129. d in multiprocess analysis The a11 entry causes all processes in the process group to stop or sample when the trap fires The pgrp entry sets the trap in all processes within the process group that contains the code where the trap is set You can set a default for the action by setting the Stop All Default or Group Trap Default toggles in the Traps menu After you enter the trap by using the Add or Modify button or by pressing Enter the full syntax of the specification appears in the field The Clear button clears the Trap and Condition fields and the cycle fields Some typical trap examples are provided in Figure 28 page 78 The entries made in the Trap field are shown in the left portion of the figure the trap display in the Trap Manager window resulting from these entries is shown on the right and the trap display shown at the command line in the Main View window is shown at the bottom 77 Developer Magic Debugger User s Guide Trap entries Trap fusr demos WorkShop jello jello c line 778 Trap Sample all exit main file usr demos WorkSt Trap Stop at file usr demos WorkShop jello jel Cycle Count O Current Count Modify Add Clear Delete Stop at file usr demos WorkShop jello jello c line 778 a Sample all exit main file usr demos WorkShop jello jello c Stop watch address 0x00400304 size 4 for write access Stop at file usr demosi V iS
130. d in the Main View or Source View windows To set a sample trap 1 highlight on the appropriate line 2 pull down the Set Trap submenu 3 select the Sample option Sets a sample trap at the beginning of a function To set the sample trap highlight the function name in the source code display area then pull down the Set Trap submenu and select the Sample At Function Entry option Sets a sample trap at the end of a function To set the sample trap highlight the function name in the source code display area then pull down the Set Trap submenu and select the Sample At Function Exit option The Clear Trap submenu contains selections that allow you to delete a trap on the line containing the cursor You must designate Stop or Sample trap type since both types can exist at the same location appearing superimposed on each other The following submenu selections are available Stop Sample Designates the stop trap type Designates the sample trap type The last two menu options allow you to specify the following items Group Trap Default Stop All Default Interacts with Source View If set to true all subsequent Source View trap requests will be group traps That is all members of the process group will apply this trap This option is the same as typing stop pgrp in filename from the command line Default is false unless you are using IRIX 6 5 pthreads when the implied setting is always true Interacts with Source V
131. d linking the entire program This section contains the following subsections e Setting up the Sample Session Section 8 3 1 page 111 Redefining a C C Function Section 8 3 2 page 112 e Setting Breakpoints in Redefined Code Section 8 3 3 page 118 e Viewing Status Section 8 3 4 page 121 e Comparing Original and Redefined Code Section 8 3 5 page 121 e Ending the Session Section 8 3 6 page 124 8 3 1 Setting up the Sample Session 007 2579 005 For this tutorial use the demo files in the usr demos WorkShop timel directory that contains the complete source code for the C application timel To prepare for the session you must create the fileset and launch Fix Continue from the Debugger as shown below 1 Enter the following commands oe mkdir demos timel cd demos timel cp usr demos WorkShop timel1 make timel cvd timel amp JP Al ol oe 111 Developer Magic Debugger User s Guide The cvd command brings up the Debugger from which you can use the Fix Continue utility The Execution View icon and the Main View window appear Note that the Debugger shows a source code status indicator of Read Only 2 Open the Execution View window and position it next to the Main View window 3 Click Run to run timel The Execution View shows the program output see Figure 37 Execution View process terminated a if laboct 3 bin cvxhang signal fsgi359 4 6 104857932 home pop
132. debug User s Guide Changes the current process You will be queried for the new process ID You can select one from the list of items presented type one in or paste one in from another window Switching processes changes the session Changes the current executable This option also allows you to debug a different core file Releases the process from the Debugger This allows you to make changes to the source code You must detach the process before you recompile the program Allows you to use the previously saved preference settings from a file you choose in the Load Settings dialog Allows you to save the current preference settings to an initialization file used when the Debugger is first started or any file you choose through this dialog These can include such items as window sizes current views window configurations and so on Iconifies all session views Brings all session view windows to the foreground and displays any iconified windows Allows you to run other WorkShop tools You can switch to the other tools by selecting Build Analyzer Static Analyzer Performance Analyzer or Tester Selecting Debugger 191 Developer Magic Debugger User s Guide A 1 2 Views Menu 192 Project Close Exit allows you to start another debugging session If you have ProDev ProMP formerly called WorkShop Pro MPF installed on your system the Parallel Analyzer selection is also available Allows you
133. ded processes are marked with a folder icon Clicking the folder changes the view to show that process s pthreads Clicking on a thread opens a call stack for that thread For each process or thread clicking the right mouse button brings up a menu that applies to the selected item Note This menu is a duplicate of the Process menu See Section A 2 5 page 215 for more information 007 2579 005 A 2 2 1 Status of Processes 007 2579 005 Debugger Reference A Change focus to this entry Create new window Goto Details Add Bemove Figure 60 Process Menu When the Multiprocess View window comes up it lists the status of all processes in the process group This view includes the following information PID PPID Status State Name Function PC Shows the process identifier PID Lists the parent process PIDs Shows Status or State depending on how you have set your preferences on the Multiprocess View Preferences menu brought up by selecting Preferences from the Config menu Status is user level status and State is the kernel level status Identifies the process by file name Indicates the current function and program counter PC for any stopped processes The following Status and State conditions are possible Status Running Stopped Stopped on breakpoint State RUNNING RUNNING RUNNING but at a trap pc 207 Developer Magic Debugger User s Guide Wai
134. default value is false varBrowser maxSymSize Lets you set the maximum number of variables that can be displayed by the Variable Browser The default value is 25 The following resources apply to Source View svComponent lineNumbersVisible Displays source line numbers by default sourceView nameText columns Sets the length of the File field in Source View The default value is 30 characters sourceView textEdit scrollHorizontal If set to true displays a horizontal scroll bar in Source View tabWidth Sets the number of spaces for tabs in Source View The following resource applies to Build View buildCommand Is used to determine which program to used with make 1 smake 1 clearmake 1 and so forth The default value is make 1 runBuild Specifies whether cvmake 1 begins its build immediately upon being launched The default value is true 181 Developer Magic Debugger User s Guide To change these resources you need to set the desired value in your Xdefaults file and run the xrdb 1 command Then restart your application so that the resource gets picked up 12 2 DUMPCORE Environment Variable The DUMPCORE environment variable allows the Debugger to dump a core file in the event that there is a debugger execution problem during the debug session To enable core files enter either of the following before you startup your debug session e For the C shell enter setenv DUMPCORE
135. dependency relationships are shown as arrows with the supplying file at the base of the arrow and the dependent file at the head The colors used to depict the files 336 007 2579 005 007 2579 005 Using the Build Manager B depends on your color scheme Build Analyzer differentiates the two types of files by depicting one with light characters on a dark background and the other with dark text on a light background If you double click a source file icon an editor is brought up for that file Double clicking a derived file starts a build and displays Build View In addition to dependency relationships Build Analyzer indicates the status of the files and relationships as follows e Source file availability status normal or checked out Normal means that the source file is read only and needs to be made writable to be edited Normal files appear as light rectangles with black text Checked out means that you have a writable version of this file available and can thus edit it A checked out file appears in a different color from normal files with a shadow e Derived file compile status current or obsolete When applied to a derived file the term current means that none of the files on which the derived file depends have been edited since the derived file was created Current derived files appear as dark rectangles with white text Obsolete means that one or more of the source files have been modified since the derived file was
136. different register by entering its name either by hardware name or by alias in this field and pressing Enter You can also switch registers by clicking on the new register in the display area 297 Developer Magic Debugger User s Guide Current register Shows the contents of the selected register You value field can assign a new value to a register by entering either a literal or an expression into the Value field You then click on the Modify button to change the value or press Enter Register display Shows the registers organized into four groups area general special floating and double Note that the general registers are identified by both their hardware and software names For systems with 32 bit processors O2s for example double precision registers represent a pair of floating point registers For systems with 64 bit processors Origin2000s for example float registers are not displayed at all Floating point calculations are done in double precision registers Note The special registers p0 p1 and p2 do not appear in Figure 114 page 297 These are used for instrumentation and appear only when instrumentation has taken place A 7 2 2 Changing the Register View Display The Preferences selection in the Config menu allows you to change the Register View display It brings up the Register View Preferences dialog box see Figure 115 page 299 The register display toggle buttons let you specify which
137. dler or are caught by an unexpected handler If you specify item stops on exceptions that throw the base type item Do not include complex expressions using operators such as and amp in your type specification for an exception breakpoint in filename function_name if expression Traps at the entry to the specified function If the if option is used then the trap fires only if expression is true If the filename is given the function is assumed to be in that file s scope If specified the filename must be enclosed in double quotation 323 Developer Magic Debugger User s Guide marks As an example to specify a stop in function func1 in myfile f only if n is 20 the syntax is stop in myfile f funcl if n eq 20 syscall catch ignore call return sys_call_name all The catch option adds a system call to the list of system calls to be trapped The ignore option removes a system call from the system call trap list The call option specifies the entry to the system call and return signifies the return from the call trace variable at filename line_number function_name if expression Traces the specified variable You can specify a file and or test condition You can also specify a line number or a function where the trace is to take place unalias aliasname Cancels the alias specified as aliasname undisplay displaynumber Stops display of expression with specified displaynum
138. ds 326 Read Only debugger status 109 readv syscall that blocks continued pthreads 326 realloc call errors heap corruption error 126 Recompile selection in the Source menu 195 007 2579 005 recompiling code 7 recv syscall that blocks continued pthreads 327 recvfrom syscall that blocks continued pthreads 327 recvmsg syscall that blocks continued pthreads 327 redefine dbx style command 319 redefined code distinguished from compiled code 108 redefining a function in Fix Continue tutorial 112 redefining functions 107 Register name display format field in disassembly view preferences box 295 Register View Views menu option 5 Register view 296 Register view formatting 299 Register view preferences dialog box 299 Register view window 297 Register View selection in views menu 193 registers 5 release notes 9 relnotes 9 Remap paths selection in session menu 44 Remove selection in structure browser node menu 284 removing traps with mouse 73 replace_source dbx style command 320 rerun dbx style command 320 Reset To Factory Defaults toggle in Fix Continue Preferences dialog 205 resource change breakpoints examiner 233 restrictions and limitations of X Motif analyzer 161 Result column in Expression View 99 Result column in expression view 275 Resume child after attach on fork Multiprocess View preferences option 210 Resume child after attach on sproc Multiprocess View preferences option 210 Re
139. ds or concepts being defined user input This bold fixed space font denotes literal items that the user enters in interactive sessions Output is shown in nonbold fixed space font Brackets enclose optional portions of a command or directive line Ellipses indicate that a preceding element can be repeated 007 2579 005 xxiii Developer Magic Debugger User s Guide Reader Comments If you have comments about the technical accuracy content or organization of this document please tell us Be sure to include the title and part number of the document with your comments You can contact us in any of the following ways Send electronic mail to the following address techpubs sgi com Send a facsimile to the attention of Technical Publications at fax number 1 650 932 0801 Use the Suggestion Box form on the Technical Publications Library World Wide Web page http techpubs sgi com library Call the Technical Publications Group through the Technical Assistance Center using one of the following numbers For Silicon Graphics IRIX based operating systems 1 800 800 45GI For UNICOS or UNICOS mk based operating systems or CRAY Origin2000 systems 1 800 950 2729 toll free from the United States and Canada or 1 651 683 5600 Send mail to the following address Technical Publications Silicon Graphics Inc 1600 Amphitheatre Pkwy Mountain View California 94043 1351 We value your comments and will
140. e 42 Heap Corruption Warning Shown in Execution View 6 Select the following from the Main View window menu bar Views gt Call Stack Call Stack View opens displaying the call stack frame at the time of the error see Figure 43 Calf Stack pid 242411 Admin Config Display smalloc error message Uxsb eb ssmalloc c i malloc_checktail p 0x10012018 ssmalloc c 1047 malloc_checkpattern p 0x10012018 ssmalloc c 1029 free ptr 0x10012018 ssmalloc c 689 mainfarge 1 argv Ox fff2e74 corrupt c 14 __start lt stripped crtltext s 177 Figure 43 Call Stack at Boundary Overrun Warning 131 Developer Magic Debugger User s Guide 132 7 Click the Continue button in the Main View window s control panel Watch the Execution View and Call Stack View windows The process continues from the stop at the boundary overrun warning until it hits the next trap where an erroneous free error occurs Click the Continue button again and watch the Execution View and Call Stack View windows This time the process stops at a bus error or segmentation violation The PC stops at the following statement because bogus was set to an uninitialized value value bogus Enter p amp bogus on the Debugger command line at the bottom of the Main View window This gives us the address for the bogus variable and has been done in Figure 44 page 133 We need the bad address so tha
141. e Breakpoint Examiner the examiner appears as shown in Figure 74 page 238 007 2579 005 237 Developer Magic Debugger User s Guide 238 Active Breakpoints Breakpoints Figure 74 X Event Breakpoints Examiner The X Event Breakpoints examiner contains the following items Breakpoint Type Allows you to select the type of breakpoint you button wish to set In this section X Event is selected Clear button Clears all the current breakpoint selections and text fields Event Type button Allows you to set the event type for a given breakpoint Window ID text field Allows you to set the Window ID value for the breakpoint 007 2579 005 Debugger Reference A A 4 2 8 X Request Breakpoints Examiner 007 2579 005 When the X Request option of the Breakpoint Type option button in the Breakpoint Examiner is selected the examiner appears as shown in Figure 75 page 239 Active Breakpoints wv ea Breakpoints Figure 75 X Request Breakpoints Examiner The X Request Breakpoints examiner contains the following items Breakpoint Type Allows you to select the type of breakpoint you option button wish to set In this section X Request is selected Clear button Clears all the current breakpoint selections and text fields 239 Developer Magic Debugger User s Guide Request Type button Launches the Request Type Selection dialog see Figure 76 This dialog allows you to s
142. e For the Korn shell or Bourne shell enter DUMPCORE export DUMPCORE 182 007 2579 005 Debugger Reference A This chapter describes the function of each window menu and display in the Debugger s graphical user interface and describes the commands available on the Debugger command line see Section A 9 page 312 This chapter contains the following sections A 1 Main View Window Main View Window Section A 1 page 183 Basic Windows Section A 2 page 206 Ada Specific Windows Section A 3 page 216 X Motif Analyzer Windows Section A 4 page 222 Trap Management Windows Section A 5 page 251 Data Examination Windows Section A 6 page 256 Machine Level Debugging Windows Section A 7 page 290 Fix Continue Windows Section A 8 page 301 Debugger Command Line Section A 9 page 312 The major areas of the Main View window are shown in Figure 57 page 184 007 2579 005 183 Developer Magic Debugger User s Guide 184 Menu bar Control panel Status area Source code display area Annotation column Source filename Debugger command line Admin Views Query Source Display Perf fraps PC FhoContinue H Command usr demos WorkShop bounce bounce Debug Oniy Run Executable bounce bounce Status void main unsigned int argc char argv endif j emembered rt theApplication f f Init Intrinsics build all windows and enter event loop theApplication
143. e Main View window menu bar as follows Admin gt Library Search Path Or the Library Search Path dialog opens automatically if you invoke the Debugger on an executable or core file and the it is unable to find all of the required DSOs In this case an annotated list of required DSOs displays at the top of the dialog box with such status messages as OK Error Cannot find library or Error Core file and library mismatch which indicates that the Debugger found a DSO that did not match the core file Below this list are three to nine fields in which you can modify the value of the corresponding named environment variable ens a dialog that allows you to enter a new 8 y pathname Displays the Multiprocess View window which allows you to control processes and threads You should note that if you exit from 007 2579 005 007 2579 005 GLdebug Switch Process Switch Executable Detach Load Settings Save Settings Iconify Raise Launch Tool Debugger Reference A Multiprocess View you will exit from your debugging session More additional information about Multiprocess View refer to Section A 2 2 page 206 Provides a toggle to turn on GLdebug GLdebug is a graphical software tool for debugging application programs that use the IRIS Graphics Library GL GLdebug locates programming errors in executables when GL calls are used incorrectly For more information refer to the GL
144. e View description 210 Source View selection in views menu 193 spreadsheet area in array browser 260 sproc processes 136 ssmalloc_error 128 Stack Depth Multiprocess View preferences option 209 stack frame 59 stack frames 94 272 starting the debugger 47 starting program execution 88 startup file for customizing the debugger 177 State selection in structure browser node menu 282 state change breakpoints examiner 236 static analyzer how to access from the Main View window 6 status dbx style command 322 Status field in the Main View window 87 88 Status window 302 Admin menu 304 Fix continue 121 Fix Continue menu 305 Fix Continue Preferences submenu 203 View menu 304 status viewing 121 step dbx style command 323 step indicators in array browser 260 Step Into button 12 Step into button in disassembly view 291 007 2579 005 Index Step Into button in the Main View window 88 Step Over button 12 Step Over button description 20 Step over button in disassembly view 291 Step Over button in the Main View window 89 stepi dbx style command 323 Stop All Default Traps menu option 254 Stop All Defaults toggle 75 stop at dbx style command 323 Stop at Function Entry selection in traps submenu 74 Stop at function entry selection in traps submenu 199 Stop at Function Exit selection in traps submenu 74 Stop at function exit selection in traps submenu 200 Stop button description 19 Stop button i
145. e field r16 s0 rif st r18 s2 r19 s3 120 s4 r21 s5 cause pe 3 85486976e 29 3 85487086e 29 2 98000002e 00 4 311480682e 8 8 62281322e 8 1 97188044e a f12 fl4 fl6 f18 20 22 one Ke Ke OO Ow 8986876656828557e 81 8986876656028568e 81 92529764065 16556e 315 5826662397 162854e 314 5862187637336457e 314 4889346729283308e 314 9186642215587208e 81 32529764065 16556e 315 4309880854 4x 16883fca Gx 16883Fc4 430088 1484 4x00880888 4280880082 Gx fffat44 Ox fffaf4c Ox fffafad 4xa0800088 4x 980088a 4x80800024 4x80403f8c 2 98000002e 00 2 98000002e 08 4 31140661e 8 8 89868796e 81 4 G000000Ge 00 4 0000000Ge 0a d16 d18 d20 d22 d26 d28 d30 Po gvaga goo we taped 2 4 2 2 414 4x 088088a Gx 18883Fca 4x88483f8a 4x88988888 0x00403f80 Gx 188882ca Ox7fffaec oxogagagga 0x00402460 6x8088 168c Modify button 4 6000000Ge 08 4 80000000e 0a 4 68880008e 88 4 6008000Ge 08 5824662407044 167e 314 2544 154288859639e 315 ta 4 2 2 4 2 4 4 4 2 2 4 a2 2 BaegbRRRRe00RR0Ge 08 popogoggggoopp e 0A pppppanggoaana ge aA Ua 4 4 2 4 4 4 4 4 2 4 4 4 a2 2 ABG0800008080000e 0a Figure 114 The Register View Window A 7 2 1 The Register View Window The major features of the Register View window are the following Current register field Identifies the currently selected register You can switch to a
146. e session tutorial 111 setting traps for 118 Status window 121 WorkShop integration 108 Fix Continue menu 305 348 Fix Continue Preferences submenu 203 fork application 135 fork editor 6 Fork Editor selection in Source menu 195 fork processes 136 Format menu in Expression View 99 in jello tutorial 61 Format menu in expression view 274 275 Format menu in structure browser 279 Format menu in variable browser 288 Formatting Fields in Structure Browser 284 fortran debugging a multiprocess fortran program 146 fortran multiprocess debugging session 146 general fortran debugging hints 146 Fortran 90 tutorial code example 13 Fortran expressions 105 Fortran function calls 107 Fortran variables supported in expressions 106 frames 93 271 free call errors heap corruption errors 126 free run of single 6 5 POSIX pthread 153 fsync syscall that blocks continued pthreads 326 func dbx style command 317 function definitions comparing in Fix Continue tutorial 122 function editing 113 function redefining Fix continue 112 Function selection in disassemble menu 292 functions identifying 109 G g option for compiling 12 Geometry selection in structure browser node menu 283 getmsg syscall that blocks continued pthreads 326 007 2579 005 getpmsg syscall that blocks continued pthreads 326 getstarted tutorial directory 13 getting started with debugger tutorial 11 givenfile dbx style
147. e source code 4 Enter a breakpoint at line 15 as follows at the cvd gt prompt at the bottom of the Main View window This will enable you to execute through the end of the initialization of the y array for the sample code cvd gt stop at 15 Line 15 is highlighted in red and a stop icon appears in the left column 14 007 2579 005 Basic Debugger Usage 2 5 Run the program There are two ways that you can do this a Click on the Run button at the top of the Main View window OR b Enter the following at the cvd gt prompt cvd gt run The program executes up to Line 15 and waits for further instruction 6 Enter the following command at the cvd gt prompt to print the y array for this example cvd gt print y The following displays in the cvd gt command pane Note You should expand this pane or use the slider at the right side of the pane if you do not see the printout 7 At this point you can experiment with other command described in this chapter notably the execution control buttons described in Section 2 1 4 page 19 8 Select the following to end this tutorial for the Fortran 90 demo program Admin gt Exit 2 1 3 C Code Example and Short Tutorial Use the C file prog c and dot c in usr demos WorkShop getstarted to demonstrate the Debugger features in the following tutorial 007 2579 005 15 Developer Magic Debugger User s Guide Example 2 C Code Example The following is the same
148. ebugger will stop each time it encounters this function or subroutine 3 To remove this stopping condition enter the following in the command message pane cvd gt status For the Stop in command above the trap in the list would appear as n Stop entry name Here the value of n is a positive integer and name is the name of the function or subroutine where the stop has been set 4 To delete this stop enter cvd gt delete n e Using the Trap Manager 1 Select the following from the Main View window menu bar to use the trap manager Views gt Trap Manager This will call up the Trap Manager window 007 2579 005 Basic Debugger Usage 2 Admin Contig Traps Display Trap Condition Cycle Count Current Count E Display Full Names Clear Active Trap E pending Stop at file usr demos VorkShop getstarted prog c line 23 Fi Stop at file usr demosWVorkShop getstarted prog c line 4 ee ee Search Figure 7 Trap Manager Window 2 In the pane to the right of the word Trap enter stop in name 3 Click on the Add button or press Enter This will add your breakpoint at your desired function or subroutine Note To remove the stopping condition so the Debugger will not stop at each occurrence of name click on the Delete button in the Trap Manager window If you have multiple traps displayed click on the trap that you wish to delete before you click on the De
149. ed text or the source pane of the Main View window Kills the currently running process or all running processes in your debug session by sending the process es the equivalent of a kill 9 signal You can use this button if the process es is running or stopped otherwise the button is grayed out 187 Developer Magic Debugger User s Guide Run A11 Status area Source Code area Annotation column File text field Command line area Show Hide annotations button 188 Runs the program that you are currently debugging or all programs After the initial run allows you to rerun the program s while maintaining any breakpoints and command line arguments you have set Displays information about the process that you are debugging such as process id thread id function name list of arguments location of the PC and so forth Displays the source code for the program that your are currently debugging Clicking in this area displays information specific to a line number such as breakpoints location of the PC and so forth Displays the name of the file shown in the source code area Area of the Main View window where you can enter Debugger commands and view line mode debugger message and in which Debugger messages are displayed This button see Figure 58 page 189 is visible only when you run or load a performance experiment see the Developer Magic Performance Analyzer User s Guide for more inf
150. ee Figure 66 page 223 007 2579 005 Debugger Views Menu Array Browser Cali Stack AC Disassembly View Exception View Execution View Expression View AIHE File Browser Memory View Multiprocess View Process Meter Register View Signal Panel Source View Structure Browser Ali B Syscali Panel Task View trap Manager Variable Browser XiMotif Analyzer Debugger Reference A Admin Examine none Figure 66 Launching the X Motif Analyzer Window A 4 1 Global Objects Through the X Motif Analyzer is made up of several different examiner windows a number of objects such as the Admin menu Examine menu Help menu and several text bars remain constant throughout window changes The following examiners are available and discussed in the sections indicated 007 2579 005 Breakpoints Examiner Section A 4 2 page 226 Trace Examiner Section A 4 3 page 240 Widget Examiner Section A 4 4 page 242 Tree Examiner Section A 4 5 page 243 Callback Examiner Section A 4 6 page 246 Window Examiner Section A 4 7 page 247 223 Developer Magic A 4 1 1 Admin Menu A 4 1 2 1 Examine Menu 224 Debugger User s Guide e Event Examiner Section A 4 8 page 248 e Graphics Context Examiner Section A 4 9 page 248 e Pixmap Examiner Section A 4 10 page 249 e Widget Class Examiner Section A 4 11 page 250 The Admin menu offers the following menu selections Active Activates
151. efore you can view current values of variables with the Debugger Before you can do this you must first run your program under the Debugger and stop execution at some point The following sections list ways of viewing current values of variables with the Debugger It is suggested that you try each of the following methods to determine which you would prefer to use 007 2579 005 Basic Debugger Usage 2 2 1 6 1 Viewing Variables Using the cvd gt Command Line At the bottom of the Main View window is the command message pane Here you can give the Debugger various instructions at the cvd gt command line Example 1 Value of array x If you want to know the current value of array x enter either of the following two commands in the command message pane cvd gt print x or cvd gt p x The current values for x will be printed Example 2 Value of x 2 If your program is written in Fortran and you only want the value of x 2 enter cvd gt print x 2 For a C program enter cvd gt print x 2 Example 3 Change value of x 2 to 3 1 To change the value of x 2 to 3 1 in a Fortran program enter cvd gt assign x 2 3 1 For a C program enter cvd gt assign X 2 3 1 The value of x 2 will now be 3 1 when execution is resumed Such changes are only active during the current Debugger run of your program In the preceding examples if x is a large array you may want to use the Array Browser window see Section 2 1 6 5 pa
152. elect the type of X Request used for your breakpoint The information displayed is in outline form selecting a given item selects all its subitems For example if you select Window Category CreateWindow ChangeWindowAttributes GetWindowAttributes and so on are also selected X Requests A eguests Window Category CreateWindow ChangeWindowAttributes GetWindowAttributes ChangeSaveSet Window Configuration Category DestroyWindow DestroySubwindows OK Cancel Help Figure 76 Request Type Selection Dialog A 4 3 Trace Examiner The Trace examiner see Figure 77 page 241 is a control area where you can trace the execution of your application and collect the following date e X Server Events e X Server Requests e Widget Event Dispatch Information 240 007 2579 005 Debugger Reference A e Widget Resource Changes through xt Set Values e Widget State Changes create destroy manage realize and unmanage e Xt Callbacks widget event handler work proc timeout input and signal X Motif Analyzer pid 601133 Admin Examine Collect Trace F File un ounce trace Trace Summary 2 Widget Realize bounce Widget Create screen0 XmScreen Widget Resource Change bounce mapped WhenManaged Widget Resource Change bounce x Widget Resource Change bounce y Widget Resource Change bounce width Widget Resource Change bounce height Search C Filter Clear File
153. en Note There is a public domain version of lint for FORTRAN 77 called ftnchek You can get ftnchek from the pub directory at the anonymous ftp site ftp dsm fordham edu at Fordham University Also there is a lint for Fortran 90 for SGI Cray PVP machines and the Cray T3E called cflint You can invoke cflint if you compile with the r1 option 2 2 2 Step 2 Check for Out of Bounds Array Accesses 32 A common programming error is the use of array indices outside their declared limits For help finding these errors compile your program as follows gt g DEBUG subscript_check ON Then run the generated executable under cvd and click on the RUN button See the DEBUG_group 5 man page for more information on this option The following list explains compiling dependencies when working with out of bounds array accesses e If you are running a C or C program your program will stop at the first occurrence of an array index going out of bounds You can now examine the value of the index that caused the problem by using any of the methods 007 2579 005 007 2579 005 Basic Debugger Usage 2 described in Section 2 1 6 page 20 If you compile with the g option the compiler generates symbolic debugging information so your program will execute under cvd It also disables optimization Sometimes disabling optimization will cause the bug to disappear If this happens you should still carefully go through each of these step
154. ender Menu Color Menu Scale Menu Examiner Viewer Controls Examiner Viewer Menu Call Stack View Window Config Menu Display Menu Expression View Window Config Menu Display Menu Language Pop up Menu Format Pop up Menu File Browser Window Structure Browser Window Using the Structure Browser Overview Window to Navigate Entering Expressions Working in the Structure Browser Display Area Structure Browser Display Menu Node Menu Formatting Fields Variable Browser Window Entering Variable Values xii Page 254 254 255 256 257 261 262 263 263 265 266 268 271 273 273 273 274 275 275 275 276 277 279 279 279 280 282 284 288 288 007 2579 005 Changing Variable Column Widths Viewing Variable Changes Machine level Debugging Windows The Disassembly View Window Similarities with Main View Window The Disassemble Menu The Config Menu Preferences Dialog The Register View Window The Register View Window Changing the Register View Display The Memory View Window Viewing a Portion of Memory Changing the Contents of a Memory Location Changing the Memory Display Format Moving around the Memory View Display Area Fix Continue Windows Fixt tContinue Status Window Admin Menu View Menu Fix Continue Menu Fix Continue Error Messages Window Admin Menu View Menu Fix Continue Build Environment Window Changes to Debugger Views Main View Command Line Interface Call Stack View Trap Manage
155. enu 196 view changes in debugger 309 View menu 304 View submenu 203 view windows Multiprocess View 136 view call stack 311 viewing data 4 viewing status Fix Continue tutorial 121 Views menu in the Main View window 192 WwW Warn Unfinished Edits Before Continue toggle in Fix Continue Preferences dialog 204 Warn Unfinished Edits Before Run toggle in Fix Continue Preferences dialog 204 watch command in jello tutorial 57 watch trap debugger command option 80 watch dbx style command 325 Watchpoint definition 57 watchpoint 57 watchpoints 4 whatis dbx style command 325 when at dbx style command 325 when in dbx style command 325 where dbx style command 325 which dbx style command 325 widget class examiner 250 widget class menu item 225 widget classes examining 168 widget examiner 242 widget hierarchy 166 widget item 224 widget structure navigating 163 widget tree menu item 224 007 2579 005 widgets examining 166 window attributes viewing 171 window examiner 171 247 WorkShop integration 108 Wrapped display selection in array browser display menu 261 write syscall that blocks continued pthreads 327 writev syscall that blocks continued pthreads 327 X X event menu item 225 X graphics context menu item 225 X pixmap menu item 225 X window system resources changing to customizing the debugger 180 X event breakpoints examiner 237 X Motif Analyzer global objects descr
156. er s Guide Disable submenu Save submenu Delete submenu Show submenu 306 Has the same menu choices as the Enable submenu but disables rather than enables Allows you to save your code changes to a file You can save the changes in one of the following ways Function Launches the File dialog allowing you to save only the current function to a file File Launches the Save FiletFixes As pop up window allowing you to save the entire file that contains the current function Has the same menu choices as the Save submenu but deletes rather than saves Allows you to launch any of the following windows Message Window Launches a Fix Continue Error Messages window for the selected item See Section A 8 2 page 307 for more details Build Env for File Launches a Fix Continue Build Environment window for the file shown in the Source View window See Section A 8 3 page 308 for more details on the Fix Continue Build Environment window Default Build Env Launches the FixtContinue Build Environment window to show the options that are to be used in cases where they could not be obtained from the target See Section A 8 3 page 308 for details on the Fix Continue Build Environment window 007 2579 005 Debugger Reference A A 8 2 Fix Continue Error Messages Window A 8 2 1 Admin Menu A 8 2 2 View Menu 007 2579 005 The Fix Continue
157. er or you can request information for all threads The thread qualifier does not affect command output source filename status 322 Executes commands in the specified file Displays a list of currently set breakpoints and traces 007 2579 005 007 2579 005 step stepi stop stop stop stop stop int int all Debugger Reference A Steps the specified number of source lines This command steps into procedures The default is one line Steps the specified number of machine instructions This command steps into procedures The default is one instruction pgrp in filename If set to all stops all members of the specified process group whenever the trap is encountered If set to pgrp all members of the process group will apply the trap at filename line number if expression Traps at the specified line in the specified file If the if option is used the trap fires only if expression is true If specified the file name must be enclosed in double quotation marks As an example to specify a stop at line 5 in myfile c the syntax is stop at myfile c 5 exception all item Stops on all C exceptions or exceptions that throw the base type item Do not include complex expressions using operators such as and amp in your type specification for an exception breakpoint exception all item item Stops on all C exceptions or exceptions that either have no han
158. erable to the following typical corruption problems boundary overrun A program writes beyond the malloc region boundary underrun A program writes in front of the malloc region access to uninitialized A program attempts to read memory that has not memory yet been initialized access to freed memory A program attempts to read or write to memory that has been freed double frees A program frees some structure that it had already freed In such a case a subsequent reference can pick up a meaningless pointer causing a segmentation violation erroneous frees A program calls free on addresses that were not returned by malloc such as static global or automatic variables or other invalid expressions See the malloc 3F man page for more information 007 2579 005 125 Developer Magic Debugger User s Guide 9 2 Finding Heap Corruption Errors To find heap corruption problems you must relink your executable with the lmallo mallo c_ss library instead of the standard 1malloc library By default the c_ss library catches the following errors malloc call failing returning NULL reall real oc call failing returning NULL loc call with an address outside the range of heap addresses returned by ma memal free free lloc or memalign ign call with an improper alignment call with an address that is improperly aligned call with an address outside the range of heap addresses
159. erminology Section 5 1 page 70 e Setting traps in the Main View and Source View windows Section 5 2 page 72 e Setting traps in the Trap Manager Section 5 3 page 76 e Setting traps with Signal Panel and Syscall Panel Section 5 4 page 84 For a tutorial on the use of traps see Section 4 5 page 54 007 2579 005 69 Developer Magic Debugger User s Guide 5 1 Traps Terminology 5 1 1 Trap Triggers 70 A trap is an intentional process interruption that can either stop a process or capture data about a process It has two parts trigger Specifies when the trap fires action Specifies what happens when the trap fires You can set traps at a specified location in your program or when a specified event occurs You can set a trigger at any of the following points e Ata given line in a file often referred to as a breakpoint e Ata given instruction address e At the entry or exit for a given function e After set time intervals referred to as a pollpoint e When a given variable or address is read written or executed referred to as a watchpoint e When a given signal is received e When a given system call is entered or exited In addition you can use an expression to specify a condition that must be met before a trap fires You can also specify a cycle count which specifies the number of passes through a trap before firing it Note When you set a breakpoint in C code that uses templates that breakpoint
160. ers enable you to set breakpoints only in source lines or functions With the X Motif Analyzer you can set breakpoints for specific widgets or widget classes for specific control flow constructs like callbacks or event handlers and for specific X events or requests 007 2579 005 X Motif Analyzer 11 11 1 5 Tracing the Execution The X Motif Analyzer can trace X1ib level server events and client requests Xt level event dispatching information widget life cycle and widget status information 11 2 Restrictions and Limitations The X Motif Analyzer has the following restrictions and limitations e The Breakpoints Examiner is active only after you have stopped a process and if you have changed LD_LIBRARY_PATH See Section 11 3 2 page 163 for more information regarding the correct LD_LIBRARY_PATH e Sometimes gadget names may be unavailable and are displayed as lt object gt You can minimize this condition by first loading the widget tree e editres requests such as widget selection and widget tree work only if the process is running or if the process is stopped outside of a system call This can be annoying when the process is stopped in select waiting for an X server event e The process state and appearance of the Main View window flickers while the X Motif Analyzer tries to complete an edit res request when the process is stopped e editres requests may be unreliable if the process is stopped 11 3 X Motif Ana
161. es or enter a process ID in the Process ID field and click the OK button To remove a process click on the process name in the Multiprocess View window and select Remove from the Process menu Be aware that a process in a sproc process group cannot be removed Likewise you cannot remove a pthread from a pthread group 10 1 7 Multiprocess Preferences The Preferences option in the Config menu brings up the Multiprocess View Preferences dialog The preferences on this dialog lets you determine when a process is added to the group specify process behavior specify the number of call stack levels to display and so forth For details about Multiprocess View Preference options see Section A 2 2 4 page 209 10 1 8 Bringing up Additional Main View Windows To create a Main View window for a process highlight that process in the Multiprocess View window Then select the following in the Multiprocess View window Process gt Create new window 10 2 Debugging a Multiprocess C Program 007 2579 005 This section uses a C program that generates numbers in the Fibonacci sequence to demonstrate the following tasks when using the debugger to debug multiprocess code e Stopping a child process on a sproc Using the buttons in the Multiprocess View window Setting traps in the parent process only e Setting group traps 139 Developer Magic Debugger User s Guide 140 The fibo program uses sproc to split off a ch
162. es simultaneously Note The Multiprocess View window is for use by C C and Fortran users If you are debugging Ada code you should use the Task View window available through the View menu of the Main View window see Section A 3 1 page 216 Currently Multiprocess View handles the following multiple process situations e True multiprocess program which refers to a tightly integrated system of sproc d processes generated by the MIPSpro Automatic Parallelization Option For more information on parallel processing see the auto_p 5 man page or the MIPSpro Automatic Parallelizer Programmer s Guide e Auto fork application which is a process that spawns a child process and then runs in the background e Fork application which is a process that spawns child processes and can interact with them e Locally distributed application which is an application that involves two different executables running in different processes on the same host coordinated by a rendezvous mechanism 135 Developer Magic Debugger User s Guide This chapter discusses the details of multiprocess debugging in WorkShop and includes the following topics e Using the Multiprocess View window Section 10 1 page 136 e Controlling Execution and Setting Traps in a Multiprocess Program Section 10 2 page 139 e Debugging a Multiprocess Fortran Program Section 10 3 page 146 e Debugging pthreaded applications Section 10 4 page 152 10 1 Us
163. eset for X Motif analyzer tutorial 162 print expression dbx style command 318 printd expression dbx style command 318 printf expression dbx style command 318 printo expression dbx style command 319 printregs dbx style command 319 printx expression dbx style command 319 process group 136 Process menu description 215 Process Meter description 213 Charts menu 214 Scale menu 215 Process Meter selection in views menu 193 Product information selection in help menu 205 Program counter definition 59 program counter 91 201 Program data 93 program execution options for controlling 19 352 program execution control 87 Main View control panel 87 PC menu 91 program output tracking 110 pthreads and blocking anomalies 155 and scheduling anomalies 153 debugging a pthreaded program 152 debugging session 157 differences between 6 4 and 6 5 pthreads 156 how to continue a single pthread 155 pthread debugging hints 156 syscalls which block continued pthreads 326 user level continue of single 6 5 POSIX pthread 153 viewing pthreaded applications 138 putmsg syscall that blocks continued pthreads 326 putpmsg syscall that blocks continued pthreads 326 pwd dbx style command 319 pwrite syscall that blocks continued pthreads 327 Q quit dbx style command 319 R Raise selection in admin menu 191 Raise selection in structure browser node submenu 283 RCS 7 read syscall that blocks continued pthrea
164. ets a trap on entry to the specified system call This is slightly different from setting a trap on entry to the function by the same name A syscall entry trap sets a trap on entry to the actual system call A function entry trap sets a trap on entry to the stub function that calls the system call For a list of system calls or an alternative way to set traps involving system calls see Section 5 4 page 84 For example Trap stop syscall entry write 5 3 1 1 9 Setting a Trap on Exit from sys call name stop sample all pgrp syscall exit sys call name This command sets a trap on exit from the specified system call This is slightly different from setting a trap on exit from the function by the same name A syscall exit trap sets a trap on exit from the actual system call A function exit trap sets a trap on exit from the stub function that calls the system call For a 007 2579 005 81 Developer Magic Debugger User s Guide list of signals or an alternative way to set traps involving signals see Section 5 4 page 84 For example Trap stop syscall exit read 5 3 1 1 10 Setting a Trap at time Interval stop sample pollpoint interval time seconds This command sets a trap at regular intervals of seconds This is typically used only for sampling For example Trap stop pollpoint 3 5 3 1 1 11 Setting a Trap for C Exception stop sample exception all item itemname This command sets a trap on all
165. eveloper Magic Debugger User s Guide 52 1 Select the following from the Main View menu bar Source gt Search The Search dialog box appears 2 Type spin in the Search field in the dialog box as shown in Figure 13 Search type Literal Case Sensitive gt Literal Case Insensitive Regular Expression Search Apply Cancel Close Help Figure 13 The Search Dialog 3 Click the Apply button The search takes place on the displayed source files Each instance of spin is highlighted in the source code and flagged with target indicators in the scroll bar to the right of the display area See search target indicators in Figure 14 page 53 The Next and Prev buttons in the Search dialog box let you move from one occurrence to the next in the order indicated For more information on Search see Section A 1 4 page 194 4 Click the Close button and the dialog box disappears 007 2579 005 Tutorial The jello Program 4 5 Click the middle mouse button on the last search target indicator at the right side of the source code pane see the figure below This scrolls the source code down to the last occurrence of spin the location of the spin function Search target indicators Figure 14 Search Target Indicators 6 Proceed to Section 4 4 to edit your code 4 4 Edit Your Source Code To edit and recompile your source code follow these steps 1 Select the followin
166. ew Signal Panel Source View Structure Browser Syscall Panel Task View Trap Manager Variable Browser 007 2579 005 Debugger Reference A Displays a list of source files and library routines used by the current executable Double click a source file in the list to load it directly into the source display area in Main View or Source View windows The Search field allows you to find files in the list quickly Displays the value at a given memory address Monitors the resource usage of a running process without saving the data Used with the Performance Analyzer Displays the values stored in the hardware registers for the target process Displays the signals that can occur You can specify which signals trigger traps and which are to be ignored Displays source code Allows you to set traps perform searches and inspect source code without losing information in the Main View window Displays data structures in a graphical format You can de reference pointers by double clicking Allows you to set traps at the entry to or exit from system calls Brings up an Ada specific view that provides task and callstack information for processes Allows you to set edit and manage traps The Trap Manager is used by both the Debugger and the Performance Analyzer Displays values of local variables and parameters for the current context 193 Developer Magic Debugger User s Guide A 1 3 Query Menu
167. expression s in octal format You can use po as an alias printregs Prints the contents of the registers printx expression expression Prints the value of the specified expression s in hexadecimal format You can use px as an alias pwd Displays the current directory quit Exits the debugging session redefine func_spec edit read filename line_number line_number For C and C only Specifies a new body for a function The new definition is checked and errors if any are printed The new function body is redefined on the next function entry Breakpoints if set on the old definition are put on the new definition based on their relative line number position from the beginning of the function definition Note that some breakpoints may not make it to the new definition You can invoke this command when the process is stopped or on a running process when a function entry breakpoint is set There are three ways to provide a new definition e edit pops up an editor of your choice containing the current definition of the function The specification of the new definition is complete when you exit the editor You may not leave the editor open e read takes the contents of the file specified within the line numbers if given as the new function definition 319 Developer Magic Debugger User s Guide e No option allows you to type in replacement code from the next line A period in the first colum
168. following fields Default Structure Sets the number of fields to be displayed initially Field Count Default Structure The width in pixels of the object Width Default Iconic The width in pixels of the object when it is in Width iconic form Automatic Limits the number of structures that are Dereference Limit automatically dereferenced Dereference Ptrs Toggles automatic dereferencing on and off By Default To bring up the Structure Browser Type Formatting dialog box select the set of structures under consideration and select Node Formatting from the Node menu see Figure 106 page 286 007 2579 005 285 Developer Magic Debugger User s Guide Structure Browser Type Formatting L Type Name Default Field Count Default Structure Width Default Iconic Width Default State Type Color Field Type r float struct atom_struct tu struct atom_struct struct conec_struct 4 220 110 Normal Result Format Default Default Default struct conec_struct Default Selected Instances All Instances Future Instances OK Tear or iconic Normal Detail Visible Dereference Apply Close Help Figure 106 Structure Browser Type Formatting Dialog The dialog box has the following fields Type Name Default Field Count Default Structure Width Default Iconic Width Default State 286 Displays the current data type
169. g from the Main View menu bar Source gt Fork Editor A text editor will appear In this case if you are proceeding from Section 4 3 page 51 notice that the spin function is displayed 007 2579 005 53 Developer Magic Debugger User s Guide Note If you use source control you can check out the source code through the configuration management shell by selecting the following from the menu bar Source gt Versioning gt CheckOut 2 Edit the source code as follows Change all occurrences of 3600 to 3000 in the following code if at 1 gt 3600 a 3600 if b 3 gt 3600 b 3600 if c 7 gt 3600 c 3600 Save your changes 3 Select the following from the menu bar to recompile your code Source gt Recompile The Build View window displays and starts the compile Your makefile will determine which files need to be recompiled and linked to form a new executable Any compile errors are listed in the window and you can access the related source code by clicking the errors Note This does not apply to warnings generated by the compiler For more information on compiling see Using the Build Manager Appendix B page 329 When the code is successfully rebuilt the new executable file reattaches automatically to the Debugger and the Static Analyzer Previously set traps are intact unless you have traps triggered at line numbers and have changed the line count 4 5 Setting Traps Stop
170. g the Variable Browser To call up the Variable Browser window select the following from the Main View menu bar Views gt Variable Browser This window lists the names and values of variables associated with the current routine in which the process has stopped See Section 2 1 6 3 page 23 for a short description of the Variable Browser Also Section A 6 6 page 288 Variable Browser Window provides a more detailed description and graphic of the window and associated submenus 7 2 6 Using the Expression View 98 Select the following from the Main View menu bar to bring up the Expresssion View window Views gt Expression View Expressions may be entered into this window in the Expression column and the corresponding Results entry will display the value of the evaluated expression using values of variables associated with the current routine in which the process has stopped See Section 2 1 6 4 page 23 for a short description of the Expressions View window Also Section A 6 3 page 273 Expression View Window provides a more detailed description and graphic of the window and associated submenus The next section of this chapter Evaluating Expressions gives further details on how to create acceptable expressions for the Expression View 007 2579 005 Viewing Program Data 7 7 3 Evaluating Expressions You can evaluate any valid expression at a stopping point and trace it through the p
171. ge there may be errors check the Message Window 8 1 6 Change ID Build Path and Other Concepts The Fix Continue features finding files and accessing functions through ID numbers as follows e Each redefined function is numbered with a change ID Its status may be shown as redefined enabled disabled deleted or detached e Fix Continue needs to know the location of include files and other parameters specified by compiler build flags You can set the build environment for all files or for a specific file You can display the current build environment from the Fix Continue menu the command line or 007 2579 005 109 Developer Magic Debugger User s Guide the Fixt Continue Status Window When you finish a Fix Continue session you can unset the build environment Output from a successful run is displayed in the Execution View This functionality is the same as it is in the Debugger without Fix Continue 8 2 Restrictions on Fix Continue 110 Fix Continue has the following restrictions When you work with C code you must use the 032 compiler option Fix Continue does not support C templates You may not add delete or reorder local variables in a function You may not change the type of a local variable You may not change a local variable to be a register variable and vice versa You may not add any function calls that increase the size of the parameter area You may not add an alloca functio
172. ge 25 007 2579 005 21 Developer Magic Debugger User s Guide To view the components of the structure start in the prog c example enter cvd gt print start The current values of each component of start will be printed To view what the pointer list points to in the prog c example enter cvd gt print list Note This pointer must be initialized before you can perform this function A complete list of the instructions that can be entered at the cvd gt command line can be found in Section A 9 page 312 2 1 6 2 Viewing Variables Using Click To Evaluate 22 Perform the following to view variables with Click To Evaluate 1 Right click in the window that contains your source code to bring up the following pop up menu Expr Evaluation Evaluation Off Click To Evaluate gt Auto Evaluation Figure 2 Evaluation Pop Up Menu 2 Select Click To Evaluate from this menu You can now click on any variable and its value will appear For example e If you click on the x in x i the address of x will appear e If you click drag to highlight x i the current value of x i displays e If you highlight an expression the current value of the expression displays 007 2579 005 2 1 6 3 Viewing Variables Using Basic Debugger Usage 2 the Variable Browser Perform the following to view variables with the Variable Browser 1 2 1 6 4 Viewing Variables Using The Select the following from the M
173. gic Debugger User s Guide Admin Contig Process Continue All Stop All Step Into All Step Over All PPID Status Name Function PC Running fibo Running fibo Stopped fibo _nsproc x fab3b94 Figure 46 Examining Process State Using Multiprocess View 13 Click on Stop All in the Multiprocess View window 14 Repeat steps 7 through 11 to bring up a Main View window for the parent process 10 2 3 Using the Trap Manager to Control Trap Inheritance Note The instructions in this section assume that you have just run the tutorial in Section 10 2 2 page 142 This section shows you how to use the Trap Manager to set traps that affect one or all processes in the fibo process group For complete information on using the Trap Manager refer to Chapter 5 page 69 1 Select the following from the Main View window for the parent process Views gt Trap Manager Note Traps are specific to the processes in the Main View window in which they are set 2 Select the following from the same Main View window to turn on line numbering in the source pane if not already showing Display gt Show Line Numbers 144 007 2579 005 007 2579 005 Multiple Process Debugging 10 Click to the left of line 32 to set a breakpoint stop trap for the parent process Line 32 reads as follows o 32 Number to Compute NumberToCompute 1 10 Line 32 highlights in red to indicate that a breakpoint has been se
174. gling back and forth between active and inactive trap states This feature lets you accumulate traps and turn them on only as needed Thus when you do not need the trap it will not be in your way When you do need it you can easily activate it 5 3 7 Saving and Reusing Trap Sets The Load Traps selection in the Config menu lets you bring in previously saved trap sets This is useful for reestablishing a set of traps between debugging sessions The Save Traps selection of the Config menu lets you save the current traps to a file 5 4 Setting Traps by Using Signal Panel and System Call Panel You can trap signals by using the Signal Panel and set system calls by using System Call Panel see Figure 29 page 85 84 007 2579 005 Setting Traps 5 Signal Panel Getic e D Admin Trap Signal Entry Exit System Call SIGHUP syscall SIGINT exit SIGQUIT fork SIGILL read SIGTRAP write SIGABRT open SIGEMT close SIGFPE creat SIGKILL link SIGBUS unlink SIGSEGV execv SIGSYS chdir SIGPIPE time SIGALRM chmod SIGTERM chown SIGUSR1 brk SIGUSR2 stat SIGCLD Iseek SIGPWR getpid SIGSTOP mount SIGTSTP aaa a aaa a aaa a a aa a a a a a E O D D D E UL HH a a E Figure 29 Signal Panel and System Call Panel You can select either panel from the Views menu of the Main View window menu bar The Signal Panel sets a trap on receipt of the signal s selected The System Call Panel sets a trap at the selected entry to or
175. gt make jello 4 Invoke the Debugger with the jello program gt cvd jello amp The Main View window appears as shown in Figure 11 page 50 and scrolls automatically to the main function In addition to the Main View window the Execution View icon also appears When you run the jello program the command you used to invoke jello is displayed in this window The Execution View window is the interface between the program and the user for programs that use standard input output or generate stderr messages 007 2579 005 49 Developer Magic Debugger User s Guide 50 Target process command Execution control buttons Current process information Source code display area Source code annotation column Source code file Debugger command line Source code buffer status Command Status Filo usr demos WorkShop jello jello r demos WorkShop jello jello c dS Ol jj Admin Views Query Source Dispiay Perf fraps PC FhoContinue Help Debug Only Run ecutable usr demos WorkShop jello jello fprintf stderr s takes no arguments n argv 8 exit 1 Ph initialize argv ifdef EIGHTPLANE Read Only Figure 11 The Main View Window with jello Source Code Note The Main View window brings up the source file in read only mode You can change this to read write mode if you select the following from the Main View window menu bar provided you have the proper fi
176. gt initialize theApp ication gt handleEven Read Only r demos WorkShop bounc Figure 57 Major Areas of the Main View Window The Main View window contains a menu bar from which you can perform a number of actions and launch windows The menu bar contains the following menus which are discussed in detail in later pages e Admin Section A 1 1 page 190 e Views Section A 1 2 page 192 e Query Section A 1 3 page 194 e Source Section A 1 4 page 194 e Display Section A 1 5 page 197 e Perf Section A 1 6 page 197 e Traps Section A 1 7 page 199 e PC Section A 1 8 page 201 007 2579 005 007 2579 005 Debugger Reference A e Fix tContinue Section A 1 9 page 201 e Help Section A 1 10 page 205 The Main View window also contains several input fields a source code display area and buttons that trigger commonly used actions In the Main View window actions can be applied to a single process or to all processes To force an action to apply to all processes click the right mouse button over the Run Continue or Stop buttons to set the All Processes mode For more information about multiprocess and pthreaded programs refer to Chapter 10 page 135 The Main View window contains the following items Command text field Debug option menu Cont A11 Displays full pathname of the executable file that you are currently debugging including any run time arguments if any Allows you to toggle a
177. gt initialize theApp ication gt handleEven r demos WorkShop bounce Main C Read Only Figure 1 The WorkShop Debugger Main View Window 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 There are two categories of traps e A stop trap halts a process so that you can manually examine data e A sample trap collects specific performance data without stopping The Debugger lets you set traps at the following points e Ata line ina 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 e At an instruction address e On entry to or exit from a function Developer Magic Debugger User s Guide When a signal is received When a system call is made at either the entry or exit point When a given variable or address is written to read from or executed a watchpoint At set time intervals a pollpoint For more information on traps refer to Chapter 5 page 69 1 1 3 Viewing Program Data When you stop a process the Views menu at the Main View window menu bar provides several options for viewing your data These Views menu options allow you to inspect the following types of data Call Stack This option allows you to inspect the c
178. h each machine instruction Displays the function name and file position along with each machine instruction Displays the memory address of each machine instruction Displays the instruction word along with each machine instruction Controls whether the target address of a jal instruction is displayed as a hex address or symbolic label Register View window allows you to examine and modify register values You bring it up by selecting Register View from the Views menu in the Main View window Figure 114 page 297 shows a typical Register View window that has been resized to show all available registers The Register View window displays each register with its current value A question mark displayed immediately before a register value signifies that the value is suspect it may not be valid for the current frame This can occur if a register is not saved across a function call A colored marker indicates that a register value has changed since the last time the process stopped 007 2579 005 Current register field General register display area Special register display area Floating register display area Double register display area 007 2579 005 Admin Contig Register O e Value 4x80000088 6x86800882 6x86000088 4x 18803FcB x8f 1d11b4 Gx 18803Fc4 6x80000084 4x88000088 6x86800 188 6x86800488 4x88000853 4x008Gaded 6x88000089 Debugger Reference A Current register valu
179. he Task View and Exception View windows that are specific to Ada code Select the following from the Main View window menu bar to call up the Task View window Views gt Task View The Task View window is an Ada specific view that provides you with task and call stack information If you do not have Ada installed on your system the Task View menu option of the Views menu is grayed out 007 2579 005 Sort toggles Process display area Process display tabs Callstack display area Callstack display tabs A 3 1 1 Admin Menu 007 2579 005 Debugger Reference A Figure 64 Task View Window The Task View menu bar contains the Admin Config Layout Display and Help menus The Help menu is the same as that described in Section A 1 10 page 205 Other menus are described in the following sections The Admin menu contains the following options Active This toggle activates the current window in a set of cloned windows Clone Creates a clone of the current window This action is not supported in the current release and the option is grayed out 217 Developer Magic Debugger User s Guide A 3 1 2 Config Menu A 3 1 3 Layout Menu A 3 1 4 Display Menu 218 Save As Text Launches the Save Text dialog This dialog allows you to save your current session as text in a file you designate Close Closes the current window The Config menu contains the following item Preferences
180. he current value appears in the right column If this Result field is editable highlighted you can click it and enter a new value or legal expression Press Enter to assign the new value You can perform an assignment to any expression that evaluates to a legal lvalue in C The C operator is not valid in Expression View Valid expression operations are shown in the following paragraphs 102 007 2579 005 Viewing Program Data 7 7 3 3 Evaluating Expressions in C The valid C expressions are shown in Table 1 Table 1 Valid C Operations Operation Symbol Arithmetic Arithmetic bin rithmetic binary pa ee Logical 8 amp amp Relational lt gt lt gt l Bit amp lt lt gt gt Dereference 7 Address Array indexing Conditional Member extraction gt Assignment i J gt gt lt lt amp Sizeof Type cast Function call 1 Unary increment and decrement do not have side effects These operations are interchangeable A new assignment is made at each stepping point Use Assignments with caution to avoid inadvertently modifying N variables 007 2579 005 103 Developer Magic Debugger User s Guide 7 3 3 1 C Function Calls Function calls can be evaluated in expressions as long as enough actual parameters are supplied Arguments are passed by value Following the rules of C each actual parameter is converted to a value of the sa
181. he entire tree structure in another window along with an indication of which portion of the tree is currently being displayed in the full sized Tree Examiner window This button shows hides multiple connections between nodes on the graph For example if main calls foo several times you will se a line arc for all calls made This button resets the graph back to its original configuration before you began working with it Also hidden nodes will reappear Change the format of the window from up down to left right or vice versa Search for text in the tree using a Widget Hierarchy Search Text window Click on this indicator to change the kind of information being displayed in the nodes of the tree This will bring up a submenu which allows you to choose Name Class ID widget address or Window indicate lt gadget gt or address 245 Developer Magic Debugger User s Guide A 4 6 Callback Examiner 246 The Callback examiner see Figure 81 automatically appears when the process is stopped somewhere in a callback It first displays the callstack frame Then it displays information about the widget in the callback Finally it displays the proper callback structure contained in the call_data argument to the callback procedure based on the widget type and the callback name Callback Figure 81 Callback Examiner 007 2579 005 Debugger Reference A A 4 7 Window Examiner The Window examiner see Figure 8
182. hed from refined code 108 compiling introductory tips 12 with the malloc library heap corruption 126 compiling with the malloc library 126 Condition field in trap manager 82 Config menu in structure browser 278 Config menu in trap manager 76 cont in dbx style command 313 cont to dbx style command 313 continue of single 6 5 POSIX pthread 153 continue signal dbx style command 314 Continue button description 19 Continue button in the Main View window 56 88 007 2579 005 Continue Even If Line Has Changed toggle in Fix Continue Preferences dialog 204 Continue To selection in PC menu 91 Continue to selection in disassembly view pc menu 292 Continue to selection in pc menu 201 continue dbx style command 313 control flow constructs 160 controlling program execution options 19 Copy Traps Even on Changed Lines toggle in Fix Continue Preferences dialog 204 Copy Traps On Previous Definition toggle in Fix Continue Preferences dialog 203 Copy traps to forked processes Multiprocess View preferences option 209 Copy traps to sproc d processes in multiprocess tutorial 142 Copy traps to sproc d processes Multiprocess View preferences option 209 core file analysis for scientific programs 36 corefile dbx style command 314 corrupt program heap corruption tutorial program 129 creat syscall that blocks continued pthreads 326 customizing the debugger 177 changing X window system resources 180 startup file
183. hical display mode through the Render menu The Render menu has the following options Surface Exhibits the data as a solid using the data values as vertices in a polyhedron Bar Chart Presents the data values as 3 D bar charts Points Simply plots the data values in 3 D space Multi Line Plots and connects the data values in each row None Allows you to display with no graphical display in effect turning off graphical display mode Note The Color tear off menu is available only if you are have a Silicon Graphics workstation with Open Inventor installed on it If the Color menu is grayed out when the Array Browser window first opens select the Surface option of the Render menu The Color menu provides the following options Monotone Ramp Displays the data values in a single tone with lower numbers being darker and higher values lighter in tone Hue Ramp Displays the data values in a spectrum of colors ranging from blue lowest values through green yellow orange and red highest values 263 Developer Magic Debugger User s Guide Exception Allows you to flag certain conditions by color usually for the purpose of spotting bad data When you select Exception the controls shown in Figure 94 page 264 appear in the window Admin Bender Color Scale Format Spreadsheet Array e Monotone Ramp Indexing Expression O Hue Ramp a Infinity a NAN a Infinity WS Undertiow Underflow Subscript Co
184. hin WorkShop to make the desired change If you must modify resources the following X Window System resources for the Debugger and its views may be useful AllowPendingTraps If set to true enables support for pending traps The default value is false autoStringFormat If set to true sets default format for char results as strings in Expression View the Variable Browser and the Structure Browser The default format is the hexadecimal address cvmain sourceView nameText columns Sets the length of the File field in the Main View window The default value is 30 characters Cvmain disableLicenseWarnings and disableLicenseWarnings Disables the license warning message that displays when you start the Debugger and the other tools editorCommand If you prefer to view source code in a text editor rather than in Source View lets you specify a text editor The default value is the vi editor expressionView maxNumOfExpr Lets you set the maximum number of expressions that can be read from a file by Expression View The default value is 25 180 007 2579 005 007 2579 005 Customizing the Debugger 12 UseOldExprEval and useOldExprEval When set to true allows you to use the older dbx like expression evaluator rather than the default C expression evaluator introduced in WorkShop version 2 6 4 Using the older evaluator may result in faster evaluation of some expressions The
185. his button to display the pop up menu shown in Figure 32 page 90 You can select one of the fixed values or enter your own number of steps by selecting N If you select N the dialog box shown at the right in Figure 32 page 90 displays 007 2579 005 89 Developer Magic Debugger User s Guide 90 Figure 32 Pop up Menu and Step Over Dialog Return Executes the remaining instructions in the current function or subroutine and stops execution at the return from this subprogram Sample Collects performance data Before this button is operative a performance task must have been previously specified in the Performance Task window and data collection must have been enabled 007 2579 005 Controlling Program Execution 6 For further information about using the Performance Analyzer see Developer Magic Performance Analyzer User s Guide 6 2 Controlling Program Execution Using the Pc Menu The PC program counter menu in the Main View window includes two tools Continue To and Jump To which allow you to control program execution without setting breakpoints These tools are inoperative until a process has been executing and is stopped At that point you must place your cursor on a source line you wish to target then select from the PC menu depending on your requirements The program counter tools are described as follows Continue To Jump To 007 2579 005 This tool lets you select a target loca
186. i L i Min a Max 5 Step Row Col j e Min Max 3 Step Row Col k 5 E Min a Max 3 Step A Row column toggles Index identifiers Index values Index sliders Index minimums Index maximums Step indicators Figure 91 Subscript Controls Area in the Array Browser 007 2579 005 259 Developer Magic Debugger User s Guide 260 The Subscript Controls area provides the following features Row column toggles Index identifiers Index values Index sliders Index minimums Index maximums Step indicators Control area scroll bars Control whether an index variable represents rows or columns or neither in the spreadsheet area You are not limited by the number of dimensions of an array but you can only view a two dimensional orthogonal slice of the array at a time Indicate to which subscript the controls in the row refer Show the value of the subscript for the element currently in the focus cell You can enter a different value if you wish Let you move the focus cell along the particular dimension Identify the beginning visible element in that particular dimension Identify the last visible element in that particular dimension If you have an unspecified array you can use this field to specify the last element in the vector to be displayed in the spreadsheet Specifies the increment between adjacent elements in the dimension to be displayed A value
187. ider the following setbuildenv fermat c DnameB Ianotherdir See also unsetbuildenv sh shell_command Calls a shell if no arguments otherwise executes the specified shell command 007 2579 005 321 Developer Magic Debugger User s Guide showbuildenv filename show_changes For C and C only when compiled with 032 Lists all the build environment flags set showbuildenv with a filename lists any build environment specifications that have been set separately with setbuildenv filename file filename func_spec all For C and C only when compiled with 032 Prints the code of all enabled redefinitions of the specified function s The default is show_changes all See also enable_changes and disable_changes show_diff func_spec file filename showthread For C and C only when compiled with 032 Launches a xdiff comparing the compiled source and its latest redefinition for the specified function If file filename is specified xdiff shows the difference between the compiled file and the file with all redefinitions applied to the compiled source of the file with the condition that the file has had only its functions redefined and has not been edited since the last build full thread number all Shows brief status information about threads If full is specified prints full status information You can request status information for a specific thread by numb
188. iew If set to true all subsequent Source View trap requests will apply the Stop A11 command to the trap That is whenever this trap is encountered all other members of the process group also will be 007 2579 005 A 1 8 PC Menu Debugger Reference A stopped This option is the same as typing stop all in filename from the command line Default is false unless you are using IRIX 6 5 pthreads when the implied setting is always true If both of the default options are set to true it is the same as typing stop all pgrp in filename from the command line The PC program counter menu in the Main View window provides the following selections for controlling the execution of a process Continue To Jump To A 1 9 Fix Continue Menu 007 2579 005 Continues the process to the selected point in the program unless some other event interrupts Select a line by clicking on it Note The process must be stopped before you can use Continue To Goes directly to a selected point within the same function jumping over intervening code Then the Debugger waits for a command to resume execution Select a line by clicking on it The Fix Continue menu offers the following menu selections Edit External Edit Parse and Load Show Difference submenu Allows you to edit text using the Debugger editor Allows you to edit text by using an external editor The default editor is vi but can be changed by using the Set Edit T
189. iew just like other member functions To call a constructor you must pass in a first argument that points to the object to be created C function calls have the same possibility of side effects as C functions 007 2579 005 7 3 5 Evaluating Expressions in Fortran You can enter any Fortran expression under the 1 Viewing Program Data 7 Expression heading and its current value will appear in the same row under the Results column Fortran expressions may contain any of the arithmetic relational or logical operators Relational and logical operator keywords may be spelled in upper case lower case or mixed case The usual forms of Fortran constants including complex constants may be used in expressions String constants and string operations however are not supported The operators in Table 2 are supported on data of integer real and complex types Table 2 Valid Fortran Operations Operation Symbol Arithmetic unary Arithmetic binary EREE Logical NOT AND OR XOR EQV NEQV Relational SGT GE LT LB EQ NE Array indexing Intrinsic function calls except string intrinsics Function subroutine calls Assignment 4 variables 007 2579 005 A new assignment is made at each stepping point Use assignments with caution to avoid inadvertently modifying 105 Developer Magic Debugger User s Guide 7 3 5 1 Fortran Variables Names of Fortran va
190. iew window to close your session and end this tutorial Admin gt Exit 10 3 Debugging a Multiprocess Fortran Program The section of this chapter presents a few standard techniques to assist you in debugging a parallel program This section shows you how to debug the sample program See also Chapter 2 page 11 for important related information 10 3 1 General Fortran Debugging Hints Debugging a multiprocessed program is more involved than debugging a single processor program Therefore you should debug a single processor version of your program first and try to isolate the problem to a single parallel DO loop Once you have isolated the problem to a specific DO loop change the order of iterations in a single processor version If the loop can be multiprocessed then the iterations can execute in any order and produce the same answer If it cannot be multiprocessed you will see that changing the order in which the loops execute will cause the single processor version to produce wrong answers If wrong answers are produced you can use standard single process debugging techniques to find the problem See Chapter 2 page 11 for important related information If this technique fails you must debug the multiprocessed version To do this compile your code with the g and FLIST 0ON flags The FLIST ON flags save the file containing the multiprocessed DO loop Fortran code in a file called total w2f f and a file tital rii and an r
191. iewing position for subsequent use of the home button Repositions the display area so that the entire graph is visible Provides a special cursor that allows you to reposition the graph in the center of the display area or allows you to center the view on a point you select with the cursor See Seek to point lt or object gt in the Preferences dialog box The following controls let you move the graphic display x rotation thumbwheel y rotation thumbwheel dolly thumbwheel Examiner Viewer Menu 268 Rotates the graph around its x axis Rotates the graph around its y axis Changes the size of the graph and adjusts the angles to maintain perspective The dolly control simulates moving the viewing camera back and forth with respect to the graph You access the Examiner Viewer menu by holding down the right mouse button in the graphical display area The Examiner Viewer menu provides the following options see Figure 96 page 267 for illustration Functions Displays a submenu with the selections Help Home Set Home View All and Seek which are the same as the right mouse button controls described in the previous section and the Copy View and Paste View selections These operate like standard copy and paste editing commands enabling you to transfer graphs 007 2579 005 Debugger Reference A 007 2579 005 Draw Style Viewing Decoration Headlight Preferences Displays a submenu that
192. ii_files directory 10 3 2 Fortran Multiprocess Debugging Session This section shows you how to debug a small segment of multiprocessed code The source code for this tutorial total f can be found in the directory usr demos WorkShop mp 146 007 2579 005 Multiple Process Debugging 10 A listing of this code is as follows program driver implicit none integer iold 100 10 inew 100 10 i j double precision aggregate 100 10 result common work aggregate result 0 call total 100 10 iold inew do 20 4j 1 10 do 10 i 1 100 result result aggregate i j 10 continue 20 continue write 6 result result stop end subroutine total n m iold inew implicit none integer n m integer iold n m inew n m double precision aggregate 100 100 common work aggregate integer i j num ii jj double precision tmp CSDOACROSS LOCAL i ii j 3j3 num do j 2 m 1 do i 2 A num 1 if iold i j eq 0 then inew i j 1 else num iold i 1 j tiold i j 1 itold i 1 j 1 amp iold it l j iold i j 1 iold i 1 j 1 if num ge 2 then inew i j iold i j 1 else inew i j max iold i j 1 0 end if end if aS ALO aT 007 2579 005 147 Developer Magic Debugger User s Guide jj 9 10 1 aggregate ii jj aggregate ii jj inew i j end do end do end In the program the local variables are properly declared The inew always appears with j as its second index so i
193. ild process which in turn uses sproc to split off a grandchild process All three processes generate Fibonacci numbers until stopped You can find the source for fibo c in the usr demos WorkShop mp directory A listing of the fibo c source code follows include lt stdio h gt include lt sys types h gt include lt sys prcetl h gt int NumberToCompute 100 int fibonacci void run runl int fibonacci int n int f f_minus_1 f_plus_1l Erends f 1 f_minus_1 0 i 09 for if i n return f f_plus_l f f_minus_1 f_minus_1 f f f_plus_l void run int fibon for 7 7 NumberToCompute NumberToCompute 1 10 fibon fibonacci NumberToCompute printf Sd th fibonacci number is d n NumberToCompute fibon void runl 007 2579 005 Multiple Process Debugging 10 int grandChild errno 0 grandChild sproc run PR_SADDR if grandChild 1 perror SPROC GRANDCHILD else printf grandchild is d n grandChild run void main int second second sproc runl PR_SADDR if second 1 perror SPROC CHILD else printf child is d n second run exit 0 10 2 1 Launch the Debugger in Multiprocess View 007 2579 005 Perform the following to start compile the program and run the Debugger 1 Copy the program source from the demo directory as follows o cp usr demos WorkShop
194. ime cvd gt func Time printTime This command opens the time1 timel c file which contains the implementation of class Time The cursor is placed at the beginning of the printTime function See Figure 38 page 114 113 Developer Magic Debugger User s Guide Note The syntax of the func command is as follows e For C class member functions cvd gt func className classMemberFunction e For all other C C functions cvd gt func functionName void Time printT ime caut C LOLI lt Ae he ese oe Oe chia oo ee cc minute lt EET eee eee minute 44s lt lt second lt 16 7 B lt lt second Figure 38 Selecting a Function for Redefinition 6 Select the following option from the menu bar to highlight the function to be edited Fixt Continue gt Edit Note You can also use Alt Ctrl e to perform this task Note the results as shown in Figure 39 page 115 Line numbers changed to a decimal notation based on the first line number of the function body The function body highlights to show that it is being edited The line numbers of the rest of the file are not affected 114 007 2579 005 Line number notation Highlight 8 3 2 2 Changing Code 007 2579 005 22 al 22 a 4 Debugging with Fix Continue 8 void Time printTimet Figure 39 Redefined Function To change the time output as shown in Step 5 in Section 8 3 2 1 page 113 delete the 0 from 0 in line 23
195. in scientific programs 35 dmi syscall that blocks continued pthreads 326 double frees 125 down dbx style command 315 dump dbx style command 315 DUMPCORE environment variable 182 E edit source code as shown in jello tutorial 53 editors fork editor 6 how to access from the Main View window 6 editres requests and X Motif analyzer 161 enable all dbx style command 315 enable trap dbx style command 316 enable_changes dbx style command 316 Entry Function Traps menu option 254 environment variables CVDINIT 177 DUMPCORE 182 MALLOC_CLEAR_FREE 127 MALLOC_CLEAR_ FREE PATTERN 127 MALLOC_CLEAR_ MALLOC 127 MALLOC_CLEAR_MALLOC_PATTERN 127 MALLOC_FASTCHK 127 MALLOC_MAXMALLOC 128 MALLOC_NO_REUSE 128 MALLOC_TRACING 128 MALLOC_VERBOSE 128 _RLD_LIST 126 setting in Execution View 92 setting to detect heap corruption 127 environment variables for debugging 11 erroneous frees 125 Error messages window 307 evaluating expressions 99 evaluating expressions in C 104 evaluating expressions in Fortran 105 007 2579 005 event examiner 248 event handler breakpoints examiner 231 examine menu 224 examiner breakpoint 167 breakpoints 226 callback 170 246 callback breakpoints 229 event 248 event handler breakpoints 231 graphics context GC 248 input handler breakpoints 235 pixmap 249 resource change breakpoints 233 state change breakpoints 236 timeout procedure breakp
196. indow Viewport Clobber omponent o Figure 131 Build Analyzer Overview Window with Build Analyzer Graph 007 2579 005 339 Developer Magic Debugger User s Guide B 9 2 Build Analyzer Menus B 9 2 1 Admin Menu B 9 2 2 Build Menu B 9 2 3 Filter Menu 340 The Build Analyzer window contains the following menus e Admin e Build e Filter e Query The Admin menu provides one selection Refresh Graph Display in addition to the standard WorkShop selections Refresh Graph Refreshes the window Display Launch Tool Lets you execute the WorkShop tools For more information see the Section A 1 1 page 190 Project Lets you control the WorkShop tools operating on the same executable as a group For more information see Section A 1 1 page 190 The selections in the Build menu let you perform builds as follows Build Default Performs a make with no arguments Target Build Selected Performs the build s as entered in the Target s Target s field Show Build Rule Displays a dialog box showing the makefile line for the selected node The Filter menu has only one selection Select files to Opens the File Filter dialog box that lets you show in graph enter a regular expression to filter files displayed in the build graph 007 2579 005 B 9 2 4 Query Menu 007 2579 005 Using the Build Manager B The upper list area lets you specify files to be excluded from the build graph
197. ing Preferences 007 2579 005 Project Close Closes the Multiprocess View window only Exit Exits all views in the session and terminates the session The Preferences option in the Config menu brings up the Multiprocess View Preferences dialog that allows you to control when processes are added to the group and specifies their behavior This option also contains a Save option that allows you to save your preferences The Multiprocess View preference options are Stack Depth Allows you to set how many lines of the call stack should be displayed when opening the call stack Default is 10 Levels to open Allows you to specify the number of levels of hierarchy to be displayed For pthreaded programs you can display information by program threads and callstack For non pthreaded programs you can display information by process and callstack Default is one level Attach to forked Automatically attaches new processes spawned processes by the fork command to the group Note that processes spawned by sproc are always attached Default is off Copy traps to Copies traps you have set in the parent process to forked processes new forked processes automatically Alternatively if you create parent traps with Trap Manager and specify pgrp then the children inherit these traps automatically regardless of the state of this flag Default is off Copy traps to Copies traps you have set in the parent process to sproc d proces
198. ing a multiprocess session 137 X Motif analyzer 161 Type color field in structure browser type formatting box 287 Type Formatting Dialog 286 Type name field in structure browser type formatting box 286 357 Developer Magic Debugger User s Guide U unalias dbx style command 324 undisplay dbx style command 324 uninitialized variables 34 unsetbuildenv dbx style command 324 up dbx style command 325 Update selection in structure browser display menu 281 use dbx style command 325 using the X Motif analyzer 159 V Variable Browser in jello tutorial 60 View menu option 4 viewing variables with 23 98 Variable browser general description 288 Variable Browser selection in Views menu 60 Variable Browser selection in views menu 193 variables assigning values to 102 compiled with n32 g 288 options for viewing 20 96 unused 288 viewing at the cvd gt command line 97 viewing with Array Browser 25 viewing with Click To Evaluate 22 viewing with Click to Evaluate 97 viewing with cvd gt command line 21 viewing with Expression View 23 viewing with Structure Browser C code only 27 viewing with the Array Browser 97 viewing with the Expressions View window 98 viewing with the Structure Browser C code only 97 viewing with the Variable Browser 98 viewing with Variable Browser 23 358 versioning and accessing configuration management tools 7 Versioning selection in Source m
199. ing the Multiprocess View Window 136 The Multiprocess View window is brought up by selecting the following from the menu bar of the Main View window Admin gt Multiprocess View This window can display individual processes or operate on a process group By default a process group includes the parent process and all descendants spawned by sproc Processes spawned with fork during the session can be added to the process group automatically when they are created For a program compiled with the MIPSpro Automatic Parallelization Option a process group includes all threads generated by the option Any process to which you have read write access can also be added to the process group All sproc d processes must be in the same process group since they share information Note Any child process that performs an exec with setuid set user ID enabled will not become part of the process group Each process in the session can have a standard main view window session associated with it However all processes in a process group appear on a single Multiprocess View window When debugging multiprocess applications you should disable the SIGTERM signal by selecting the following from the Main View window menu bar Views gt Signal Panel Note Although multiprocessing debugging is possible with SIGTERM enabled the multiprocess application may not terminate gracefully after execution is complete 007 2579 005 Multiple Process Deb
200. ion 2 311 Figure 122 Call Stack View fon oes ae ae Bh BP oh oe Ry Oe Ta ga oe e Oe 311 Figure 123 Trap Manager Window with Redefined Function 2 1 312 Figure 124 Build Process Control Area in Build View Window i eG E Ve koe 330 Figure 125 Build View Window with Typical Data 2 2 a we ee 331 Figure 126 Build View Preferences Dialog fa wit 8 832 ee Het 8 Ge Bo ad the 333 Figure 127 Build Options Dialog ok wy By ee wye a a eR koe 2 ee os ter Y 334 Figure 128 Build Analyzer Window 2 we ee 336 Figure 129 Build Graph Icons 2 2 we ee 338 Figure 130 Build Graph Control Area Pde fs ua fercae ge oe fea Ay Ake ee ye Bae 338 Figure 131 Build Analyzer Overview Window with Build Analyzer Graph Kote ke 339 Tables Table 1 Valid C Operations 2 2 we 103 Table 2 Valid Fortran Operations 2 2 1 1 ee 105 Table 3 Fix Continue Keyboard Accelerators te he at AS ts ae oe gs OE ae Sie ol 205 007 2579 005 xix About This Guide 007 2579 005 This publication documents the Developer Magic Debugger released with the 2 8 version of MIPSpro WorkShop tools running on IRIX systems The Debugger is a source level debugging tool that allows you to see program data monitor program execution and fix code for Ada C C Fortran 77 and Fortran 90 This manual contains the following chapters Chapter 1 page 1 gives you an introductory functional overview of the Developer Magic Debugger
201. iption 223 X Motif analyzer additional features 172 debugging with 8 default view 165 inspecting data with 160 inspecting the control flow with 160 launching 163 navigating widget structure 163 overview 159 restrictions and limitations 161 starting 8 tracing execution with 161 X Motif Analyzer admin menu 224 close 224 save as text 224 X Motif Analyzer breakpoint type option button 228 007 2579 005 Index X Motif Analyzer breakpoints examiner 226 callback 229 event handler 231 input handler 235 resource change 233 state change 236 timeout procedure 234 X event 237 X Request Breakpoints Examiner 239 X Motif Analyzer callback examiner 246 X Motif Analyzer event examiner 248 X Motif Analyzer examine menu selection 224 widget 224 widget class 225 widget tree 224 X event 225 X graphics context 225 X pixmap 225 X Motif Analyzer examiner tabs 225 X Motif Analyzer graphics context GC examiner 248 X Motif Analyzer pixmap examiner 249 X Motif Analyzer trace examiner 240 X Motif Analyzer tree examiner 243 graphical buttons 245 X Motif Analyzer widget class examiner 250 X Motif Analyzer widget examiner 242 X Motif Analyzer window examiner 247 X Motif Analyzer window menu item examine menu window 225 X Motif Analyzer windows description 222 X Motif Analyzer selection in views menu 194 xdiff 123 xhost setting for debugger 11 359
202. ision of the Developer Magic Debugger User s Guide supports the 2 8 release of MIPSpro WorkShop tools New features include the following e Improved pthread support stability ability for user to continue a single POSIX 6 5 pthread e Fix and continue for n32 abi e Trap manager improvements ability to save breakpoints across debugging sessions ability to set a breakpoint at a line number in a non loaded DSO an enhancement to pending traps introduces in WorkShop 2 7 e Modules based installation Record of Revision Version Description 257 June 1998 Revised to reflect changes for the ProDev WorkShop 2 7 release 2 8 April 1999 Revised to reflect changes for the MIPSpro WorkShop 2 8 release 007 2579 005 Contents Page About This Guide xxi Related Publications Bm oe reeds oh My RNR ee eh a ee ree xxii Obtaining Publications 2 2 1 6 ee xxii Gonventions e 4 3 a aa deoa a a m Bak ae eo a ow Ge AP A a e oe S xxii Reader Comments boot Ga oe Te a we ok Om 2 pace a Shon Boe G a BGP eG xxiv WorkShop Debugger Overview 1 1 Main Debugger Features 1 The Debugger Main View Window 2 About Traps 3 Viewing Program Data 4 Integrating the Debugger with Other WorkShop Tools 5 Accessing the Performance Analyzer from the Main View Window 5 Accessing the Static Analyzer from the Main View Window 6 Accessing Editors from the Main View Window 6 Accessing Configuration Management Tools 7 Recompiling from the Main
203. k frame This shifts the stack frame to the main function scrolls the source code in the Main View window or Source View to the place in main where spin was called and highlights the call Any active views are updated according to the new stack frame Double click the spin stack frame This returns the stack frame to the spin function 59 Developer Magic Debugger User s Guide 60 Select Variable Browser from the Views menu in the Main View window The Variable Browser window appears This window shows you the value of local variables at the breakpoint The variables appear in the left column read only and the corresponding values appear in the right column editable Your Variable Browser window should resemble the one in Figure 18 although you may need to enlarge the window to see all the variables the values will be different The jello program uses variables a b and c as angles in tenths ca cb cc as their corresponding cosines and sa sb sc as their sines Whenever you stop at spin these values change p 4829338e 43 Figure 18 Variable Browser at spin 5 Double click some different frames in Call Stack View and observe the changes to Variable Browser and the Main View window These views update appropriately whenever you change frames in Call Stack View Notice also the change indicators in the upper right corners of the Result fields in Figure 19 page 61 The
204. kShop Debugger The WorkShop 2 8 Release Notes are installed on any system running WorkShop 2 8 These notes provide the following information Installation instructions Changes and additions since the last release Bugfixes Known problems and their workarounds There are two ways to view the release notes Enter the following command to view the relnotes as simple text relnotes WorkShop See the relnotes 1 man page for additional information Enter the following command to view the relnotes through the graphical release notes viewer grelnotes WorkShop See the grelnotes 1 man page for additional information The online Help menu includes a FAQ option Consult this for a list of frequently asked questions and operating tips Basic Debugger Usage 2 The WorkShop Debugger can be used with the following compilers C C Ada FORTRAN 77 and Fortran 90 Currently the Debugger does not handle all Fortran 90 syntax that is derived types but it does handle Fortran 90 array syntax This chapter includes information regarding principles and procedures of the debugging process and how these are to be approached with the WorkShop Debugger 2 1 Getting Started with the Debugger Before starting a Debugger session from a remote workstation you must first enter the following from a window xhost machine_name Where machine_name is the name or IP address of the machine where the program that you would like to de
205. ke clobber make Create another new directory in your jellodemos directory mkdir newdir Move the Jello source files to a new location mv c newdir Start the WorkShop Debugger evd jello amp 45 Developer Magic Debugger User s Guide 10 11 The Main View window will display with no source in the source pane The following message appears Unable to find file lt your_home_directory newdir jello c Choose the following from the menu bar in the Main View window Admin gt Remap Paths The Path Remapping window displays In the Substitution Set for dialog box a Select your_home_directory jellodemos newdir jello c The path filename will appear in the Value field b Enter the following Enter the following in the Value field below the Substitution Set for dialog box newdir Click on the Insert Before button The directory is inserted before the highlighted empty line in the Substitution Set for dialog box and after the first element which was not highlighted Now the source appears in the Main View source pane as your_home_directory newdir jello c 46 007 2579 005 Tutorial The jello Program 4 This chapter presents a short tutorial with the demonstration program jello provided with your MIPSpro WorkShop software package This tutorial walks you through commonly encountered debugging situations The tutorial is divided into four par
206. ked ON the pgrp option is added into the resulting trap when a trap is set This option causes the trap to apply to all processes pthreads in the group of which the current process is a member When the Stop All Defaults toggle is checked ON the all option is added into the resulting trap when a trap is set This option causes the trap to apply to all processes pthreads in the current debugging session WorkShop Debugger Getto Admin Views Query Source Display Perf Traps PC Fix Continue Command usr demos WorkShop jello jello Debug Only static int a b c fiost soe She Soca ED CES l_sincos a amp sa amp ca REET amp sc TOE if a 1 gt 3608 a 3608 if b 3 gt 3600 b 3608 if c 7 gt 3600 c 3600 loadmatrix view rot sa y FotCShy ORC ss File r demos WorkShop jello jello c Read Only Stop at file usr demos WorkShop jello jello c line 779 1 Stop at file usr demos WorkShop jello jello c line 782 Disabled 1 Stop at file usr demos WorkShop jello jello c line 782 2 Sample all at file usr demos WorkShop jello jello c line 786 3 Sample all at file usr demos WorkShop jello jello c line 798 Disabled 3 Sample all at file usr demos WorkShop jello jello c line 798 cvd gt Figure 26 Typical Trap Icons 75 Developer Magic Debugger User s Guide 5 3 Setting Traps in the Trap Manager Window The Trap Manager window is bro
207. lback then click on the Add button to add a breakpoint for the activateCallback object of the RUN button widget The result is displayed in Figure 50 page 167 Return button Widget specification Parameter specification Active Breakpoints a ari Breakpoints E a JS A Breakpoints Figure 50 Adding a Breakpoint for a Widget 7 Click on the red breakpoint down arrow in the Annotation Column of the Main View window to remove the Clock timeout breakpoint Note If you click on the line but not the down arrow the breakpoint will be deleted but the source pane will still display the arrow 8 Click on the Continue button in the Main View window 9 Click on the Stop button in the Bounce window 007 2579 005 167 Developer Magic Debugger User s Guide 10 Click on the Run button in the Bounce window The process stops in the Run button s registered act ivateCallback This is the routine that was passed to XtAddCallback routine Notice that the Callback tab for the Callback Examiner is added to the tab list 11 3 5 Setting Callback Breakpoints 1 Click on the Breakpoints list item the Active box will be checked to highlight the breakpoint in the X Motif Analyzer Breakpoint Examiner window 2 Delete the widget address in the Widget text field by backspacing over the text 3 Click on the Modify button to change the act ivateCallback breakpoint to apply to all push button gadgets XmP
208. le 1 Click the Run button to view your redefined code If you are following procedures in order in this section you should see the following display 8 20 50 AM 2 Enter the following at the cvd gt prompt cvd gt func Time printTime 3 Select the following from the menu bar Fixt Continue gt Parse and Load 007 2579 005 121 Developer Magic Debugger User s Guide Select the following from the menu bar to disable your changes Fix Continue gt Edit lt gt Compiled Click the Continue button to see the printing of Time as in the original executable The following displays 08 20 50 Re enter the following at the cvd gt prompt cvd gt func Time printTime Select the following from the menu bar to re enable your changes Fix Continue gt Edit lt gt Compiled Click on the RUN button to see the changed printout of Time The following displays 08 20 50 AM 8 3 5 2 Comparing Function Definitions 122 1 Place the cursor in the time1 c function 2 Select the following from the menu bar Fixt Continue gt Show Difference gt For Function 007 2579 005 Debugging with Fix Continue 8 A window opens to display an xdiff comparison of the files as follows H File Edit Global Region Line EE a sr Figure 41 Comparing Compiled and Redefined Function Code You can get the same result by entering the show_diff command from the Debugger com
209. le access permissions Source gt Make Editable 5 Click the Run button in the upper right corner of the Main View window to run the jello program The jello window opens on your display see Figure 12 page 51 Enlarge this window to watch the program execute The polyhedron is initially suspended in the center of the cube If you wish you can perform the following with the jello program a Click the left mouse button anywhere inside the jello window The polyhedron drops to the floor of the cube 007 2579 005 Tutorial The jello Program 4 b Hold down the right mouse button to display the pop up menu and select spin The cube rotates and the polyhedron bounces inside the cube c Hold down the right mouse button to display the pop up menu and select the Display option This opens a submenu that allows you to change the appearance of the jello polyhedron d Feel free to select right click from this menu to see how the jello display changes Note You may encounter flashing colors inside windows while running jello This is normal Figure 12 The jello Window 6 Right click and select Exit from the pop up menu to exit this demonstration executable 4 3 Perform a Search This part of the tutorial covers the search facility in the Debugger You will search through the jello source file for a function called spin The spin function recalculates the position of the cube 007 2579 005 51 D
210. lete button 2 2 Suggestions for Debugging for Serial Execution of Scientific Programs This section offers tips and suggestions for debugging programs written for scientific applications but many of the suggestions will apply to debugging other types of applications as well Note This section deals only with debugging programs that are running serially and not in parallel 007 2579 005 31 Developer Magic Debugger User s Guide 2 2 1 Step 1 Use lint Programs can sometimes appear to have no bugs with some sets of data because all paths through the program may not be executed To debug your program therefore it is important to test it with a variety of different data sets so that one would hope all paths in your program can be tested for errors Now assume that your program compiles and produces an executable but the program execution either does not complete or it completes but produces wrong answers In this case go through the following steps to find many of the commonly occurring bugs Note All compiler options mentioned in the following sections are valid for FORTRAN 77 Fortran 90 C and C compilers unless indicated otherwise If your program is written in C you should use the lint utility This will help you identify problems with your code at the compile step For example if your C program is in a file named prog c invoke lint with gt lint prog c The output from this command is directed to your scre
211. lick on a subscript variable its address will appear If you hold down the left mouse button and wipe across a variable and its subscripts to highlight them the current value will be displayed The same is true if an expression in the source is highlighted 7 2 3 Using the Array Browser To view values of arrays select the following from the Main View menu bar Views gt Array Browser This calls up the Array Browser window When the name of an array is entered into the Array field the values of 1 dimensional arrays or the values in a selected plane of a multi dimensional array are displayed See Section 2 1 6 5 page 25 for short description of the Array Browser Also Section A 6 1 page 257 Array Browser Window provides a more detailed description and graphic of the window and associated submenus 7 2 4 Using the Structure Browser To view C structures select the following from the Main View menu bar Views gt Structure Browser 007 2579 005 97 Developer Magic Debugger User s Guide This calls up the Structure Browser window When the name of a structure is entered into the Expression field the objects in the structure display in the lower portion of the window See Section 2 1 6 6 page 27 for a short description of the Structure Browser Also Section A 6 5 page 277 Structure Browser Window provides a more detailed description and graphic of the window and associated submenus 7 2 5 Usin
212. ll that blocks continued pthreads 327 sh dbx style command 321 Show Difference submenu 202 Show embedded source annotation field in disassembly view preferences box 295 Show Icons selection in Display menu 197 Show instruction value field in disassembly view preferences box 296 Show jal target numerically field in disassembly view preferences box 296 Show Line Numbers selection in display menu 197 Show machine address field in disassembly view preferences box 296 Show overview selection in structure browser display menu 282 Show source file and line number field in disassembly view preferences box 296 Show Thread Status vs Thread State Multiprocess View preferences option 210 Show Hide buttons Multiprocess View preferences option 210 Show Hide Header Information Multiprocess View preferences option 210 show_changes dbx style command 322 show_diff dbx style command 322 showbuildenv dbx style command 322 showthread dbx style command 322 Signal panel 84 Signal Panel selection in views menu 193 signal trap debugger command option 81 signal traps 4 SIGTERM signal 136 source annotation column traps 74 007 2579 005 source code status indicator 109 source control using configuration management tools for 7 source dbx style command 322 source file saving changes to Fix Continue tutorial 118 source files comparing code files with xdiff 124 loading 39 managing 39 Source view File menu 211 Sourc
213. llows you to change the size of the object You will see a small square handle at the upper right and lower left corners Left click drag the handle to resize the object Middle click drag the handle to move the object Arrows show relationships among the displayed structures If a member field is not visible in a structure its arrow tail is displayed at the top or bottom of the scrolling area for fields Otherwise its tail is adjacent to its field Double clicking a value field right column for a pointer changes the display so that the data structure it points to is displayed Double clicking a member field left column puts the full expression for that member in the Expression field A 6 5 4 Structure Browser Display Menu 280 The Display menu controls the way structures appear in the display area The Display menu provides the following options Display Determines contents of the display The Display option has the following two options e Expression Displays the structure of the expression entered in the Expression field e Selection Displays the structure based on the text you have selected in the source code pane in the Main View window Arrange Rearranges the currently selected nodes Arrange has the following two options See Figure 103 page 281 e Tree Arranges nodes into a tree type formation that is the hierarchy descends from left to right and child structures are shown as branche
214. locked by another thread s usage the OS kernel decides what the next move is regarding the OS kernel thread attached to the user pthread making the call Control could just transfer to another application to disk I O or whatever These syscalls are all I O related The OS kernel thread says in effect I m waiting for something to do gt I m blocked and it is immediately available for reassignment The best example of a blocking kernel syscall is writev which is used by the common library routine printf Thus if a single 6 5 POSIX thread is continued or free run and it eventually calls printf the debugging user may see the anomalous behavior of another pthread started running because the continued or free run 6 5 pthread was blocked in writev The printf pthread s OS kernel thread is reassigned and another pthread suddenly takes off Various lock blocking in the pthread library such as Mutex mutual exchange lock This occurs in user space libc user code and so on The pthread library sense that a pthread is going to block due to another pthread s usage Control transfers to the routine usync_control which eventually calls a blocking kernel syscall see preceding item Again the OS kernel decides the fate of the associated OS kernel thread Unexpected things could start running Other lock blocking in the pthread library whereby the pthread library senses that a user pthread is going to block but does not go off to usync
215. lows you to perform a text search through your breakpoints Allows you to add a new breakpoint Allows you to change the selected breakpoint s settings Deletes the selected breakpoint Allows you to step to the next condition Step To creates a temporary breakpoint resumes the process and waits until the process stops This temporary breakpoint acts exactly like an ordinary breakpoint save that the Step To button automatically resumes the process and puts up a busy cursor until the condition becomes true 227 Developer Magic Debugger User s Guide Return button Widget specification Parameter specification Active Breakpoints m Ci Breakpoints a sarl Breakpoints Figure 68 Breakpoints Examiner Display in the X Motif Analyzer Window The control area has eight different breakpoint types that it can examine These types are set through the Breakpoint Type options The following Breakpoint Type options are available Callback Widget callback installed by XtAddCallback Parameters include callback name and client_data XtPointer value See Section A 4 2 1 page 229 for more information Event Handler Widget event handler installed by XtAddEventHandler Parameters include X event type and client_data XtPointer value See Section A 4 2 2 page 231 for more information 228 007 2579 005 Resource Chang Timeout Procedur Input Handler State Change X Event X
216. lue appear in the two fields below the Subscript Controls panel in the center of the Array Browser window For example if you click on the value for array element A 2 3 then A 2 3 appears in the box above the display of the array values and its value appears in the box to the right of A 2 3 Simply click in this box and enter a new value for A 2 3 Press A 2 3 to the new value ENT ER to change the value of 2 Enter your change into the Value field described in the note above 3 If you would like to view a second array at the same time select the following in the Array Browser window that you have already opened Admin gt Clone This will bring up a second Array Browser window 007 2579 005 Basic Debugger Usage 2 4 Select the following from this new window Admin gt Active You can now enter the name of the second array you would like to view 2 1 6 6 Viewing Variables Using the Structure Browser Window Perform the following to view values of a C structure 1 Select the following from the Main View window menu bar to call up the Structure Browser window Views gt Structure Browser 2 Enter the name of the structure in the Expression pane This will bring up a window listing the name of the structure the names of its components in the left column and their values in the right column 3 If one of these components is a pointer you can see what is being pointed to by do
217. lyzer Tutorial 007 2579 005 This section illustrates several features of the X Motif Analyzer The demo files in the usr demos WorkShop bounce directory are used to demonstrate the debugging of a running X application These files contain the complete C source code for the bounce program This section includes the following subsections e Setting up a Sample Session Section 11 3 1 page 162 e Launching the X Motif Analyzer Section 11 3 2 page 163 e Navigating the Widget Structure Section 11 3 3 page 163 e Examining Widgets Section 11 3 4 page 166 161 Developer Magic Debugger User s Guide Setting Callback Breakpoints Section 11 3 5 page 168 Using Additional Features of the Analyzer Section 11 3 6 page 172 Ending the Session Section 11 3 7 page 175 11 3 1 Setting up the Sample Session 162 Perform the following to prepare for this session 1 Enter the following commands oe mkdir demos bounce cd demos bounce cp usr demos WorkShop bounce make clean make bounce JP X X cvd bounce amp The Debugger is launched from which you can use the X Motif Analyzer Upon invocation you see the Execution View icon and the Main View window Double click the Execution View icon to open the window Then tile your windows so you can clearly see all windows Click on the Run button in the Main View window to run the bounce program The Execution View window will update wi
218. mand line where is the redefined function ID If you do not like xdiff you can change the comparison tool by selecting the following from the menu bar Fix Continue gt Show Difference gt Set Diff Tool 007 2579 005 123 Developer Magic Debugger User s Guide 8 3 5 3 Comparing Source Code Files If you have made several redefinitions to a file you may need a side by side comparison of the entire file To see how changes to the entire file look select the following from the menu bar Fix Continue gt Show Difference gt For File This opens an xdiff window that displays the entire file rather than just the function You can get the same comparison results from the Debugger command line if you enter the following command show_diff file timel C 8 3 6 Ending the Session Exit the Debugger by selecting the following from the menu bar Admin gt Exit 124 007 2579 005 Detecting Heap Corruption 9 The heap is a portion of memory used to support dynamic memory allocation deallocation via the malloc and free function This chapter describes heap corruption detection and covers the following topics e Typical Heap Corruption Problems Section 9 1 page 125 e Finding Heap Corruption Problems Section 9 2 page 126 e Heap Corruption Detection Tutorial Section 9 3 page 129 9 1 Typical Heap Corruption Problems Due to the dynamic nature of allocating and deallocating memory the heap is vuln
219. matically until actual values are encountered You can then perform any further de referencing by double clicking pointer addresses in the right column of the data structure objects A window similar to the one shown in Figure 21 now appears Structure Browser pid 2404 a j Admin Config Display Node jello_conec jello_conec Figure 21 Structure Browser Window with jello_conec Structure 13 Click once to focus then double click the address of the next field in the right column of the jello_conec structure Double clicking the address corresponding to a pointer field de references it Double clicking the field name displays the complete name of the field in the Expression field at the top of the Structure Browser window See Figure 22 page 64 007 2579 005 63 Developer Magic Debugger User s Guide Expression jello_conec jello_conec struct conec_struct J Figure 22 Structure Browser Window with Next Pointer De referenced 14 15 16 64 Select Close from the Admin menu of Structure Browser window to close it Select the following from the Main View window menu bar Views gt Array Browser The Array Browser lets you see or change values in an array variable It is particularly valuable for finding bad data in an array or for testing the effects of values you enter Type shadow in the Array field and press Enter You can now see the values of the shadow matrix which displays the
220. mation on the Performance Analyzer see the Developer Magic Performance Analyzer User s Guide Developer Magic Debugger User s Guide 1 1 4 2 Accessing the Static Analyzer from the Main View Window 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 the following from the menu bar Admin gt Launch Tool gt Static Analyzer For more information on the Static Analyzer see the Developer Magic Static Analyzer User s Guide 1 1 4 3 Accessing Editors from the Main View Window Once 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 1 You can select the following from the Source Menu to make code changes in the source pane of the Main View window a Select Source gt Make Editable Make your changes accordingly Make Editable toggles with Make Read Only b Select Source gt Save to save your changes c Select Source gt Recompile to recompile your changed code 2 You can invoke an editor from the Views menu that is a separate window in which to edit your code Views gt Source View Note You must select Make Editable from the File menu at this point to proceed 3 You can call up a fork editor window to launch your own editor as follows first path Source gt Fork Editor 6 007 2579 0
221. me type as the formal parameter before the call If the types of the formal parameters are unknown integral arguments are widened to full words and floating point arguments are converted to doubles Functions may return pointers scalar values unions or structs Note that if the function returns a pointer into its stack frame rarely a good programming practice the value pointed to will be meaningless since the temporary stack frame is destroyed immediately after the call is completed Function calls may be nested For example if your program contains a successor function succ the Debugger will evaluate the expression succ succ succ 3 to 6 7 3 4 Evaluating Expressions in C 7 3 4 1 Limitations 104 C expressions may contain any of the C operations You can use the word this to explicitly reference data members of an object in a member function When stopped in a member function the scope for this is searched automatically for data members Names may be used in either mangled or de mangled form Names qualified by class name are supported for example Symbol a If you wish to look at a static member variable for a C class you need not specify the variable with the class qualifier if you are within the context of the class For example you would specify myclass myvariable for the static variable myvariable outside of class myclass and myvariable inside myclass Constructors may be called from Expression V
222. mong various modes The following mode choices are available Debug Only runs the Debugger in Debug mode with no performance tools enabled Performance mode causes performance data to be gathered and instrumented code to be generated for performance analysis while using the Debugger Purify mode activates the Purify memory corruption analysis tool The code displayed in the Main View window Source View window and so forth will be code generated by Purify This option appears only if Purify is installed on your system Purify is not a Silicon Graphics product nor is it part of the WorkShop package It is a product of Rational Software and is neither available from nor supported by SGI Continues execution of the current process or all processes in the program When you click on the Continue button the program runs either to a breakpoint exception or to termination This button is active only after the running process es 185 Developer Magic Debugger User s Guide 186 Stop A11 Step Into button Step Over has stopped If the program has not been run or has been killed the Continue button is grayed out If the target program has not yet started executing use the Run button to start execution Stops execution of the current running process es This button is valid only when a process es is running otherwise the button is grayed out Traps can also be set to stop the program at a specific location or on
223. mporarily disabled If you click again in this box the trap will be re enabled 7 Click the Clear button move the cursor to the Trap field then type watch display mode Click the Add button This sets a watchpoint for the display_mode variable A watchpoint is a trap that causes an interrupt when a specified variable or address is read written or executed 8 Click the Continue button in the Main View window to restart the process 57 Developer Magic Debugger User s Guide The process now runs somewhat slower but still at a reasonable speed for debugging 9 Hold down the right mouse button in the jello window to display the pop up menu From this menu select display and then select the conecs option with the right mouse button This triggers the watchpoint and stops the process 10 Go to the Trap Manager window and click the button next to the display_mode watchpoint to deactivate it Then click the button next to the spin stop trap to reactivate it 11 Enter 100 in the Cycle Count field and click the Modify button Notice how the trap description changes in the Trap Manager window 12 Click the Continue button in the Main View window This takes the process through the stop trap for the specified number of times 100 provided no other interruptions occur The Current Count field keeps track of the actual number of iterations since the last stop which is useful if an interrupt occurs Note that it upda
224. n which identifier Displays the qualification of the specified variable where thread thread id Performs a stack trace showing the activation levels of a program or optionally of the specified thread You can obtain thread ids from the first column of output of the showthread command 325 Developer Magic Debugger User s Guide A 10 Blocking Kernel System Calls 326 The following are the kernel system calls syscalls that actually block continued pthreads There are numerous library routines such as printf that can use one of these blocking system calls It would be impractical here to list all library routines which utilize a blocking syscall Nevertheless as a user you should know for example that if you call the printf library routine it eventually calls writev a blocking system call and thus may block continued pthreads accept close creat dmi fentl fsync getmsg getpmsg ioctl lockf mq_open msgsnd msgrcv msync nanosleep open pause poll putmsg putpmsg read readv pread accept a connection on a socket close a file descriptor create a new file or rewrite an existing one SGI specific Used to implement the interface defined in X Open document Systems Management Data Storage Managment XDSM API file and descriptor control Provides for control over open descriptors synchronize a file s in memory state with that on the physical medium get next mes
225. n hexadecimal X Prints a long word in hexadecimal b Prints a byte in octal Prints a byte as a character s Prints a string of characters that ends in a null byte f Prints a single precision real number g Prints a double precision real number 007 2579 005 007 2579 005 Debugger Reference A file filename Displays the name of the current or specified file filename If a file is specified it becomes the current file func func_name Moves to the source code corresponding to the specified frame in the call stack or to the function in the executable if not on the stack givenfile filename With no arguments displays name of current object file With filename specifies object file to be debugged goto linenumber Skips over lines going directly to the specified line number in the current routine Unlike dbx 1 cvd 1 does not begin execution at the specified line ignore signal_name all With no arguments lists those signals not to be trapped If a signal is specified this command removes it from the list of signals to be trapped If all is specified ignores all signals kill pid all Kills the specified process currently controlled by the Debugger or kills all processes to line function_name list from line line_count Lists source lines beginning at from line If no additional argument is specified the default for line_count is 10 If line_count i
226. n A 8 4 page 309 Special line numbers in decimal notation applied to redefined functions appear in several views 301 Developer Magic Debugger User s Guide Note Fix Continue functionality within the debugger is limited to C C programs compiled with the 032 compiler option The following windows devoted entirely to Fix Continue functions can be brought up as follows from the Main View window menu bar Fix Continue gt View gt Pulldown menu e Status window e Message window e Build Environment window This section describes Fix Continue menu selections and windows The Fix Continue menu is available from the Main View menu bar The menu selections operate on the selected code or the file shown in the Source View window The Fix Continue menu is also available from Source View window and from the Fix Continue Status window A 8 1 Fix Continue Status Window 302 The Fixt Continue Status window see Figure 117 page 303 provides you with a summary of the modifications you have made during your session It also allows you quick access to your modifications and somewhat expanded menu options 007 2579 005 Debugger Reference A Redefined functions Id Status Saved Function Function list Function ID Function status Function name Filename for function Figure 117 Fix Continue Status Window The function ID number status name and file name are displayed in the wi
227. n be pending traps not stop at traps The debugger will only accept a stop at trap on a DSO dynamic shared object and line number loaded at startup See Section 5 3 1 1 page 78 for trap syntaxes To get around this set a pending stop in trap and run to the trap location Now you can set stop at traps because the DSO is loaded The debugger will then remember these traps if you run kill and re run within a single session Pending traps display with the prefix pending preceding the normal trap display line 71 Developer Magic Debugger User s Guide 5 2 Setting Traps 72 Note Breakpoints on misspelled names are not flagged as errors when pending traps are enabled This is because the Debugger has no way of knowing if a pending trap will ever be tripped A sample trap collects performance data Sample traps are used only in performance analysis not in debugging They collect data without stopping the process You can specify sample traps to collect such information as call stack data function counts basic block counts PC profile counts mallocs frees system calls and page faults Sample traps can use any of the triggers that stop traps use Sample traps are often set up as pollpoints so that they collect data at set time intervals An exception trap fires when a C exception is raised You can add a conditional expression to an exception trap through the Trap Manager window However the
228. n button to execute your program When a trap stops a process you can view your program data using the tools described in this chapter This chapter covers e Tracing Through Call Stack View Section 7 1 page 93 e Evaluating Expressions Section 7 3 page 99 The Debugger also lets you examine data at the machine level The tools for viewing disassembled code machine registers and data by specific memory location are described in Appendix A page 183 7 1 Traceback through Call Stack View The Views menu may be used to bring up the Call Stack View window This window displays the functions subroutines that is the frames in the call stack when the process associated with your program has stopped This display provides a traceback of subprograms from the system routine which starts your executable found at the bottom of the list to the routine in which you are currently stopped found at the top of the list If the trap breakpoint at which you are currently stopped is located in your source code that code is displayed in the source pane of the Main View window If the trap breakpoint is located in a system routine the Call Stack View allows you to double click on another routine s name to bring up that routine s source and associated data A typical Call Stack View window is shown in Figure 33 page 94 007 2579 005 93 Developer Magic Debugger User s Guide 94 Maximum call stack depth OK Cancel Help
229. n 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 e A menu bar for performing debugger functions e A control panel for specifying and controlling program execution e A source code display area which displays the code for the program you are debugging e A source filename field which tells gives you the path to the file displayed in the source code display area e A status area for viewing the current status of the program e The Debugger command line in which to enter debugging commands see Section A 9 page 312 for command syntax The major areas of the Main View window are shown in Figure 1 page 3 Note For a comprehensive description of the Main View window see Section A 1 page 183 2 007 2579 005 Menu bar Control panel Status area Source code display area Annotation column Source filename Debugger command line 1 1 2 About Traps 007 2579 005 WorkShop Debugger Overview 1 Admin Views Query Source Display Perf fraps PC FhoContinue Command usr demos WorkShop bounce bounce Debug Only Run Status Executable us WorkShop bounce bounce signed int argc char argy remembered to Eri ject assert the pplication 25 Init Intrinsics build all windows and enter event loop theApplication
230. n increment with each click Select the following from the Main View window menu bar Views gt Trap Manager The Trap Manager window appears as shown in Figure 16 page 57 The Trap Manager window lets you list add edit disable or remove traps in a process In Step 2 you set a breakpoint in the spin function by clicking in the source code annotation column The trap now displays in the trap display area of the Trap Manager window The Trap Manager window also permits you to do the following e Define other traps 007 2579 005 007 2579 005 Tutorial The jello Program 4 e Set conditional traps in the Condition field near the top of the window e Specify the number of times a trap should be encountered before it activates by using the Cycle Count field e Manipulate traps by using trap controls Modify Add Clear Delete e View all traps active and inactive in the trap display area Trap Manager pid 2740 ID Admin Config fraps Display Heip Trap specification Trap Stop at file usr demos WorkShop jello je Trap condition specification Condition Cycle count Cycle Count 1 Current Count Current count Trap controls Modify Add Clear Delete Active Trap Trap display area _ Stop at file usr demos Search field __ xz ai Figure 16 Trap Manager Window 6 Click the button to the left of the stop trap in the trap display area The trap is te
231. n on a fresh line terminates the definition For example redefine getNums usr fmain c 8 1 gt usr fmain c 8 2 gt printf In getNums n usr fmain c 8 3 gt usr fmain c 8 4 gt replace_source filename line_number line_number For C and C only when compiled with 032 Prompts you to type in replacement source if line_number or line_number range is within the body of a function The source lines you provide replace the specified line s An example is replace_source fmain c 12 This command returns an existing or new id depending on whether the function affected has already been changed or not The resulting new definition of the function is executed on its entry next time See also add_source and delete_source rerun Runs the program again using the same arguments return Continues executing the current procedure and returns to the next sequential line in the calling function run all argument_list Runs the program s If an argument_list is specified it is used as the arguments to be supplied to the program runtime_check func_spec options key key For C and C only when compiled with 032 Enables all run time checking options by default If options is specified then run time checking is restricted to the keys The result of the runtime checks are printed the next time the specified function func_spec is entered You can invoke this c
232. n structure browser preferences box 285 345 Developer Magic Debugger User s Guide Default structure width field in structure browser preferences box 285 Default structure width field in structure browser type formatting box 286 delete all dbx style command 314 delete trap dbx style command 315 delete_changes dbx style command 314 delete_source dbx style command 314 deleting changed code tutorial 116 Dereference ptrs by default field in structure browser preferences box 285 Dereference ptrs selection in structure browser node menu 284 detach dbx style command 315 Detach selection in admin menu 191 Detail selection in structure browser submenu 282 difference tools in Fix Continue 124 disable all dbx style command 315 disable dbx style command 315 disable_changes dbx style command 315 disabling traps in jello tutorial 57 Disassemble File Dialog 294 Disassemble Function Dialog 293 Disassemble menu in disassembly view 292 disassembled code 5 Disassembly View Preferences 294 Views menu option 5 Disassembly View selection in views menu 192 display area in structure browser 280 DISPLAY environment variable for debugging 11 Display menu in Main View window 197 Main View window 340 Display menu in structure browser 279 Display menu in traps manager 76 display dbx style command 315 Display selection in structure browser display menu 280 divisions by zero 346 how to find
233. n the Main View 88 stop dbx style command 323 stop exception dbx style command 323 stop in dbx style command 323 Stop Into button description 19 stop trap 71 stop trap command 77 Stop Trap Default Traps menu option 254 stop traps 3 in jello tutorial 55 stopping process execution 88 Structure Browser viewing variables with C code only 97 Views menu option 4 Structure browser general description 277 Structure Browser C code only viewing variables with 27 Structure browser preferences dialog box 284 Structure Browser selection in views menu 63 Structure Browser selection in views menu 193 subscript controls in Array Browser 65 Subscript Controls panel in Array Browser wi ndow 26 355 Developer Magic Debugger User s Guide subscripts array 259 Switch executable selection in admin menu 191 Switch process dialog box 191 Switch process selection in admin menu 191 switching between compiled and redefined code in Fix Continue 121 syscall dbx style command 324 Syscall panel 84 Syscall Panel selection in views menu 193 syscall trap debugger command option 81 syscalls accept 326 close 326 creat 326 dmi 326 fentl 326 fsync 326 getmsg 326 getpmsg 326 ioctl 326 lockf 326 mq_open 326 msgrcv 326 msgsnd 326 msync 326 nanosleep 326 open 326 pause 326 poll 326 pread 326 putmsg 326 putpmsg 326 pwrite 327 read 326 readv 326 recv
234. n the Step Into button you can select the number of steps the Debugger takes Left click on the Step Into button to take one step e Step Over steps to the next executable statement and steps over function and subroutine calls Thus if you set a breakpoint at a subroutine call click on the Run button so the call to the subroutine is highlighted in green then click the Step Over button to step over this subroutine to the next executable statement displayed in the source pane of the Main View window Right click on the Step Over button to select the number of steps the Debugger takes Left click on the Step Over button to take one step e Return executes the remaining instructions in the current function or subroutine Execution stops upon return from that function or subroutine A trap also called a breakpoint can be set if you click your cursor in the area to the left of the statement in the area underneath the word Status in the Main View window When you do this the line in your program will be highlighted in red To remove the breakpoint click in the same place and the red highlighting will disappear Clicking on the Run button will cause your program to run and stop at the first breakpoint encountered To continue program execution click on the Continue button Breakpoints can only be set at executable statements 2 1 6 Options for Viewing Variables 20 There are many ways to view current values of variables with the Debugger B
235. n the tab overflow area the area where the tabs overlap to the far left of the tab list as labeled in Figure 54 and select the Breakpoints tab 007 2579 005 X Motif Analyzer 11 El Breakpoinis by Figure 54 Selecting the Breakpoints Tab from the Overflow Area 9 Click on the word Callback in the Breakpoint Type text field of the Breakpoints Examiner window to bring up a submenu and select Resource Change 10 In the Class text field enter Any 11 In the Resource Name text field enter sensitive 007 2579 005 173 Developer Magic Debugger User s Guide 12 13 14 Click Add This adds a breakpoint The Active Breakpoints list should now include the following text Any Resource Change name sensitiv Click Continue The status will update to Stopped in the SetValues routine since the breakpoint set in the previous step was reached Select the following in the Main View window Views gt Call Stack Notice the call to Xt Set Values on the second line see Figure 55 Admin Contig Display BetValues base UxTOUZSbUS UZO Tab Ws 74c 2422208 res OxT002eeb0 num resol xtSetValues w 0x10028b08 args Ox fff2960 num_args 1 Setalues c 226 xtSetSensitive widget 0x10028b08 sensitive 3001 SetSens c 119 CmdInterface activate this 0x10024a48 CmdInterface C 47 Cmd activate this 0x10028548 Cmd C 92 Cmd execute this 0x10028580 Cmd C 17
236. n to a frame that did not previously use an alloca function Both the old and new functions must be compiled with the g option In other words the layout of the stack frames of both the old and new functions must be identical for you to continue execution in the function that is being modified If not execution of the old function continues and the new function is executed the next time the function is called If you redefine functions that are in but not on top of the call stack the modified code will not be executed when they combine Modified functions will be executed only on their next call or on a rerun For example consider the following call stack foo bar foobar main If you redefine foo you can continue execution provided that the layout of the stack frames are the same 007 2579 005 Debugging with Fix Continue 8 If you redefine main after you have begun execution the redefined main will be executed only when you rerun If you redefine bar or foobar the new code will not be executed when foo returns It will be executed only on the next call of bar or foobar 8 3 Fix Continue Tutorial This tutorial illustrates several features of Fix Continue The demo files included in usr demos WorkShop time1 contain the complete C source code for the program time1 Use this program for your tutorial Here you will see how Fix Continue can modify functions without recompiling an
237. nalyzer for viewing build dependencies and recompilation requirements and accessing source files Build View uses the UNIX make 1 facility as its default build software Although cvmake can be set up to run any program instead of make for example gnumake cvbuild will only parse and display standard makefiles in particular it does not understand gnu make constructs B 1 Build View Window 007 2579 005 You can access the Build View window from the WorkShop analysis tools from the command line by typing cvmake or from the Build Analyzer see next section To access Build View from WorkShop select Recompile from the Source menu in the Main View window in the Debugger or from the File menu in Source View for more information on the Main View and Source View windows refer to Chapter 1 page 1 Selecting Recompile detaches the current executable from the WorkShop analysis tools and displays Build View You can edit the Directory and Target s fields as needed and click Build to compile If the source compiles successfully the new executable is reattached when you reenter the WorkShop analysis tools The Build View window has three major areas e Build Process Control Area Section B 2 page 330 e Transcript Area Section B 3 page 331 e Error List Area Section B 4 page 332 329 Developer Magic Debugger User s Guide B 2 Build Process Control Area 330 The build process control area lets you run or stop the
238. name line_number line_number For C and C only when compiled with 032 Deletes the given line s if line_number or line_number range is within the body of a function An example is delete_source fmain c 8 6 8 7 This command returns an ID existing or new depending on whether the function affected has already been changed or not The resulting new definition of the function is executed on its entry next time 314 007 2579 005 007 2579 005 Debugger Reference A delete trap_number trap_number Deletes the specified breakpoint numbered trap_number as obtained from the list generated when the status command is issued detach Detaches from the current process disable all Deactivates all traps disable_changes func_spec all file filename For C and C only when compiled with 032 Disables specified changes for selected functions for example disable_changes getNumbers file fmain c Nothing happens if the selected function is already disabled The compiled definition of the function is executed on its next entry You can invoke this command when the process is stopped or on a running process when a function entry breakpoint is set disable trap_number trap_number Deactivates the specified breakpoint numbered trap_number as obtained from the list generated when the status command is issued display expression With expression adds expression to the lis
239. ndow Double clicking a line in the window brings up the corresponding source in the Debugger main window Status window menus and submenus are described in Figure 118 page 304 007 2579 005 303 Developer Magic Debugger User s Guide For Function For File Function Functions in File Ali Functions Function Fife Function View Tear off Functions in File Sort Status View Aff Functions Bt Show Long Filenames Message Window Build Env for File Default Build Env External Editor Ciriha Parse And Load CirhP Update Ail Files Show Difference Enable Disable Save Delete Show Fi FF FF Admin View Fix Continue Help Figure 118 Fix Continue Status Window Menus A 8 1 1 Admin Menu The Admin menu contains an option for closing the window Close Closes the status window A 8 1 2 View Menu The View menu contains options for sorting information in the window and displaying file names Sort Status View Sorts the information in the status view according to the field currently selected 304 007 2579 005 Show Long Filenames A 8 1 3 Fix Continue Menu Debugger Reference A Toggles among absolute long path names or base names The Fixt Continue menu available from the Fix Continue Status window is somewhat different from that available through the Debugger Main View It contains a number of options and submenus that are described
240. ng options Default Sets the format to the default values Value Displays a submenu from which you can select a value of Decimal Unsigned Octal Hex Exponential Float Char String or Wide Character type Type Displays a submenu from which you can select a type of Decimal Octal or Hex Bit size Sets the format to Bit Size A 6 4 File Browser Window The File Browser window displays a list of source files used by the current executable Double click on a file in the list to load it into the source display area in the Main View or Source View windows Some files may be listed due to subroutines functions being resolved from system libraries If you select such a file you may get the following message Unable to find file lt xxx c gt This is because the source for system library routines may not be stored on your system The Search field allows you to find files in the list 276 007 2579 005 Debugger Reference A File Browser pid 18458 Admin Heip ail usr demosVorkShopi jello jello c al AddDIC c AddSF c AllCells c AllPlanes c AllowEv c AuDispose c AuFileName c AuGetBest c Figure 101 File Browser Window The File Browser contains an Admin menu described in Section A 3 1 1 page 217 and a Help menu described in Section A 1 10 page 205 In addition the browser has a Search field A 6 5 Structure Browser Window The Structure Browser window allows you to examine data structures and
241. ns through the Path Remapping dialog box e To view the substitution set for a different prefix click that prefix e To add a new prefix enter the new value in the Value field below the Prefix list and click the Add button A new substitution set is created with the prefix name as the first element Click on this element to highlight it 007 2579 005 Selecting Source Files 3 Next type the desired substitution in the Value field below the Substitution Set list and insert it by clicking on either the Insert Before button or the Insert After button To modify the currently selected prefix edit the string in the Value field and click the Modify button To remove the current prefix and its substitution set select the prefix and click the Remove button 3 2 1 Case Example for Path Remapping 007 2579 005 In some cases if source files have been moved to new locations path remapping is required to help the Debugger find the source files again The following tutorial shows you a case for remapping It includes demo files bundled with your WorkShop Debugger 1 Create a new directory in your_home_directory o mkdir jellodemos Change to the new directory o cd jellodemos Copy the Jello demo files from the Workshop demo directory into your new directory o cp usr demos WorkShop jello Enter the following to ensure that the jello executable contains the jello demos source path o ma
242. ntains the following items from which you can select to vary the display Sort toggles Process display tabs Callstack display tabs Allow you to sort the process list by Thread Name State Pid or Location depending on which of the buttons is active Default selection is Thread Allow you to view a list of tasks or details of the currently running highlighted task Allow you to view all call stack information or call stack details of the currently selected process Select the following from the Main View window menu bar to display the Views gt Exception View window Exception View Exception View is an Ada specific view that allows you to set traps on exceptions and control exception handling This view works only if the Ada compiler is installed By default this view displays only the following predefined Ada exceptions e Constraint errors e Program errors e Storage errors e asking errors 219 Developer Magic Debugger User s Guide In addition a single breakpoint is set on any unhandled exception Figure 65 shows a typical Exception View window Stop When option Exception toggles menus names sp Exception View wid 6138677 de Admin Contig Display Stop Wher Exception Name Always Any Exception Awas constraint_error_def Awas program_error_def Aways storage_error_def Awas tasking_error_def Figure 65 Exception View The Admin me
243. ntrols Row Col i P E Min p Max 5 step i Figure 94 Color Exception Portion of Array Browser Window Thus you can highlight data values less than or greater than specified values values of plus or minus infinity values of plus or minus underflow zero values and NaN not a number values 264 007 2579 005 Debugger Reference A a 5 2 E a Doss Surface rendering Bar chart rendering A 6 1 5 Scale Menu 007 2579 005 Point rendering Multiple line rendering Figure 95 Array Browser Graphic Modes Note The Scale tear off menu is available only if you are have a Silicon Graphics workstation with Open Inventor installed on it If the Scale menu is grayed out when the Array Browser window first opens select the Surface option of the Render menu The Scale menu provides options for changing the ratio of the z dimension which represents the value of the element The number on the left represents the value of the x and y dimensions which are always the same as each other The number on the right is the z dimension Manipulating the z dimension affects the ease of spotting differences in values If your data is scattered over a narrow range of values you may wish to heighten the graph by selecting 10 1 as your scale this exaggerates the values in the z dimension If your data is in a wide range selecting 1 2 or 1 10 as the scale will minimize the differences flattening the graph 265
244. nu has the following options Active Activates the current window in a set of cloned windows Clone Creates a clone of the current window 220 007 2579 005 Save As Text Close Debugger Reference A Launches the Save Text dialog This dialog allows you to save your current session as text in a file you designate Closes the current window The Config menu has the following options Load Exceptions Save Exceptions Opens the Load User Defined Exceptions dialog that allows you to add additional exceptions to the predefined Ada exceptions Opens the Save User Defined Exceptions dialog that allows you to save any user defined exceptions to the predefined Ada exceptions The Display menu has the following options Delete All Clear All Traps Reset All Buttons Deletes all exception traps Clears all exception traps Clearing traps is not the same as deleting traps Clearing only temporarily affects traps while deleting removes them permanently Resets all button actions The Stop boxes toggle on and off to indicate whether a trap is active The When control menus allow you to determine when an exception trap fires The following choices are available Always WhenOthers Unhandled 007 2579 005 Stops any time the exception is raised Stops when caught by a when others handler rather than an explicit handler or when unhandled Stops when the exception is unhandle
245. number wf Show function name and line number tf Show machine address L Show instruction value LJ Show jal targets numerically OK Apply Close Help Figure 113 The Disassembly View Preferences Dialog with Display Format Menu The dialog box provides you with the following options Number of Controls the default number of disassembly lines instructions to shown when the process stops This number disassemble appears in the dialog boxes selected from the Disassemble menu see Figure 110 page 292 Figure 111 page 293 and Figure 112 page 294 The default is all instructions indicating that the entire function will be disassembled Minimum lines Controls the display of the disassembled code around current enabling you to view at least the specified instruction number of instructions before and after the current instruction Register name Controls how register names are displayed The display format available modes are Hardware Compiler and Assembler Show embedded When ON displays source and disassembly source annotation statements interleaved When OFF displays disassembly statements only 295 Developer Magic Debugger User s Guide how source file nd line number how function name nd line number how machine ddress how instruction alue ng n an DWN DN how jal targets numerically A 7 2 The Register View Window 296 Displays the filename and file position along wit
246. o contend with all of the complexity of X The X Motif Analyzer helps you debug code that calls Motif library routines The X Motif Analyzer is integrated with the Debugger so you can issue X Motif Analyzer commands graphically To access X Motif analyzer subwindow select the following from the Main View window menu bar Views gt X Motif Analyzer 11 1 Introduction to the X Motif Analyzer The Analyzer contains X Motif objects for example widgets and X graphics contexts that can be difficult or impossible to inspect through ordinary debugging procedures It also allows you to set widget level breakpoints and collect X event history information in the same manner as using xscope See the xscope 1 man page for more information 11 1 1 Examiners Overview 007 2579 005 When the X Motif Analyzer first displays it is set to examine widgets At this point the window may be blank or it may display a widget found in the call stack of a stopped process At the bottom of the X Motif Analyzer window is a tab panel that shows the current set of examiners In addition to this tab the Widget Examiner Breakpoints Trace and Tree Examiners tabs are at the bottom of the window These four tabs are always present Other examiners are available from the Examine menu of the X Motif Analyzer window 159 Developer Magic Debugger User s Guide Some examiners cannot be manually selected They appear only when appropriate to the call sta
247. of a single 6 5 pthread is used each time a user requests a single thread step over of a function The single thread is allowed to free run through the function which is being stepped over Thus if any blocking or scheduling situations occur in the course of this stepping over and associated free run of a single thread then anomalous behavior can and does occur For example when attempting to step over a function call which eventually calls the routine pthread_create the user will see the step over succeed or not succeed in non deterministic fashion due to complex scheduling algorithms in the pthreads library This is explained in greater detail below in Section 10 4 1 1 page 153 As another example when a single thread step over is requested of a routine which does a printf somewhere down the call tree the blocking operating system call writev is eventually invoked and this can and does lead to anomalous behavior in the eyes of the debugging user This is explained in detail inSection 10 4 1 2 page 155 10 4 1 1 Scheduling Anomalies 007 2579 005 Scheduling anomalies may occur when the single 6 5 POSIX pthread which is being continued or free run creates a new pthread via call to routine pthread_create At the time of the call to pthread_create the OS kernel and the pthreads library get into a complex algorithm in deciding how to give 153 Developer Magic Debugger User s Guide life to the new child pthread An actual OS ke
248. oints 234 trace 240 tree 243 tree examiner 166 widget 242 widget class 250 widget examiner 165 window 171 247 X event breakpoints 237 examiners overview in X Motif analyzer 159 selections in X Motif analyzer 160 examining data 4 in jello tutorial 58 examining program data 93 examining widget classes 168 examining widgets in X Motif analyzer tutorial 166 exception trap 72 Exception View description 219 Exception View selection in views menu 192 executable run directly from the Main View window 39 execution control buttons 88 in Main View window 88 Execution View 92 Execution View description 12 206 Execution View selection in views menu 192 007 2579 005 Index Exit Function Traps menu option 254 Exit selection in admin menu 192 exiting the debugger 67 Expression column in Expression View 99 Expression column in expression view 275 expression count dbx style command 316 Expression field in Structure Browser in jello tutorial 63 Expression field in structure browser 279 Expression View viewing variables with 23 Expression view 273 Views menu option 4 Expression View selection in Views menu in jello tutorial 61 Expression View Window for evaluating expressions 99 Expression View window viewing variables with 98 Expression View selection in views menu 192 Expression selection in structure browser display submenu 280 expressions C 104 for C operations 103
249. ommand on a stopped or a running process 320 007 2579 005 Debugger Reference A save_changes func_spec file filename wlal filename_to_save For C and C only when compiled with 032 Saves enabled or disabled function redefinitions or an entire file to another file filename_to_save The following example shows how to save a function definition save_changes getNumbers getNumbersFunc If you specify the file option then before saving to filename_to_save all function changes are applied to the compiled source of the file with the condition that the file has had only its functions redefined and has not been edited since the last build An example of saving an entire file is the following save_changes file fmain c fmain c The w option replaces the filename_to_save The a option appends to the filename_to_save An example of adding a function to a file is the following save_changes file fmain c a fmain c See also delete_changes setbuildenv filename compiler flag list For C and C only when compiled with 032 Overrides default build environment flags compiler options Without filename the flags are passed along with c g flags to the compiler for any function in any file except those set separately with setbuildenv An example is the following setbuildenv DnameA Idir If filename is given this command sets separate flags specifically for that file For example cons
250. ool pop up menu in the Admin menu of the Status window See Section A 8 1 page 302 for further information Compiles your modified program and loads it for execution You can execute the modified program by clicking on the Run or Continue buttons in the Main View window Allows you to see the difference between the original code and your modifications See Section A 1 9 1 page 202 for further information 201 Developer Magic Debugger User s Guide Edited lt gt Compiled Enables or disables your changes This switch allows you to see how your application executed before and after the changes you made Save As Allows you to save your changes to a file You can save changes to the current source file the default or to a separate file Save All Files Launches the Save File Fixes As dialog that allows you to update the current session and save all the modifications View submenu Allows you to change to different views Fix Continue supports status message and build environment windows See Section A 1 9 2 page 203 for further information Preferences Allows you to set your Fix Continue preferences submenu See Section A 1 9 3 page 203 for further information Cancel Edit Takes you out of edit mode and cancels any changes you have made Delete Edits Deletes any modifications that you made A 1 9 1 Show Difference Submenu 202 This submenu allows you to view differences between
251. option of the Breakpoint Type option button in the Breakpoint Examiner is selected the examiner appears as shown in Figure 73 Active Breakpoints F wi Breakpoints Figure 73 State Change Breakpoints Examiner 236 007 2579 005 Debugger Reference A The State Change Breakpoints examiner contains the following items Widget text field Name text field Class text field Parent button Previous button Children button Select button Breakpoint Type option button Clear button State Type option button A 4 2 7 X Event Breakpoints Examiner Allows you to choose a widget to examine by entering the widget address Allows you to choose a widget to examine by entering the widget name Allows you to choose a widget to examine by entering the widget s class Leave the field blank or enter Any to select all widgets Allows you to move the parent of the currently selected widget Moves you to the previously selected widget Shows you the widget s children it is grayed out if the selected widget cannot have children Allows you to select the widget in the target process Allows you to select the type of breakpoint you wish to set In this section State Change is selected Clears all the current breakpoint selections and text fields Allows you to set the state change type for a given breakpoint When you select the X Event option of the Breakpoint Type option button in th
252. ormance Analyzer User s Guide Developer Magic ProDev WorkShop Overview Developer Magic Static Analyzer User s Guide Fortran 77 Language Reference Manual dbx User s Guide Silicon Graphics maintains publications information at the following web site http techpubs sgi com library This library contains information that allows you to browse documents online order documents and send feedback to Silicon Graphics To order a printed Silicon Graphics document call 1 800 627 9307 Customers outside of the United States and Canada should contact their local service organization for ordering and documentation information The following conventions are used throughout this document Convention Meaning command This fixed space font denotes literal items such as commands files routines path names signals messages and programming language structures 007 2579 005 About This Guide manpage x Man page section identifiers appear in parentheses after man page names The following list describes the identifiers 1 User commands 1B User commands ported from BSD System calls Library routines macros and opdefs 4 Devices special files 4P Protocols 5 File formats 7 Miscellaneous topics 7D DWE related information 8 Administrator commands Some internal routines for example the _assign_asgcmd_info routine do not have man pages associated with them variable Italic typeface denotes variable entries and wor
253. ormation on the performance tools This is a toggle button that shows or hides performance related annotations 007 2579 005 Debugger Reference A aamin Eey E V AA epe EG Coa Command aed E eee ee ee Show Hide annotations button with annotations showing Excl Totalims shut btu Read Only Admin Views Query Sgurce Display Perf Traps PC _ fFix Continue Command ee conme stp oep ino ser ower ew sanee era Show Hide annotations button with annotations hidden Figure 58 Show Hide Annotations Button in the Main View Window 007 2579 005 189 Developer Magic Debugger User s Guide A 1 1 Admin Menu 190 The Admin menu in the Main View window performs administrative and general management tasks dealing with processes windows and user preferences The Admin menu provides the following selections Library Search Path Remap Path Multiprocess View Controls where the Debugger looks for DSOs when you invoke the Debugger on an executable or core file The Library Search Path dialog allows you to reset the LD_LIBRARY_PATH and _RLD_ROOT environment variables You can also reset _RLD_LIST to control the set of DSOs that will be used by the program See the r1d 1 man page for more information on these variables Any changes you make to these variables are propagated into Execution View when you run the program There are two ways to open this dialog First from th
254. orrespondence between a frame and the source code when a frame is clicked in the Call Stack View window In this example the stack frame spin has been selected the Main View display scrolls to the place where the trap occurred If the second stack main had been selected the window would have scrolled to the place where the function main calls spin 95 Developer Magic Debugger User s Guide Figure 34 Tracing through Call Stack View 7 2 Options for Viewing Variables The WorkShop Debugger provides several options for viewing variables or expressions involving these variables In this section only brief descriptions of these options will be provided along with references where further information may be obtained elsewhere in this document 96 007 2579 005 Viewing Program Data 7 7 2 1 Using the cvd gt Command Line At the bottom of the Main View window is the cvd command message pane Here you can enter print xxx commands to obtain the current value of variable xxx For examples of these commands see Section 2 1 6 1 page 21 For the syntax of these commands such as assign print printd printo printx and so on see Section A 9 1 page 312 7 2 2 Using Click to Evaluate In the Main View window s source pane a click of the right mouse button will bring up a pop up menu from which you can select Click to Evaluate When this option is on a click on a variable will cause its value to appear If you c
255. ound current instruction field in disassembly view preferences box 295 mg_open syscall that blocks continued pthreads 326 msegrcv syscall that blocks continued pthreads 326 msgsnd syscall that blocks continued pthreads 326 msync syscall that blocks continued pthreads 326 multiple process debugging description and introduction 135 multiprocess add and remove processes 139 additional main view windows for 139 debugging a multiprocess fortran program 146 fortran multiprocess debugging session 146 multiprocess traps 138 preferences 139 using trap manager to control trap inheritance tutorial 144 view control buttons 138 viewing process status 137 multiprocess traps 77 Multiprocess View launching debugger in 141 to control execution 142 Views menu option 4 Multiprocess View description 206 administrative functions 208 control buttons 208 preferences 209 Multiprocess View preferences options Attach to forked processes 209 Combine threads at same location 210 Copy traps to forked processes 209 Copy traps to sproc d processes 209 Levels to open 209 Resume child after attach on fork 210 Resume child after attach on sproc 210 Resume parent after fork 210 007 2579 005 Index Resume parent after sproc 210 Show Thread Status vs Thread State 210 Show Hide buttons 210 Show Hide Header Information 210 Stack Depth 209 Multiprocess View window 136 Multiprocess View selection in admin menu 190 multi
256. ource file under a different filename You must first select Make Editable which appears in the Source menu when the file is read only 007 2579 005 Save As Text Insert Source Fork Editor Recompile Make Read Only Make Editable Search Go to Line 007 2579 005 Debugger Reference A Records the information in the display area as a text file Inserts the text of a file within your current file You must first select Make Editable which appears in the Source menu when the file is read only You must first select Make Editable which appears in the Source menu when the file is read only Starts your default editor on the current file The default editor is determined by the editorCommand resource in the app defaults file The value of this resource defaults to wsh c vi d which means run vi in a wsh window and scroll to the current line If the editor allows you to specify a starting line enter d in the resource to indicate the new line number Displays the Build View window which allows you to compile the source code associated with the current executable Toggles the source code displayed between read only and writable states so that you can edit your code Searches for a literal case sensitive literal case insensitive or regular expression After you have set your target and clicked Apply or pressed Enter each instance is marked by a search target indicator in the s
257. play area of the Main View window You may now use any of the methods to find variable values described in Section 2 1 6 page 20 to discover why the divide by zero or overflow occurred 35 Developer Magic Debugger User s Guide For more information on handling floating point exceptions see the handle_sigfpes 3 and fsigfpe 3F man pages Perform the following to find integer divisions by zero 1 Compile your program using the following options g DEBUG div_check 1 2 Enter the following cvd executable 3 Click the Run button The program will automatically stop at the first line where an integer divide by zero occurred You may now use any of the methods to find variable values described in Section 2 1 6 page 20 to discover why the divide by zero occurred 2 2 5 Step 5 Perform Core File Analysis 36 Sometimes during program execution a core file is produced and the program does not complete execution The file is placed in your working directory and named core Some machines are configured to not produce a core file To find out if this is the case on the machine you are using enter the following o limit If the limit on coredumpsize is zero no corefile will be produced If the limit on coredumpsize is not large enough to hold the program s memory image the core file produced will not be usable To change the configuration to allow core files to be produced enter the following unlimit cored
258. ppear near the top of the Multiprocess View window Show Hide Header When this option is ON column headings display Information above the list of processes threads A 2 3 Source View The Source View window is brought by choosing the following from the Main View window menu bar Views gt Source View 210 007 2579 005 007 2579 005 Debugger Reference A By default a copy of the source on display in the Main View window source pane is displayed in this window File Display Traps PC FixtContinue Read Only Figure 61 Source View Window The Source View menu bar contains selections duplicated from the Main View window Display Traps PC and Fix Continue Each of these menus has the same functionality as its counterpart in the Main View window see Section A 8 4 1 page 309 The only new menu selection is the File menu described below Open Launches the Open dialog that allows you to choose a file to load into Source View Save Records changes made to the file during the current debugging session You must first select Make Editable from this File menu when the file is read only Save As Records changes made during the debugging session to the source file under a different file 211 Developer Magic Debugger User s Guide Save As Text Open Separate Insert File Clone Fork Editor Recompile Make Editable Search 212 name the name of which you
259. processing debugging 135 N N selection in step into menu 89 N selection in Step Over menu 89 nanosleep syscall that blocks continued pthreads 326 next dbx style command 318 nexti dbx style command 318 Node menu in structure browser 279 Node pop up menu in structure browser 280 Normal selection in structure node submenu 282 Number of instructions to disassemble field in disassembly view preferences box 295 O Open dialog box loading files 41 Open Recent selection in Source menu 194 open syscall that blocks continued pthreads 326 Open selection in Source menu 194 overflows how to find in scientific programs 35 Overview selection in help menu 205 P path remapping case example 45 path remapping description 43 351 Developer Magic Debugger User s Guide Pattern layout selection in structure browser node menu 284 pause syscall that blocks continued pthreads 326 PC 201 PC menu 91 201 Continue To 91 Jump To 91 PC menu in disassembly view 292 PC menu in main view window 91 pending trap definition 71 performance analyzer how to access from Main View window 5 performance data Sample button 91 pgrp trap debugger command option 77 pixmap examiner 249 poll syscall that blocks continued pthreads 326 pollpoint 4 pollpoint trap debugger command option 82 pread syscall that blocks continued pthreads 326 preferences for multiprocesses 139 preparing the fil
260. pyaS bab demas timel timel First printing of time 08 20 50 OK KK OK Second printing of time 98 20 50 KKK K Y OK OK KOKOK laboct 4 Close Help Figure 37 Program Results in Execution View 8 3 2 Redefining a Function time1 Program In this section you will do the following in the time1 program e Edit a C C function e Change the code of an existing C C function and then parse and load the function rebuilding your program to see the effect of your changes on program output without recompiling e Save the changed function to its own separate file 112 007 2579 005 8 3 2 1 Editing a Function Debugging with Fix Continue 8 Perform the following in the Debugger Main View window the time1 program should be displayed to edit a function 1 007 2579 005 Selecting the following from the Main View window menu bar to show line numbers Display gt Show Line Numbers Click on the source annotation column to the left of line 17 to set a breakpoint at that point Set a breakpoint at line 20 from the cvd gt prompt as follows cvd gt stop at 20 Click on the Run button to execute the program The following output appears in the Execution View window First printing of time 08 20 50 KAKKK KKK KK KKK KKK Second printing of time Enter the following in the cvd gt field to choose a class member function to edit in this case printTime a C member fu nction of class T
261. r Debugger Command Line 007 2579 005 Contents Page 289 289 290 290 291 292 294 296 297 298 299 300 301 301 301 301 302 304 304 305 307 307 307 308 309 309 310 311 311 312 xiii Developer Magic Debugger User s Guide Syntax for dbx style Commands Blocking Kernel System Calls Appendix B Using the Build Manager Build View Window Build Process Control Area Transcript Area Error List Area Build View Admin Menu Build View Preferences Build Options Using Build View Build Analyzer Window Build Specification Area Build Graph Area Build Graph Control Area Build Analyzer Overview Window Build Analyzer Menus Admin Menu Build Menu Filter Menu Query Menu Index Figures Figure 1 The WorkShop Debugger Main View Window Figure 2 Evaluation Pop Up Menu Figure 3 Expression View Window Figure 4 Array Browser Window xiv Page 312 326 329 329 330 331 332 332 332 333 334 335 336 336 338 339 340 340 340 340 341 343 3 22 24 25 007 2579 005 Figure 5 Figure 6 Figure 7 Figure 8 Figure 9 Figure 10 Figure 11 Figure 12 Figure 13 Figure 14 Figure 15 Figure 16 Figure 17 Figure 18 Figure 19 Figure 20 Figure 21 Figure 22 Figure 23 Figure 24 Figure 25 Figure 26 Figure 27 Figure 28 Figure 29 Figure 30 Figure 31 Search Window Call Stack View Window Trap Manager Window File Bro
262. r from the Main View window Admin gt Exit Note If you exit the Debugger first you exit the X Motif Analyzer as well For more information on the X Motif Analyzer see Section A 4 page 222 007 2579 005 175 Customizing the Debugger 12 This section shows you how you may customize the WorkShop Debugger specifically to your environment needs 12 1 Customizing the Debugger with Scripts If there are Debugger commands or combinations of Debugger commands that you use frequently you may find it convenient to create a script composed of Debugger commands Debugger scripts are ASCII files containing one Debugger command and its arguments per line A Debugger script can in turn call other Debugger scripts There are three general methods for running scripts e Enter the source command and the filename at the Debugger command line This is useful for scripts that you need only occasionally e Include the script in a startup file This is useful for scripts that you want implemented every time you use the Debugger e Define a button in the graphical interface to run the script Use this method for scripts you use frequently but apply only at specific times during a debugging session 12 1 1 Using a Startup File 007 2579 005 A startup file lets you preload your favorite buttons and aliases in a file that runs when the Debugger is invoked It also is useful if you have traps that you set the same way each time The sugge
263. r as follows Views gt Trap Manager The Trap Manager allows you to set edit and manage traps used in both the Debugger and Performance Analyzer The X window is shown in Figure 87 Admin Config fraps Display Condition iy Add Clear Delet Figure 87 Trap Manager Window The Trap Manager window contains the following items besides the menu bar which is discussed below Trap text field Contains a description of the trap Condition text field Contains the condition of the trap Cycle Count text field Displays the current cycle count 007 2579 005 A 5 2 Config Menu 007 2579 005 Current Count text field Full button Modify button Add button Clear button Delete button Active label Trap display area Search text field Debugger Reference A Displays the current trap count Allows you to toggle between display of full and partial path names Allows you to change the selected breakpoint s settings Allows you to add a new breakpoint Clears all the current breakpoint selections and text fields Deletes the selected breakpoint If selected with a check mark the trap is enabled Contains a description of each trap and a toggle to indicate whether or not the trap is active Allows you to perform an incremental textual search for the trap list The Trap Manager window has a menu bar which contains the Admin Config Traps Display and Help men
264. r features in the following tutorial Example 1 Fortran 90 Example e The Fortran 90 code in the file prog f is as follows program prog parameter n 3 double precision A n n x n y sum xydot initialize arrays x 2 0d0 do i 1 n y i i do j 1 n A i j i j i enddo enddo 1 compute the dot product of x and y call dot x y n xydot print dot product of x amp y xydot l compute y Ax do i 1 n sum 0 0 do j 1 n sum sum A i j x j enddo y i sum enddo print ty py stop end 13 Developer Magic Debugger User s Guide e It includes subroutine dot in file dot f as follows subroutine dot a b m answer double precision a m b m answer integer m answer 0 0d0 do i 1 m answer answer a i b i enddo end Perform the following steps with these files to demonstrate Debugger features 1 Enter the following command in the usr demos WorkShop getstarted directory to produce the executable program f90 g o progf prog f dot f This produces the executable progf 2 Launch the WorkShop Debugger with your newly compiled executable as follows o cvd progf amp The WorkShop Debugger Main View displays the source for your prog f file see Example 1 page 13 3 Select the following from the Main View menu bar to turn on file line numbering Display gt Show Line Numbers The line numbers will display to the left of th
265. r the specified address and size in bytes Typically the expression is the name of a variable The watchpoint may be specified to fire on write read or execute or some combination thereof of memory in the given span If not specified the size defaults to 4 bytes Also if not specified the write condition is assumed Addresses may be found by choosing the following from the Main View window menu bar Views gt Variable Browser or Views gt Structure Browser The window displays addresses for arrays and has options to display addresses for other variables Addresses may be entered in the form 0x0123fabc or 0123fabc X For example Trap stop watch addr 0x0123fabc 16 007 2579 005 Setting Traps 5 If the array you are watching at address 0x0123fabc is defined such that each element is 4 bytes long this example trap would be watching 4 adjacent array elements and would cause a stop if any of those 4 elements were updated since a size of 16 is specified 5 3 1 1 7 Setting a Trap at signal name stop sample all pgrp signal signal name This command sets a trap upon receipt of the given signal This is the same as the dbx 1 catch subcommand For a list of signals or an alternative way to set traps involving signals see Section 5 4 page 84 For example Trap stop signal SGIFPE 5 3 1 1 8 Setting a Trap on Entry to sys call name stop sample all pgrp syscall entry sys call name This command s
266. rences selection brings up the dialog box shown in Figure 126 page 333 The options are Maker Program field Lets you enter the program you use to build your executable Macro Settings field Lets you enter build macros such as CFLAGS g Makefile field Lets you enter the name of a makefile if you do not wish to use the default 007 2579 005 Using the Build Manager B Discard Duplicate Eliminates subsequent duplicates of errors in the Errors button error list area Show Warnings Toggles the option to display warnings in the list button Build View Preferences Maker Program make __ Discard Duplicate Errors bf Macro Settings Makefile Show Warnings OK Apply Cance Figure 126 Build View Preferences Dialog B 5 2 Build Options The Build Options Dialog lets you add the options shown in Figure 127 page 334 to your make command 007 2579 005 333 Developer Magic Debugger User s Guide B 5 3 Using Build View 334 Build Options Dialog Build Options J Print Macro And Target Descriptions p J Ignore Error Codes i L Continue After Build Failure k J Don t Echo Command Lines s L Dont Use Built In Rules r J Dont Execute Build Scripts n LI No Compatibility Mode For Old Makefiles B L Environment Variables Override Macros e L Touch Target Files t L Question And Return Status q J Unconditional Build u Fig
267. respond to them promptly xxiv 007 2579 005 WorkShop Debugger Overview 1 The Silicon Graphics MIPSpro WorkShop Debugger is a UNIX source level debugging tool for Silicon Graphics MIPS systems It displays program data and execution status in real time This tool can be used to debug Ada C C FORTRAN 77 and Fortran 90 Note Currently the Debugger does not accommodate all Fortran 90 derived syntax but it does accommodate Fortran 90 array syntax For an introductory tutorial to the principles of debugging particularly with the WorkShop Debugger see Chapter 2 page 11 This chapter presents an overview of the WorkShop Debugger and is divided into the following sections e Main Debugger Features Section 1 1 page 1 e Debugging with Fix Continue Section 1 2 page 8 e Debugging with the X Motif Analyzer Section 1 3 page 8 e Customizing the Debugger Section 1 4 page 8 1 1 Main Debugger Features The following sections outline the primary features and functions of the WorkShop Debugger and include references to comprehensive information found throughout this manual e The Debugger Main View Window Section 1 1 1 page 2 e About Traps Section 1 1 2 page 3 e Viewing Program Data Section 1 1 3 page 4 e Integrating the Debugger with Other WorkShop Tools Section 1 1 4 page 5 007 2579 005 1 Developer Magic Debugger User s Guide 1 1 1 The Debugger Main View Window When you start the Debugger with a
268. return from the system call Note When debugging IRIX 6 5 pthreads the Signal Panel is inaccessible if more than one thread is active 007 2579 005 85 Controlling Program Execution 6 This chapter shows you how to control the execution of your program with WorkShop Debugger It includes the following topics e Main View Control Panel Section 6 1 page 87 e Controlling Program Execution Using the PC Menu Section 6 2 page 91 e Execution View Section 6 3 page 92 6 1 The Main View Window Control Panel The Main View window control panel allows you to choose an executable and control its execution Admin Views Query Source Display Perf Traps PC Fix Continue Target command Command usr demos WorkShop jello jello Execution control ss Siop z i Sien O hoon Brn buttons Status line Figure 30 The Main View Window Control Panel 6 1 1 Features of the Main View Window Control Panel The control panel includes the following Command field Use this field to enter commands with arguments to run your program Status field Displays information about the execution status of your program The top line in this box indicates whether the program is running or stopped The message No executable displays if no executable is loaded When your program stops at a breakpoint an additional status line lists the current stack frame 007 2579 005 87 Developer Magic Debugger User s Guide
269. returned by malloc or memalign If you also set the MALLOC_FASTCHK environment variable you can catch these errors e free or realloc calls where the words prior to the user block have been corrupted e free or realloc calls where the words following the user block have been corrupted e free or realloc calls where the address is that of a block that has already been freed This error may not always be detected if the area around the block is reallocated after it was first freed 9 2 1 Compiling with the Malloc Library 126 You can compile your executable from scratch as follows 2 6 cc g o targetprogram targetprogram c lmalloc_ss You can also relink it by using 2 ld o targetprogram targetprogram o lmalloc_ss An alternative to rebuilding your executable is to use the _RLD_LIST environment variable to link the 1malloc_ss library See the rld 1 man page 007 2579 005 9 2 2 Setting Environment Variables 007 2579 005 Detecting Heap Corruption 9 After compiling invoke the Debugger with your executable as the target In Execution View you can set environment variables to enable different levels of heap corruption detection from within the malloc library as follows ALLOC_CLEAR_FREE Clears data in any memory allocation freed by free It requires that MALLOC_FASTCHK be set MALLOC_CLEAR_FREE_PATTERN pattern
270. riables functions parameters arrays pointers and arguments are all supported in expressions as are names in common blocks and equivalence statements Names may be spelled in upper case lower case or mixed case 7 3 5 2 Fortran Function Calls 106 The Debugger evaluates function calls the same way that compiled code does If it can be an argument is passed by reference otherwise a temporary expression is allocated and passed by reference Following the rules of Fortran actual arguments are not converted to match the types of formal arguments Side effects can be caused by Fortran function calls A useful technique to protect the value of a parameter from being modified by a function subroutine is to pass an expression such as parameter 0 instead of just the parameter name This causes a reference to a temporary expression to be passed to the function rather than a reference to the parameter itself The value is the same 007 2579 005 Debugging with Fix Continue 8 Fix Continue allows you to make changes to a C C program you are debugging without having to recompile and link the entire program With Fix Continue you can edit a function parse the new function and continue execution of the program being debugged Fix Continue is an integral part of the Debugger You issue Fix Continue commands graphically from the Fix Continue submenu of the Main View window or from the cvd gt command line prompt in the Command Message
271. rnel thread OS kernel threads are not available at the user level they differ from the user level pthread must be either created anew or found elsewhere to support the user s new child pthread First let s assume the OS kernel thread is to be found elsewhere depending on a vast number of things for example number of cpu s environment variables and so on The OS kernel may this is very non deterministic decide to just put the child pthread on a ready queue in need of an OS kernel thread Thus the child does nothing right away Meanwhile if the parent pthread via a call to routine pthread_cond_wait monitors the child pthread s struggle for life it the parent gets parked on a mutex because the child obviously has not been born yet remember it s on the ready queue The parent pthread s OS kernel thread becomes available which causes the OS scheduler to check for work for this newly freed OS kernel thread Behold it finds the child sitting in the ready queue and assigns the parent s OS kernel thread to the new child pthread The child then runs to completion and releases its parent s old OS kernel thread The parent checking for the child s new life via pthread_cond_wait now recaptures its OS kernel thread and things work fine in the eyes of the debugging user Now let s assume the OS kernel thread required by the new child pthread must be created anew The child is not placed on the ready queue Again
272. rocess Expressions are evaluated by default in the frame and language of the current context Expressions may contain data names or constants however they may not contain names known only to the C preprocessor such as in a define directive or a macro To evaluate expressions you can use Expression View which lets you evaluate multiple expressions simultaneously updating their values each time the process stops Note You can also evaluate expressions from the command line See Section A 9 page 312 for more information 7 3 1 Expression View Window The Expression View window is shown in Figure 35 page 100 with its major menus displayed The Expression View window has two pop up menus the Language menu and the Format menu e The Language menu is invoked by holding down the right mouse button while the cursor is in the Expression column e The Format menu is displayed by holding down the right mouse button in the Result column To specify the expression to be evaluated click in the Expression column and then enter the expression in the selected field It must be a valid expression in the current or selected language Ada C C or Fortran To change languages display the Language menu and make your selection When you press Enter the result of the expression is displayed in the Result column 007 2579 005 99 Developer Magic Debugger User s Guide Clear Alf Load Expressions Save E
273. rocess View window The control buttons on the Multiprocess View window may be used to control all processes simultaneously or the control buttons on any Main View window may be used to control that individual process separately Click on the first line that is the main process in the process pane of the Multiprocess View window to highlight this line 007 2579 005 Multiple Process Debugging 10 8 10 11 12 007 2579 005 Select the following from the menu bar of the Multiprocess View window Process gt Create new window A new Main View window displays with a debug session for the main process Note You may get a warning that write s is missing This refers to assembly code and can be ignored The new Main View window will not have source in its source pane Select the following from the menu bar of the Main View window you just created to create a Call Stack View window Views gt Call Stack View Double click on the line in the Call Stack View window that contains run This brings up the fibo c source for the main process in the Main View window Select the following from within the Call Stack View window to close it Admin gt Close Click on Continue Allin the Multiprocess View window The first child created in Step 5 now spawns a grandchild process that stops in _nsproc as shown here Note A Main View window switches to the new stopped process 143 Developer Ma
274. rray browser 258 array subscripts 259 array variables 4 258 assign dbx style command 313 assigning values to variables 102 At Source Line Traps menu option 254 Attach to forked processes Multiprocess View preferences option 209 attach dbx style command 313 auto fork application 135 Automatic dereference limit field in structure browser preferences box 285 B basic debugger usage 11 blocking anomalies and pthreads 155 boundary overrun 125 boundary underrun 125 breakpoint 3 breakpoint results viewing 174 breakpoint adding for a widget 167 breakpoints tab 172 breakpoints setting Fix Continue tutorial 118 breakpoints setting for a class 169 Build Analyzer to examine build dependencies 7 Build analyzer 335 build dependencies examine with Build Analyzer 7 Build environment window 308 Build manager 329 build path 109 Build view 329 343 Developer Magic Debugger User s Guide C C expressions 103 C function calls 104 C tutorial code example 15 C exception trap 72 C expressions 104 Call stack Views menu option 4 Call Stack selection in Views menu 58 Call Stack View 93 Call stack view 271 Call Stack View Window introduction to 28 Call Stack View with Fix Continue 311 Call Stack selection in views menu 192 call dbx style command 313 callback breakpoints examiner 230 callback context viewing 170 callback examiner 170 246 callstack view in X Motif
275. s as best as you can If you are using the Fortran 90 compiler after compiling with the preceding options and after running the generated executable under cva enter the following in the cvd pane cvd gt stop in __ 90 bounds_check Note __f90 in this command has two lead _ characters Now click on the RUN button Next select the following from the Main View window menu bar Views gt Call Stack View Next double click on the function or subroutine immediately below __ 90_bounds_check This will cause the source code for this function or subroutine to display in the Main View window and the line where cvd has stopped will be highlighted You can now find the value of the index that caused the out of bounds problem If you are using the FORTRAN 77 compiler after compiling with the preceding options and after running the generated executable under cvd enter the following in the cvd gt pane cvd gt stop in s_rnge Now click on the RUN button Next select the following from the Main View menu bar Views gt Call Stack View Double click on the function or subroutine immediately below s_rnge This will cause the source code for this function or subroutine to display in the Main View window and the line where the Debugger stopped will be highlighted You can now find the value of the index that caused the out of bounds problem 33 Developer Magic Debugger User s Guide Note For Fortran programs bounds
276. s in Expression View Program Results in Execution View Selecting a Function for Redefinition Redefined Function Stopping after Breakpoints in Redefined Code Comparing Compiled and Redefined Function Code Heap Corruption Warning Shown in Execution View Call Stack at Boundary Overrun Warning Main View at Bus Error Multiprocess View Examining Process State Using Multiprocess View Comparing Variable Values from Two Processes First View of the X Motif Analyzer Widget Examiner Widget Hierarchy Displayed by the Tree Examiner Adding a Breakpoint for a Widget Setting Breakpoints for a Widget Class Callback Context Displayed by the Callback Examiner Window Attributes Displayed by the Window Examiner Selecting the Breakpoints Tab from the Overflow Area Breakpoint Results Displayed by the Call Stack View User Defined Button Example Major Areas of the Main View Window Show Hide Annotations Button in the Main View Window Page 90 94 96 100 101 112 114 115 120 123 131 131 133 137 144 152 164 165 167 169 170 171 173 174 178 184 189 007 2579 005 Figure 59 Figure 60 Figure 61 Figure 62 Figure 63 Figure 64 Figure 65 Figure 66 Figure 67 Figure 68 Figure 69 Figure 70 Figure 71 Figure 72 Figure 73 Figure 74 Figure 75 Figure 76 Figure 77 Figure 78 Figure 79 Figure 80 Figure 81 Figure 82 Figure 83 Figure 84 Figure 85 Perf Menu and Subwindows Process Menu Sour
277. s specified a total of line_count lines are listed If function_name is specified the lines from the given function are listed 317 Developer Magic Debugger User s Guide list_changes func_spec all file filename Lists one or more lines using the following syntax change_id isEnabled filename function_spec For example 4 enabled foo c foo 8 disabled A c A bingo The default is list_changes all next int Steps over the specified number of source lines This command does not step into procedures The default is one line nexti int Steps over the specified number of machine instructions This command does not step into procedures The default is one instruction print expression expression Prints the value of the specified expression s If the expression is a character pointer or array both the string and address print You can use p as an alias printd expression expression Prints the value of the specified expression s in decimal format You can use pd as an alias printf string expression1 expression2 Prints the value s of the specified expression s in the format specified by the string string The printf command supports all formats of the IRIX printf command except s For a list of formats see the print 1 man page 318 007 2579 005 007 2579 005 Debugger Reference A printo expression expression Prints the value of the specified
278. s that 12 characters including punctuation and digits are viewable Allows you to display a single dimension of an array wrapped around the entire spreadsheet area The index value for an element is determined by adding the appropriate row index and column index values Figure 93 page 262 shows an example of a wrapped array There is only one index i The current cell is element 4 in the array by adding 3 and 1 261 Developer Magic Debugger User s Guide Gredow tA JENE i 1 2 E Current cell Figure 93 Example of Wrapped Array A 6 1 2 Format Menu The Format menu displays a separate menu that you allows you to display the elements in the following formats Default toggle Toggles the default format Value submenu Contains the following display toggles for formatted values e Decimal e Unsigned e Octal e Hex e Float e Exponential e Char e Wide Character e String Type Allows listing by data type Bit Size Allows listing by bit size 262 007 2579 005 A 6 1 3 Render Menu A 6 1 4 Color Menu 007 2579 005 Debugger Reference A The graphical display area presents array data in a three dimensional graph in one of the following formats e Surface polyhedron e Bar chart e Points e Multiple lines array vectors Note The Render tear off menu is available only if you are have a Silicon Graphics workstation with Open Inventor installed on it You select the grap
279. s the following options Seek animation Allows you to specify the time it takes for the time graph to be repositioned after you change the seek point Set to 0 for instant seek See also Seek to point lt or object gt Seek to point lt or Seek to point uses the picked point and object gt surface normal to align the camera Seek to object uses only the object center to align the camera Seek distance wheel This wheel controls how close to the camera the object will appear This distance can be either an absolute distance or a percentage of the distance to the picked point 007 2579 005 Camera Zoom slider Zoom slider ranges from Auto clipping planes Stereo Viewing Enable spin automation Show point of rotation axes A 6 2 Call Stack View Window Debugger Reference A This slider allows you to set in degrees the camera height angle only perspective camera If you wish you may set this value in the field immediately to the right of the slider Range is 1 0 to 140 0 by default but you can reset this if you wish Centers the graph in your view if enabled If disabled it allows you to move the graph out of view at either end of the z axis This is useful if you wish to focus on data above or below a set value This may be turned on to see the scene in stereo special glasses required The offset between the left and right eye can be specified using the camera rotation thumbwheel When selec
280. s to the right of the parent 007 2579 005 Debugger Reference A e Linked List Arranges nodes into a linked list formation that is horizontally Child a node Tree arrangement Parent Child node node as Child node Linked list arrangement First ____ Next __ Next node node node Figure 103 Tree and Linked List Arrangements of Structures Search Allows you to select structures in the display area that contain the string specified in the Expression field Search has the following four options e Name Selects structures whose names contain the specified string e Type Selects structures whose types contain the specified string e Field Name Selects structures that have a field whose name contains the specified string e Value Selects structures that have a field value containing the specified string Update Explicitly updates the displayed structures This happens automatically in the current Structure Browser when the process stops This can be used in an inactive Structure Browser to update it It can also be used to update the display after changes have been made in other Debugger views 007 2579 005 281 Developer Magic Debugger User s Guide Show Overview Brings up the Structure Browser Overview window Clear All Clears all structures from the display area A 6 5 5 Node Menu The Node menu gives you options that apply to currently selected objects
281. sage off a stream control device Performs a variety of control functions on devices and streams record locking on files Allow sections of a file to be locked open create a message queue message send and message receive synchronize memory with physical storage high resolution sleep open for reading and writing suspend process until signal is received input output multiplexing send a message on a stream read from a file 007 2579 005 007 2579 005 recv recvfrom recvmsg select semget semctl semop send sendto sendmsg sginap write writev pwrite Debugger Reference A receive a message from a socket synchronous I O multiplexing semaphore handling send a message from a socket times sleep and processor yield function write on a file 327 Using the Build Manager B WorkShop lets you compile software without leaving the WorkShop environment Thus you can look for problems using the WorkShop analysis tools Static Analyzer Debugger and Performance Analyzer make changes to the source suspend your testing and run a compile WorkShop provides two tools to help you compile e Build View for compiling viewing compile error lists and accessing the code containing the errors in Source View the WorkShop editor or an editor of your choice Build View helps you find files containing compile errors so that you can quickly fix them recompile and resume testing e Build A
282. se appear if the value has changed If you click the folded corner the previous value displays and the indicator appears unfolded You can then toggle back to the current value 007 2579 005 007 2579 005 Tutorial The jello Program 4 Variable Browser pid 18458 a C Change 2 98880882 indicator es Ea 117549421638 89859912e 39 so 5 88902966e 39 C Figure 19 Variable Browser after Changes 6 Select Close from the Admin menu in Variable Browser and Close from the Admin menu in Call Stack View to close them Select Expression View from the Views menu in the Main View window The Expression View window appears It lets you evaluate an expression involving data from the process The expression can be typed in or more simply cut and pasted from your source code You can view the value of variables or expressions involving variables any time the process stops Enter the expression in the left column and the corresponding value appears in the right column For more information see Section 7 3 page 99 Hold down the right mouse button in the Expression column to bring up the Language menu Then hold down the right mouse button in the Result column to display the Format menu The Language menu shown on the left side of Figure 20 page 62 lets you apply the language semantics to the expression The Format menu shown on the right side of Figure 20 page 62 lets you view
283. sequent experiment The Traps menu see Figure 25 page 74 offers the Set Trap and Clear Trap submenus and the Group Trap Default and Stop All Default menu options The Set Trap submenu offers submenus for managing breakpoints and sample points The following submenu selections are available Stop Stop At Function Entry Stop At Function Exit 007 2579 005 Sets a breakpoint at a designated line in your source code To set a breakpoint at a line displayed in the Main View or Source View windows 1 position the cursor on the appropriate line in the source code display area 2 select the Set Trap submenu 3 choose the Stop option Note The preferred method for setting a breakpoint is to click in the annotations area of the Main View window across from the line at which you want to set the breakpoint Sets a breakpoint at the beginning of a function To set a breakpoint at a function click on the function name in the source code display area and select the Set Trap submenu then choose the Stop At Function Entry option Sets a breakpoint at the end of a function To set a breakpoint at a function exit click on the function name in the source code display area and select the Set Trap submenu then choose the Stop At Function Exit option 199 Developer Magic Debugger User s Guide 200 Sample Sample At Function Entry Sample At Function Exit Sets a sample trap at a line displaye
284. ses new sproc d processes automatically As in the 209 Developer Magic Debugger User s Guide previous option if you create parent traps with the Trap Manager and specify pgrp the children inherit these traps automatically whether this flag is set or not Default is on Resume parent Restarts the parent process automatically when a after fork child is forked Default is on Resume child after Restarts the new forked process automatically attach on fork when it is attached If this option is left off a new process will stop as soon as it is attached Default is on Resume parent Restarts the parent process automatically when a after sproc child is sproc d Default is on Resume child after Restarts the new sproc d process automatically attach on sproc when it is attached If this option is left off a new process will stop as soon as it is attached Default is on Combine threads at Applies a collapsing algorithm to display threads same location stopped at the same location at the same time It is possible for threads to arrive at the same location through different logical routes Default is on Show Thread Status Displays thread status which is the user level vs Thread State status as opposed to showing thread state which is the kernel level status Default is status Show Hide Buttons When this option is ON the Continue All Stop All Step Into All Step Over All Sample All and Kill A11 buttons a
285. shows the Process Meter in its default configuration with only the User Time and Sys Time fields active 213 Developer Magic Debugger User s Guide A 2 4 1 Charts Menu 214 Admin Charts Scale User Time Sys Time Figure 62 Process Meter The Process Meter contains its own menu bar that contains the Admin Charts Scale and Help menus The Admin menu is the same as that described in Section A 3 1 1 page 217 The Help menu is the same as that described in Section A 1 10 page 205 The other menus are described in the following sections The Charts menu contains a set of toggles that allow you to choose which charts are displayed in the Process Meter window You can display as many charts simultaneously as you wish The following choices are available User Sys Time the default Major Minor Faults Context Switches Bytes Read Written Read Write Sys Calls Other Sys Calls Total Sys Calls Signals Process Size 007 2579 005 A 2 4 2 Scale Menu Debugger Reference A The Scale menu allows you to set the time scale for the processes displayed in the Process Meter window A menu allows you to choose a time scale from 2 seconds to 10 minutes A 2 5 Controlling Multiple Processes 007 2579 005 The Process menu allows you to control processes and threads Change focus to this entry Create new window Goto Details Add Bemove Figure 63 Process Menu
286. sted name for the startup file is cvdrc However you can select a different name as long as you specify its path in the CVDINIT environment variable The Debugger uses the following criteria when looking for a startup file e Checks the CVDINIT environment variable e Check for a cvdrc file in the current directory e Checks for a cvdrc file in the user s home directory 177 Developer Magic Debugger User s Guide 12 1 2 Implementing User Defined Buttons You can implement buttons by providing a special Debugger startup file or by creating them on the fly within a debugging session Buttons appear in the order of implementation in a row at the bottom of the control panel area Currently you can define only one row of custom buttons Figure 56 is a typical example of the Main View window with user defined buttons The definitions for the user defined buttons display in the Debugger command line area Views Query Source Display Data fraps PC Fix Continue Heip Custom button row Button specifications Multiple command example Figure 56 User Defined Button Example The syntax for creating a button is as follows button label command sel 178 007 2579 005 007 2579 005 Customizing the Debugger 12 The syntax for creating a multiple command button is as follows button label command1 Ssel command2 Ssel The button command accepts the following options label Specifies the b
287. sume child after attch on sproc in multiprocess tutorial 142 007 2579 005 Index Resume parent after fork Multiprocess View preferences option 210 Resume parent after sproc Multiprocess View preferences option 210 Return button description 20 Return button in the Main View window Main View Return button 90 return dbx style command 320 row column toggles in array browser 260 RUN button description 19 Run button in the Main View window 88 run dbx style command 320 runtime_check dbx style command 320 Sample At Function Entry 200 Sample at Function Entry selection in traps submenu 74 Sample at Function Exit selection in traps submenu 74 Sample at function exit selection in traps submenu 200 Sample button in the Main View window 91 sample session setting up for X Motif analyzer 162 sample session setup Fix continue 111 sample trap 72 sample trap command 77 Sample Trap Default Traps menu option 254 sample traps 3 save as text 218 224 Save as text selection in Source menu 195 Save as selection in Source menu 194 Save deactivated code during File Save toggle in Fix Continue Preferences dialog 204 Save expressions selection in Expression View gt Config menu 102 Save settings selection in admin menu 191 353 Developer Magic Debugger User s Guide Save traps selection in config menu in trap manager 84 Save selection in Source menu 194 save_changes dbx style command
288. t A corresponding trap command appears in the Trap text box in the Trap Manager window and the trap is added to the list on the Active Traps list of the same window Remember this trap will affect only the parent process Click on the Continue A11 button in the Multiprocess View window Note The parent process has stopped but the other processes are probably still running Insert the word pgrp that is process group after the word stop in the Trap field of the Trap Manager window The trap should now read Stop pgrp at As the command suggests pgrp affects the whole process group Click on the Modify button The trap now affects two child processes Watch the Multiprocess View window to see the running processes in the process group stop at the trap on line 32 Select the following from the Trap Manager window Traps gt Group Trap Default Note Now any additional traps that you set using the Trap Manager will affect the entire process group Any previously set traps will not be affected Select the text of line 23 found in the source pane of the Main View window associated with the parent process This line reads as follows 23 f_minus_1l f Select the following from the menu bar of the Trap Manager window Traps gt At Source Line 145 Developer Magic Debugger User s Guide The trap you have just set includes the modifier pgrp 10 Select the following from any Main V
289. t be satisfied first for the condition to be tested A condition is true if the expression valid in the language of the program you are debugging evaluates to a nonzero value 5 3 3 Setting a Trap Cycle Count The Cycle Count field in the Trap Manager window lets you pass through a trap a specific number of times without firing If you set a cycle count of n the trap will fire every nth time the trap is encountered The Current Count field indicates the number of times the process has passed the trap since either the cycle count was set or the trap last fired The current count updates only when the process stops 5 3 4 Setting a Trap with the Traps Menu 007 2579 005 The Traps menu of the Trap Manager window lets you specify traps in conjunction with the Main View or Source View windows Clicking At Source Line sets a trap at the line in the source display area that is currently selected To set a trap at the beginning or end of a function highlight the function name in the source display and click Entry Function or Exit Function 83 Developer Magic Debugger User s Guide 5 3 5 Moving around the Trap Display Area The trap display area displays all traps set for the current process There are vertical and horizontal scroll bars for moving around the display area The Search field lets you incrementally search for any string in any trap 5 3 6 Enabling and Disabling Traps Each trap has an indicator to its left for tog
290. t can be a share variable when multiprocessing the j loop The iold m and n are only read not written so they are safe The problem is with aggregate The person analyzing this code deduces that because j is always different in each iteration 3 10 will also be different Unfortunately since j 10 uses integer division it often gives the same results for different values of j While this is a fairly simple error it is not easy to see When run on a single processor the program always gets the right answer Sometimes it gets the right answer when multiprocessing The error occurs only when different processes attempt to load from and or store into the same location in the aggregate array at exactly the same time 10 3 2 1 Debugging Procedure 148 Perform the following to debug this code 1 Create a new directory for this exercise mkdir demos mp 2 cd to the new directory and copy the following program source into it cp usr demos WorkShop mp 3 Edit the total f file in a shell editor such as vi vi total f 4 Reverse the order of the iterations for demonstration purposes Replace 007 2579 005 007 2579 005 10 Multiple Process Debugging 10 This still produces the right answer with one process running but the wrong answer when running with multiple processes The local variables look right there are no equivalence statements and inew uses only simple indexing The likely item to check is aggregate Your
291. t of expressions displayed whenever the process stops With no arguments lists all expressions See undisplay to delete an expression down number Moves down the specified number of frames in the call stack down moves away from the direction of the caller dump Prints local variable values enable all Reactivates all inactive traps 315 Developer Magic Debugger User s Guide 316 enable_changes func_spec all file filename For C and C only when compiled with 032 Enables specified changes for selected functions for example enable_changes getNumbers file fmain c Nothing happens if the selected function is already enabled The latest accepted definition of the function is redefined on its next entry You can invoke this command when the process is stopped or on a running process when a function entry breakpoint is set enable trap_number trap_number Reactivates the specified breakpoint numbered trap_number as obtained from the list generated when the status command is issued expression count format or expression count format Prints the contents of the memory address specified by expression according to the specified format count represents the number of formatted items The following format options are available d Prints a short word in decimal D Prints a long word in decimal Prints a short word in octal Prints a long word in octal x Prints a short word i
292. t we can set a watchpoint to find out when it is written to This example has an address of 0x7fffaef4 your address will be different 007 2579 005 Bus error data PC at error line Entry to get bad address Problem address to be watched 007 2579 005 Detecting Heap Corruption 9 WorkShop Debugger pid 329742 Perf fraps PC Tar ron pointer File bab de allocbug corrupt c Read Only F 2 Stop exit ssmalloc_error file fdata clink a dpm bui 1lds ss_14 SpeedShap 1 4 ssmalloc ssmalloc c cvd gt run 2 Stop all _pgrp exit ssmalloc_error disabled Disabled 8 n Stop exit ssmalloc_error file data clink a dpm bui lds ss_14 SpeedShop 1 4 ssmalloc ssmalloc c 1 Process 329742 stopped at ssmalloc c 1187 xSfeb3f8 1 Process 329742 stopped at ssmalloc c 1107 xSfeb3fa 8 Process 329742 stopped at corrupt c 28 x10 8c74 cvd gt p amp bogus amp bogus Ox7fff2e28 cvd gt Figure 44 Main View at Bus Error 10 Deactivate the stop trap by clicking the toggle button next to the trap description in the Trap Manager window and click the Kill button in the Main View window to kill the process 11 Click on the Clear button in the Trap Manager window 12 Type the following command in the Trap field This includes the address you obtained from the Debugger command line see Figure 44 page 133 This sets a watchpoint that is triggered if a write is attempted
293. ted you can cause the camera to continue spinning To animate left click and drag in the direction of your desired spin then release while spinning The graph spins as if by a trackball To stop left click anywhere Displays a set of three axes You can move the graph around the x and y axes using the thumbwheel controls described in the previous section When this option is on you can set the size of the axes in pixels The Call Stack View Figure 98 page 272 window displays call stack entries when a process has stopped 007 2579 005 271 Developer Magic Debugger User s Guide Figure 98 Call Stack View The source display in the Main View window has two special annotations that are synchronized with the Call Stack View e The location of the current program state is indicated by a large arrow representing the PC The source line to which the arrow points is highlighted usually in green e The location of the call to the item selected in the Call Stack View window is indicated by a small arrow representing the current context The source line becomes highlighted usually in blue green The Call Stack View contains its own menu bar which contains the Admin Config Display and Help menus The Admin menu is the same as that described in Section A 3 1 1 page 217 The Help menu is the same as that described in Section A 1 10 page 205 The other menus are described in the following sections 272 007 2579 005
294. teps to load your source file directly into or run your executable from the Debugger Main View window e Enter the source file directly Enter the name or full pathname if necessary of the source file in the File field For example enter File jello c if you launched cvd amp from within the jello demos directory 007 2579 005 39 Developer Magic Debugger User s Guide e Enter the executable directly Enter the name or full pathname if necessary of the executable in the Command field For example enter Command jello if you launched cvd amp from within the jello demos directory 3 1 2 Load from the File Browser Dialog Box You can load source files from the File Browser dialog box available as follows from the menu bar of the Main View window Views gt File Browser The File Browser window is shown in Figure 8 usr demos WVorkShopi jello jello c AddDIC c AddSF c AllCells c AllPlanes c AllowEv c AuDispose c AuFileName c AuGetBest c Figure 8 File Browser Window 40 007 2579 005 Selecting Source Files 3 This dialog box provides you with a list of the source files that your executable file can use including any files in linked libraries locate a file To locate a file enter your desired filename in the Search field load a file To load a file directly into the Main View window from the File Browser dialog box simply double click on the file name Note Yo
295. tes at interrupts only 13 Select Close from the Admin menu to close the Trap Manager window 4 6 Examining Data This part of the tutorial describes how to examine data after the process stops 1 Select the following from the Main View window menu bar Views gt Call Stack The Call Stack View window appears as shown in Figure 17 page 59 The Call Stack View window shows each frame in the call stack at the time of the breakpoint with the calling parameters and their values Through the Call Stack View gt Display menu you can also display the calling parameters types and locations as well as the program counter PC The program counter is the address at which the program has stopped For more information about the program counter see Section 7 1 page 93 58 007 2579 005 007 2579 005 Tutorial The jello Program 4 In this example the spin and main stack frames are displayed in the Call Stack View window and the spin stack frame is highlighted indicating that it is the current stack frame Select the following from the Call Stack window menu bar Admin gt Active Notice that the Active toggle button is turned on Active views are those that have been specified to change their contents at stops or at call stack context changes If the toggle is on the call stack is updated automatically whenever the process stops Figure 17 Call Stack View at spin Stop Trap 3 Double click the main stac
296. th the command that cvd is executing Click Run in the Bounce window Note You will see no action until you have finished the next steps Select the following from the menu bar of the Bounce program window Actors gt Add Red Ball Click on the Kill button in the Main View window to terminate the process that has been running The Execution View shows the program output 007 2579 005 X Motif Analyzer 11 11 3 2 Launching the X Motif Analyzer Once the bounce fileset is built and the debugger is active you need to launch the X Motif Analyzer as follows 1 Select the following from the menu bar of the Main View window Views gt X Motif Analyzer 2 Click OK when asked if you want to change your LD_LIBRARY_PATH environment variables to include usr lib WorkShop Motif This includes instrumented versions of the Silicon Graphics libraries Xlib Xt and Xm These libraries provide debugging symbols and special support for the X Motif Analyzer Note There are no instrumented MIPS ABI versions of the libraries You are now ready to begin the sample session Note Follow the steps in this tutorial precisely as written 11 3 3 Navigating the Widget Structure When the X Motif Analyzer is launched it brings up the X Motif Analyzer window with an empty Widget Examiner tab panel The tab panels also show the Breakpoints Trace and Tree Examiner tab panels see Figure 48 page 164 007 2579 005 163 De
297. that were called to bring the Debugger to this place This call list will include not only your program functions subroutines but may also include system routines that have been used You can now move up or down the call tree by issuing for example cvd gt up n In this case the source code for a function or subroutine that is up n items in the call stack will appear in the Main View window If you omit n you move up one item in the call stack e You can select the following from the Main View window menu bar Views gt Call Stack View This brings up the Call Stack View window Calf Stack pid 3131186 Admin Config Display ir proa c i243 __start lt stripped crt1text s 177 Figure 6 Call Stack View Window If you double click on an item here the source code for the function or subroutine if available will display in the Main View window 007 2579 005 29 Developer Magic Debugger User s Guide 2 1 9 Stopping at Functions or Subroutines 30 In the debugging process it is sometimes useful to stop at each occurrence of a function or subroutine The Debugger permits you to do this in either of two ways e Using the cvd command message pane 1 Enter the following in the command message pane of the Main Window cvd gt stop in name For name specify the name of the function or subroutine in your program where you would like the Debugger to stop 2 Click on the Run button and the D
298. the following selections to annotate the displayed source code Show Line Displays or hides line numbers in the annotation Numbers Hide Line column corresponding to the source code Numbers Preferences Displays the Annotations Preferences dialog box which allows you to show or hide column annotations and menus specific to the different WorkShop tools If you have purchased ProDev ProMP you can display and manipulate loop indicators The Performance toggle displays experiment statistics The Tester module allows you to see coverage statistics Turning off the Performance toggle deletes the performance annotations from the Source View Hide Icons Show Hides or displays the annotation column which is Icons located to the left of the source code display area A 1 6 Perf Menu The Perf Performance menu see Figure 59 page 198 includes the following menu selections Select Task Allows you to choose the task for your submenu performance analysis The choices available are shown in Figure 59 page 198 You may select only one task per performance analysis run If none of the given tasks satisfy your requirements you can choose Custom which brings up the configuration dialog open to the General tab From here you can design your own task requirements 007 2579 005 197 Developer Magic Debugger User s Guide 198 Select Task Examine Results Contigs Configs Select Task submenu
299. the previously selected widget Shows you the widget s children It is grayed out if the selected widget does not have children Allows you to select the widget in the target process The Tree examiner see Figure 79 page 244 displays the widget hierarchy 243 Developer Magic Debugger User s Guide Figure 79 Tree Examiner You may double click a node to view that widget in the Widget examiner If the Tree examiner is currently selected it will not automatically fetch the current widget tree each time the process stops To force retrieval of the widget tree select another examiner and then go back to the Tree examiner Or click on the Tree tab The graphical buttons across the bottom of the Tree Examiner window from left to right have the following functions 244 007 2579 005 Debugger Reference A Zoom menu 100 J A 25 6 ram zil A Zoom Out button Oo Zoom In button Overview button Multiple Arcs button disabled Realign button Rotate button Search button Figure 80 Tree Examiner Window Graphical Buttons 007 2579 005 Zoom percentage indicator Zoom Out button Zoom In button Overview button Multiple Arcs button Realign button Rotate button Search button Widget View Type Option button Click on this indicator to bring up a submenu from which you can select a different percentage Decreases the zoom percentage Increases the zoom percentage Shows t
300. the same as that described in Section A 1 10 page 205 The other menus are described in the following sections A 6 3 1 Config Menu The Config menu contains the following options Load Save 274 Expressions Expressions Launches the Load Expressions dialog box that allows you to choose source file from which to load your expressions Launches the Save Expressions dialog box that a llows you to choose a file to which you can save your expressions 007 2579 005 Debugger Reference A A 6 3 2 Display Menu The Display menu contains the following option Clear All Clears all fields in the view A 6 3 3 Language Pop up Menu The Language pop up menu contains three buttons that allow you to select one of three languages for evaluation C C or Fortran The Language pop up is invoked by holding down the right mouse button while the cursor is in the Expression column A 6 3 4 Format Pop up Menu The Format pop up menu is displayed by holding down the right mouse button in the Result column Value Decimal Unsigned Octal Hex Float gt Exponential Format Char Default String Value Wide Character Type Address Of Bit Size Decimal Octal Hex Figure 100 Expression View Format Popup with Submenus 007 2579 005 275 Developer Magic Debugger User s Guide The Format popup contains the followi
301. ting to JOIN terminate Thread terminated DEAD Waiting on kernel READY Waiting on mutex MUTEX WAIT Sleeping in system RUNNING Gada A 2 2 2 Multiprocess View Control Buttons The Multiprocess View window uses the same control buttons as are in the Main View window with following exceptions e There are no Run Return or Print buttons in the Multiprocess View e The buttons in this view apply to all processes as a group e Using a control button in the Multiprocess View window has the same effect as clicking the button in each process s Main View window The following command buttons are available Continue All Stop All Step Into All Step Over Al Sample All Kill All These buttons operate identically to those described for the Main View window Section A 1 page 183 with the A11 option effect Refer to that section for descriptions of these buttons A 2 2 3 Multiprocess View Administrative Functions The Admin menu in the Multiprocess View window lets you perform several administrative functions Only the Save as Text Close and Exit items are described here All other options perform as those found in the Admin menu of the Main View window described in Section A 1 1 page 190 208 007 2579 005 Debugger Reference A Save as Text The process status list from in the Multiprocess View window is saved to the file you select using the Save Text dialog Launch Tool A 2 2 4 Controll
302. tion parse the new functions and continue execution of the program being debugged Fix Continue commands may be issued from the Fixt 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 page 107 for a comprehensive description of the theory and operation of Fix Continue including a short tutorial 1 3 Debugging with the X Motif Analyzer 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 the following from the Main View window to access this subwindow Views gt X Motif Analyzer See Chapter 11 page 159 for a comprehensive description of the theory and operation of the X Motif Analyzer including a short tutorial 1 4 Customizing the Debugger 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 page 177 for more tips on customizing the Debugger to your specific needs 8 007 2579 005 1 5 Additional Information 007 2579 005 WorkShop Debugger Overview 1 In addition to this manual and the manuals listed in About This Guide page 8 you should consult the following sources regarding the Wor
303. tion in the current program by placing the cursor in the line The process proceeds from the current program counter to that point provided there are no interruptions It then stops there as it would for a stop trap Continue To is equivalent to setting a one time trap If the process is interrupted before reaching your target location then the command is cancelled This tool lets you select a target location in the current program by placing the cursor in the line This location must be in the same function Instead of starting from the current program counter Jump To skips over any intervening code and restarts the process at your target This is particularly useful if you want to get around bad code or irrelevant portions of the program It also lets you back up and reexecute a portion of code 91 Developer Magic Debugger User s Guide 6 3 Execution View 92 The Execution View window is a simple shell that lets you set environment variables and inspect error messages If your program is designed to be interactive using standard I O this interaction will take place in the Execution View window Any standard I O that is not redirected by your Target Command is displayed in the Execution View window Note When you launch the debugger the Execution View window is launched in iconified form 007 2579 005 Viewing Program Data 7 After you set traps breakpoints in your program use the Ru
304. ts e Start the Debugger Section 4 1 page 47 e Run the jello Program Section 4 2 page 48 e Perform a Search Section 4 3 page 51 e Edit Your Source Code Section 4 4 page 53 e Set Traps Section 4 5 page 54 e Examine Your Data Section 4 6 page 58 Before you begin this tutorial you should be aware of the following e This tutorial must be run on an SGI workstation e WorkShop identifies files with the path names in which they were compiled The path names in the tutorial may not match the ones on your system 4 1 Starting the Debugger 007 2579 005 Use the following syntax to start the Debugger cvd pid pid host host executable_file corefile s Note The cvd command should be invoked in the same directory as your program source code e The pid option lets you attach the Debugger to a running process You can use this to determine why a live process is in a loop 47 Developer Magic Debugger User s Guide The host option lets you specify a remote host on which to run your program while the Debugger runs locally This option is seldom used except under the following circumstances You do not want the Debugger windows to interfere with the execution of your program on the remote host You are supporting an application remotely You do not want to use the Debugger on the target machine for any other reason Note The host and local machines must be running the same version of WorkShop
305. tting up the Sample Session Redefining a Function time1 Program Editing a Function Changing Code Saving Changes Setting Breakpoints in Redefined Code Viewing Status Comparing Original and Redefined Code Switching between Compiled and Redefined Code Comparing Function Definitions Comparing Source Code Files Ending the Session Detecting Heap Corruption 9 Typical Heap Corruption Problems Finding Heap Corruption Errors Compiling with the Malloc Library Setting Environment Variables 007 2579 005 Contents Page 107 107 107 108 108 109 109 109 110 111 111 112 113 115 118 118 121 121 121 122 124 124 125 125 126 126 127 vii Developer Magic Debugger User s Guide Trapping Heap Errors Using the Malloc Library Heap Corruption Detection Tutorial Multiple Process Debugging 10 Using the Multiprocess View Window Starting a Multiprocess Session Viewing Process Status Using Multiprocess View Control Buttons Multiprocess Traps Viewing Pthreaded Applications Adding and Removing Processes Multiprocess Preferences Bringing up Additional Main View Windows Debugging a Multiprocess C Program Launch the Debugger in Multiprocess View Using Multiprocess View to Control Execution Using the Trap Manager to Control Trap Inheritance Debugging a Multiprocess Fortran Program General Fortran Debugging Hints Fortran Multiprocess Debugging Session Debugging Procedure Debugging a Pthreaded Program
306. u may be unable to locate some files because the source supports system routines Source for these routines may not be available on your system 3 1 3 Load from the Open Dialog Box You can load source files from the Open dialog box available as follows from the menu bar of the Main View window Source gt Open The standard dialog box lists all available files and the currently selected directory in the Selection field You can change this directory as you wish 007 2579 005 41 Developer Magic Debugger User s Guide Makefile E cvstatic fileset File list cvstatic index display area cvstatic posting cvstatic xref jello jello c Selection Drop pocket Selection field Figure 9 Open Dialog Box There are several ways to load a file You can e double click on the file name e type the full pathname of the file in the Selection field and click the OK button e drag the file icon into the drop pocket Use an application like fm to produce file icons If you specify a file name without a full path the Debugger uses the current path remapping information to try to locate the file see Path Remapping Section 3 2 page 43 42 007 2579 005 3 2 Path Remapping 007 2579 005 Selecting Source Files 3 Path remapping allows you to modify mappings to redirect file names located in your executable file to their actual source locations on your file system Since WorkShop uses full that is absol
307. uble clicking on its value to the right of the pointer name This will bring up a new window showing what is being pointed at and an arrow will appear showing this relationship This can aid in debugging linked lists for example 2 1 7 Searching Often it is useful to search for the occurrences of a variable or some character string in your program so you can set breakpoints Perform a search as follows 1 Call up the search utility from the Main View window menu bar as follows to call up the Search window Source gt Search 007 2579 005 27 Developer Magic Debugger User s Guide Search type o Literal Case Sensitive Literal Case Insensitive Regular Expression Next Prev Reset Search Apply Cancel Close Help Figure 5 Search Window 2 Enter the character string for which you would like to search in this window then click on the Apply button All occurrences of this string are highlighted 3 Click on Cancel to remove highlighting 2 1 8 Using the Call Stack View As the Debugger executes it may stop during a program function or subroutine or in a system routine When this happens you can locate where the Debugger is in your program by examining the call stack There are two ways to examine the call stack e You can enter the following in the command message pane cvd gt where 28 007 2579 005 Basic Debugger Usage 2 This will list the functions and subroutines
308. ugging 10 10 1 1 Starting a Multiprocess Session Multiprocess control area _ Process display area The first step in debugging multiple processes is to invoke the Debugger with the parent process Then select the following from the menu bar Admin gt Multiprocess View The following figure shows a typical Multiprocess View window Figure 45 Multiprocess View 10 1 2 Viewing Process Status 007 2579 005 The process display area of the Multiprocess View lists the status of all processes and threads in the process group For definitions of the various status and states see Section A 2 2 1 To get more information about a process or thread displayed in the process display area right click on the process or thread entry A Process menu pops up which is applicable to the selected entry From this menu you can do the following e change entry focus e create anew window e focus attention to a user entered thread 137 Developer Magic Debugger User s Guide e show thread specific details e add or remove an entry For complete details about the Process menu see Section A 2 5 page 215 10 1 3 Using Multiprocess View Control Buttons The Multiprocess View window uses the same control buttons as the Main View window with the following exceptions e Buttons are applied to all processes as a group e There are no Return Print or Run buttons Control buttons in the Multiprocess View window
309. ught up by selecting the following from the Main View window menu bar Views gt Trap Manager This tool helps you manage all traps in a process Its two major functions are to e List all traps in the process except signal traps e Add delete modify or disable the traps listed The Trap Manager window appears in Figure 27 with the Config Traps and Display menus shown At Source Line Entry Function Exit Function l2 Stop Trap Default i Sample Trap Default Load Traps F Group Trap Default Save Traps l F Stop Ali Default Delete Ali Trap specification Admin Config fraps Display Trap condition Trap Stop at file usr demos Wc specification Condition Cycle Count Cycle Count Current Count a Current Count Trap controls Modify Add Clear Delete Active Trap Trap display area Search field Figure 27 Trap Manager Config Traps and Display Menus 76 007 2579 005 Setting Traps 5 5 3 1 Setting Single Process and Multiprocess Traps 007 2579 005 New or modified traps are entered in the Trap field Traps have the following general form stop sample a11 pgrp location condition The entry stop sample refers to the trap action You can set a default for the action by using the Stop Trap Default or Sample Trap Default selections of the Traps menu and omitting it on the command line The entries a11 and pgrp are use
310. ultiple Processes Me Ge o Gee ae a ae eS os a oak Se a a a 215 Ada specific Windows 6 we ee 216 Task View 4 2 oS amp 2 ce RB cee oe Goa ee Se Se obd SS 216 Admin Menu Be al Oe GR ned Se SO ae UR a ah te a as at oe a OM tat 217 ConfigMenu s 2 6 om peo oso RR a a a d 218 Tiavyout Men sad s s 2 2 chad oun BAY Re we a ae ek ee ee A a pu ts 218 Display Menu ke Se Rh Sy a a Ss Ce sea a ee ee hs eK es 218 x 007 2579 005 Exception View X Motif Analyzer Windows Global Objects Admin Menu Examine Menu Examiner Tabs Return Button Breakpoints Examiner Callback Breakpoints Examiner Event Handler Breakpoints Examiner Resource Change Breakpoints Examiner Timeout Procedure Breakpoints Examiner Input Handler Breakpoints Examiner State Change Breakpoints Examiner X Event Breakpoints Examiner X Request Breakpoints Examiner Trace Examiner Widget Examiner Tree Examiner Callback Examiner Window Examiner Event Examiner Graphics Context Examiner Pixmap Examiner Widget Class Examiner Trap Manager Windows Trap Manager Config Menu Traps Menu 007 2579 005 Contents Page 219 222 223 224 224 225 226 226 229 231 233 234 235 236 237 239 240 242 243 246 247 248 248 249 250 251 252 253 254 xi Developer Magic Debugger User s Guide Display Menu Signal Panel Syscall Panel Data Examination Windows Array Browser Window Spreadsheet Menu Format Menu R
311. uments lists signals to be trapped If a signal is specified it s added to the list If a11 is specified it traps all signals clearcalls Cancels pending function calls cont in function_name Continues execution from the current line to the entry to the specified function cont to line_number Continues execution from the current line until the specified line if there is not an intervening breakpoint to stop execution continue all Continues executing a program or all processes after a breakpoint You can use both c and cont as aliases for continue 313 Developer Magic Debugger User s Guide continue signal Sends specified signal and continues executing a program after a breakpoint corefile filename With no arguments reports whether data referencing commands reference a core file If so displays the current core file With filename provided specifies core file to be debugged delete all trap_number trap_number Deletes all traps The all option deletes all breakpoints delete_changes func_spec all file filename For C and C only when compiled with 032 Deletes changes corresponding to the selected functions for example delete_changes getNumbers file fmain c Once IDs are deleted you will not be able to use the IDs again because the IDs associated with the selected functions are released The default is all See also save_changes delete_source file
312. umpsize Once you have a core file you can perform the following analysis 1 You can find the place in your program where the execution stopped and the core file was produced by entering cvd executable core Here executable is the executable that you were running 007 2579 005 Basic Debugger Usage 2 The Main View window will come up and the source line where execution stopped may be highlighted in green 2 If the source line is not highlighted in green select the following from the Main View window menu bar Views gt Call Stack View 3 Double click on the routine closest to the top of the displayed list that is not a system routine You will probably recognize the name of this source file This will bring up the source code for this routine and the last line executed will be highlighted in green If the executable was formed by compiling with the g option then you can view values of program variables when program execution stopped To find the assembly instruction where execution stopped select the following from the Main View window menu bar Views gt Disassembly View Remember that this is the last statement executed before the core file was produced It therefore does not necessarily mean that the bug in your program is in this line of code For example a program variable may have been initialized incorrectly but the core was not produced until the variable was used later in the program 2 2 6 Step
313. und x87488880 background Gx a3fffff line_width 71 line_style LineSolid cap_style x f528dc4 join_style 1 JoinRound Till_style 32 fill_rule 32 arc_mode 1 ArcPieSlice tile 6 stipple x1 0076ba ts_x_origin 11 ts_y origin 5888 font subwindow_mode ClipByChildren graphics_exposures Figure 84 Graphics Context Examiner The Graphics Context examiner contains the GC text field that displays the address of the graphics context that is being examined You may change to a different context by entering a new address and pressing Enter A 4 10 Pixmap Examiner The Pixmap examiner see Figure 85 page 250 displays basic attributes of an X pixmap like size and depth It also attempts to provide an ASCII display of small pixmaps using the units digit of the pixel values 007 2579 005 249 Developer Magic Debugger User s Guide Admin Examine Pixmap 121634874 Colormap Size 9x32 Depth 8 Figure 85 Pixmap Examiner The Pixmap examiner displays the contents of an X pixmap To specify an X pixmap identifier enter a numeric expression in the top text field of the window Then use default as the colormap identifier to specify the default X colormap for your screen In the pixmap display left click on a pixel to see the pixel value position and red green blue intensities A 4 11 Widget Class Examiner The Widget Class examiner see Figure 86 page 2
314. ure 127 Build Options Dialog The steps in running a compile using Build View are as follows 1 2 Bring up the Build View window Edit the Target s and Directory fields as required Specify your preference regarding duplicate errors and warnings using the Admin menu optional Click Build to start the build All compile information displays in the transcript area Errors are grouped in a list below Click Interrupt to terminate or Suspend for a temporary stop if you want to stop the build The Resume button restarts a suspended build Double click an error to bring up your preferred editor with the appropriate source code A check mark indicates that an error has been accessed 007 2579 005 Using the Build Manager B Note The default editor is determined by the editorCommand resource in the app defaults file The value of this resource defaults to wsh c vi d which means run vi in a wsh window and scroll to the current line If the editor lets you specify a starting line enter d in the resource to indicate the new line number 7 Click Build to restart the build B 6 Build Analyzer Window 007 2579 005 The Build Analyzer window displays a graph indicating the source files and derived files in the build and their dependency relationships and current status Source files refers to input files such as code modules documentation data files and resources Derived files refers to output files such
315. ures saving them as text and closing the Structure Browser window the four additional menus contain options that allow you to change the way data is displayed The following data display menus are available Config Provides options for saving and reusing type specific formats and expressions You can also set preferences regarding how objects of a given type are to be displayed 007 2579 005 Debugger Reference A Display Provides display options for all objects in the display area Node Provides options for selected objects in the display area only Format Allows you to change or reformat a specific value in the result column To access this pop up menu hold down the right mouse button while the cursor is over the result column A 6 5 1 Using the Structure Browser Overview Window to Navigate WorkShop provides the Structure Browser Overview window from the Show Overview option in the Display menu as another way to navigate around the display This window is a reduced scale view of the requested structures The structures are represented by solid rectangles color coded by data type The relative position of the currently visible area is represented by a transparent rectangle This rectangle can be dragged using the left mouse button to change the display of the Structure Browser Clicking the left mouse button in an area of this window repositions the currently visible area A 6 5 2 Entering Expressions The Structure
316. us The Admin menu is the same as that described in Section A 3 1 1 page 217 The Help menu is the same as that described in Section A 1 10 page 205 The other menus are described in the following sections The Config menu contains the following items Load Traps Save Traps Brings up the Fil Le dialog allowing you to load the traps from a file Brings up the Fil Le dialog allowing you to save the current traps to a file 253 Developer Magic Debugger User s Guide A 5 3 Traps Menu The Traps menu has options that allow you to set traps under a number of conditions The following conditions are available At Source Line Highlight a line in the Main View window s source pane before selecting this option to set a breakpoint at the selected line Entry Function Highlight a function name in the Main View window s source pane before selecting this option to set a breakpoint at the entry to the function Exit Function Highlight a function name in the Main View window s source pane before selection this option to set a breakpoint at the exit from the function Stop Trap Default Causes a trap created to be a stop trap Toggles with the Sample Trap Default Sample Trap Causes a trap created to be a sample trap Default Toggles with the Stop Trap Default Group Trap Default ON OFF toggle to cause a trap created to have the pgrp option Stop All Default ON OFF toggle to
317. ushButtonGadget see in the Class text field rather than just the Run button See Figure 51 168 007 2579 005 X Motif Analyzer 11 XiMotit Analyzer pid 2498882 a a ee ee ynPushButtonGadaet_ Previous chicren setec _ activate Callback Figure 51 Setting Breakpoints for a Widget Class 4 Click Continue in the Main View window 5 Click Stop in the Bounce window The process now stops in the Stop button s activateCallback routine 6 Click the Callback tab in the X Motif Analyzer window to go to the Callback Examiner This examiner displays the callback context and the appropriate call_data structure see Figure 52 007 2579 005 169 Developer Magic Debugger User s Guide Callback Figure 52 Callback Context Displayed by the Callback Examiner 7 Double click the window value in the callback structure fourth line from bottom 8 Select the following in the Callback Examiner Examine gt Window The X Motif Analyzer displays the window attributes for that window the window of the Stop button Notice that the Window tab for the Window Examiner is added to the tab list See Figure 53 170 007 2579 005 X Motif Analyzer 11 Note You can also accomplish the same action by triple clicking the window value in the callback structure of the Callback Examiner Step 7 In general triple clicking on an address brings you to that object in the appropriate examiner
318. ute path names path remapping generally is not necessary However if you have mounted executable files on a different tree from the one on which they were compiled you will need to remap the root prefix to get access to the source files in that hierarchy ww The most basic remapping is for which allows you to specify the directories to be searched for files This basic function works just like dbx and can be modified by using use full_path_name and dir full_path_name in the command line Open the Path Remapping window as follows from the menu bar of the Main View window Admin gt Remap Paths 43 Developer Magic Debugger User s Guide 44 Switch Process Switch Executable Detach Load Settings Save Settings feonity Raise Launch Toot Project Exit Admin Views Query The following displays Substitution Set for a a T renser users vey ireo fconify Baise Remap Paths Project View Source Display Perf Fraps PC FixtContinue Figure 10 Path Remapping Dialog Box For each prefix listed in the Prefix list there is an ordered set of substitutions used to find a real file By default path remapping is initialized so that is mapped to the current directory The Substitution Set for list shows the substitution list for the currently highlighted item in the Prefix list You can perform the following operatio
319. utton name Button labels should be kept short since there is only room for a single row of buttons There can be no spaces in a label command Specifies one of the Debugger commands which are entered at the command line at the bottom of the Main View window See Section A 9 page 312 Ssel Provides a substitute for the current cursor selection and should be appropriate as an argument to the selected command commandn Specifies Debugger commands to be applied in order Commands must be separated by semicolons and enclosed by braces The multiple command button is a powerful feature it lets you write a short script to be executed when you click the button The following command displays a list of all currently defined buttons button The following command deletes the button corresponding to the label unbutton label You might use this command if you needed room to create a new button The effect of unbutton is temporary so that subsequently running the startup file reactivates the button The following command displays the definition of the specified button if it exists If the button does not exist an error message is displayed button label 179 Developer Magic Debugger User s Guide 12 1 3 Changing X Window System Resources While there are many X Window System resources that you can change we recommend that you avoid modifying these resources if at all possible In some cases there may be no way wit
320. ve Main View windows 16 Invoke the Variable Browser as follows from the Menu Bar of each process Views gt Variable Browser 17 Look at ii and jj in the following figure 007 2579 005 151 Developer Magic Debugger User s Guide Variable Browser pid 244530 a _ Variable Browser pid 10832 a Admin Variable Admin Heip Result Variable Result Figure 47 Comparing Variable Values from Two Processes They have the same values in each process therefore both processes may attempt to write to the same member of the array aggregate at the same time So aggregate should not be declared as a share variable You have found the bug in your parallel Fortran program 10 4 Debugging a Pthreaded Program 152 cvd supports the debugging of IRIX 6 4 and 6 5 pthreads You can view pthread creation and execution through the Multiprocess View window Through this window you can e View a hierarchal display of a threaded application e View a process pthread relationship e Expand individual call stacks C C and Fortran users should use the Multiprocess View window when debugging pthreads Ada users should use the Task View window The next sections give hints on debugging pthreaded programs list differences between 6 4 and 6 5 threads and illustrate how to debug a program that uses IRIX 6 5 pthreads 007 2579 005 Multiple Process Debugging 10 10 4 1 User Level Continue of Single 6 5 P
321. veloper Magic Debugger User s Guide 164 Figure 48 First View of the X Motif Analyzer Widget Examiner Widen the X Motif Analyzer window shown in Figure 48 page 164 This will make it easier to understand what you will be asked to do in this tutorial Click Run in the Main View window to re run the bounce program The instrumented versions of the Motif libraries will now be used When the Bounce window appears re size it to make it taller Click Run in the Bounce window Note You will not see any action until you perform the next steps Position the X Motif Analyzer and Bounce windows side by side 007 2579 005 X Motif Analyzer 11 6 Click on the Select button in the X Motif Analyzer window This brings up an information dialog and changes the cursor to a plus sign Note Do not click on the OK button in this dialog 7 Select the Step widget by clicking on the Step button in the Bounce window with the cursor as described in the cvmotif information dialog The Widget Examiner displays the Step widget structure 8 Click the Tree tab in the X Motif window The Tree Examiner panel displays the widget hierarchy of the target object see Figure 49 page 165 Figure 49 Widget Hierarchy Displayed by the Tree Examiner 007 2579 005 165 Developer Magic Debugger User s Guide 11 3 4 Examining Widgets 166 9 Double click the Run node in the tree Run is in the
322. view A sash between the compile transcript area and the error list area lets you adjust the lengths of the lists displayed See Figure 125 Transcript area Error list area Figure 125 Build View Window with Typical Data 331 Developer Magic Debugger User s Guide B 4 Error List Area The error list area consists of the error list display and three control buttons The following buttons are available Next Error Brings up the default editor scrolled to the next error location This button is below the error list display Rescan Refreshes the error list display Clear Clears the error list display area The error list area displays compile errors see Figure 125 page 331 The errors are annotated according to their severity level fatal has a solid icon and the warning icon is hollow Double clicking the text portion of an error brings up the default editor scrolled to the error location and displays a check mark to help you keep track of where you are in the error list Check marks also display when you click the Next Error button B 5 Build View Admin Menu The Admin menu in Build View has two selections in addition to the standard WorkShop entries e Build View Preferences Section B 5 1 page 332 e Build Options Section B 5 2 page 333 For information on Launch Tool Project and Exit menu selections refer to Section A 1 1 page 190 B 5 1 Build View Preferences 332 The Prefe
323. will be set in each instantiation of the template 007 2579 005 5 1 2 Trap Types Setting Traps 5 Traps can effect any of a number of actions in your debugging process The following is a list of the variety of traps and their functions 007 2579 005 Note See Section 5 3 1 1 page 78 for trap syntaxes A stop trap will cause one or all processes to stop In single process debugging a stop trap stops the current process In multiprocess debugging you can specify a stop trap to stop all processes or only the current process A pending trap is a trap with a destination address that does not resolve at the initial startup of the debugger it allows you to place breakpoints on names that do not yet exist By enabling pending traps you make unknown function names acceptable breakpoint locations or entries Because of this the trap manager will not error a pending trap off it if can not be found in the executable Instead when a dlopen of a DSO dynamic shared object occurs and the function name is found that matches the trap the trap is resolved and becomes active There are two ways to enable pending traps You can add the following line to your Xdefaults file AllowPendingTraps true You can enable pending traps by entering the following in the cvd gt pane of the Main View window set Spendingtraps true The default for this variable is false Note Only stop entry stop in and stop exit traps ca
324. wser Window Open Dialog Box Path Remapping Dialog Box The Main View Window with jello Source Code The jello Window The Search Dialog Search Target Indicators Stop Trap Indicator Trap Manager Window Call Stack View at spin Stop Trap Variable Browser at spin Variable Browser after Changes Expression View with Language and Format Menus Displayed Structure Browser Window with jello_conec Structure Structure Browser Window with Next Pointer De referenced Array Browser Window for shadow Matrix Subscript Controls Panel in Array Browser Window Traps Menu in the Main View Window Typical Trap Icons Trap Manager Config Traps and Display Menus Trap Examples Signal Panel and System Call Panel The Main View Window Control Panel Pop up Menu and Step Into Dialog 007 2579 005 Contents Page 28 29 31 40 42 44 50 51 52 53 56 57 59 60 61 62 63 64 65 66 74 75 76 78 85 87 89 XV Developer Magic Debugger User s Guide Figure 32 Figure 33 Figure 34 Figure 35 Figure 36 Figure 37 Figure 38 Figure 39 Figure 40 Figure 41 Figure 42 Figure 43 Figure 44 Figure 45 Figure 46 Figure 47 Figure 48 Figure 49 Figure 50 Figure 51 Figure 52 Figure 53 Figure 54 Figure 55 Figure 56 Figure 57 Figure 58 xvi Pop up Menu and Step Over Dialog Call Stack View Window Tracing through Call Stack View Expression View with Major Menus Displayed Change Indicator
325. xpressions Admin Contig Display Expression Result lfar Inear 8323871 jello_conec 8x 168036818 Editable Result field Decimal Unsigned Octal Hex Float Char String Default Value Type Decimal Address Of Octal Bit Size Hex Figure 35 Expression View with Major Menus Displayed To change the type of result information displayed in the right column hold down the right mouse button over the right column This displays the Format menu From here you can select the following e Select the Default Value menu to see the value as decimal unsigned octal hex float char or string characters e Select the Type Address Of menu to display the address in decimal octal or hexadecimal e Select Bit Size to specify the size of the result in bits 100 007 2579 005 Viewing Program Data 7 Caution The Debugger uses the symbol table of the target program to A N determine variable type Some variables in libraries such as errno and _environ are not fully described in the symbol table As a result the Debugger may not know their types When the Debugger evaluates such a variable it assumes that the variable is a fullword integer This gives the correct value for fullword integers or pointers but the wrong value for non fullword integers and for floating point values To see the value of a variable of unknown type use C type cast syntax
326. y distributed application 135 locate files with File Browser 41 lockf syscall that blocks continued pthreads 326 M Main View window 309 Command field 87 Continue button 88 control panel 87 Display menu 197 340 execution control buttons 88 general description 2 Kill button 88 350 PC menu 91 Run button 88 Sample button 91 Status field 88 Step Into button 88 Step Over button 90 Stop button 88 Main View window X Motif analyzer tutorial 162 Make Editable selection in Source menu 195 Make Read Only selection in Source menu 195 malloc call failing heap corruption error 126 malloc library compiling with 126 MALLOC_CLEAR_FREE_ PATTERN 127 MALLOC_CLEAR_ MALLOC 127 MALLOC_CLEAR_MALLOC_PATTERN 127 MALLOC_FASTCHK 127 MALLOC_FASTCHK environment variable and heap corruption errors 126 MALLOC_MAXMALLOC 128 MALLOC_NO_REUSE 128 MALLOC_TRACING 128 MALLOC_VERBOSE 128 managing source files 39 Maximize selection in structure browser node submenu 283 memalign call with improper alignment heap corruption error 126 memory locations 5 Memory View Views menu option 5 Memory view 299 Memory view mode menu 301 Memory View selection in views menu 193 menu selections and operations Fix Continue 201 Message window Admin menu 307 buttons 307 View menu 307 007 2579 005 Messages window 307 Minimize selection in structure browser node submenu 283 Minimum lines ar
327. your original and your modified code It contains the following options For Function Opens a window that shows you the differences between the original source and your modified source For File Opens a window that shows you the differences between the original source file and your modified version Set Diff Tool Launches the Fix Continue Preferences Dialog that allows you to set the tool that displays code differences The default is xdiff 1 For further information on the Fix Continue Preferences Dialog see Section A 1 9 3 page 203 007 2579 005 A 1 9 2 View Submenu Debugger Reference A This submenu allows you to open different Fixt Continue view windows It contains the following options Status Window Launches the Fix Continue Status window See Section A 8 1 page 302 for more information Message Window Launches the Fix Continue Message window See Section A 8 2 page 307 for more information Build Environment Launches the Fix Continue Build Window Environment window See Section A 8 3 page 308 for more information A 1 9 3 Preferences Submenu 007 2579 005 This submenu allows you to set various options for the Fix Continue environment such as the difference tool the external editor command and so on The menu contains the following options Show Preferences Launches the Fix Continue Preference Dialog that displays preferences currently enabled for the session and allows you to ch

Download Pdf Manuals

image

Related Search

Related Contents

OM, Flymo, Safety Book, 2006-01, EN, DE, FR, NL, NO, FI, SE, DK  TLS2200™ Thermal Labeling System  Datasheet  EUROPALMS Fountain, BUDDHA OF ENLIGHTENMENT User Manual  WL-1502 User`s Manual v1.2  1 - Movistar  A.O. Smith Power-Vent BTV-100 Specification Sheet  User Manual  Pyramix 7.1 Release Notes Installation  ÍNDICE PROPIEDAD INTELECTUAL  

Copyright © All rights reserved.
Failed to retrieve file