HP 68000 Series User manual

User’s Guide
HP B1466
68000 Series
Debugger/Simulator

Notice
Hewlett-Packard makes no warranty of any kind with regard to this material,
including, but not limited to, the implied warranties of merchantabilityand
fitness for a particular purpose. Hewlett-Packard shall not be liable for errors
contained herein or for incidental or consequential damages in connection
with the furnishing,performance, or use ofthis material.
Hewlett-Packard assumes no responsibility for the use or reliabilityof its
software on equipment that is not furnished byHewlett-Packard.
© Copyright 1989-1992, 1995, Hewlett-Packard Company.
This document contains proprietaryinformation, which is protected by
copyright. All rights are reserved. No part ofthis document maybe
photocopied,reproduced or translated to another language without the prior
written consent of Hewlett-Packard Company. The information contained in
this document issubject to change without notice.
HP-UX 9.* and 10.0 for HP 9000 Series 700 and 800 computers are X/Open
CompanyUNIX 93 branded products.
UNIX® is a registered trademark in the United States and other countries,
licensed exclusivelythrough X/Open CompanyLimited.
Hewlett-Packard Company
P.O . Box 2197
1900 Garden of the Gods Road
Colorado Springs, CO 80901-2197, U.S.A.
RESTRICTED RIGHTS LEGEND Use,duplication, or disclosure bythe U.S.
Government is subject to restrictionsset forth in subparagraph (C) (1) (ii) of
the Rights in Technical Data and Computer Software Clause in DFARS
252.227-7013. Hewlett-Packard Company, 3000 Hanover Street, Palo Alto,
CA 94304 U.S.A.
Rights for non-DOD U.S. Government Departments and Agencies are set
forth in FAR 52.227-19(c)(1,2).
ii

About this edition
Manyproduct updates and fixes do not require manual changes, and manual
correctionsmaybe done without accompanying product changes. 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 B1466-97004, July 1995
B1466-97003 incorporatesinformation which previouslyappeared in
B1466-92000, B1466-92001, B1466-97000, B1466-97001, B1466-97002,
64360-92003, 64360-97011, 64360-97008, and 64360-97009.
Certification and Warranty
Certification and warrantyinformation can be found at the end ofthismanual
on the pagesbefore the back cover.
iii

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 assemblylanguage programsusinga simulator on your host
system.
With the Debugger, You Can ...
•Browse and edit C and C+ + source files.
•ViewC and C+ + functions on the stack.
•Monitor variables as the program executes.
•Viewassemblylanguage code with source lines.
•Viewregisters and stack contents.
•Step through programsbyC or C+ + source linesor byassemblylanguage
instructions.
•Stop programs upon the execution of selected instructionsor upon a read
or write ofselected memorylocations.
•Create conditional breakpoints usingmacros.
•Patch C or C+ + code without recompiling.
•Simulate input and output devices using your computer’s keyboard,
display, and file system.
•Tune code byusing the clock cycle count pseudo register to time code
modules during simulation.
•Save and execute command files.
•Log debugger commands and output.
•Examine the inheritance relationships ofC+ + classes.
With the Graphical Interface You Can ...
•Use the debugger under an X WindowSystem that supports OSF/Motif
interfaces.
•Enter debugger commands using pull-down or pop-up menus.
•Set source-level breakpoints using the mouse.
iv

•Create custom action keys for commonlyused debugger commands or
command files.
•Viewsource code,monitored data,registers,stack contents, and backtrace
information in separate windows on the debugger’smain display.
•Access on-line help information.
•Quicklyenter commands using the guided syntaxof the standard interface.
With the Standard Interface You Can ...
•Use the debugger with a terminal or terminal emulator.
•Quicklyenter commands using guided syntax, command recall, and
command editing.
•Viewsource code,monitored data,registers,stack contents, and backtrace
information in separate windows on the debugger’smain display.
•Define your own screensand windows in the debugger’smain display.
•Access on-line help information.
Compatibility with Other Products
The debugger/emulator hasbeen 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 FamilyC Cross Compiler, Version 4.00
HP B3641, Motorola 68000 FamilyAssembler, Linker, Librarian,
Version 2.00.
HP B1471, HP 64000-UX Operating Environment Software,Version 6.20.
See the “Loading and Executing Programs” chapter if you are using the
Microteclanguage tools.
v

