Previous Issue | Search TidBITS | TidBITS Home Page | Next Issue
Remember those Programming for Poets courses in college? This week, our Technical Editor Geoff Duncan waxes poetical about the capabilities of Apple's low-level debugger MacsBug when placed in the hands of merely geeky non-programmers. Also this week, we welcome two new sponsors - Maxum and Dantz, announce Conflict Catcher 8.0.2 and a public beta of the hot Eudora Pro 4.1, and relay news of a free version of Nisus Writer you can download.
Copyright 1998 TidBITS Electronic Publishing. All rights reserved.
Information: <email@example.com> Comments: <firstname.lastname@example.org>
This issue of TidBITS sponsored in part by:
Northwest Nexus -- 1 888-NWNEXUS -- <http://www.nwnexus.com/>
Internet business solutions throughout the Pacific Northwest.
Small Dog Electronics -- Special Deal for TidBITS Readers!
PowerBook G3/250 (old style), factory refurbished - $1995!
Dayna Communications Close-Out Sale: Ethernet On Sale!
For Details: <http://www.smalldog.com/> -- 802/496-7171
Cyberian Outpost -- The Cool Place to Shop for iMac Stuff!
HUNDREDS IN STOCK! Imation iMac USB SuperDisk drive: $147.95!
Reads high-capacity 120 MB disks, plus standard floppies.
FWB CD-ROM ToolKit 3.0 & Hard Disk ToolKit 2.5 PE only $39.95!
It's an end of season special from FWB Software, and TidBITS
readers SAVE $79.95 on this great storage enhancement bundle!
Download now! --> <http://www.digitalriver.com/TidBITS/Spiffy/>
WebDoubler: ACCELERATE Web Surfing for Your Entire Workgroup!
Visit Maxum's Web site for complete information on WebDoubler
and a 20% discount for TidBITS readers! Download the demo now!
BACK UP VIA THE INTERNET! Try the new Retrospect 4.1 from Dantz
Development for compressed and encrypted backups to any FTP
server. The best backup program anywhere! $29.95 upgrades.
Read more about Retrospect 4.1 at <http://www.dantz.com/>.
Conflict Catcher Completes Mac OS 8.5 Compatibility -- Casady & Greene today released a free update to Conflict Catcher 8.0, adding full Mac OS 8.5 compatibility. The previous version, 8.0.1, provided partial information for performing a Clean-Install System Merge with Mac OS 8.5; the new Conflict Catcher 8.0.2 completes the feature in anticipation of Apple's new operating system later this month. The 8.0.2 update also includes support for more monitor types, along with additional descriptions of startup files. For more information about Conflict Catcher 8, see "Nice Catch, Conflict Catcher" in TidBITS-446. The 8.0.2 updater is a 1.8 MB download. [JLC]<http://db.tidbits.com/getbits.acgi?tbart=05086>
Eudora Pro 4.1 in Public Beta -- We reserve reporting on public betas to truly impressive releases, and Qualcomm's Eudora Pro 4.1 beta falls squarely into that category. Although the revision number is a small bump, the feature list will have long-time Eudora users drooling. Eudora Pro 4.1 now supports IMAP, includes an inline spell checker like Microsoft Word 98, offers a completely revamped Search command, provides an optional preview pane in mailbox windows, colorizes quoted text, and adds a Speak action to filters. A neat minor feature is the x-eudora-setting URL type that enables users to click an x-eudora-setting URL sent in an email message and edit that setting in a graphical interface - this feature provides access to Eudora's numerous tweaky settings without requiring ResEdit or AppleScript. Although the time-limited beta has been solid in our testing, it has known bugs, and we don't recommend you try it without a backup of your mail folder. The current beta, 4.1b26, is a 3 MB download. Do note that the README file's wording regarding Eudora not working with FreePPP is unfortunate and incorrect - Eudora works fine with FreePPP, but the OT/PPP and MacSLIP settings panel doesn't apply to FreePPP. [ACE]
Nisus Writer 4.1 Free! Nisus Software has taken the unusual step of releasing an older version of their powerful word processor, Nisus Writer 4.1, for free. Nisus Writer 4.1 offers features that remain unmatched in other word processors, including unlimited undo, discontiguous selection, customizable multiple key keyboard shortcuts, GREP searching, powerful macro capabilities, graphics creation, and support for WorldScript. Nisus Writer 5 has been out since 1996 (see "Nisus Writer Turns 5" in TidBITS-352), and although it added many welcome features, Nisus Writer 4.1 worked well for us for years. You can read more about Nisus in our three-issue review of Nisus 3.0 in TidBITS-116, TidBITS-117, and TidBITS-118, and in our three-part review of Nisus 4.0 - "Text Processing," "Word and Document Processing," and "Multimedia Features" - in TidBITS-263, TidBITS-264, and TidBITS-265. [ACE]
The free Nisus Writer 4.1 doesn't include a printed manual or technical support, but you can purchase both separately, and a copy of Joe Kissell's book, The Nisus Way, might prove useful (see "I Am Joe's Book" in TidBITS-319). You can also upgrade to the current Nisus Writer 5.1 for $50 ($40 without a printed manual). Nisus Software deserves credit for this bold move - with the dominance of juggernauts like Microsoft Word, small companies must introduce as many people as possible to their products to stand a chance at surviving. Giving away an old version as an incentive could be successful guerilla marketing - in the first three days, over 6,000 people downloaded Nisus Writer 4.1. [ACE]
by Adam C. Engst <email@example.com>
The Mac is back. A year or so ago, many people pointed to the thinning of the Macintosh magazines (and the Macworld/MacUser merger) as evidence of Apple's troubles. It was true - a significant reduction in advertising in major magazines is indicative of a shrinking industry. We felt the pinch as well, finding it nearly impossible to sign up new sponsors for TidBITS. Now, though, Apple is spending heavily on advertising in mainstream media, ad pages appear to be on the rebound in the Mac magazines, and we're seeing the upswing as well. Last week we welcomed Digital River, one of the major players behind the scenes in online software sales, and this week we have two new sponsors starting, Maxum Development and Dantz Development. The Macintosh resurgence is good for us all on both business and emotional levels - let's face it, plenty of us have many years invested in the Macintosh industry and it's a great feeling to pull back from the abyss.
Maxum Development -- First off, we're pleased to welcome Maxum Development to TidBITS. The community of Macintosh Internet developers started out small, and at trade shows the same faces appear time after time. Over the years, companies have come and gone, but two faces have remained: John O'Fallon, president of Maxum, and Mark Kriegsman, president of Clearway Technologies. Both companies made their names producing innovative add-ons for StarNine's popular Macintosh Web server, WebSTAR - NetCloak and NetForms from Maxum, FireSite and Nitro from Clearway.
Now the two companies have teamed up to produce WebDoubler, a full-featured caching proxy server ideal for schools, libraries, businesses, and other organizations interested in improving Web browsing performance and filtering content inappropriate for the situation. WebDoubler fills a hole in the Mac world by providing Web caching along with content filtering and usage tracking. Such capabilities aren't new, but for those of us who rely entirely on Macs as Internet clients and Internet servers, it's been a difficult combination of features to find. If you're in charge of a Macintosh network connected to the Internet, take a look at the 30-day demo of WebDoubler to see if it can solve any of your problems. And if you follow the link in sponsorship area above to purchase WebDoubler, you can get it for 20 percent off.
Dantz Development -- Our second new sponsor has supported TidBITS in the past, and it's great to have them back. Dantz Development is one of the longest-standing Macintosh developers. Their flagship product, Retrospect, is generally acknowledged to be the most powerful and flexible backup program on the Macintosh. PC Week even once recommended buying a Macintosh and Retrospect to back up networks of PCs.
The latest version, Retrospect 4.1, provides an emergency CD-ROM that can boot many Macintosh models (handy when you're trying to restore an entire hard disk from a backup). More important, though, Retrospect 4.1 adds the capability to back up to standard FTP servers via Internet backup sets (coincidentally, John O'Fallon of Maxum just mentioned that they've put some work into making their Macintosh FTP server Rumpus work better with Retrospect 4.1). Especially when you combine it with Retrospect's built-in compression and encryption, backup via FTP is ideal for individuals or organizations who don't want to buy or manage a backup device (offers for Internet backup services are included) or for people who want to increase their peace of mind by adding an off-site backup of important files. I fall squarely into that latter category, although, as always, I'm hoping that I never need to resort to that secondary backup.
by Geoff Duncan <firstname.lastname@example.org>
Here's a fun game: let's plot Macintosh software on a map of the Earth, based on how Mac-like the software is.
We would naturally plot the points representing the easiest, most intuitive software for the Mac OS at Apple headquarters in Cupertino, California. As we plotted more points, we'd find the surrounding San Francisco area would be peppered with thousands of dots, each representing a Macintosh program. In fact, most Macintosh software - even hard-to-learn programs or obtuse, cryptic utilities meant for power users - could be plotted within, say, a few thousand miles of Cupertino. That's not the kind of travel you'd undertake without packing a toothbrush and some clean underwear, but, for many people, getting there is at least conceivable in today's world.
However, on the opposite side of the globe, well south of Mauritius in the Indian Ocean, we would find a dot representing MacsBug.
MacsBug is Apple's low-level assembly language Macintosh debugger. If I remember correctly, MacsBug stands for "Motorola Advanced Computer System Debugger" and predates the Macintosh, first appearing in 1981. There's nothing Mac-like about MacsBug: it has no menu bar, no menus, no windows, no icons, no dialogs, and no buttons. Its display is a jumble of numbers, letters, and some cryptic words. You communicate with MacsBug using a command line, precisely the thing many people sought to escape with the Mac. MacsBug doesn't provide intuitive feedback about practically anything - in short, MacsBug violates every aspect of the Macintosh ideal.
MacsBug breaks these rules because it was designed to live underneath the Macintosh system software so programmers can see what's going on in overwhelming detail. MacsBug provides direct access to things users were never meant to see: system globals, application heap zones, CPU registers, task queues, and executing code.
Sounds scary, right? It is. But MacsBug is powerful, and power is seductive. Mastering MacsBug would require most Macintosh users to apply for passports and visas, receive immunizations and inoculations, make expensive travel arrangements, endure radical culture shock, leave their real lives, and maybe even grow gills. However, you can benefit from MacsBug without travelling to the other side of the world (or learning to read assembly language). MacsBug's not for everybody, but if you've been willing to travel from Cupertino to, say, Ohio, for another Macintosh program (like DeBabelizer or ResEdit), you should be able to put MacsBug to work for you. MacsBug can provide detailed information about your computer and problems you might be having, and - perhaps most significantly - save work in other applications when an otherwise fatal system error occurs.
Installing MacsBug -- You can download MacsBug for free from Apple. I recommend the most recent version available - even if it's not a final release - because it's likely to work with the latest versions of the Mac OS. You can also download a PDF version of Apple's pre-PowerPC MacsBug documentation, which makes for interesting reading if you're curious about MacsBug's more abstruse capabilities. As of this writing, the current version of MacsBug is 6.5.4.a6.
You install MacsBug by dragging it into your System Folder and restarting your Mac (feel free to ignore other files that come with it). Your Mac OS startup screen will say "Debugger installed" to let you know MacsBug is there. MacsBug works with any Mac newer than the Mac Plus and System 6.0 or higher; it might even work with earlier system software. Although for years MacsBug occupied only a few hundred kilobytes of RAM, changes to the Macintosh architecture over the last few years mean MacsBug commonly requires 1 to 1.5 MB of RAM on modern Macs.
Recent versions of MacsBug come with a program called MacsBugApp, which, despite limitations, is a stand-alone application that behaves much like MacsBug itself. It's occasionally flaky, but you can use it to follow along with some of the examples below without installing MacsBug itself.
Invoking MacsBug -- Once you've installed MacsBug, you might wonder where it is - nothing on your screen changes. There are two ways to enter MacsBug: deliberately and dramatically.
To enter MacsBug deliberately, press Command-Power, where Power is the key you use to turn on your Mac from the keyboard. This combination works on most Macs; older Macintosh models (up to the NuBus Power Macs, I believe) may also have a physical interrupt switch on the front, side, or back of the machine. If you've ever pressed a switch and seen a mysterious dialog containing only a greater-than symbol (">"), that's the interrupt switch. (By the way, that dialog is referred to as MicroBug or the programmer's window; to get out, your best bet is to type the letter G and press Return. You'll never see MicroBug with MacsBug installed, but Apple has a brief TechNote about it if you're curious.)
You can also invoke MacsBug by holding down the Control key when your Mac starts up. Only programmers typically need to do this, but I was once surprised by an old keyboard with sticky modifier keys.
The dramatic way to enter MacsBug is to experience a system error. Normally, a system error produces a bomb dialog, or a program quits, resulting in a dialog saying "An error of type -1 occurred." or something equally unhelpful. Now, MacsBug instantaneously appears, completely taking over your startup monitor. You need to be careful about how you exit MacsBug in response to a system error; your options are covered below.
First, let's describe MacsBug's display - it's divided into four areas. At the bottom is the command line, where you type MacsBug commands. Immediately above the command line is the PC region: PC stands for "program counter," and it displays the next instruction the CPU will execute, along with the disassembly of that instruction. This information is for programmers: it can give you an idea of where a system error occurred, but things like instruction pipelining (where the CPU executes more than one instruction at a time) sometimes mean the PC may not point to the actual error. Programmers sometimes need to disassemble forward and backward from the current PC to find the problem.
The largest area of the MacsBug display is called the output region, and it's where MacsBug shows the results of your commands. Although it doesn't have scrollbars, the Page Up, Page Down, Home, and End keys do scroll the output region's history. When you first enter MacsBug, it displays the version and copyright information in the output region, along with the reason MacsBug was entered.
Finally, along the entire left side of the MacsBug display is the status region, most of which displays CPU registers (R0 to R31 for PowerPC code, D0 to D7 and A0 to A7 for 68K code), along with the current stack pointer and, for 68K code, the stack itself. Don't worry about the stack and CPU registers. In the middle of all this, however, is some important information: beneath the label CurAppName, MacsBug shows the name of the currently executing application. If you entered MacsBug because of a system error, this is the program that had control when the error occurred, although it may not be the program you were using. Programs continue to execute when they aren't frontmost, and many things we think of as extensions - like Web Sharing and File Sharing - are in fact faceless applications that run in the background. Further, although CurAppName always says what program was in control when a problem occurred, the real problem could be in an extension, driver, or other software that underlies an application.
Near CurAppName, MacsBug also displays VM if you're using virtual memory, vM to indicate MacsBug was invoked while the Memory Manager was swapping between real and virtual memory, or RM to show you're using real memory. MacsBug also shows a number from 0 to 7 that indicates the interrupt level before MacsBug was invoked. Interrupts tell your CPU to set aside whatever it's doing and immediately take up a more important operation - they're used to handle mouse actions, screen redraws, network activity, serial port operations, and many other functions. MacsBug itself takes control of your system by generating a level 7 interrupt, otherwise known as a Non-Maskable Interrupt or NMI. (If you enter MacsBug deliberately, it tells you that the reason is an NMI rather than a system error.) An NMI overrides everything and can't be interrupted by other tasks. Generally, this isn't a problem: your applications aren't even aware they've been suspended. However, other computers on a network can notice that your Mac is no longer responding. After a few minutes, AppleShare servers will assume your Mac is gone and drop their connections; similarly, Internet servers might drop connections, and ISPs might hang up on you.
Stop This Crazy Thing! Now that you're in MacsBug, the first thing most sensible people want to do is get out. If you invoked MacsBug deliberately, this is simple: just type G then press Return, or press Command-G. This stands for Go, and tells your Mac to resume operating right where it left off. MacsBug then vanishes, your Mac's normal display reappears, and your Macintosh universe resumes its normal, harmonious state.
If you entered MacsBug as the result of a system error, try the following options. First, under CurAppName in the status region, note the name of the program executing when the error occurred. Also look at the bottom of the output region for the reason MacsBug was triggered. It might say something like "bus error" or "illegal instruction." If you need to see what you were doing on screen when the error occurred, pressing Escape toggles between your normal Macintosh display and MacsBug. Don't become confused: pressing Escape doesn't exit MacsBug, it just shows your screen at the instant MacsBug was triggered, which can be handy for writing down that paragraph of erudition that you otherwise stand no chance of recreating. Press Escape again to return to MacsBug.
Next, try typing G then pressing Return, or pressing Command-G. Most likely, you'll immediately reenter MacsBug with the same error, but it's worth a shot.
Type ES then press Return. ES stands for Exit to Shell, and tells MacsBug to terminate the current application and return you to the Finder. This is roughly equivalent to forcing an application to quit by pressing Command-Option-Escape. You may have to try ES a few times - just make sure you check which program is currently executing before repeating the command. If ES returns you to the Finder, save all your work and restart. If an application appears to have locked up, you can enter MacsBug intentionally and use ES to terminate that program. Use this capability with discretion, however: there's no telling what might be left in your computer's memory, whether any files that program had open will be closed properly, whether preferences might be damaged, etc. If you do this, restart as soon as possible.
If none of these techniques work - you keep popping into MacsBug with a system error - you may have no choice but to restart, even though it means losing unsaved work. You do this by typing RB (for ReBoot), then pressing Return. The RB command unmounts your startup volume and then restarts the machine. If you have multiple volumes, this action can result in delays the next time you need to use those disks: since they weren't properly unmounted, the Mac makes sure they're okay before mounting them on the desktop. You can alternatively use the RS command (for ReStart) to unmount all drives, then restart the system. Some programmers may tell you the RS command is dangerous, since it could write corrupted volume information back to your drives, potentially leading to data loss or a session with a disk recovery tool. In my experience, everyday problems with the RS command are quite rare, and changes to both the RS and RB commands in recent versions of MacsBug reduce the danger further. However, either command is preferable to turning your computer off and on.
Note that there are crashes from which MacsBug can't save you, and there are crashes that will still freeze your Mac, failing to invoke MacsBug at all. (The latter are often caused by poor or non-existent error checking when a program is low on memory.) In these cases, MacsBug can't help you, but having it installed doesn't hurt.
Impress Your Friends -- Now that you can get into and out of MacsBug, let's look at some simple tricks to enhance your guru status.
Being a low-level programmer's tool, MacsBug's default numbering system is base 16, or hexadecimal. Hexadecimal digits run from zero to fifteen, with ten through fifteen represented by the letters A through F. So, the number 200 is written as C8 in hexadecimal, which means "twelve times sixteen, plus eight." Hexadecimal is useful for representing binary values, and if you've done much HTML authoring, you've seen six-digit hexadecimal values like 3366CC used to specify colors. This might be wonderful from MacsBug's point of view, but hexadecimal isn't intuitive for people like me who have trouble making change for a dollar. Fortunately, you can tell MacsBug a number is a normal decimal number by preceding it with a pound symbol ("#"). Thus, if you type 42, MacsBug sees it as hexadecimal and thinks you mean 66 (four times sixteen, plus two), but if you type #42, MacsBug thinks you mean 42.
One instance where this esoteric knowledge becomes practical is in conjunction with MacsBug's error command, which returns a short description of cryptic Mac OS error numbers. If a program complains that "an error -43 occurred" you can identify the error number by popping into MacsBug, typing "error #-43", and pressing Return:
$FFD5 #-43 fnfErr - File not found
The application is telling you it tried to open a file, but couldn't find it. Depending on the program, this might be caused by a missing extension, plug-in, or document, but at least it gives you something to go by. The error command can score big points: I once got a frantic call from a small business owner who had an AppleScript that essentially looked up records in a database and printed a variety of labels. "I think it has corrupted the hard drive! Every time I need to use the machine, it says there's an error -1711 - big error numbers are really bad, right?" So, assuring the caller that the number of digits in an error has nothing to do with its severity, I popped into MacsBug and looked up the number:
$F951 #-1711 errAEWaitCanceled - in AESend, the user cancelled out of wait loop for reply or receipt
It turned out this script had been designed to run overnight, since it spent most of its time waiting around for other applications. However, the script was instead being run during lunch breaks and other odd times. Whenever someone needed to use the machine, they pressed Command-Period to stop the script, which promptly produced this error. The situation was harmless, but in this case having MacsBug installed helped me reduce my caller's blood pressure and gave me a low-stress consulting job fixing the script.
You can also use MacsBug to convert between decimal and hexadecimal, which can be useful with other MacsBug commands. Since MacsBug assumes numbers are hexadecimal; entering "3366CC" on MacsBug's command line yields this result:
3366cc = $003366CC #3368652 #3368652 '*3fA' (between #3M and #4M)
This shows the number 3366CC as a hexadecimal value, an unsigned decimal value, a signed decimal value, an ASCII value, and (often) a semi-human-friendly conversion to memory units, in this case between three and four megabytes. If you're converting from hexadecimal to decimal, the number you want is the third - the signed ASCII value (notice that it's preceded with a pound sign). Thus, 3366CC in hexadecimal is equal to 3,368,652 in decimal. The second (unsigned) decimal value will be identical for non-negative numbers, but wildly different for negative numbers. Convert #-43 and see what you get. You can use this trick to convert numbers up to about 2.1 billion.
Recent versions of MacsBug include basic mouse support in the output region, enabling you to click on a word, number, or term in order to place it in the command line. Although this mouse support drives some programmers insane (say, if the mouse moves while debugging a problem with a pop-up menu), you can quickly convert a number from hexadecimal to decimal by clicking it and pressing Return.
Finally, you can do math using MacsBug - try entering 32 + 32, or #32 + #32. Programmers occasionally rave about this capability, since they often need to play with hexadecimal values after an application has crashed. But most people should stick to the Calculator desk accessory.
Break Point -- In the next part of this article, we'll look at some MacsBug commands that provide important information about your computer and applications, and how to make MacsBug automatically restart your computer if an application crashes, which can be great for unattended servers.
Non-profit, non-commercial publications and Web sites may reprint or link to articles if full credit is given. Others please contact us. We do not guarantee accuracy of articles. Caveat lector. Publication, product, and company names may be registered trademarks of their companies. TidBITS ISSN 1090-7017.
Previous Issue | Search TidBITS | TidBITS Home Page | Next Issue