PDA

View Full Version : MacsBug documentation......



crazyeights
02-09-2001, 11:29 PM
Hi guys. This seemed like a better place to continue this discussion.....

Mag, as you said, MacsBug would be a better way to interrupt apparent software hangs than using the programmer restart. Thanks for your tip on Interarchy. It is slick, for sure.

Louie, I got v6.6.3 installed in my System folder, and now get the "debugger installed" message on startup.

But, I've looked on the Apple website, and there doesn't appear to be ANY documentation on how to use it, I get 0 hits doing a search, and couldn't find it in the Developers section. Although, Apple has a knack for putting things in places on their site that require pre-knowledge of exact URL addressing. I couldn't find any real documentation on gurus ftp either.

Can you or Mag give me some guidance?

Best,

Dave

Louie
02-10-2001, 12:58 AM
I'll check. They probably hid it.

crazyeights
02-10-2001, 02:45 AM
p.s. Thanks for the file Louie.

Found the documentation Louie, its here:
http://developer.apple.com/tools/debuggers/MacsBug/

Damn, it's also a primer for assembly language, and OS archtecture and operation!!

D

[This message has been edited by crazyeights (edited 10 February 2001).]

[This message has been edited by crazyeights (edited 10 February 2001).]

Louie
02-10-2001, 02:17 PM
That's it! I knew it was there someplace. Study it and give us a 100 word summation next Wednesday.

crazyeights
02-10-2001, 06:24 PM
I may have to do that Louie. It's not exactly clear when, where or if it will get around to basic instructions. Maybe you can tell me.....

With Macsbug installed, does that mean I can hit programmer interrupt, and it will kick me into Macsbug command line?

c8

mactheripper
02-10-2001, 07:25 PM
I can't remember what happens if you hit the button (my 9500 doesn't have programmer's interrupt or reset switches). If you don't have MacsBug, the Mac throws up the built in low-level debugger, with that white box.

However, the normal way to enter MacsBug if you have it installed is to hit command-power key on your keyboard, and if you are doing it during normal operation (i.e. not while crashed) you can get back out by typing 'g' for Go To Finder. The only other commands that I find useful are 'es' for Escape Current App and 'rs' for Restart.

Using these commands, sometimes repeatedly, can get you out of about 60% of crashed apps, or at the very least, let you restart without just killing power, slightly better for the system's internal filing. IE, the PPP control panel, Netscape, and most games are, in my experience, able to be jettisoned by MacsBug.

With some effort, and some documentation, you can actually use MacsBug to do more than that. You can check condition of system variables, addresses in RAM, and all kinds of weird stuff. It is incredibly powerful, but most people never use it. It also has the strangest screen-scramble algorithm I've ever seen. You'll see what I mean when you test it.

[This message has been edited by mactheripper (edited 10 February 2001).]

Louie
02-10-2001, 08:26 PM
Dookie already told you more than I know. Second Lieutenants are good for something.

crazyeights
02-10-2001, 08:57 PM
MTR, thanks man!!! Yeah, it works like a charm, and, it turns out the debugger screen is on my smaller "pallette" monitor. Perfect!!

Thanks to you too Louie.

I would expect using this will be much kinder to my OS resources.

UPDATE: Oh Yeah!!! This is nice. Another question. If you use ES to escape from a running application, is there any penalty to stability like there is with an "Unexpectedly quit" error. Does it leave System heap and memory with artifacts requiring restart, or does it clear heap and pointers?

Thanks again guys!!!

c8

[This message has been edited by crazyeights (edited 10 February 2001).]

Louie
02-10-2001, 09:59 PM
I would suspect you will be much cleaner useing ES.

crazyeights
02-11-2001, 12:19 AM
Yeah, that would make sense. But man, when you issue that command, whatever app is gone like NOW!

That reminds me of my exw..........oh yeah, Mag doesn't like us to talk about that...........

http://macgurus.com/infopop/emoticons/icon_biggrin.gif

magician
02-11-2001, 03:03 PM
hush, now.

only use ES if you need to bail out and can't, using command-q or the menus. In other words, don't think you can kill an app in MacsBug and continue working for 50-days more without a restart. It's risky.

while it is cleaner to ES out than force-quit out, it ain't by much. Either is best considered an opportunity to execute a restart.

and guys, there is a separate directory on the FTP site labelled "macsbug_references." The contents may or may not be useful.

http://macgurus.com/infopop/emoticons/icon_wink.gif

you can also just type "help" and hit return in MacsBug itself. Extra points if you can also figure out how to print it.

http://macgurus.com/infopop/emoticons/icon_biggrin.gif