In This Book
This book is organized into five parts:
Part 1. Quick Start Guide
An overviewofthe debugger and a short lesson to get you started.
Part 2. User’s Guide
Howto use the debugger to solve your problems.
Part 3. Concept Guide
Conceptual information on CPU simulation and on X resources.
Part 4. Reference
Descriptions of what each debugger command does,details of how the
debugger works, and a list of error messages.
Part 5. Installation
Howto install the debugger software on your computer.
vi

Contents
Part 1 Quick Start Guide
1 Getting Started with the Graphical Interface
The GraphicalInterface at a Glance 5
Pointer and cursor shapes 5
The Debugger Window 6
Graphical Interface Conventions 8
Mouse Buttons 9
Platform Differences 10
The Quick Start Tutorial 11
The Demonstration Program 11
To prepare to run the debugger 12
To start the debugger 13
To activate displayarea windows 14
To run until main() 15
To scroll the Code window 16
To displaya function 17
To run until a line 18
To edit the program 19
To displayinit_system() again 20
To set a breakpoint 20
To run until the breakpoint 21
To patch code usinga macro 22
To delete a single breakpoint 23
To delete all breakpoints 24
To step through a program 25
To run until a stack level 25
To step over functions 26
To step out ofa function 26
To displaythe value of a variable 26
To change the value of a variable 27
vii

To recall an entrybuffer value 28
To displaythe addressof a variable 29
To break on an access to a variable 30
To use the command line 31
To use a C printf command 31
To turn the command line off 32
To see on-line help 33
To end the debugging session 34
Part 2 User’s Guide
2 Entering Debugger Commands
Starting the Debugger 41
Using Menus, the EntryBuffer, and Action Keys 42
To choose a pull-down menu item using the mouse (method 1) 42
To choose a pull-down menu item using the mouse (method 2) 43
To choose a pull-down menu item using the keyboard 44
To choose pop-up menu items 45
To use pop-up menu shortcuts 46
To place values into the entrybuffer using the keyboard 46
To copy-and-paste to the entrybuffer 46
To recall entrybuffer values 48
To edit the entrybuffer 49
To use the entrybuffer 49
To copy-and-paste from the entrybuffer to the command line entryarea 49
To use the action keys 50
To use dialog boxes 51
To access help information 55
Usingthe Command Line with the Mouse 56
To turn the command line on or off 57
To enter a command 58
To edit the command line usingthe command line pushbuttons 59
To edit the command line usingthe command line pop-up menu 60
Contents
viii

To recall commands 60
To get help about the command line 61
To find commands which duplicate a menu selection 61
Usingthe Command Line with the Keyboard 62
To enter debugger commands from the keyboard 62
To edit the command line 64
To recall commands using the command line recall feature 64
To displaythe help window 65
Viewing Debugger Status 67
Debugger Status 67
Indicator Characters 68
CPU Simulated 68
Current Module 68
Last Breakpoint 68
To displayinformation about the debugger version 69
Solving problems with the interface 70
Ifpop-up menusdon’t pop up 70
3 Loading and Executing Programs
Compiling Programs for the Debugger 72
Writing programs for simulation 72
68020 Module Support —CALLM and RTM 72
Using a Hewlett-Packard C Cross Compiler 73
Using Microtec Language Tools 75
Loading Programs and Symbols 78
To specifythe location of C source files 78
To load programs 79
To load program code only 80
To load symbols only 81
To load additional programs 82
To turn demand loading of symbols on or off 83
Stepping Through and Running Programs 84
To step through programs 84
Contents
ix

