Home

gdb960 User`s Manual

image

Contents

1. gdb960 ICAP INUM n23 Col 10 The editor window in the background keeps track of the code you are debugging You can click in this window to specify information for debugger commands such as symbol names or lines of code The debugger in turn uses the attribute panel in the left margin of the editor window to show breakpoints and the execution context Using the gdb960 Windows Graphical User Interface Figure 3 2 The Debug toolbar near the top of Figure 3 1 shown by itself in Figure 3 7 has shortcuts for the most common debugging actions See Debugger Buttons for a description of each button The gdb960v buttons window provides you with options for connecting to a target board and opening a binary file Once you a open file this window provides you with the option of listing code The commands in the Debug menu Figure 3 2 include alternatives to the buttons in the Debug toolbar as well as other debugger functions Keyboard shortcuts shown to the right of the commands in the menu in Figure 3 2 are available for many graphical debugger commands The Debugger window at bottom right of Figure 3 1 is a command line interface to the debugger see The Debugger Command Line Window on page 3 38 This window is rarely needed because the graphical controls provide easy access to the most common debugger actions Many developers keep the Debugger window minimized The Debug Menu
2. Display the 1istsize lines preceding the last lines displayed Repeating a 1ist command with RET discards the argument so it is equivalent to entering list However the argument is preserved in repetition so that each repetition displays preceding lines in the file The 1ist command expects a user supplied zero one or two linespecs The linespec arguments specify source lines there are several ways of writing the 1inespec argument but the effect is always to specify some source line The following is a list of 1ist commands with possible arguments and descriptions of their effects list linespec list first last list last list first Tistet Lists Display 1istsize number of lines centered around the line specified by linespec Display lines from first to last Both arguments are linespecs Display listsize lines ending with last Display listsize lines starting with first Display the 1istsize lines following the last lines displayed Display the 1ist size lines preceding the lines last displayed Examining Source Files list Display listsize lines If the last lines displayed were displayed with a 1ist command the new lines follow them If the last line displayed was part of a stack frame display the new lines precede and follow it linespec Definition The display command argument 1inespec can be composed of a single argument or a combination of arguments The following is a list of pos
3. Displaying Program Data and Symbols In the following example function the variable a is usable whenever the program is executing within the function foo but the variable b is visible only while the program is executing inside the block where b is declared foo a int aj bar a int b test bar pis As a special exception you can refer to a variable or function whose scope is a single source file even if the current execution point is not in the currently selected file If there are two or more static file scope variables with the same name in two or more different files you can specify which one you want in the following manner block variable In this example block is the name of the source file in which the variable you want resides Assignment to Variables To alter a variable s value evaluate an assignment expression In the following example print stores the value 4 into the variable x and then displays the value of the assignment expression which is 4 print x 4 All C assignment operators are supported including the increment operators and and combined assignments such as and lt lt If you are not interested in seeing the assignment s value use the set command instead of the print command set does not display the expression s value and does not put it in the value history The expression is evaluated only for side effects For more information on the value history and exam
4. The help Command Used by gdb960 to find gdbinit and inputrc No defaults The debugger always looks in the current directory for gdbinit whether or not HOME gdbinit is found The debugger always takes input rc from the HOME directory Sets number of gdb960 commands to save in history file Default is 256 Sets name of history file Defaults are gdb_history in the current directory for UNIX hosts hist gdb in the current directory in Windows Used to set up screen width and height from termcap database Default is 80 x 24 Windows only If set send stdout and stderr to different streams Default is to mix stdout and stderr Sets the default baud rate Default is 38400 bps Command line b overrides G960BAUD The help command displays category or command specific help The help command syntax is as follows help option Displays information about gdb960 commands When option is acommand name help displays a paragraph on how to use the command With no arguments help displays a short list of command categories you can then enter the help command using one of the listed categories to replace option The result is a list of the individual commands in the specified category Configuring the gdb960 Environment The show Command The show command displays the gdb960 software debugger s internal state The following is the show command syntax show option Where option is one of the set command
5. next next count Similar to step but steps over function calls Execution halts when control reaches a new line of code at the stack level that was executing when the next command was given next is abbreviated as n A count argument is a repeat count as in step gdb960 Command and Option Reference nexti nexti count Executes one machine instruction but if it is a subroutine call proceeds until the subroutine returns count A count argument is a repeat count as in next output output fmt expression expression Display the value of expression and nothing but that value no newlines no nn The value is not entered in the value history For more information on expressions refer to Chapter 11 fmt expression Display the value of expression in format fmt For more information on format specifications fmt refer to Chapter 11 path path directory Adds directory to the front of the current search path If no directory argument is specified displays the current search path print print fmt expression Displays the evaluated value of exp and add exp to the value history where exp is an expression fmt expression Display the value of expression in format fmt For more information on format specifications mt refer to Chapter 11 12 23 gdb960 User s Manual 12 24 printf PEINEE Serving Expression es Prints formatted data string expression Display the value of expre
6. DEL unix line discard CITRE u Kill the text from the current cursor position to the end of the line Kill backward to the beginning of the line This is normally not bound to a key sequence Kill from the cursor to the end of the current word or if between words to the end of the next word Kill the word behind the cursor Remove the line input backward kill line Save the killed text on the kill ring Command Line Editing unix word rubout CTRL w Remove a word from line input Save yank CTRL y yank pop META y Specifying Numeric Arguments the text on the kill ring This is the same as backward kill word Yank the top of the kill ring into the buffer at the cursor Rotate the kill ring and yank the new top You can only do this if the prior command is yank or yank pop The following is a list of the command names their original bindings and short descriptions for specifying numeric arguments on the command line digit argument META 0 META 1 META universal argument Letting Readline Type For You Add this digit to the argument already accumulating or start a new argument META starts a negative argument Do what CTRL u does in Emacs By default this function is not bound to a key sequence The following is a list of the command names their original bindings and short descriptions for automatic completions on the command li
7. The profile command supports the two pass compilation systems of the 1960 compiler See your compiler user s guide for complete information on two pass compilation The gdb960 software debugger provides the profile command to store and retrieve profiling counts even if your target does not support file I O As you run an instrumented application the instrumented code generates information about the application and accumulates it in the application s memory space It is then necessary to save the information into a file on the host system to make it available for the second compilation pass This file is known as a profile file You can save this information yourself at any time during the debugging session and then retrieve it at a later time If your target system does not have a file system the debugger is the only way to save this information in a file profile clear Reset profile data area in target memory to all zeroes profile get filename Get profile data from filename and put it into the profile data area in target memory default file name is default pf profile put filename Store profile data from the profile data area in target memory into filename default file name is default pf gdb960 Command and Option Reference This chapter contains two sections The first is a list of possible command line arguments that you can use when invoking gdb960 The second section is a list of gdb960 commands and th
8. e Connected to the target e Opened a binary file reading its symbols and downloading its code to the target e Listed a source module or two You are now ready to debug your software as described in the next section Debugging With gdb960 Programs executing under debugger control execute normally and the debugger maintains control until e The program terminates e The program encounters a breakpoint e You interrupt the executing program via the debugger e An event such as a fatal error occurs Note that an interrupt for the executing program by itself will not cause the debugger to regain control CAUTION You must compile your application using debugging symbols g to use many of the features of the debugger Highly optimized code is best debugged with ELF DWARF file format Fe1 3 11 gdb960 User s Manual 3 12 You can interrupt program execution with Interrupt Debugger in the Debug menu by pressing CTRL BREAK in the Debugger command window or by using the keyboard shortcut ALT SHIFT F5 Debugger Buttons Figure 3 7 Debug Toolbar Debug amp x v tls lz t a The Debug toolbar shown as a floating palette in Figure 3 7 has buttons for the most common debugging commands Table 3 1 summarizes each button Table 3 1 Summary of Debug Buttons Button Description Button Description Download Next a Run program lt Continue bd Stop debugging Finish y Toggle brea
9. or just the portion You can set this value by including the r command line option when you initiate gdb960win as you would using the line oriented debugger see your system administrator for the specific name of the serial port on your system You can also set this option in the command window using the target mon960 lt portname gt command If needed specify the baud rate used to communicate with the target board The default setting is 38 400 BPS and is the maximum rate on UNIX You need only use this option to specify a slower baud rate than the default If you wish to use a parallel port for code downloading make sure the parallel cable is connected from target to host and enter the port name in the field provided To connect to the target press the connect button NOTE You can set variables so that the proper communication parameters are set automatically whenever you run gdb960 These variables are stored in the TCL configuration files For more information see Customizing the GUI on page 4 18 If you have not successfully connected to your target an error message appears in the command window Using the gdb960 UNIX Graphical User Interface When you have successfully connected to your target the following changes appear in the main window The Target Connect button on the toolbar disappears The No target portion of the status line becomes MON960 The Windows pull down menu appears which g
10. regardless of whether you have used this command Use the Down Stack Frame command to retrace your steps through the stack Like Up Stack Frame it changes only your view of the program not the program s state As you move up and down the stack frames the Backtrace window changes the highlight to the currently selected stack frame and the Register window contents change to reflect the register values associated with the selected stack frame Table 3 4 lists displays the toolbar button keyboard shortcut and Debug menu commands for using the Up and Down Stack Frame features Buttons for Navigating Up and Down the Stack Button Shortcut Debug Menu Command t CTRL U Up Stack Frame a CTRL D Down Stack Frame 3 21 gdb960 User s Manual 3 22 Table 3 5 Using the Auxiliary Debugger Windows When a program stops under debugger control you can examine local and global program variables arguments registers target memory and the execution stack Table 3 5 provides you with a summary of these window types Buttons for Bringing Up Auxiliary Debugger Windows Button Shortcut Debug Menu Command n a ALT 2 Inspect n a ALT 3 Locals n a ALT 4 Registers n a ALT 5 Memory n a ALT 6 Back Trace The sections below describe the Debug menu commands that open auxiliary windows for these purposes NOTE The sub windows described in this section update each time your program stops in the debugger Each update
11. regexp Searches by line starting with the one following the last line listed for a match for the regular expression regexp frame frame n addr When used with any of the arguments described with the break command selects a stack frame with no argument it does not change which frame is selected but still displays information about the currently selected stack frame The frame command can be used as an argument to into n Select frame number n where frame zero is the innermost currently executing frame frame_addr Select the frame at address addr 12 13 gdb960 User s Manual gmu detect define gmu detect define regnum access startaddress endaddress Controls the Guarded Memory Unit GMU detection registers Detection GMU registers are identified by number ranging from 0 to NUMDREGS 1 NUMDREGS is currently 6 on the Hx processors regnum Specifies the protection register number access Specifies which types of memory access cause a GMU fault The string has the form ModeType ModeType where Mode is either u user mode access or s supervisor mode access Type is a string of one or more letters from Table 12 1 An optional second modet ype may be given to program both user mode and supervisor mode in the same command An example of a valid access argument is urw sx which means fault on a user mode read or user mode write or a supervisor mode execute startaddress Evaluates to the st
12. 10 11 12 13 14 15 16 Set a breakpoint on line 10 gdb960 b 10 Breakpoint 2 at 0xe0008120 file hello c line 10 Continue execution until the second breakpoint is encountered gdb960 e Continuing Breakpoint 2 main argc 1l argv 0xe000d0c0 at hello c 10 10 buf it 0 Display the contents of the eighth element of the buf array gdb960 p buf 8 ad aa 2 Step to the next line gdb960 n it sercat but ya Lrs Display the string held in buf after executing the eighth line gdb960 p buf 2 hi there 000 000 000 000 000 000 000 Step to the next line gdb960 n 12 prince ss n buat Display the string held in buf after executing the eleventh line gdb960 p buf 3 hi there ya 11 000 000 000 000 Continue execution until the program terminates gdb960 c Continuing hi there ya ll Program exited with code 020 Quit the debugger gdb960 q Terminating old session with dev tty0l Running Your Program with gdb960 This chapter describes how to complete the following tasks e Run programs from the gdb960 debugger e Specify arguments for your program e Set the working directory for gdb960 e Set the environment for gdb960 Running Programs Complete the following steps 1 Make sure you recompile your software to include debugging information as described in Chapter 2 2 Run gdb960 and specify the name of the file that you w
13. Both the Add directory after selection and the Insert directory before selection options present you with a dialog where you select a directory name When you are finished modifying the search list press the OK button Using the Debugger Once you have connected to the target loaded the file and downloaded your program you are ready to use gdb960 s debugging features In this section you learn how to e List the code in C assembly language or mixed code e Set permanent or temporary breakpoints e Run the program e Step through your code 4 12 Using the gdb960 UNIX Graphical User Interface Code Display Options After you have loaded symbols from a file you have the option of displaying them in C assembly language or mixed code 1 Select the List mode menu The List mode menu appears 2 Choose the desired mode C Displays C source code Assembly Displays assembly language code Mixed Displays a combination of C and assembly language code Setting Breakpoints The debugger lets you set two kinds of breakpoints Y Breakpoints which stop execution at the indicated line of code each time the code is run Z Temporary breakpoints which stop execution at the indicated line of code the first time you run the program but then are deleted There are two methods for setting and removing breakpoints Point and Click Using the mouse select the line where you wish to insert or remove a breakpoint then pr
14. Gdb960 C testfiles test c agi File Edit View uA Debug Tools Window Help Source Search Path Download Shift F6 Run F6 eaaa eab960 Butiod 7 touco code Interrupt Debugger Stop Debugging Toggle Breakpoint Alt Shift F5 Alt F5 F9 Toggle Temp Breakpoint F8 Step Next Continue Finish F10 Ctrl F5 F5 Shift F5 Up Stack Frame Down Stack Frame Ctrl U Ctrl D Inspect Locals Registers Memory Back Trace Altt2 Altt3 Altt4 Altt5 Altt6 Adal a Directory to the Source Search Path 3 5 gdb960 User s Manual Connecting to a Target Now that you are more familiar with the parts of the debugger window you are ready to connect to a target board 1 If you have not already done so physically connect the target board to the host For details see Chapter 2 2 Press the Target Connect button in the gdb960v buttons pane You can also open File pull down menu select the Target Connect option and from the submenu select the type of media used for communication between the host and the target You can then skip step 3 below The Target Connect window appears 3 Select the type of media you are using for communication between the target and host Select the fastest media your hardware supports PCI is the fastest and is therefore the preferred media however in some cases you may need to use serial communications for your target board For details se
15. Readline Bare Essentials To enter characters into the line position the cursor and type Characters appear at the cursor position and the cursor moves to the right If you mis type a character you can use DEL to back up and delete the mis typed character Typing CTRL b moves the cursor to the left and CTRL moves the cursor to the right When adding text in the middle of a line notice that characters to the right of the cursor move right to make room for the text you are inserting When deleting text to the left of the cursor characters to the right of the cursor move left to fill in the blank space created The following is a list of input line editing commands and descriptions of their effects CTRL b Move back one character CTRL Move forward one character DEL Delete the character to the left of the cursor CTRL d Delete the character underneath the cursor Command Line Editing CTRL _ Undo the last input line change made You can repeat the undo command until only an empty line remains Readline Movement Commands Commands in addition to CTRL b CTRL f CTRL d and DEL allow rapid movement within a line Here are some commands for moving more rapidly about the line CTRL a Move to the start of the line CTRL Move to the end of the line META f Move forward a word META b Move backward a word CTRL 1 Clear the screen redisplaying the current line at
16. Setting Up Your Target Board To run your software you must have a target board connected to the host computer Target boards such as the Cyclone evaluation platform support communications via serial port parallel port or PCI bus The table below shows the host requirements for using each type of communication Communication Media Resource s Required Serial Communication e One available serial port Serial Communication e One available serial port Paralel Downlgag e One available parallel port PCI Communication e One available full length PCI slot Download fastest 2 1 gdb960 User s Manual If your PC host and target support PCI communication you will probably want to take advantage of the superior host to target transfer speeds that PCI communication provides See the MON960 Debug Monitor User s Guide for a list of i960 evaluation boards that support PCI communication Refer to your target board documentation for steps on connecting the board to your host system Using the MON960 Debug Monitor with gdb960 The MON960 debug monitor software is resident in ROM or Flash on all evaluation boards provided by Intel This software allows a debugger such as gdb960 to communicate with the evaluation board and view and modify memory If you are using a Cyclone evaluation board you probably do not need to install the files from the MON960 installation media since the software in your evaluation board is sufficient for all
17. The command list starts with the silent command so no output is produced and ends with the cont command so the program does not halt break 403 commands silent set x y 4 cont end Continuing Stepping The continue command allows you to re start a halted program continue cont Continue running the program where it halted If the program halted at a breakpoint execution resumes at the address of the breakpoint but the breakpoint is not taken Stepping means executing a line of code or set of lines according to restrictions set by the step command Control returns automatically to the debugger after one line of code Breakpoints are active during stepping and execution halts if a breakpoint is encountered on a machine instruction The step command may be given when control is within a function that has no debugging information Execution proceeds until control reaches another function or is about to return from this function The following is a list of stepping commands and their descriptions finish Continue execution until after the selected stack frame returns or until there is some other reason to halt such as a fatal signal or a breakpoint Display the value returned by the selected stack frame 8 13 gdb960 User s Manual next nexti nexti count step step count stepi stepi count until 8 14 Similar to step but function calls in a line are executed without halting or taking special a
18. Windows 3 24 variables assignment to 11 3 convenience 11 20 environment 2 9 program 11 2 vi command line mode B 12 virtual data formats 11 22 W Y watchpoints 8 5 deleting 8 6 hardware assisted 8 5 memory access 12 4 memory write hardware 12 37 setting 12 36 Windows gdb960 GUI 2 4 working directory GUI UNIX 4 4 yanking and killing B 10
19. gdb960 User s Manual 3 16 Table 3 2 3 Click the Download button to download the selected object modules to the target Debugging information for these modules is contained in each object module Setting Breakpoints To set a breakpoint 1 Place the text cursor in the line where you want the program to stop 2 Choose Toggle Breakpoint or Toggle Temporary Breakpoint Breakpoint Buttons Debug Menu Button Shortcut Command Description F9 Toggle Places a breakpoint that stops Breakpoint execution at that point each time you run the program Z F8 Toggle Places a breakpoint that stops Temporary execution at the selected point only Breakpoint once The debugger disables it automatically as soon as the program stops there The same breakpoint symbols used on the buttons for these commands mark breakpoints in the editor s left margin so that you can readily distinguish the two kinds of breakpoints If you try to create a breakpoint on a line that has no corresponding object code such as a comment line or a declaration the breakpoint appears on the next line that does have corresponding object code To remove either type of breakpoint select the breakpoint line then click the appropriate breakpoint command Using the gdb960 Windows Graphical User Interface Figure 3 8 NOTE f your application was compiled without debugging information the debugger displays an error when you try to set a break
20. into your home directory or if you already have a collection of lt 1 files into that directory Your system administrator can tell you where BaseOfTree is Edit emacs and add the line autoload gdb960 gud960 e1 nil Substitute the destination directory you used in step 1 if it is different from your home directory Make sure gdb960 can be found on your PATH The next time you start Emacs run the command gdb960 It asks for a command line in the same way that the Emacs command gdb does Enter the name of the 1960 processor program you want to debug followed by any other arguments you wish to pass to gdb960 If you have an earlier version of GNU Emacs 1 Copy the file gdb960 e1 from the GNU 960 source code tree BaseOfTree src gdb960 common gdb960 e1 into your home directory or if you already have a collection of lt 1 files into that directory Your system administrator can tell you where BaseOfTree is gdb960 User s Manual 2 Edit emacs and add the line autoload gdb960 gdb960 e1 nil Substitute the destination directory you used in step 1 if it is different from your home directory Make sure gdb960 can be found on your PATH The next time you start Emacs run the command gdb960 It asks for a symbol file in the same way that the Emacs command gab does Enter the name of the i960 processor program you want to debug After you see the gdb960 prompt use the gdb960 tar
21. the top Notice how CTRL moves forward a character while META moves forward an entire word It is a loose convention that control keystrokes operate on characters while meta keystrokes operate on words Readline Killing Commands Killing text means to delete the text from the line but to save it away for later use If the description for a command says that it kills text then you can retrieve the text later The following is a list of commands for killing text CTRL k Kill the text from the current cursor position to the end of the line META d Kill from the cursor to the end of the current word or if between words to the end of the next word B 3 gdb960 User s Manual B 4 META DEL Kill from the cursor to the start of the previous word or if between words to the start of the previous word CTRL w Kill from the cursor to the previous white space This is different than META DEL because CTRL w kills to first white space rather than to first white space before a complete word Yanking text means retrieving the text from the kill buffer If the description for a command says that it yanks text then the command places previously killed text at the cursor position The following commands yank the text back into the line CTRL y Yank the most recently killed text back into the command line at the cursor location META y Rotate the kill ring the list
22. unset environment configuration 7 3 until execution 8 14 up selection 9 4 user defined 12 10 13 1 watch watchpoint 8 6 whatis display 11 17 where display 9 3 wwatch watchpoint 8 6 x display 11 1 11 11 11 14 comment lines 5 2 comments 13 4 compiler g option 2 3 complaints 5 13 convenience variables 11 20 conventions notational 1 6 conversions type 11 15 customer service 1 8 D data examining 11 1 data type display 11 17 12 36 debugger display attribute setting 12 32 features of 1 1 set attribute 12 27 Index 3 gdb960 User s Manual Index 4 debugger continued symbol 11 19 UNIX GUI 4 1 back tracing 4 17 connecting to target 4 5 creating a new file 4 18 customizing 4 18 debugging 4 12 editing source code 4 18 exiting 4 18 listing code 4 9 4 13 online help 4 2 opening a file 4 8 overview 4 3 printing 4 17 program navigation 4 14 register values 4 16 running 4 2 running a program 4 14 search path 4 11 setting breakpoints 4 13 stack viewing 4 16 stepping through a program 4 14 working directory 4 4 Windows GUI 3 1 back tracing 3 25 command window 3 37 connecting to target 3 6 debugging 3 11 downloading 3 15 expression values 3 22 files editing 3 32 listing code 3 10 memory viewing 3 26 opening a file 3 9 overview 3 4 program navigation 3 17 register values 3 25 running a program 3 17 search path 3 7 setting bre
23. when either Disassembly or Mixed is selected from the View menu or the current routine has no debugging symbols In this case Step advances execution to the next machine instruction rather than to the next source line The display style has the same effect on Next as on Step thus Next causes the program to run through a call instruction and stop on the next source line Using the gdb960 Windows Graphical User Interface Table 3 4 Viewing Alternate Stack Levels Each function call creates a new stack frame A stack frame contains auto variables local variables and register values for the called function The Backtrace window displays all active stack frames The Backtrace window can be opened with the menu command Debug Back Trace or Alt 6 The deepest frame 0 is where program execution stopped The debugger displays data symbols and source code from the current stack frame This also means that which variable definitions are visible depends on the selected stack frame The data for that frame is related to the function which created the frame The Up Stack Frame command in the Debug menu selects the context to the current function s caller You can then click it again to get to function s caller stack frame and so on This command does not change the location of the program counter it only affects what data symbols and source code are visible If you continue or step the program execution still takes up where it left off
24. 12 33 SLO Diesecseaceistectcesceecteessdeckees cee eves E 12 33 SVMDOM TG faste eoe toe ceteade abet ERR 12 33 tAr gO te tence ane aetden cetel anes evtads tear ita arid 12 34 11 8 GPR Ree ESA a ee eee ee 12 34 14 018 fat Pee eee a PP EP 12 34 Contents LINSOT hae a a e Gs deei etna dts Babette 12 35 U lissisbsehanidrnesd vices a a e cimeeaaueebeaten 12 35 OT o ex PEET ET E EA E 12 35 UD Silently iiien aE A Ea EE aa ee 12 36 WAC D ERIA EENE TE EA E 12 36 Whats ig as sated aeatneed as udedadvintind kav Geese eds iokaneiane 12 36 WWI sick concedes AE tds Sod E TAA Wile evden davon 12 36 wwate Mi icnsaid an tuasaualeeuuds tases a E A A EA 12 37 r O I E E E E AAT 12 37 Chapter 13 Storing Commands User defined Commands sirctawiiecctctescdeuiii cheer cotter dette 13 1 User defined Command Hooks ccceeeeceeeeeteeeeees 13 3 Command Files rca nee eie ieee E ea 13 4 Commands for Controlled Output 0 ccceeeeeeeeeeeeeeeeteees 13 5 Appendix A Using gdb960 Under GNU Emacs Setting Up gdb960 in EMacs cccccceeeeeeeeeeeeeseeeeeeeeees A 1 If you have GNU Emacs version 19 or greater A 1 If you have an earlier version of GNU Emacs A 1 Either versiOM ene ee E E EREE A 2 Using Emacs Commands with gdb960 cceeeeeeeeees A 3 Appendix B Command Line Editing Introduction to Line Editing sacks dsscteicestateed iesneisedet B 1 Readline Interaction cceececsccccce
25. 14 expressions 11 1 features 1 1 internal state 5 7 invocation arguments 12 1 invocation example 6 2 invoking 2 9 gdb960 continued manipulating history B 8 quitting 5 14 12 25 read commands 12 32 setting up in Emacs A 1 working directory 12 25 GNU history library C 1 Index 5 gdb960 User s Manual graphical user interface using 4 1 Guarded Memory Unit GMU 8 17 commands 12 14 syntax and arguments 12 17 GUI UNIX 4 1 back tracing 4 17 connecting to a target 4 5 creating a new file 4 18 customizing 4 18 debugging 4 12 editing source code 4 18 exiting 4 18 listing code 4 9 4 13 online help 4 2 opening a file 4 8 overview 4 3 printing 4 17 program navigation 4 14 register values 4 16 running 4 2 running a program 4 14 search path 4 11 setting breakpoints 4 13 stack viewing 4 16 stepping through a program 4 14 working directory 4 4 Index 6 GUI Windows 3 1 back tracing 3 25 command window 3 37 connecting to a target 3 6 debugging 3 11 downloading 3 15 expression values 3 22 files editing 3 32 listing code 3 10 memory viewing 3 26 opening a file 3 9 overview 3 4 program navigation 3 17 register values 3 25 running a program 3 17 search path 3 7 setting breakpoints 3 16 source code viewing 3 29 stack viewing 3 21 starting 3 3 stepping through a program 3 17 symbol values 3 22 text editor 3 32 attributes 3 36 customizing 3 36 fo
26. 3 36 Customizing the Text Editor eee eeceeeeeeeeeeeeeeeees 3 36 Setting the Attribute Pane eeeeeeeeeeeeeeee 3 36 Changing the Tab Settings eeeeeeeeeee rete 3 36 Changing Font Type and Font Size cccccee 3 37 Changing Syntax Coloring in a Source File 3 37 The Debugger Command Line Window cceeeeeee 3 37 Using the gdb960 UNIX Graphical User Interface OCI IG Wire iera a e e et A e ai na 4 1 ROMO Dies oe artek cathe dete Mik Ae e nek eek ee lee 4 2 Running the GUI DebUuggel cceeeeeeeseeeeeeeeeeeeneneeeees 4 2 A Sketch of the Debugge ccccccceeeeeeeeesesseeeeeeeeeeeees 4 3 Setting the Working DireCtory ccccceceeeeeeeeeeeeeeeeeeeeeees 4 4 Connecting to a Target ccceceeeeeeeeeeeeceeeeeeeeeeeessseeeeeeeees 4 5 Openingra Filet is5 ciece ace a Maui A ad 4 8 Listing Code S508 5 Oo he accu aes het enraeaan saan Seca 4 9 Setting the Search Directories cccccccccccessssssesssssseeees 4 11 gdb960 User s Manual vi Chapter 5 Using the Debugger icici ence ate rate tien tants coat eats ole ott beta sae 4 12 Code Display Options wisicsesetciceeehiaeesdeneits ehh aed dati eee 4 13 Setting Breakpoints cece ee ceeeeeeeeeeeeeeeeeseeeeeeeeees 4 13 Running Your Program iis iccceisetitectenteetetattecgetiethteesest 4 14 Using the Up and Down Stack Frames Feature 4 16 Viewing the Contents of Registers 4 16 Using the
27. Backtrace WiNdOW ccceeeeeeeeeeetteeeeeeeees 4 17 Using the Print Print Star Options eeeeeeeeees 4 17 Editing Source Code orccsatcls ci tarde ootas idee wets omen enced 4 18 Creating a New File eiseccciscieceesaeieranniaeeh aaeion ee ae 4 18 Exiting the DEDUGQOSl 2 ssisrscstaccdocevtaeesnnrscdeaceteaapeasbascindiepeieees 4 18 Customizing the GUI wesc sccietecayteasreeh pet etetoadad athena nina 4 18 Configuring the gdb960 Environment Rules for Using gdb960 Command5 ccceeceeeeeeetees 5 1 File specifying Options cscs cctssicsnt ccursiectionsiteiey aed ivebiets 5 2 gdb960 Environment Variables ccceeeeeeeeeeeeeeeeeeeee 5 5 The help COMMA csccscctetectee hunk ae et dadaecadareieene 5 6 The SHOW Command 20 00 eee ee eee ce eeeeeceee cece eee eeeeeneaeaeeeeeeeeeeeeee 5 7 The info GOMMANG sett tea e nih ar eareeee edn tutes 5 7 The set prompt COMMANGA cc eeeeeeeeeeeeeeeetteeeeeeeeeeteeee 5 8 Command Line Editing sich iAwa lies ceils 5 8 Using the History Feature ceeeeceeeeeeeeeeeeeeeeneeeeeeeeeeeeeee 5 9 Hist ry EXPANSION sires tharee aiid ar eee 5 10 shell and make COMMANAS ccceeeeeteeeetteeeeeeeeeeteeeeeee 5 11 SCIEGI SIZE wae ie cess ra tide S a cate eis 5 11 Setting MACIX het niee Ot eeG lea te oh et ela e eaters 5 12 Messages Complaints and Cautions cceeeeeeee 5 13 Exiting gdb960 2 coho eden de hag cntdenpeveer eecaicegrchar teat
28. MONS960 to crash See the next section for examples of using these commands Using gdb960 With ApLink The Cx Jx and Hx ApLink compatible versions of MON960 are not configured to enable the active memory regions on the target connected to ApLink Consequently debugger access to target memory and or peripherals is by default impossible However ApLink aware debuggers such as gdb960 R5 0 and later support several new commands to dynamically enable processor memory regions following monitor boot Using gdb960 with ApLink Cx Configuration To configure memory regions for a Cx based target you need only to modify the processor s memory region configuration registers For more information on those registers refer to the description of the processor s bus controller in Chapter 10 of the i960 Cx Microprocessor User s Manual The following example shows gdb960 syntax that enables DRAM in memory regions C and D of an EP80960CX target connected to ApLink e gt gdb960 r comli b 57600 gdb960 mcon e 0x900003 d cache on 32 bit little endian ready set burst set gdb960 mcon d 0x900003 d cache on 32 bit little endian ready set burst set Jx Configuration Configuring memory regions for a Jx based target is discussed in Chapter 12 of the i960 Jx Microprocessor User s Manual When the Jx s DLMCON dcen bit is not set a region containing noncacheable memory mapped peripheral s may be enabled by simply us
29. Manual 12 4 aplink switch aplink switch region mode Changes ApLink modes region is a hex constant mode is a decimal constant aplink wait aplink wait Executes the ApLink wait command awatch awatch expr Sets a memory access hardware watchpoint Memory access watchpoints halt program execution when any read or write is attempted at the address of expr backtrace backtrace n Displays a backtrace of the entire stack one line per frame for all frames in the stack You can stop the backtrace at any time by typing the system interrupt character normally CTRL C n Display only the innermost n frames n Display only the outermost n frames gdb960 Command and Option Reference break break argument options Sets a breakpoint address break filename function filename linenum function if Cond linenum effset Set a breakpoint at address Set a breakpoint at entry to function in filename Set a breakpoint at line Jinenumin source file filename Set a breakpoint at entry to function Set a breakpoint with condition cond evaluate the expression cond each time the breakpoint is reached and halt only if the value is non zero An ellipsis stands for one of the possible arguments described above or no argument specifying where to break Set a breakpoint at 1inenum in the current source file the source file corresponding to the currently se
30. NULL environment can be abbreviated env show environment Show the value of environment variable varname varname or all variables if varname is omitted unset environment Remove the variable varname from the varname environment If varname is omitted remove all environment variables path directory Add directory to the front of the PATH environment variable the search path for executables You may specify several directory names separated by or white space or white space on Windows 7 3 Program Execution Control This chapter describes the features of the gdb960 debugger that allow you to halt examine and restart your program A debugger allows you to interrupt program execution to inspect the internal state of the program The gdb960 debugger provides breakpoints conditional breakpoints and watchpoints to monitor execution and halt execution at instructions you have identified or when conditions you have defined develop Breakpoints A breakpoint halts program execution when the execution point reaches a pre selected instruction in the program Set breakpoints explicitly with gdb960 commands specifying by line number function name or exact address the line on which the program should halt execution Conditions describing the internal state of the program can be added to breakpoints When the breakpoint is encountered the debugger interrupts the programs operation and evaluates the stop cond
31. Once the breakpoints are set they are treated just like the breakpoints set with break They can be deleted disabled made conditional and so forth in the standard ways The gdb960 debugger converts the expression to an address 12 25 gdb960 User s Manual 12 26 regs regs Displays non floating registers as two columns of hexadecimal numbers Output is suitable for a 24x80 display This command is an Intel modification to GNU gdb reset reset Sends a break to the remote target board with MON960 attached through a serial line useful only if the target board has a circuit to perform a hard reset or some other action when a break is detected reverse search reverse search regexp Searches backward for a text match on each line regexp Check each line starting with the one preceding the last line listed for a match for regexp Lists the line that is found The command abbreviation for reverse is rev run run arguments Before executing the run command you must use the file command exec file command or an argument to gdb960 to specify the program The run command initiates execution at the location it has recorded as the start of the program Program arguments are specified in arguments gdb960 Command and Option Reference search search regexp Searches forward for a text match on each line regexp Check each line starting with the one following the last line listed for a match for regexp L
32. a supervisor mode execute Evaluates to the starting address of the protection range Evaluates to a number describing the addressing constraints for this range For more information refer to the i960 Hx Microprocessor User s Manual gdb960 User s Manual 12 16 Table 12 1 Access Types Access Type Access Type Symbolic Name Read r Write Execute Data Cache Write None clears previous settings 53 0 x s gmu protect disable gmu protect disable regnum Disables the specified GMU protection register Specifies a GMU protection register number Clears the memory protection enable bit for this register in the GMU control register If regnumis omitted disables all GMU protection registers gmu protect enable gmu protect enable regnum Enables the specified GMU protection register Sets the memory protection enable bit for this register in the GMU control register If regnum is omitted enables all GMU protection registers gdb960 Command and Option Reference hbreak hbreak args Sets a hardware breakpoint on a specified line or function The arguments list allows the same arguments as are listed in the break command and the breakpoint is set in the same way Hardware breakpoints allow breakpoints in non writeable code e g code that resides in ROM or FLASH Breakpoints set with the break command are silently ignored when set in code that resides in non writeable memory You can set any number of
33. before becoming silent about the problem The default is zero off Set 1imit to a large number five is reasonable to prevent complaints from being suppressed show complaints Displays how many symbol complaints gdb960 is permitted to produce 5 13 gdb960 User s Manual 5 14 By default gdb960 provides cautions in its queries for information For example if you try to run a program that is already running the debugger displays the message shown in the following example gdb960 run The program being debugged has been started already Start it from the beginning y or n You can use these options to enable or disable this feature set confirmoff Disables cautions set confirmon Enables cautions the default show confirm Displays state of cautious questions Exiting gdb960 To exit the gdb960 software debugger use the quit command abbreviated q or type an end of file character usually CTRL d An interrupt often CTRL c does not exit from gdb960 but terminates the action of any gdb960 command that is in progress and returns control to the gdb960 command line Example gdb960 Session This chapter contains an example session of the gdb960 Software Debugger The session provided here uses a variation on hello world In the example you perform the following tasks list the program compile the program invoke the debugger load the program set a breakpoint list lines set another breakp
34. cite ticede cuidate eadeiie uns 3 12 The Debug MeNUen ic daha dees len aaa cts 3 15 Downloading a Module cccceeeeeeseeeeeeeeeeeeeeeeeees 3 15 Setting BreakpoOints cece cecceeeeeeeeeeeeeeeeeetneeeeeeees 3 16 Navigating through a Program ecccceeeeeeeeeeettteeeeeees 3 17 Viewing Alternate Stack Levels ccceeeeeeeeeeetees 3 21 Using the Auxiliary Debugger WindowS e 3 22 DS EELO E eee E ee BT cee eg 3 22 LAC AIS casera ceieieua res A tas cg eld cuates hee nehe tua re chad 3 24 Back Trace ct nie a e ira Gunter Aa 3 25 Registers ii ae ia E E ted eee 3 25 DIGI OY 2 eed de GA denne eet eee de Renee 3 26 Contents Chapter 4 Using the gdb960v Text Editor cece cceeeeeeeeeeeeeneeeees 3 32 Editing a File scsccsebeivasentepheptacweh bausy chee R 3 32 Opening File mrret a nre ESEE EANAIR 3 32 Creating a New Text File ccccceceeeeeeeeseeeeeeeeeeees 3 33 Cutting Copying and Pasting Text eeeees 3 34 Moving to a Line ssce setae tdeeusetotiiieh deel eae oad 3 34 Finding a Text SUG xenie de Sesceat detent seteedeenkviaiess 3 34 Finding and Replacing Text ceeeeeeeeeeeeeeeeee 3 34 Printing the Contents of an Active Window 3 35 Customizing a Print JOD cicccesiieciieeeceitneneient 3 35 SAVING a FING scrire e Ee ea aeeai 3 35 Saving A New File or Renaming an Existing One 3 36 Setting the Save Options eee eee eee
35. ee a ee A tai nesianes 2 4 Starting the gdb960 Windows Graphical User mternaca enet aaa E a a aia 2 4 Starting the gdb960 UNIX Graphical User Interface 2 4 Starting the Command Line Interface ccccee 2 5 Changing Your Target Settings After Starting GDI GOs i ceacneieGeacktctdecnuente EIA TT EAE 2 6 HDIL ArgUNE NiS ist ta ae a a E RR 2 8 iii gdb960 User s Manual Combining Serial Communication and PCI Downloading seis hahetae aha dehaa ind hactidadaareapeliise es 2 8 Emacs INVOCAtION cccccceccceceseeeeeeeeeeeteeeseeeeeaeaeees 2 9 Batch Mode Invocation cccceeceeeeeceeseaeeeeeteeeneees 2 9 MOC ODIONS nenen eet eet e 2 9 Chapter 3 Using the gdb960 Windows Graphical User Interface OVEINIG Ws concn es Cachan ea tase see aniesae eens 3 2 Online le Sayer eereper ery rence ert teria error rrr rerer Toner merer 3 2 Starting and Stopping the DebUQQET ccceeeeeeeeeee 3 3 Starting the Debugger sisceeiel at adeuracuntetceimdnd meta cbonnas 3 3 Stopping the DebDuUgQGel cccceeeeeeeeeeeeeeeeeeeeeeeeeees 3 3 A Sketch of the Debugger i lt icicitacnde la cnnedeveeie 3 4 Connecting to a Target ccccccccceceeeeeeeeseeseeeeeeeeeeeteeeesaaees 3 6 Setting the Search Paths eilinete er entien 3 7 Opening a Pilese Ani cet hn sae shiek Sede 3 9 Listing Gode ma ei a E AE E 3 10 Debugging With gdb960 sssssseeenenesssernrrrnersserrrrrrnn 3 11 Debugger BUMOns sic ccseti
36. file 1 Open the File menu and choose New 2 Inthe dialog provided enter the name of the file that you would like to create and the directory where it will reside The debugger brings up the text editor specified with the TCL EDITOR environment variable See Customizing the GUT on page 4 18 for information on setting this option Exiting the Debugger To exit the debugger 1 Open the File menu and choose Exit Alternatively you can type quit in the command window Customizing the GUI You can customize your configuration for many of the GUI s dialogs by editing the following TCL files To set the options you need to edit either of the following files SI 960BASESG960BASE gui host resource tcl app config lt host type gt tcl SHOME wind crosswind tcl Using the gdb960 UNIX Graphical User Interface The second file is read in after the first one and so can override values in the first file which in turn overrides the default configuration The first file is for customizations visible throughout the whole system affecting all users whereas the second file is for customizations specific to a user For example you may enter lines to set your target communication parameters set targetConnectSerialPort 01 set targetConnectSerialBaud 9600 set targetConnectSerialPPort dev bpp0 You may want to set the default invocation arguments by assigning them to the targetRunArgs For example
37. found by gdb960 in the symbol table loaded by the symbol file command The information is inherent in the text of your program and does not change as the program executes NOTE print amp symbol does not work at all for a register variable and for a stack local variable displays the exact address of the current instantiation of the variable whatis exp Display the data type of expression exp The argument exp is not actually evaluated and any side effecting operations such as assignments or function calls inside it do not take place whatis Display the data type of the last value in the value history ptype typename Display a description of data type typename typename may be the name of a type or for C code it may have the form struct st ruct tag union union tag Or enum enum tag 11 17 gdb960 User s Manual ptype exp info address symbol info functions info functions regexp info Locals info sources info types 11 18 Display a description of the type of expression exp This is like whatis except it displays a detailed description instead of just the name of the type The following example shows the results of entering what is and ptype if the type of a variable is struct complex double real double imag gdb960 whatis foo struct complex gdb960 ptype foo struct complex double real double imag Describe where the data for symbo1 is stored For a register variable this say
38. from being expanded The readline history facilities do not attempt substitution on the strings and even when history expansion is enabled The set history options to control history expansion are expansion on Enable history expansion History expansion is of by default expansion off Disable history expansion The show history options to display the state of the gdb960 history parameters are filename show history by save itself displays all four size states expansion For additional information about command line editing using Emacs or vi refer to Appendix A For additional options refer to Chapter 12 Configuring the gdb960 Environment shell and make Commands You can execute a shell command from within gdb960 in either Windows or UNIX systems by entering the she11 command shell Causes gdb960 to spawn a shell with a command prompt Enter the exit command to the shell to return to gdb960 shell command Causes gdb960 to spawn a shell to execute command The debugger uses the environment variable SHELL when it is set otherwise gdb960 uses bin sh The utility make is often needed in development environments The shell command is not needed to execute make However make must appear in the PATH make Causes gdb960 to spawn a shell run the make program with the arguments specified with the make command This is equivalent to shell make Screen Size Certain gdb960 commands may ou
39. gdb960 debugging features If however you need to update the version of MON960 in your evaluation board or want to retarget MON960 for a custom board you must install the MON960 software to the host The MON960 installation media includes ROM images hex files for all currently supported target boards and source code MON960 also ships with its source code so you can modify MON960 to support custom boards For more information refer to the MON960 Debug Monitor User s Guide Because MON960 is a separate product from CTOOLS versions of MON960 may be released between releases of CTOOLS Dependencies between versions of MON960 and versions of the tools are described in the release notes For details on versions and dependencies refer to the release notes and the MON960 Debug Monitor User s Guide Updated versions of MON960 are available free on the Intel World Wide Web server at http www intel com Getting Started Compiling for Debugging To debug a program effectively you need to recompile your code to include debug information This information is stored in the object file and describes the data type of each variable or function and the correlation between source line numbers and addresses in the executable code To include debugging information specify the g option when you invoke the compiler gcc960 or ic960 For example the commands gcc960 g ACA tl c ic960 g ACA tl c tell the compiler to compile the fil
40. highlights values that changed since the previous display Inspect To monitor an expression or a symbol s current value 1 Select an expression or symbol name in the editor 2 Pull down the Debug menu and choose Inspect or press Alt 2 This opens a sub window for the selected symbol the window is updated automatically each time the program stops Alternatively if you choose Inspect with nothing selected and specify the symbol name in the dialog provided Using the gdb960 Windows Graphical User Interface Several different kinds of data inspection windows are available depending on the data structure The debugger chooses the right one automatically Figure 3 10 shows two Inspect windows one for the ordinary numeric variable ix and one for the structure dB Each Inspect window s title bar shows the name of the variable it displays preceded by a parenthesized display number Figure 3 10 Inspect Windows in the Debugger RETURNS 1 if bad node or bad cNum rank in the database otherwise ae 4 Inspect 2 ix _ ol x int nodeChecks fant ix 0 int nodeId node id t 2 PIE int ix index struct dB char nNum 9 E struct GNODE nArray Eo M char stable 1 t char rev 0 E struct tnid int tid 7821064 char nid 1 FE struct att char color int Xvalue 27997 M int pc 3 M int oD F in
41. in a Windows NT environment See Chapter 3 for complete instructions on using the Windows 95 NT GUI debugger See Chapter 4 for instructions on using the gdb960 UNIX GUI 1 3 gdb960 User s Manual 1 4 About this Manual Table 1 1 Contents This guide includes the following chapters and appendices Chapter Summaries Chapter 1 The gdb960 Debugger 2 Running gdb960 3 Using the gdb960v Windows Graphical User Interface 4 Using the gdb960 UNIX Graphical User Interface 5 Configuring the gdb960 Environment 6 Example gdb960 Session 7 Running Your Program with gdb960 8 Program Execution Control Description This chapter Provides setup instructions and invocation procedures for all three gdb960 interfaces Tells you how to use all features of the Windows 95 NT GUI Tells you how to use all features of the UNIX GUI Describes the basic commands for configuring the gdb960 environment including commands for specifying files and directories Provides an example session of the gdb960 Software Debugger Describes how to run programs from the gdb960 debugger including e specifying arguments for your program e setting the working directory for gdb960 e setting the environment for gdb960 Describes the features of gdb960 that let you halt examine and restart your program continued amp The gdb960 Debugger Table 1 1 Chapter Summaries continued Chapter Descriptio
42. options The following are some of the more commonly used show command options version Displays version information for the currently running gdb960 software debugger print Displays gdb960 s print settings editing Tells you whether command line editing is on or off prompt Displays the current prompt string For more information on the prompt string see the set prompt command For a complete listing of the show options refer to Chapter 12 The info Command The info command displays information about the program being debugged for example the program s registers or the status of the program s breakpoints Following is the info command syntax and a description of the effects of two examples of the use of info info option Where option is one of the info options listed in Chapter 12 gdb960 User s Manual The following are examples of the info command info registers Displays the registers of the program info breakpoints Displays the current breakpoints For a complete listing of the possible arguments to info refer to Appendix E The set prompt Command The set prompt command changes the prompt string displayed by gdb960 The gdb960 software debugger indicates its readiness to read a command by printing a string called the prompt This prompt string is normally gdb960 set prompt newprompt Directs gdb960 to use newprompt as its prompt string Command Line Editing The gdb960 software debugger reads i
43. regnum access address mask Initializes and enables the specified protection GMU register regnum Specifies a protection register number access Specifies which types of memory access can cause a GMU fault The string has the form modetype modetype where mode is either u or s for user mode access or supervisor mode access t ype is a string of one or more letters from Table 8 1 An optional second modet ype may be given to program both user and supervisor modes in the same command An example of a valid access argument is urw sx which means fault on a user mode read or user mode write or a supervisor mode execute address Evaluates to the starting address of the desired protection range mask Evaluates to a number describing the addressing constraints for this range For more information refer to the i960 Hx Microprocessor User s Manual 8 19 gdb960 User s Manual 8 20 Table 8 1 Access Types Access Type Access Type Symbolic Name Read Write Execute Data Cache Write None clears previous settings s 53 0 x s gmu protect disable regnum Disables the specified GMU protection register Specifies a GMU protection register number Clears the memory protection enable bit for this register in the GMU control register If regnum is omitted disable all GMU protection registers gmu protect enable regnum Enables the specified GMU protection register Set the memory protection enable b
44. the following information e A list of features and benefits of the gdb960 software debugger e lt A description of the new features in gdb960 e Information about this manual including chapter and appendix descriptions and notational conventions e Instructions on how to access the online help systems that are provided with gdb960 gdb960 Features and Benefits e Graphical and command line user interfaces With gdb960v provides a windowed environment where you can access almost all of gdb960 s command line features listed below gdb960 User s Manual e Source level debugging You can set and display breakpoints directly in source code browse through program modules and examine the procedure call chain e Watch expressions You can select specific program variables to display and you can watch the values of these variables change as you step through your program e Breakpoints You can define a breakpoint at a function name source code line an assembly instruction an execution address or on the i960 Cx Jx Hx and RP processors a data address e Stepping You can execute your program as single assembly language steps high level language statement steps or high level language procedure call or return steps e Register access You can examine and modify the processor registers e Memory access You can display and modify memory and system tables You can also display and assemble code in memory as assembler mnemo
45. was installed into your gdb960v program group during installation of the toolset The installation also sets the proper environment variables for you You can modify the Windows start up properties to include any command line options you want used such as the specifying the baud rate for the communications port When the debugger is running you can interact with it through the editor window through the Debugger command window and through the Debug menu and toolbar The section titled A Sketch of the Debugger provides an outline of these interaction modes Stopping the Debugger You can end the debugging session in any of the following ways e In the debug toolbar press the gt button e Click on the Stop Debugging command in the Debug menu e Close the Debugger command window e Close the debugger 3 3 gdb960 User s Manual 3 4 A Sketch of the Debugger Figure 3 1 Figure 3 1 illustrates the windows and buttons you can use to interact with the debugger Debugging Windows Gdb960 Debugger gdbS60w rdb File Edit View Debug Tools Window Help include lt stdio h gt void main int i igt j for i 0 i lt 5 i printf Hello i d n i j id s for j 0 j lt 5 j printf Hello j d n j i j 5 Fault type Invalid Opcode type 0x2 subtype 0x1 ip Oxa0008000 fault record Oxa00011c0 Program received signal SIGTRAP Trace breakpoint trap Oxa0009000 in
46. which the format and address are allowed to default to the last address accessed by the previous x command x 7 The addresses and contents displayed by the x command are not put in the value history because there are often so many of them that they get in the way After an x command the last address examined is available for use in expressions in the convenience variable s_ The contents of that address as examined are available in the convenience variable s_ If the x command has a repeat count the address and contents saved are from the last memory unit displayed which is not the same as the last address displayed if several units were displayed on the last line of output Displaying Program Data and Symbols Storing to Memory The gdb960 software debugger allows more implicit conversions in assignments than C does you can freely store an integer value into a pointer variable or vice versa and any structure can be converted to any other structure that is the same length or shorter To store values into arbitrary places in memory use the construct to generate a value of specified type at a specified address For more information on the construct refer to Chapter 11 In the following example int 0x83040 refers to memory location 0x83040 as an integer which implies a certain size and representation in memory and set stores the value 4 into that memory location set int 0x83040 4 Automatic Displa
47. with an argument The until command accepts all the same arguments as the break command Continue running the program until either the specified location is reached or the current innermost stack frame returns location can be any argument form acceptable to break This form of the unt il command uses breakpoints and hence is quicker than unt il without an argument because it need not break on every machine instruction A typical technique for using stepping is to put a breakpoint see the Breakpoints section at the beginning of the function or program section where a problem is believed to be execute to the breakpoint then step through the suspect area problem occurs examining the interesting variables until the The cont command can be used after stepping to resume execution until the next breakpoint or signal Continuing at a Different Address Ordinarily when you continue the program you do so from the place it stopped with the cont command You can instead continue from any address you choose using the following commands jump linenum Resume execution at line number 1 inenum Execution may stop immediately if there is a breakpoint there The jump command does not change the current stack frame the stack pointer the contents of any memory location or any register other than the instruction pointer If line 1inenumisina 8 15 gdb960 User s Manual 8 16 jump address different function from th
48. 1istsize lines starting with first Display the 1istsize lines following the last lines displayed Display the 1istsize lines preceding the lines last displayed Imadr lmadr regno value Sets the contents of the specified logical memory address register to the designated value Range of regnois 0 1 This command is valid only for Jx Hx RP processors Both command arguments are assumed to be hex constants Iimmr lmmr regno value Sets the contents of the specified logical memory mask register to the designated value Range of regno is 0 1 This command is valid only for Jx Hx RP processors Both command arguments are assumed to be hex constants 12 21 gdb960 User s Manual 12 22 load load filename Downloads file filename Download filename to the current target If you have already specified an exec file with the file orexec file command then leaving out filename causes the current exec file to be downloaded make make make options Runs a make tool in the shell using the options in make options as arguments to the make command mcon mcon region value Sets the Memory Configuration register for region to the specified value Range of regionis 0 0xf This command is valid only for i960 Cx Jx Hx RP processors For the i960 Jx and RP processors region is automatically divided by two to map to the supported range of that processor Both command arguments are assumed to be hex constants
49. 3 format 11 9 P parallel port specifying 2 7 path notation 1 7 printing GUI UNIX 4 17 processor status 11 22 profile data manage 12 24 profiling 11 24 program arguments 7 2 continue execution 12 7 12 12 continuing at a different address 8 15 execute at new location 12 20 execution halting and continuing 8 1 loading example 6 3 resuming execution 8 15 running 12 26 specify for debugging 12 12 status information 5 7 stop execution 12 33 variables 11 2 working directory 7 2 program navigation GUI UNIX 4 14 GUI Windows 3 17 programs running GUI UNIX 4 14 GUI Windows 3 17 prompt string change 5 8 publications related 1 7 R raw data formats 11 22 readline arguments B 5 automatic typing B 11 command line completion B 11 history facilities 5 10 init file B 5 init syntax B 6 interaction B 2 interface 5 8 key bindings B 7 killing commands B 3 movement commands B 3 register values viewing GUI UNIX 4 16 GUI Windows 3 25 Index registers 11 22 fp 11 22 ip 11 22 ps 11 22 sp 11 22 display non floating 12 26 information display 11 22 instruction pointer 11 22 S screen size setting 5 11 search backward 12 26 for text match 12 27 search path add directory to 12 23 executable search 10 5 GUI UNIX 4 11 GUI Windows 3 7 source 10 5 serial port specifying 2 6 shell invoke inferior 12 32 source
50. 5 14 Contents Chapter 6 Chapter 7 Chapter 8 Chapter 9 Example gdb960 Session Example Session iisseskices sdecieasseeeenbeteacenagetidevnuaneahigesteeewae 6 1 Running Your Program with gdb960 Running Programs ost taste Ree tte oc ceecke net cried 7 1 Setting Your Program s ArguMent ccccccccccccceeeeeeeeees 7 2 Setting Your Program s Working Directory ccceeee 7 2 Your Program s Environment iceccseetotvert ierntediberedsnatdedwwes 7 3 Program Execution Control BiGAKPOINS nran a ates seat l 8 1 WICNPOINIS 2 ck4 eRe a eel ee aie ates 8 5 Deleting Breakpoints and Watchpoints ee 8 6 Disabling Breakpoints and Watchpoints 0 e 8 7 Break Conditions eicicieseshccecseieieiiacercheiiacieh seeeeaeienetiaies 8 9 Commands Executed on Breaking cceeeeeeeeeees 8 11 COMUN cts eee tees teak ice a etons cs A E E A 8 13 StEPPIN I ien a A E EE 8 13 Continuing at a Different Address eeeceeeeetteereeeees 8 15 gmu COMUIM ANS soars sal oadereaseece renee dallas t din Podevaneee sete 8 17 gmu detect gmu PPOlOCl issn seescttescwsssnsbenwssdekewwssnabemwstasy 8 17 Tea cat eae la oe cate ails ole aah ae taal oer Mae a ee 8 18 Examples oee aes aa etad E E ait panes 8 20 Examining the Program Stack Stack Frames Stes Roe acee ee cds oi adece te agaghescer ener ureddenea Nageaerne 9 1 BACK ACCS siika ee ree a aa E ara ae 9 2 Selecting a Frame ceccecccceceeeeeeeseseceeeee
51. 60 Command and Option Reference unset unset env var Unsets environment variable var With no arguments unsets all environment variables until until Lecation Allows executing all iterations of a loop as a single step without arguments causes execution to continue until the program reaches a source line greater than the current source line The until command always halts the program if it attempts to exit from the current stack frame With no argument unt il works like single instruction stepping and hence is slower than until with an argument The until command accepts the same arguments as the break command location Continue running the program until either the specified location is reached or the current innermost stack frame returns location can be any argument form acceptable to break see the set command in this chapter This form of the until command uses breakpoints and hence is quicker than unt il without an argument because it need not break on every machine instruction up up n Selects the frame n frames up from the previously selected frame For positive numbers n this advances toward the outermost frame to higher frame numbers Default is one 12 35 gdb960 User s Manual 12 36 up silently up Silently n Same as up except produces no output This is useful in command scripts watch watch expr Sets a watchpoint on expr Execution stops whenever the value of expr change
52. 960 wants a source file it tries all directories in the list in the order they appear until it finds a file with the desired name The source path is not the same as the executable search path unless you have specified them identically If gdb960 can t find a source file in the source path and the object program records the directory the program was compiled in gdb960 tries the recorded directory too Ifthe source path is empty and there is no record of the compilation directory gdb960 looks in the current directory Whenever you reset or rearrange the source path gdb960 clears out any information it has cached about where source files are found where each line is in the file and so forth gdb960 User s Manual 10 6 When you start gdb960 its source path is empty The source path contains only the special directories cdir stands for the compilation directory if available from the object file and cwa stands for the current working directory To add other directories use the directory command directory dirname Add directory dirname abbreviated dir to the front of the source path Multiple directory names may be given to this command separated by white space or a colon or a semi colon on DOS directory Reset the source path to empty You are prompted for confirmation show directories Display the source path show which directories it contains Because the directory command when used with argu
53. Controls whether an asterisk appears at the beginning of history lines that have been modified There are two possible settings on and off off no asterisk is the default If set to on use the visible bell if one is available rather than using the terminal bell There are two possible settings on and off off is the default Although the Readline library comes with a set of Emacs like key bindings it is possible to set up your own key bindings You can customize programs that use Readline by putting commands in an init file in your home directory The name of this file is inputrc The following two examples set edit ing mode to vi and horizontal scroll mode to on respectively set diting mod vi set horizontal scroll mode on Command Line Editing Readline Key Bindings The syntax for controlling key bindings in the input rc or C inputre requires that you know the name of the command you want to change The following pages provide tables containing command names their default key bindings and a short description of what each command does Once you know the name of the command place the name of the key you wish to bind the command to a colon and then the name of the command on a line in the init file In the following example CTRL u is bound to the function universal argument and CTRL o is bound to the macro amp gt output which inserts the string gt output into the line This is
54. Hx processors Detection GMU registers are identified by number ranging from 0 to NUMDREGS 1 NUMDREGS is currently 6 on the Hx processors gdb960 records the gmu define commands in an internal data structure called the command cache If you later invoke the file command gdb960 reprograms the GMU using the commands in the command cache This allows the same GMU definitions to be used repeatedly while only the file name changes Since the gmu define commands accept expressions as well as addresses you can protect a section of memory without knowing its exact size If the section s size changes due to recompilation the GMU settings still work regardless of the change gmu detect gmu protect Following is the gmu detect and gmu protect command syntax a description of the effects of the possible options and examples of use Refer to Chapter 12 for further discussion of gmu syntax and arguments gmu detect Allows control over the Hx processor Guarded protect Memory Unit and specifies the type of GMU subcommand register to control either protection protect or detection detect subcommand specifies the action to perform on the register Following are the subcommand options for the gmu protect and gmu detect commands define Initialize and enable the specified register 8 17 gdb960 User s Manual disable Disable the previously defined register enable Enable the previously defined register You may also use the i
55. Link gdb960 supports ApLink a software and hardware debug probe for the 1960 processors Because ApLink includes the MON960 debug monitor on board it makes 1960 processor software development as simple as self hosted development on a PC or workstation By using ApLink you avoid having to port software or design specialized hardware into the target system to use the monitor ApLink Commands These commands are useful primarily for ApLink but can be used by all Cx Jx and Hx based targets mcon region value lmadr regno value Set the Memory Configuration register for region to the specified value Range of region is 0 0xf This command is valid only for Cx Jx Hx processors For the Jx processor region is automatically divided by two to map to the supported range of that processor Both command arguments are assumed to be hex constants Set the contents of the specified logical memory address register to the designated value Range of regno is O 1 D gdb960 User s Manual This command is valid only for i960 Jx Hx RP processors The debugger assumes that both command arguments are hex constants lmmr regno value Set the contents of the specified logical memory mask register to the designated value Range of regnois 0 1 This command is valid only for 1960 Jx Hx RP processors The debugger assumes that both command arguments are hex constants NOTE Improper use of the mcon 1madr or 1mmr commands causes
56. OF Delete the character behind the cursor A numeric argument says to kill the characters instead of deleting them Add the next character that you type to the line verbatim Use this command to insert characters like CTRL q Insert a tab character Insert the character of the key that is pressed Drag the character before the cursor forward The cursor insertion point moves forward as well If the cursor is at the end of the line then transpose the two characters preceding the cursor Negative arguments do not work Drag the word behind the cursor past the word in front of the cursor moving the cursor over that word as well B 9 gdb960 User s Manual B 10 upcase word META u downcase word META 1 capitalize word META c Killing And Yanking Convert to uppercase the current or following word With a negative argument convert the previous word but do not move the cursor Convert to lowercase the current or following word With a negative argument convert the previous word but do not move the cursor Convert to uppercase the current or following word With a negative argument convert the previous word but do not move the cursor The following is a list of the command names their original bindings and short descriptions for killing and yanking text on the command line kili lrne CTRE k backward kill line kill word META d backward kill word META
57. Source Files Displays the starting and ending addresses of the compiled code for source line 1 inenum The default examine address for the x command is changed to the starting address of the line so that x i is sufficient to begin examining the machine code Also this address is saved as the value of the convenience variable s_ For more information on the x command and convenience variables refer to Chapter 11 Two commands let you search the current source file for a regular expression The following list shows the forward and reverse commands and describes their uses 10 4 Examining Source Files forward search regexp Checks each line starting with the one following the last line listed for a match for regexp It lists the line that is found The command abbreviation for forward is fo The synonym search regexp is also supported reverse search regexp Checks each line starting with the one before the last line listed and going backward for a match for regexp It lists the line that is found The command abbreviation for reverse is rev Specifying Source Directories Executable programs sometimes do not record the directories of the source files from which they were compiled just the source file names Additionally directories can be moved between compilation and debugging The gdb960 debugger remembers a list of directories to search for source files That directory list is called the source path Each time gdb
58. a comment line Control T gt go tpu t Controls universal argument You need not spell out the key sequences You can specify key sequences in shorthand by enclosing the sequence in double quotes and using Emacs style escapes In the following example CTRL u is bound to the function universal argument CTRL o is bound to the macro gt soutput which inserts the string gt output into the line and CTRL x CTRL r is bound to the function re read init file This is a comment line TICTRL 6 gt soutput WV CTR a i universal argument PNETRE XYCTRL pti re read init fil Commands For Moving The following is a list of the command names their original bindings and short descriptions for cursor movement commands beginning of line Move to the start of the current line CTRL a gdb960 User s Manual B 8 end of line CT forward char C backward char forward word MI backward word clear screen C RL e TRL CTRL b ETA f ETA b TRL Move to the end of the line Move forward a character Move back a character Move forward to the end of the next word Move back to the first white space that precedes the cursor position Clear the screen leaving the current line at the top of the screen Commands For Manipulating History The following is a list of history manipulation command names their original bindings and short descriptions acc
59. a000cc38 r3 0 0 Oxa000d680 Oxa000d688 Oxa 0 0 Global Oxa Oxa0009cb4 0 Oxffffffff 0 Oxa000dc50 0x400 Oxa000dc50 0 0 0x101 0 fp Oxa002d840 fH Control You can use the same hierarchy controls described in Inspect to hide or reveal groups of registers 3 26 Using the gdb960 Windows Graphical User Interface Memory Table 3 6 Options for Bringing Up the Memory Window Button Shortcut Debug Menu Command n a ALT 5 Memory Click the Memory item in the debug menu to open a window that displays a range of target memory starting at a specified address Figure 3 15 shows a maximized Memory window displaying memory in Hex ASCII format The numbers in the left margin of Figure 3 15 identify the control fields described below Figure 3 15 Memory Window Start Address Jost I Refresh on debugger stop Cj Format Hex ASCil Size 512 in Byte DOOOfEEE 3 27 gdb960 User s Manual NOTE You can choose whether to update the Memory window only on demand or automatically Check the box labeled Refresh on debugger stop to update the Memory window each time the debugger takes control To update the memory display immediately press the LC button The following controls specify what memory range to display and in what format Start Address Format Size in Enter the beginning address for the range of memory The debugger saves each address you t
60. able they are allocated to your watchpoint Otherwise a software watchpoint is generated The awatch and wwatch commands are available for setting only hardware assisted watchpoints 8 5 gdb960 User s Manual 8 6 Watchpoints find bugs when the module function or location causing the problem is unknown For all types of watchpoints provide a specifier for a memory location expr below i e not a register or machine address but a variable like arg 10 The gdb960 debugger converts the expression into an address awatch expr Set a memory access hardware watchpoint Memory access watchpoints halt program execution when any read or write is attempted at the address of expr watch expr Set a watchpoint on expr Use hardware resources if available wwatch expr Set a memory write hardware watchpoint Memory write watchpoints halt program execution when a write is attempted at the address of expr Deleting Breakpoints and Watchpoints The clear command lets you delete breakpoints according to their placement in the program The delete command lets you delete individual breakpoints by specifying their breakpoint numbers A deleted breakpoint no longer exists in any sense it is forgotten NOTE The gdb960 debugger automatically ignores breakpoints on the first instruction to be executed when you continue execution without changing the execution address This prevents the debugger from stalling on a breakpoint Program Execut
61. akpoints 3 16 source code viewing 3 29 stack viewing 3 21 starting 3 3 stepping through a program 3 17 symbol values 3 22 text editor 3 32 variable values 3 24 Windows online help 3 2 debugging GUI UNIX 4 12 GUI Windows 3 11 optimized code 2 3 directories changing 12 6 DOS command line 1 7 downloading GUI Windows 3 15 E editor text GUI Windows 3 32 Emacs commands with gdb960 A 3 setting up gdb960 A 1 Index environment variables 2 9 unset 12 35 escape sequences 13 6 event designators C 2 exclamation point assign special meaning to 5 10 execution continuing 8 13 example 6 3 exiting debugger GUI UNIX 4 18 expression data type 11 17 expression values viewing GUI Windows 3 22 expressions 11 1 display 13 6 display when program stops 12 10 remove from display 12 34 F files creating GUI UNIX 4 18 downloading 12 22 editing GUI Windows 3 31 gdbinit 13 4 init gdb 13 4 opening GUI UNIX 4 8 GUI Windows 3 8 font settings GUI Windows 3 36 format letters 11 9 options 11 5 output 11 9 11 12 frame information 9 5 initial 9 1 innermost 9 1 outermost 9 1 pointer register 9 2 select 12 13 selecting 9 4 12 10 12 35 function calls stepping over 12 22 functions calling 12 6 G gdb960 command help 12 17 command list 12 3 compiling for 2 1 configuring from the command line 2 1 example session 6 1 exiting 5
62. ame Set the gdb960 command history file to filename The gdb960 debugger reads an initial command history list from this file and writes a history list to this file when you exit gdb960 The history list is accessed through history expansion or through the history command editing characters By default Filenameis gdb_history for UNIX hosts and hist gdb for Windows hosts However when the GDBHISTFILE environment variable is set the value of the GDBHISTFILE is used save on Record the gdb960 command history in a file By default fi lenameis gdb_history for UNIX hosts and hist gdb for Windows hosts However when the GDBHISTFILE environment variable is set the value of GDBHISTFILE is used You can also specify a filename using the set history file command By default set history save is off save off Stop recording command history in a file 5 9 gdb960 User s Manual 5 10 size size Set the number of commands that gdb960 keeps in its history list The default is the value of the HISTSIZE environment variable or 256 when HISTSIZE is not set History Expansion History expansion assigns special meaning to the exclamation point character Since is also the logical not operator in C history expansion is off by default NOTE When using as a logical not in an expression while history expansion is enabled you may sometimes need to follow with a space or a tab to prevent it
63. and provides some examples of its use Introduction to Line Editing In this appendix the following notation is used to describe keystrokes The text CTRL k is read as Control k and describes the character produced when the Control key is depressed and held while the k key is pressed The text META k is read as Meta k and describes the character produced when the meta key if you have one is depressed and the k key is pressed If you do not have a META key identical effects can result from holding down the Esc key while typing k Either process is known as metafying the k key The text META CTRL k is read as Meta Control k and describes the character produced by metafying CTRL k gdb960 User s Manual B 2 In addition several keys have their own names Specifically DEL ESC LFD SPC RET and TAB all stand for themselves when seen in this text or in an init file For more information on init files refer to the Readline Init File section of this appendix Readline Interaction The Readline library provides a set of commands for manipulating the text on the command line allowing you to fix typos without retyping the line These editing commands allow positioning the cursor and deleting or inserting text When you are satisfied with a line press RETURN The cursor does not have to be at the end of the line to press RETURN and have the modifications accepted
64. aphical User Interface 3 Set the types of files to display in the Files of Type box Files with the chosen extension are displayed in the File name box This box serves as a filter to display all files with a given extension The drop down box initially lists commonly used file extensions The default shows the TXT C CPP H HPP and TCL extensions Alternatively you can specify wildcard patterns in the File name box to display file types The new wildcard pattern is retained until the dialog box is closed You can also use any combination of wildcard patterns delimited by semicolons For example entering displays all files with these extensions In the File name box click a filename then click Open or Double click on a filename You are now ready to edit the file Creating a New Text File 1 From the File menu choose New CTRL N The New dialog box appears Select C Source File then click OK or Click 2 on the Standard toolbar From the File menu choose Save CTRL S or Click on the Standard toolbar The Save As dialog box appears Double click a directory where you want to store the source file or move down a path to the appropriate directory Type a filename in the File name box then choose OK The default extension given to a file is the last extension used when you saved a file You can type another extension or select one from the Save as Type box You are now ready to enter t
65. aphical User Interface Table 3 9 2 From the Edit menu choose Replace The Replace dialog box appears 3 Type the search text in the Find What box 4 Type the replacement text in the Replace With box 5 Select any of the Replace options Begin replacing text by choosing Find Next or Replace All Printing the Contents of an Active Window 1 From the File menu choose Print The Print dialog box appears 2 Under Print Range select the All option button 3 Click OK Customizing a Print Job 1 From the File menu choose Page Setup 2 Type the header or footer text codes see Table 3 6 or both 3 Click OK Print Options To Print Use Filename amp f Page of current page amp p Current system time amp t Current system date amp d Left aligned g amp l Centered amp C Right aligned amp r Saving a File 1 From the File menu choose Save CTRL S or Click on the Standard Toolbar 3 35 gdb960 User s Manual 3 36 4 5 If your file is unnamed the environment displays the Save As dialog box In the File name box type the filename Select the drive and directory where you want the file saved The default is the current drive and directory Specify the type of file you re saving in the Save as type box Click Save Saving A New File or Renaming an Existing One 1 2 3 4 5 Make the file active by clicking the editor window From the File menu choose Save As The Sav
66. argument of 10 type META 1 0 CTRL d Readline Init File Although the Readline library comes with a set of Emacs like key bindings it is possible to set up your own key bindings and change the state of a few variables You can customize programs that use Readline by putting commands in an init file in your home directory The name of this file is inputrc on UNIX hosts and inputrc on Windows hosts gdb960 looks for this file at startup in the directory specified by the HOME environment variable There is no default for SHOME If HOME is not set then no init file is used When a program that uses the Readline library starts up the inputre file is read and the key bindings are set B 5 gdb960 User s Manual B 6 Readline Variables There are four internal Readline variables You can use them to change the initial state of Readline editing A list of the Readline init variables and their descriptions follows editing mode horizontal scroll mode mark modified lines prefer visible bell Lon o t Controls which editing mode you are using By default GNU Readline starts up in Emacs editing mode Possible settings are emacs and vi Controls whether the text of the lines you edit scroll horizontally on a single screen line when they are larger than the width of the screen instead of wrapping onto a new screen line There are two possible settings on and off off is the default
67. arting address of the detection range endaddress Evaluates to one byte beyond the ending address of the desired detection range gmu detect disable gmu detect disable regnum Disables the specified GMU detection register Clears the memory detection enable bit in the GMU control register If regnum is omitted disables all GMU detection registers 12 14 gdb960 Command and Option Reference gmu detect enable gmu detect enable regnum Enables the specified GMU detection register Sets the memory detection enable bit for this register in the GMU control register If regnumis omitted enables all GMU detection registers gmu protect define gmu protect define regnum access address mask Controls the Guarded Memory Unit GMU protection registers Protection GMU registers are identified by number ranging from 0 to NUMPREGS 1 regnum access address mask NUMPRI EGS is currently 2 on the Hx processors Specifies the protection register number Specifies which types of memory access cause a GMU fault The string has the form ModeType ModeType where Mode is either u user mode access or s supervisor mode access Type is a string of one or more letters from Table 12 1 An optional second modet ype may be given to program both user mode and supervisor mode in the same command An example of a valid access argument is urw sx which means fault on a user mode read or user mode write or
68. as a list of directories to search The file command with no argument leaves both the executable file and symbol table unspecified 5 3 gdb960 User s Manual info files load filename readnow s file se file symbol file filename 5 4 If you specify pc pd or px symbols are relocated by adding offset to their values These arguments act the same as their command line counterparts Refer to Chapter 12 for more information After loading the debug data with the file command you can download the code with the load command Display the current target including the names of the executable files currently in use by gdb960 and the files from which symbols were loaded This command downloads filename to the current target If you have already specified an exec file with the file or exec file commands then leaving out filename causes the current exec file to be downloaded Read each symbol file s entire symbol table immediately rather than the default which is to read it incrementally as needed This slows the symbol file command but speeds up other operations Read symbol table from file Read the symbol table from file and use it as the executable Read symbol table information from file filename PATH is searched when necessary Use the file command to get both the symbol table and the program to run from the same file The symbol file command with no argument clears out gdb960 s i
69. as defined in FAR 52 227 7013 No part of this document may be copied or reproduced in any form or by any means without prior written consent of Intel Corporation Intel Corporation retains the right to make changes to these specifications at any time without notice Contact your local sales office to obtain the latest specifications before placing your order Other brands and names are the property of their respective owners Q GO printed on recycled paper Copyright 1994 1996 1997 Intel Corporation All rights reserved Contents Chapter 1 The gdb960 Debugger gdb960 Features and Benefits ccceeeeeeeeeeeeeeeeees 1 1 Whats New in gdb960 sc cciccuetd in inomuiettaatadeaesls 1 2 About this Manual s ridcuditninlen cicceetitateiin GaieeG ame Selec 1 4 C N EN S ennnen EE e nage due IEE EEE aati as nace 1 4 PUM NCE SEEE AE SS E E EEE A T 1 6 Notational Conventions ccccccccceceeeceeeeeeeeeeeeeeeeeeeeeees 1 6 UNIX and Windows Command Line Differences 1 7 Related Publications sneseeeeeeeeeeeene ennenen enneren 1 7 Online Help sacs oo a aac A eager eae eee aa 1 7 Contacting Intel Support Services ceeeeeeeteeeees 1 8 Chapter 2 Getting Started Setting Up Your Target Board ccccccccccceeeeeeeeeeeeeeeeeeeees 2 1 Using the MON960 Debug Monitor with gdb960 2 2 Compiling for DebUQGING cccceeeseeeeeeeeeeeeeteeeeteeeeeeaeees 2 3 Staring Gab9G0y
70. ation but application requirements make it undesirable for the monitor to tie up the PCI bus with T O and various service requests e g register dumps then use PCI download to augment serial communication Examples gt gdb960 lt r comi pi myprog This example connects to the target via serial port COM and downloads the program myprog via the PCI bus The PCI bus is used only for downloading all other host target communication use the serial port gt gdb960 E coml peib O 0 myprog This example is similar to the previous one except that the PCI device is explicitly specified by bus 0 device 0xc and function number 0 Getting Started Emacs Invocation On UNIX hosts if you are a GNU Emacs user you can set up gdb960 to run in an Emacs window This has many advantages over the normal single line gdb960 command line notably the source code buffer that Emacs keeps updated for you as you debug your application For more information on running gdb960 under Emacs refer to Appendix B Using gdb960 Under GNU Emacs Batch Mode Invocation You can also start gdb960 in batch mode You can get more detailed control over how gdb960 starts by using the command line options listed in Appendix E of this manual All the options and command line arguments listed in a batch file are processed in sequential order Sometimes order is important For example when the x option is used you need to load an object before you
71. c address it normally displays the closest earlier symbol plus an offset If that symbol does not uniquely identify the address for example it is a name whose scope is a single source file you may need to disambiguate by entering the info 1ine command for example info line 0x4537 As an alternative you can set gdb960 to display the source file and line number when it displays a symbolic address The following list provides examples of the set print command and descriptions of the effect of each example set print symbol filename on set print symbol filename off set print symbolic disassembly set print max symbolic offset MAX OFFSET set print autoderef Display the source file name and line number of a symbol in the symbolic form of an address Do not display the source file name and line number of a symbol Omission of the on or off argument assumes off can be abbreviated set print symbolic When on addresses in the disassembly show the machine address followed by lt symbo1 1234 gt where symbo1 is the closest preceding function name Turning this off creates less clutter in the display The on setting is the default Display only the symbolic form of an address if the offset between the closest earlier symbol and the address is less than MAX OFFSET The default is zero to always display the symbolic form of an address if any symbol precedes it When on always dereference char p
72. can manipulate it Mode Options Mode options specified in the gdb960 invocation line determine how the software debugger accepts input produce output and processes debugging commands The following is a list of the available mode options along with brief descriptions of their effects on gdb960 s operation batch Run in batch mode Terminate gdb960 with exit code 0 after processing the commands in the file specified with x and in gdbinit if not inhibited Terminate with non zero status if an error occurs in executing the gdb960 commands in the command file On Windows hosts the initiation batch file is named init gdb instead of gdbinit Only one command file can be specified on the command line Execution of gdb960 terminates when the command file ends gdb960 User s Manual help nx pc picoffset pd pidoffset px offset 2 10 Batch mode allows you to run gdb960 as a filter For example you can download and run a series of programs and capture their output Informs gdb960 that the target has big endian memory gdb960 briefly describes usage details Suppress execution of commands in the gdbinit initialization file Normally the commands in gdbinit execute after the command line options and arguments have been processed For more information on command files refer to Chapter 13 Debug position independent code Download code sections to link time address picoffset instead of the usual link time addr
73. ces the same output as echo This is some text n echo which is continued n echo onto several lines n 13 5 gdb960 User s Manual output expression output fmt expression print string expressions printf foo bar lt foo UKIR 13 6 Display the value of expression and nothing but that value no newlines and no snn The value is not entered in the value history For more information on expressions refer to Chapter 11 The following example compares the printout of the print command to the printout of the output command gdb960 print d foo 15 42 gdb960 42 gdb960 output d foo Display the value of expression in format fmt For more information on expressions refer to Chapter 11 Display the values of the expressions under the control of string The expressions are separated by commas and may be either numbers or pointers Their values are displayed as specified by string exactly as if the program were to execute the following C output function printf string expressions For example you can display two values in hex by entering the following command Ox x n foo bar foo The only backslash escape sequences allowed in the format string are backslash letter combinations Using gdb960 Under GNU Emacs Setting Up gdb960 in Emacs If you have GNU Emacs version 19 or greater 1 Copy the file gud960 e1 from the source code tree BaseOfTree src gdb960 common gud960 e1
74. countered gdb960 User s Manual 8 12 Breakpoint commands can re start execution The cont or step commands begin execution again However any further commands in the same command list are ignored When execution halts again gdb960 executes any command list associated with the breakpoint that causes the halt If silent is the first command specified in a command list the usual message about halting at a breakpoint is not displayed This may be desirable for breakpoints that are to display a specific message and then continue If the remaining commands also display nothing you see no sign that the breakpoint was reached at all The silent command is meaningful only at the beginning of the command list for a breakpoint The following example displays the value of x at entry to foo when x is positive then continues execution break foo if x gt 0 commands silent Don t print normal bp stuff print x What is x s value cont Resume program end NOTE The commands echo and output allow more precise display control of output and are often useful in silent breakpoints The following example of a command list shows correction of one bug so another can be pursued without reinvoking the program The example places a breakpoint just after an error in the code gives the breakpoint a condition to detect the error case and adds a command list that assigns Program Execution Control correct values to variables that need them
75. ctions inside them Execution halts when control reaches a new line of code at the stack level that was executing when the next command was given or if another breakpoint is hit next is abbreviated as n A count argument is a repeat count as in step Execute one machine instruction but if it is a subroutine call proceed until the subroutine returns A count argument is a repeat count as in step Execute one line of code then halt execution and return control to the debugger This command is abbreviated as s Execute count lines If a breakpoint or a signal not related to stepping is encountered before count steps execution halts Execute one machine instruction then halt and return control to the debugger It is often useful to do display i ip when stepping by machine instructions This causes the next instruction executed to display automatically at each halt For more information on examining data refer to Chapter 11 A count argument is a repeat count as in step The until command allows execution of all iterations of a loop as a single step The until command with no arguments causes execution to continue until the program reaches a source line greater than the current source line The until command always halts the program if it attempts to exit the current stack frame Program Execution Control until location With no argument until works like single instruction stepping and hence is slower than until
76. d When the symbol table changes the value history is discarded because values may contain pointers back to the types defined in the symbol table The values displayed are given history numbers for reference The reference numbers are successive integers starting with 1 The print command displays the history number assigned to a value by displaying num before the value where num is the history number To refer to a value previously displayed use and the value s history number The output displayed by print reminds you of that The character alone refers to the most recent value in the history and refers to the value before that n refers to the nth value from the end 2 is the value just before 1 is equivalent to and 0 is equivalent to The following example displays the contents of a structure pointed to by a pointer that was just displayed px 11 19 gdb960 User s Manual 11 20 If you have a chain of structures where the component next points to the next one you can display the contents of the next one with the following example p next Repeat commands with RET The history records values not expressions In the following example if the value of x is 4 then the value recorded in the value history by the print command remains 4 even though the value of x has changed print x set x 5 The following is a list of show commands and descriptions of their effects show values Disp
77. d by your program when it next starts Setting Your Program s Working Directory Each program invocation with run inherits its working directory from gdb960 s current working directory The gdb960 debugger s working directory is initially inherited from its parent process typically the shell The cd command allows specifying a new working directory in gdb960 The gdb960 working directory also serves as a default for the commands that specify files on which gdb960 operates cd directory Set gdb960 s working directory to directory pwd Display gdb960 s working directory Running Your Program with gdb960 Your Program s Environment At startup gdb960 inherits the environment from your current shell This environment is then passed on to MON960 where it becomes available to your program Up to 20 environment variables can be passed to the program via MON960 The typical UNIX environment is larger than that It may be necessary to start your UNIX shell with a stripped down environment if you need to pass variables to your application One common way to do this is to give the UNIX command env bin ksh where bin ksh is the shell that is used to start up gdb960 The following commands allow you to change or examine the program environment set environment Set environment variable varname to value varname value The environment change is visible to your program not to gdb960 If optional value is omitted varname is set to
78. define command The end of these commands is marked by a line containing end document Document the user defined command commandname commandname The command commandname must already be defined The document command reads lines of documentation just as define reads lines of the command definition ending with end After the document command is finished help on command commandname displays the documentation you have specified You must use the document command to change a command s documentation Redefining the command with define does not change its documentation Storing Commands User defined commands do not take arguments When they are executed the commands of the definition do not display An error in any command stops execution of the user defined command and displays an error Commands that ask for confirmation if used interactively proceed without confirmation when part of a user defined command Many gdb960 commands that normally display messages omit the messages when used in user defined commands User defined Command Hooks You may define hooks which are a special kind of user defined command Whenever you run the command foo if the user defined command hook foo exists it is executed before that command Like other user defined commands hooks cannot take arguments In addition a pseudo command stop exists Defining hook stop makes the associated commands execute every time execution stops in your program be
79. displaying example 6 3 files searching 10 4 lines displaying 10 1 mapping to program addresses 10 4 path 10 5 reset 12 8 source code example 6 2 editing GUI UNIX 4 18 viewing GUI Windows 3 29 stack frame 8 13 9 1 10 1 selecting 12 27 pointer 11 22 viewing GUI UNIX 4 16 GUI Windows 3 21 Starting gdb960 2 4 command line interface 2 5 UNIX GUI 2 4 Windows GUI 2 4 startup options See also options Stepping execution 8 13 stepping through a program GUI UNIX 4 14 GUI Windows 3 17 stty rows and stty cols settings 5 11 support customer 1 8 symbol file messages 5 5 data dump 12 24 read 12 33 table 5 3 11 19 examining 11 17 information display 12 3 symbol values viewing GUI Windows 3 22 symbols defined by the preprocessor 11 1 syntax coloring GUI Windows 3 37 system interrupt character 9 2 Index 9 gdb960 User s Manual T tab settings GUI Windows 3 36 target connect to 12 34 connection GUI UNIX 4 5 GUI Windows 3 6 termcap database 5 11 test display 12 11 text search for a match 12 13 text editor GUI Windows 3 32 attributes GUI Windows 3 36 customizing GUI Windows 3 36 tracing GUI UNIX 4 17 GUI Windows 3 25 type conversions 11 15 display description 12 25 U unit size to examine 11 12 UNIX command line editing B 1 gdb960 GUI 2 4 command line 1 7 V value history 11 17 variable values viewing GUI
80. dow provides full access to the command language described in Chapters 5 13 Using the gdb960 UNIX Graphical User Interface This chapter provides step by step instructions for running gdb960 using its UNIX Graphical User Interface gdb960v Topics include e Overview e Online Help e Running the Debugger e Setting the Working Directory e Connecting to a Target e Opening a File e Using the Debugger e Editing Source Code e Creating a New File e Setting the Search Directories e Exiting the Debugger e Customizing the GUI e See Chapter 3 for information on running the Windows 95 NT version Overview gdb960v provides users with a Graphical User Interface to access many of the features of its line oriented interface The most common debugging activities such as setting breakpoints and controlling program execution are available through convenient point and click interfaces Similarly program listings and data inspection windows provide an immediate visual context for the crucial portions of your application gdb960 User s Manual For more complex or unpredictable debugging needs a command line interface gives you full access to a wealth of specialized debugging commands For instructions on running gdb960 from the command line see Chapters 5 through 13 Online Help The UNIX help system is HTML based and can be viewed with any web browser such as Mosaic or Netscape To view the file simply open the file w
81. e As dialog box appears Type a filename and extension in the File name box Choose the drive and the directory where you want to save the file Click Save Setting the Save Options 1 From the Tools menu choose Options gt Editor The Editor Preferences dialog box appears To save open files before running any tool select the Save Before Running Tools Builds check box Click OK Customizing the Text Editor Setting the Atiribute Pane 1 From the Tools menu choose Options gt Editor The Editor Preferences dialog is displayed Select the Attribute Pane check box this box is checked by default When the mouse is moved into the Attribute Pane the cursor changes to an up and right pointing select cursor a mirror image of the standard select arrow Clicking the left mouse button in the margin selects the entire line to the right of the click Dragging the mouse cursor in the selection margin selects multiple consecutive lines Using the gdb960 Windows Graphical User Interface Clicking the left mouse button or dragging the mouse cursor with the Shift key held down extends the selection Changing the Tab Settings 1 3 From the Tools menu choose Options gt Editor The Editor Preferences dialog box appears Under Tab Settings in the Tab Stops box type the number of spaces to be used as a tab stop The default is four spaces Click OK Changing Font Type and Font Size 1 From the Tool
82. e Chapter 2 Ifyou select PCI a window appears displaying the PCI devices that are currently installed in your system Select the desired PCI device and choose OK For example the Cyclone i960 1Q80960RP evaluation board has vendor and device identification numbers 8086 and 0960 respectively For more information on PCI see the PCI Local Bus Specification from the PCI Special Interest Group 1 800 433 5177 Ifyou select Serial in the previous step you are prompted to select the port parameters You also have the option of using a parallel port to download code to the target Once you have set the correct parameters choose OK If you have not successfully connected to your target a dialog displaying an error message is presented to you When you successfully connect a window displays target information Using the gdb960 Windows Graphical User Interface Figure 3 3 Target Connected Window Target Connected Target Information Attached to COM2 at 57600 bps BETA HDIL 3 1 1 JX at 33 MHz with 2MB DRAM Cyclone EP MONS6O 3 0 2 Jan 31 1996 JF step number 00 No executable file has been loaded to the remote Cpu status information PRCE address 0xa0001080 System procedure table address 0xa0000700 Fault table address Oxa0000f50 Interrupt table address Oxa0000b40 Base of Interrupt stack 0xa0001340 When you have successfully connected to your target the following changes appear in the main
83. e Debugger Command Line Window page 3 38 See Chapter 4 for information on running the UNIX version 3 1 gdb960 User s Manual 3 2 Overview The design of the gdb960v GUI debugger combines the best features of graphical and command line debugging interfaces The most common debugging activities such as setting breakpoints and controlling program execution are available through convenient point and click interfaces Similarly program listings and data inspection windows provide an immediate visual context for the crucial portions of your application For more complex or unpredictable debugging needs a command line interface gives you full access to a wealth of specialized debugging commands For instructions on running gdb960 from the command line see Chapters 5 through 13 Online Help Reference information is available to you anytime you are running the debugger simply by pressing F1 in any window or by pulling down the Help menu and choosing any of the help options listed there Using the F1 key provides you with context sensitive information about the current active window The Help menu provides you with options that let you start your search in the more general areas of the online help system and then move to the more specific topics Using the gdb960 Windows Graphical User Interface Starting and Stopping the Debugger Starting the Debugger You can start the debugging session by double clicking the icon that
84. e frame pointer register The gdb960 debugger assigns numbers to all existing stack frames starting with zero for the innermost frame one for the frame that called it and so on These numbers are record keeping devices for gdb960 They do not really exist in your program they provide a way of describing stack frames in gdb960 commands When program execution halts gdb960 automatically selects the innermost stack frame Many gdb960 commands refer implicitly to the selected stack frame You can select any frame using gdb960 command frame Once selected gdb960 commands operate on the newly selected frame Backtraces A backtrace is a summary list of stack frames in the order in which they were called The backtrace presents one line per frame starting with the currently executing frame frame zero followed by its caller frame one and so on up the stack The following is a list of commands for creating a backtrace accompanying each command is a description of its use backtrace Display a backtrace of the entire stack one line per frame for all frames in the stack You can stop the backtrace at any time by typing the system interrupt character normally CTRL C Examining the Program Stack backtrace n Display only the innermost n frames backtrace n Display only the outermost n frames The commands where and info stack are synonyms for backtrace Every line in the backtrace shows a frame number and function name An instr
85. e gdb960 software debugger provides the following ways to control array structure and symbol printing Each of the set commands shown has a corresponding show command that displays the current setting For commands where the on or of f arguments are used as toggles the default iS on when the argument is omitted set print address on Display memory addresses showing the location of stack traces structure values pointer values breakpoints and so forth even when it also displays the contents of those addresses set print address off Do not display addresses when displaying their contents The following is a backtrace command example gdb960 set print address on gdb960 bt 0 hithere foo 0x55 at hi c 11 1 Oxe00081b4 in main argc 0xl argv 0xe000e960 at hello c 43 2 Oxe00080d4 in start gdb960 set print addr off gdb960 set print address off gdb960 bt 0 hiya foo 0x55 at hi c 11 1 main argc 0xl argv at hello c 43 2 start The set print address off command eliminates most machine dependent displays from the gdb960 interface For example with print address off you should get the same text for backtraces on all machines whether or not they involve pointer arguments This is especially useful if you wish to compare the results of running the same program on different hosts using gdb960 in batch mode as an execution vehicle 11 5 gdb960 User s Manual 11 6 When gdb960 displays a symboli
86. e halts execution the next time it reaches the current location In any selected frame but the innermost the breakpoint causes the program to halt as soon as control returns to that frame For more detail on how stack frames are selected and moving from frame to frame refer to Chapter 9 Set a breakpoint at address You can set breakpoints in parts of the program that do not have debugging information or source files The asterisk allows the command line parser to identify address as an address rather than a number Set a breakpoint at entry to function in filename Specifying a file name is unnecessary except when multiple files contain functions with the same name Program Execution Control break filename linenum break if cond break toffset break offset hbreak args Set a breakpoint at line 1inenumin source file filename If filename is not specified it defaults to the current file Set a breakpoint with condition cond evaluate the expression cond each time the breakpoint is reached and halt only if the value is non zero An ellipsis stands for one of the possible arguments described above or no argument specifying where to break See the Break Conditions section in this chapter for more information on breakpoint conditions Set a breakpoint offset number of lines forward or back from the execution point in the currently selected frame For MON960 only Set a hardware break
87. e larger than 500 lines of C code the time to disassemble will be quite slow The status line shows progress as it disassembles as percentages of the modules 3 31 gdb960 User s Manual Using the gdb960v Text Editor gdb960v provides an integrated text editor to manage edit and print source files Most of the procedures involved in using the editor such as file and text handling and moving around in a file should seem familiar if you have used other Windows based text editors The Text Editor window displays C source files as well as all header files used in gdb960 With the editor you can Perform advanced find and replace operations Specify syntax coloring Customize tab stops Use toolbar shortcuts for various commands Use multiple levels of undo and redo Open multiple windows for debugging monitoring variables disassembling code and displaying source files Open multiple views of the same file Take advantage of other ease of use features such as a list of recently opened files at the bottom of the File menu parsing text around the insertion point as the initial search string in a Find operation and keyboard shortcuts Editing a File Opening a File 1 From the File menu choose Open CTRL O or Click E on the Standard Toolbar The Open dialog box appears Select the drive and directory where the file is stored The default is the current drive and directory Using the gdb960 Windows Gr
88. e one currently executing the results may be unpredictable if the two functions expect different patterns of arguments or of local variables For this reason the jump command requests confirmation if the specified line is not in the function currently executing However results are predictable based on careful study of the machine language code of the program Resume execution at the instruction at address address The asterisk allows the command line parser to identify address as an address rather than a number You can get much the same effect as the jump command by storing a new value into the register ip The difference is that the program does not start running only the address where it will run when it is continued changes For example set Sip 0x485 causes the next cont command or stepping command to execute at address 0x485 rather than at the address where the program stopped The most common use of the jump command is to back up perhaps with more breakpoints set over a portion of a program that has already executed Program Execution Control gmu Commands The gmu commands allow interactive control over the Guarded Memory Unit GMU They apply to the Hx processor only gmu protect and gmu detect specify the type of GMU register to control either protection protect or detection detect Protection GMU registers are identified by number ranging from 0 to NUMPREGS 1 NUMPREGS is currently 2 on the
89. e t1 c for use with the i960 CA architecture and to include debugging information You can use the g option with or without on capital Oh where n is an optimization level making it possible to debug optimized code Note however that some debugging operations do not work as well with g 0n as with just g Many optimizations can make debugging optimized code more difficult In particular source line information in the program may be incorrect which can cause confusion while debugging Also variables that exist in your source programs may not exist at run time or their values may not be current These difficulties appear most often at higher levels of optimization You can reduce problems caused by compiler optimizations greatly by compiling with ELF DWARF object module format whenever possible Use the relf compiler option The ELF DWARF debug data is specifically enriched to aide debugging of highly optimized code If problems persist disable optimization features and compile with g only For more information on compiler options refer to the i960 Processor Compiler User s Guide 2 3 gdb960 User s Manual Starting gdb960 Starting the gdb960 Windows Graphical User Interface You can start the debugging session by double clicking the icon that was installed into your gdb960 program group during CTOOLS installation The installation also sets the proper environment variables for you When the debugger is runnin
90. ecification If you do not use any letters after the slash you can omit the slash as well If you omit the address to examine the address following the last unit examined is used String and instruction formats actually compute a unit size based on the data It ensures that the next string or instruction examined starts in the right place 11 13 gdb960 User s Manual 11 14 When the print command shows a value that resides in memory print also sets the address for the x command Similarly the info line command also sets the address for x to the start of the machine code for the specified line and info breakpoints sets the address for x to the address of the last breakpoint listed When you use RET to repeat an x command any previously specified address is ignored so the repeated command examines the successive locations in memory rather than the same ones You can use one command to examine several consecutive memory units by writing a repeat count after the slash and before the format letters The repeat count must be a decimal integer It has the same effect as repeating the x command that many times except that the output may be more compact with several units per line The following example displays x instructions starting with the one to be executed next in the selected frame x 10i Sip After displaying a set of instructions you could display the seven following instructions by entering the following example in
91. eeeeeeeeeeeeeeeeeeeeeeeeeeteeees B 2 Readline Bare Essentials ccceeeeeeeesseeeeeeeeeeeeee B 2 Readline Movement Commands cccceeeeeeeeeeeeees B 3 Readline Killing Command c ccceeeeeeeeeeeeetteeeeeeees B 3 Readline Argument ccccccceeeeceeesseceeeeeeeeeeeeeeesaeees B 5 Readline Init File a senla cutee cn cote dere te aein B 5 Readline Variables cccccccceeeeeeseesecceeeeeeeeeeeeesaaees B 6 Readline Key Bindings ceeeceeeeeeeeeeeeeeeeeeeeeeeeeeees B 7 xi gdb960 User s Manual xii Commands For Moving s s sssssssssssserrnnersssernnrnnnrrrrerrnnneseee B 7 Commands For Manipulating History 0 eeeeeeeeeees B 8 Commands For Changing Text eeeceeeesteeeeeeeeeeeeeeeeeee B 9 Killing And Yanking cise cccceredsceeecedh toiatiactezercesseeesdivthceatiee ts B 10 Specifying Numeric Argument eceeeeeeeeeeeeeeeeeeeeeees B 11 Letting Readline Type For YOu ccccceeessseeseseeeeeeeeees B 11 Some Miscellaneous Commands cceeeeeeeeeeeeeteeees B 12 Readline vi Mode scciccccsvccedsnestchages tas ieaadehnenerieeesnanteaaeetsneens B 12 Appendix C GNU History Library History Interaction 4c ds ction auotte eee keen C 2 Event DeSignatorSc st scc d tester ea eta ee eeee C 2 Word DeSignators ccccceeeeeeeneceeeeeeeeesenesseeeeeeeees C 3 NMIOGIHGTG Psst Sevarad Satahetit a e a lena eae C 3 Appendix D Usi
92. eeeeeeeeesseeaeeeeees 9 4 Frame Information ssoeseenneeeeesoeeeenernnrennreserrrrenrnnreeserrenne 9 5 Chapter 10 Examining Source Files Displaying Source LineS sesseserseerirerrrirrrserrrirserrnns 10 1 linespec Definition sssosssnnnneeesooeeeerrnrrrsrerretrrerrrnereeert 10 3 Searching Source Files i isiesieete ects viesd enced netieder aecenies 10 4 Specifying Source Directories cccccceeeeeeeeeeeeseeeeeeeees 10 5 gdb960 User s Manual Vili Chapter 11 Displaying Program Data and Symbols EXP OSS S yi aa EEE EE Program Variable Sisenna ese eieatie Assignment to Variables eeceeeeccceeeeeeeeeeeessneeeeeeeeeeeees Artificial Aray S eiers areenaa aiaee erea EEE acess Format Options aieeaii eea araea EE REER O tput Formats hrener eei a aa e Ena t E RENEE Examining Memory ssssssseeseesssesrsrrrnrrsserrrrerrnerrrrrrnn Storing to Memory ssssssssssseerseesssereerrnrressrrssrrnnrrrnnresserrnne Automatic DISD AY x0 c2ccccascaseues teetuee spss cust tehegeaveseuee aden teantee Examining the Symbol Table cceeeeeeeesseseeeeeeeees Walle History pe ear e saute sani EE E EG Convenience Variables cccccceeeeeeeeeeeeeeeeeeeeeeeeeeeeeeees Register Sea epi ea eaea E E TE EREE ER PXAIN PIGS vic ccrctatisictecnse a a e aY Profile Data File Manipulation ccceceeecteeeeteeeeeeeeeee Chapter 12 gdb960 Command and Option Reference gdb960 Invoca
93. eir options gdb960 Invocation Arguments b bps Set the baud rate bps of the serial interface to the i960 processor target system batch Run in batch mode brk Send a break of about 1 4 second in duration through MON960 to the target system after opening the connection but before trying to talk This allows you to connect to some running systems cd directory Set gdb960 s working directory to directory command cmdfile Run gdb960 commands from cmdfile d directory Add directory to the path to search for source files e file Use file as the file to download and or execute G Inform gdb960 that the target has big endian memory nx Suppress execution of commands in the gdbinit initialization file For more information on command files refer to Chapter 13 12 1 gdb960 User s Manual par device p picerfrset el pd pidoffset px offset g port readnow s file se file E target 12 2 Use parallel download instead of serial download The parallel device typically LPT1 or LPT2 in Windows is used only for downloading Other host target communications use the serial port specified with r Debug position independent code Download code sections to link time address picoffset instead of the usual link time address Specify PCI communication Refer to Chapter 2 for more information Debug position independent data Download data and bss sections to link
94. en likewise the default display for numbers when no particular format is specified is base ten You can change the default base for both input and output with the set radix command set radix base show radix set input radix base Set the default base for numeric input and display Supported choices for base are decimal 8 10 16 base must be specified either unambiguously or using the current default radix Display the current default base for numeric input and display Set the default base for numeric input that you provide Configuring the gdb960 Environment set output radix base Set the default base for numeric output printed by gdb960 set radix base Set both input and output bases Messages Complaints and Cautions By default gdb960 is silent about its inner workings The set verbose command forces gdb960 to display messages during lengthy internal operations Currently the messages controlled by set verbose announce that the symbol table for a source file is being read set verbose on Enables gdb960 s output of informational messages set verbose off Disables gdb960 s output of informational messages show verbose Displays whether set verbose is on or off You can tell gdb960 to display a message when it encounters a bug in an object file s symbol table By default gdb960 does not display such messages set complaints Permits gdb960 to output 1 imit complaints limit about each type of unusual symbol
95. ept line Newline Return preyious history CTRL p next history C TRE m beginning of history META lt end of history META gt reverse search CTRL r history Accept the line regardless of cursor position If this line is non empty add it to the history list If this line was a history line restore the history line to its original state Move up through the history list Move down through the history list Move to the first line in the history Move to the end of the input history i e the line you are entering Search backward starting at the current line and moving up through the history as necessary This is a character by character incremental search Command Line Editing forward search history CTRL FS Commands For Changing Text Search forward starting at the current line and moving down through the history The following is a list of the command names their original bindings and short descriptions for changing text on the command line delete char CTRL d backward delete char Rubout quoted insert CTRL q CTRL v tab insert META TAB self insert ap Ay dolpas transpose chars CTRL t transpose words MI ETA t Delete the character under the cursor If the cursor is at the beginning of the line and there are no characters in the line and the last character typed was not CTRL d then return E
96. ess When gdb960 reads the symbol table from your program code section labels and symbols will have picoffset added to their link time addresses to account for this relocation Debug position independent data Download data and bss sections to link time address pidoffset instead of to link time address When gdb960 reads the symbol table from your program data and bss symbols will have pidoffset added to their link time addresses to account for this relocation Enter the same offset for both pc and pa Download all sections to link time address offset instead of to link time address When gdb960 reads the symbol table from the program to debug all labels and symbols have offset added to their link time addresses to account for this relocation Getting Started q Quiet Do not display the introductory and copyright messages These messages are automatically suppressed in batch mode Using the gdb960 Windows Graphical User Interface This chapter provides information on running gdb960 using its Graphical User Interface gdb960v in Windows 95 and Windows NT Topics include e Overview e Online Help page 3 2 e Starting and Stopping the Debugger page 3 3 e A Sketch of the Debugger page 3 4 e Connecting to a Target page 3 6 e Setting the Search Path page 3 7 e Opening a File page 3 9 e Listing Code page 3 10 e Debugging with gdb960v page 3 11 e Using the dgb960v Text Editor page 3 32 e Th
97. ess the right mouse button to set a breakpoint Drag and Drop Drag a breakpoint or a temporary breakpoint icon to a location in the source pane The breakpoint or temporary breakpoint icon appears in the debug margin at the file line number where you dropped the icon 4 13 gdb960 User s Manual Running Your Program Now that you have set your breakpoints you are ready to run your program 1 Press the Run button The Target Run dialog appears 2 Inthe Target Run enter any program command line options For example you might enter debug in the box and then your initial program module main can parse these using the usual techniques of parsing argc argv This assumes you are using Intel s standard crt 960 0 startup routine 3 Press Run NOTE You can set the default invocation arguments by assigning them to the targetRunArgs variable in your tcl configuration file See Customizing the GUI on page 4 18 for more information When your program starts executing the debugger changes the appearance of the screen in a number of ways In the main window the Run button changes to the re Run button and the following new buttons appear Target interrupt Lets you interrupt processing on the target board Your board must have a break detect circuit to use this option see xyz for more information on this To resume execution from where it stopped press the step next continue or finish buttons te Step ne
98. et of well known commands for manipulating the text of previous lines and using that text in new commands The basic history manipulation commands are similar to the history substitution used by csh C 1 gdb960 User s Manual C 2 History Interaction The History library provides a history expansion feature similar to the history expansion in csh The following text describes the available syntax features History expansion takes place in two parts First determine which line from the previous history should be used during substitution Second select portions of that line for inclusion in the current line The line selected from the previous history is called the event and the portions of that line that are acted upon are called words The line is broken into words in Bash shell fashion Words are delimited by white space with the exception of quoted strings So several words surrounded by quotes are considered one word Event Designators An event designator is a character or character sequence that refers to a command line entry in the history list The following is a list of event designators and descriptions of their effects Start a history substitution except when followed by a space tab or end of line L Refer to the previous command This is a synonym for 1 In Refer to command line n lan Refer to the command line n lines back string Refer to the most recent command starting with string str
99. evenbit strings Display using only seven bit characters on if this option is set gdb960 displays any eight bit characters in strings or character values using the notation NnwN For example M a is displayed as octal 341 set print sevenbit strings Display using either seven bit or eight off bit characters as required off is the default set print union on Display unions that are contained in structures on is the default set print union off Do not display unions contained in structures The following example demonstrates displaying structures containing unions The structures are declared initialized and displayed with union both on and off typedef enum Tree Bug Species typedef enum Big_tree Acorn Seedling Tree_forms typedef enum Caterpillar Cocoon Butterfly Bug_forms Struct thing Species it union Tree_forms tree Bug_forms bug form Displaying Program Data and Symbols struct thing foo Tree Acorn gdb960 set print union on gdb960 print foo 2 it Tree form tree Acorn bug Cocoon gdb960 set print union off 62 it Tree form frs Output Formats The gdb960 software debugger normally displays all values according to their data types Output formats allow you to view data as other types Possible types are e integer in hexidecimal e integer in signed decimal e integer in unsigned decimal e integer in octal e integer in binary e
100. ext into the file you created 3 33 gdb960 User s Manual 3 34 Cutting Copying and Pasting Text 1 Select the text you want to paste 2 From the Edit menu choose the Cut CTRL X or SHIFT DEL or Copy CTRL C or CTRL INS 3 Place the insertion point in any source window where you want to insert the text 4 From the Edit menu choose the Paste CTRL V or SHIFT INS Moving to a Line 1 From the Edit menu choose Go To The Go To dialog box appears 2 Inthe Line box type a line number 3 Click OK If you type a line number greater than the last line in your source file the editor moves to the end of the file Finding a Text String 1 Position the insertion point where you want to start your search If you select some text the editor uses that text as the default search string 2 From the Edit menu choose Find ALT F3 The Find dialog box appears 3 Type the search text in the Find What box 4 Select any of the Find options 5 To begin your search choose Find Next The find dialog box disappears when the search begins To repeat a find operation you can use the F3 shortcut key To begin a find without bringing up the Find dialog box select a text string in a source file then press ALT F3 Finding and Replacing Text 1 Position the insertion point where you want to start your search If you select some text the editor uses that text as the default search string Using the gdb960 Windows Gr
101. fier an expression a string a symbol or a value Substitute one of these items for the place holder means the syntactic symbols enclosed by the braces are optional i means you must select one and only one of the syntactic symbols enclosed in the braces means exclusive or Select only one of the syntactic items on opposite sides of the bar amp means and In syntax specification except when used in a C expression as a unary operator shows that symbols on both sides of the must appear together UNIX and Windows Command Line Differences Most examples in this manual show a UNIX command line Unless otherwise specified examples work in both UNIX and Windows 95 NT environments In Windows you can precede optional arguments with either a or however you must use a backslash in directory pathnames Related Publications This manual contains the information needed to use the debugger The publications list in Getting Started with the i960 Processor Development Tools provides the order numbers and brief descriptions of related manuals and books For information on ordering these and other Intel publications contact your local Intel sales office or write to the Intel Literature Sales Department P O Box 7641 Mt Prospect IL 60056 7641 or call 1 800 548 4725 gdb960 User s Manual 1 8 Online Help All three gdb960 interfaces Windows GUI UNIX GUI and Windows UNIX command line provide online hel
102. fore breakpoint commands are run displays are printed or the stack frame is printed For example suppose you want to execute a troublesome loop over and over but you do not wish to single step through it The following resets the loop counter before cont inue and examines the registers each time execution stops gdb960 define hook continue set var i 12 end gdb960 define hook stop regs end gdb960 continue 13 3 gdb960 User s Manual 13 4 You can define a hook for any single word command in gdb960 but not for command aliases you should define a hook for the basic command name e g backtrace rather than bt If an error occurs during the execution of your hook execution of gdb960 commands stops and gdb960 issues a prompt before the command that you actually typed had a chance to run To undefine a hook redefine it with the word end only Command Files A command file contains gdb960 command lines Comments and lines starting with can also be included An empty line in a command file does nothing it does not repeat the last command On invocation gdb960 first executes commands from its init files These are files named gdbinit on UNIX hosts and init gdb on DOS hosts The gdb960 debugger reads any init file in your home directory then any init file in the current working directory The init files are not executed if the nx invocation option is given You can also request the execution of a c
103. g you can interact with it through the editor window through the Debugger command window and through the Debug menu and toolbar See Chapter 3 for details Starting the gdb960 UNIX Graphical User Interface To start the gdb960 UNIX GUI use the syntax gdb960v options where opt ions is any of the options allowed by the gdb960 command line interface see Chapter 12 for more information For example in Bourne shell you might enter SG960BASE bin gdb960v r dev tty0 myprogram You can also use 4 display option which allows you to explicitly set the X terminal type used for the display For example gdb960v r dev tty0 d system company com 0 0 myprogram selects the X DISPLAY as the console of system company com If no d option is given the debugger uses the current setting of the DISPLAY environment variable If it is not set the debugger issues a fatal error When the debugger is running you are ready to load an executable s symbols and begin debugging See Chapter 4 for details Getting Started Starting the Command Line Interface You can invoke gdb960 s command line interface from a Windows command prompt box a UNIX command line an Emacs command line or with a batch command file executed from a Windows or UNIX command line Once started gdb960 interactively reads commands from standard input until you exit the debugger by entering the quit command NOTE Unless otherwise specified command line options
104. gdb960 User s Manual Order Number 485546 003 Revision 001 002 003 Revision History Original Issue Revised for R5 0 Revised for R5 1 Date 05 94 02 96 01 97 In the United States additional copies of this manual or other Intel literature may be obtained by writing Literature Distribution Center Intel Corporation P O Box 7641 Mt Prospect IL 60056 7641 Or you can call the following toll free number 1 800 548 4725 In locations outside the United States obtain additional copies of Intel documentation by contacting your local Intel sales office Intel Corporation makes no warranty of any kind with regard to this material including but not limited to the implied warranties of merchantability and fitness for a particular purpose Intel Corporation assumes no responsibility for any errors that may appear in this document Intel Corporation makes no commitment to update nor to keep current the information contained in this document Intel Corporation assumes no responsibility for the use of any circuitry other than circuitry embodied in an Intel product No other circuit patent licenses are implied Intel software products are copyrighted by and shall remain the property of Intel Corporation Use duplication or disclosure is subject to restrictions stated in Intel s Software License Agreement or in the case of software delivered to the government in accordance with the software license agreement
105. get command to connect to your target Either version When the target stops running for the first time due to a breakpoint or single stepping Emacs splits the current window vertically showing you the text of the current source file in the second window This new buffer is continually updated as you step through your source code A special interface allows you to use GNU Emacs to view and edit the source files for the program you are debugging with gdb960 Using gdb960 under Emacs is just like using gdb960 normally except in two aspects 1 All terminal input and output goes through the Emacs buffer This applies both to gdb960 commands and their output and to the input and output produced by the program you are debugging This is useful because it means you can copy the text of previous commands and input them again you can even use parts of the output that way All the facilities of Emacs shell mode are available for interacting with your program In particular you can send signals the usual Emacs way for example c c c c for an interrupt and c c C z for a stop Using gdb960 Under GNU Emacs 2 gdb960 displays source code through Emacs Each time gdb960 displays a stack frame Emacs automatically finds the source file for that frame and puts an arrow gt at the left margin of the current line Emacs uses a separate buffer for source display and splits the screen to show both your gdb960 session and the source Ex
106. hardware breakpoints but 1960 processor architecture allows only two to be enabled at any one time help help option Displays information about gdb960 commands option With no arguments help displays a short list of command categories ignore ignore bnum count Sets the count of breakpoint number bnumto count The next count times the breakpoint is reached your program s execution does not halt other than to decrement the ignore count gdb960 takes no action To make the breakpoint halt the next time it is reached specify a count of zero 12 17 gdb960 User s Manual info info option Displays requested information address symbol all registers args break bnum display files frame addr 12 18 option_modifier Describes where the data for symbol is stored Display the names and relativized values of all registers including floating point registers Display the selected frame s arguments each on a separate line The command info break displays a list of all breakpoints set and not deleted showing their numbers where in the program they are and any special features related to them bnum identifies breakpoints about which information should be displayed Display the list of expressions set up to display automatically each one with its item number Display the current target including the names of the executable files currently in use and the files from which s
107. he breakpoint halt the next time it is reached specify a count of zero continue count Continue executing the program If count fg count is specified ignore count of the breakpoint that halted execution to count minus one The program does not halt at the breakpoint again until the breakpoint is encountered count times Program Execution Control Except when halted at a breakpoint the argument to cont inue is ignored The synonym fg is provided for convenience and has exactly the same behavior as continue NOTE Jfa breakpoint has a positive ignore count and a condition the condition is evaluated each time the breakpoint is hit but execution does not stop until the ignore count reaches zero Commands Executed on Breaking You can give any breakpoint a series of commands to execute after execution halts at a breakpoint For example you might want to display the values of certain expressions or enable other breakpoints The following command allows creation of a list of commands that can be associated with breakpoints commands bnum Specify a list of commands for breakpoint number bnum Enter the commands one per line on separate lines following commands Type a separate line containing the end command to terminate the commands To remove all commands from a breakpoint follow commands immediately by end NOTE With no arguments commands refers to the last breakpoint set not to the breakpoint most recently en
108. he current stack frame The gdb960 debugger always views the contents of a register as an integer when the register is examined in this way Some machines have special registers that can hold nothing but floating point values There is no way to refer to the contents of an ordinary register as a floating point value However you can display the value in an ordinary register as a floating point value by entering the print f regname command Some registers have distinct raw and virtual data formats Register contents are saved by the operating system in a different data format from the one your program normally sees For example the registers of the 1960 KB floating point coprocessor are always saved in extended raw format but most C programs expect to work with double virtual format The gdb960 debugger normally works with the virtual format only the format that makes sense for your program but the info registers command displays the data in both formats Except for g0 through g15 register values are relative to the selected stack frame For more information on the stack frame refer to Chapter 9 The result is the value the register would contain if all stack frames nearer to 0 were exited and their saved registers restored To see the real contents of all registers you must select the innermost frame by entering the command frame 0 The global registers g0 through g15 are never saved For these registers relativization makes
109. he front of the source path gdb960 Command and Option Reference disable disable display breakpoints bnums Disables the breakpoints listed in bnums Any number of breakpoints may be listed by number Separates each number from the next by a space The breakpoints keyword is not necessary unless differentiating between disabling the display of breakpoints display and disabling breakpoints If no list of breakpoints is specified all breakpoints are disabled disassemble disassemble function address address Provides a dump of a range of memory as machine instructions address The range is the inclusive area bounded by the two machine addresses provided in the address arguments If only one address argument is provided gdb960 finds the first C function that starts at an address less than or equal to the given address then disassembles the entire function function If only a function argument is provided then the function named in function is disassembled in its entirety If the string in function is nota function name then its address is calculated and acted on as though it were an address argument 12 9 gdb960 User s Manual 12 10 display display format exp addr Prints a list of expressions each time the program stops Without arguments displays the current values of the expressions on the list just as when the program stops addr For fmt i or s or when including a uni
110. in examples are presented using the UNIX x option specification syntax Either the x syntax or the x syntax is allowable on Windows systems Command line options apply to both the GUI and the command line versions of gdb960 The command name for invoking the debugger is gdb960 Enter gdb960 along with associated options to start an interactive debugging session The following invocation example starts the gdb960 software debugger and establishes communication with a MON960 debug monitor connected to tty x running at the default baud rate 38400 bps The debugger reads symbols from the file program then downloads program to the MON960 debug monitor gdb960 r port program e for example to specify a serial port on a host and load the program with symbols for the executable myprogram you would enter the command in Windows and UNIX gdb960 r com2 myprogram Windows Host gdb960 r dev tty0 myprogram UNIX Host e To specify serial communication and parallel download gdb960 r com2 par lpt1 myprogram Windows Host gdb960 r dev tty0 par dev bpp0 myprogram UNIX Host 2 5 gdb960 User s Manual For PCI communication gdb960 pci myprogram Windows Host Changing Your Target Settings After Starting gdb960 After you have run gdb960 you can change your target communications settings using the target command at the gdb960 prompt gdb960 executable gdb960 target mon960 port hdil arguments The following is a
111. inary The letter t stands for two o Display as integers in unsigned octal Displaying Program Data and Symbols a Display as an address both absolute in hex and then relative to a symbol defined as an address below it Note that p a and x a are similar but not exactly the same The following example shows p a displaying the result of an expression as if it were an address gdb960 p a main 8 9 0xe00080e8 lt maint 8 gt The following example of the x a command shows it displaying the contents of the result of the expression as if it were an address There is an additional level of indirection here gdb960 x a amp main Oxe000880e0 lt main gt 0x59084810 gdb960 x a Oxe000880e8 Oxe000880e8 lt maint8 gt OxeQ0080f0 lt main 16 gt c Display as character constants f Display as floating point This works only with sizes w and g s Display a null terminated string of characters The specified unit size is ignored instead the unit is however many bytes it takes to reach a null character including the null character Display a machine instruction in assembler syntax The specified unit size is ignored the number of bytes in an instruction varies depending on the type of machine the op code and the addressing modes used The command disassemble is an alternative for inspecting machine instructions If either the manner of displaying or the size of unit is unspecified the default is to use the last used sp
112. ing Refer to the most recent command containing string GNU History Library Word Designators A colon separates event specifications from the word designators The colon can be omitted if the word designator begins with or 3 Words are numbered from the beginning of the line with the first word being denoted by a 0 zero 0 zero The zero th word This is usually the command word n The n th word The first argument That is word 1 The last argument The word matched by the most recent string search x y A range of words y is the abbreviation for 0 y All of the words excepting the zero th This is a synonym for 1 It is not an error to use if there is just one word in the event The empty string is returned in that case Modifiers Modifiers allow modification of designator created commands After the optional word designator you can add a sequence of one or more of the following modifiers each preceded by a colon The entire current command line typed so far h Remove a trailing pathname component leaving only the head Remove a trailing suffix of the form suffix leaving the basename C 3 gdb960 User s Manual C 4 Remove all but the suffix Remove all leading pathname components leaving the tail Display the new command but do not execute it This takes effect immediately so it should be the last specifier on the line Using gdb960 with Ap
113. ing the previously described mcon commands to write an appropriate bus width setting into the applicable PMCON register When enabling cacheable memory i e DRAM the processor s PMCON LMADR and LMMR registers must all be configured The effective address range for a logical data template is defined using the A31 12 field in the LMADRx register and the MA31 12 field in the LMMRx register For each data access the upper 20 bits of the effective address are compared against A31 12 of the LMADRx Only address bits for which the corresponding mask bit is set in the LMMRx register are compared Effective address bits with corresponding mask bits cleared are automatically considered a match Logically the operation is as follows EFA 31 12 xnor LMADRx A31 12 or not LMMRx MA31 12 where EFA 31 12 is the effective bus address Only when all compared address bits match are the LMADR x be used for the current bus access D 3 gdb960 User s Manual D 4 The following example gdb960 commands enable 32 bit DRAM in memory region A of an EP80960JX target connected to ApLink c gt gdb960 r coml gdb960 mcon a 0x800000 32 bit bus width gdb960 Imadr 0 0xa0000002 data caching configured for region A gdb960 Immr 0 0xf0000001 set mask register to appropriate value amp enabl template gdb960 Scripts gdb960 supports command scripts that automate enabling a target s DRAM and or peripheral mem
114. ing unique filenames across directory boundaries Using the gdb960 Windows Graphical User Interface You can set the debugger source paths prior to starting the debugging session The directories you enter here persist to the next debugger invocation Opening a File You are now ready to open a program file load its symbols and or Download code from it to the target You can edit a file using the Open file menu item in the File menu See Source Views on page 3 29 for more information 1 Press the Open Binary button located in the gdb960v buttons pane Alternatively you can pull down the File menu and choose Open Binary 2 In the File select dialog select the desired program file and choose OK This window shown in Figure 3 5 appears Figure 3 5 Open Window Open TEST B IX Download code 3 You can now load the symbols and or download the code to the target For the purposes of this chapter select Load symbols and download code and choose OK The status line in the lower left corner of the window tells you when the debugger has finished loading the symbols and or downloading the file Also the List source code button replaces the Open Binary button in the gdb960v buttons pane You are now ready to use the debugger s options for listing code as described in the next section gdb960 User s Manual 3 10 Listing Code Figure 3 6 The debugger lets you display any of the file
115. ingdb960 htm with your web browser At installation this file is placed the in directory G960BASE i960BASE html tools Running the GUI Debugger To start the gdb960v UNIX GUL use the syntax gdb960v options where opt ions is any of the options allowed by the gdb960 command line interface see chapter 12 for more information For example in borne shell you might enter S G960BASE bin gdb960v r dev tty0 myprogram You can also use 4 display option which allows you to explicitly set the X terminal type used for the display For example gdb960v r dev tty0 d system company com 0 0 myprogram selects the X DISPLAY as the console of system company com If no a option is given the debugger uses the current setting of the DISPLAY environment variable If it is not set the debugger issues a fatal error Using the gdb960 UNIX Graphical User Interface A Sketch of the Debugger Here is the initial gdb960v screen File Target Target connect Open file No target No file under certain conditions type show copying to see the conditions There is absolutely no warranty for GDB type show warranty for details gdb960 5 0 003 Mon Sep 9 13 55 20 PDT 1996 GDB 4 13 sparc sun sunos4 1 3 target i960 intel hdi Copyright 1994 Free Software Foundation Inc gdb960 I The initial screen includes e A menu bar with pull down menus for File and Target e A toolbar with buttons that vary depe
116. ining data refer to Chapter 11 11 3 gdb960 User s Manual NOTE f the beginning of a set command s argument string appears identical to a set subcommand you may need to use the set variable command This command is identical to set except for its lack of subcommands Artificial Arrays It is often useful to display several successive objects of the same type in memory e g a section of an array or an array of dynamically determined size for which only a pointer exists in the program To display successive objects construct an artificial array by using the binary operator The left operand of is the first element of the desired array as an individual object The right operand is the number of objects in the array The result is an array value whose elements are all of the type of the left argument The first element is actually the left argument the second element comes from bytes of memory immediately following those that hold the first element and so on Given the following example source line you might want to display the contents of array int array int malloc len sizeof int To display the contents of array enter the following line p array len The left operand of must reside in memory Array values made with in this way behave just like other arrays in terms of subscripting and are coerced to pointers when used in expressions Displaying Program Data and Symbols Format Options Th
117. integer as character constant e address as hexadecimal e floating point To display a value already computed start the arguments of the print command with a slash and a format letter The following is a list of the supported format letters x Regard the bits of the value as an integer and display the integer in hexadecimal d Display as integer in signed decimal u Display as integer in unsigned decimal o Display as integer in octal Display as integer in binary The letter t stands for two 11 9 gdb960 User s Manual 11 10 a Display as an address both absolute in hex and as an offset of the nearest preceding symbol This format can be used to discover in which function an unknown address is located gdb p a 0x54320 3 054320 lt _ initialize vx 396 gt Regard as an integer and display as a character constant Regard the bits of the value as a floating point number and display using floating point syntax The following example displays the instruction pointer in hexadecimal Dx Sip No space is required before the slash because gdb960 command names cannot contain a slash To redisplay the last value in the value history with a different format you can use the print command with a format and no expression For example p x redisplays the last printed value in hex Examining Memory This section contains information about manipulating and examining memory contents The commands listed below
118. inter values breakpoints and so forth even when it also displays the contents of those addresses on is the default 12 29 gdb960 User s Manual 12 30 print array print autoderef on off on GEE print elements NUMBER OF ELEMENTS print hit counts print max symbolic offset on off J max offset print null stop on GEE l print pretty on GEE Display pretty print arrays This format is more convenient to read but uses more space off is the default Print char variables as strings on is the default When displaying a large array stop displaying after printing the number of elements set by the set print elements command The limit also applies to display of strings Setting the number of elements to zero allows unlimited displaying Display the number of times a breakpoint or watchpoint was encountered in info break output off is the default Display only the symbolic form of an address if the offset between the closest earlier symbol and the address is less than max offset The default is zero to always display the symbolic form of an address if any symbol precedes it Stop printing of char arrays on the first null character when on The default is off Display structures in an indented format with one member per line off is the default format gdb960 Command and Option Reference print sevenbit strings on GEE print symbo
119. ion Control The following is a list of commands that remove breakpoints or watchpoints clear clear function clear filename function clear linenum clear filename linenum delete breakpoints PNUM 44 delete Dnums delete Delete any breakpoints at the next instruction to be executed in the selected stack frame When the innermost frame is selected clear deletes the breakpoint at which the program halted Delete any breakpoints set at the entry to the function function Delete any breakpoints set at or within the code of the specified line Delete the breakpoints of the numbers specified as arguments If no argument is specified delete all breakpoints Disabling Breakpoints and Watchpoints Once a breakpoint is created it can be set to one of the four following states e Enabled The breakpoint halts the program A breakpoint made with the break command starts out in this state e Disabled The breakpoint has no effect on the program e Enabled once The breakpoint halts the program but when it does so it is disabled A breakpoint made with the toreak command starts out in this state e Enabled for deletion The breakpoint halts the program but immediately after the breakpoint is deleted permanently Disabling renders a breakpoint inoperative However a disabled breakpoint can be enabled again Disable and enable breakpoints with the disable and enable commands optionally specifying o
120. ion continues until the current function completes then the debugger regains control in the calling statement This button is equivalent to the Finish command in the Debug menu see Navigating through a Program on page 3 17 Move one level up the function stack This button is equivalent to the Up Stack Frame command in the Debug menu see Viewing Alternate Stack Levels on page 3 20 The change is reflected in the Backtrace and Register windows Move one level down the stack This is the converse of the up button This button is equivalent to the Down Stack Frame command in the Debug menu see Viewing Alternate Stack Levels on page 3 20 The change is reflected in the Backtrace and Register windows The Debug menu provides an alternate method from debugger buttons to invoke commands and also presents supplementary debugger commands Refer to the online help for detailed descriptions of each option Downloading a Module Once the debugger is running and you have connected to a target you can download code to the target board 1 Click on the Download button Alternatively you can pull down the Debug menu and choose Download or press Shift F6 Select a program to download to the target for debugging You can also do this operation while opening a binary file See Opening a File on page 3 9 for details This brings up the Download objects dialog box where you can select one or more object modules
121. isplays it in a specified format Expressions Many different gdb960 commands accept an expression and evaluate its value Any valid C operator constant or variable is legal in a gdb960 expression including conditional expressions and casts Symbols defined by preprocessor define commands do not evaluate 11 1 gdb960 User s Manual In addition to C language operators the gdb960 debugger supports the following three operators type addr Program Variables a binary operator for treating parts of memory as arrays For more information on treating memory as arrays refer to the Artificial Arrays section in this chapter allows specification of a variable in terms of the file or function in which the variable is defined Refers to an object of type type stored at memory address addr where addr may be any expression whose value is an integer or pointer but parentheses are required around non unary operators just as in acast The type construct is allowed regardless of what kind of data resides at addr The most common kind of expression used to examine data is a variable name A reference to a variable by an expression assumes the reference is to an instance of the variable that is located in the selected stack frame the variable must either be global static or be visible according to C s scope rules from the point of execution in that frame For more information on the selected stack frame refer to Chapter 9
122. ists the line that is found select frame select frame n addr When used with any of the arguments described with the break command selects a stack frame with no argument does not change which frame is selected The select frame command does not display information The select frame command can be used as an argument to into n Select frame number n where frame zero is the innermost currently executing frame addr Select the frame at address addr set set item setting filename Changes the setting of a debugger attribute args Specify the arguments to be used the next time the program is run If set args has no arguments it means use no arguments the next time the program is run autoreset on off When on the default quit resets the target 12 27 gdb960 User s Manual 12 28 Caching on oft complaints limit confirm I off on editing on off env var value height lpp history option expansion on expansion off filename Prevent gdb960 from caching target memory if of f is set By default caching is enabled set caching on Permit gdb960 to output limit complaints about each type of unusual symbol before becoming silent about the problem The default is zero off Set limit to a large number five is reasonable so complaints are not suppressed Disables or enables the default cautious questions Enable or disable command line ed
123. it for this register in the GMU control register If regnum is omitted enable all GMU protection registers Examples gdb960 gmu protect define 0 urwxc 0 Oxfffc0000 This example establishes 256 KB of illegal access protection beginning at address 0 Any user mode access to this memory range triggers a fault All supervisor mode access is allowed without generating a fault Protection register 0 is used gdb960 gmu detect define 4 sw uw 0xa0010000 0xa0020000 This example initializes detection register 4 as follows 64 KB of illegal access detection beginning at address 0xa0010000 Either a user mode write or a supervisor mode write to this memory range triggers a fault Examining the Program Stack The gdb960 debugger provides commands for examining the stack It allows you to see information about where the call was made and the local variables of the called function Each function call causes information to be saved in a block of data called a stack frame The stack frame also contains the call s arguments All stack frames are allocated from a region of memory called the call stack The gdb960 debugger selects one of the stack frames and many gdb960 commands act on the selected frame In particular when you ask gdb960 for a variable s value the value is sought in the selected frame Commands are provided in gdb960 to allow selection of any stack frame When execution halts gdb960 automatically selects the currently execu
124. iting on is the default Set the environment variable var to expression value Set the number of horizontal output lines on the screen The set history options to control history expansion are Enable history expansion Disable history expansion default Set the command history file to filename gdb960 Command and Option Reference history save on off history size size input radix base listsize n output radix base print address on off Record the gdb960 command history in a file By default filename is gdb_history on UNIX and hist gdb on DOS However when the GDBHISTFILE environment variable is set its value is used You can also specify a filename using the set history filename command By default set history save is off Set the number of commands that gdb960 keeps in its history list The default is the value of the HISTSIZE environment variable or 256 if HISTSIZE is not set Set the default base for numeric user input Supported choices for base are decimal 8 10 16 base must be specified either unambiguously or using the current default radix Set the number of lines to list to n Set the default base for numeric output Supported choices for base are decimal 8 10 16 base must be specified either unambiguously or using the current default radix Enable or disable display of memory addresses showing the location of stack traces structure values po
125. itions If the conditions evaluate to false then the debugger silently continues program execution If the conditions evaluate to true then the debugger announces the interruption The effects of momentary interruptions to a real time system must be considered when setting conditional breakpoints When each breakpoint is created the debugger assigns it a number The numbers are successive integers starting with 1 In commands for controlling breakpoint features the breakpoint number determines which breakpoint is affected Each breakpoint can be enabled or disabled if disabled it cannot effect program execution until enabled 8 1 gdb960 User s Manual 8 2 Breakpoints are set with the break command abbreviated b The gdb960 software debugger allows any number of breakpoints on the same line in a program When it resumes execution the gdb960 debugger ignores breakpoints until at least one instruction has been executed Otherwise you could not proceed past a breakpoint without first disabling it Refer to Chapter 2 for more information on breakpoints and symbolic debugging of optimized code The following is a list of commands that create examine or manipulate breakpoints Accompanying each command is a description of its use break break address break filename function Set a breakpoint at the next instruction to be executed in the selected stack frame A breakpoint set with break in the innermost fram
126. ives you options for viewing the contents of registers A dialog box appears indicating various information about the target to which you have connected Target information Attached to dev ttya at 38400 bps HDIL 3 0 2 CX at 33 MHz with 32MB DRAM Cyclone EP Rev B MONS60 3 0 1a Jan 26 1996 CF step number 05 Big Endian No executable file has been loaded to the remote Cpu status information PRCB address Oxa00010c0 System procedure table address Oxa0000700 Fault table address 0xa0000f50 Interrupt table address Oxa0000b40 Base of Interrupt stack 0xa0001380 Control table address 0xa0001050 Note also that if you have previously opened a file and read the symbols from it the Download button appears on the toolbar 4 7 gdb960 User s Manual 4 8 Opening a File You are now ready to open a program file and then load its symbols and or download code from it to the target You can also edit the file in a text editor as described in Editing Source Code on page 4 18 1 Press the Open File button This window appears Directory name Selected File name Contains Sub Directories You can also access this window by opening the File menu and choosing Open 2 Select the desired file by entering the directory and filename in the text boxes provided or by selecting one of the directory or file items in the two list boxes provided 3 Choose OK 4 A window appears giving you the option to edit the so
127. kpoint t Up stack Z Toggle Temporary 4 Down stack breakpoint 4 Step You can get the same help using the tool tip feature Place the mouse over the button and pause A bubble pops up letting you know what the button does Using the gdb960 Windows Graphical User Interface The following paragraphs describe each button x Download an object module to the connected target This button is equivalent to the Download command in the Debug menu it opens a file browser to find the module See Downloading a Module on page 3 15 Run a program on the target under debugger control A Run dialog box allows you to specify initial arguments for the program This button is equivalent to the Run command in the Debug menu See Navigating through a Program on page 3 17 for more information Stop the debugger This button is equivalent to the Stop Debugging command in the Debug menu Set or remove a breakpoint or temporary breakpoint on the current line of the editor window To insert a breakpoint place the mouse cursor on the desire line press the left mouse button to select the line then press y to insert a breakpoint or x to insert a temporary breakpoint The breakpoint is inserted at the next valid stopping point To delete a breakpoint place the mouse cursor on a line that is already marked with the breakpoint icon press the left button and then press vjor y This button is equivale
128. l data recording symbols and data types which are part of the old symbol table data being discarded filename Read symbol table information from file filename PATH is searched when necessary Use the file command to run both the symbol table and the program from the same file 12 33 gdb960 User s Manual 12 34 target target type devicename hdil_arguments type devicename Connect to an i960 processor board controlled by a type mon960 The devicename is the name of the serial device to use for the connection e g dev ttya On Windows hosts this is the name of your serial port e g COM1 hdil_arguments See the MON960 Debug Monitor User s Guide for valid arguments to pass as hdil_arguments tbreak tbreak args Sets a breakpoint enabled to cause only one halt The arguments list args is the same as in the break command and the breakpoint is set the same way but the breakpoint is automatically disabled the first time it is encountered For more information on disabling breakpoints see the disable command in this chapter thbreak thbreak args Sets a hardware assisted breakpoint enabled to cause only one halt The arguments list args is the same as in the hbreak command and the breakpoint is set the same way However the breakpoint is automatically disabled the first time it is encountered undisplay undisplay dnums Removes item numbers dnums from the list of expressions to display gdb9
129. laaeee 12 15 gmu protect disable we eos eeleedeitnct teased descent deidocextangaed 12 16 gmu protect enable cccccsccceceeeeeeeeeeeeseeeeeeeeeeeeeeeee 12 16 HDG ANC ai Geral a E ET 12 17 FGI rese eer E EAER 12 17 TELOLET OE 12 17 NIO a a a a a Raa 12 18 JUMPee a E E a E E 12 20 liS a a etedbametcntans 12 20 aae e tens E E E EAEAN 12 21 IMNE pora vince E O A RORE E ERE aa 12 21 gdb960 User s Manual fe Y PRO pre re Oe ee a aa A oe 12 22 Make tite hel A iin et A eet athe a Ae ee 12 22 MEON eii E EOE eee bee sseee E RE 12 22 LES A E E E T E E E E T 12 22 NON aa EAE NAE R ieenterteeess 12 23 OUP Utin a E ane eat 12 23 pathir e a a ea eere 12 23 PINDA aa a a E A eet 12 23 Brinte nt rece ener en Per cree ne renee aa Pen eet 12 24 PIINTS YMG sesso she aee aeae e EE ERE earner adenine 12 24 profilera are eo hei eade esate EEEE EART eens 12 24 PYPE eoa a ae aa aa A A aE 12 25 WG AN TEE EEE EE E E E 12 25 qU ia a a T a 12 25 reak aera a a tact a 12 25 OOS e e e ee ee ee 12 26 VOSOU EAA N AAE O A E E A E OA A 12 26 fEVErse SE ale his isciceech eich a a a E 12 26 PUD sxeisecrteesatasttetareedince deal dea ea Mos tel dns etc lnos E 12 26 SOA ede T AAA E tee hasta Sa A 12 27 selectiraMNe ren ern n a oxacsvis igaeiveenecteae eae 12 27 e AEE E E A E A tented 12 27 shelli ierra aaia aatan ita 12 32 SO a ask a aiek eae oee 12 32 SOUCO noona teat Noch aires ee cliente een dee e bea ciliene eee 12 32 SLSD siete sete tahiti E Bie eee
130. lay the last x values in the value history with their item numbers This is like pss9 repeated x number of times except that show values does not change the history show values n Display x history values centered on history item number n show values Display x history values just after the values last printed Convenience Variables You can use convenience variables within gdb960 to hold a value and refer to it later These variables exist entirely within gdb960 and are not part of your program Setting a convenience variable does not affect further execution of your program so you may use them freely Convenience variables have names starting with Any name starting with s can be used for a convenience variable unless it is one of the pre defined register names For more information on registers and register names refer to the Registers section in this chapter Displaying Program Data and Symbols You can save a value in a convenience variable with an assignment expression just as you would set a variable in your program The following example saves the value contained in the object pointed to by object_ptr in the foo convenience variable set foo object_ptr Using a convenience variable the first time creates it but its value is void until you assign a new value You can alter the value with another assignment at any time because convenience variables have no fixed types You can assign a convenience variable any t
131. le The add symbol file command reads filename address additional symbol table information from filename Use this command when that file has been dynamically loaded by some other means Configuring the gdb960 Environment cd directory d directory e file exec file filename file filename into the running program The address argument must be the memory address at which the file has been loaded The symbol table of filename is added to the symbol table originally read with the symbol file command You can use the add syms command any number of times the new symbol data keeps adding to the old In contrast the symbol file command loses all the symbol data gdb960 has read before loading new symbols Set gdb960 s working directory to directory Add directory to the search path for source files Use file as the file to download and or execute Specify that the program to be run but not the symbol table is found in filename The gdb960 debugger searches the environment variable PATH when necessary to locate the program Use the file command to get both the symbol table and the program to run from the same file Use filename as the program to be debugged p c d x offset It is read for its symbols and pure memory contents and it is executed when you give the run command If you do not specify a directory and the file is not found in gdb960 s working directory gdb960 uses the PATH environment variable
132. lected frame Set a breakpoint offset number of lines forward or back from the execution point in the currently selected frame 12 5 gdb960 User s Manual 12 6 call call function args Calls a function in the program The function function is called with argument args and the return value is printed and saved in the value history if it is not void cd cd directory Sets gdb960 s working directory to directory clear clear argument Deletes any breakpoints at the next instruction to be executed in the selected stack frame When the innermost frame is selected clear deletes the breakpoint at which the program halted breakpoints bnums Delete the breakpoints of the numbers specified in bnums function filename function Delete any breakpoints set at the entry to the function function linenum Delete any breakpoints set at or within the code filename linenum of the specified line commands commands bnum Specifies a list of commands for breakpoint number bnum The commands appear one per line on separate lines following commands Type a separate line containing the end command to terminate the commands gdb960 Command and Option Reference To remove all commands from a breakpoint follow commands immediately by end condition condition bnum expression Adds a condition to a breakpoint bnums The breakpoint numbers of breakpoints to alter expression The break condi
133. lic disassembly print symbol filename on oft Print union on GFE prompt newprompt radix base variable var expr Display using only seven bit characters if this option is set gdb960 displays any eight bit characters in strings or character values using the notation NNN For example M a is displayed as octal 341 off is the default Can be abbreviated set print symbolic When on addresses in the disassembly show the machine address followed by lt symbo1 1234 gt where symbo1 is the closest preceding function name Turning this off reduces clutter in the display The on setting is the default Disable or enable displaying the source file name and line number of a symbol in the symbolic form of an address off is the default Display unions contained in structures on is the default Direct gdb960 to use newprompt as its prompt string Set the default base for numeric input and display Supported choices for base are decimal 8 10 16 base must be specified either unambiguously or using the current default radix Set the variable var to expression expr The keyword variable is required when var conflicts witha set print keyword 12 31 gdb960 User s Manual 12 32 verbose on off width cpl shell shell command Enable gdb960 s output of certain informational messages off is the default Contain the number of lines on the screen and cp1 contains the number of columns
134. list of command line options and their descriptions r port Specify the serial port name of a serial interface to use to connect to the target system If no target type is set using the t option or target command the debugger assumes that MON960 is the target monitor You can specify port as any of e a full pathname e g r dev ttya e a device name in dev e g r ttya the unique suffix for a specific tty e g r a t mon960 Use MON960 as the target type This is the default target type b bps Set the line speed baud rate or bps of the serial interface to the target system MON960 supports baud rates of 1200 2400 9600 19200 and 38400 bps the default on UNIX hosts some of these may not be available on every host The additional unsupported baud rates 57600 and 115200 may work on some hosts Getting Started brk par device pcib bus_no dev_no func_no pciv vendor_id device_id Send a break of about 1 4 second in duration to the target system after opening the connection but before trying to communicate If the target board is equipped with a break triggered reset circuit this allows you to connect to a running system Use parallel download instead of serial download Use parallel device device for downloading typically LPT1 or LPT2 on Windows varies on UNIX The parallel device is used only for downloading Other host target communications use the serial port specified with r or
135. lutely no warranty for GDB type show warranty for details gdb960 2 4 Thu Mar 10 09 14 12 BST 1995 GDB 5 0 host target i960 intel mon960 Example gdb960 Session Copyright 1993 Free Software Foundation Inc Connected to dev tty01 at 38400 bps Once the prompt returns specify the file gdb960 is to read the symbol table from by entering the file command gdb960 file hello Reading symbols from hello done Enter the load command to download the program and prepare for execution gdb960 load section 0 name text address 0xe0008000 size Ox4c9c flags 0x20 writing section at 0xe0008000 section 1 name data address 0xe000cca0 size 0x18 flags 0x40 writing section at 0Oxe000cca0 section 2 name bss address 0xe000ccc0 size 0x68c flags 0x80 molgad 5 Set a breakpoint after the initialization code and at the first executable line in main gdb960 b main Breakpoint 1 at 0xe0008100 file hello c line 8 Run the program until it encounters the breakpoint at the first line of main gdb960 run Starting program ffs a peters gdb960 tutorial hello Breakpoint 1 main argc 1l argv O0xe000d0c0 at hello c 8 8 int i 8 List ten lines centered around the encountered breakpoint gdb960 list i 2 char buf 20 hi there 3 4 main argc argv 5 int arge 6 Ghar argyv 1 4 8 9 1 int i 8 but it 3 0 buf itt Wh O s gdb960 User s Manual
136. ments adds to the front of the source path it can affect files that gdb960 has already found If the source path contains directories that you do not want and those directories contain misleading files with names matching your source files you can correct the situation using one of the following two methods 1 using directory with no argument to reset the source path to empty 2 using directory with suitable arguments to add any other directories you want in the source path You can add all the directories in one command Displaying Program Data and Symbols This chapter contains information on examining data through expressions variables and artificial arrays This chapter also presents information about accessing the value history using convenience variables and accessing registers To help in presentation of data gdb960 allows use of format options and output format specifications Use of the options and format specifications is also presented and demonstrated in this chapter The usual way to examine data in your program is with the print command abbreviated p or its synonym inspect The print command evaluates and displays the value of any valid C expression exp The value of exp is displayed in a format appropriate to its data type The following example shows the syntax of the print command print exp A lower level way of examining data is with the x command It examines data in memory at a specified address and d
137. mmand line To switch interactively between Emacs and vi editing modes use the command META CTRL j toggle editing mode Command Line Editing When you enter a line in vi mode you are already in insertion mode as if you had typed an i after invoking vi Pressing ESC switches to edit mode and allows you to edit text with the standard vi movement keys For example you may move to previous history lines with k follow lines with j and so forth B 13 GNU History Library This appendix describes the history library a programming tool that provides a consistent user interface for recalling lines of previously typed input Many programs read input from the user one line at a time The GNU history library keeps track of those lines associates arbitrary data with each line and uses information from previous lines to make up new ones The programmer using the History library has functions available for completing the following tasks e remembering lines on a history stack e associating arbitrary data with a line e removing lines from the stack e searching through the stack for a line containing an arbitrary text string e referencing any line on the stack directly In addition a history expansion function is available that provides a consistent user interface across many different programs The end user using programs written with the History library has the benefit of a consistent user interface with a s
138. n 9 Examining the Provides information about manipulating stack Program Stack frames selecting frames creating traces and extracting information from selected frames 10 Examining Source Describes commands and techniques that allow Files you to display specified pieces of source files 11 Displaying Program Contains information about examining data Data and Symbols through expressions variables and artificial arrays This chapter also presents information about accessing the value history using convenience variables and accessing registers 12 gdb960 Command Provides a list of the gdb960 command line and Option options and commands along with common HDIL Reference invocation options 13 Storing Commands Tells you how to define custom commands create command files to execute commands sequences automatically and control gdb960 s output Table 1 2 Appendix Summaries Appendix A Using gdb960 Under GNU Emacs B Command Line Editing C GNU History Library D Using gdb960 with ApLink Description Describes setting up gdb960 in Emacs and using Emacs commands with gdb960 Describes GNU s command line editing and provides some examples of its use Describes the GNU history library a programming tool that provides a consistent user interface for recalling lines of typed input Tells you how to use the debugger with the ApLink debug probe gdb960 User s Manual Audience To use this product yo
139. n commands and their effects on the breakpoints to which they are applied condition bnum expression Specify expression as the break condition for breakpoint number bnum The breakpoint halts the program only if the value of expression is true non zero in C The expressionis not 8 9 gdb960 User s Manual 8 10 evaluated when the condition argument is given When you enter the condition argument to the break command the expression you specify is checked immediately for syntactic correctness and to determine whether symbols in it are defined in the scope of your breakpoint For more information on examining data refer to Chapter 11 condition bnum Remove the condition from breakpoint number bnum to make it an unconditional breakpoint Each breakpoint has an integer value called an ignore count associated with it The integer is set to 0 for enabled unconditional breakpoints The ignore count command sets the integer to a positive value Each time execution encounters the breakpoint the ignore count value is decremented by 1 When the value reaches 0 the breakpoint halts execution and any set conditions are evaluated The following is a list of commands that manipulate count and execution ignore bnum count Set the count of breakpoint number bnum to count The next count times the breakpoint is reached your program s execution does not halt other than to decrement the ignore count gdb960 takes no action To make t
140. nding on the state of the debugger For example the Target connect button disappears after you have connected to a target board In the above figure the toolbar contains the Target connect and Open file buttons e A target status line near the upper right corner This area shows the state of the target connection the name of the program that is loaded if any and whether the program is running or stopped e A source pane where the debugger displays source code and disassembly to you e A debug margin along the left side of the source pane where the debugger shows which line it is executing and where breakpoints are set gdb960 User s Manual e Acommand line window at the bottom of the screen where you can enter gdb960 commands All gdb960 commands can be used in this window This is where debugger error messages are displayed and other feedback such as printing the values of variables e An animation area above showing the debugging hand When the debugger is busy this area flashes and animate To start debugging a program you need to 1 Set your working directory optional 2 Connect to a target 3 Open a file load the symbols from a program and optionally download code to the target 4 Start running the application The sections that follow describe how to complete these tasks Setting the Working Directory Before you get started debugging you can optionally change your working directory This can be d
141. ne complete TAB Attempt to do completion on the text before the cursor This is implementation defined Generally if you are typing a filename argument you can do filename completion if you are typing a command you can do command completion if you are typing in a symbol to gdb960 you can do B 11 gdb960 User s Manual B 12 possible completions TAB TAB or META symbol name completion if you are typing in a variable to Bash you can do variable name completion List the possible completions of the text before the cursor Some Miscellaneous Commands The following is a list of the command names their original bindings and short descriptions for miscellaneous actions on the command line abort CTRL qQ do uppercase version META a META b prefix meta ESC undo CTRL revert line META r Readline vi Mode Stops execution and sounds the terminal bell Run the command that is bound to the uppercase character Make the next character typed metafied This is for people without a meta key ESC f is equivalent to META f Character by character incremental undo separately remembered for each line Undo all changes made to this line This is like typing the undo command enough times to get back to blank line While the Readline library does not have a full set of vi editing functions it does contain enough to allow simple editing of the co
142. ne or more breakpoint numbers as arguments 8 7 gdb960 User s Manual 8 8 NOTE Use info break to display a list of breakpoints if you don t know which breakpoint numbers to use The following is a list of commands and descriptions for enabling or disabling breakpoints disable breakpoints bnums disable bnums disable enable breakpoints bnums enable bnums enable enable once bnums enable delete bnums Disable the breakpoints listed in bnums Any number of breakpoints may be listed by number Separate each number from the next by a space The breakpoint keyword is not necessary unless differentiating between disabling display and disabling breakpoints The default is to disable breakpoints If no list of breakpoints is specified all breakpoints are disabled A disabled breakpoint has no effect but is not forgotten All options such as ignore counts conditions and commands are remembered in case the breakpoint is enabled again later Enable the breakpoints specified in bnums If bnums is not specified enable all defined breakpoints Enable the specified breakpoints temporarily Each is disabled the next time it halts your program Enable the specified breakpoints temporarily Each is deleted the next time it halts your program Except for a breakpoint set with tbreak breakpoints are enabled or disabled only when you use one of the above commands Program Execution Control NOTE The c
143. nfo gmu command to print a table of all current GMU registers Refer to Chapter 12 for more information on the info command Syntax gmu detect define regnum access startaddress endaddress Initializes and enables the specified GMU detection register regnum Specifies a detection register number access Specifies which types of memory access can cause a GMU fault The string has the form modetype modetype where mode is either u or s for user mode access or supervisor mode access t ype is a string of one or more letters from Table 8 1 An optional second modet ype may be given to program both user and supervisor modes in the same command An example of a valid access argument is urw sx which means fault on a user mode read or user mode write or a supervisor mode execute startaddress Evaluates to the starting address of the desired detection range endaddress Evaluates to one byte beyond the ending address of the desired detection range Program Execution Control gmu detect disable regnum Disables the specified GMU detection register Clears the memory detection enable bit for this register in the GMU control register If regnum is omitted disable all GMU detection registers gmu detect enable regnum Enables the specified GMU detection register Sets the memory detection enable bit for this register in the GMU control register If regnumis omitted enable all GMU detection registers gmu protect define
144. nformation on your program s symbol table Configuring the gdb960 Environment The symbo1 file command causes the gdb960 debugger to lose the contents of its convenience variables the value history and all breakpoints and auto display expressions This is because they may contain pointers to internal data recording symbols and data types that are part of the old symbol table data being discarded x file Execute gdb960 commands from file For more information on setting up a batch mode execution file refer to Chapter 13 command is a synonym for x While all file specifying commands allow both absolute and relative file names as arguments gdb960 always converts the file name to an absolute gdb960 Environment Variables The following is a list of environment variables recognized by the gdb960 debugger Following each variable is a description of its use and its default value COMSPEC Used by Windows systems only Sets the shell to run for the shell command Can be overridden with the SHELL variable SHELL Sets the shell to run for the she11 command Defaults are UNIX bin sh Windows Current setting of the COMSPEC environment variable If SCOMSPEC is not set the debugger then looks for comMAND com in the current PATH PATH Used by gdb960 to find executables when not found in the current directory gdb960 User s Manual 5 6 HOME HISTSIZE GDBHISTFILE I960ERR G960BAUD
145. ng gdb960 with ApLink Ap Ink COMMAS siasisiccccipeteds tees ented Seheceeavbieiadideneoueets D 1 Using gdb960 With ApLink cceceeeeeseeeeeeeeeteeeeees D 2 QODIG6O Scripts nsec irr e aie a Ee D 4 Index Figures 1 1 Sample GUI Debugger Windows Windows NT 1 3 3 1 Debugging WiNdOWS cccceeeeeeeeetetteeeeeeeeeeteeee 3 4 3 2 The Debug Menu ccccceeesesseceecceeeeeeeeteeeeeanees 3 5 3 3 Target Connected Window ccceeeeeeeeeeeeeeee 3 7 3 4 Source Search Path Window cceeeeeeeeee eee 3 8 3 5 Open WINKOW 5420 20 h eet in eater eededcluahentetaceees 3 9 3 6 File Function Lister Window ceeeeeeeeeeeteees 3 10 B DEBUG TOGI Bal csceecuseescatteteceen coer a 3 12 3 8 The Run WiNdoW sssssssssssessererrnrrsssrerrrrrnnrrsserrrnne 3 17 3 9 The Context Pointer sssssssseeeeessserrerrrrrressrrrrrrrrn 3 18 3 10 Inspect Windows in the Debugger seeessssreeeeee 3 23 3 11 Inspect Partly Hidden Structure Hierarchy 3 24 Contents Tables S12 Locals WINKOW iaix bciicinstnedivintietsuielecbslielucductetecteuesteds 3 24 3 13 Backtrace WiINGOW ccccccccccccccccececeeeeeeeeeeeeeeeeeees 3 25 3 14 Registers Window ccsssssssssssssssssssssssssssseseseees 3 26 3 15 Memory WindOW ccccceeeeeeeccceeeeeeeeeeeseeeeeeeeeeeeees 3 27 3 16 Source View Window 0 0 eeeeeeecceeeeeeeeeeeeeseeeeeeeeee
146. nics e Symbolic support You can use symbols to debug all programs written in the C language You can also display and modify program memory using program symbols e Downloading You can download i960 processor ELF DWARF Common Object File Format COFF files or b out files What s New in gdb960 With release 5 1 gdb960v adds a Graphical User Interface GUT that combines the best features of graphical and command line debugging interfaces The most common debugging activities such as setting breakpoints and controlling program execution are available through convenient point and click interfaces in both Windows 95 NT and UNIX Similarly program listings and data inspection windows provide an immediate visual context for the crucial portions of your application The gdb960 Debugger Figure 1 1 Sample GUI Debugger Windows Windows NT Oxa0008000 in gab960 Gdb960 Debugger gdb960w rdb include etic h gt void main int i ant j for i 0 i lt 5 i printf Hello i d n i j i 5 for j 0 j lt 5 j printf Hello j d n j i j 5 Debugger gdb960w rdb Starting program C testfiles TEST Program stop reason Unclaimed fault Fault type Invalid Opcode type 0x2 subtype 0x1 ip Oxa0008000 fault record 0xa00011c0 Program received signal SIGTRAP Trace breakpoint trap ICAP NUM eel Ln 23 Col 10 Figure 1 1 shows some sample gdb960v windows
147. no difference Displaying Program Data and Symbols The following is a list of commands that display register information regs Display non floating registers as two columns of hexidecimal numbers Output is suitable for a 24x80 display info registers Display the names and relativized values of all non floating point registers info all registers Display the names and relativized values of all registers including floating point registers For MON960 this is a synonym for info registers when the 1960 processor architecture does not contain floating point registers e g the 1960 CA processor family info registers regname Display the relativized value of register regname The regname argument may be any register name that is valid on the machine you are using with or without the initial Examples The following example displays the instruction pointer in hexadecimal p x Sip The following example displays the instruction to be executed next x i ip The following example adds four to the stack pointer set sp 4 The set Ssp 4 command also removes one word from the stack on machines where stacks grow upward in memory This assumes that the innermost stack frame is selected Setting ssp is not allowed when other stack frames are selected To pop entire frames off the stack regardless of machine architecture enter the finish command 11 23 gdb960 User s Manual 11 24 Profile Data File Manipulation
148. nt settings 3 37 syntax coloring 3 37 tab settings 3 36 variable values 3 24 GUI Windows help 3 2 Index H HDIL arguments 2 8 history command line substitution 5 8 event designators C 2 expansion 5 10 controlling 5 10 library GNU C 1 manipulating B 8 modifiers C 3 numbers 11 19 word designators C 3 l K ignore count 8 11 increment operators 11 3 instruction pointer 11 23 register 11 22 killing and yanking B 10 L line wrapping 5 12 lines display 12 20 linespec definition 10 3 logical not operator 5 10 loops execute all iterations 12 35 machine instruction executing 12 23 make tool 12 22 manuals related 1 7 memory dump as machine instructions 12 9 examining 11 10 12 37 examining consecutive units 11 14 modifying 11 15 viewing GUI Windows 3 26 messages 5 13 modifying memory 11 15 MON960 awatch command 8 6 connecting to 2 6 setting up 2 2 specifying target type 2 6 watch command 8 6 wwatch command 8 6 monitor software 2 2 N O notational differences UNIX vs DOS 1 7 numeric arguments specifying B 11 online help accessing 1 7 GUI UNIX 4 2 Index 7 gdb960 User s Manual Index 8 operators 11 2 assignment 11 3 increment 11 3 optimized code debugging 2 3 options command line example 2 5 file specifying 2 9 5 5 format 11 5 invocation nx 13 4 modes 2 9 2 11 startup 2 6 output display 12 2
149. nt to the Toggle Breakpoint command in the Debug menu see Setting Breakpoints on page 3 16 3 13 gdb960 User s Manual 3 14 4 Step to the next line of code This button is equivalent to Step in the Debug menu see Navigating through a Program on page 3 17 This button causes the debugger to step one machine instruction when the edit window contains assembly language Step over a function call instead of stepping to the next statement executed this button steps to the next line on the screen If there is a function call on the current line the button executes that function in its entirety then stops at the line after the function call This button is equivalent to the Next command in the Debug menu see Navigating through a Program on page 3 17 The next button behaves analogously to the step button when assembly language is displayed in the edit window Continue program execution This button allows the program to continue execution from its current IP location until the debugger regains control The debugger regains control when e The program terminates e The program encounters a breakpoint e You interrupt the program e An event such as an interrupt or a fatal error occurs This button is equivalent to Continue in the Debug menu see Navigating through a Program on page 3 17 Using the gdb960 Windows Graphical User Interface The Debug Menu Ea Finish the current execut
150. numbered frame is the start frame The second highest is the frame for main Select the frame at address frame_addr If the chaining of stack frames has been damaged by a bug it is impossible for gdb960 to properly assign numbers to all frames If the numbers are unavailable addresses are still available for selecting frames Select the frame n frames up from the previously selected frame For positive numbers n this advances toward the outermost frame to higher frame numbers Default is one Select the frame n frames down from the previously selected frame For positive numbers n this advances toward the innermost frame to lower frame numbers Default is one Each of the above commands ends by displaying information about the selected frame the frame number the function name and its arguments the source file and line number of execution in that frame and the text of that source line For example 3 67 main argc 3 argv env at main c 67 read_input_file argv i Examining the Program Stack After one of the above listed commands produces a printout entering the list command without arguments displays ten source lines centered on the point of execution in the selected frame up silentlyn down silentlyn Frame Information These two commands are variants of up and down respectively They differ in that they do their work silently without causing display of the new frame They are intended
151. of previously killed text and yank the new top You can do this only if the prior command is CTRL y or META y When you use a kill command the text is saved in a buffer called a kill ring Any number of consecutive kills save all the killed text together in one element of the kill ring When yanking all text in one element of the kill ring is retrieved Elements in the kill ring separate from one another only if kills are separated by other commands The kill ring is not changed by creation of a new command line Text killed on a previously typed line is available to be yanked when you are typing another line Command Line Editing Readline Arguments You can pass numeric arguments to Readline commands Sometimes numeric arguments determine the number of times a command is to repeat Sometimes the sign of the argument determines the action and the numeric provides an offset If you pass a negative argument to a command that normally acts in a forward direction that command acts in a backward direction For example to kill text back to the start of the line you might type META CTRL k Generally pass numeric arguments to a command by typing META digits before the command If the first digit you type is a minus sign then the sign of the argument is negative Once you have typed one meta digit to get the argument started type the remaining digits and then the command For example to give the cTRL d command an
152. oint execute to the breakpoints OPENDEN examine data 10 exit from the program and the debugger Example Session This extended example demonstrates a minimal set of gdb960 commands Follow the example sequence to familiarize yourself with the debugger and the command line interface Experiment with the other commands described in this manual gdb960 User s Manual The following is a UNIX listing of the example program s cat hello ec char buf 20 hi there main argc argv int argc char argv 1 int i 83 but att tT bub liste Xo strcat buf T ya ll Prince syi Duft The two compiler invocation lines below demonstrate a build of the example program using gcc960 and ic960 respectively For more information on the two compilers refer to your compiler user s guide In the example compile lines the test program is built for the Intel EV80960CA evaluation board gcc960 g Tmevca o hello hello c gt ic960 g Tev960ca o hello hello c The example assumes a UNIX system and a serial port dev tty01 To familiarize yourself with a work session with the gdb960 software debugger perform the following actions 1 Invoke the gdb960 debugger by entering the following command S gdb960 r 01 2 The following messages appear GDB is free software and you are welcome to distribute copies of it under certain conditions type show copying to see the conditions There is abso
153. ointers i e print the string that the char points to When turned off char is printed like a void i e just print the hex address that the char points to The on setting is the default Displaying Program Data and Symbols set print array on set print array off set print elements number of elements set print pretty on set print pretty off Pretty print arrays This format is more convenient to read but uses more space off is the default Return to compressed format for arrays When displaying a large array stop displaying after printing the number of elements set by the set print elements command The limit also applies to display of strings Setting the number of elements to zero allows unlimited displaying Display structures in an indented format with one member per line The following is an example of a pretty printed structure el next 0x0 flags sweet 1 sour 1 meat 0x54 Pork off is the default format Display structures in a compact format as in the following example 1 next 0x0 flags sweet 1 sour 1 meat 0x54 Pork 11 7 gdb960 User s Manual 11 8 set print repeats repeats Set threshold for printing repeated elements e g printing an array that contains repeats or more zeroes prints a message 000 lt repeats NN times gt where NN is the number of elements The default for repeats is 10 set print s
154. oints is specified all breakpoints are enabled delete bnums Enable the specified breakpoints temporarily Each is deleted the next time it halts your program display Enable display of breakpoint information once bnums Enable the specified breakpoints temporarily Each is disabled the next time it halts your program 12 11 gdb960 User s Manual 12 12 exec file exec file filename Specifies the program to run Omitting the argument specifies no executable filename Specify that the program to be run but not the symbol table is found in filename The gdb960 debugger searches the environment variable PATH if necessary to locate the program file file filename p cl d x offset Specifies the program to debug no arguments Leaves both the executable file and symbol table unspecified filename The program to be debugged It is read for its symbols and pure memory contents and it is executed when you give the run command pc pd or px Symbols are relocated by adding offset to their values These arguments act the same as their command line counterparts finish finish Continues execution until after the selected stack frame returns or until there is some other reason to halt such as a fatal signal or a breakpoint Displays the value returned by the selected stack frame gdb960 Command and Option Reference forward search forward search regexp Searches for a text match in each line
155. ommand file with the source command as shown in the following line gdb960 source filename Execute the command file filename Lines in a command file are executed sequentially They do not display as they are executed An error in any command terminates execution of the command file Commands that normally ask for confirmation proceed without confirmation when used in a command file Many gdb960 commands that normally display messages omit the messages when used in command files Storing Commands Commands for Controlled Output During execution of a command file or user defined command only output explicitly displayed by the included commands appears This section describes three commands for generating output from a command file or a user defined command The following is a list of commands and their effects when included in a command list echo text Display text Non printing characters can be included in text using C escape sequences such as n to print a newline No newline will be printed unless you specify one In addition to the standard C escape sequences a backslash followed by a space stands for a space Unless escaped leading and trailing spaces are trimmed from all arguments Thus to display and foo use the command echo and foo A backslash at the end of text continues the command onto subsequent lines For example echo This is some text n which is continued n onto several lines n produ
156. ommand unt ican set and delete a breakpoint but it does not change the state of your breakpoints The until command is described later in this chapter Break Conditions Execution is halted every time an enabled breakpoint is encountered To customize a breakpoint to halt execution only under special conditions a conditional expression can be attached to the breakpoint Conditional breakpoints cause momentary program interruption which can affect real time programs Execution halts only if the expression evaluates to true Any valid C expression in scope when the breakpoint is reached can be used in a breakpoint condition Breakpoint conditions can have side effects and may even call functions in your program This can useful for example to activate functions that log program progress or to use your own print functions to format special data structures The effects are predictable unless there is another enabled breakpoint at the same address In that case gdb960 might encounter the unexpected breakpoint first and halt execution without checking the expected breakpoint Note that breakpoint commands are usually more convenient and flexible for the purpose of performing side effects when a breakpoint is reached When a breakpoint is set break conditions can be specified by using if in the arguments to the break command Breakpoint conditions can also be changed at any time with the condition command The following is a list of conditio
157. on 8 15 list display 9 5 10 1 make 5 11 miscellaneous B 12 next execution 8 14 nexti execution 8 14 output display 8 12 13 6 path configuration 7 3 print display 11 1 11 9 11 14 printf display 13 6 printsyms display 11 19 profile 11 24 ptype display 11 17 pwd display 7 2 quit 5 14 Index commands continued rbreak breakpoint 8 4 readline movement B 3 readline killing B 3 regs display 11 23 reverse search search 10 5 run execution 7 1 set args configuration 7 2 set caching mode 11 10 set complaints configuration 5 13 set confirm configuration 5 14 set editing mode 5 8 set environment configuration 7 3 set height configuration 5 12 set history configuration 5 9 mode 5 10 set listsize configuration 10 1 set print mode 11 5 set prompt display 5 8 set radix configuration 5 12 set verbose configuration 5 13 set width configuration 5 12 shell 5 11 show args display 7 2 show complaints display 5 13 show confirm display 5 14 show editing display 5 8 show environment display 7 3 show height display 5 12 show history display 5 10 11 20 show radix display 5 12 show values display 11 20 show verbose display 5 13 show width display 5 12 show display 5 7 12 8 12 9 silent display 8 12 step execution 8 12 8 13 8 14 stepi execution 8 14 store for later retrieval 5 9 target example 2 6 tbreak breakpoint 8 5
158. on halted and the arrow icon j appears in the debug margin adjacent to the C source statement or the assembly instruction where execution halted 4 15 gdb960 User s Manual 4 16 Using the Up and Down Stack Frames Feature Pressing the up and down the stack frame buttons causes the debugger to display the contexts of the previous or next stack frames respectively Two icons displayed in the debug margin help you in using this feature indicates the call site p indicates the innermost frame Viewing the Contents of Registers After you have run your program or stopped execution at a breakpoint you may want to check the values of the i960 processor registers To do so 1 Open the Windows menu and choose Registers This window appears f i960 Registers 0xa002d920 0xa002d9a0 0xa0008 1c4 Ox95d05641 0 0xa00081b0 0 0za002dc50 0x1 0 0 0 Oxffffffff 0 0 0 0x9 0 0xf0040d84 Oxfoo40d40 0x9 Oxa Oxa0003306 0x2696 006100 O a a a a a boven a 0003301 Using the gdb960 UNIX Graphical User Interface The window is updated each time the target halts and if a value differs from the previous display the value appears in bold For example in the register window above the three registers pfp sp and rip have changed since the previous execution Using the Backtrace Window When debugging software it is often useful to step backwards through the calling sequence gdb960v lets you do
159. on the screen Directs gdb960 to invoke an inferior shell and give you a shell prompt command show show settings Directs gdb960 to invoke an inferior shell to execute command The environment variable SHI b ELL is used if it exists otherwise gdb960 uses in sh on UNIX and command com on DOS Displays the setting of a debugger attribute Arguments for show are the same as the arguments for set or set print With no arguments display all current settings source source file Reads gdb960 commands from file gdb960 Command and Option Reference step step count Executes one line of code then halts execution and returns control to the debugger Steps into function calls This command is abbreviated s count Execute count lines If a breakpoint or a signal not related to stepping is encountered before count Steps execution halts stepi stepi count Executes one machine instruction then halts and returns control to the debugger count A count argument is a repeat count as in step symbol file symbol file filename Reads symbol table information The symbol file command with no argument clears out gdb960 s information on your program s symbol table The symbol file command causes the gdb960 debugger to forget the contents of its convenience variables the value history and all breakpoints and auto display expressions This is because they may contain pointers to the interna
160. one anytime you are in the debugger 1 Open the File menu and choose Change Directory This window appears Directory name ffs a paulr Contains Sub Directories 80960_cust_support ATS_PROJECT cheap_rtos cmpdirs Using the gdb960 UNIX Graphical User Interface Enter the desired path in the directory name textbox You can also set this textbox using the mouse by selecting one of the directory names listed in the Contains Sub Directories listbox A dialog box appears confirming that the directory has been changed You can also change the working directory in the command window by using the cd lt dirname gt command Connecting to a Target Now that you have set the working directory you are ready to connect to a target board 1 Physically connect the target board to the host via a serial cable For more information see Chapter 2 Make sure the target board has the MON960 debug monitor running For more information see Chapter 2 Press the Target Connect button from the toolbar You can also use the Connect option in the Target pull down menu This window appears Serial port Connect Baud optional Parallel Port optional 4 5 gdb960 User s Manual 4 6 4 Enter the serial port name in the top text box of the dialog Typically in a UNIX system there is a file named dev tty used for serial communication In the Serial port field you can enter either the entire name dev tty
161. ontext pointer P indicates what statement executes if you allow the program to resume The Context Pointer HHH HEHE HHH HEHE JE JE HEH JE E JE JE JE JE JE JE JE JEJE JE JE JE JE E JE JE JE JE JE JE JE JE JEJE JE JE JE E JE JE JE JE SESE AEH JE JE JE JE JE JE JE JE JE JE JE AEH JE JEJE JE JEJE JEE JEE graphInit coloring graph initialization 7 set initial node number to 0 dB nNum 0 Se enabling round robin necessary to give each node of the graph which have all the same priority some CPU access void graphInit void r Using the gdb960 Windows Graphical User Interface Table 3 3 When the program is stopped you can use any of the following options from the Debug menu Buttons for Stepping Through a Program Debug Menu Button Shortcut Command Description F5 Continue Restarts program execution If there are no remaining breakpoints interrupts or signals the program runs to completion A common example of using Continue is to set a breakpoint at the end of a loop then use Continue repeatedly to stop once in each loop iteration while monitoring a loop variable 4 F10 Step Steps through the code one line at a time If you have auxiliary debugger windows open See Using the Auxiliary Debugger Windows on page 3 22 they are updated with current values as you step through the code If there is a function call in the current line Step takes you to
162. ory regions prior to downloading and debugging a program The following example script and actual command line syntax demonstrate how to use this facility The script downloads and executes a fictitious program called hello In this example assume that an EP80960CX target is physically connected to a CA ApLink and that the EP80960CX has DRAM in region C Example Script c gt type gdb960 cmd mcon c 0x900003 file hello load hello run tiyo gdb960 lt b 57600 E coml parallel pti command gdb960 cmd Index character 1 7 character 1 7 A ApLink commands 12 3 Jx processor configuration D 3 arguments to your program 7 2 arrays artificial 11 4 assignment operators 11 3 automatic display expression value 11 15 backslash letter combinations 13 6 backtrace 9 2 12 36 of a stack 12 4 baud rate specifying 2 6 binary operator 11 4 break 2 7 conditions 8 9 send to target 12 26 breakpoints 8 1 add a condition to 12 7 deleting 8 6 12 6 12 8 disabling 8 7 12 9 enabling 12 11 example 6 3 hardware 8 3 hardware assisted to halt 12 34 register 8 4 set count of number 12 17 set hardware 12 17 set to cause halt 12 34 setting 12 5 12 25 GUI UNIX 4 13 GUI Windows 3 16 specify commands for 12 6 states 8 7 C boolean expressions 8 9 C operators 11 1 call stack 9 1 character 1 7 code listing GUI UNIX 4 9 4 13 GUI Windows 3 10 command file
163. ould like to execute as described in Chapter 2 For example gdb960 pci myprogram Note that you can use the file specification options e g file exec file described in Chapter 5 to specify a different file to execute after gdb960 has loaded 3 Enter the run command using the syntax run arguments where arguments specifies any arguments that your program accepts on the run command Alternately use set args to set the program arguments Entering a run command begins program execution immediately For a discussion of how to stop and restart a program by using breakpoints refer to Chapter 8 7 1 gdb960 User s Manual Setting Your Program s Arguments The arguments to your program are specified as arguments to the run command The run command passes them directly to the monitor target to be used during the invocation of your program NOTE Entering run with no arguments invokes your program with the same arguments used by the previous run The following commands allow you to change or examine the arguments to be passed the next time your program is invoked by the run command set args The command set args can be used to specify arguments the arguments to use the next time the program is run If set args has no arguments it means to use no arguments the next time the program is run This way you can run your program with arguments and set it to run again with no arguments show args Show the arguments to be use
164. p In Windows 95 NT reference information is available to you anytime by pressing F1 in any window or by opening the Help menu and choosing any of the help options listed there Using the F1 key provides you with context sensitive information about the current active window The UNIX help system is HTML based and can be viewed with any web browser such as Mosaic or Netscape To view the file simply open the file wingdb960 htm with your web browser At installation this file is placed the in directory G960BASE i960BASE html tools When running gdb960 from the command line use the he 1p command as described in Chapter 5 This allows you to access reference information about specific gdb960 commands Contacting Intel Support Services If you need service or assistance with the debugger refer to Getting Started with the i960 Processor Development Tools Getting Started This chapter provides information on setting up your target platform and host PC to use with gdb960 In this chapter you e Set up your target board e Learn about MON960 the onboard monitor software that gdb960 uses to communicate with your evaluation board e Learn about recompiling your software for debugging e Learn how to start gdb960 s Windows UNIX and command line interfaces For some operations you may need to refer to your target board manual the MON960 Debug Monitor User s Guide and the i960 Processor Compiler User s Guide
165. plicit gdb960 1ist or search commands still produce output as usual CAUTION f the directory where your program resides is not your current directory it can be easy to confuse Emacs about the location of the source files in which case the auxiliary display buffer does not appear to show your source gdb960 can find programs by searching your environment s PATH so the gdb960 input and output session proceed normally but Emacs does not get enough information back from gdb960 to locate the source files in this situation To avoid this problem either start gdb960 mode from the directory where your program resides or specify a full path name when prompted for the M x gdb960 argument Confusion can also result if you use the gdb960 file command to switch to debugging a program in some other location from an existing gdb960 buffer in Emacs Using Emacs Commands with gdb960 By default M x gdb960 calls the program called gdb960 If you need to call gdb960 by a different name for example if you keep several configurations around with different names you can set the Emacs variable gdb960 command name In the following example the set gq command preceded by ESC ESC or typed in the scratch buffer or in your emacs file makes Emacs call the program named mygdb instead setq gdb960 command name mygdb A 3 gdb960 User s Manual In the gdb960 I O buffer you can use these special Emacs version 18 or earlier command
166. point abbreviated hb The arguments list args allows the same arguments that are listed in the break command and the breakpoint is set the same way Hardware breakpoints allow breakpoints in non writeable code e g code that resides in ROM or FLASH Breakpoints set with the break command are silently ignored when set in code that resides in non writeable memory You may set any number of hardware breakpoints but 1960 processor architectures allow only two to be enabled at any one time If more than 8 3 gdb960 User s Manual 8 4 info break bnum info watch rbreak regex two are enabled the lowest two breakpoint numbers are honored and all others are automatically disabled The command info break displays a list of all breakpoints set and not deleted showing their numbers where in the program they are and any special features related to them Disabled breakpoints are included in the list and marked as disabled Specifying a breakpoint number after the info break command lists only information about the breakpoint associated with the specified number The info break command sets the convenience variable _ and the default examining address for the x command to the address of the last breakpoint listed This is a synonym for info break Set a breakpoint on all functions matching regex This command sets an unconditional breakpoint on all matches displaying a list of all breakpoints set Once the b
167. point using these commands If you are forced to work on an object module without debugging information you can still break at the start of any function in the following ways e Check the Break at main check box in the Run dialog box when you start the program See Navigating through a Program e Use the break command in the debugger command window see Chapter 13 for usage of the break commana In either case when the debugger stops it displays a Disassembly window as it does whenever no debugging information is available for the program context Navigating through a Program To run a program under debugger control 1 Press the Run button or pull down the Debug menu and choose Run The Run dialog box see Figure 3 8 appears The Run Window a a 7 Arguments Break at main 3 17 gdb960 User s Manual 3 18 Figure 3 9 Figure 3 8 shows the Run dialog box with an argument list optional The default for required arguments that you do not supply is zero To set a temporary breakpoint program function main check the Break at main box 2 Specify the arguments if any used by the program 3 Click OK to start the program execution on the target Once a program stops under debugger control most often at a breakpoint you can single step through the code jump over function calls or resume execution Figure 3 9 shows the debugger stopped at the routine graphInit The c
168. primarily for use in gdb960 command scripts where output might be unnecessary and distracting The following commands display information about the selected stack frame frame info frame info frame frame_addr With no argument does not change which frame is selected but does display information about the currently selected stack frame The frame command can be abbreviated to The frame command can also be used as an argument to an o Display a verbose description of the selected stack frame including the frame s address the address of the frame called by the selected frame the frame that called the selected frame the address of the selected frame s arguments the instruction pointer saved in the selected frame the address of execution in the caller frame and which registers were saved in the frame The description is useful when some problem has corrupted the stack format Display a verbose description of the frame at address frame_addr without selecting that frame The selected frame remains unchanged 9 5 gdb960 User s Manual 9 6 info args info Locals Display the selected frame s arguments each on a separate line Display the selected frame s local variables each on a separate line These are all variables declared static or automatic within all program blocks that are executed within this frame Examining Source Files The gdb960 debugger knows from which source files yo
169. provide access to the memory Each command is followed by a description of its use set caching The gdb960 debugger normally caches on off target memory reads and writes to reduce serial line traffic In some cases this feature masks volatile memory changes To prevent gdb960 from caching target memory use set caching off which flushes the memory cache prior to every target read or write By default caching is enabled set caching on Displaying Program Data and Symbols disassemble function address address x NFU address Provides a dump of a range of memory as machine instructions The range is the inclusive area bounded by the two machine addresses provided in the address arguments If only one address argument is provided gdb960 finds the first C function that starts at an address less than or equal to the given address then it disassembles the entire function If only a function argument is provided then the function named in function is disassembled in its entirety If the string in function is not a function name then its address is calculated and acted on as though it were an address argument You can use the command x to examine memory in any of several formats independent of your program s data types N F and v are all optional parameters that specify how much memory to display and how to format it address is an expression giving the address where you want to start di
170. rary routines supplied as object code only To choose this option you can also press Alt F7 gdb960 User s Manual Mixed Source and Disassembly Displays both high level source and a symbolic disassembly with the assembly level code shown as close as possible to the source code that generates the corresponding object code To choose this option you can also press Shift F7 Figure 3 16 shows a mixed mode code display Figure 3 16 Source View Window File Edit View Project Debug Tools Window Help olal 8 2 amp gt zjx tie tla phobos yunque wrs c v gt i a iy C T ornado target src demo color vxColor c Oo x b62f addqw a se each node block on the same semaphore this avoid using here a taskDelay which leads when used with many tasks to sync problems semTake nodeSyncSem 1 if pNode gt cNum gt 0 630 I graphColoring pNode 5 DO al peste LMHS IIIS II IIIA IIIS IIIS I IIIS IIIS IIIS IIIS ISI IIS SII ISI SSIS ISI ISI SAI ISIS IIIS IIIA SAI IS SII nodeInit node initialization x ajoj x Finished disassembly for vxColor c NUM READ Ln 1978 Col 1 Source display in either the Source or the Mixed Source and Disassembly view requires that your application modules be compiled with debugging information using the g option 3 30 Using the gdb960 Windows Graphical User Interface NOTE For some
171. reakpoints are set they are treated just like the breakpoints set with break They can be deleted disabled made conditional etc in the standard ways Program Execution Control tbreak args Set a breakpoint that only halts execution once The arguments list args is the same as in the break command and the breakpoint is set the same way but the breakpoint is automatically disabled the first time it is encountered For more information on disabling breakpoints refer to the Disabling Breakpoints and Watchpoints section in this chapter Watchpoints A watchpoint is a breakpoint that halts your program only when a specified expression s value changes Watchpoints are set with the watch command Watchpoints are managed like other breakpoints and are enabled disabled and deleted using the same commands used for other breakpoints There are two types of watchpoints 1 Hardware assisted watchpoints use i960 registers and evaluate at normal execution speed 2 Software watchpoints depend on single stepping and are slower Hardware watchpoints are available on 1960 C series J series RP series and H series processors A maximum of two hardware watchpoints can be set at any one time six on the H series processors When you specify a watchpoint with the watch command gdb960 determines automatically if the target hardware supports hardware watchpoints If so and if there are sufficient hardware watchpoint registers avail
172. ring list values interactively Locals To view the value of local variables open the Debug menu and choose Locals Alternatively use the Alt 3 keyboard command A window appears showing the values of local variables For example Figure 3 12 Locals Window a Locals x int nodeId int mode int rank char color OH tl 3 24 Using the gdb960 Windows Graphical User Interface Figure 3 13 You can use the same controls as for Inspect windows see the previous section to hide or reveal levels of structures The contents of the Locals window always reflect the routine that is currently executing when you step into a different routine the new routine s local variables replace those in the previous display Back Trace To inspect the calling sequence leading to the current routine pull down the Debug menu and choose Back Trace or press Alt 6 A window opens to monitor the stack Backtrace Window S Backtrace O x E Call Stack Fe semQPut al nodeJob In the Backtrace window you can double click on any routine to make the corresponding editor window the active window Registers To view the values of the target registers pull down the Debug menu and choose Registers or press Alt 4 Figure 3 14 illustrates the Registers window 3 25 gdb960 User s Manual Figure 3 14 Registers Window Registers i960 HE Local pip 0 sp Oxa002d880 rip Ox
173. s 13 4 command hooks user defined 13 3 command line completion readline B 11 editing 5 8 invocation 2 5 Index 1 gdb960 User s Manual Index 2 command line continued startup options 2 6 text changing B 9 UNIX B 1 command window GUI Windows 3 37 commands ApLink 12 3 awatch watchpoint 8 6 backtrace display 9 2 break breakpoint 8 2 cd configuration 7 2 clear breakpoint 8 7 command breakpoint 8 11 condition breakpoint 8 9 cont execution 8 12 8 15 continue execution 8 10 8 13 define 11 1 define 13 1 defining 12 8 delete breakpoint 8 7 directory configuration 10 6 disable breakpoint 8 8 disassemble display 11 10 display name display 11 15 document 13 2 down selection 9 4 echo display 8 12 13 5 Emacs with gdb960 A 3 enable breakpoint 8 8 executed on breaking 8 11 file specifying 5 5 finish execution 8 13 for controlled output 13 5 for GMU 12 14 for moving on command line B 7 forward search search 10 5 frame 9 4 9 5 gdb960 command list 12 3 gmu display 8 17 hbreak breakpoint 8 3 help display 5 6 ignore count breakpoint 8 10 info address display 11 17 info args display 9 6 info break display 8 4 info breakpoints display 11 14 info line display 10 4 11 14 info locals display 9 6 info registers display 11 22 11 23 info stack display 9 3 info display 5 7 11 18 inspect display 11 1 jump executi
174. s If hardware assisted watchpoints are available in the target hardware they are assigned to the watchpoint otherwise a software watchpoint is generated Use awatch or wwatch for hardware only watchpoints whatis whatis exp Without an argument displays the data type of the last value in the value history exp Briefly display the data type of expression exp like pt ype but do not expand type descriptions The argument exp is not actually evaluated and any side effecting operations such as assignments inside it do not take place For more information on examining data refer to Chapter 11 where where Synonym for backtrace gdb960 Command and Option Reference wwatch wwatch expr Sets a memory write hardware watchpoint Memory write watchpoints halt program execution when a write is attempted at the address of expr X x formatspec address Examines memory without reference to the program s data types The format must be explicitly specified address The beginning location in memory where examination is to begin formatspec The format in which memory contents are to be displayed For more information on formatting output refer to Chapter 11 12 37 Storing Commands The gdb960 debugger provides two ways to store sequences of commands for execution user defined commands and command files This chapter lists commands for defining custom commands a description of how to create command files tha
175. s 3 29 1 1 Chapter Summaries 3 24 ieiiteag heavier ait 1 4 1 2 Appendix Summaries eseeeeeeseeeeesseteeeeeeeeeees 1 5 3 1 Summary of Debug Buttons eee 3 12 3 2 Breakpoint Buttons eccecceceeeeeeeeeeeeeeeeeeeeeeeeeees 3 16 3 3 Buttons for Stepping Through a Program 3 19 3 4 Buttons for Navigating Up and Down the Stack 3 21 3 5 Buttons for Bringing Up Auxiliary Debugger WHINGOWS 2s csstaadazie data a a a a a Aa 3 22 3 6 Options for Bringing Up the Memory Window 3 26 3 7 Memory display Formats and Units 3 28 3 8 Print Options iniaeeaa aree aa 3 35 8 1 Access T pGGsc eck a teees Ack aa eadaeeeueeaide 8 20 t2 Access TYPES n Ser ra aea 12 16 xiii The gdb960 Debugger This manual tells you how to use the gdb960 debugger in Microsoft Windows 95 Windows NT and UNIX gdb960 is a source level symbolic debugger that helps you find problems in your application code When used with a target platform such as a Cyclone evaluation platform and monitor software running in the target e g MON960 gdb960 lets you e Run your program with any command line arguments e Stop and restart your program at specified locations and conditions e Examine the internal state of your program when execution has stopped e Change the values in your program so that you can experiment with corrections and continue debugging without re invoking the program This chapter provides
176. s and data types of all variables declared outside of functions With the regexp argument display the names and data types of all variables except for local variables whose names match regular expression regexp watch This is a synonym for info break jump jump linenum address Resumes execution at a new location linenum Resume execution at line number Jinenum address Resume execution at the instruction at address address The asterisk is required so the command line parser can identify address asa location rather than a value For more information on halting the program refer to Chapter 8 list list Jistsize nl Without an argument displays 1istsize more lines If the last lines displayed were displayed with a 1ist command displays 1istsize lines following the last lines displayed however if the last line displayed was a solitary line displayed as part of displaying a stack frame displays listsize lines centered around that line The command set listsize n changes the default of ten lines to n lines linenum Display 1istsize lines centered on linenum from the current source file gdb960 Command and Option Reference Display the 1istsize lines preceding the last lines displayed function Display 1istsize lines centered around the beginning of function first last Display lines from first to last Both arguments are linespecs last Display listsize lines ending with last Firet Display
177. s in addition to the standard Shell mode commands C hm Describe the features of Emacs gdb960 Mode M s Execute to another source line like the gdb960 step command also update the display window to show the current file and location M n Execute to next source line in this function skipping all function calls like the gdb960 next command Then update the display window to show the current file and location M i Execute one instruction like the gdb960 st epi command update display window accordingly M x gdb960 nexti Execute to the next instruction using the gdb960 next i command update display window accordingly Ce Caf Execute until you exit from the selected stack frame like the gdb960 finish command M c Continue executing your program like the gdb960 continue command M u Go up the number of frames indicated by the numeric argument M d Go down the number of frames indicated by the numeric argument like the gdb960 down command Using gdb960 Under GNU Emacs C z amp Read the number where the cursor is positioned and insert it at the end of the gdb960 I O buffer For example if you wish to disassemble code around an address that was displayed earlier type disassemble then move the cursor to the address display and pick up the argument for disassemble by typing C x You can customize this further by defining elements of the gdb960 list print command once it is defined you can format or otherwi
178. s menu choose Options gt Font The Font dialog box appears Select the font from the Font box The text sample in the Sample box will change to the font you selected Select the size in points from the Size box The text sample in the Sample box will change to the font size you selected Changing Syntax Coloring in a Source File 1 Click the editor window or use the Window menu to make the source window active If there are multiple windows open on the source file select one of them Syntax coloring changes will appear in all windows opened on the source file From the Tools menu choose Options gt Color The Color Preferences dialog box is displayed The Items list box displays the current setting for syntax coloring Select a window or text element for which you want to specify a color Click a color from both the Foreground and Background color areas Click OK Note that syntax coloring must be enabled before you can set the syntax coloring properties for any specific file To enable global syntax coloring select the Syntax Coloring check box in the Color Preferences dialog box 3 37 gdb960 User s Manual The Debugger Command Line Window The gdb960v graphical interface is usually the most convenient way to run the debugger However you can also use the command line interface which in some cases is the best way to perform a particular action and in some cases the only way to perform an action The Debugger win
179. s or modules that comprise a program in an edit window You can also have multiple edit windows open which lets you move between source files and modules as needed 1 Press the List source code button in the gdb960v buttons window The window shown in Figure 3 6 appears File Function Lister Window File Function Lister Select a filename to list Or select a function to list You can also access this window by pulling down the View menu and choosing List Code The left field lists the names of the files or modules that comprise the program To the right is a list with the names of the functions found in the program 2 Select the file and function that you want displayed then press the List button An edit window appears displaying the selected file or module By default it appears in C code The two other file viewing options are described in Source Views on page 3 29 Using the gdb960 Windows Graphical User Interface NOTE f the debugger cannot find the file or function you specify it displays an error message in a message box In most cases the error is due to the directory with the desired module or file not being in the list of search directories To fix this problem use the Source Search Path option from the Debug menu to add the directory where the file or function resides to the list of search directories For more information see The Debug Menu on page 3 15 So far you have
180. s which register it is kept in For a non register local variable this displays the stack frame offset at which the variable is always stored Display the names and data types of all defined functions Display the names and data types of all defined functions whose names match the regular expression regexp Thus info fun step finds all functions whose names include step info fun step finds those whose names start with step Display the names and data types of local variables from the current stack frame Display the names of all source files along with debugging information Print a brief description of all types in the program This includes typedefs enums structs and unions explicitly declared or included Displaying Program Data and Symbols info types regexp Print a brief description of all types whose name matches regular expression regexp info variables Display the names and data types of all variables declared outside of functions i e all variables except for local variables info variables Display the names and data types of all variables regexp except for local variables whose names match the regular expression regexp printsyms Write a complete dump of the debugger s symbol filename data into the file filename Value History Values displayed by print are saved in gdb960 s value history so you can refer to them in other expressions Values are kept until the symbol table is re read or discarde
181. se process numbers picked up by c x before they are inserted A numeric argument to c x amp indicates both that you want special formatting and acts as an index to pick an element of the list If the list element is a string the number to be inserted is formatted using the Emacs function format otherwise the number is passed as an argument to the corresponding list element In any source file the Emacs command c x spc gdb960 break tells gdb960 to set a breakpoint on the source line point is on If you accidentally delete the source display buffer an easy way to get it back is to type the command in the gdb960 buffer to request a frame display when you run under Emacs this recreates the source buffer if necessary to show you the context of the current frame The source files displayed in Emacs are in ordinary Emacs buffers that are visiting the source files in the usual way You can edit the files with these buffers if you wish CAUTION Jn Emacs v19 or later most of the special commands shown above have been replaced by commands preceded with the c c command prefix Use C n m to list the commands available in gdb960 mode A 5 Command Line Editing Command line editing allows fast modification of command lines You can repeat often typed text delete and replace text record text to be inserted later splice commands together and repair mis typed commands This appendix describes the command line editing interface
182. set targetRunArgs debug You may also want to specify the editor to use by setting the EDITOR environment variable or by setting the textEditor TCL variable in the above tcl files For example set textEditor emacs 4 19 Configuring the gdb960 Environment In this chapter you learn some of the basic commands for configuring the gdb960 environment Topics include e Rules for using gdb960 commands e Commands for specifying files and directories e gdb960 environment variables e Using the help command to access reference information on gdb960 commands e Using the show command to determine the current gdb960 settings e Using the info command to display register and breakpoint settings e Setting the gdb960 command prompt e Command line editing e Using the History feature e Shell and Make options e Setting the gdb960 screen size e Setting the radix octal decimal hexadecimal e Message options e Quitting gdb960 Rules for Using gdb960 Commands Commands consist of a command name followed by arguments whose meaning depends on the command name For example the command step accepts an argument that is the number of times to step as in step 5 You can also use the step command with no arguments Some commands do not allow any arguments 5 1 gdb960 User s Manual 5 2 Command names may be truncated if the abbreviation is unambiguous Some commands have pre defined abbreviations These are li
183. sible 1 inespec command arguments that modify the display of source lines linenum offset ofrset filename linenum function Specifies line 1inenum of the current source file The linenum argument is a linespec When a list command has two 1inespec arguments both refer to the same source file as the first linespec Specifies the line offset lines after the last line displayed When used as the second 1inespec ina list command offset specifies the line offset lines after the first 1inespec Specifies the line offset lines before the last line displayed Specifies line 1inenum in the source file filename Specifies the line of the first executable statement that begins the body of the function Funston 10 3 gdb960 User s Manual filename function address Specifies the line of the first executable statement in the functionin filename The file name is needed with a function name only if you have identically named functions in different source files Otherwise the function argument searches all specified source files for the first match Specifies the line containing the program s address where address may be any expression The asterisk is necessary to allow the command line parser to identify address as an address rather than a number The info command maps source lines to program addresses The following is an example command line for the info command info line linenum Searching
184. source lines compilers generate code that is not contiguous because it is sometimes more efficient to interleave the object code from separate source lines In this situation the mixed mode display rearranges the assembly listing to group all object code below the line that generates it The display indicates any rearranged chunks of the assembly with an asterisk at the start of each non contiguous segment in the mixed mode display The debugger is fully operational no matter what view you select For example you can set breakpoints in a line of assembly code and you can use the Step and Next commands in either assembly or source In views that show assembly these commands step by instructions rather than by source lines see Navigating through a Program on page 3 17 The editor however works only on source code Thus when you display a view with disassembled instructions the editor display goes into read only mode until you either stop debugging or switch to the Source view NOTE Disassembly takes a long time the first time you switch to a view that requires it Subsequently in the same debugging session you can switch views quickly The disassembly information is not persistent the debugger discards it when you stop debugging or if you close the source file with the Close command in the File menu Note also that if you have a relatively slow PC e g has slower than a 100 MHz Pentium processor and or your modules ar
185. splaying memory If you use defaults for NFU you need not type the slash Several commands set convenient defaults for address N is the repeat count The repeat count is a decimal integer the default is 1 It specifies how much memory counting by units U to display 11 11 gdb960 User s Manual 11 12 F is the display format It is one of the formats used by print or s null terminated string or i machine instruction The default is x hexadecimal initially or the format specified the last time you used either the x command or print U is the unit size The unit size is any of the size specifiers described in the lists on the following pages Each time you specify a unit size with x that size becomes the default unit the next time you use x For the s and i formats the unit size is ignored and is normally not written Output format specifies how large a unit of memory to examine and how to display the contents of that unit Format specification consists of one or two of the following letters The following letters specify the size of unit to examine b Examine individual bytes h Examine half words two bytes each w Examine words four bytes each g Examine giant words eight bytes The following letters specify the display format x Display as integers in unsigned hexadecimal d Display as integers in signed decimal u Display as integers in unsigned decimal t Display as integers in b
186. ssion in the format specified in st ring Format specifications are the same as for C print For more information on expressions refer to Chapter 11 printsyms printsyms filename Writes a complete dump of the debugger s symbol data into the file filename profile profile put get clear filename Manages profile data clear Reset profile data area in target memory to all zeroes get filename Get profile data from filename and put it into the profile data area in target memory default file name is default pf put filename Store profile data from the profile data area in target memory into filename default file name is default pf gdb960 Command and Option Reference ptype ptype typename exp Displays a description of a type typename Display a description of data type t ypename typename can be the name of a type or for C code it can have the form struct struct tag union union tag Or enum enum tag exp Display a description of the type of expression exp This is like whatis except it displays a detailed description instead of just the name of the type pwd pwd Displays gdb960 s working directory quit guie I a 1 The optional n option tells quit not to reset the target system rbreak rbreak regexp Sets a breakpoint on all functions matching regexp This command sets an unconditional breakpoint on all matches displaying a list of all breakpoints set
187. sted in the description for individual commands For example s is specially defined as equivalent to step even though there are other commands whose names start with s For more information on command line shortcuts refer to Appendix B Entering a blank line at the gdb960 prompt repeats the previous command Commands whose unintentional repetition might cause trouble are restricted from repeating in this way Other commands e g 1ist and x act differently when repeated For example 1 ist n shows the next n lines beyond those already listed rather than repeating the lines already displayed An input line starting with is a comment it does nothing This is useful in command files For additional information on command files refer to Chapter 13 File specifying Options When you invoke gdb960 from the command line the debugger assumes that the first argument not preceded by one of the file specifying command line options or by the option flags or specifies an executable file For example in this command line program1 is the name of the executable from which symbolic information is read gdb960 pci programl This is equivalent to using the se option described below There are other options that let you perform such functions as changing the working directory specifying additional search directories and specifying whether the debugger loads a program s symbols before downloading and executing it add symbol fi
188. t cNum tests if the node exists ix 0 while ix lt dB nNum amp amp dB nArray ix tnid 1x if BR dB nNun return 1 tests if the connected node number i if dB nArray ix cNum NODEMAXCONNEX return 1 return the rank in the database return ix 1o To display a C struct the debugger displays the data structure graphically grouping hierarchical structures The dB window in Figure 3 11 is an example of a structure browser Each level of a hierarchy that groups other data is marked with a small minus sign icon To hide data that is not of current interest double click on any intermediate hierarchy level in a structure browser the debugger changes the level marker to a small plus sign to indicate that hidden data is available To reveal a hidden hierarchy level click the plus sign icon Figure 3 11 shows an Inspect window with some hidden hierarchy levels 3 23 gdb960 User s Manual Figure 3 11 Inspect Partly Hidden Structure Hierarchy Bg Inspect 1 dB x E struct dB char nNum 9 El struct GNODE nArray Eo char stable 1 char rev 0 struct tnid struct att int pc 3 int oD 0 int cNum 8 struct CONNECT_INFO cArray Ei 2 He You can also click on pointers marked with a small asterisk to open a new Inspect window that shows the pointer value This feature provides a convenient way of explo
189. t can execute sequences of commands automatically and a list of commands for controlling output User defined Commands A user defined command is a sequence of gdb960 commands that you assign a name which can then be used to invoke the sequence The define command assigns the execution name to the sequence of commands As with breakpoint command lists a user defined command is a list of commands entered after the initial command is entered Terminate the list with the end command The following is an example of creating a user defined command list which when invoked by entering the foo command displays a name a number and sets the tmp convenience variable to the next structure In 13 1 gdb960 User s Manual 13 2 this example the convenience variable tmp must be set to the first structure before the foo command is invoked Once defined this command allows examining each member of a list by repeatedly pressing RETURN gdb960 define foo print S tmp gt sptr gt name str print Stmp gt sptr gt number set tmp Stmp gt next end gdb960 The following is a list of commands used to create and manipulate user defined commands Each command is followed by a description of its use define Define a command named commandname If commandname there is already a command by that name you must confirm that you want to redefine it The command definition is made up of other gdb960 command lines that follow the
190. t size or a number of units add addr to the auto display list exp Add the expression exp to the auto display list and display it each time in the specified format formatspec The format in which memory contents are to display document document commandname Documents a user defined command commandname Document the user defined command commandname The document command reads lines of documentation ending with end After the document command is finished help on command commandname displays the documentation you specify down down n Selects the frame n frames down from the previously selected frame For positive numbers n this advances toward the innermost frame to lower frame numbers Default is one gdb960 Command and Option Reference down silently down silently n Same as down except produces no output This is useful in command scripts echo cho text Displays text C escape sequences may be used in text text Display text Non printing characters can be included in text using C escape sequences such as n to print a newline enable enable display once delete breakpoints bnums Enables breakpoints bnums Enable breakpoints specified in bnums If bnums is not specified enable all defined breakpoints breakpoints The breakpoints keyword is not necessary unless differentiating between enabling the display of breakpoints display and enabling breakpoints If no list of breakp
191. t the file or function that you want displayed 4 9 gdb960 User s Manual 3 Choose List Notice the following changes to the debugger main window e Two buttons for setting permanent or temporary breakpoints appear on the toolbar e Ifthe target is connected the Run button appears on the toolbar e The List mode menu appears The options in this menu let you specify whether you want to display C code assembly code or both File Target Windows Sourcelist List mode Run Y iy 2 List code ffs pl dev sre gas960 paulr 960 as c mon960 gas960c Ready ifdef DEBUG int tot_instr_count int mem_instr_count int mema_to_memb_count int FILE_run_count int FILE_tot_instr_count int FILE_mem_instr_count int FILE_mema_to_memb_count char xinstr_count_file gas960 trace endif int main arge argv int argc char argv ifdef GNU960 ifdef DOS ifdef _INTELC32 RARKAKKERAAARKKAKARAKKKAAARAKKAARARKKAAKARAKAAAARAKRARAKKKK under certain conditions type show copying to see the conditions There is absolutely no warranty for GDB type show warranty for details gdb960 5 0 003 Mon Sep 9 13 55 20 PDT 1996 GDB 4 13 sparc sun sunos4 1 3 target i960 intel hdi Copyright 1994 Free Software Foundation Inc gdb960 4 10 Using the gdb960 UNIX Graphical User Interface NOTE f the debugger cannot find the file or function you specify it displays an error message in the command
192. the first line of that function not to the next line currently displayed on your screen The only exception is for functions that are compiled without debugging information Step cannot step into these functions continued amp 3 19 gdb960 User s Manual 3 20 Table 3 3 Buttons for Stepping Through a Program continued Debug Menu Button Shortcut Command Description CTRL F5 Next z SHIFT F5 Finish Single steps without going into other functions The Next command is similar to Step but instead of stepping to the very next statement executed which in the case of a function call is typically not the next statement displayed Next steps to the next line on the screen The command allows you to run through a function call without considering its details If there is no intervening function call this is the same thing as Step When there is an intervening function call Next executes that function in its entirety then stops at the line after the function call Continues execution until the current function completes then the debugger regains control in the calling statement This option is useful if after stepping through a program you conclude that the problem you are interested in lies in the current function s caller rather than at the stack level where your program is suspended The effect of Step is somewhat different if the current view in the editor shows assembly instructions
193. the program stops For more detailed information on expressions refer to the Expressions section in this chapter Add the expression exp to the auto display list and display it each time in the specified format fmt fmt specifies only a display format and not a size or count For fmt i or s or when including a unit size or a number of units add the expression a memory address to be examined each time the program stops addr Examining means in effect entering x fmt addr Remove item numbers dnums from the list of expressions to display Disable the display of item numbers dnums A disabled display item is not displayed automatically but is not forgotten It may be enabled again later Enable the display of item numbers dnums The items in dnums appear once again in auto display until you specify otherwise Display the current values of the expressions on the list just as occurs when the program stops Displaying Program Data and Symbols info display Display the list of expressions set up to display automatically each one with its item number Do not display the values of the expressions Include disabled expressions and mark them as such in the printout Also include expressions that refer to automatic variables Examining the Symbol Table The commands described in this section allow you to inquire about the symbols names of variables functions and types defined in your program This information is
194. the PCI target specified with pci For more information about UNIX parallel download from gdb960 refer to Appendix F in this guide Selects a target connected to the host s PCI bus if available Selects a target connected to the host s PCI bus if available This option selects the target using an absolute PCI bus address All arguments are specified in hex Selects a target connected to the host s PCI bus if available This option selects the target using using an algorithm that searches for the first available PCI device that matches the specified PCI vendor and device ID All arguments are specified in hex gdb960 User s Manual 2 8 peic io mmap Configures PCI communications By default gdb960 always attempts to communicate with a PCI device via I O space This option permits the user to explicitly specify the interface io Communicate via I O space i e use in out instructions to access the PCI device mmap Communicate via memory mapped access HDIL Arguments The MON960 Host Debugger Interface Library HDIL routines allow interaction with the target monitor Several optional HDIL arguments may be specified on the target mon960 command line These options affect the communication between the host and target For more information on the HDIL routines refer to the MON960 Debug Monitor User s Guide Combining Serial Communication and PCI Downloading If your PC host and target support PCI communic
195. this any time after you have halted program execution To use this feature 1 Select the Windows menu and choose Backtrace or press the Backtrace button on the toolbar An interactive window displaying the program s call stack appears f Call Stack printf d 0 1 2 3 4 The frame that corresponds to the source pane is set in bold The Debug margin displays the current execution point going up and down in the backtrace The register window changes to display the register values for the selected stack frame 2 Click on any member of the call stack to display its contents in the source pane Using the Print Print Star Options The print and the print buttons let you print or print with one level of indirection what is currently selected in the source pane and display it in the command window For example suppose in the source pane there is a line of source code that says foo bar If you select the variable bar and press the print button the command window displays the current value of the variable in the command window gdb960 User s Manual 4 18 Editing Source Code To edit your source code drag the edit icon Lto the line that you want to change If you drag the Edit icon by default the vi editor is brought up You can specify a different editor by setting the EDITOR environment variable See Customizing the GUT on page 4 18 for more information Creating a New File To create a new source
196. time address pidoffset instead of to link time address Enter the same offset for both pc and pa Quiet Do not display the introductory and copyright messages Specify the serial port name of a serial interface to be used to connect to the target system Read each symbol file s entire symbol table immediately rather than the default which is to read it incrementally as needed Read symbol table from fi Je Read the symbol table from file and use it as the executable Use target as the target monitor type MON960 is currently the only supported target type gdb960 Command and Option Reference x file Execute gdb960 commands from file For more information on setting up a batch mode execution file see Chapter 13 The commana option is a synonym for x gdb960 Commands This section contains an alphabetic listing of the gdb960 commands Each command appears as a section header followed by a syntax description a description of the command s purpose and the arguments you can use with the command add symbol file add symbol file filename address Reads symbol table information filename Read additional symbol table information from filename address The memory address at which the files text section has been loaded aplink enable aplink enable bit value Changes bits in the ApLink mode register aplink reset aplink reset Executes the ApLink reset command 12 3 gdb960 User s
197. ting frame and describes it briefly This chapter provides information about manipulating stack frames selecting frames creating traces and extracting information from selected frames Stack Frames The call stack is divided into contiguous pieces called stack frames or frames Each frame contains the data associated with a call to a function A frame contains the function s arguments its local variables and its execution address When your program starts the call stack contains a frame for all purpose execution You might call this the start frame which is how gdb960 prints it for backtrace The function main is actually in the second to the outermost frame The starting frame is called the initial frame or the outermost frame Each time a function is called a new frame is created Each time a function returns its frame is eliminated from the call stack If 9 1 gdb960 User s Manual 9 2 a function is recursive there can be many frames for the same function The frame for the function where execution is actually occurring is called the innermost frame This is the most recently created of all the stack frames that still exist Stack frames are identified by addresses A stack frame consists of many bytes each of which has its own address different hosts have different conventions for choosing a byte whose address serves as the frame address On i960 processors the address of the currently executing frame is kept in th
198. tion Argument eeeeeeeeeeeeeeeeeeeeeeeeeaeees gdb960 COM Mans tac ielesiercnnuee erat einuds coerced add symbol file on cc feet enim eure eee AD NICMAS state ine e i ene eee aplink RESET oo 2e ks id ers A ldderee Meas eaeteen ee dae etd ete ee aplink SWITG A ini ienna ir a iea aplink WAL cance tee heh ete ath see a hes on Dace LW LC hne ese cS ra a Popa ease ANE E EAEE Contents CONNUE seie wba vaste Wie lean daade late biel alu ctate tiles 12 7 detine a ally spams scnuienstanseauadtdepoheamteniasaianats 12 8 COIBIO ES T E T E 12 8 delete display cicissssevcsceeeceeevsbuiuestencceseeblewtieaqelvee nancies 12 8 CIO CORY sic esi aee EE EE E E ER EES 12 8 disable maane E dhacmanenes 12 9 disassemble wrtvceisee ee tieideelista sevens aaaea aaea 12 9 CISPIAY ai a E a E E E a 12 10 d c ment esr e e a E 12 10 COM E TA 12 10 COWI SIDINY ss osia ceca pra senctecetydceaewesanvectenntiadiveaepnstincearness 12 11 Choa a a E a A a 12 11 enable an ea R EEA E EE NE 12 11 exec Tle seh E E E O E 12 12 E EEEE AL EA E EE A te ten Tan EEEE 12 12 fiM S Mire reia Er E E EEE REE RR Ei 12 12 f rward searoh ereen ae at a ERS 12 13 FAME s E EEE R 12 13 gmu detect define sanccccevcesveddeeettadieaesvensiectenoirsnnyetvestnentned 12 14 gmu detect disable snssnnnneeeeseeeennrrntresserrrrrrnrressrrrnne 12 14 gmu detect enable sccvicc teeics wool ekeesacrpeieael shoe aemnedacieeers 12 15 gmu protect GOING si te cscceuisie cues eieaedee
199. tion for breakpoint number bnum The breakpoint s halts the program only if the value of expression is true non zero in C If not specified remove the condition from breakpoint number bnums to make it an unconditional breakpoint For more information on examining data refer to Chapter 11 continue continue count Continues executing the program setting the ignore count of the breakpoint that halted execution to count minus one The program does not halt at the breakpoint again until the breakpoint is encountered count times If the program halts for any reason other than a breakpoint the argument to cont inue is ignored The synonym g is provided for convenience and has exactly the same behavior as other forms of the command 12 7 gdb960 User s Manual 12 8 define define commandname Defines a command commandname Define a command named commandname The end of these commands is marked by a line containing end delete delete bnums If no argument is specified deletes all breakpoints Otherwise deletes the breakpoints whose numbers appear in bnums delete display delete display dnums Removes item numbers dnums from the list of expressions to display If dnums is omitted removes all items from the list of expressions to display directory directory dirname With no argument resets the source path to empty You are then prompted for confirmation dirname Add directory dirname to t
200. tput large amounts of information to the screen To help you read all of it gdb960 pauses and asks you for input at the end of each page Enter RET to continue On UNIX gdb960 sets the screen size based on settings from the termcap database the value of the TERM environment variable and the stty rows and stty cols settings In Windows gdb960 queries the host for the current screen dimensions You can override the default settings with the set height and set width commands 5 11 gdb960 User s Manual 5 12 The gdb960 software debugger also uses the screen width setting to determine when to wrap lines of output It tries to break the line at a readable place rather than simply letting it overflow onto the following line show height show width set height lpp set width cpl Setting Radix These set commands specify a screen height and a screen width where 1pp contains the number of lines on the screen and cp contains the number of columns on the screen The associated show commands display the current setting If you specify a height of zero lines gdb960 does not pause during output no matter how long the output is This is useful if output is to a file or to an editor buffer You can enter numbers in octal decimal or hexadecimal in gdb960 using the standard conventions Octal numbers begin with 0 and hexadecimal numbers begin with 0x Numbers that begin with none of these are by default entered in base t
201. ts input commands via the readline interface This GNU library provides consistent behavior for programs that provide a command line interface to the user Advantages are Emacs style or vi style in line editing of commands csh like history substitution as well as storage and recall of command history across debugging sessions For detailed information on the command line editing capabilities of gdb960 refer to Appendix B Command Line Editing The set command controls the behavior of command line editing in gdb960 The show command checks the status of command line editing The following examples demonstrate the use of set and show Fora complete list of the options available for set and show refer to Chapter 12 set editing Enable command line editing enabled by set editing on default set editing off Disable command line editing show editing Show whether command line editing is enabled Configuring the gdb960 Environment Using the History Feature The set history save command causes each command entered at the gdb960 command line to be stored for later retrieval You can store the commands to either a buffer or a file History expansion commands allow retrieval of commands stored by history Below is the set history command syntax followed by a list of and a description of the effects of the possible replacements for option in a set history command set history option Where option may be any of the following filen
202. u must be familiar with your host operating system the 1960 processor architecture and the 1960 processor program development tools CTOOLS See the list of related publications listed in Getting Started with the i960 Processor Development Tools for more information on the i960 processor This manual assumes that you know techniques for writing and debugging software Notational Conventions The following notational and terminology conventions are used throughout this manual debugger debug tool refers to the gdb960 software debugger 1960 Cx processor refers generically to the 1960 CA and CF processors 1960 Hx processor refers to the 1960 HA HD and HT processors 1960 Jx processor refers to the 1960 JA JF and JD processors 1960 Kx processor refers generically to the i960 KA KB SA and SB processors target processor refers to the 1960 processor on the target board This processor can be an i960 Sx Kx Cx Jx Hx or RP processor This type style indicates an element of syntax a reserved word a keyword a filename computer output or part of a program example The text appears in lowercase unless uppercase is significant 1 is lowercase letter L in examples 1 is the number 1 in examples O is the uppercase O in examples 0 is the number 0 in examples The gdb960 Debugger This type style indicates the exact characters you type as input in examples This type style indicates a place holder for an identi
203. uction pointer value is also shown unless you use set print address off If a function is in a source file whose symbol table data has been fully read the backtrace shows the source file name and line number as well as the function s arguments When the line number is shown the instruction pointer value for that line number is omitted if it is at the beginning of the code Here is an example of a backtrace It was made with the command bt 3 so it shows the innermost three frames 0 rtx_equal_p x rtx Ox8e58c y rtx 0x1086c4 gp rms cc rtlanal c line 337 1 Ox246b0 in expand call 2 Ox2lef in expand expr 1 4 ss More stack frames follow The functions expand_call and expand_expr are ina file whose symbol details have not been fully read Full detail is available for the function rtx_equal_p which is in the file rt 1anal c Its arguments named x and y are shown with their typed values 9 3 gdb960 User s Manual 9 4 Selecting a Frame Most commands for examining the stack and other data in a program work on the currently selected stack frame The following commands select a stack frame Each finishes by displaying a brief description of the stack frame just selected frame n frame frame_addr up n down n Select frame number n where frame zero is the innermost currently executing frame frame one is the frame that called the innermost one and so on The highest
204. ur program was compiled and can display parts of the source files text When execution halts gdb960 displays the source line at which execution halted When you select a stack frame gdb960 displays the source line on which execution in that frame has halted This chapter describes commands and techniques that allow you to display specified pieces of source files The chapter contains information on displaying specified source lines identifying the directory in which source files are found and searching source files for particular lines Displaying Source Lines To display lines from a source file use the 1 ist command abbreviated as 1 There are several ways to specify which part of the file you want to display The following is a list of the most common uses of the 1 ist command Each command is followed by a description of its effect list linenum Display listsize lines centered on linenum from the current source file The command set listsize n changes the default of ten lines to n lines list function Display 1istsize lines centered around the beginning of function 10 1 gdb960 User s Manual 10 2 Leet Lge Display 1istsize more lines If the last lines displayed were displayed with a 1ist command display 1istsize lines following the last lines displayed however if the last line displayed was a solitary line displayed as part of displaying a stack frame display 1istsize lines centered around that line
205. urce file or load its symbols If you choose to load the symbols you can also download the file to the target In this section you load the symbols and download to the target See Editing Source Code on page 4 18 for more information on using gdb960v to run your favorite text editor Load symbols IE Download to target Using the gdb960 UNIX Graphical User Interface 5 Select the Load symbols and Download to target options and choose Open Notice the following changes to the Debugger window The Open file button from the toolbar disappears The List Code button appears on the toolbar The status line indicates the basename of the file from which you have loaded symbols downloaded code The Source list menu appears The options in this menu allow you to set the search directories for source files and also to bring up the list code dialog Listing Code The debugger lets you display any of the files or modules that comprise a program You can also have multiple windows open which lets you move between source files and modules as needed 1 Choose List Code from the toolbar This window appears Selecta filename to list Or select a function name to list atof_gen c atofieee c cec_finfo c cc_finfo c cc_info c cec_linfo c cce_rdwrt c emdout c The left field displays the names of the files or modules that comprise the program To the right are the names of the functions found in the program 2 Selec
206. window e The Target Connect button in the gdb960v buttons pane disappears e The status line at the lower left corner indicates that you have connected to a host running MON960 Setting the Search Path The debugger maintains a list of directories where it searches for source code This list is called the source search path To edit this list 1 Open the Debug pull down menu and then select Source Search Path This window shown in Figure 3 4 appears gdb960 User s Manual 3 8 Figure 3 4 Source Search Path Window Debugger Source Search Path Directories C AINTELS6O BIN Remove C wazzu Move Up Move Down Path C testfiles Cancel 2 Use the following buttons to maintain the Search list Add Brings up a window where you can select a new directory to add to the current search directory list Remove Removes a search directory from the list Move Up Moves the selected directory up one place higher in the list Move Down Moves the selected directory down one place lower in the list Note that the order of the directories is significant Generally you should place the directories that you will be accessing most often first Also if the same filename exists in multiple directories make sure the directory with the desired file is listed above any other directories that contain files with the same name To reduce confusion while debugging your application we recommend you consider us
207. window In most cases the error is due to the directory with the desired module or file not being in the list of search directories To fix this problem use the Search Directories option from the Windows directory to add the directory where the file or function resides to the list of search directories For more information see Setting the Search Directories on page 4 11 You are now ready to debug your software as described in the next section Setting the Search Directories The Search Directories option lets you maintain a list of directories that gdb960v uses when searching for files or modules for listing Also if the same filename exists in multiple directories make sure the directory with the desired file is listed above any other directories that contain files with the same name 1 Open the Source list menu and choose Search directories This window appears Current search directory list ffs s3 960tools tornado unix wingdb960 c cdir Remove selected directory Add directory after selection Insert directory before selection 4 11 gdb960 User s Manual 2 Use these options to set up the search directories list Remove selected directory Removes the selected directory from the search list Add directory after selection Adds a new entry to the search directory list after the selection Pressing Insert directory before Adds a new entry to the search directory list before the selection
208. xt Causes execution to resume for one line of C code or assembly instruction depending on which list mode is currently selected The step button steps into calls whereas the next button steps over calls Continue Continues execution from where it stopped 4 4 14 Using the gdb960 UNIX Graphical User Interface z Finish Continues execution until the current subroutine completes then the debugger regains control in the calling statement Backtrace Displays the backtrace window See backtrace window below t Up stack frames Causes the debugger to go to the scope of the caller of the current frame 4 Down stack frames Causes the debugger to go down in stack frames closer to where the machine is actually executing p pe print print star Lets you print or print with one level of indirection what is currently selected in the source pane and display it in the command window i i Display display Display the value of the selection or the selection with one level of indirection in a separate window The window updates whenever the variable changes values Once a program starts executing the debugger regains control after e the program encounters one of the breakpoints you inserted or e the program encounter a fatal error or e you press the Target interrupt button When the debugger regains control the source pane displays the C source code or assembly language corresponding to the location where executi
209. y To frequently display the value of an expression to see how it changes add it to the automatic display list so that gdb960 displays its value each time the program stops Each expression added to the list is given an identifying number To remove an expression from the list specify that number in a disable display or delete display command The automatic display shows item numbers expressions and their current values 2 foo 38 3 bar 5 struct hack 0x3804 If the expression refers to local variables then it does not make sense outside the lexical context in which it was set up Such an expression is disabled when execution enters a context where one of its variables is not defined For example if you give the command display name while inside a function containing a variable name then this argument displays while the program continues to stop inside that function When it stops elsewhere where there is no variable name display is disabled The next time your 11 15 gdb960 User s Manual 11 16 program stops where name is meaningful you can enable the display expression once again by entering the enable display command The following is a list of display commands and their descriptions display exp display fmt exp display fmt addr undisplay dnums delete display dnums disable display dnums enable display dnums display Add the expression exp to the list of expressions to display each time
210. ymbols were loaded Without the addr argument display a verbose description of the selected stack frame With the addr argument display a verbose description of the frame at address addr gdb960 Command and Option Reference functions regexp gmu line linenum program logals registers regname set sources stack target types regexp Without the regexp argument display the names and data types of all defined functions With the regexp argument display the names and data types of all defined functions whose names match the regular expression regexp Display the current values of all Guarded Memory Unit GMU registers Hx only Display the starting and ending addresses of the compiled code for source line 1 inenum Display the execution status of the program Display the selected frame s local variables each on a separate line Without the regname argument display the names and relativized values of all non floating point registers With the regname argument display the relativized value of register regqname Display all gdb960 settings Display the names of all source files with debugging information Display a backtrace Display the execution status of the program Display either all types or all those matching the regular expression regexp 12 19 gdb960 User s Manual 12 20 variables regexp Without the regexp argument display the name
211. ype here You can select a previously displayed address from the drop down list associated with this box Select a display format from this drop down list box Type the amount of memory to display here The units are specified in the adjacent in field For example if the in field has the value Word the Memory window displays 4 x Size bytes of data Select the unit of memory to display Using the gdb960 Windows Graphical User Interface Table 3 7 Memory Display Formats and Units Format Values Unit Values in Hex ASCII Byte Octal Halfword Hex Word Decimal Giant 8 bytes Unsigned decimal Binary Float Address Instruction Char String See the description of the x examine command in Chapter 13 for a discussion of the memory display formats Source Views While the debugger is running you have control how your program is displayed By default the debugger displays your code in C style You also have the option of displaying the source as disassembly or a combination of C and disassembly To change the view simply pull down the View menu and choose one of these options Source Displays the C source code This is the default style of program display To choose this option you can also press the F7 key Disassembly Displays a symbolic disassembly of your program s object code This style of display is the default for routines compiled without debugging information such as the C runtime lib
212. ype of value including structures and arrays even if that variable already has a value of a different type The convenience variable as an expression has its current value s type Use the show command to display a list of convenience variables used show convenience Display a list of convenience variables used so far and their values show con is the abbreviation One way to use a convenience variable is as a counter to be incremented or as a pointer to be advanced In the following example i is set at 0 and used in the print command to control incrementing the bar array set Si 0 print bar Sit gt contents repeat that command by typing RET The following is a list of the convenience variables gdb960 automatically creates _ Automatically set by the x command to the last address examined Other commands that provide a default address for x to examine also set _ to that address The commands include info line and info breakpoint a The variable __ is automatically set by the x command to the value found in the last address examined 11 21 gdb960 User s Manual 11 22 Registers Machine register contents can be referred to in expressions as variables with names starting with s The info registers command lists the names of all the registers The names ip and sp represent the instruction pointer register and the stack pointer respectively The name fp represents a register that contains a pointer to t

Download Pdf Manuals

image

Related Search

Related Contents

HP Pavilion dm4 Entertainment PC    Plantronics 80846-02  LG MFL39817401 User's Manual  Ma Yaris facile - Communauté d`Agglomération du Pays Viennois  SmartTemplate User Guide  R&S FSH Quick Start Guide  the great outdoors by Minka Lavery 9274-277 Instructions / Assembly  Manual do usuário da M105  Pelco DX8000 User's Manual  

Copyright © All rights reserved.
Failed to retrieve file