[comp.sys.mac.programmer] detecting macsbug

sonenbli@oxy.edu (Andrew D. Sonenblick) (09/06/90)

is there a cool way of detecting whether macsbug is installed?

Ando Moon: In the end we're all MoOnaTicS!
sonenbli@oxy.edy

smoke@well.sf.ca.us (Nicholas Jackiw) (09/26/90)

In article <109400@tiger.oxy.edu> sonenbli@oxy.edu (Andrew D. Sonenblick) writes:
>is there a cool way of detecting whether macsbug is installed?

Can you just check if GetTrapAddress($A9FF)<>GetTrapAddress(UnImplTrapNum)?
This will, of course, only tell you if -somebody- has installed a debugger,
not necessarily whether -macsbug- has.  ($A9FF is the _Debug trap.)  Check out
Tech Note #156 for info on GetTrapAddress and its bigger sibling, 
NGetTrapAddress.

-- 
                              --- * ---
Nicholas Jackiw                Smoke@well.sf.ca.us | Jackiw@cs.swarthmore.edu
Key Curriculum Press, Inc.     Applelink: D3970    | (415) 548-2304
                              --- * ---

tim@hoptoad.uucp (Tim Maroney) (09/29/90)

In article <109400@tiger.oxy.edu> sonenbli@oxy.edu (Andrew D. Sonenblick)
writes:
>>is there a cool way of detecting whether macsbug is installed?

In article <20759@well.sf.ca.us> smoke@well.sf.ca.us (Nicholas Jackiw) writes:
>Can you just check if GetTrapAddress($A9FF)<>GetTrapAddress(UnImplTrapNum)?
>This will, of course, only tell you if -somebody- has installed a debugger,
>not necessarily whether -macsbug- has.  ($A9FF is the _Debug trap.)

If I recall correctly, I tried this once and it didn't work.  MacsBug
takes over the trap dispatcher in order to intercept its two debugger
traps; it doesn't use SetTrapAddress to grab the traps.
-- 
Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com

This message does represent the views of Eclectic Software.

thecloud@dhw68k.cts.com (Ken McLeod) (09/30/90)

In article <20759@well.sf.ca.us> smoke@well.sf.ca.us (Nicholas Jackiw) writes:
>In article <109400@tiger.oxy.edu> sonenbli@oxy.edu (Andrew D. Sonenblick) writes:
>>is there a cool way of detecting whether macsbug is installed?
>
>Can you just check if GetTrapAddress($A9FF)<>GetTrapAddress(UnImplTrapNum)?
>This will, of course, only tell you if -somebody- has installed a debugger,
>not necessarily whether -macsbug- has.  ($A9FF is the _Debug trap.)  Check out

 Checking to see if the _Debugger and/or _DebugStr traps are implemented is
the obvious thing to do... unfortunately, they appear to be implemented all
the time now in current systems, whether a debugger is installed or not.
Another method, also fraught with peril, is to test the low-memory vector
MacJmp ($120) for a valid (positive, even, non-zero address) pointer to
Macsbug's code. This is the method MacEnvy uses, as of 2.1; however, it
hasn't proved to be a 100% infallible test. :(  If MacJmp contains an
*invalid* pointer, you can be reasonably sure that Macsbug is NOT installed.
A third method would be to read the name of the debugger from the boot
blocks, then try to OpenRFPerm() that file in the System Folder and see
whether ResError() returns noErr or resFNotFound. Obviously, this wouldn't
work if someone placed the Macsbug file in their System Folder after boot
time (or removed it after boot time) before your program had a chance to
check for it.

 Maybe there will eventually be a Gestalt selector for this. Or not.

-ken

 
-- 
==========     .......     =============================================
Ken McLeod    :.     .:    UUCP: ...{spsd,zardoz,felix}!dhw68k!thecloud
==========   :::.. ..:::   INTERNET: thecloud@dhw68k.cts.com
                ////       =============================================