To step over functions 85
To run from the current program counter (PC) address 86
To run from a start address 86
To run until a stop (break) address 87
To count simulated clock cycles 88
To add simulated wait states 89
Using Breakpoints 90
To set a memoryaccess breakpoint 90
To set an instruction breakpoint 91
To set a breakpoint for a C+ + object instance 92
To set a breakpoint for overloaded C+ + functions 93
To set a breakpoint for C+ + functions in a class 93
To clear selected breakpoints 94
To clear all breakpoints 95
To displaybreakpoint information 96
To halt program execution on return to a stack level 99
UsingSimulated Interrupts 100
To define simulated interrupts 100
To remove simulated interrupts 101
RestartingPrograms 102
To reset the processor 102
To reset the program counter to the startingaddress 102
To reset program variables 103
Savingand Loadingthe CPU State 104
To save the current CPU state 104
MappingMemory 105
To prevent accessto memorylocations 105
To prevent writingto memorylocations 105
To allowaccess to memorylocations 106
To displaycurrent memorymap assignments 106
Accessing Input Ports 108
To set or alter input port status 108
To delete an input port 109
Contents
x

To rewind the input file associated with an input port 109
To displayinput port buffer values 110
Accessing Output Ports 111
To set or alter output port status 111
To delete an output port 112
To rewind the output file associated with an output port 112
To displayoutput port buffer values 113
Accessingthe UNIX OperatingSystem 114
To fork a UNIX shell 114
To execute a UNIX command 115
Using simulator and emulator debugger products together 116
Usingthe Debugger with the Branch Validator 117
To unload Branch Validator data from program memory 117
4 Viewing Code and Data
Using Symbols 120
To add a symbol to the symbol table 120
To displaysymbols 121
To displaysymbols in all modules 122
To delete a symbol from the symbol table 122
DisplayingScreens 124
To display the high-level screen 126
To displaythe assemblylevel screen 126
To switch between the high-level and assemblyscreens 126
To display the standard I/O screen 127
To displaythe next screen (activate a screen) 127
Displaying Windows 129
To change the active window 131
To select the alternate viewofa window 132
To viewinformation in the active window 133
To view information in the "More"lists mode 134
To copywindowcontents to a file 135
Contents
xi

To viewcommands in a separate window 136
DisplayingC Source Code 137
To displayC source code 137
To find first occurrence ofa string 138
To find next occurrence ofa string 138
DisplayingDisassembled AssemblyCode 140
To displayassemblycode 140
Displaying Program Context 141
To set current module and function scope 141
To displaycurrent module and function 142
To displaydebugger status 142
To displayregister contents 143
To list all registers 145
To displaythe function calling chain (stack backtrace) 146
To displayall local variables of a function at the specified stack (backtrace)
level 149
To displaythe address of the C+ + object invoking a member function 150
Using Expressions 151
To calculate the value of a C expression 151
To displaythe value ofan expression or variable 152
To displaymembers of a structure 153
To displaythe members of a C+ + class 154
To displaythe values of all members of a C+ + object 154
To monitor variables 155
To monitor the value ofa register 156
To discontinue monitoringspecified variables 156
To discontinue monitoring all variables 157
To displayC+ + inheritance relationships 157
To print formatted output to a window 158
To print formatted output to journal windows 158
ViewingMemoryContents 160
To compare two blocks of memory 160
To search a memoryblock for a value 160
To examine a memoryarea for invalid values 161
To displaymemorycontents 162
Contents
xii

Using Simulated I/O 163
HowSimulated I/O Works 164
Simulated I/O Connections 164
Special Simulated I/O Symbols 166
To enable simulated I/O 166
To disable simulated I/O 167
To set the keyboard I/O mode to cooked 167
To set the keyboard I/O mode to raw 168
To control blockingof reads 168
To interpret keyboard reads as EOF 169
To redirect I/O 169
To check resource usage 171
To increase I/O file resources 171
5 Editing Code and Data
Editing Files 174
To edit source code from the Code window 174
To edit an arbitraryfile 175
To edit a file based on an address in the entrybuffer 175
To edit a file based on the current program counter 175
Patching Source Code 176
To change a variable using a C expression 176
To patch a line of code using a macro 177
To patch C source code byinsertinglines 178
To patch C source code bydeletinglines 178
Editing Memory Contents 180
To change the value of one memorylocation 180
To change the values of a block of memoryinteractively 180
To copya block ofmemory 181
To fill a block of memorywith values 182
To compare two blocks of memory 182
To re-initialize all program variables 183
To change the contents of a register 183
Contents
xiii

