Converted to HTML in GNNPress 1.2 , July 24, 1996 by Jim Green
Type a command and then press Return or Enter to execute it. Pressing Return without entering a command repeats the last command. You can enter more than one command on the command line by separating commands with a semicolon (;).
| Command-V | Scroll command buffer down and copy command line to current command line. |
| Command-B | Scroll command buffer up and copy command line to current command line. |
| Option-Left Arrow | Move cursor left one word. |
| Option-Right Arrow | Move cursor right one word. |
| Option-Delete | Delete the word to the left of the cursor. |
| Command-Left Arrow | Move cursor to beginning of command line. |
| Command-Right Arrow | Move cursor to end of command line. |
| Command-Delete | Delete the line to the left of the cursor. |
| Command-D or ; | Display list of embedded symbols |
| Command-E | Display list of external symbols |
| Command-R | Display list of external symbols with resource information |
Select a procedure from the list by using the up and down arrows. Copy the selected procedure name to the insertion point of the command line by pressing Return. Copy the selected absolute address by pressing Option-Return. Press Escape to leave command line unchanged. Display a selected (qualified) list of procedure names by typing the first letter(s) of the procedure name (after displaying the list with Command-D, E, R, or ;). Pressing Delete undoes the qualification one letter at a time. With C++ and Object Pascal names you may use the Tab key to qualify the class.
The general form of an expression is: value1 [operator value2]. Use parentheses to control the order of evaluation. Expressions always evaluate to a 32 bit value unless .W or .B follows the value. Expressions evaluate to either a numeric or a boolean value based on the operators used. The action of some commands change based on this result. For instance, BR addr expr will break each n times if expression is numeric or it will break when expr is true if expression is boolean.
| Registers | All 68000 family registers use their Motorola names. MMU 64 bit registers and floating point registers are not allowed in expressions. |
| Numbers | Numbers are hex by default but can be preceded by a '$' in the case of conflicts with registers An and Dn. Numbers are decimal if they are preceded by a '#'. |
| Symbols | Symbols are found by searching the heap and evaluate to an address. To give priority to a ROM-map symbol, use '®'; to give priority to a CFM symbol, use '©'. |
| Traps | Trap number in the range A000 to ABFF or a trap name. Trap names can be preceded by a 'Æ' in the case of conflicts with symbol names. To use a trap's number instead of its address, use 'ÆÆ' before the name. |
| '.' | The last address referenced by certain commands. For instance, SM sets dot to the first address that was changed and sets the last command to DM. Typing return will display the memory that was changed. |
| ':' | The address of the start of the proc shown in the PC window. Not valid if no proc name exists for PC. |
| Arithmetic | + - * / or Æ MOD |
| Boolean | AND or & OR or | NOT or ! XOR |
| Shifting | << >> |
| Equality | = or == <> or != or Æ < > <= >= |
| Indirection | @ (prefix) or ^ (postfix) |
| G [addr] | Resume execution at addr or PC if no addr. Command-G is the same as entering G and pressing Return. |
| GP | Resume execution at current PC, ignoring the PowerPC exception that caused our last entry. This propagates the exception to the next handler in the PowerPC exception chain (usually the current application's handler). If executed when in 68K code, this acts like the "G" command. |
| GT addr [';cmds'] | Go till addr is reached and optionally execute one or more commands. The addr can be in ROM but execution will be much slower. |
| GTP addr [';cmds'] | Go till PowerPC code addr is reached and optionally execute one or more commands. |
| S [n | expr] | Step n instructions or until expr is true. Command-S is the same as entering S and pressing Return. |
| SO [n | expr] | Step n instructions or until expr is true. JSRs, BSRs and Traps are treated as one instruction. For historical reasons, T (for Trace) is allowed as an alias for SO. Command-T is the same as entering T and pressing Return. If n is zero then clear all step points. |
| SS addr [addr] | Step until checksum of addr range changes. If you do not specify a range, step until long word at addr changes. |
| MR [offset | addr] | Break after the current procedure returns by replacing its return address. If the parameter is less than A6 then the return address is at A7+offset. If the parameter is greater than or equal to A6 then the return address is at addr+4. If no parameter then the return address is at A7. Example: MR A6 to return from a 68K subroutine any time after executing a LINK A6 instruction. (MR stands for Magic Return.) |
| BR addr [n | expr] [';cmds'] | Break at addr each n times or when expr is true and optionally execute one or more commands. If no n or expr then break always. The addr can be in ROM but execution will be much slower. |
| BRP addr [n | expr] [';cmds'] | Break at PowerPC code addr each n times or when expr is true and optionally execute one or more commands. If no n or expr then break always. The addr can be in ROM but execution will be much slower. |
| BRM string | Set breakpoints at all procedure names that contain string.String can occur anywhere in the name, not just at the beginning. |
| BRC [addr] | Clear breakpoint at addr or all breakpoints if no addr. |
| BRD | Display breakpoint table. |
| FSB string | Break on the code fragment symbol string. Naah, not really. This command is just here so I can play around with some ideas. |
Appending A to an A-Trap command name specifies that the command applies only to A-Traps that are called from the application heap. Entering two traps as parameters defines a trap range. Entering no traps defines the range A000 to ABFF.
| ATB[A] [trap [trap]] [n | expr] [';cmds'] | Break at traps each n times or when expr is true and optionally execute one or more commands. If no n or expr then break always. |
| ATT[A] [trap [trap]] [n | expr] [,intlev] | Display trap information each time a specified trap is called. Intlev specifies the maximum interrupt level at which to record traps. 0 records only non-interrupt level calls, 7 records all. |
| ATHC[A] [trap [trap]] [n | expr] | Check the heap each time a specified trap is called. |
| ATSS[A] [trap [trap]] [n | expr], addr [addr] | Checksum addr range each time a specified trap is called. If the checksum has changed then break into MacsBug. If no second addr then chec ksum the long word at addr. |
| ATC [trap [trap]] | Clear trap range or all traps if no parameters. ATD Display the A-Trap tables. |
| ATR[A] [ON | OFF] | Turns trap recording on or off. Toggle if no parameters. Information about the most recent trap calls is recorded. ATP Plays back the information recorded while ATR is on. |
| DSC[A] [ON | OFF | str] | Turns Discipline on or off. Toggle if no parameter. Any parameters other than ON or OFF are passed to Discipline for interpretation. Discipline examines parameters before trap calls and examines results after trap calls. Any errors break into MacsBug. |
| DSCX [OFF | ON] | Turn discipline breaks on or off. Default ON. |
All commands assume the PC if no addr is specified.
| IL [addr [n]] | Disassemble n lines from addr. If no n then display half page. |
| ILP [addr [n]] | Disassemble n lines of PowerPC code from addr. If no n then display half page. |
| IP [addr] | Disassemble half page centered around addr. |
| IPP [addr] | Disassemble half page of PowerPC code centered around addr. |
| ID [addr] | Disassemble 1 line starting at addr. |
| IDP [addr] | Disassemble 1 line of PowerPC code starting at addr. |
| IR [addr] | Disassemble until the end of the routine addr is in. |
| IRP [addr] | Disassemble PowerPC code until the end of the routine addr is in. |
| DH expr ... | Disassemble one or more exprs as a sequence of 16-bit opcodes. |
| DHP expr ... | Disassemble one or more exprs as a sequence of 32-bit PowerPC opcodes. |
| HX [addr] | Set the current heap to the heap at addr. If no parameter then toggle between the Application, System and user heaps. | ||||||||||||||||
| HZ [addr] | List all known heap zones. If parameter then list all heap zones embedded into the heap at addr. | ||||||||||||||||
| HD [F | N | R | L | P | Q | RS | TYPE] |
Display specific blocks in the current heap, or all blocks if no parameter.
A '!' beside a relocatable block means the master pointer is not within the
heap; a '?' means master pointer does not point to the block data. A '·'
at the left marks all locked blocks and all nonrelocatable blocks, for your
convenience in spotting heap fragmentation. -- The possible block specifiers
on the command line are:
|
||||||||||||||||
| HT | Display a summary of the current heap. | ||||||||||||||||
| HC [ALL] | Check all heaps or current heap if no parameters for inconsistencies. Possible command line options are: ALL: Check all known heaps (same as shown by HZ). | ||||||||||||||||
| HS [addr] | Turn on scrambling of the heap at addr or ApplZone if no addr. Calling NewPtr, NewHandle, ReallocHandle, SetPtrSize or SetHandleSize checks the heap before the call. If good then the heap is scrambled. If bad then a MacsBug break is forced. Scrambling continues until next HS or a bad heap is detected. |
| RN [expr] | Set the resource file ref num qualifier to expr. If no expr then set it to curMap. Once set, all subsequent symbol references must be from a heap block with a matching file ref num. If expr is 0 then all symbols match. |
| SD | Command-: or Command-D is now used to select symbol names. |
| SX [ON | OFF] | Turn symbols in disassembly on or off. Toggle if no parameter. |
| EXT [expr [pathname]] | External symbols for resource file ref num expr from .SYM file pathname. If no pathname then dispose of external symbols for resource file ref num expr. If no expr then display all load external symbol .SYM files. |
| SC6 [addr [nbytes]] | Show the calling chain based on A6 links. If no addr then the chain starts with A6. If addr then the chain starts at addr. If no nbytes then the stack base is CurStackBase. If nbytes then the stack base is addr+nbytes. |
| SC7 [addr [nbytes]] | Show possible return addresses on the stack. A return address is an even address that points after a JSR, BSR or A-Trap. If no addr then A7 is the stack pointer. If addr then addr is the stack pointer. If no nbytes then the stack base is CurStackBase. If nbytes then the stack base is addr+nbytes. |
All commands assume the dot address if no addr is specified.
| DM [addr [n | template | basic type]] | Display memory from addr for n bytes or as defined by a template or a basic type. The basic types are Byte, Word, Long, SignedByte, SignedWord, SignedLong, UnsignedByte, UnsignedWord, UnsignedLong, PString, CString, and IORefNum. See ?SET for DITTO mode. |
| DMA [addr [n]] | Display memory as ASCII from addr for n bytes. See ?SET for DITTO mode. |
| TMP [name] | List templates names that match name. If no name then list all template names. |
| DP [addr] | Display memory from addr for 128 bytes. |
| DB [addr] | Display the byte at addr. |
| DW [addr] | Display the word at addr. |
| DL [addr] | Display the long at addr. |
| SM addr expr | 'string' ... | Assign values to memory starting at addr. Each value determines the assigment size. Specific sizes can be set using SB, SW or SL. Sets the dot to the first address that was changed and sets the last command to DM. Typing return will display the memory that was changed. |
| SB addr expr | 'string' ... | Assign values to bytes starting at addr. Typing return will display the memory that was changed. |
| SW addr expr | 'string' ... | Assign values to words starting at addr. Typing return will display the memory that was changed. |
| SL addr expr | 'string' ... | Assign values to longs starting at addr. Typing return will display the memory that was changed. |
Values can be assigned to registers with commands of the form: RegisterName := expression or RegisterName = expression
| TD | Display CPU registers. |
| TF | Display 68881 floating point registers. |
| TM | Display 68851 MMU registers. |
| RAD | Toggle between specifying registers as RAn or RDn and specifying registers as An or Dn. The default setting does not require the R. |
| MC name 'expr' | expr | Define a macro called name that expands to 'expr' or to the current value of expr. Macros can have up to nine parameters, indicated in the quoted expression as ®1 through ®9. ('®' is Option-R.) |
| MCC [name] | Clear named macro or all macros if no name. |
| MCD [name] | List macros that match name. If no name then list all macros. |
| Escape or tilde | Toggle between the user screen and the MacsBug screen. | ||||||||
| RB | Unmount the boot volume and reboot. | ||||||||
| RS | Unmount all volumes except server volumes and reboot. | ||||||||
| ES | Exit the current application (like Command-Option-Escape in 7.x). | ||||||||
| EA | Restart the current application. | ||||||||
| STAT | Displays various interesting facts about the environment. Provided with the StdLog macro in mind, but you can type STAT whenever you feel like it. | ||||||||
| WH [addr | trap] | Find the name and addr of the parameter. If no parameter then assume WH PC. For better results, use WHT to locate a trap. (WHT is a macro that expands to "WH ÆÆ".) | ||||||||
| HOW | Display the reason MacsBug was entered this time. | ||||||||
| F addr nbytes expr | 'string' | Search from addr to addr+nbytes-1 for the pattern. If pattern is an expr then the width of the pattern is the smallest unit (byte, word or long) that contains its value. | ||||||||
| FB addr nbytes expr | Search from addr to addr+nbytes-1 for the byte. | ||||||||
| FW addr nbytes expr | Search from addr to addr+nbytes-1 for the word. | ||||||||
| FL addr nbytes expr | Search from addr to addr+nbytes-1 for the long. | ||||||||
| FP addr nbytes expr | Search from addr to addr+nbytes-1 for the pointer. | ||||||||
| FILL addr nbytes expr | Fill memory with the long expr from addr to addr+nbytes-4. Addr must be long-aligned and nbytes must be a multiple of 4. | ||||||||
| CS [addr [addr]] | Checksum addr range and store the value. CS without parameters checksums the last addr range and compares it to the last value.If no second addr then checksum the long word at addr. | ||||||||
| LOG [pathname | Printer [ -H ]] | Log all MacsBug output to a file or to an ImageWriter printer. LOG without parameters turns logging off. LOG with only a file name defaults to saving the log to the root of the boot volume. LOG -H saves the scrollback history to the bottom of the current screen to the log file. | ||||||||
| SHOW [addr | 'addr' [ L | LA | W | A ]] |
Display memory at addr in status region. Quoting addr causes it to be evaluated
each time the display is updated. SHOW without parameters cycles thru the
display formats. The formats are:
|
||||||||
| SWAP |
|
||||||||
| SET [option [ON | OFF]] |
Temporarially change the specified MacsBug behaviour. On/off options toggle
if you don't specify ON or OFF. The options are:
|
||||||||
| DX [ON | OFF] | Turn user breaks (A9FF, ABFF) on or off. Toggle if no parameter. | ||||||||
| DV [V] | Display MacsBug version. V: Display version only, do not show credits. | ||||||||
| MBUG | Displays lots of internal globals for debugging MacsBug itself. | ||||||||
| DCMD [name] | Shows a table of all installed DCMDs (modular debugger commands) that match name. If no name, shows all DCMDs. Use "HELP" ("?") with an individual DCMD name for the full help on that command, or "HELP DCMDS" ("?dc") for full help on all DCMDs. Example: dcmd v shows all DCMDs whose names start with "v". | ||||||||
| HELP [cmd | topic] | Display info about a specific command or topic. If no parameter then display all topics. You can use "?" instead of HELP. For example: ?set is the same as help set . |
Written by Jim Murphy and Dave Lyons with contributions by Kurt Clark, Cameron
Esfahani, Hoon Im, Mike Puckett, Eric Slosser, Chas Spillar, and Fernando
Urbina.
Originally rewritten in C by Danny Kubota (based on MacsBug 6.2.2).
Converted to HTML in GNNPress 1.2 , July 24, 1996 by Jim Green
[Back to MacsBug Tips] [Mail Mike] [GoingWare, Inc. Home]
![]() |
Voting for GoingWare at The Programming Pages will encourage more people to read these articles. |