info-mac@utcsrgv.UUCP (info-mac) (06/22/84)
Date: Thu, 21 Jun 84 12:20:55 pdt From: Bill Croft <uw-beaver!croft@safe> To: info-mac@sumex Subject: using MACSBUG with SUMACC Cc: croft@SUMEX-AIM.ARPA, sumacc@sumex ---- Date: 20 Jun 1984 20:27-EST From: David.Anderson@CMU-CS-G.ARPA I picked up my copy of the SUMacC disk today, and it included MacsBug and Disassembler. I can't figure out what they do -- can someone enlighten me? They sound terribly useful. ---- David, Your SUMACC disk as distributed has MACSBUG named xMACSBUG, this prevents it from being loaded at boot time. If you want to debug something you should follow these steps: Ensure that Macsbug is NOT loaded; i.e. the name in the system folder should read "xMACSBUG". If this is not true, then rename it, attempt eject (to flush), and reboot. MacTerminal and the Finder don't work well when the large MACSBUG and DISASSEMBLER are loaded; Finder runs out of space and MacTerminal crashes. AFTER you have downloaded and/or converted your program, then rename "xMACSBUG" to "MACSBUG", eject, and reboot. This will load the debugger/disassembler at the top of memory. Make sure that you have an ASCII terminal connected to the "printer" port at 9600 baud. Double click your program, pause a half-second, then hold down the mouse button. When you hear a beep, release the mouse button. What this does is: (1) load your program, (2) tells the "C runtime startoff" (lib/crtmac.s, the first part of your program to get control after loading) to "pause" before entering your main program. This will give you time to set breakpoints or alter memory before your program starts. The "beep" means crtmac is waiting in a tight loop for register D0 to become zero. It will just sit there forever. Now on the side of your Mac, carefully press the "INTERRUPT" (not the "RESET") button once. The debugger should print out a register dump on your terminal. I assume you have read the section "ROM 7.0 MacsBug Summary" in your Inside Macintosh. This is located somewhat behind the "Misc" tab in my copy. Other sections that are helpful are "Pascal Program Debug Strategy" and "Toolbox Names"; the latter is useful for setting breakpoints on toolbox calls. To MACSBUG, type "d0 0"; this clears register D0 and will allow the program to proceed. Now you might want to set a breakpoint on a location or a trap; use the appropriate "br" or "at" command. You will probably want to have an assembler listing of your program; use the "-S" switch of cc68. After you are ready to proceed, type "g" or "t". This will go to the next breakpoint or trace each instruction before execution. When finished debugging you will (unfortunately) need to rename MACSBUG back to xMACSBUG and reboot if you want to use MacTerminal. BETTER DEBUGGERS: Soon Apple will be releasing their two-Mac debugger/ assembler system. Instead of an ascii terminal on the printer port, you use another Mac with a nice window based debugging package. And instead of MACSBUG/DISASSEMBLER there is just a tiny "stub" that lives on the system heap which interfaces to the "remote" window debugger. This idea is very similar to David Bogg's old "TeleSwat" protocol on the Alto.