crazyeights
02-12-2001, 03:01 AM
Well......all right then....................

ah.....we knew that Mag, we just wanted to see if you were on the ball.....right guys?

http://macgurus.com/infopop/emoticons/icon_biggrin.gif

magician
02-12-2001, 09:08 PM
I bet dookie knows how to print the help screens from within MacsBug.

http://macgurus.com/infopop/emoticons/icon_wink.gif

crazyeights
02-12-2001, 10:31 PM
I wouldn't know what to do with em after I printed em. I guess I could send em to Mag, and he could do a collage on the wall of Heaven with them.

If I documented bugs would that get me in to being privy to those groovy comp copies of OS's and Apps software........aka "a developer"?

mactheripper
02-13-2001, 02:11 PM
Oh, yeah. I just remembered another little tidbit, and one that would mean you don't have to invoke the feared "stdlog" command. http://macgurus.com/infopop/emoticons/icon_biggrin.gif

There is an app that puts MacsBug in a window in the Finder, one that you can move around and have a menu bar with. It's called MacsBugWin, or MBWindow, or something weird like that. My friend showed it to me on his G4. That would probably simplify the process of learning MB.

crazyeights
02-13-2001, 02:36 PM
Righteous!! I'll see if I can track it down.

Thanks Mac!!

c8

MacMikester
02-14-2001, 12:40 AM
Its just called MacsBugApp. It is the Application version of MacsBug that comes with the download when you get MacsBug from the Apple ftp site.

magician
02-14-2001, 06:37 AM
dookie....

sigh.

http://macgurus.com/infopop/emoticons/icon_smile.gif

BMonk
04-03-2001, 10:27 PM
Jumping into this late, it's worth adding that probably the best macsbug book ever written is "Debugging Macintosh Software with Macsbug" buy Othmer and Strauss, circa 1991. I assumed it was out of print, but amazon says it's still available (and "includes version 6.2 on floppy disk!").

That book is a gold mine of interesting and useful facts, even if you never actually use it to debug anything. For example, who hasn't crashed right in the middle of posting a mesage like this one. What a drag to retype it. Well, macsbug can search RAM and usually find the text. If the system isn't totally hosed, you can usually log taht memory off to a file, then restart.

Other good books are "How To Write Macintosh Software" 1st ed by Knaster (out of print, it has little to say about -writing- software and should have been called "Why Software Crashes." Parts are way out of date but still a worthwhile book if you can find one. The 2nd ed. is more about writing software and much less about why it breaks.)

Apple's "Macsbug Reference and Debugging Guide", also from 1991, is terse and neither as entertaining or useful that the Othmer/Straus book. But it is free from Apple's site.

Current versions macsbug do lots more than is in any of these books. It's own built in help (type ? <return> for a list of topics) is the best reference. These days the mouse even works when stopped inside it. Amazing...

BTW, someone mentioned using ES to kill off a crashed app. That works in 68K, but not very well in PPC code. If it was 68K, typing
es <return>
will do the job (es = exit to shell).

But if PPC code was executing, using es will just crash back into macsbug again. So first type

gp <return>

and *then* issue ExitToShell.

Anybody can tell what kind of code is executing. Look at the register display at the left of the macsbug display. If there's a long unbroken list of items (they are the pn-chip registers) and if the bottommost label is "R31", it's PPC code

If the list is broken up into two sections, with labels D0 through D7 and A0 through A7, you're in 68K code.

Another way to tell if just look at the code. If it's displayed in all caps and seems to have English-like words in it such as
MOVEQ
MOVEM
UNLK

then it's 68K.

If it is all-lowercase gibberish such as

blr
stw
li

then it is PPC code, and the gp command is helpful before killing off the app with es.

crazyeights
04-04-2001, 12:02 AM
Hey, thanks Bmonk. That's good info. Funicular sent me a couple of links earlier today that also have some great info, here:
http://www.tidbits.com/tb-issues/TidBITS-449.html http://www.tidbits.com/tb-issues/TidBITS-450.html

I had occasion to use some of this info today. I had a full crash while doing a Palm HotSync and using IE 5.0, which I guess I was kinda asking for it ("I wonder if my Palm Mac can handle HotSync while cranking up a large HTML doc"?). Did a StdLog and determined that it was my Palm Mac app that had fully puked, and then killed it......presto! Back to IE 5.0 and full finder access again.

That is just too cool!!!! Magician, thanks for your original suggestion!!!

Hope everybody around these parts is doing okay.

Hey Mag, I'm a non-smoker now!!! 2 weeks and not counting.....much anyway.......

http://macgurus.com/infopop/emoticons/icon_biggrin.gif