This week, while I was doing some telephone tech support for a friend, a misbehaving application kept locking up his computer. Each time this happened, he was obliged to resort to the "three finger salute"-- Command + Control plus Power Key and then sit through an entire restart sequence. This was an older machine with and ADB keyboard; some USB Macs require you to use the hardware reset button or to insert a straightened paper clip into the reset hole in the side of the machine.
My friend needed MacsBug.
MasBug is a free programmer's tool from Apple. It is used by programmers to debug code in most execution environments, from applications to drivers, and everything in between, and is used as a bug-reporting tool by Mac OS software developers. MacsBug is capable of doing a number of things -- a lot more than I, a non-programmer, have ever explored -- but its main utility for most of us is as a crash recovery tool.
MacsBug can get you out of crashes and screen lockups so you can save work and restart your Mac in an orderly fashion, or even continue working without restarting. If I'm pressed for time, sometimes I will have programs crash to MacsBug three or four times a day, and still be able to carry on for days without restarting my computer after a MacsBug recovery (not recommended).
When MacsBug is installed, instead of a bomb dialog box or an "unexpectedly quit" or "system error" message, or just a locked-up screen with an immovable cursor showing up when a program crashes, you are presented with a strange-looking, DOS-like screen, which will provide you with a usually incomprehensible explanation of the problem, such as "illegal instruction" or "unimplemented trap" or somesuch at some address in some data space with other details you don't care about. That's not very helpful unless you understand programming code.
What is helpful is that you can type "es" (which stands for "ExitToShell") into MacsBug's command line entry field, press return or enter, and quite often be transported back to the Finder where you will still be able to do stuff -- if only save your unsaved work. The prudent user will then quit all running programs and restart, which is still a lot better than losing unsaved work in other programs in a force restart. The unprudent user like me will keep right on computing and wait until the memory heap gets so corrupted that even MacsBug won't get me out of it. However, no harm done usually. In MacsBug App 6.6 and later, when you type "es" it now cleans up properly by patching ExitToShell.
If typing "es" doesn't work, and sometimes it won't, you're no worse off, and will usually end up back in the MacsBug window. I usually try "es" two or three times, and if that does not produce the desired result, I resign myself to the dreary task of restarting, which can also be done from the MacsBug window by typing "rs" (which stands for guess what?) and pressing return or enter. You can also (almost always) bring up the MacsBug window at any time by pressing Command and PowerKey (if your Mac has a keyboard Power Key), even if things have frozen but MacsBug has not appeared of its own accord. Why would you want to do this?
Because the restart you get by pressing "rs" in MacsBug is different from the "Restart" command the Finder offers. The Finder's "Restart" command sends an Apple event to all programs, asking them to quit, turning off the hardware only when the Finder is all that's left. The MacsBug "rs" command tries to unmount all of your online volumes and then toggles the hardware power, so you'll lose any unsaved work in any application. The main advantage to "rs" over the Finder's "Restart" command (which is probably inaccessible anyway in a crash or freeze) is disk unmounting. If a disk isn't unmounted correctly, the Mac OS realizes that something is wrong and goes through a time-consuming verification cycle next time the disk is mounted (made available for use). But "rs" takes a crack at unmounting the disks before restarting, which could save some time. If that fails, MacsBug's "rb" command tries to unmount only the boot volume before telling the hardware to restart. Either is better than simply turning the Power switch off or unplugging te Mac (a last resort if all else fails).
When you're in the MacsBug window, you can type the command "g" for "go" and press the Return key or Enter key to exit the MacsBug window and return to the Finder.
You can also type "ea" to Exit To Application in case the Finder has crashed (the Finder is the Shell)
These useful commands: "es," "rs," "ea" "f" and "rb," are just the tip of the iceberg, so to speak, of what MacsBug is capable of, but they are the reason I wouldn't want to be without it. If you don't already have MacsBug, give it a try. It's free! Just download a copy at this URL: <http://developer.apple.com/tools/> (scroll down the page), drag the little MacsBug cherry bomb shaped icon into your System Folder, and restart. The rest of the stuff you get in the MacsBug download seems to be irrelevant for the purposes normal Mac users will put this software to.
Once you have MacsBug installed in your System Folder, when you start up your computer, the "Welcome To Mac OS" screen will now also read "Debugger Installed."
MacsBug will not work with Mac OS X, and there is no need for it there, since you will be able to do similar tasks and more using Unix command lines. My son says this is better, I believe him, but it will involve another learning curve.
MacsBug 6.6.3, released September 14, 2000, is the latest final version of MacsBug. This version works up to all of the machines released in the Summer of 2000, including the Power Mac G4 (uni- and multi-processor), Power Mac G4 Cube, the new iMac family (Ruby, Indigo, Sage, Graphite, and Snow), and the Paris iBook family (Indigo, Key Lime, and Graphite).
It includes better support for debugging MP tasks, and fixes some serious bugs in the memory setting commands when used in PCI I/O space.
For a tutorial on recovering unsaved data lost in crashes using MacsBug, visit:
http://www.applelinks.com/mooresviews/macsbug.shtml
Tags: Blogs ď Hands On Mac ď

Other Sites