hit counter script
HP 68000 Series User Manual
HP 68000 Series User Manual

HP 68000 Series User Manual

Debugger/simulator
Table of Contents

Advertisement

Quick Links

User's Guide
HP B1466
68000 Series
Debugger/Simulator

Advertisement

Table of Contents
loading

Summary of Contents for HP 68000 Series

  • Page 1 User’s Guide HP B1466 68000 Series Debugger/Simulator...
  • Page 2 Hewlett-Packard Company. The information contained in this document is subject to change without notice. HP-UX 9.* and 10.0 for HP 9000 Series 700 and 800 computers are X/Open Company UNIX 93 branded products. UNIX® is a registered trademark in the United States and other countries, licensed exclusively through X/Open Company Limited.
  • Page 3 Therefore, do not expect a one-to-one correspondence between product updates and manual revisions. Edition dates and the corresponding HP manual part numbers are as follows: Edition 1 B1466-97003, November 1992 Edition 2...
  • Page 4 Debugging C Programs for 6800x/010/020/3xx Microprocessors The HP B1466 68000 Series Debugger/Simulator is a debugging tool for 6800x/010/020/3xx microprocessor code. The debugger loads and executes C programs or assembly language programs using a simulator on your host system. With the Debugger, You Can ...
  • Page 5 • Access on-line help information. Compatibility with Other Products The debugger/emulator has been designed to work with HP-UX (version 8.0 or greater), SunOS, or Solaris (see the Installation Notice for version requirements) and the following Hewlett-Packard language products: HP B3640, Motorola 68000 Family C Cross Compiler, Version 4.00 HP B3641, Motorola 68000 Family Assembler, Linker, Librarian, Version 2.00.
  • Page 6 In This Book This book is organized into five parts: Part 1. Quick Start Guide An overview of the debugger and a short lesson to get you started. Part 2. User’s Guide How to use the debugger to solve your problems. Part 3.
  • Page 7: Table Of Contents

    Contents Part 1 Quick Start Guide 1 Getting Started with the Graphical Interface The Graphical Interface at a Glance Pointer and cursor shapes The Debugger Window Graphical Interface Conventions Mouse Buttons Platform Differences The Quick Start Tutorial The Demonstration Program To prepare to run the debugger To start the debugger To activate display area windows...
  • Page 8 Contents To recall an entry buffer value To display the address of a variable To break on an access to a variable To use the command line To use a C printf command To turn the command line off To see on-line help To end the debugging session Part 2 User’s Guide 2 Entering Debugger Commands...
  • Page 9 Contents To recall commands To get help about the command line To find commands which duplicate a menu selection Using the Command Line with the Keyboard To enter debugger commands from the keyboard To edit the command line To recall commands using the command line recall feature To display the help window Viewing Debugger Status Debugger Status...
  • Page 10 Contents To step over functions To run from the current program counter (PC) address To run from a start address To run until a stop (break) address To count simulated clock cycles To add simulated wait states Using Breakpoints To set a memory access breakpoint To set an instruction breakpoint To set a breakpoint for a C+ + object instance To set a breakpoint for overloaded C+ + functions...
  • Page 11 Contents To rewind the input file associated with an input port To display input port buffer values Accessing Output Ports To set or alter output port status To delete an output port To rewind the output file associated with an output port To display output port buffer values Accessing the UNIX Operating System To fork a UNIX shell...
  • Page 12 Contents To view commands in a separate window Displaying C Source Code To display C source code To find first occurrence of a string To find next occurrence of a string Displaying Disassembled Assembly Code To display assembly code Displaying Program Context To set current module and function scope To display current module and function To display debugger status...
  • Page 13 Contents Using Simulated I/O How Simulated I/O Works Simulated I/O Connections Special Simulated I/O Symbols To enable simulated I/O To disable simulated I/O To set the keyboard I/O mode to cooked To set the keyboard I/O mode to raw To control blocking of reads To interpret keyboard reads as EOF To redirect I/O To check resource usage...
  • Page 14 Contents 6 Using Macros and Command Files Using Macros To display the Macro Operations dialog box To define a new macro interactively using the graphical interface To use an existing macro as a template for a new macro To define a macro interactively using the command line To define a macro outside the debugger To edit an existing macro To save macros...
  • Page 15 Contents To change debugger options settings To specify whether command file commands are echoed to the Journal window To set automatic alignment for breakpoints and disassembly To set backtrace display of bad stack frames To specify demand loading of symbols To select the microprocessor simulated To select the interpretation of numeric literals (decimal/hexadecimal) To specify exception processing behavior...
  • Page 16 Contents To use customized scheme files To set up custom action keys To set initial recall buffer values Part 3 Concept Guide 8 X Resources and the Graphical Interface An X resource is user-definable data A resource specification is a name and a value Don’t worry, there are shortcuts But wait, there is trouble ahead Class and instance apply to applications as well...
  • Page 17 Contents Symbol Commands Window Commands Breakpt Access Breakpt Clear_All Breakpt Delete Breakpt Erase Breakpt Instr Breakpt Read Breakpt Write Debugger Directory Debugger Execution Display_Status Debugger Execution IO_System Debugger Execution Load_State Debugger Execution Reset_Processor Debugger Execution Save_State Debugger Host_Shell Debugger Help Debugger Level Debugger Macro Add Debugger Macro Call...
  • Page 18 Contents File Window_Close Memory Assign Memory Block_Operation Copy Memory Block_Operation Fill Memory Block_Operation Match Memory Block_Operation Search Memory Block_Operation Test Memory Display Memory Hex Memory Inport Assign Memory Inport Delete Memory Inport Rewind Memory Inport Show Memory Map Guarded Memory Map Read_Only Memory Map Show Memory Map Write_Read Memory Outport Assign...
  • Page 19 Contents Window Active Window Cursor Window Delete Window Erase Window New Window Resize Window Screen_On Window Toggle_View 10 Expressions and Symbols in Debugger Commands Expression Elements Operators Constants Symbols Program Symbols Debugger Symbols Macro Symbols Reserved Symbols Line Numbers Addresses Code Addresses Data and Assembly Level Code Addresses Address Ranges...
  • Page 20 Contents Stack References 11 Predefined Macros break_info byte close dword error fgetc fopen getsym inport isalive key_get key_stat memchr memclr memcpy memset open outport read reg_str showversion strcat strchr strcmp strcpy stricmp strlen strncmp until when word write...
  • Page 21 Installation at a Glance Supplied interfaces Supplied filesets C Compiler Installation To install software on an HP 9000 system Required Hardware and Software Step 1. Install the software To install the software on a Sun SPARCsystem™ Required Hardware and Software...
  • Page 22 Contents xxii...
  • Page 23: Part 1 Quick Start Guide

    Part 1 Quick Start Guide...
  • Page 24 Part 1...
  • Page 25: Getting Started With The Graphical Interface

    Getting Started with the Graphical Interface How to get started using the debugger’s graphical interface.
  • Page 26 Chapter 1: Getting Started with the Graphical Interface When an X Window System that supports OSF/Motif interfaces is running on the host computer, the debugger has a graphical interface that provides features such as pull-down and pop-up menus, point and click setting of breakpoints, cut and paste, on-line help, customizable action keys and pop-up recall buffers.
  • Page 27: The Graphical Interface At A Glance

    Chapter 1: Getting Started with the Graphical Interface The Graphical Interface at a Glance Pointer and cursor shapes Arrow The arrow mouse pointer shows where the mouse is pointing. Hand The hand mouse pointer indicates that a pop-up menu is available by pressing the right mouse button.
  • Page 28: The Debugger Window

    Chapter 1: Getting Started with the Graphical Interface The Debugger Window Menu bar Action keys Entry buffer Scroll bar Display area Status line Command line...
  • Page 29 Chapter 1: Getting Started with the Graphical Interface Menu Bar. Provides pull-down menus from which you select commands. When menu items are not applicable, they appear half-bright and do not respond to mouse clicks. Action Keys. User-defined pushbuttons. You can label these pushbuttons and define the action to be performed.
  • Page 30: Graphical Interface Conventions

    Chapter 1: Getting Started with the Graphical Interface Graphical Interface Conventions This manual uses a shorthand notation for indicating that you should choose a particular menu item. For example, the following instruction Choose File→Load→Executable... means to select the File menu, then select Load from the File menu, then select the Executable...
  • Page 31: Mouse Buttons

    Chapter 1: Getting Started with the Graphical Interface Mouse Buttons Mouse Buttons Mouse Button Descriptions Button Name General Function left Selects pushbuttons. Pastes from the display area to the entry buffer. middle Pastes from the entry buffer to the command line text area.
  • Page 32: Platform Differences

    This manual refers to those mouse button and keyboard bindings in a general way. Refer to the following tables to find out the button names for the computer you are using to run the debugger. Mouse Button Bindings Generic Button Name HP 9000 Sun SPARCsystem command select left right...
  • Page 33: The Quick Start Tutorial

    Chapter 1: Getting Started with the Graphical Interface Platform Differences The Quick Start Tutorial This tutorial gives you step-by-step instructions on how to perform a few basic tasks using the debugger. Perform the tasks in the sequence given; otherwise, your results may not be the same as those shown here.
  • Page 34: To Prepare To Run The Debugger

    "platformScheme" in the Xdefaults.sim file. This file is located in directory /usr/hp64000/demo/debug_env/sim68000. For example, if you are sitting at a Sun workstation which is networked to an HP 9000 Series 300 workstation, change the platformScheme to "SunOS".
  • Page 35: To Start The Debugger

    Chapter 1: Getting Started with the Graphical Interface To start the debugger To start the debugger 1 Change to the debugger demo directory: cd /usr/hp64000/demo/debug_env/sim68000 2 Start the debugger by entering: Startdebug This will set some environment variables, start the debugger and load a program for you to look at.
  • Page 36: To Activate Display Area Windows

    Chapter 1: Getting Started with the Graphical Interface To activate display area windows To activate display area windows Notice there are several windows in the main display area of the debugger. The different windows contain different types of information from the debugger.
  • Page 37: To Run Until Main()

    Chapter 1: Getting Started with the Graphical Interface To run until main() To run until main() 1 Click on the Run til () action key. The Code window now shows the main () routine. Clicking on the Run til () action key runs the program until the line indicated by the contents of the entry buffer.
  • Page 38: To Scroll The Code Window

    Chapter 1: Getting Started with the Graphical Interface To scroll the Code window To scroll the Code window To see more of the program you can: • Use the mouse to operate the vertical scroll bar: Click to go to top of file Click to go up one line Click to go up one half page Drag slider to move incrementally...
  • Page 39: To Display A Function

    Chapter 1: Getting Started with the Graphical Interface To display a function To display a function 1 Position the cursor over the call to init_system. 2 Click the left mouse button. This will place the string "init_system" into the entry buffer. 3 Click on the Disp Src () action key.
  • Page 40: To Run Until A Line

    Chapter 1: Getting Started with the Graphical Interface To run until a line To run until a line 1 Position the cursor over line 34. The hand-shaped cursor means that a pop-up menu is available. 2 Hold down the right mouse button to display the Code window pop-up menu. Move the mouse to Run until, then release the button.
  • Page 41: To Edit The Program

    To edit the program To edit the program This step assumes you are using an HP Advanced Cross Language System compiler (HP B3640). If you are using another compiler, skip this step. Suppose we wanted the initial value of target_temp to be 74 instead of 73. The debugger makes it easy to change the source code: 1 Place the cursor over the assignment to target_temp (line 33).
  • Page 42: To Display Init_System() Again

    Chapter 1: Getting Started with the Graphical Interface To display init_system() again To display init_system() again • Click on the Disp Src() action key. Since "init_system" is still in the entry buffer, the init_system() routine is displayed. You have now completed a edit-compile-load programming cycle. To set a breakpoint We want to run until just past the line that we changed.
  • Page 43: To Run Until The Breakpoint

    Chapter 1: Getting Started with the Graphical Interface To run until the breakpoint To run until the breakpoint • Click on the Run Xfer action key to run the program from its transfer address. While the program is executing, the menus and buttons are "grayed out," and an "hourglass"...
  • Page 44: To Patch Code Using A Macro

    Chapter 1: Getting Started with the Graphical Interface To patch code using a macro To patch code using a macro 1 Position the cursor over line 38. 2 Select Attach Macro from the Code window pop-up menu. The Macro Operations dialog box appears. The macro "patch_temp" is already selected.
  • Page 45: To Delete A Single Breakpoint

    Chapter 1: Getting Started with the Graphical Interface To delete a single breakpoint Debugger Macro Add int patch_temp() /* set the current_temp to be 71 degrees instead of what the code says */ current_temp = 71; /* Restart execution at line # 39 -- Skips over the code too!! $Memory Register @PC = #39$;...
  • Page 46: To Delete All Breakpoints

    Chapter 1: Getting Started with the Graphical Interface To delete all breakpoints To delete all breakpoints 1 Position the mouse pointer in the Breakpoint window. 2 Hold down the right mouse button to select Delete All Breakpoints from the Breakpoint window pop-up menu. All breakpoints are deleted.
  • Page 47: To Step Through A Program

    Chapter 1: Getting Started with the Graphical Interface To step through a program To step through a program You can execute one source line (high-level mode) or one instruction (assembly-level mode) at a time by stepping through the program. • Click on the Step action key a few times. •...
  • Page 48: To Step Over Functions

    Chapter 1: Getting Started with the Graphical Interface To step over functions To step over functions You can either step through functions or step over functions. When you step over a function, it is executed as a single program step. •...
  • Page 49: To Change The Value Of A Variable

    Chapter 1: Getting Started with the Graphical Interface To change the value of a variable To change the value of a variable 1 In the entry buffer, add "= 10" after "num_checks". 2 Click on the C Expr () action key. The new value is displayed in the Journal window and in the Monitor window.
  • Page 50: To Recall An Entry Buffer Value

    Chapter 1: Getting Started with the Graphical Interface To recall an entry buffer value To recall an entry buffer value 1 Click on the Recall button. 2 In the Recall dialog box, click the left mouse button on "num_checks". 3 In the Recall dialog box, click the left mouse button on OK. The string "num_checks"...
  • Page 51: To Display The Address Of A Variable

    Chapter 1: Getting Started with the Graphical Interface To display the address of a variable To display the address of a variable You can use the C address operator (&) to display the address of a program variable. 1 Position the mouse pointer in the entry buffer. 2 Type "&"...
  • Page 52: To Break On An Access To A Variable

    Chapter 1: Getting Started with the Graphical Interface To break on an access to a variable To break on an access to a variable You can also set breakpoints on a read, a write, or any access of a variable. This helps to locate defects due to multiple functions accessing the same variable.
  • Page 53: To Use The Command Line

    Chapter 1: Getting Started with the Graphical Interface To use the command line To use the command line 1 Select Settings→Command Line from the menu bar. The command line area which appears at the bottom of the debugger window can be used to enter complex commands using either the mouse or the keyboard.
  • Page 54: To Turn The Command Line Off

    Chapter 1: Getting Started with the Graphical Interface To turn the command line off In this example, the value of num_checks is printed as a decimal integer with a field width of 10, padded with zeros. To turn the command line off 1 Move the mouse pointer to the Status line.
  • Page 55: To See On-Line Help

    Chapter 1: Getting Started with the Graphical Interface To see on-line help To see on-line help 1 Select Help→General Topic ... 2 Select To Use Help, then click on the OK button. Spend a few minutes exploring the help topics, so that you can find them when you need them.
  • Page 56: To End The Debugging Session

    • Use the command select mouse button to choose File→Exit→Yes. The debug session is ended and your system prompt is displayed. This completes your introduction to the 68000 Series Debugger/Simulator. You have used many features of the debugger. For additional information on performing tasks with the debugger, refer to the "User’s Guide"...
  • Page 57: Part 2 User's Guide

    Part 2 User’s Guide...
  • Page 58 Part 2...
  • Page 59: Entering Debugger Commands

    Entering Debugger Commands How to enter debugger commands using the mouse or the keyboard.
  • Page 60 Entering Debugger Commands This chapter shows you how to enter debugger commands using the graphical interface or the standard interface. The tasks are grouped into the following sections: • Starting the debugger. • Using menus, the entry buffer, and action keys. •...
  • Page 61 Chapter 2: Entering Debugger Commands Function Key Commands You can enter commonly used commands quickly and easily by pressing the function keys F1 through F8 on your keyboard. Function keys can be used in the graphical interface as well as the standard interface. The following table and figure describe the commands associated with the function keys.
  • Page 62 Chapter 2: Entering Debugger Commands Command Line Control Character Functions Press the control key <Ctrl> simultaneously with the B, C, E, F, G, L, Q, R, S, U, or \ keys to execute the operations listed in the following table. (The letter keys may be upper- or lower-case.) Command Line Control Character Functions Control...
  • Page 63: Starting The Debugger

    Chapter 2: Entering Debugger Commands Starting the Debugger Starting the Debugger Use the db68k command to start the debugger. See Also The “Getting Started with the Graphical Interface” chapter for information about starting the graphical interface. The “Getting Started with the Standard Interface” chapter for information about starting the standard interface.
  • Page 64: Using Menus, The Entry Buffer, And Action Keys

    Chapter 2: Entering Debugger Commands Using Menus, the Entry Buffer, and Action Keys Using Menus, the Entry Buffer, and Action Keys This section describes the tasks you perform when using the debugger’s graphical interface to enter commands. This section describes how to: •...
  • Page 65: To Choose A Pull-Down Menu Item Using The Mouse (Method 2)

    Chapter 2: Entering Debugger Commands Using Menus, the Entry Buffer, and Action Keys If you decide not to select a menu item, simply continue to hold the mouse button down, move the mouse pointer off of the menu, and release the mouse button.
  • Page 66: To Choose A Pull-Down Menu Item Using The Keyboard

    • To initially display a pull-down menu, press and hold the menu select key (for example, the “Extend char” key on a HP 9000 keyboard) and then type the underlined character in the menu label on the menu bar. (For example, “f” for “File”.
  • Page 67: To Choose Pop-Up Menu Items

    Chapter 2: Entering Debugger Commands Using Menus, the Entry Buffer, and Action Keys policy is set to pointer. That just means that the window containing the mouse pointer receives the keyboard input. In addition to keyboard mnemonics, you can also specify keyboard accelerators which are keyboard shortcuts for selected menu items.
  • Page 68: To Use Pop-Up Menu Shortcuts

    Chapter 2: Entering Debugger Commands Using Menus, the Entry Buffer, and Action Keys To use pop-up menu shortcuts • To choose the first item in a pop-up menu, click the right mouse button. • To choose the second item in a pop-up menu, hold down the < Shift> key and click the right mouse button.
  • Page 69 Chapter 2: Entering Debugger Commands Using Menus, the Entry Buffer, and Action Keys On a memory display, you may need to scroll the display to show more characters of a symbol. The interface displays absolute addresses as hex values. If you copy and paste an address from the display to the entry buffer, you must add a trailing “h”...
  • Page 70: To Recall Entry Buffer Values

    Chapter 2: Entering Debugger Commands Using Menus, the Entry Buffer, and Action Keys To recall entry buffer values 1 Position the mouse pointer over the Recall button just to the right of the entry buffer text area, and click the mouse button to bring up the Entry Buffer Value Selection dialog box.
  • Page 71: To Edit The Entry Buffer

    Chapter 2: Entering Debugger Commands Using Menus, the Entry Buffer, and Action Keys To edit the entry buffer • To position the keyboard cursor, click the left mouse button or use the arrow keys. • To clear the entry buffer, type < Ctrl> -U. •...
  • Page 72: To Use The Action Keys

    Chapter 2: Entering Debugger Commands Using Menus, the Entry Buffer, and Action Keys 2 If necessary, reposition the keyboard cursor to the location where you want to paste the text. 3 If necessary, choose the insert or replace mode for the command entry area. 4 Click the middle mouse button to paste the text into the command line entry area at the current cursor position.
  • Page 73: To Use Dialog Boxes

    Chapter 2: Entering Debugger Commands Using Menus, the Entry Buffer, and Action Keys run, and step through the demo program. You’ll really appreciate action keys when you define and use your own. Action keys are defined by setting an X resource. Refer to the chapter “Setting X Resources”...
  • Page 74 Chapter 2: Entering Debugger Commands Using Menus, the Entry Buffer, and Action Keys • Dialog boxes can be moved around the screen and do not have to be positioned over the graphical interface window. • If you iconify the interface window, all dialog boxes are iconified along with the main window.
  • Page 75 Chapter 2: Entering Debugger Commands Using Menus, the Entry Buffer, and Action Keys Examples To use the File Selection dialog box: The file filter selects specific files. A list of filter-matching files. A list of files previously accessed during the debugger session.
  • Page 76 Chapter 2: Entering Debugger Commands Using Menus, the Entry Buffer, and Action Keys To use the Directory Selection dialog box: Label informs you of the type of list displayed. A single click on a directory name from the list highlights the name and copies it to the text area.
  • Page 77: To Access Help Information

    Chapter 2: Entering Debugger Commands Using Menus, the Entry Buffer, and Action Keys To access help information 1 Display the Help Index by choosing Help→General Topic ... or Help→Command Line ..2 Choose a topic of interest from the Help Index. The Help Index lists topics covering operation of the interface as well other information about the interface.
  • Page 78: Using The Command Line With The Mouse

    Chapter 2: Entering Debugger Commands Using the Command Line with the Mouse Using the Command Line with the Mouse When using the graphical interface, the command line portion of the interface gives you the option of entering commands in the same manner as they are entered in the standard interface.
  • Page 79: To Turn The Command Line On Or Off

    Chapter 2: Entering Debugger Commands Using the Command Line with the Mouse To turn the command line on or off • To turn the command line on or off using the pull-down menu, choose Settings→Command Line. • To turn the command line on or off using the status line pop-up menu: position the mouse pointer within the status line area, press and hold the right mouse button, and choose Command Line On/Off from the menu.
  • Page 80: To Enter A Command

    Chapter 2: Entering Debugger Commands Using the Command Line with the Mouse To enter a command 1 Build a command using the command token pushbuttons by successively positioning the mouse pointer on a pushbutton and clicking the left mouse button until a complete command is formed. 2 Execute the completed command by clicking the Return pushbutton (found near the bottom of the command line in the “Command”...
  • Page 81: To Edit The Command Line Using The Command Line Pushbuttons

    Chapter 2: Entering Debugger Commands Using the Command Line with the Mouse To edit the command line using the command line pushbuttons • To clear the command line, click the Clear pushbutton. • To clear the command line from the cursor position to the end of the line, click the Clear to end pushbutton.
  • Page 82: To Edit The Command Line Using The Command Line Pop-Up Menu

    Chapter 2: Entering Debugger Commands Using the Command Line with the Mouse To edit the command line using the command line pop-up menu • To clear the command line: position the mouse pointer within the Command Line entry area; press and hold the right mouse button until the Command Line pop-up menu appears;...
  • Page 83: To Get Help About The Command Line

    Chapter 2: Entering Debugger Commands Using the Command Line with the Mouse contents of the Command Recall dialog box is not restricted to commands entered directly into the command line entry area. The Command Recall dialog box contains a list of interface commands executed during the debugger session as well as any predefined commands present at interface startup.
  • Page 84: Using The Command Line With The Keyboard

    Chapter 2: Entering Debugger Commands Using the Command Line with the Keyboard Using the Command Line with the Keyboard Commands are entered on the command line at the debugger prompt (> ) and executed by pressing the < Return> key. Command tokens are entered by typing a single letter, typically the first uppercase letter of the token.
  • Page 85 Chapter 2: Entering Debugger Commands Using the Command Line with the Keyboard To enter a command keyword, type the first letter of the keyword. For example, to enter the command Debugger L evel Assembly, type the letters D, L, and A. The following command will appear on the command line: Debugger Level Assembly Press <...
  • Page 86: To Edit The Command Line

    Chapter 2: Entering Debugger Commands Using the Command Line with the Keyboard To edit the command line • To clear the command line, press < Ctrl> U. • To clear the command line from the cursor position to the end of the line, press <...
  • Page 87: To Display The Help Window

    Chapter 2: Entering Debugger Commands Using the Command Line with the Keyboard list. Finally, you cannot predefine entries for the recall list — the list only contains the most recent commands executed during the debugger session. To display the help window •...
  • Page 88 Chapter 2: Entering Debugger Commands Using the Command Line with the Keyboard Press the F5 function key one time or press the escape (< Esc> ) key twice to exit the help window. (Note that you cannot exit the graphical interface help window this way.)
  • Page 89: Viewing Debugger Status

    Chapter 2: Entering Debugger Commands Viewing Debugger Status Viewing Debugger Status The status line shows you what the debugger is doing. The status line: • Contains information about the operation being performed by the debugger. • Contains indicators to warn you about special conditions. •...
  • Page 90: Indicator Characters

    Chapter 2: Entering Debugger Commands Viewing Debugger Status Reading The debugger is reading an executable file or a C source file into the debugger’s memory. Working The debugger is executing internal debugger operations. Indicator Characters The Warning indicator (W) indicates that the program counter is not on a C source line boundary.
  • Page 91: To Display Information About The Debugger Version

    Chapter 2: Entering Debugger Commands Viewing Debugger Status To display information about the debugger version • Select Help→General Topic ...→Interface Revision Information. Information about how this version of the debugger differs from previous versions is now included in the on-line help. This includes the information which was previously printed in the Operating Notice or the "Versions"...
  • Page 92: Solving Problems With The Interface

    Chapter 2: Entering Debugger Commands Solving problems with the interface Solving problems with the interface If pop-up menus don’t pop up When you hold the right mouse button down, a pop-up menu does not appear. Here are some things to check: Check that the mouse pointer is hand-shaped.
  • Page 93: Loading And Executing Programs

    Loading and Executing Programs How to load a program into the debugger and control its execution.
  • Page 94: Compiling Programs For The Debugger

    Compiling Programs for the Debugger Writing programs for simulation Several microprocessor features work differently in the simulator: • Some instructions and exception conditions cause the microprocessor to read or write data to CPU space. CPU space references are intended for communication with external hardware (such as a floating point coprocessor or security-checking device).
  • Page 95: Using A Hewlett-Packard C Cross Compiler

    Note Do not use the –h option when compiling and linking your program for the debugger. The –h option causes the compiler to generate HP 64000 file formats. Use the default settings which generate executable files in the HP-MRI IEEE-695 file format required by the debugger. The debugger extracts all symbolic information from the executable (.x) file.
  • Page 96 Chapter 3: Loading and Executing Programs Compiling Programs for the Debugger The "Environment Dependent Routines" chapter of the Motorola 68000 Family C Cross Compiler User’s Guide describes the environment dependent routines supplied with the compiler. Using Optimizing Modes If you use the optimizing modes (–O or –OT), function calls that do not have automatic variables may not have stack frames.
  • Page 97: Using Microtec Language Tools

    Family C Cross Compiler User’s Guide describes the environment dependent routines supplied with the compiler. Using Microtec Language Tools The debugger is designed to work with the HP Advanced Cross Language System. However, you can also use the Microtec Research, Inc. language tools with the debugger.
  • Page 98 Use the command line flag "-fd’ with asm68k to generate local symbols. The HP assembler places global symbols in the debug part by default. There is no way to do this with Microtec’s asm68k. This information is needed to correctly scope symbols.
  • Page 99 Chapter 3: Loading and Executing Programs Compiling Programs for the Debugger The Microtec MCC68K Compiler mcc68k is very different from the HP compilers. Study the Microtec documentation if you need specific information about mcc68k.
  • Page 100: Loading Programs And Symbols

    Chapter 3: Loading and Executing Programs Loading Programs and Symbols Loading Programs and Symbols This section shows you how to: • Specify the location of C source files. • Load programs. • Load programs only (without symbols). • Load symbols only (without the program). •...
  • Page 101: To Load Programs

    Chapter 3: Loading and Executing Programs Loading Programs and Symbols their location at compile time (this information is recorded in the absolute file) the current directory (if the required source files are not found in their compile location) Example The shell variable definition: HP64_DEBUG_PATH=/users/proj/src:/users/proj/mysrc export HP64_DEBUG_PATH causes the debugger to search paths for C source files in the following order:...
  • Page 102: To Load Program Code Only

    Chapter 3: Loading and Executing Programs Loading Programs and Symbols When you load an absolute file using these commands, the debugger: Removes all previous program symbols. Removes all previously set breakpoints. Resets the program counter (PC). Loads the full symbol set. Loads the new executable module.
  • Page 103: To Load Symbols Only

    Chapter 3: Loading and Executing Programs Loading Programs and Symbols Enter the name of the absolute file whose code is to be loaded, and press the < Return> key. The code image will be loaded without loading symbols or resetting the PC. If you are re-loading a program, you may need to re-specify variables for the Monitor window.
  • Page 104: To Load Additional Programs

    Chapter 3: Loading and Executing Programs Loading Programs and Symbols To load additional programs • Using the command line, enter: Program Load Append Select either All, Code_Only, or Symbols_Only. Then, select either Pc_Set or No_Pc_Set. Finally, enter the name of the absolute file to be appended, and press the <...
  • Page 105: To Turn Demand Loading Of Symbols On Or Off

    Chapter 3: Loading and Executing Programs Loading Programs and Symbols To turn demand loading of symbols on or off • Select Settings→Debugger Options and set the Demand Loading option. With demand loading, some symbol information is loaded on an as-needed, demand basis rather than during the initial load of the .x file.
  • Page 106: Stepping Through And Running Programs

    Chapter 3: Loading and Executing Programs Stepping Through and Running Programs Stepping Through and Running Programs The various Program Run command options can be combined to make complex run-time control commands for your program. This section shows you how to: •...
  • Page 107: To Step Over Functions

    You can also use function key F7 to single-step. If the debugger steps into an HP library routine, run until the stack level above the level of the library routine. Use the Program Run Until command or the Backtrace window pop-up menu.
  • Page 108: To Run From The Current Program Counter (Pc) Address

    Chapter 3: Loading and Executing Programs Stepping Through and Running Programs To run from the current program counter (PC) address • Click on the Run action key. • Select Execution→Run→from PC. • Using the command line, enter: Program Run And press the < Return> key. The program runs until: •...
  • Page 109: To Run Until A Stop (Break) Address

    Chapter 3: Loading and Executing Programs Stepping Through and Running Programs • Using the command line, enter: Program Run From <start_addr> Type in the start address, and press the < Return> key. The program runs until: • The program encounters a permanent or temporary breakpoint. •...
  • Page 110: To Count Simulated Clock Cycles

    Chapter 3: Loading and Executing Programs Stepping Through and Running Programs count of three will cause the program to break on the fourth execution of the break address. Multiple break addresses are OR’ed. In other words, if you specify more than one break address, the program runs until either address is encountered.
  • Page 111: To Add Simulated Wait States

    Chapter 3: Loading and Executing Programs Stepping Through and Running Programs You can use the @cycles pseudoregister in expressions and macros. Keep in mind, however, that @cycles exists only in the simulator. Macros which will be used with a debugger/emulator must not refer to @cycles. To add simulated wait states •...
  • Page 112: Using Breakpoints

    Chapter 3: Loading and Executing Programs Using Breakpoints Using Breakpoints The debugger implements breakpoints using shadow bits. The number of access breakpoints available to the debugger/simulator is unlimited. This section shows you how to: • Set a memory access breakpoint (read, write, or either). •...
  • Page 113: To Set An Instruction Breakpoint

    Chapter 3: Loading and Executing Programs Using Breakpoints Access breakpoints cause the debugger to halt program execution each time the target program reads from or writes to the specified memory location(s). Memory locations can contain code or data. Examples To cause execution to halt each time the program reads from or writes to the variable current_temp: Breakpt Access &current_temp To cause execution to halt each time the program reads from the variable...
  • Page 114: To Set A Breakpoint For A C+ + Object Instance

    Chapter 3: Loading and Executing Programs Using Breakpoints Enter the address of the instruction location, and press the < Return> key. The instruction breakpoint causes the debugger to halt program execution each time the target program attempts to execute an instruction at the specified memory location(s).
  • Page 115: To Set A Breakpoint For Overloaded C+ + Functions

    Chapter 3: Loading and Executing Programs Using Breakpoints To do this the hard way, you could enter: Breakpoint Instr C::cfunc\@entry;when (C::cfunc\this== &cobj1) To set a breakpoint for overloaded C+ + functions • To set a breakpoint at one of the functions when you know the argument type, supply the argument type following the function name.
  • Page 116: To Clear Selected Breakpoints

    Chapter 3: Loading and Executing Programs Using Breakpoints Breakpoint Instr classname:: To clear selected breakpoints • Position the mouse pointer in the Code window over the line at which you wish to clear a breakpoint. Click the right mouse button. •...
  • Page 117: To Clear All Breakpoints

    Chapter 3: Loading and Executing Programs Using Breakpoints (< brkpt_nmbr> ..< brkpt_nmbr> ) to remove more than one breakpoint at a time. When you delete a breakpoint, all following breakpoints are renumbered. • Using the command line, enter: Breakpt Erase <address> where <...
  • Page 118: To Display Breakpoint Information

    Chapter 3: Loading and Executing Programs Using Breakpoints To display breakpoint information • Select Window→Breakpoints. • Using the command line, enter: Window Active Breakpoint And press the < Return> key. The debugger displays the breakpoint window when: • You enter a breakpoint command. •...
  • Page 119 Chapter 3: Loading and Executing Programs Using Breakpoints Breakpoint address The breakpoint address (ADDRESS) shows the memory location of the breakpoint. The debugger displays the address as a hexadecimal value. Module/function The module/function field (MOD/FNCT) displays either the name of the module containing the breakpoint or the name of a function if you qualified the breakpoint with a function name.
  • Page 120 Chapter 3: Loading and Executing Programs Using Breakpoints addresses, symbol names, and macro names all appear in this field. For more information about breakpoints, see the specific breakpoint command descriptions in the “Debugger Commands” chapter.
  • Page 121: To Halt Program Execution On Return To A Stack Level

    Chapter 3: Loading and Executing Programs Using Breakpoints To halt program execution on return to a stack level • Select Run Until Stack Level from the Backtrace window pop-up menu. 1 Set a stack level breakpoint. 2 Run the program. 3 If desired, delete the breakpoint that was just encountered.
  • Page 122: Using Simulated Interrupts

    Chapter 3: Loading and Executing Programs Using Simulated Interrupts Using Simulated Interrupts The debugger can simulate program interrupts to your target program. The debugger lets you specify a delay between interrupts in terms of a clock cycle count. The pseudoregister @cycles maintains the current clock cycle count. Caution The pseudoregister @cycles is not implemented in the emulation environment.
  • Page 123: To Remove Simulated Interrupts

    Chapter 3: Loading and Executing Programs Using Simulated Interrupts To remove simulated interrupts • Using the command line, enter: Program Interrupt Remove Enter the level number of the interrupts to be removed, and press the < Return> key. The Program Interrupt Remove command cancels any pending interrupts. Examples To remove all level 7 interrupts: Program Interrupt Remove 7...
  • Page 124: Restarting Programs

    Chapter 3: Loading and Executing Programs Restarting Programs Restarting Programs This section shows you how to: • Reset the processor. • Reset the program counter to the starting address. • Reset program variables. To reset the processor • Select Execution→Reset to Monitor. •...
  • Page 125: To Reset Program Variables

    Chapter 3: Loading and Executing Programs Restarting Programs • Using the command line, enter: Program Pc_Reset And press the < Return> key. The program counter is reset to the transfer address of your absolute file. The next Program Run or Program Step command entered without a from address will restart program execution at the beginning of the program.
  • Page 126: Saving And Loading The Cpu State

    Chapter 3: Loading and Executing Programs Saving and Loading the CPU State Saving and Loading the CPU State State files are used to save the current CPU state (memory image, register values, and program symbols) of a debug session. Though state files can only be created from within a debugger/simulator session, you can use them to restore a CPU state in either a debugger/simulator or debugger/emulator session.
  • Page 127: Mapping Memory

    Chapter 3: Loading and Executing Programs Mapping Memory Mapping Memory This section shows you how to: • Prevent access to memory locations. • Prevent writing to memory locations. • Allow access to memory locations. • Display current memory map assignments. To prevent access to memory locations •...
  • Page 128: To Allow Access To Memory Locations

    Chapter 3: Loading and Executing Programs Mapping Memory Enter the range of addresses that should not be written to, and press the < Return> key. Examples To configure memory address range 8000h through 8fffh as read-only (ROM) memory: Memory Map Read_Only 8000h..8fffh To allow access to memory locations •...
  • Page 129 Chapter 3: Loading and Executing Programs Mapping Memory Memory Map Show > Memory Map Show TYPE OWNER ADDRESS COMMAND LINE SIMU 00000000..0000002F Load section SIMU 000000BC..000000BF Load section SIMU 00000100..0000010B Load section SIMU 00000400..00001044 Load section env SIMU 00001048..00002851 Load section prog SIMU 00002854..0000906B Multiple load sections...
  • Page 130: Accessing Input Ports

    Chapter 3: Loading and Executing Programs Accessing Input Ports Accessing Input Ports This section shows you how to: • Set or alter input port status. • Delete an input port. • Rewind the input file associated with an input port. •...
  • Page 131: To Delete An Input Port

    Chapter 3: Loading and Executing Programs Accessing Input Ports To delete an input port • Using the command line, enter: Memory Inport Delete Enter the address of the input port to be disabled, and press the < Return> key. The specified input port address is disabled, allowing the address to behave like a normal memory location.
  • Page 132: To Display Input Port Buffer Values

    Chapter 3: Loading and Executing Programs Accessing Input Ports To display input port buffer values • Using the command line, enter: Memory Inport Show Enter the address or address range of the input ports whose buffer values are to be displayed, and press the < Return> key. Each input port has a single value buffer associated with it.
  • Page 133: Accessing Output Ports

    Chapter 3: Loading and Executing Programs Accessing Output Ports Accessing Output Ports This section shows you how to: • Set or alter output port status. • Delete an output port. • Rewind the output file associated with an output port. •...
  • Page 134: To Delete An Output Port

    Chapter 3: Loading and Executing Programs Accessing Output Ports Write operations to the port will access the stdio window. To delete an output port • Using the command line, enter: Memory Outport Delete Enter the address of the output port to be disabled, and press the < Return> key.
  • Page 135: To Display Output Port Buffer Values

    Chapter 3: Loading and Executing Programs Accessing Output Ports To display output port buffer values • Using the command line, enter: Memory Outport Show Enter the address or address range of the output ports whose buffer values are to be displayed, and press the < Return> key. Each output port has a one value buffer associated with it that contains the last value written to the port.
  • Page 136: Accessing The Unix Operating System

    Chapter 3: Loading and Executing Programs Accessing the UNIX Operating System Accessing the UNIX Operating System This section shows you how to: • Fork a UNIX shell. • Execute a UNIX command. To fork a UNIX shell • Select File→Term. A terminal emulation window will be created.
  • Page 137: To Execute A Unix Command

    Chapter 3: Loading and Executing Programs Accessing the UNIX Operating System To execute a UNIX command • Using the command line, enter: Debugger Host_Shell Type in the UNIX command, and press the < Return> key. When using the graphical interface, a terminal emulation window will be opened and the UNIX command will be executed in that window (as specified by the “shellCommand”...
  • Page 138: Using Simulator And Emulator Debugger Products Together

    Chapter 3: Loading and Executing Programs Using simulator and emulator debugger products together Using simulator and emulator debugger products together You can continue a debugging session started in the debugger/simulator in the debugger/emulator by following the steps listed below: 1 In the debugger/simulator, use the Debugger Execution Save_State command to save the current memory contents and register values.
  • Page 139: Using The Debugger With The Branch Validator

    The BBA preprocessor (-b option) must be used at compile time in order for this information to exist in program memory. Once this information has been unloaded, it can be formatted with the BBA report generator, bbarep (see the HP Branch Validator for AxL S C User’s Guide).
  • Page 140 Chapter 3: Loading and Executing Programs Using the Debugger with the Branch Validator...
  • Page 141: Viewing Code And Data

    Chapter 4: Viewing Code and Data Viewing Code and Data How to find and display source code and memory contents.
  • Page 142: Using Symbols

    Chapter 4: Viewing Code and Data Using Symbols Using Symbols This section shows you how to: • Add a symbol to the symbol table. • Display symbols. • Delete a symbol from the symbol table. To add a symbol to the symbol table •...
  • Page 143: To Display Symbols

    Chapter 4: Viewing Code and Data Using Symbols To display symbols • Select Display→Symbol () to display information about the symbol in the entry buffer. • Using the command line, enter: Symbol Display Default Enter the symbol, module, or function name; then, press the < Return> key. Symbols and associated information are displayed in the journal window.
  • Page 144: To Display Symbols In All Modules

    Chapter 4: Viewing Code and Data Using Symbols Address = 00001436 thru 00001513 update_system\refresh : Type is Local int. Address = Frame + 8 update_system\interval_complete : Type is Local int. Address = Frame + 12 To display symbols in all modules •...
  • Page 145 Chapter 4: Viewing Code and Data Using Symbols To delete all symbols in module "update_sys": Symbol Remove update_sys\ To delete all symbols in all modules: Symbol Remove \...
  • Page 146: Displaying Screens

    Chapter 4: Viewing Code and Data Displaying Screens Displaying Screens A debugger screen is what you see in the display area. Each debugger screen may contain one or more debugger windows. A debugger window is a predefined physical area on the screen containing specific debugger information.
  • Page 147 Chapter 4: Viewing Code and Data Displaying Screens • view The high-level screen displays high-level source code and stack backtrace information including the calling sequence of functions and function nesting levels. Assembly-Level Screen The debugger automatically displays the assembly-level screen when an executable (.x) file is loaded from within the debugger or the executable file does not contain the C source function main().
  • Page 148: To Display The High-Level Screen

    Chapter 4: Viewing Code and Data Displaying Screens To display the high-level screen • Select Settings→High Level Debug. • Using the command line, enter: Window Screen_On High_Level To display the assembly level screen • Select Settings→Assembly Level Debug. • Using the command line, enter: Window Screen_On Assembly_Level To switch between the high-level and assembly screens...
  • Page 149: To Display The Standard I/O Screen

    Chapter 4: Viewing Code and Data Displaying Screens • Using the command line, enter: Debugger Level You can also use the Window New and the Window Active commands to display a different screen. To display the standard I/O screen • Press the F6 function key. •...
  • Page 150 Chapter 4: Viewing Code and Data Displaying Screens • Using the command line, enter: Window Screen_On Next The next higher-numbered screen will be displayed. Either the high-level or the assembly-level screen will be displayed, not both. The debugger screens are numbered as follows: Screen Name Screen Number High-level screen...
  • Page 151: Displaying Windows

    Chapter 4: Viewing Code and Data Displaying Windows Displaying Windows This section shows you how to: • Change the active window. • Select the alternate view of a window. • Set the cursor position for a window. A debugger window is a predefined physical area on the screen. The debugger has 18 predefined windows.
  • Page 152 Chapter 4: Viewing Code and Data Displaying Windows Window Name Window Screen Number Number journal (high–level) code (high–level) monitor (high–level) backtrace status (high–level) journal (assembly–level) code (assembly–level) monitor (assembly–level) register (assembly–level) stack status (assembly–level) standard I/O view 1, 2, 3 breakpoint 1, 2, 3 error...
  • Page 153: To Change The Active Window

    Chapter 4: Viewing Code and Data Displaying Windows To change the active window • Use the command select mouse button to click on the border of the window you wish to activate. • Select the window you want to make active from the Window→ menu. •...
  • Page 154: To Select The Alternate View Of A Window

    Chapter 4: Viewing Code and Data Displaying Windows To make user window 57 active: Window Active User_Window 57 To select the alternate view of a window • Click on the border of the active window with the command select mouse button.
  • Page 155: To View Information In The Active Window

    Chapter 4: Viewing Code and Data Displaying Windows To view information in the active window • Use the scroll bar. • Use the cursor control keys. Press the < Up> or < Down> cursor key to move up or down in the window one line at a time.
  • Page 156: To View Information In The "More" Lists Mode

    Chapter 4: Viewing Code and Data Displaying Windows Description → Move to right in data field of command. Highlight token to the right in status line window. ← Move to left in data field of command. Highlight token to the left in status line window. ↑...
  • Page 157: To Copy Window Contents To A File

    Chapter 4: Viewing Code and Data Displaying Windows • Press the space bar to display the next screen of information. • Press the < Return> key to display the next line. • Press "Q" to end the "More" display. If you try to enter a command while the debugger is displaying the "--More--" prompt, the command will not be executed until the "More"...
  • Page 158: To View Commands In A Separate Window

    Chapter 4: Viewing Code and Data Displaying Windows To view commands in a separate window • Select Window→Journal Browser→Start. Journal output—the commands and miscellaneous information usually displayed in the Journal window—will be displayed in a separate browser window. You may start several nested browser windows. Use End to end output to the current browser window without closing the window.
  • Page 159: Displaying C Source Code

    Chapter 4: Viewing Code and Data Displaying C Source Code Displaying C Source Code This section shows you how to: • Display the C source code. • Find first occurrence of a string. • Find next occurrence of a string. To display C source code 1 Display the high-level screen (see the instructions in the previous “Displaying Screens”...
  • Page 160: To Find First Occurrence Of A String

    Chapter 4: Viewing Code and Data Displaying C Source Code Program Display_Source cfunc (float) To find first occurrence of a string 1 Display the high-level screen (see the instructions in the previous “Displaying Screens” section). 2 Enter the string in the entry buffer. 3 Select Display→Source Find Fwd () or Display→Source Find Back ().
  • Page 161 Chapter 4: Viewing Code and Data Displaying C Source Code Select either Forward or Backward as the direction, and press the < Return> key. Example To find the next occurrence of a string: Program Find_Source Next Forward...
  • Page 162: Displaying Disassembled Assembly Code

    Chapter 4: Viewing Code and Data Displaying Disassembled Assembly Code Displaying Disassembled Assembly Code To display assembly code • Select Settings→Assembly Level Debug. • Using the command line, enter: Window Screen_On Assembly_Level The Code window will show disassembled insructions.
  • Page 163: Displaying Program Context

    Chapter 4: Viewing Code and Data Displaying Program Context Displaying Program Context This section shows you how to: • Set current module and function scope. • Display current module and function. • Display debugger status. • Display register contents. • List all debugger registers.
  • Page 164: To Display Current Module And Function

    Chapter 4: Viewing Code and Data Displaying Program Context Examples To select module “update_sys” as the current module: Program Context Set update_sys To select function “update_sys\graph_data” as the current function: Program Context Set update_sys\graph_data To set the program context to the module at which the program counter is pointing: Program Context Set To display current module and function...
  • Page 165: To Display Register Contents

    Chapter 4: Viewing Code and Data Displaying Program Context • Using the command line, enter: Debugger Execution Display_Status The following information is displayed in the view window (which temporarily overlays the top portion of the screen): • Product version. • Current working directory.
  • Page 166 Chapter 4: Viewing Code and Data Displaying Program Context The information displayed in the register window varies with different microprocessors. See the “Registers” chapter and page 143 for information about the registers and pseudoregisters which you can display using expression commands.
  • Page 167: To List All Registers

    Chapter 4: Viewing Code and Data Displaying Program Context 68020 TTSM.III...XNZ VC Status Register: USP, ISP, MSP (only two shown at a time) Stack Pointers: SFC, DFC, VBR, CACR, CAAR Control Registers: Access Status: 6833x, 68340, 68360 TTS..III...XNZ VC Status Register: USP, SSP (only one shown) Stack Pointers: SFC, DFC, VBR...
  • Page 168: To Display The Function Calling Chain (Stack Backtrace)

    Chapter 4: Viewing Code and Data Displaying Program Context This command is useful if you want to know what registers are supported by the debugger, or if you need to find the sizes of various registers. See Also Many of the registers are described in the “Registers” chapter. To display the function calling chain (stack backtrace) •...
  • Page 169 Chapter 4: Viewing Code and Data Displaying Program Context Another way to execute until a stack level is reached is to choose Run Until Stack Level in the Backtrace window pop-up menu. Return Address. The return address field displays the return address of the calling function.
  • Page 170 Chapter 4: Viewing Code and Data Displaying Program Context generates backtrace information as described in the following paragraphs. The backtrace window is displayed only in the high-level screen. Nesting level 0. Nesting level 0 information is based solely on the current value of the processor’s program counter (PC).
  • Page 171: To Display All Local Variables Of A Function At The Specified Stack (Backtrace) Level

    Chapter 4: Viewing Code and Data Displaying Program Context appear in the backtrace window at any stack level other than levels 0 or 1. Assembly language Assembly language functions that set up stack frames functions. appear in the backtrace window, but the information shown is incomplete.
  • Page 172: To Display The Address Of The C+ + Object Invoking A Member Function

    Chapter 4: Viewing Code and Data Displaying Program Context To display the address of the C+ + object invoking a member function • Display the value of the function’s this pointer. If the program has stopped at a function, you can find out the address of the object which invoked the function.
  • Page 173: Using Expressions

    Chapter 4: Viewing Code and Data Using Expressions Using Expressions This section shows you how to: • Calculate the value of a C expression. • Display the value of an expression or variable. • Monitor variables. • Discontinue monitoring specified variables. •...
  • Page 174: To Display The Value Of An Expression Or Variable

    Chapter 4: Viewing Code and Data Using Expressions Expression C_Expression old_data Result is: data address 000091DC {old_data} To calculate the value of member ’temp’ of the first element of the old_data array of structures: Expression C_Expression old_data[0].temp Result is: To assign the value 1 to ’num_checks’: Expression C_Expression num_checks = 1 Result is: 1 0x01...
  • Page 175: To Display Members Of A Structure

    Chapter 4: Viewing Code and Data Using Expressions To display the address of the variable ’num_checks’: Expression Display_Value &num_checks 000091F0 To display the name of the current program module: Expression Display_Value @module To display the name of the current program function: Expression Display_Value @function To display members of a structure 1 Copy the name of the structure into the entry buffer.
  • Page 176: To Display The Members Of A C+ + Class

    Chapter 4: Viewing Code and Data Using Expressions To display the members of a C+ + class • Using the command line, enter Symbol Display Options Search_all End_Options < class_name >\ This will display the type, size, protection, and overloading of each member of class_name.
  • Page 177: To Monitor Variables

    Chapter 4: Viewing Code and Data Using Expressions To monitor variables • Enter the variable to be monitored in the entry buffer and click on the Monitor () action key. • Enter the variable to be monitored in the entry buffer and select Display→Monitor ().
  • Page 178: To Monitor The Value Of A Register

    Chapter 4: Viewing Code and Data Using Expressions To monitor the value of a register • Monitor a register just as you would a variable. Example To monitor the value of register D2, enter "@D2" in the entry buffer and select Display→Monitor ().
  • Page 179: To Discontinue Monitoring All Variables

    Chapter 4: Viewing Code and Data Using Expressions To discontinue monitoring all variables • Select Delete All Variables in the Monitor window pop-up menu. • Using the command line, enter: Expression Monitor Clear_All All variables are removed from the monitor window. To display C+ + inheritance relationships •...
  • Page 180: To Print Formatted Output To A Window

    Chapter 4: Viewing Code and Data Using Expressions To print formatted output to a window • Using the command line, enter: Expression Fprintf Enter the number of the user-defined window, the format string (enclosed in quotes), and the arguments; then, press the < Return> key. The formatted output is written to the user-defined window.
  • Page 181 Chapter 4: Viewing Code and Data Using Expressions Enter the format string (enclosed in quotes) and the arguments; then, press the < Return> key. The formatted output is written to the journal window. This command is similar to the C printf function. Examples To print the value of var to the journal window as a single character: Expression Printf "%c",var...
  • Page 182: Viewing Memory Contents

    Chapter 4: Viewing Code and Data Viewing Memory Contents Viewing Memory Contents This sections explains how to to view, compare, and search blocks of memory. To compare two blocks of memory • Using the command line, enter: Memory Block_Operation Match <Mismatch_Operation> Select either Repeat_On_Mismatch or Stop_On_Mismatch to specify what happens when a mismatch is found, enter the address range to be compared and the starting address of the range that it is compared to;...
  • Page 183: To Examine A Memory Area For Invalid Values

    Chapter 4: Viewing Code and Data Viewing Memory Contents address range and the value that is to be searched for, and press the < Return> key. Example To search for the expression ’gh’ in the memory range from address 1000h through address 10ffh and stop when the expression is found or address 10ffh is reached: Memory Block_Operation Search Word Once...
  • Page 184: To Display Memory Contents

    Chapter 4: Viewing Code and Data Viewing Memory Contents To display memory contents • Place a memory start location in the entry buffer and then select Display→Memory→< Format> . • Using the command line, enter: Memory Display <Format> Select either Mnemonic (()), Byte (()), Word (()), or Long (()) as the format in which memory contents are to be displayed.
  • Page 185: Using Simulated I/O

    Dependent Routines" chapter of your compiler manual for information on using the C SIMIO libraries. If you are using the Microtec Research, Inc., C compiler (HP B3640), your programs can use SIMIO by means of the C routines supplied to you with the debugger software.
  • Page 186: How Simulated I/O Works

    Chapter 4: Viewing Code and Data Using Simulated I/O How Simulated I/O Works Communication between your program running in the simulated system and the SIMIO process takes place through contiguous single-byte length memory locations. The first memory location is called the Control Address (CA). The Control Address and the memory locations that follow it are called the CA buffer.
  • Page 187 Chapter 4: Viewing Code and Data Using Simulated I/O Display and Keyboard The debugger provides a window named stdio which functions as the normal display output for target programs. The screen can be opened for output from target programs via SIMIO with the special name /dev/simio/display. This name appears to be an UNIX file name.
  • Page 188: Special Simulated I/O Symbols

    Chapter 4: Viewing Code and Data Using Simulated I/O Special Simulated I/O Symbols User Program Symbols The following symbols are user program symbols that are used by the SIMIO system to process the simulated I/O protocol: systemio_buf This symbol indicates the start of the Control Address buffer. Simulated I/O Reserved Symbols The following names are reserved by the SIMIO system and cannot be used for your file names.
  • Page 189: To Disable Simulated I/O

    Chapter 4: Viewing Code and Data Using Simulated I/O When SIMIO is enabled, polling for simio command begins. In the debugger/simulator, the debugger detects writes to the SIMIO control address. SIMIO behavior in the debugger is identical to that described in the Simulated I/O User’s Guide.
  • Page 190: To Set The Keyboard I/O Mode To Raw

    Chapter 4: Viewing Code and Data Using Simulated I/O To set the keyboard I/O mode to raw • Using the command line, enter: Debugger Execution IO_System Mode Raw In the Raw mode, each character you type is sent directly to the target program that is reading from the keyboard.
  • Page 191: To Interpret Keyboard Reads As Eof

    Chapter 4: Viewing Code and Data Using Simulated I/O To interpret keyboard reads as EOF • Using the command line, enter: Debugger Execution IO_System Keyboard_EOF This causes the debugger to interpret any further keyboard reads as being at the end of file. In cooked mode, pressing <...
  • Page 192 Chapter 4: Viewing Code and Data Using Simulated I/O • stderr The debugger uses an internal table to determine where the streams should be opened. Each of the names (stdin, stdout, and stderr) has an associated translation name: • stdin_name •...
  • Page 193: To Check Resource Usage

    Chapter 4: Viewing Code and Data Using Simulated I/O To check resource usage • Using the command line, enter: Debugger Execution IO_System Report The command displays the simulated I/O status, keyboard mode, and the translation names used for stdin, stdout, and stderr. The SIMIO system has the following default resource limitations: •...
  • Page 194 Chapter 4: Viewing Code and Data Using Simulated I/O Caution Compiler startup files compiled with the modified stdio.h header file will run only in the debugger environment. Emulators which do not have the debugger interface do not support the increased number of open SIMIO file descriptors. Calls to the SIMIO function open() will fail in this environment if 12 file descriptors have already been allocated.
  • Page 195: Editing Code And Data

    Chapter 5: Editing Code and Data Editing Code and Data How to use the debugger to make permanent or temporary changes to source code, memory contents, and registers.
  • Page 196: Editing Files

    Chapter 5: Editing Code and Data Editing Files Editing Files The graphical interface gives you a number of context-dependent and context-independent editing commands. From several screens, you can bring up the source file that contains the source line or symbol you are viewing in the display.
  • Page 197: To Edit An Arbitrary File

    Chapter 5: Editing Code and Data Editing Files To edit an arbitrary file 1 Select File→Edit→File. 2 Using the file selection dialog box, enter the name of the file you wish to edit; then, click on the OK pushbutton. After editing the file, you quit the edit session by the standard method for the editor used.
  • Page 198: Patching Source Code

    Chapter 5: Editing Code and Data Patching Source Code Patching Source Code When you change source code by editing the C source file, you need to re-compile. The debugger provides several ways to patch your program without re-compiling: • Change a variable’s value using a C expression. •...
  • Page 199: To Patch A Line Of Code Using A Macro

    Chapter 5: Editing Code and Data Patching Source Code To patch a line of code using a macro 1 Set a breakpoint at the line you wish to patch. An easy way to set the breakpoint is to click the right mouse button on the line in the Code window.
  • Page 200: To Patch C Source Code By Inserting Lines

    Chapter 5: Editing Code and Data Patching Source Code To patch C source code by inserting lines 1 Define a macro containing the inserted statements. The macro must provide a return value of 1 (true) in order for the program to continue after the macro is executed.
  • Page 201 Chapter 5: Editing Code and Data Patching Source Code count = 5; for (i=0; i < MAXNUM; i++) array[i]=1; count=count+2; k=count*i; To delete lines 29 and 30, and insert a new line incrementing count by one, you could write the following macro: Debugger Macro Add patch_29() count++;...
  • Page 202: Editing Memory Contents

    Chapter 5: Editing Code and Data Editing Memory Contents Editing Memory Contents This section shows you how to: • Change memory location values. • Copy a block of memory. • Fill a block of memory with values. • Compare two blocks of memory. •...
  • Page 203: To Copy A Block Of Memory

    Chapter 5: Editing Code and Data Editing Memory Contents Memory Assign <Size> 2 Using the command line, select either Byte, Word, or Long as the size of the memory location, enter the address of the beginning of the block, and press the <...
  • Page 204: To Fill A Block Of Memory With Values

    Chapter 5: Editing Code and Data Editing Memory Contents To fill a block of memory with values • Using the command line, enter: Memory Block_Operation Fill <Size> Select either Byte, Word, or Long as the size of the memory locations, enter the expression that assigns a value to locations in a range of addresses, and press the <...
  • Page 205: To Re-Initialize All Program Variables

    Chapter 5: Editing Code and Data Editing Memory Contents To re-initialize all program variables • Select File→Load→Program Only ..., then use the File Selection dialog box to select the absolute file. • Using the command line, enter: Program Load New Code_only No_Pc_Set <absolute_name> Enter the name of the absolute file whose code is to be loaded, and press the <...
  • Page 206 Chapter 5: Editing Code and Data Editing Memory Contents Example To modify register values interactively: Memory Register The program counter PC is displayed in the journal window. You can modify the PC by entering a value (10a4h in this example) at the cursor prompt and pressing <...
  • Page 207: Using Macros And Command Files

    Using Macros and Command Files How to use macros and command files to make debugging easier.
  • Page 208 Chapter 6: Using Macros and Command Files The debugger provides several ways for you to simplify tasks that you do often. • Macros are C-like functions. You can call macros individually, attach them to breakpoints, or automatically execute them with each program step.
  • Page 209: Using Macros

    Chapter 6: Using Macros and Command Files Using Macros Using Macros A macro is a C-like function consisting of debugger commands and C statements and expressions. Macros are most often used to: • Patch C source code. Often, bugs found with the debugger can be temporarily patched with C source statements in macros.
  • Page 210 Chapter 6: Using Macros and Command Files Using Macros This section shows you how to: • Define a macro. • Call a macro. • Stop a macro. • Display macro source code. • Patch C source code by using macros. •...
  • Page 211 Chapter 6: Using Macros and Command Files Using Macros Macro arguments You can use formal macro arguments throughout the macro definition. They are replaced at execution time by the actual parameters present in the macro call. The actual parameter is coerced to the corresponding formal parameter type.
  • Page 212 Chapter 6: Using Macros and Command Files Using Macros If a macro is executed while the PC is pointing into the function foo(), variables i, j, and k can be directly accessed. If this is not the case, i must be accessed with a module qualifier, such as init\i.
  • Page 213: To Display The Macro Operations Dialog Box

    Chapter 6: Using Macros and Command Files Using Macros • File Command • Debugger Quit To display the Macro Operations dialog box • Select Breakpoints→Edit/Call Macro from the menu bar. • Select Attach Macro from the Code window pop-up menu. The Macro Operations dialog box allows you to call predefined macros, edit or call existing user-defined macros, and create new macros.
  • Page 214: To Use An Existing Macro As A Template For A New Macro

    Chapter 6: Using Macros and Command Files Using Macros When you exit the editor, save the macro under the default name. If you save it under a different name, the macro may be lost. See Also See "To use an existing macro as a template for a new macro" if you want to use an existing macro as the basis for a new macro.
  • Page 215: To Define A Macro Interactively Using The Command Line

    Chapter 6: Using Macros and Command Files Using Macros To define a macro interactively using the command line 1 Enter the Debugger Macro Add command followed by an optional return type, and then a macro name. The macro name must be followed by parentheses;...
  • Page 216: To Define A Macro Outside The Debugger

    Chapter 6: Using Macros and Command Files Using Macros To define a macro outside the debugger 1 Using a text editor on your host system, define the macro. 2 Save the macro definition in a command file (< filename> .com). 3 Start the debugger.
  • Page 217: To Save Macros

    Chapter 6: Using Macros and Command Files Using Macros Remember to save the macro under the default file name when you leave the editor (use the "Z Z " or ":wq!" command in vi). To save macros • Select File→Store→User-Defined Macros..The File Selection dialog box will be displayed so that you can choose a file in which to save the macros.
  • Page 218: To Call A Macro

    Chapter 6: Using Macros and Command Files Using Macros If you need to access local program variables in a macro, pass them to the macro as parameters. To call a macro • Select Breakpoints→Edit/Call Macro ...→Call. • Using the command line, enter: Debugger Macro Call Enter the name of the macro to be called, and press the <...
  • Page 219: To Call A Macro From Within An Expression

    Chapter 6: Using Macros and Command Files Using Macros To call a macro from within an expression • Enter a macro call as part of any expression entered on the command line of the debugger. The debugger will evaluate the macro and use its return value when evaluating the rest of the expression.
  • Page 220: To Call A Macro On Execution Of A Breakpoint

    Chapter 6: Using Macros and Command Files Using Macros • The macro cannot call itself. Example If you have the following macro definition: Debugger Macro Add int ten_to_the(y) return power(10,y); } the macro will compute 10**y by calling the previously defined macro power(). To call a macro on execution of a breakpoint •...
  • Page 221 Chapter 6: Using Macros and Command Files Using Macros Example The following example shows how return values can be used to conditionally control a breakpoint. The example uses the Debugger Macro Add and Breakpt Write commands to define a breakpoint that occurs only when the target variable days becomes greater than 31.
  • Page 222: To Call A Macro When Stepping Through Programs

    Chapter 6: Using Macros and Command Files Using Macros To call a macro when stepping through programs • Select Execution→Step→with Macro ..• Using the command line, enter: Program Step With_Macro Enter the name of the macro to be called, and press the < Return> key. You can use the Program Step With_Macro command to execute a macro after the step occurs.
  • Page 223: To Stop A Macro

    Chapter 6: Using Macros and Command Files Using Macros To stop a macro • Press < Ctrl> -C. Macros can be halted during execution by pressing < Ctrl> -C. Caution < Ctrl> -C will stop execution of a macro. Pressing < Ctrl> -C may interrupt a code-patching macro before it completes execution.
  • Page 224: To Delete A Macro

    Chapter 6: Using Macros and Command Files Using Macros To delete a macro • Using the command line, enter: Symbol Remove <macro_name> Enter the name of the macro you want to delete, and press the < Return> key. Use the Breakpt Delete command to remove the breakpoint that called the macro.
  • Page 225: Using Command Files

    Chapter 6: Using Macros and Command Files Using Command Files Using Command Files A command file is an ASCII file containing debugger commands. You can create command files from within the interface by logging commands to a command file as you execute the commands, or you can create or modify command files outside the interface with an ASCII text editor.
  • Page 226: To Record Commands

    Chapter 6: Using Macros and Command Files Using Command Files To record commands • Use the -l command_file option to the db68k command when starting the debugger. (The debugger appends the file extension .com to command_file.) $ db68k -l <command_file> <RETURN> •...
  • Page 227: To Place Comments In A Command File

    Chapter 6: Using Macros and Command Files Using Command Files To place comments in a command file • Using the command line, enter: File Log Comment Enter the comment that should be placed in the command file, and press the <...
  • Page 228: To Stop Command Recording

    Chapter 6: Using Macros and Command Files Using Command Files To stop command recording • Select File→Log→Stop Command Recording. • Using the command line, enter: File Log oFF And press the < Return> key. The command file is closed. To run a command file •...
  • Page 229: To Set Command File Error Handling

    Chapter 6: Using Macros and Command Files Using Command Files The debugger will begin executing commands found in the command file as if those commands were entered directly into the interface. The debugger will continue to execute commands until it reaches the end of the file or, perhaps, until an error occurs, depending on the command file error handling mode (see “To set command file error handling”).
  • Page 230: To Append Commands To An Existing Command File

    Chapter 6: Using Macros and Command Files Using Command Files To append commands to an existing command file • Using the command line, enter: File Log Append Enter the name of the file to which commands will be appended, and press the <...
  • Page 231: To Stop Command And Result Recording To A Journal File

    Chapter 6: Using Macros and Command Files Using Command Files Journal files are similar to command files. They contain debugger commands entered during a debug session. Journal files also contain any output generated by debugger commands. Journal files contain everything that is written to the journal window during a debug session.
  • Page 232: To Close The File Associated With A Window Number

    Chapter 6: Using Macros and Command Files Using Command Files After opening a file using the File User_Fopen Append or File User_Fopen Create command, you can use the Expression Fprintf command to write information to the file. Files opened for reading may be read from the built-in macro fgetc().
  • Page 233: To Use The Debugger In Batch Mode

    Chapter 6: Using Macros and Command Files Using Command Files To use the debugger in batch mode • Use the -b and -c command_file options to the db68k command when starting the debugger. When using the debugger in batch mode, stdin, stdout, and stderr are disabled. The -b option must be accompanied by the -c option and a debugger command file.
  • Page 234 Chapter 6: Using Macros and Command Files Using Command Files...
  • Page 235: Configuring The Debugger

    Chapter 7: Configuring the Debugger Configuring the Debugger How to change the appearance and behavior of the debugger.
  • Page 236 Chapter 7: Configuring the Debugger Configuring the debugger These tasks are grouped into the following sections: • Setting the general debugger options. • Setting the symbolics options. • Setting the display options. • Modifying display area windows. • Saving and loading the debugger configuration. •...
  • Page 237: Setting The General Debugger Options

    Chapter 7: Configuring the Debugger Setting the General Debugger Options Setting the General Debugger Options This section describes how to: • Display the Debugger Options dialog box. • List the debugger options settings. • Change debugger options settings. To display the Debugger Options dialog box •...
  • Page 238: To Specify Whether Command File Commands Are Echoed To The Journal Window

    Chapter 7: Configuring the Debugger Setting the General Debugger Options • Use the command line. See Also The "Debugger Option" sections in the "Debugger Commands" chapter for information on using the command line to set debugger options. To specify whether command file commands are echoed to the Journal window •...
  • Page 239: To Set Backtrace Display Of Bad Stack Frames

    Chapter 7: Configuring the Debugger Setting the General Debugger Options To set backtrace display of bad stack frames • In the Debugger Options dialog box, click on the Frame Stop button to toggle display of bad stack frames. Only consecutive valid stack frames are displayed. All stack frames, including bad frames, are displayed.
  • Page 240: To Select The Interpretation Of Numeric Literals (Decimal/Hexadecimal)

    Chapter 7: Configuring the Debugger Setting the General Debugger Options 68000, 68EC000, 68HC000, 68HC001, 68008, 68010, 68012, 68020, 68EC020, 68070, 68302, 683xx, 6833x, 68330, 68331, 68332, 68333, 68F333, 68334, 68335, 68336, 68337, 68338, 68340, 68349, CPU32, or CPU32P. To select the interpretation of numeric literals (decimal/hexadecimal) •...
  • Page 241: To Specify Exception Processing Behavior

    Chapter 7: Configuring the Debugger Setting the General Debugger Options To specify exception processing behavior • Using the command line, enter: Debugger Option General Exceptions Select Normal, Report, or Stop; then, press the < Return> key. Normal The debugger handles exceptions as would the processor. (default) Report The debugger reports exceptions to the Journal window and...
  • Page 242: To Specify Step Speed

    Chapter 7: Configuring the Debugger Setting the General Debugger Options To specify step speed • Using the command line, enter: Debugger Option General Step_Speed <numb 0..100> Enter the step speed number (from 0 to 100), and press the < Return> key. Higher numbers represent slower speeds.
  • Page 243: Setting The Symbolics Options

    Chapter 7: Configuring the Debugger Setting the Symbolics Options Setting the Symbolics Options This section shows you how to: • Display symbols in assembly code. • Display intermixed C source and assembly code. • Control case-sensitivity for symbols and module names. To display symbols in assembly code •...
  • Page 244: To Convert Module Names To Upper Case

    Chapter 7: Configuring the Debugger Setting the Symbolics Options To convert module names to upper case • In the Debugger Options dialog box, click on Uppercase Module Names. To control case sensitivity of symbol lookups • In the Debugger Options dialog box, select one of the following values for Symbol Lookup: As Entered Only The debugger will always look up the symbol as...
  • Page 245: Setting The Display Options

    Chapter 7: Configuring the Debugger Setting the Display Options Setting the Display Options This section shows you how to: • Specify the Breakpoint, Status, or Simulated I/O window display behavior. • Display half-bright or inverse video highlights. • Display information a screen at a time (more). •...
  • Page 246: To Display Half-Bright Or Inverse Video Highlights

    Chapter 7: Configuring the Debugger Setting the Display Options Swap The window is only displayed when you activate the window or when the debugger updates the information in the window. (Simulated I/O window only) The Stdio window is only displayed when function key F6 is pressed or when the Window Screen_On Stdio command is entered.
  • Page 247: To Specify Scroll Amount

    Chapter 7: Configuring the Debugger Setting the Display Options To specify scroll amount • Using the command line, enter: Debugger Option View Amt_Scroll <numb 0..50> Enter the number of lines for information to be scrolled (from 0 to 50), and press the <...
  • Page 248: Modifying Display Area Windows

    Chapter 7: Configuring the Debugger Modifying Display Area Windows Modifying Display Area Windows You can reformat display-area screens by modifying their windows. For example, you can reformat the high-level screen by resizing and moving the high-level Code, Monitor, Backtrace, Journal, and Breakpoint windows. You can also resize and move the alternate view of these windows.
  • Page 249: To Move The Status Window (Standard Interface Only)

    Chapter 7: Configuring the Debugger Modifying Display Area Windows The Window Resize command is used to move or alter the size of any existing window, except for the Status window. Use the Window New command to move the Status window in the standard interface. When you use the Window Resize command on the normal view of a window, the normal dimensions are modified.
  • Page 250: To Define User Screens And Windows

    Chapter 7: Configuring the Debugger Modifying Display Area Windows Examples To move the high-level Status window to the top of the display (upper left corner at 0,0 and lower right corner at 3,78): Window New 5 <tab> High_Level 0,0,3,78 To move the assembly-level Status window to the bottom of the display: Window New 15 <tab>...
  • Page 251: To Display User-Defined Screens

    Chapter 7: Configuring the Debugger Modifying Display Area Windows Caution When making a new window on the high-level or assembly-level screens, be careful not to enter coordinates that will result in a window that covers the status line and command line. On a standard 80-column terminal display, a row coordinate may be between 0 and 23.
  • Page 252: To Erase Standard I/O And User-Defined Window Contents

    Chapter 7: Configuring the Debugger Modifying Display Area Windows To erase standard I/O and user-defined window contents • Using the command line, enter: Window Erase <user_window_nmbr> Enter the user window number (the standard I/O window number is 20) whose contents you wish to clear, and press the < Return> key. If you do not specify a window number or if you specify 0, the active user-defined window is cleared.
  • Page 253 Chapter 7: Configuring the Debugger Modifying Display Area Windows Window Delete 55 Window Delete 73...
  • Page 254: Saving And Loading The Debugger Configuration

    Chapter 7: Configuring the Debugger Saving and Loading the Debugger Configuration Saving and Loading the Debugger Configuration Information regarding debugger options and screen configurations can be saved in a startup file. Startup files can be created only from within the debugger.
  • Page 255: To Load A Startup File

    Chapter 7: Configuring the Debugger Saving and Loading the Debugger Configuration To load a startup file • Use the -s startup_file option to the db68k command when starting the debugger. $ db68k -s <startup_file> <RETURN> The debugger’s startup options and window specifications are configured as described in startup_file.
  • Page 256: Setting X Resources

    Chapter 7: Configuring the Debugger Setting X Resources Setting X Resources The debugger’s graphical interface is an X Window System application which means it is a client in the X Window System client-server model. The X server is a program that controls all access to input devices (typically a mouse and a keyboard) and all output devices (typically a display screen).
  • Page 257 Chapter 7: Configuring the Debugger Setting X Resources Resource specifications included in the command line with the -xrm option. System scheme files in directory /usr/hp64000/lib/X11/HP64_schemes. System-wide custom scheme files located in directory $XAPPLRESDIR/HP64_schemes. User-defined scheme files located in directory $HOME/.HP64_schemes (note the dot in the directory name).
  • Page 258: To Modify The Debugger's Graphical Interface Resources

    X resources. The following tables describe some of the commonly modified application resources. Application Resources for Schemes Resource Values Description HP64_Debug.platformScheme HP-UX Names the subdirectory for platform SunOS specific schemes. This resource should be (custom) set to the platform on which the X server is running (and displaying the debugger’s...
  • Page 259 Chapter 7: Configuring the Debugger Setting X Resources Commonly Modified Application Resources Resource Values Description HP64_Debug.enableCmdline True Specifies whether the command line area False is displayed when you initially enter the debugger’s graphical interface. *editFile (example) Specifies the command used to edit files. vi %s *editFileLine (example)
  • Page 260 Chapter 7: Configuring the Debugger Setting X Resources The following steps show you how to modify the debugger’s graphical interface’s X resources. 1 Copy part or all of the HP64_Debug application defaults file to a temporary file. Type: cp $HP64000/lib/X11/app-defaults/HP64_Debug HP64_Debug.tmp 2 Make the temporary file writable: chmod +w HP64_Debug.tmp 3 Modify the temporary file.
  • Page 261 Chapter 7: Configuring the Debugger Setting X Resources 4 If the RESOURCE_MANAGER property exists (as is the case with HP VUE — if you’re not sure, you can check by entering the xrdb -query command), use the xrdb command to add the resources to the RESOURCE_MANAGER property.
  • Page 262: To Use Customized Scheme Files

    3 Modify the $HOME/.HP64_schemes/< platform> /Debug.< scheme> file. For example, you could modify the “$HOME/.HP64_schemes/HP-UX/Debug.MyColor” file to change the defined foreground and background colors. Also, since the scheme file name is different than the default, you could comment out various resource settings to cause general foreground and background color definitions to apply to the debugger’s graphical interface.
  • Page 263 For example, to use the “$HOME/.HP64_schemes/HP-UX/Debug.MyColor” color scheme file you would set the “HP64_Debug.colorScheme” resource to “MyColor”:...
  • Page 264: To Set Up Custom Action Keys

    Chapter 7: Configuring the Debugger Setting X Resources To set up custom action keys • Modify the “actionKeysSub.keyDefs” resource. To modify this resource, follow the procedure in "To modify the debugger’s graphical interface resources." The “actionKeysSub.keyDefs” resource defines a list of paired strings. The first string defines the text that should appear on the action key pushbutton.
  • Page 265: To Set Initial Recall Buffer Values

    Chapter 7: Configuring the Debugger Setting X Resources To set initial recall buffer values • Modify the “entries” resource for the particular recall buffer. Some of the resources for the pop-up recall buffers are listed in the following table: Pop-up Recall Buffer Resources Recall Pop-up Resources Entry Buffer ():...
  • Page 266 Chapter 7: Configuring the Debugger Setting X Resources...
  • Page 267: Part 3 Concept Guide

    Part 3 Concept Guide...
  • Page 268 Part 3...
  • Page 269: Resources And The Graphical Interface

    X Resources and the Graphical Interface An introduction to X resources.
  • Page 270: An X Resource Is User-Definable Data

    Chapter 8: X Resources and the Graphical Interface X Resources and the Graphical Interface This chapter helps you to understand how to set the X resources that control the appearance and operation of the debugger’s graphical interface. This chapter: • Explains the X Window concepts surrounding resource specification.
  • Page 271: Don't Worry, There Are Shortcuts

    Chapter 8: X Resources and the Graphical Interface widgets in the application. The name of the top-level widget is usually the same as that of the application. This top-level widget may have a number of widgets “beneath” it that are called children of the top-level widget. The names for these widgets are most often chosen for their mnemonic value.
  • Page 272: But Wait, There Is Trouble Ahead

    Chapter 8: X Resources and the Graphical Interface Instead of specifying the foreground color for the tracker quit button by using a resource name made up of instance names as in the last example, you could instead use a class name, as follows: tracker.panel.control.XmPushbutton.foreground: white Using class names in this way makes it easier to specify resources because it relieves you from having to discover the names of particular widgets in an...
  • Page 273: Class And Instance Apply To Applications As Well

    Chapter 8: X Resources and the Graphical Interface tracker*XmPushButton.foreground: white may not only set the foreground color of the quit button on the control panel of the application to white — it could also set the foreground colors for any pushbutton anywhere in the application.
  • Page 274: Resource Specifications Are Found In Standard Places

    Chapter 8: X Resources and the Graphical Interface HP64_Debug*<resource>: <value> • The following specifications apply to all sim68000 debugger interfaces: HP64_Debug.sim68000*<resource>: <value> debugsim.sim68000*<resource>: <value> According to the precedence rules for resource matching, the first specification is the most general and would be overridden by either of the following two.
  • Page 275: Loading Order Resolves Conflicts Between Files

    RESOURCE_MANAGER property. Some X servers have a resource property associated with the root window for the server. Resources are added to the resource property database by using xrdb. (HP VUE is an example.) The server can use this property to access those resources.
  • Page 276: The App-Defaults File Documents The Resources You Can Set

    Chapter 8: X Resources and the Graphical Interface The app-defaults file documents the resources you can set The HP64_Debug file is complete, well-commented, and a good source of reference for graphical interface resources. The HP64_Debug file should be your primary source of information about setting graphical interface resources.
  • Page 277: You Can Create Your Own Scheme Files, If You Choose

    /usr/hp64000/lib/X11/HP64_schemes. This directory is the upper level directory for scheme files. The other five files are in subdirectories below this one named by platform (or operating system). For example, the HP 9000 scheme files are in the subdirectory /usr/hp64000/lib/X11/HP64_schemes/HP-UX. Like the app-defaults file, these scheme files are system files and should not be modified directly.
  • Page 278: You Can Force The Debugger's Graphical Interface To Use Certain Schemes

    /usr/hp64000/lib/X11/HP64_schemes (or alternative) and then set this resource to choose that subdirectory instead of the standard platform subdirectory. Values can be: HP-UX, SunOS, or the name of a sub-directory containing custom scheme files. HP64_Debug.colorScheme: Chooses the black and white or color scheme.
  • Page 279 Chapter 8: X Resources and the Graphical Interface Values can be: Input or the name of a custom scheme file. HP64_Debug.sizeScheme: Chooses the large or small scheme for fonts and sizes. Values can be: Large, Small, or the name of a custom scheme file. HP64_Debug.labelScheme: Chooses a different label scheme for fixed text.
  • Page 280: Resource Setting - General Procedure

    HP64_Debug file for information about that resource. If the RESOURCE_MANAGER property exists (as is the case with HP VUE), copy the complete HP64_Debug file, or just the part you are interested in, to a temporary file. Modify the resource in your temporary file and save the file.
  • Page 281: Part 4 Reference

    Part 4 Reference...
  • Page 282 Part 4...
  • Page 283: Debugger Commands

    Debugger Commands Detailed descriptions of command line commands.
  • Page 284: Command Summary

    Restore previously saved debugger session Debugger Execution Reset_Processor Simulate microprocessor reset Debugger Execution Save_State Save current debugger session Debugger Host_Shell Enter HP-UX operating system environment Debugger Level Select debugger mode (high-level or assembly) Debugger Macro Add Create a macro Debugger Macro Call...
  • Page 285: Expression Commands

    Chapter 9: Debugger Commands Debugger Option Set or list debugger options for this session Debugger Pause Pause debugger session Debugger Quit Terminate a debugging session Expression Commands Expression commands calculate expression values, print formatted output to a window, and monitor variables. Command Definition Expression C_Expression...
  • Page 286: Memory Commands

    Chapter 9: Debugger Commands Memory Commands Memory commands do operations on the target microprocessor’s memory. Command Definition Memory Assign Change the values of memory locations Memory Block_Operation Copy Copy a memory block Memory Block_Operation Fill Fill a memory block with values Memory Block_Operation Match Compare two blocks of memory Memory Block_Operation Search...
  • Page 287: Program Commands

    Chapter 9: Debugger Commands Program Commands Program commands load and execute programs, control program execution, display source code and program variables, and set or cancel program interrupts. Command Definition Program Context Set Specify current module and function scope Program Context Display Display all local variables of a function Program Context Expand Display all local variables of a function at the specified stack...
  • Page 288: Window Commands

    Chapter 9: Debugger Commands Window Commands Window commands do operations on the debugger windows. Command Definition Window Active Activate a window Window Cursor Set the cursor position for a window Window Delete Remove a user-defined window or screen Window Erase Clear data from a window Window New Make a new screen or window...
  • Page 289: Breakpt Access

    Chapter 9: Debugger Commands Breakpt Access Breakpt Access The Breakpt Access command sets an access breakpoint at the specified memory location (< addr> ) or range (< addr> ..< addr> ). The access breakpoint halts program execution each time the target program attempts to read from or write to the specified memory location or range.
  • Page 290: Breakpt Clear_All

    Chapter 9: Debugger Commands Breakpt Access See Also Breakpt Clear_All Breakpt Read Breakpt Delete Breakpt Write Breakpt Erase Program Run Breakpt Instr Program Step Examples To set a breakpoint on accesses of addresses ’assign_vectors’ through ’assign_vectors’ + 16: Breakpt Access &assign_vectors..+16 To set a breakpoint on access of the address of the variable ’current_temp’: Breakpt Access &current_temp To stop program execution when the value of variable system_running is set or...
  • Page 291 Chapter 9: Debugger Commands Breakpt Clear_All Breakpt Clear_All The Breakpt Clear_All command clears (removes) all defined breakpoints. See Also Breakpt Access Breakpt Read Breakpt Delete Breakpt Write Breakpt Erase Program Run Breakpt Instr Program Step Examples To remove all defined breakpoints: Breakpt Clear_all...
  • Page 292: Breakpt Delete

    Chapter 9: Debugger Commands Breakpt Delete Breakpt Delete The Breakpt Delete command deletes (removes) one or more previously set breakpoints. When you set a breakpoint, the debugger assigns it a breakpoint number. Use this breakpoint number (< brkpt_nmbr> ) to remove a specific breakpoint.
  • Page 293: Breakpt Erase

    Chapter 9: Debugger Commands Breakpt Erase Breakpt Erase The Breakpt Erase command erases (deletes) a previously set breakpoint at a specific address or all breakpoints set within a range of addresses. The Breakpt Erase command differs from the Breakpt Delete command in that you identify the breakpoint(s) you wish to remove by an address or by a range of addresses instead of by a breakpoint number.
  • Page 294: Breakpt Instr

    Chapter 9: Debugger Commands Breakpt Instr Breakpt Instr The Breakpt Instr command sets an instruction breakpoint at a specified memory location (< addr> ) or range (< addr> ..< addr> ). The instruction breakpoint halts program execution each time the target program attempts to execute an instruction at the specified memory location(s).
  • Page 295 Chapter 9: Debugger Commands Breakpt Instr – If the macro return value is false (zero), the debugger returns to command mode without executing the instruction where the break occurred and displays breakpoint information. Returns to command mode without executing the instruction where the break occurred if no macro was attached and displays breakpoint information.
  • Page 296: Breakpt Read

    Chapter 9: Debugger Commands Breakpt Read Breakpt Read The Breakpt Read command sets a read breakpoint. The read breakpoint halts program execution each time the target program attempts to read data from the specified memory location (< addr> ) or range (< addr> ..< addr> ). The Breakpt Read command behaves just like the Breakpt Access command.
  • Page 297: Breakpt Write

    Chapter 9: Debugger Commands Breakpt Write Breakpt Write The Breakpt Write command sets a write breakpoint. The write breakpoint halts program execution each time the target memory attempts to write data to the specified memory location (< addr> ) or range (< addr> ..< addr> ). The Breakpt Read command behaves just like the Breakpt Access command.
  • Page 298: Debugger Directory

    Chapter 9: Debugger Commands Debugger Directory Debugger Directory The Debugger Directory command displays or changes the current working directory. When you specify the Show_Working parameter, the debugger displays the current working directory in the journal window. When you specify the Change_Working parameter with a directory name, the debugger makes that directory the current working directory.
  • Page 299: Debugger Execution Display_Status

    Chapter 9: Debugger Commands Debugger Execution Display_Status Debugger Execution Display_Status The Debugger Execution Display_Status command activates the debugger View window and displays the following status information: Version of debugger Current working directory Current log file Current journal file Startup file used in current debug session Loaded absolute files If no files have been loaded, the absolute file will be missing from the display.
  • Page 300: Debugger Execution Io_System

    Chapter 9: Debugger Commands Debugger Execution IO_System Debugger Execution IO_System The Debugger Execution IO_System command enables you to configure the simulated I/O system to use the host system keyboard, display, and file system to simulate I/O devices for your target program. Debugger Execution IO_System Enable The Debugger Execution IO_System Enable command enables the debugger simulated I/O system.
  • Page 301 Chapter 9: Debugger Commands Debugger Execution IO_System system keyboard (/dev/simio/keyboard) and the system display (/dev/simio/display). Debugger Execution IO_System Mode The Debugger Execution IO_System Mode command selects how keyboard I/O input is processed. Keyboard I/O may be either cooked or raw. Cooked Mode.
  • Page 302 Chapter 9: Debugger Commands Debugger Execution IO_System To redirect the standard input file to the keyboard, the standard output file to the display, and the standard error file to file ’/users/project/errorfile’: Debugger Execution IO_System Stdio_Redirect "/dev/simio/keyboard","/dev/simio/display", "/users/project/errorfile" To redirect the standard input file to ’temp.dat’, the standard output file to ’cmdout.dat’, and the standard error file to file ’errorlog.err’: Debugger Execution IO_System Stdio_Redirect "temp.dat","cmdout.dat","errorlog.err"...
  • Page 303: Debugger Execution Load_State

    Chapter 9: Debugger Commands Debugger Execution Load_State Debugger Execution Load_State The Debugger Execution Load_State command restores the memory contents and register values saved with the debugger/simulator Debugger Execution Save_State command. If you do not specify a file name (< save_file> ), the debugger uses the default file db68k.sav.
  • Page 304: Debugger Execution Reset_Processor

    Chapter 9: Debugger Commands Debugger Execution Reset_Processor Debugger Execution Reset_Processor This command simulates a microprocessor reset. It does the following: The program counter is loaded from exception vector 1 at location 4 in memory. The interrupt stack pointer is loaded from exception vector 0 at location 0 in memory.
  • Page 305: Debugger Execution Save_State

    Chapter 9: Debugger Commands Debugger Execution Save_State Debugger Execution Save_State The Debugger Execution Save_State command saves the current memory contents and register values. These values can be restored at a later time by executing the Debugger Execution Load_State command. If a file name (<...
  • Page 306: Debugger Host_Shell

    Chapter 9: Debugger Commands Debugger Host_Shell Debugger Host_Shell The Debugger Host_Shell command enables you to temporarily leave the debugging environment by forking an operating system shell or to execute a single UNIX operating system command from within the debugger. The type of shell forked is based on the shell variable SHELL.
  • Page 307 Chapter 9: Debugger Commands Debugger Host_Shell Wait Suspends the interface until the command completes. NoPrompt When the command completes, the "cmdscript" window is closed immediatelly. See Also Debugger Quit Examples To temporarily exit the debugger to the UNIX operating system command mode: Debugger Host_Shell To write the current working directory to the journal window:...
  • Page 308: Debugger Help

    Chapter 9: Debugger Commands Debugger Help Debugger Help This command displays the on-line help screen. The debugger provides on-line help for all debugger commands, debugger command arguments, and debugger function keys. You can access on-line help by entering the command Debugger ? or by pressing the F5 function key.
  • Page 309: Debugger Level

    Chapter 9: Debugger Commands Debugger Level Debugger Level The Debugger Level command selects either high-level mode or assembly-level mode for debugging. When debugging programs containing C modules, you can switch back and forth between the two modes. If the program contains no high-level modules accessible to the debugger, the debugger displays an error message if you attempt to select high-level mode.
  • Page 310: Debugger Macro Add

    Chapter 9: Debugger Commands Debugger Macro Add Debugger Macro Add The Debugger Macro Add command defines a macro. The name of the macro is specified by <macro_name> . The result type of the macro is specified by <type> . If a type is not specified, it defaults to type int. A parenthesized list of parameters (<param_list>) may optionally follow the macro name.
  • Page 311 Chapter 9: Debugger Commands Debugger Macro Add The curly braces ( { } ) are required punctuation. Formal arguments can be used throughout the macro definition, and are later replaced by the actual arguments in the macro call. The maximum number of characters that can be entered on a line in a macro definition is 255.
  • Page 312 Chapter 9: Debugger Commands Debugger Macro Add Debugger Macro Call Debugger Macro Display Program Run Symbol Remove The “Using Macros and Command Files” chapter The “Predefined Macros” chapter in this manual. Example Debugger Macro Add int power(x, y) /* Loop counter */ int multiplier;...
  • Page 313: Debugger Macro Call

    Chapter 9: Debugger Commands Debugger Macro Call Debugger Macro Call The Debugger Macro Call command calls a macro previously defined by the Debugger Macro Add command or a macro built into the debugger. See Also Debugger Macro Add Debugger Macro Display Symbol Remove Example To call the previously defined macro ’stackchk()’:...
  • Page 314: Debugger Macro Display

    Chapter 9: Debugger Commands Debugger Macro Display Debugger Macro Display The Debugger Macro Display command displays the source code for the named macro. If a window number is specified (< user_window_nmbr> ), the macro source is written to the file or user-defined window associated with the number.
  • Page 315: Debugger Option Command_Echo

    Chapter 9: Debugger Commands Debugger Option Command_Echo Debugger Option Command_Echo The Debugger Option Command_Echo command controls whether or not commands executed from a command file are echoed (copied) to the Journal window. If the oFF parameter is specified, only the results (if any) of a command are copied to the Journal window.
  • Page 316: Debugger Option General

    Chapter 9: Debugger Commands Debugger Option General Debugger Option General The Debugger Option General command changes the default values for the following debugger startup options for the current debugging session: Align_Bp Aligns breakpoints with processor instruction start Frame_Stop Controls stack walking Demand_Load Enables/disables demand loading of symbols Processor...
  • Page 317 Chapter 9: Debugger Commands Debugger Option General Use the Debugger Option List command to display the current option values. To permanently change any option default values, first use the Debugger Option command to change the value(s) and then use the File Startup command to save the new default values in a startup file.
  • Page 318 Chapter 9: Debugger Commands Debugger Option General There are several side effects of demand loading. The debugger command Memory Unload_BBA is disabled. Type mismatch errors may not be detected during the initial load of the executable (.x) file. Global symbols may have leading underscores stripped, depending on whether they were defined or referenced in a C or assembly source module.
  • Page 319 Chapter 9: Debugger Commands Debugger Option General This causes the debugger to allow exceptions to be handled as they would be by the processor. In Report mode, the debugger reports the exception type, and where it occurred to the Journal window, and then handles the exception as the processor would.
  • Page 320: Debugger Option List

    Chapter 9: Debugger Commands Debugger Option List Debugger Option List The Debugger Option List command lists the current debugger option values in the Journal window. The list will be similar to the sample list shown in the example. See Also Debugger Option Command_Echo Debugger Option General Debugger Option Symbolics...
  • Page 321: Debugger Option Symbolics

    Chapter 9: Debugger Commands Debugger Option Symbolics Debugger Option Symbolics The Debugger Option Symbolics command changes the default values for the following debugger symbol options and C source line display options for the current debugging session: Assem_Symbols Displays symbols in assembly code Intermixed Intermixes C source with assembly code Check_Args...
  • Page 322 Chapter 9: Debugger Commands Debugger Option Symbolics Use the Debugger Option List command to display the current option values. To permanently change any option default values, first use the Debugger Option command to change the value(s) and then use the File Startup command to save the new default values in a startup file.
  • Page 323 Chapter 9: Debugger Commands Debugger Option Symbolics Symbol_Case Symbol_Case tells the debugger how to look up symbols. The debugger will always look up the symbol as entered, case sensitive. This option allows you to specify that if the case sensitive lookup fails, the debugger should try again after converting the symbol to all uppercase (Upper), lowercase (Lower), or upper first and then lower (All).
  • Page 324: Debugger Option View

    Chapter 9: Debugger Commands Debugger Option View Debugger Option View The Debugger Option View command changes the default values for the following debugger display options for the current debugging session: Breakpt_Window View_Window Highlight More Stdio_Window Amt_Scroll Use the Debugger Option List command to display the current option values. To permanently change any of the default values, first use the appropriate Debugger Option command to change the value(s) and then use the File Startup command to save the new default values in a startup file.
  • Page 325 Chapter 9: Debugger Commands Debugger Option View Breakpt_Window The Breakpt_Window option controls the display of the breakpoint window. The On setting causes the Breakpoint window to be displayed at all times. The window may be hidden by other windows but will be displayed whenever a breakpoint is set or deleted.
  • Page 326 Chapter 9: Debugger Commands Debugger Option View Stdio_Window The Stdio_Window option controls the display of the Stdio window. The Swap setting causes the Stdio window to be displayed when a program writes to it and to be removed when the program returns to the command mode.
  • Page 327: Debugger Pause

    Chapter 9: Debugger Commands Debugger Pause Debugger Pause The Debugger Pause Time command pauses the debugger for the specified number of seconds or (if you enter the Debugger Pause command without the Time parameter) pauses the debugger until you press the space bar, CTRL C, or the escape key (Esc) twice.The Debugger Pause command is useful when executing command files.
  • Page 328: Debugger Quit

    Chapter 9: Debugger Commands Debugger Quit Debugger Quit The Debugger Quit command ends a debugging session without saving the session. If you enter the command Debugger Quit Yes , the debugging session is immediately ended. If you enter the command Debugger Quit without an option, the debugger asks the question "Are you sure?".
  • Page 329: Expression C_Expression

    Chapter 9: Debugger Commands Expression C_Expression Expression C_Expression The Expression C_Expression command calculates the value of most valid C expressions or assigns a value to a variable. The result is displayed in floating point or in decimal, hexadecimal, and ASCII formats. The Expression C_Expression command can be used to set C variables by specifying a C assignment statement.
  • Page 330: Expression Display_Value

    Chapter 9: Debugger Commands Expression Display_Value Expression Display_Value The Expression Display_Value command displays expressions and their values in the Journal window. Displays the expression as a string. Displays the expression in decimal format. Displays the expression in hexadecimal format.
  • Page 331 Chapter 9: Debugger Commands Expression Display_Value If you do not use /S, /T, or /H, all expressions displayed with this command are displayed according to their type as shown in the following list: Type Display Format Ints 32-bit signed decimal numbers Longs 32-bit signed decimal numbers Shorts...
  • Page 332 Chapter 9: Debugger Commands Expression Display_Value To display the contents of a character array as a string, cast the variable using the quoted string cast, as shown in the following example: Expression Display_Value (Q S)buf If the type of the expression is unknown, it defaults to type byte. See the “Expressions and Symbols in Debugger Commands”...
  • Page 333: Expression Fprintf

    Chapter 9: Debugger Commands Expression Fprintf Expression Fprintf The Expression Fprintf command prints formatted output to the specified user-defined window. Formatted output may be written to a file that has been opened by the File User_Fopen command. The Expression Fprintf command is similar to the C fprintf function.
  • Page 334 Chapter 9: Debugger Commands Expression Fprintf – indicates that the result of conversion is to be left-justified within the field. digits is a string of one or more decimal characters. The first digits is a minimum field width. The field will be at least this many characters wide, padded if necessary.
  • Page 335 Chapter 9: Debugger Commands Expression Fprintf The double argument is converted to decimal notation in the format [–]ddd.ddd, where the number of digits after the decimal point is equal to the precision specification. If the precision is not specified, it is 6 by default; if the precision is explicitly zero, no decimal point appears.
  • Page 336 Chapter 9: Debugger Commands Expression Fprintf The argument is converted to hexadecimal. Letters are displayed in lower case. The character % is substituted for the field. Any other non-conversion character following a % is printed. %% is used to generate % in the output as a literal character. Conversion characters are case-sensitive.
  • Page 337 Chapter 9: Debugger Commands Expression Fprintf See Also Expression Printf File Journal File Log File User_Fopen Window New Examples To print value of ’var’ to user window 57 as a single character: Expression Fprintf 57,"%c",var To print the string in double quotes to user window 57 followed by the floating point value of ’temperature’...
  • Page 338: Expression Monitor Clear_All

    Chapter 9: Debugger Commands Expression Monitor Clear_All Expression Monitor Clear_All The Expression Monitor Clear_All command stops monitoring of all expressions being monitored with the Expression Monitor Value command and removes all expressions from the Monitor window. See Also Expression Fprintf Expression Monitor Delete Expression Monitor Value Expression Printf...
  • Page 339: Expression Monitor Delete

    Chapter 9: Debugger Commands Expression Monitor Delete Expression Monitor Delete The Expression Monitor Delete command stops monitoring of specified expressions being monitored with the Expression Monitor Value command and removes those expressions from the Monitor window. When an expression is monitored using the Expression Monitor Value command, it is assigned a line number, which is displayed in the Monitor window.
  • Page 340: Expression Monitor Value

    Chapter 9: Debugger Commands Expression Monitor Value Expression Monitor Value The Expression Monitor Value command monitors the specified expressions as the target program is executing. Expressions are updated and displayed in the Monitor window each time the debugger stops executing the program. Up to seventeen lines, selected by the display line range parameter (;<...
  • Page 341 Chapter 9: Debugger Commands Expression Monitor Value All expressions monitored with this command are displayed according to their type as follows: Type Display Format Ints 32-bit signed decimal numbers Longs 32-bit signed decimal numbers Shorts 16-bit signed decimal numbers Chars 8 bit characters (unsigned hexadecimal numbers if not printable) Pointers...
  • Page 342 Chapter 9: Debugger Commands Expression Monitor Value filled, you must use the Expression Monitor Delete command to delete an expression before monitoring another one. If you do not specify a display line range, the next available line in the data window is selected to display the monitored variable.
  • Page 343: Expression Printf

    Chapter 9: Debugger Commands Expression Printf Expression Printf The Expression Printf command prints formatted output to the Journal window. See the Expression Fprintf command for a detailed description. See Also Expression Fprintf File User_Fopen Examples To print the string in double quotes to the journal window followed by the floating point value of ’temperature’...
  • Page 344 Chapter 9: Debugger Commands Expression Printf Expression Printf "%m", 2030h 00002030 2040 MOVEA.L D0,A0 To print the contents of the assembly-level stack window to the Journal window: Expression Printf "%w",14 > Expression Printf "%w",14 00043FC8=00000690 FP->00043FC4=00043FF0 00043FC0=000604AC 00043FBC=00000001 SP->00043FB8=00000001...
  • Page 345: File Command

    Chapter 9: Debugger Commands File Command File Command The File Command command reads the file specified by < file_name> and executes the commands contained in the file as though they were entered from the keyboard. Commands in the file are executed until the end of the file is reached.
  • Page 346 Chapter 9: Debugger Commands File Error_Command File Error_Command The File Error_Command command sets the command file error handling mode. The command specifies what action the debugger takes when an error occurs while reading a command file. Abort_Read causes the debugger to return to the command line after an error and wait for keyboard input.
  • Page 347: File Journal

    Chapter 9: Debugger Commands File Journal File Journal The File Journal command copies the information written to the Journal window output into a journal file specified by < file_name> . The default journal filename extension .jou will be appended to < filename> . The journal file provides a history of your debugging session.
  • Page 348 Chapter 9: Debugger Commands File Journal Examples To make and open journal file ’debug1.jou’ for writing: File Journal On debug1 To close the currently open journal file: File Journal oFF To open existing journal file ’debug1.jou’ for writing and append new information at the end of the file: File Journal Append debug1...
  • Page 349: File Log

    Chapter 9: Debugger Commands File Log File Log The File Log command records user input in a command file, specified by < file_name> . The default filename extension .com will be appended to < filename> . The File Log command allows an interactive debugger session to be logged as a command file which can be rerun at a later time.
  • Page 350 Chapter 9: Debugger Commands File Log Examples To make and open log file ’log1.com’ for writing: File Log On log1 To close the currently open log file: File Log oFF To open existing log file ’log1.com’ for writing and append new information at the end of the file: File Log Append log1 To place the comment ’This is a comment string’...
  • Page 351: File Startup

    Chapter 9: Debugger Commands File Startup File Startup The File Startup command saves the current debugger option settings and window parameters in a startup file specified by < startup_file> . When you start a debugging session and specify the startup file with the -s option of the db68k command, the startup options and window parameters you saved will be the default parameters in that debugging session.
  • Page 352 Chapter 9: Debugger Commands File Startup To save the current set of debugger startup options and window parameters in startup file ’my_start_file.rc’ and execute the command file ’initDemo.com’ whenever the debugger is started using ’my_start_file.rc’: File Startup my_start_file , initDemo...
  • Page 353: File User_Fopen

    Chapter 9: Debugger Commands File User_Fopen File User_Fopen The File User_Fopen command opens the file specified by < file_name> for reading or writing and assigns a window number to it. The File User_Fopen Append command opens an existing file for writing, adding new information at the end of the file.
  • Page 354 Chapter 9: Debugger Commands File User_Fopen Examples To open user window 57 and redirect any data written to window 57 to the file ’varTrace.out’: File User_Fopen Create 57 File varTrace.out To open user window 57 and append any data written to window 57 to the existing file ’varTrace.out’: File User_Fopen Append 57 File varTrace.out To open file ’temp.dat’...
  • Page 355 Chapter 9: Debugger Commands File Window_Close File Window_Close The File Window_Close command closes a device or file which was previously opened with the File User_Fopen command. The Window Delete command may also be used for this purpose. See Also File User_Fopen Window Delete Example To close file associated with user window number 57:...
  • Page 356: Memory Assign

    Chapter 9: Debugger Commands Memory Assign Memory Assign The Memory Assign command changes the contents of the memory location specified by < addr> to the value or values defined by the expression < expr> or expression string < expr_string> . The size of the memory elements to be modified is specified by one of the size qualifiers (Byte, Word, or Long).
  • Page 357 Chapter 9: Debugger Commands Memory Assign will not work. The command will set the memory location referenced by the value of count equal to 5, not the contents of the variable. To set the value of count equal to 5, use the following command: Memory Assign Long &count=5 The Expression C_Expression command should be used to set C variables.
  • Page 358: Memory Block_Operation Copy

    Chapter 9: Debugger Commands Memory Block_Operation Copy Memory Block_Operation Copy The Memory Block_Operation Copy command copies the contents of the memory range specified by < addr> ..< addr> to a block of the same size starting at the memory location specified by < addr> . See Also Memory Assign Memory Block_Operation Fill...
  • Page 359: Memory Block_Operation Fill

    Chapter 9: Debugger Commands Memory Block_Operation Fill Memory Block_Operation Fill The Memory Block_Operation Fill command fills the range of memory locations specified by the address range < addr> ..< addr> with the value or values specified by an expression < expr> or an expression string <...
  • Page 360 Chapter 9: Debugger Commands Memory Block_Operation Fill See Also Memory Assign Memory Block_Operation Copy Memory Block_Operation Match Memory Block_Operation Search Memory Block_Operation Test Memory Register Examples To fill memory locations 1000h through 1007h with the long pattern 61626364, 65666768: Memory Block_Operation Fill Long 0x1000..+7=’abcdefgh’ To fill the memory area starting at location 1000h and ending at location 10ffh with zeros: Memory Block_Operation Fill Byte 0x1000..0x10ff...
  • Page 361: Memory Block_Operation Match

    Chapter 9: Debugger Commands Memory Block_Operation Match Memory Block_Operation Match The Memory Block_Operation Match command compares the contents of two blocks of memory to determine their similarities or differences. The command compares the block of memory specified by the address range <...
  • Page 362 Chapter 9: Debugger Commands Memory Block_Operation Match Examples To compare the block of memory starting at address 1000h and ending at address 10ffh with a block of the same size beginning at address 5000h and stop when a difference is found: Memory Block_Operation Match Stop_On_Mismatch 1000h..10ffh,5000h To execute the previous Memory Block_Operation Match...
  • Page 363: Memory Block_Operation Search

    Chapter 9: Debugger Commands Memory Block_Operation Search Memory Block_Operation Search The Memory Block_Operation Search command searches the block of memory specified by < addr> ..< addr> for the specified expression < expr> or expression string< expr_string> . The size qualifier (Byte, Word, or Long) specifies the size of an expression or each expression in an expression string.
  • Page 364 Chapter 9: Debugger Commands Memory Block_Operation Search See Also Memory Display Memory Block_Operation Copy Memory Block_Operation Fill Memory Block_Operation Match Memory Block_Operation Test Program Find First Program Find Next Examples To search for the expression ’gh’ in the memory range from address 1000h through address 10ffh and stop when the expression is found or address 10ffh is reached: Memory Block_Operation Search Word Once...
  • Page 365: Memory Block_Operation Test

    Chapter 9: Debugger Commands Memory Block_Operation Test Memory Block_Operation Test The Memory Block_Operation Test command examines the specified memory locations specified by < addr..addr> to verify that the value(s) defined by < expr> or < expr_string> exist throughout the specified memory area. When the debugger finds a mismatch, it displays the mismatched address and value.
  • Page 366 Chapter 9: Debugger Commands Memory Block_Operation Test the test of a previous Memory Block_Operation test command given with the Once qualifier, beginning with the last address tested. Repeatedly Qualifier If you specify the Repeatedly qualifier, the debugger continues testing the specified value(s) for mismatches until the end of the block is reached, or until you enter CTRL C.
  • Page 367: Memory Display

    Chapter 9: Debugger Commands Memory Display Memory Display The Memory Display displays the contents of the specified memory locations. Mnemonic Option The Mnemonic option displays memory in assembly language mnemonics starting at the memory location specified by < addr> . If you do not specify an address, the debugger displays memory beginning with the address pointed to by the program counter.
  • Page 368 Chapter 9: Debugger Commands Memory Display Note If the Align_bp option is set to On, the address of the first instruction in the assembly Code window may be incorrect after executing the Memory Display Mnemonic command. Byte, Word, and Long Options The byte, word, or long qualifier option displays the contents of memory locations specified by <...
  • Page 369: Memory Hex

    Chapter 9: Debugger Commands Memory Hex Memory Hex The Memory Hex command allows you to work with memory image files. Read This command allows you to read a memory image file in Motorola S record or Intel Hex format. The addresses in the file may be offset to generate the address in the target.
  • Page 370: Memory Inport Assign

    Chapter 9: Debugger Commands Memory Inport Assign Memory Inport Assign The Memory Inport Assign command assigns a simulated input port and defines its size, address, and input source. The port address can be any valid address. The source of input data may be the standard I/O screen, the Journal window, a file, an expression string, or the input or output port buffers.
  • Page 371 Chapter 9: Debugger Commands Memory Inport Assign Inport Port Size You can specify the size of an input port by using one of the size qualifiers (Byte, Word, or Long). Input Data Source Specify the input data source (Source_Is) by entering one of the following associated keywords: Journal_Window Journal window...
  • Page 372 Chapter 9: Debugger Commands Memory Inport Assign value. If you do not enter a value and an output port has not been declared at that address, the debugger places a value of zero in the buffer. Inport. If you specify Inport < port_addr> , the input port uses the value in the input port buffer at the same address.
  • Page 373: Memory Inport Delete

    Chapter 9: Debugger Commands Memory Inport Delete Memory Inport Delete The Memory Inport Delete command disables the specified input port address, allowing the address to behave like a normal memory location. See Also Memory Inport Assign Memory Outport Assign Example To disable the input port at address 400h: Memory Inport Delete 400h...
  • Page 374: Memory Inport Rewind

    Chapter 9: Debugger Commands Memory Inport Rewind Memory Inport Rewind The Memory Inport Rewind command rewinds an input file or resets the pointer to the input string associated with the input port. The input port is specified by the port address (< port_addr> ). See Also Memory Inport Assign Memory Inport Delete...
  • Page 375: Memory Inport Show

    Chapter 9: Debugger Commands Memory Inport Show Memory Inport Show The Memory Inport Show command displays the value stored in the buffer of the specified input port or ports. Each input port has a single value buffer associated with it. The buffer contains the last value read from the port. This value can be represented in byte, word, or long format.
  • Page 376: Memory Map Guarded

    Chapter 9: Debugger Commands Memory Map Guarded Memory Map Guarded The Memory Map Guarded command prevents access to a specified memory location or range of memory locations. These locations cannot be accessed during execution of the target program. The Memory Map Guarded command overrides any Memory Map Read_Only and Memory Map Write_Read commands previously executed.
  • Page 377 Chapter 9: Debugger Commands Memory Map Read_Only Memory Map Read_Only The Memory Map Read_Only command prevents a specified memory location or range of memory locations from being written to during execution of the target program. Read_Only protects the target program memory so that specified code and/or data can only be read.
  • Page 378: Memory Map Show

    Chapter 9: Debugger Commands Memory Map Show Memory Map Show The Memory Map Show command displays a map of the memory location assignments (Guarded, Read_Only, Write_Read). See Also Memory Map Guarded Memory Map Read_Only Memory Map Write_Read Example To display the memory map: Memory Map Show >...
  • Page 379: Memory Map Write_Read

    Chapter 9: Debugger Commands Memory Map Write_Read Memory Map Write_Read The Memory Map Write_Read command enables read/write access to a specified memory location or a range of memory locations by the target program. Memory Map Write_Read allows the program to read from or write to specified code or data areas.
  • Page 380: Memory Outport Assign

    Chapter 9: Debugger Commands Memory Outport Assign Memory Outport Assign The Memory Outport Assign command defines the address, size, and output destination of a simulated output port. The target program can write output data to the simulated output port. The port address can be any valid address. Outport Port Size You can specify the size of an output port buffer by entering one of the size qualifiers (Byte, Word, or Long).
  • Page 381 Chapter 9: Debugger Commands Memory Outport Assign Journal_Window Journal window File < file_name> Specified file Standard I/O device Stdio Outport Output port buffer Inport Input port buffer Journal_Window. If you specify Journal_Window, the output port writes output data to the Journal window. The debugger displays the current output value and port address in hexadecimal.
  • Page 382 Chapter 9: Debugger Commands Memory Outport Assign Examples To assign address 0x408 as an I/O port (output) of size word: Memory Outport Assign Word 0x408 Destination_Is File "/myproj/cmdout.dat" Write operations to the port will access file ’/myproj/cmdout.dat’. You must specify the file name in quotation marks. To assign address 0x40C as an I/O port (output) of size byte: Memory Outport Assign Byte 0x40C Destination_Is Stdio Write operations to the port will access the Stdio window.
  • Page 383: Memory Outport Delete

    Chapter 9: Debugger Commands Memory Outport Delete Memory Outport Delete The Memory Outport Delete command disables the specified output port address, allowing the address to behave like a normal memory location. See Also Memory Outport Assign Memory Outport Show Example To disable the output port at address 408h: Memory Outport Delete 408h...
  • Page 384: Memory Outport Rewind

    Chapter 9: Debugger Commands Memory Outport Rewind Memory Outport Rewind The Memory Outport Rewind command rewinds an output file associated with an output port specified by the port address (< port_addr> ). Subsequent output to that port starts at the beginning of the file. See Also Memory Outport Assign Memory Outport Delete...
  • Page 385: Memory Outport Show

    Chapter 9: Debugger Commands Memory Outport Show Memory Outport Show The Memory Outport Show command displays the value stored in the buffer of the specified outport port or ports. Each output port has a one-value buffer associated with it that contains the last value written to the port. The buffer value can be displayed in byte, word, or long format.
  • Page 386: Memory Register

    Chapter 9: Debugger Commands Memory Register Memory Register The Memory Register command changes the contents of a register, status flag, or other processor variables such as cycle count. The new contents are defined by < value> . The PC is displayed or changed if you do not specify a register name. If you do not specify a value in the command, values are entered interactively.
  • Page 387 Chapter 9: Debugger Commands Memory Register = 0x000010B8 4280: 10a4h = 0x00015DB4 89524: To set the value of register @d1 to 44h: Memory Register @d1=0x44 To interactively change the value of register @d1: Memory Register @d1...
  • Page 388: Memory Unload_Bba

    Memory Unload_BBA Note You must have the HP Branch Validator product for the processor you are debugging code for installed on your system in order to use this command. If you do not have the HP Branch Validator for your processor, the debugger...
  • Page 389 Chapter 9: Debugger Commands Memory Unload_BBA Memory Unload_BBA All The Memory Unload_BBA All command unloads branch analysis information associated with all absolute files loaded into the file bbadump.data. This command lets you run bbarep without specifying a file name. The file name bbadump.data is used as the default name of all dump files.
  • Page 390 Chapter 9: Debugger Commands Memory Unload_BBA To unload branch analysis information associated with absolute file a.out.x into file "mydata": Memory Unload_BBA Load_file "a.out" To "mydata"...
  • Page 391: Program Context Display

    Chapter 9: Debugger Commands Program Context Display Program Context Display The Program Context Display command displays the current module, function, and line number in the Journal window. The current module is the one pointed to by the program counter. This command will display both the view context, as set by a Program Context Set command, and the context of the current program counter, if the two are different.
  • Page 392: Program Context Expand

    Chapter 9: Debugger Commands Program Context Expand Program Context Expand The Program Context Expand command displays values of the parameters passed to a function, and the local variables in a function. The values are displayed in the Journal window. To display a function’s calling parameters and local variables, specify the function’s stack level preceded by an at sign (@).
  • Page 393: Program Context Set

    Chapter 9: Debugger Commands Program Context Set Program Context Set The Program Context Set command changes the default module and function (context). The current module (the one to which the program counter is pointing) is the default when functions are referenced without a module or function qualifier.
  • Page 394: Program Display_Source

    Chapter 9: Debugger Commands Program Display_Source Program Display_Source The Program Display_Source command displays C source code in the Code window beginning at the specified line or function. This command works in high-level mode only. If you do not specify a line number or function name, the debugger displays the line pointed to by the program counter.
  • Page 395: Program Find_Source Next

    Chapter 9: Debugger Commands Program Find_Source Next Program Find_Source Next The Program Find_Source Next command searches a high-level source program for the next occurrence of the string specified in the last Program Find_Source Occurrence command. When the debugger finds the string, it displays the line containing the string at the top of the Code window.
  • Page 396: Program Find_Source Occurrence

    Chapter 9: Debugger Commands Program Find_Source Occurrence Program Find_Source Occurrence The Program Find_Source Occurrence command searches a high-level source file for the first occurrence of the specified string. If you provide a line number, the debugger searches for the string starting at the given line number. If you do not specify a line number, the string search starts at the top of the Code window.
  • Page 397 Chapter 9: Debugger Commands Program Find_Source Occurrence Examples To search forward through the current module for the string ’time’: Program Find_Source Occurrence Forward ’time’ To search backward through the current module for the string ’time’, starting at line 237: Program Find_Source Occurrence Backward ’time’,#237 To search forward through the module ’main’, for the string system_is_running, beginning at line 1: Program Find_Source Occurrence Forward...
  • Page 398: Program Interrupt Add

    Chapter 9: Debugger Commands Program Interrupt Add Program Interrupt Add The Program Interrupt Add command causes a simulated program interrupt after a specified number of clock cycles (< cycle_count> ) have been executed. The pseudo register @cycle is used to keep track of the clock cycle count, allowing the interrupt frequency to be precisely timed.
  • Page 399 Chapter 9: Debugger Commands Program Interrupt Add Exception Vectors The exception vector parameter < vector> is a value between 0 and 255 that acts as an index to the exception vector table. You are responsible for providing the values for the table, i.e., the addresses of the interrupt routines. If an exception vector is not given, the Interrupt Autovector for the specified interrupt level is used.
  • Page 400: Program Interrupt Remove

    Chapter 9: Debugger Commands Program Interrupt Remove Program Interrupt Remove The Program Interrupt Remove command cancels all pending interrupts at the specified interrupt level. The interrupt level range is from 1 to 7 inclusive. If you do not specify a level, all interrupts are canceled. See Also Program Interrupt Add Examples...
  • Page 401: Program Load

    Chapter 9: Debugger Commands Program Load Program Load The Program Load command loads and reloads the specified executable module into the debugger and also allows you to set default options for loading executable modules. Option_Set Parameter This parameter and its qualifiers let you specify defaults for loading executable modules.
  • Page 402 Chapter 9: Debugger Commands Program Load Reload Parameter The Reload parameter reloads only the code image for the current absolute file (that is, the file at the root of the current symbol tree). This is a shorthand way to reload code without having to look up the file name. Monitored expressions in the Monitor window will not be cleared;...
  • Page 403: Program Pc_Reset

    Chapter 9: Debugger Commands Program Load Resetting Program Variables To reset static and global program variables after entering a Debugger Execution Reset_Processor or Program Pc_Reset command, you must reload your program by using the Program Load command. For faster loading, specify Program Load New Code_Only.
  • Page 404 Chapter 9: Debugger Commands Program Pc_Reset Program Pc_Reset The Program Pc_Reset command resets the program counter (PC) to the transfer address from the absolute file. This causes the next Program Run or Program Step command to restart execution at the beginning of the program. The command does not clear breakpoints.
  • Page 405: Program Run

    Chapter 9: Debugger Commands Program Run Program Run The Program Run command starts or continues target program execution. The program runs until it encounters a permanent or temporary breakpoint, an error, or a stop instruction, or until you press CTRL C. The Program Run command may be used to resume execution after program execution has been suspended.
  • Page 406 Chapter 9: Debugger Commands Program Run Program Run fromReset Resets processor and then starts execution as the processor does when reset. Program Run Until The Program Run Until command begins program execution at the current program counter address and breaks at the specified address. Break Address The break address (<...
  • Page 407 Chapter 9: Debugger Commands Program Run Examples To execute the target program starting at address ’main’: Program Run From main To begin program execution at the current program counter address and run until line 110 of the current module: Program Run Until #110 To begin program execution at the current program counter address, run until the program returns to the calling function of the current function, and then execute the macro ’read_val’:...
  • Page 408: Program Step

    C source line or one machine instruction. Note If the debugger steps into an HP library routine, you can then use the Program Run Until @1 (stack level 1) command to run to the end of the library routine.
  • Page 409 Chapter 9: Debugger Commands Program Step Program Step Count The Program Step Count command executes the specified number of either instructions or lines, starting at the location pointed to by the program counter. The debugger updates the screen after each instruction or line is executed. If a breakpoint is encountered, single-stepping is halted.
  • Page 410: Program Step Over

    Chapter 9: Debugger Commands Program Step Over Program Step Over The Program Step Over command executes the number of instructions or lines specified, but executes through function calls, that is, the called function is executed without stepping through it. Execution begins at the specified starting address.
  • Page 411: Program Step With_Macro

    Chapter 9: Debugger Commands Program Step Over Program Step Over Count The Program Step Over Count command executes the specified number of either instructions or lines, starting at the location pointed to by the program counter. The debugger updates the screen after each instruction or line is executed.
  • Page 412 Chapter 9: Debugger Commands Program Step With_Macro Program Step With_Macro The Program Step With_Macro command single steps through the program and executes the specified macro (< macro_call> ) after each instruction or high-level line. Program execution continues if the macro returns a nonzero value.
  • Page 413: Symbol Add

    Chapter 9: Debugger Commands Symbol Add Symbol Add The Symbol Add command creates a symbol and adds it to the debugger symbol table. When defining a symbol, you must declare the symbol’s name. It may be any name not previously used. Type You can optionally assign any valid C data type <...
  • Page 414 Chapter 9: Debugger Commands Symbol Add Program Symbols Program symbols are specified with a base address (Address < target_memory_address> ). The base address references an address in target memory. Program symbols are identical to variables defined in a C or assembly language program.
  • Page 415 Chapter 9: Debugger Commands Symbol Add In this example, we assigned a value to the symbol that is too large for the specified type. In this case, the debugger fills the memory location with the lower bytes of the specified value. Executing the command: Expression Printf "%x",s1 shows that the value is 203, the lower two bytes of the specified value.
  • Page 416: Symbol Browse

    Chapter 9: Debugger Commands Symbol Browse Symbol Browse The Symbol Browse command displays the parents and children of a C+ + class. The inheritance relationship is displayed in the Journal window. Example To display the parents and children of the C+ + class fruit, type: Symbol Browse fruit...
  • Page 417: Symbol Display

    Chapter 9: Debugger Commands Symbol Display Symbol Display The Symbol Display command displays symbols and associated information in the Journal window.
  • Page 418 Chapter 9: Debugger Commands Symbol Display To display symbols in all modules, specify a backslash as the command argument. Symbol Display Default \ To displays all symbols in a specified module or function, enter a module name or function name followed by a backslash. Symbol Display Default memset\ The wildcard character * may be placed at the end of a symbol name with any option.
  • Page 419 Chapter 9: Debugger Commands Symbol Display Search_All displays symbols of all types in all roots (contexts). Wide shows symbol names only in multicolumn (compressed) format. If you do not specify any options, the debugger displays all symbols. Warnings When you execute the Symbol Display Warnings command, the debugger displays type mismatches.
  • Page 420 Chapter 9: Debugger Commands Symbol Display update_state_of\refresh : Type is Local int. Address = Frame + 8 update_state_of\interval_complete : Type is Local int. Address = Frame + 12 To display all modules in the current symbol tree: Symbol Display Options Modules End_Options \ Symbol Display Options Modules End_Options \ Root is: @ecs 31 source and 23 assembler modules, 28 source procedures.
  • Page 421 Chapter 9: Debugger Commands Symbol Display Symbol Display Options Data&Macros Search_All End_Options \ Symbol Display Options Data&macros Search_All End_Options \ Root is: @ecs 31 source and 23 assembler modules, 30 source procedures. Filename = ecs.x update_state_of\refresh : Type is Local int. Address = Frame + 8 update_state_of\interval_complete : Type is Local int.
  • Page 422: Symbol Remove

    Chapter 9: Debugger Commands Symbol Remove Symbol Remove The Symbol Remove command removes the specified symbol from the symbol table. Only program symbols and user-defined debugger symbols can be deleted from the symbol table. To delete all symbols within a named module or function, append a backslash (\) to the module or function name (<...
  • Page 423 Chapter 9: Debugger Commands Symbol Remove See Also Symbol Add Symbol Display Examples To delete symbol ’current_targets’ in function ’alter_settings’: Symbol Remove alter_settings\current_targets To delete all symbols in module ’updateSys’: Symbol Remove updateSys\ To delete symbol ’alter_settings’ in module ’updateSys’: Symbol Remove updateSys\alter_settings In this example, the symbol being removed is a function which contains other symbols.
  • Page 424: Window Active

    Chapter 9: Debugger Commands Window Active Window Active The Window Active command activates the specified window. The border of the active window is highlighted. The Code window is active by default within the high level and low level screens.
  • Page 425 Chapter 9: Debugger Commands Window Active The Next and Previous parameters specify the next higher-numbered or lower-numbered window relative to the active window. The cursor keys and the F4 function key only operate in the active window. The Error, Help, and Status windows cannot be made active. See Also Window Cursor Window Delete...
  • Page 426: Window Cursor

    Chapter 9: Debugger Commands Window Cursor Window Cursor The Window Cursor command sets the cursor position in the window specified by < user_window_nmbr> . The top left corner of the window is represented by coordinates 0,0. Subsequent output to the window begins at the cursor position. Only user-defined windows and the standard I/O window (window No.
  • Page 427: Window Delete

    Chapter 9: Debugger Commands Window Delete Window Delete The Window Delete command removes a window (possibly a screen) defined previously with the Window New command. Remove a window by entering the window’s associated window number. If you do not specify a window number or if you specify 0, the active window is removed.
  • Page 428: Window Erase

    Chapter 9: Debugger Commands Window Erase Window Erase The Window Erase command clears all displayed information in the specified window. It then places the cursor in the specified window to the 0,0 position. If you do not specify a window number or if you specify 0, the active user-defined window is cleared.
  • Page 429: Window New

    Chapter 9: Debugger Commands Window New Window New The Window New command makes (creates) new windows and screens. It may also be used to move existing windows to a new location within a screen. Windows must be assigned a number between 50 and 256 inclusive. Numbers 1 through 49 are reserved for predefined debugger windows.
  • Page 430 Chapter 9: Debugger Commands Window New Command Parameters Definition of the Window New command parameters are as follows: Parameter Definition Range < user_window_nmbr> Window number 50 to 256 inclusive < user_screen_nmbr> User_Screen 4 to 256 inclusive < top row> Upper row coordinate 0 to N-1 inclusive <...
  • Page 431 Chapter 9: Debugger Commands Window New Window Screen_On Window Toggle_View Examples To make a new user window, number it 57, and display it in user screen 4 with upper-left corner at coordinates 5,5 and the lower right corner at coordinates 18,78: Window New 57 User_Screen 4 Bounds 5,5,18,78 To make a new user window, number it 55, and display it in the high-level...
  • Page 432: Window Resize

    Chapter 9: Debugger Commands Window Resize Window Resize The Window Resize command lets you change the size and position of the active window interactively. The cursor keys (left, right, up, and down arrows) move either the top left corner, or the bottom right corner of the window. To reposition the top left corner, press T and position the top left corner of the window using the cursor control keys.
  • Page 433 Chapter 9: Debugger Commands Window Screen_On Window Screen_On The Window Screen_On command displays the selected screen. You can also use function key F6 to display a screen. If the high level screen is displayed, the debugger is placed in the high level mode.
  • Page 434 Chapter 9: Debugger Commands Window Toggle_View Window Toggle_View The Window Toggle_View command selects the alternate view of a window. Typically, this is an enlarged view of the window. If you do not specify a window number or if you specify 0, the active window is the default. When you execute the Window Toggle_View command, the display alternates between the two views of the window.
  • Page 435 Chapter 9: Debugger Commands Window Toggle_View You can also use the F4 function key to alternate views of the active window. To create alternate views of a user-defined window, follow the procedure outlined in the Window New command description. See Also Window Active Window Cursor Window Delete...
  • Page 436 Chapter 9: Debugger Commands Window Toggle_View...
  • Page 437: Expressions And Symbols In Debugger Commands

    Expressions and Symbols in Debugger Commands A description of the expressions and symbols you can use in debugger commands.
  • Page 438 Chapter 10: Expressions and Symbols in Debugger Commands Expressions and Symbols in Debugger Commands This chapter discusses the following language elements used in debugger commands: • Expression elements. • Formatting expressions. • Symbolic referencing. Debugger commands use standard C operators and syntax. This chapter describes the elements of C expressions and how expressions are structured.
  • Page 439: Expression Elements

    Chapter 10: Expressions and Symbols in Debugger Commands Expression Elements Expression Elements Most debugger commands require simple C expressions that evaluate to a scalar value. Simple C expressions are the same as standard algebraic expressions. These expressions evaluate to a single scalar value. Expressions consist of the following elements: •...
  • Page 440 Chapter 10: Expressions and Symbols in Debugger Commands Expression Elements Supported C Operators Operators Order of Association Left to right -> Right to left sizeof (type) – & Left to right Left to right – Left to right << >> Left to right <...
  • Page 441: Constants

    Chapter 10: Expressions and Symbols in Debugger Commands Expression Elements Identifies a stack level, reserved symbols, or symbol tree root. For example: Program Display_Source @2 (stack level) Expression Display_Value @module (reserved symbol) Symbol Display Default @ecs\\ (symbol tree root) ’ ’ Identifies a character constant.
  • Page 442 Chapter 10: Expressions and Symbols in Debugger Commands Expression Elements following table lists the legal prefixes or suffixes that may be specified with integer constants to denote a specific base. Integer Constant Prefixes and Suffixes Constant Prefix Suffix Base Digit Type Descriptor Descriptor...
  • Page 443 Chapter 10: Expressions and Symbols in Debugger Commands Expression Elements Prefix and Suffix Descriptor Examples Constant Decimal Mode Hexadecimal Mode Decimal Decimal 0EFF1h Hexadecimal Hexadecimal Binary Hexadecimal 0x2214 Hexadecimal Hexadecimal 23C3 Illegal Hexadecimal Decimal Hexadecimal Floating Point Constants The debugger represents floating point constants internally in standard IEEE binary format.
  • Page 444 Chapter 10: Expressions and Symbols in Debugger Commands Expression Elements Examples: 76.3e-1 76.3 –0.3e1 76.3E+0 76.e5 76.3E2 Character Strings and Character Constants Character Strings. A character string is a sequence of one or more ASCII characters enclosed in double quotation marks or two or more characters enclosed in single quotes.
  • Page 445 Chapter 10: Expressions and Symbols in Debugger Commands Expression Elements "This is a string that’s using a single embedded quotation mark" Non-Printable Character Escape Sequences Sequence ASCII Name Hex Value Description Back Space Form Feed New Line Carriage Return Horizontal Tab \"...
  • Page 446: Symbols

    Chapter 10: Expressions and Symbols in Debugger Commands Symbols Symbols A symbol (also called an identifier) is a name that identifies a location in memory. It consists of a sequence of characters that identify program and debugger variables, macros, keywords,registers, memory addresses, and line numbers.
  • Page 447: Debugger Symbols

    Chapter 10: Expressions and Symbols in Debugger Commands Symbols counterpart(_main). However, with symbols on demand, only the high-level symbol is available (main). Debugger Symbols Debugger symbols can be added during a debugging session using the Symbol Add command. The debugger treats debugger symbols as global symbols. When you create a debugger symbol, you must assign it a name.
  • Page 448: Reserved Symbols

    Chapter 10: Expressions and Symbols in Debugger Commands Symbols Reserved Symbols Reserved symbols are reserved words that represent processor registers, status bits, and debugger control variables. These symbols are always recognized by the debugger. You can use reserved symbols any time during a debugging session.
  • Page 449: Addresses

    Chapter 10: Expressions and Symbols in Debugger Commands Addresses Addresses An address may be represented by any C expression that evaluates to a single value. The C expression can contain symbols, constants, line numbers, and operators. Code Addresses Code addresses refer to the executable portion of a program. In high level mode, expressions that evaluate to a code address cannot contain numeric constants or operators.
  • Page 450 Chapter 10: Expressions and Symbols in Debugger Commands Addresses To display code as bytes starting at line number 82 and ending at address 10d0 (hex): Memory Display Byte #82..0x10d0 To display code as bytes, starting at memory location tick_clock and ending at 20 bytes past tick_clock: Memory Display Byte tick_clock..+20 To map memory to RAM, starting at memory address 3000h and ending 0fffh...
  • Page 451: Keywords

    Chapter 10: Expressions and Symbols in Debugger Commands Keywords Keywords Keywords are macro conditional statements that can be used in a macro definition. These keywords are very similar to the C language conditional statements. You cannot redefine keywords or use them in any other context. The debugger keywords are listed below.
  • Page 452: Forming Expressions

    Chapter 10: Expressions and Symbols in Debugger Commands Forming Expressions Forming Expressions The debugger groups expressions into two classes: • Assembly language expressions used in assembly level mode. • Source language expressions used in either assembly level mode or high level mode.
  • Page 453: Expression Strings

    Chapter 10: Expressions and Symbols in Debugger Commands Expression Strings Valid Expressions Expression Meaning Line number reference (code address) Symbol reference (value or address) x+ (y*5) Arithmetic operation (value or address) default_targets[2] Array reference (value or address) assign_vectors Function name reference (code address) Expression Strings An expression string is a list of values separated by commas.
  • Page 454: Symbolic Referencing

    Chapter 10: Expressions and Symbols in Debugger Commands Symbolic Referencing Symbolic Referencing The debugger references symbols in a different manner than the standard C language definition. Therefore, understanding how variables are allocated and stored in memory is important. The following sections describe symbol storage classes and data types.
  • Page 455: Data Types

    Chapter 10: Expressions and Symbols in Debugger Commands Symbolic Referencing In C, static variables local to a module can only be accessed by functions in that module. In the debugger, static variables local to a module can be accessed either when a function is active in that module or when the variable is qualified by the module name in which it is defined.
  • Page 456 Chapter 10: Expressions and Symbols in Debugger Commands Symbolic Referencing debugger treats these types as unsigned char, unsigned short int, and unsigned long, respectively. A segment attribute indicates whether a variable was defined in a code segment or a data segment. Source language modules may contain any valid C language data type.
  • Page 457 Chapter 10: Expressions and Symbols in Debugger Commands Symbolic Referencing High Level Complex Data Types Type Size struct Combined size of members (plus possible padding) union Size of largest member array Combined size of elements Type Conversion The debugger does data type conversions under the following conditions: •...
  • Page 458: Special Casting

    Chapter 10: Expressions and Symbols in Debugger Commands Symbolic Referencing Unlike C, the debugger allows casting to an array. The following example casts the address of the symbol int_value to an array of four chars: (char[4]) &int_value This type of casting to an array can be used with both the Expression Display_Value and Expression Monitor_Value commands.
  • Page 459: Scoping Rules

    Chapter 10: Expressions and Symbols in Debugger Commands Symbolic Referencing (H W) This type cast coerces an expression into a word (2 bytes). For example, assuming the symbol int_val has the value 0x12345678, Expression Display_Value (H W) int_val will cause int_val to be displayed as 0x5678. (H B) This type cast coerces an expression into a byte.
  • Page 460 Chapter 10: Expressions and Symbols in Debugger Commands Symbolic Referencing Non-program symbol tree. This tree is composed of non-program symbols. Only one non-program symbol tree exists. This tree is made up of: • debugger symbols (@PC, @SP, etc.) • macros •...
  • Page 461 Chapter 10: Expressions and Symbols in Debugger Commands Symbolic Referencing Module Names The C language does not contain the concept of a module. Within the context of the debugger, a module is a scoping level which is identical to the scoping level of a file in C.
  • Page 462 Chapter 10: Expressions and Symbols in Debugger Commands Symbolic Referencing Symbolic Referencing With Explicit Roots Example Comment Display symbols scoped under the program root Symbol Display Default @a_out\\ a_out. Display symbols scoped under the current root. Symbol Display Default \ Display symbol information for module mod1 Symbol Display Default scoped under program root a_out.
  • Page 463: Evaluating Symbols

    Chapter 10: Expressions and Symbols in Debugger Commands Symbolic Referencing Symbolic Referencing With Explicit Roots Example Comment Notes: The variable mod1 must be a module name. The variable func1 must be a function name. The example pairs are equivalent if the current root is a_out. Symbolic Referencing Without Explicit Roots Example Comment...
  • Page 464: Stack References

    Chapter 10: Expressions and Symbols in Debugger Commands Symbolic Referencing • Function names and labels evaluate to addresses. • Variables generally evaluate to the contents of the memory location at the address of the variable (the exception is unsubscripted array names which evaluate to addresses.) The examples in the following table show the differences in evaluation of these symbol types.
  • Page 465 Chapter 10: Expressions and Symbols in Debugger Commands Symbolic Referencing • To refer to variables on the stack in the current function, specify the name of the variable. For example: x. • To refer to a local variable in a nested function, specify the function name followed by a backslash and then the name of the local variable, for example, main\i.
  • Page 466 Chapter 10: Expressions and Symbols in Debugger Commands Symbolic Referencing...
  • Page 467: Predefined Macros

    Predefined Macros...
  • Page 468 Predefined Macros Predefined macros are provided with the debugger. These predefined macros provide commonly used functions to help in debugging your program. The predefined macros available for your use are listed in the “Predefined Debugger Macros” table and are described on the following pages. The following predefined debugger macros provide services to the SIMIO system and internal debugger functions.
  • Page 469: Break_Info

    Chapter 11: Predefined Macros Predefined Debugger Macros Macro Description break_info Display information about a breakpoint byte Return a byte value at the specified address Call target function (not supported in this product) call close Close a UNIX file dword Return a long value at the specified address Display error message error fgetc...
  • Page 470 Chapter 11: Predefined Macros break_info break_info Function Return information about a breakpoint Synopsis int break_info (addr) unsigned long *addr; Description The break_info macro returns the address and type of a breakpoint if it is called when a breakpoint is encountered. The macro returns the 32-bit representation of the breakpoint address used by the debugger and the following values for breakpoint type: The cause of the breakpoint is unknown.
  • Page 471 Chapter 11: Predefined Macros break_info Example If you have the following code segment: main() auto i,j,k; i = 1; j = 3; k = i + j; and you execute the following command file: Debugger Macro Add int print_info() unsigned long address; int reason;...
  • Page 472: Byte

    Chapter 11: Predefined Macros byte byte Function Return a byte value at the specified address Synopsis unsigned char byte (addr) void *addr; Description The byte macro returns a byte value of the memory contents at the specified address. The value of the expression addr is computed and used as the address. Diagnostics The byte value of the memory contents at the specified address is returned.
  • Page 473: Close

    Description The close macro closes a UNIX file. This macro is an interface to the UNIX system call close(2). Refer to the HP-UX Reference Manual for detailed information. Diagnostics If the system call to close(2) is successful, 0 is returned. Otherwise, -1 is returned and a system generated error message is written to the journal window of the debugger.
  • Page 474: Dword

    Chapter 11: Predefined Macros dword dword Function Return a long value at the specified address Synopsis unsigned long dword (addr) void *addr; Description The dword macro returns a LONG (4-byte) value of the memory contents at the specified address. The value of the expression addr is computed and used as the address.
  • Page 475: Error

    Chapter 11: Predefined Macros error error Function Display error message Synopsis void error(level, text, parm) level; char *text; long parm; Description The error() macro is used to display error messages due to errors generated within macros. level must have a value of 1, 2, or 3. text is a string which can contain one %d format character, where parm is the associated integer value.
  • Page 476: Fgetc

    Chapter 11: Predefined Macros fgetc fgetc Function Reads character from file Synopsis int fgetc(vp_num) int vp_num; Description The macro fgetc() returns the next character in the file associated with the window number vp_num. The window number must be a result of the File User_Fopen command.
  • Page 477: Fopen

    Chapter 11: Predefined Macros fopen fopen Function Open a file and associate it with a user window Synopsis int fopen(vp_num, filename, mode) vp_num; char *filename; char *mode; Description The macro fopen() opens a file and associates it with a user-defined window. This macro is equivalent to the File User_Fopen debugger command.
  • Page 478: Getsym

    Chapter 11: Predefined Macros getsym getsym Function Return the symbol associated with an address, if any exists Synopsis char *getsym (addr) void *addr; Description The getsym macro returns, as a character string, the symbol associated with the address argument. The address argument must coincide with the symbol address for the macro to return the symbol name;...
  • Page 479: Inport

    Chapter 11: Predefined Macros inport inport Function Advance the input data from its source Synopsis unsigned long inport (addr, size) void *addr; unsigned size; Description The inport macro moves size bytes of data into the port address specified by addr when the macro is executed. The value of size can be 1, 2, or 4. This macro allows inport buffers to receive new data from the defined source.
  • Page 480: Isalive

    Chapter 11: Predefined Macros isalive isalive Function Check the status of a specified symbol Synopsis int isalive (symbol_name) void symbol_name; Description The isalive macro can tell you whether a symbol is defined, and additionally if it currently active or available on the stack. Diagnostics Returns one of the following four values, depending on the status of the symbol:...
  • Page 481: Key_Get

    Chapter 11: Predefined Macros key_get key_get Function Get a key from the keyboard Synopsis unsigned short key_get() Description The macro key_get() reads a key from the keyboard. It returns only after a key is available. The return value is the value of the key.
  • Page 482: Key_Stat

    Chapter 11: Predefined Macros key_stat key_stat Function Check keyboard for availability of key Synopsis unsigned short key_stat() Description The key_stat() macro checks the keyboard to see if a key is available to read. It returns 0 if no key is available. The first pending key is returned if any keys are available.
  • Page 483: Memchr

    Chapter 11: Predefined Macros memchr memchr Function Search for character in memory Synopsis char *memchr (str1, byte_value, count) char *str1; char byte_value; unsigned count; Description The memchr macro locates the character byte_value in the first count bytes of memory area str1. Diagnostics The memchr macro returns a pointer to the first occurrence of character byte_value in the first count characters in memory area str1.
  • Page 484: Memclr

    Chapter 11: Predefined Macros memclr memclr Function Clear memory bytes Synopsis char *memclr (dest, count) char *dest; unsigned count; Description The memclr macro sets the first count bytes in memory area dest to zero. Diagnostics The memclr macro returns dest.
  • Page 485: Memcpy

    Chapter 11: Predefined Macros memcpy memcpy Function Copy characters from memory Synopsis char *memcpy (dest, src, count) char *dest, char *src unsigned count; Description The memcpy macro copies count characters from memory area src to dest. Diagnostics The memcpy macro returns dest.
  • Page 486: Memset

    Chapter 11: Predefined Macros memset memset Function Set the value of characters in memory Synopsis char *memset (dest, byte_value, count) char *dest; char byte_value; unsigned count; Description The memset macro sets the first count characters in memory area dest to the value of character byte_value.
  • Page 487: Open

    These modes may be combined be adding the appropriate values together. This macro is an interface to the UNIX system call open(2). Refer to the HP-UX Reference Manual for detailed information. Diagnostics If the system call to open(2) is successful, the system file descriptor is returned.
  • Page 488 Chapter 11: Predefined Macros open Example The following command file segment defines two global debugger symbols and includes the definition of a user-defined macro that uses open(). Symbol Add int infile Symbol Add int outfile Debugger Macro Add int open_files(infile, outfile) char *infile;...
  • Page 489: Outport

    Chapter 11: Predefined Macros outport outport Function Write a value to the simulated memory-mapped outport port Synopsis char outport (addr, size, value) void *addr; unsigned size; long value; Description The outport macro moves size bytes of the data value from the port specified by addr.
  • Page 490: Read

    Description The read macro reads from a system file. This macro is an interface to the UNIX system call read(2). Refer to the HP-UX Reference Manual for detailed information. Diagnostics If the system call to read(2) is successful, the number of bytes read is returned.
  • Page 491: Reg_Str

    Chapter 11: Predefined Macros reg_str reg_str Function Get register value Synopsis unsigned long reg_str(str1) char *str1; Description The reg_str macro gets the contents of a register using a string variable representation of its name. This is not possible using standard debugger commands.
  • Page 492: Showversion

    Chapter 11: Predefined Macros showversion showversion Function Show the software version number for the debugger product Synopsis void showversion () Description The showversion macro lists the software version number for your debugger product.
  • Page 493: Strcat

    Chapter 11: Predefined Macros strcat strcat Function Concatenate two strings Synopsis char *strcat (dest, src) char *dest, *src; Description The strcat macro appends a string to the end of another string. The string in src is appended to the string in dest and a pointer to dest is returned. Diagnostics No checking is done on the size of dest.
  • Page 494: Strchr

    Chapter 11: Predefined Macros strchr strchr Function Locate first occurrence of a character in a string Synopsis char *strchr (str1, byte_value) char *str1; char byte_value; Description The strchr macro returns a pointer to the first occurrence of the character byte_value in the string str1, if byte_value occurs in str1. Diagnostics If the character byte_value is not found, strchr returns a NULL pointer.
  • Page 495: Strcmp

    Chapter 11: Predefined Macros strcmp strcmp Function Compare two strings Synopsis unsigned long strcmp (str1, str2) char *str1, char *str2; Description The strcmp macro compares strings in lexicographic order. Lexicographic order means that characters are compared based on their internal machine representation.
  • Page 496: Strcpy

    Chapter 11: Predefined Macros strcpy strcpy Function Copy a string Synopsis char *strcpy (dest, src) char *dest, char *src; Description The strcpy macro copies src to dest until the NULL character is moved. (Copying from the right parameter to the left resembles an assignment statement.) A pointer to dest is returned.
  • Page 497: Stricmp

    Chapter 11: Predefined Macros stricmp stricmp Function Comparison of two strings without case distinction Synopsis unsigned long stricmp (str1, str2,) char *str1; char *str2; Description The stricmp macro compares str1 with str2 without case distinction. This means that the strings "ABC" and "abc" are considered to be identical. The strings str1 and str2 are compared and a result is returned according to the following relations: relation...
  • Page 498: Strlen

    Chapter 11: Predefined Macros strlen strlen Function String length Synopsis unsigned long strlen (str1) char *str1; Description The strlen macro returns the length of a string. It returns the length of str1, excluding the NULL character. Diagnostics If str1 is not properly terminated by a NULL character, the length returned is invalid.
  • Page 499: Strncmp

    Chapter 11: Predefined Macros strncmp strncmp Function Limited comparison of two strings Synopsis unsigned long strncmp (str1, str2, count) char *str1; char *str2; unsigned count; Description The strncmp macro compares strings in lexicographic order. Lexicographic order means that characters are compared based on their internal machine representation.
  • Page 500: Until

    Chapter 11: Predefined Macros until until Function Run until expression is true Synopsis char until (boolean) int boolean; Description The until macro returns a zero when boolean is nonzero. The Until macro is used with the Program Run and Program Step With_Macro commands. It halts execution when the expression passed is true, and continues when the expression passed is false.
  • Page 501: When

    Chapter 11: Predefined Macros when when Function Break when expression is true Synopsis char when (boolean) int boolean; Description The when macro returns a zero when boolean is nonzero; it returns a one when boolean is zero. This macro is used with the Breakpt Instr command. When used with this command, program execution will halt when the stated expression is true, and will continue when the stated expression is false.
  • Page 502: Word

    Chapter 11: Predefined Macros word word Function Return a word value at the specified address Synopsis unsigned short int word (addr) void *addr; Description The word macro returns a WORD (2-byte) value of the memory at the specified address. The value of the expression addr is computed and used as the address.
  • Page 503: Write

    Description The write macro writes to a system file. This macro is an interface to the UNIX system call write(2). Refer to the HP-UX Reference Manual for detailed information. Diagnostics If the system call to write(2) is successful, the number of bytes written is returned.
  • Page 504 Chapter 11: Predefined Macros write...
  • Page 505: Debugger Error Messages

    Debugger Error Messages A list of the error messages generated by the debugger.
  • Page 506 Chapter 12: Debugger Error Messages The debugger displays the error window whenever it detects a command error. The debugger displays an error message and a pointer to the location where it detected the error. This chapter lists and describes the error messages and warnings issued by the debugger.
  • Page 507 Chapter 12: Debugger Error Messages Invalid characters follow command. A command was entered with incorrect characters or with more characters than were expected. Check the command name and re-enter the command. This command is not implemented yet. The command specified is currently not supported, but will be implemented in a later release.
  • Page 508 Chapter 12: Debugger Error Messages Missing ’ ( ’, ’ [ ’, or ’ { ’ in expression. The matching left parentheses, left bracket, or left curly brace in the specified expression is missing. Check the expression and add the appropriate left delimiter.
  • Page 509 Chapter 12: Debugger Error Messages Invalid instruction address. This error occurs mainly in high-level mode. In high-level mode, this error will occur if the instruction address is not a function name or line number. Code addresses in high-level mode may not be numeric or expressions. In assembly-level mode, most instruction address values are legal.
  • Page 510 Chapter 12: Debugger Error Messages Invalid screen specification. The command entered contains a screen specification that does not correspond to the screen where the specified window is located, or the specified screen does not exist. The screen number should be verified. Invalid window specification.
  • Page 511 Chapter 12: Debugger Error Messages Cannot divide by zero. An attempt was made to divide by zero within an expression of Expression Display_Value or Expression C_Expression. This feature not available in this version. This command cannot be used in this mode. A command that is not supported in the current mode was issued.
  • Page 512 Chapter 12: Debugger Error Messages Line number not found. The line number specified does not exist in the current module. If the line number exists in a different module, the module name must be specified. Symbol not found. The symbol name was entered incorrectly, or the symbol does not exist. The symbol name may have been mistyped.
  • Page 513 Chapter 12: Debugger Error Messages Port output does not go to a file. Only port output directed to a file may be rewound with the Memory Port Rewind Output command. This breakpoint is already set. An attempt was made to set a breakpoint that already exists. The current breakpoint must be deleted before it can be reset.
  • Page 514 Chapter 12: Debugger Error Messages Invalid level number. Must be 1 to 7. The Program Interrupt Add command, as well as the 68000 family of microprocessors, permit 7 levels of interrupts. Attempt to delete nonexistent breakpoint(s). You tried to clear a breakpoint that was not previously set. Check that the breakpoint was set, or not already cleared.
  • Page 515 Chapter 12: Debugger Error Messages Invalid processor name. This error indicates that you specified a processor other than one supported by your debugger. See your user’s guide for a list of supported microprocessors. Breakpoint limit exceeded. The number of breakpoints allowed has been exceeded. This breakpoint has not been set.
  • Page 516 Chapter 12: Debugger Error Messages Cannot build disassembly table. There is not sufficient memory available to build the disassembly table for up-arrow and page-up support in the disassembler. Cannot split monitor lines. An attempt was made to monitor different elements on the same line. Only one element per line may be monitored.
  • Page 517 Chapter 12: Debugger Error Messages Not a color monitor. Not enough memory. This error indicates that not enough memory was available for the specified command. Terminated when processing absolute file. This error indicates that an invalid control value was encountered in loading the ".x"...
  • Page 518 Chapter 12: Debugger Error Messages This command not allowed from a macro. Some commands are not allowed from a macro, such as Debugger Host_Shell and Debugger Macro Add. Invalid float expression, results in NAN. A floating point expression resulted in a non-number. Cannot convert float value.
  • Page 519 Chapter 12: Debugger Error Messages Cannot create file for logging. This error indicates that there was an error when trying to create the specified log file or that the current directory does not have write permission. Write error occurred while writing to a file. This error indicates that the disk is probably full.
  • Page 520 One possible error message is: No valid BBA spec file for < processor> processor You must have the HP Branch Validator product for your processor installed on your system in order to use the Memory Unload_BBA command. Miscellaneous warning.
  • Page 521 Chapter 12: Debugger Error Messages Miscellaneous note. This is a message from the emulator which was not processed by the debugger. All available information is displayed on the screen. Any one of a number of notice messages may be displayed on your screen. Miscellaneous fatal error.
  • Page 522 Chapter 12: Debugger Error Messages Invalid type for this argument, expecting a number. The command was expecting a number. Re-enter the command with a number. Cannot delete: more than one symbol with this name. Multiple symbols with the same name exist. More fully qualify the symbol to make it unique and then retry the command.
  • Page 523 Chapter 12: Debugger Error Messages Bad command for current context (No root, start, etc.) Ambiguous member name, must qualify with more local class. The referenced C+ + member function may be one of several function which have the same name. Use a class name to be more specific. Cannot currently access via virtual base class.
  • Page 524 Chapter 12: Debugger Error Messages...
  • Page 525: Debugger Versions

    Debugger Versions Information about how this version of the debugger differs from previous versions.
  • Page 526: Version C.06.20

    Chapter 13: Debugger Versions Version C.06.20 New options to format displayed expression values The Expression Display_Value command has new options to force a variable to be displayed as a decimal number, a hexadecimal number, or a string. Revision numbers changed All hosts have been brought to the same revision number.
  • Page 527: Version C.05.20

    Demand loading is now default Demand loading now defaults ON for products that support it. These are currently the products using HP/MRI IEEE-695 file format executables. Startup files will override the default, and the -d and -doff command line options will override both the startup and the default.
  • Page 528: Version C.05.10

    16 million symbols. More Global Symbols The maximum number of global symbols that can be read from an HP-MRI IEEE-695 file has been increased from 8000 to 64K symbols. Radix Option Side Effects Input and output values are interpreted as hexadecimal only for assembly-level references.
  • Page 529 The debugger’s old standard interface may still be used. New Product Number The old product number of this debugger was HP 64360 for HP 9000 Series 300 computers. The new number is HP B1466. New Reserved Symbols @ENTRY is the address of the first executable statement in a function.
  • Page 530 Chapter 13: Debugger Versions Environment Variable Expansion Operating system environment variables will now be expanded when they appear in a debugger command. For example, "Debugger Directory Change_working $HOME/test" will now work as expected. Target Program Function Calls You may now reference target program functions in C expressions. Target and debugger variables may be passed by value, and target variables may be passed by reference.
  • Page 531: Part 5 Installation Guide

    Part 5 Installation Guide...
  • Page 532 Part 5...
  • Page 533: Installation

    Installation How to install the debugger software on your computer.
  • Page 534: Installation At A Glance

    Chapter 14: Installation Installation at a Glance Installation at a Glance The debugger/simulator is a tool for debugging C programs for 68000 series microprocessors in a simulated execution environment. Follow these steps to install the debugger: 1 Install the software on your computer.
  • Page 535: Supplied Filesets

    However, to save disk space, or for other reasons, you can choose to install selected filesets. C Compiler Installation Some older versions of HP C Cross Compilers will overwrite the file $HP64000/bin/db68k, making the graphical interface unavailable. If you encounter this problem, install the C compiler before you install the debugger...
  • Page 536: To Install Software On An Hp 9000 System

    • HP 9000 Series 300/400 computer running HP-UX version 8.01 or later, or HP 9000 Series 700 computer running HP-UX version 8.01 or later. To check the HP-UX operating system version, enter the uname -a command at the HP-UX prompt. If the version number of the HP-UX operating system is less than 8.01, you must update the operating system...
  • Page 537: Step 1. Install The Software

    /etc/update at the HP-UX prompt. 6 When the HP-UX update utility main screen appears, confirm that the source and destination devices are correct for your system. Refer to your HP-UX System Administration documentation if you need to modify these values.
  • Page 538 Chapter 14: Installation To install software on an HP 9000 system 8 To begin the update, press the softkey < Select Item> . At the next menu, press the softkey < Select Item> again. Answer the last prompt with y. It takes about 20 minutes to read the tape.
  • Page 539: To Install The Software On A Sun Sparcsystem

    IPC facilities, see the Sun System and Network Administration manual. • At least 16 megabytes of memory (for the graphical user interface). • Color display (optional, but recommended for the graphical user interface). • Approximately 16 Mbytes of disk space. • HP B1466 debugger/simulator software.
  • Page 540: Step 1: Install The Software

    Step 1: Install the software For instructions on how to install software on your SPARCsystem, refer to the HP 64000-UX for SPARCsystems— Software Installation Guide. Normally you should install all of the filesets on the tape. Step 2: Map your function keys...
  • Page 541 Chapter 14: Installation To install the software on a Sun SPARCsystem™ setenv KEYMAP sun.2-9 If you use xterm windows (the xterm window program is located in the directory /usr/openwin/demo), type: setenv KEYMAP xterm.2-9 Reminder: If you are using OpenWindows, add /usr/openwin/bin to the end of the $PATH definition, and add the following line to your .profile: setenv OPENWINHOME /usr/openwin...
  • Page 542: To Set Up Your Software Environment

    Windows application. A window manager is not required to execute the interface, but, as a practical matter, you must use some sort of window manager with the X server. • If you are using an HP workstation, start the X server and the Motif window manager by entering: x11start •...
  • Page 543: To Start Hp Vue

    To set up your software environment To start HP VUE If you will be using the X server under HP VUE and have not started HP VUE, do so now. HP VUE differs slightly from other window managers in that it does not read your .Xdefaults file to find resources you may want to customize.
  • Page 544: To Set Environment Variables

    • Set the PATH environment variable to include the usr/hp64000/bin directory. • Set the MANPATH environment variable. For the ksh login shell (most HP systems), set a variable by entering export <variable>=<value> For the csh login shell (most Sun systems), set a variable by entering setenv <variable>...
  • Page 545 If your system is named "myhost," set the display variable by typing: export DISPLAY=myhost:0.0 If you installed the HP 64000 software in the root directory, "/", enter: export HP64000=/usr/hp64000 export PATH=$PATH:$HP64000/bin If you installed the software in the directory /users/team, enter:...
  • Page 546: To Verify The Software Installation

    Near the end of the file, there will be resource strings that contain references to specific microprocessors. For example, if you installed the debugger graphical interface for the 68000 series microprocessors, resource name strings will have “debug*m68000” embedded in them.
  • Page 547 Glossary absolute file An executable module generated by compiling, assembling, and linking a program. Absolute files must have an extension of .x. action key User-definable buttons in the graphical interface which allow quick access to often-used commands. application default file A file containing default X resource specifications for an X Window System application.
  • Page 548 Glossary concurrent usage model Describes an interface in which the user can perform most comands at the same time that code is being executed under emulation. configuration file See “emulator configuration file”. cooked keyboard I/O mode The I/O mode in which keyboard input is processed.
  • Page 549 Hardware or software used to execute program code. Examples include an emulator, a target system with a ROM monitor, a target system with an HP E3490A software probe, or a simulator. foreground monitor An emulation monitor program that executes as part of the user program.
  • Page 550 Glossary patch A small, temporary change to executable code. PITS cycle Programming In The Small cycle. The repeating process of editing, compiling, and executing code to eliminate bugs. pointer The symbol on your computer’s screen which shows where the mouse is pointing.
  • Page 551 A software tool that simulates a microprocessor system for the purpose of debugging user programs. Software Probe The HP E3490A software probe is a low-cost alternative to an emulator. It uses the processor’s Background Debug Mode to control execution and to access registers and memory. Because it does not include an analyzer, the HP E3490A software probe does not support read/write breakpoints or trace analysis.
  • Page 552 Glossary trace A collection of states captured on the emulation bus (in terms of the emulation bus analyzer) or on the analyzer trace signals (in terms of the external analyzer) and stored in trace memory. trace event A bus state consisting of a combination of address, data, and status values.
  • Page 553 133–134 add symbol, 120 address operator, 29 addresses, 427–428 assembly level code, 427 code, 427 data, 427 displaying variable, 29 ranges, 427 alternate view of a window, 132 app-defaults directory HP 9000 computers, 252 Sun SPARCsystem computers, 252...
  • Page 554 Index append programs, 82 application default file, 525 application resource See X resource arguments for macros, 189 assembly code in source display, 221 assembly level code addresses, 427 assembly-level screen description of, 125 displaying, 126 moving status window, 228 background monitor, 525 backtrace window backtrace information, 147 description of, 146...
  • Page 555 Index breakpoints automatic alignment, 216 C+ + , 92–93 checking definitions of, 96 clearing, 94 commands, summary of, 262 controlling program execution with, 90–99 definition, 525 deleting, 23, 94 removing, 94–95 setting, 20 use macros with, 198 Breakpt Access command, 267–268 Breakpt Clear_All command, 269 Breakpt Delete command, 270 Breakpt Erase command, 271...
  • Page 556 Index calling a macro, 187 CALLM instruction, 72 cascade menu, 525 case-sensitivity, 299 casting, special, 436 changes to the debugger, 69 changing active window, 131 characters constants, 422 non-printable, 422 string constants, 422 check breakpoint definitions, 96 check simulated I/O resource usage, 171 class name X applications, 251 X resource, 249...
  • Page 557 Index command files (continued) logging commands to, stop, 206 playback, 206 startup, 329 command language address ranges, 427 addresses, 427–428 assembly level code addresses, 427 C operators, 417 C+ + operators, 418 character constants, 422 character string constants, 422 code addresses, 427 constants, 419 data addresses, 427 data types, 433...
  • Page 558 Index command language (continued) operators, 417 program symbols, 424 referencing symbols, 437 register storage classes, 433 reserved symbols, 426 root names, 437 scoping rules, 437 special casting, 436 stack references, 442 static storage classes, 432 storage classes, 432 symbol length, 424 symbolic referencing, 432–444 symbolic referencing with explicit roots, 439 symbolic referencing without explicit roots, + , 441...
  • Page 559 Index commands editing in command line entry area, 59–60, 64 entering, 37, 39–70 entering from keyboard, 62 entering in command line, 58 executing in command line, 58 function key, 39 logging to command file, start, 204 logging to command file, stop, 206 playback from command file, 206 recalling with command line recall, 64 recalling with dialog box, 60...
  • Page 560 Index CPU state, 104 current working directory, displaying, 143 cursor keys descriptions, 133 End (Shift_Home) Key Functions, 134 Home Key Functions, 134 cut buffer See entry buffer cycle count pseudoregister @cycles, 88, 144 data addresses, 427 data types, 433 db68k options -b batch mode, 211 -c command file, 206, 211 -d demand loading of symbols, 83...
  • Page 561 Index debugger options dialog box, 215 Debugger Pause command, 305 Debugger Quit command, 306 debugger symbols See symbols debugger version, 69 decimal, 218 define macros, 192–194 interactively, 192–193 See macros define simulated program interrupts, 100 define user screens and windows, 228 delete breakpoints, 95 delete C source lines from your program, 178 delete macros, 202...
  • Page 562 Index do statement, 190 double-click, 526 dword macro, 452 E/A, 526 editing command line entry area with keyboard, 64 command line entry area with pop-up menu, 60 command line entry area with pushbuttons, 59 copying memory, 181 file, 237 file at address, 175, 237 file at program counter, 175 files, 174–175 macros, 194...
  • Page 563 Index entry buffer (continued) with action keys, 49–50 with pull-down menus, 49 Entry Buffer Recall dialog box operation, 51 environment dependent files, 73 environment variables HP64_DEBUG_PATH, 78 MANPATH, 522 erase information in window, 230 error macro, 453 error window, description of, 484 errors exception processing option, 219 evaluating symbols, 441...
  • Page 564 Index fgetc macro, 454 File Command command, 323 File Error_Command command, 324 File Journal command, 325–326 File Log command, 327–328 File Selection dialog box operation, 51, 53 File Startup command, 329–330 File User_Fopen command, 331–332 File Window_Close command, 333 files absolute, 79–80 appending, 82 command, 203–212...
  • Page 565 90 on instruction at a specified memory location, 91 hand pointer, 45 hardware HP 9000 memory needs, 514 HP 9000 minimum performance, 514 HP 9000 system requirements, 514 SPARCsystem memory needs, 517 SPARCsystem minimum performance, 517...
  • Page 566 Index HP 9000 700 series Motif libraries, 514 HP-UX minimum version, 514 system requirements, 514 HP-UX minimum version, 514 HP64_DEBUG_PATH file search path, 78 iconify, 527 identifier, 424 if statement, 190 implicit stack references, 442 increase simulated I/O file resources, 171...
  • Page 567 429 L indicator character, 68 label scheme, 236, 240, 254 LANG environment variable, 254 level, stack, 99 libraries Motif for HP 9000/700, 514 line numbers, 299, 426 lines in main display area, 238 literals radix, 218 load additional programs, 82 load programs, 79–80...
  • Page 568 Index Macro (debugger status), 67 macros, 185–212 arguments, 189 calling, 187 calling from an expression, 197 calling from within macros, 197 calling on execution of a breakpoint, 198 calling with debugger macro call command, 196 calling with Program Step With_Macro command, 200 comments, 188 control flow statements, 190 copying, 192...
  • Page 569 Index macros (continued) symbols, 425 templates, 192 using with breakpoints, 198 variables, 189 while statement, 190 main(), displaying, 15 make windows active, 131 man pages, setting path to, 522 mapping memory, 105–107 mcc68k See Microtec memchr macro, 461 memclr macro, 462 memcpy macro, 463 memory changing, 180...
  • Page 570 438 module support, 72 monitor window, description of, 155 more display, 224 More prompt, 134 Motif HP 9000/700 requirements, 514 mouse button names, 9 choosing menu items, 42–43 mouse button names, 10–11 move assembly-level status window, 228...
  • Page 571 528 Paused (debugger status), 67 See program counter PITS cycle, 528 platform differences, 10–11 HP 9000 memory needs, 514 HP 9000 minimum performance, 514 SPARCsystem memory needs, 517 SPARCsystem minimum performance, 517 platform scheme, 236, 256 playback command file, 206...
  • Page 572 Index pop-up menus command line editing with, 60 definition, 528 hand pointer indicates presence, 45 shortcuts, 46 using, 45 ports, 108–110 predefined macros, 445, 447–482 break_info, 448–449 byte, 450 close, 451 dword, 452 error, 453 fgetc, 454 fopen, 455 getsym, 456 inport, 457 isalive, 458 key_get, 459...
  • Page 573 Index previous instruction pseudoregister @pi, 144 printf using in debugger, 31 processor resetting, 102 product version, displaying, 143 program commands, summary of, 265 Program Context Display command, 369 Program Context Expand command, 370 Program Context Set command, 371 program counter resetting, 102 run from current address, 86 Program Display_Source command...
  • Page 574 Index programs (continued) running, 84–89 step through, 84 pull-down menus choosing with keyboard, 44 choosing with mouse, 42–43 definition, 528 pushbutton, 528 quick start graphical interface, 3–34 quitting the debugger, 34 R indicator character, 68 radix selecting, 218 radix option, 218, 296, 506 raw mode, 528 re-initialize variables, 183 read macro, 468...
  • Page 575 Index reserved symbols, 426 /dev/simio/display, 166 /dev/simio/keyboard, 166 displaying, 145 simulated I/O, 166 stderr, 166 stdin, 166 stdout, 166 reset processor, 102 reset program counter, 102 reset program variables, 103 resize windows, 226 resource See X resources restart programs, 102–103 return statement, 190 return values in macros, 190 revisions, debugger interface, 69...
  • Page 576 Index screens (continued) displaying next, 127 high-level, 124 high-level, displaying, 126 predefined, 124 reformatting, 226 standard I/O, 125 user-defined, displaying, 229 working with, 124–128 scroll bar, 7, 16, 528 scrolling, 16 "more" mode, 134 setting amount of, 225 sticky slider definition, 529 sequential usage model, 528 server, X, 234, 248, 530 session control commands, summary of, 262...
  • Page 577 Index simulated I/O (continued) processing, 164 redirecting I/O, 169 reserved symbols, 166 special symbols, 166 stderr, 169 stdin, 169 stdout, 169 UNIX Files, 165 UNIX processes, 165 user program symbols, 166 using, 163–172 simulator, 529 using with debugger/emulator, 116 size scheme, 236, 255 skipping functions, 26 slider, sticky, 529 See also scrolling...
  • Page 578 Index stack frame formats, exception, 219 stack pointer, description of, 144 standard I/O screen description of, 125 displaying, 127 erasing information, 230 standard interface definition, 529 installation, 518 start address, run from, 86 starting debugger, 13, 41 logging commands to command file, 204 startup files, 232–233 definition, 529 loading, 233...
  • Page 579 Index stopping debugger, 34 storage classes automatic, 433 global (extern), 432 local, 433 register, 433 static, 432 storage qualification qualifier, definition of, 529 strcat macro, 471 strchr macro, 472 strcmp macro, 473 strcpy macro, 474 stricmp macro, 475 strlen macro, 476 strncmp macro, 477 structures displaying members, 153...
  • Page 580 120, 424 referencing, 437 reserved, 145, 426 types of, 120 system requirements HP 9000 overview, 514 HP-UX minimum version, 514 OSF/Motif HP 9000/700 requirements, 514 SPARCsystem overview, 517 SunOS minimum version, 517 template macro, 192 token, 525 trace See trace measurement...
  • Page 581 Index user-defined screens defining, 228 displaying, 229 removing, 230 user-defined windows defining, 228 erasing information in, 230 removing, 230 variables breaking on access, 30 displaying, 26 displaying address of, 29 initializing, 183 macros, 189 modifying, 176 version, 69 displaying, 143 view information in the active window, 133–134 view window, description of, 143 viewing text, 16...
  • Page 582 See also X windows windows,journal, 325 word macro, 480 words changing, 180 Working (debugger status), 68 working directory, 530 workstation HP 9000 memory needs, 514 HP 9000 minimum performance, 514 SPARCsystem memory needs, 517 SPARCsystem minimum performance, 517 write macro, 481–482...
  • Page 583 Index X client, 234, 248 X resource, 234, 247–258 $XAPPLRESDIR directory, 253 $XENVIRONMENT variable, 253 .Xdefaults file, 252 /usr/hp64000/lib/X11/HP64_schemes, 255 app-defaults file, 252 application-specific, 248 class name for applications defined, 251 class name for debugger, 237 class name for widgets defined, 249 command line options, 253 commonly modified graphical interface resources, 236 Debug.BW, 255...
  • Page 584 Index...
  • Page 585 This Hewlett-Packard system product is warranted against defects in materials and workmanship for a period of 90 days from date of installation. During the warranty period, HP will, at its option, either repair or replace products which prove to be defective.
  • Page 586 For products returned to HP for warranty service, Buyer shall prepay shipping charges to HP and HP shall pay shipping charges to return the product to Buyer. However, Buyer shall pay all shipping charges, duties, and taxes for products returned to HP from another country. HP warrants that its software and firmware designated by HP for use with an instrument will execute its programming instructions when properly installed on that instrument.

This manual is also suitable for:

B1466

Table of Contents