Aug 97 MacTech Online
Volume Number: 13 (1997)
Issue Number: 8
Column Tag: MacTech Online
by Nicholas C. "nick.c" DeMello <firstname.lastname@example.org>
It's Called MacsBug
Not MacBug, not MacBugs. The acronym stands for "Motorola advanced computer systems debugger." This powerful system extension allows developers to view and manipulate the contents of the Macintosh ram. You can download the latest version from Apple's Developer World ftp site, but if that (or any Apple ftp server) is busy check out Apple's "Software Home" page. The Software Home allows you to search for the latest version of any software Apple distributes.
MacsBug can be installed by simply dragging its file into your system folder (not your control panels folder, not your system extensions folder). When you restart your "Welcome to Macintosh" screen will display "debugger installed" if MacsBug loads (or the phrase "...carry a big stick" if you have a beta OS). Once installed, you can drop into MacsBug by hitting the command and power (triangle) keys together. Older systems require a system extension called programmers key to drop into MacsBug. Dropping into MacsBug suspends all processes and allows you direct access to all values in memory (great for pausing Doom). To return to the finder hit command-G, or to restart your Mac type "rs."
One way to learn more about using MacsBug is to drop into it and type "help" (or if you'd rather get the same information without wandering around your system memory visit Thomas Kimpton's MacsBug Help page). The Code Mechanic, Dave Evans, has at least three develop articles about wielding MacsBug (my favorite was "Stalking the Wild Defect"). In the September 1994 MacTech tips and tidbits there is a nice example of how to build a MacsBug macro, and the neat trick of making it execute automatically, every time MacsBug is entered. Check it out on the MacTech website.
Sleuthing through your systems memory is only half the fun though. When you've built up enough confidence to try and manipulate some memory see the Kool MacsBug Tricks page.
- Download MacsBug from Devworld
- Find the Latest Apple Software at Apple's "Software Home"
- Download Programmers Key or EvenBetterBusError
- MacsBug Help
- Stalking the Wild Defect
- The MacsBug "Every time" Macro, MacTech Archives
- Kool MacsBug Tricks
EvenBetterBusError -- The Art of the Controlled Crash
EvenBetterBusError crashes your Mac. Unlike most software though, Greg Marriott's system extension does so on purpose. When you have EBBE installed, if your code dereferences a NIL pointer, writes to a NIL pointer, or attempts to execute code at NIL EBBE will crash your Mac (dropping you into MacsBug). Greg has put EBBE and three other stress testing tools that he developed at Apple on the web. Greg warns that some these tools are showing a little age, and recommends folks consider Onyx technologies commercial stress testing tools. Onyx's QC is an established and well respected stress tester. If you want to shake your code -- hard: give it to QC.
Oh, and those of you looking for the fourth generation of Mr. BusError can find YetEvenBetterBusError (aka DavesBetterBusError) beta on Dave Evan's web site. This more aggressive version of EBBE, announced in the May 1997 MacTech, can also be found on the MacTech ftp site along with the Tidy Heap C++ class library (for tracking proper use of new and delete).
- EvenBetterBusError & Other Kool Tools by Greg Marriott
- About QC...
- Dave Evans & DavesBetterBusError
- YEBBE & Tidy Heap
Next month MacTech Online is going to get serious about Java -- really. One last debugging tool you should check out before then is the Zone Ranger. Zone Ranger is a valuable tool for the counts and total sizes of the free blocks, pointers, handles, locked handles, purgeable handles, and resource handles that can be found on the Metrowerks web site. See you next month.
-- nick.c <email@example.com>
- Joshua Golub's Zone Ranger