6 Using Macros and Command Files
Using Macros 187
To displaythe Macro Operations dialog box 191
To define a newmacro interactivelyusingthe graphical interface 191
To use an existing macro as a template for a newmacro 192
To define a macro interactivelyusingthe command line 193
To define a macro outside the debugger 194
To edit an existing macro 194
To save macros 195
To load macros 195
Ifmacros do not load 195
To call a macro 196
To call a macro from within an expression 197
To call a macro from within a macro 197
To call a macro on execution ofa breakpoint 198
To call a macro when steppingthrough programs 200
To stop a macro 201
To displaymacro source code 201
To delete a macro 202
Using Command Files 203
To record commands 204
To place comments in a command file 205
To pause the debugger 205
To stop command recording 206
To run a command file 206
To set command file error handling 207
To append commands to an existing command file 208
To record commands and results in a journal file 208
To stop command and result recording to a journal file 209
To open a file or device for read or write access 209
To close the file associated with a windownumber 210
To use the debugger in batch mode 211
7 Configuring the Debugger
Setting the General Debugger Options 215
To displaythe Debugger Options dialog box 215
To list the debugger options settings 215
Contents
xiv

To change debugger optionssettings 215
To specifywhether command file commands are echoed to the Journal
window 216
To set automaticalignment for breakpoints and disassembly 216
To set backtrace displayof bad stack frames 217
To specifydemand loading of symbols 217
To select the microprocessor simulated 217
To select the interpretation of numeric literals (decimal/hexadecimal) 218
To specifyexception processing behavior 219
To specifystep speed 220
Setting the Symbolics Options 221
To displaysymbols in assemblycode 221
To displayintermixed C source and assemblycode 221
To convert module names to upper case 222
To control case sensitivityof symbol lookups 222
Setting the DisplayOptions 223
To specifythe Breakpoint windowdisplaybehavior 223
To specifythe Breakpoint, Status,or Simulated I/O windowdisplaybehavior
223
To displayhalf-bright or inverse video highlights 224
To turn displaypagingon or off(more) 224
To specifyscroll amount 225
Modifying DisplayArea Windows 226
To resize or move the active window 226
To move the Statuswindow(standard interface only) 227
To define user screens and windows 228
To displayuser-defined screens 229
To erase standard I/O and user-defined windowcontents 230
To remove user-defined screens and windows 230
Saving and Loading the Debugger Configuration 232
To save the current debugger configuration 232
To load a startup file 233
Setting X Resources 234
Where resources are defined 234
To modifythe debugger’sgraphical interface resources 236
Contents
xv

To use customized scheme files 240
To set up custom action keys 242
To set initial recall buffer values 243
Part 3 Concept Guide
8 X Resources and the Graphical Interface
An X resource is user-definable data 248
A resource specification isa name and a value 248
Don’t worry, there are shortcuts 249
But wait, there is trouble ahead 250
Class and instance applyto applications as well 251
Resource specificationsare found in standard places 252
Loading order resolves conflicts between files 253
The app-defaults file documents the resources you can set 254
Scheme files augment other X resource files 254
You can create your own scheme files, if you choose 255
Scheme filescontinue the load sequence for X resources 255
You can force the debugger’s graphical interface to use certain schemes 256
Resource setting- general procedure 258
Part 4 Reference
9 Debugger Commands
Command Summary 262
Breakpoint Commands 262
Session Control Commands 262
Expression Commands 263
File Commands 263
MemoryCommands 264
Program Commands 265
Contents
xvi

Symbol Commands 265
WindowCommands 266
Breakpt Access 267
Breakpt Clear_All 269
Breakpt Delete 270
Breakpt Erase 271
Breakpt Instr 272
Breakpt Read 274
Breakpt Write 275
Debugger Directory 276
Debugger Execution Display_Status 277
Debugger Execution IO_System 278
Debugger Execution Load_State 281
Debugger Execution Reset_Processor 282
Debugger Execution Save_State 283
Debugger Host_Shell 284
Debugger Help 286
Debugger Level 287
Debugger Macro Add 288
Debugger Macro Call 291
Debugger Macro Display 292
Debugger Option Command_Echo 293
Debugger Option General 294
Debugger Option List 298
Debugger Option Symbolics 299
Debugger Option View 302
Debugger Pause 305
Debugger Quit 306
Expression C_Expression 307
Expression Display_Value 308
Expression Fprintf 311
Expression Monitor Clear_All 316
Expression Monitor Delete 317
Expression Monitor Value 318
Expression Printf 321
File Command 323
File Error_Command 324
File Journal 325
File Log 327
File Startup 329
File User_Fopen 331
Contents
xvii

File Window_Close 333
MemoryAssign 334
MemoryBlock_Operation Copy 336
MemoryBlock_Operation Fill 337
MemoryBlock_Operation Match 339
MemoryBlock_Operation Search 341
MemoryBlock_Operation Test 343
MemoryDisplay 345
MemoryHex 347
MemoryInport Assign 348
MemoryInport Delete 351
MemoryInport Rewind 352
MemoryInport Show 353
MemoryMap Guarded 354
MemoryMap Read_Only 355
MemoryMap Show 356
MemoryMap Write_Read 357
MemoryOutport Assign 358
MemoryOutport Delete 361
MemoryOutport Rewind 362
MemoryOutport Show 363
MemoryRegister 364
MemoryUnload_BBA 366
Program Context Display 369
Program Context Expand 370
Program Context Set 371
Program Display_Source 372
Program Find_Source Next 373
Program Find_Source Occurrence 374
Program Interrupt Add 376
Program Interrupt Remove 378
Program Load 379
Program Pc_Reset 382
Program Run 383
Program Step 386
Program Step Over 388
Program Step With_Macro 390
Symbol Add 391
Symbol Browse 394
Symbol Display 395
Symbol Remove 400
Contents
xviii

WindowActive 402
WindowCursor 404
WindowDelete 405
WindowErase 406
WindowNew 407
WindowResize 410
WindowScreen_On 411
WindowToggle_View 412
10 Expressions and Symbols in Debugger Commands
Expression Elements 417
Operators 417
Constants 419
Symbols 424
Program Symbols 424
Debugger Symbols 425
Macro Symbols 425
Reserved Symbols 426
Line Numbers 426
Addresses 427
Code Addresses 427
Data and AssemblyLevel Code Addresses 427
Address Ranges 427
Keywords 429
Forming Expressions 430
Expression Strings 431
Symbolic Referencing 432
Storage Classes 432
Data Types 433
Special Casting 436
ScopingRules 437
Referencing Symbols 437
EvaluatingSymbols 441
Contents
xix

Stack References 442
11 Predefined Macros
break_info 448
byte 450
close 451
dword 452
error 453
fgetc 454
fopen 455
getsym 456
inport 457
isalive 458
key_get 459
key_stat 460
memchr 461
memclr 462
memcpy 463
memset 464
open 465
outport 467
read 468
reg_str 469
showversion 470
strcat 471
strchr 472
strcmp 473
strcpy 474
stricmp 475
strlen 476
strncmp 477
until 478
when 479
word 480
write 481
Contents
xx
This manual suits for next models
1
Table of contents
Other HP Computer Accessories manuals

HP
HP MH0GC User manual

HP
HP nx9100 - Notebook PC User manual

HP
HP HSA-D01K User manual

HP
HP P2360AA #ABA User manual

HP
HP Comm Station User manual

HP
HP FQ481AA - Wireless Elite Desktop Keyboard User manual

HP
HP L1510 User manual

HP
HP Pavilion Slimline s3000 - Desktop PC User manual

HP
HP D7171A - NetServer - LPr Quick reference guide

HP
HP GM322AA User manual

HP
HP XB4000 User manual

HP
HP x4500 Specification sheet

HP
HP Z6500 Specification sheet

HP
HP P1553A User manual

HP
HP Xw6200 - Workstation - 2 GB RAM User manual

HP
HP DHN0 Guide

HP
HP FQ481AA - Wireless Elite Desktop Keyboard User manual

HP
HP MG-0133 User manual

HP
HP MINI 1101 User manual

HP
HP Integrity cx2600 User manual