jamesm@sco.COM (James M. Moore) (03/07/89)
I'd like to be able to do somthing like this in LSC 3.0: if (DebuggerIsActive()) DebugStr("\pNow in Macsbugs"); ... at the beginning of my main() procedure. This would be useful during the debugging process, as I like to be able to go in and set breakpoints before my code starts executing. How do I tell if the debugger is running? -- ** James Moore ** ** Internet: jamesm@sco.com ** ** uucp: {decvax!microsoft | uunet | ucbvax!ucscc | amd}!sco!jamesm ** ** Nil clu no suim ar bith ag SCO ceard a bhfuil me ag scriobh anois. **
jackiw@cs.swarthmore.edu (Nick Jackiw) (03/15/89)
In article <1806@viscous.sco.COM> jamesm@sco.COM (James M. Moore) writes: > I'd like to be able to do somthing like this in LSC 3.0: > > if (DebuggerIsActive()) > DebugStr("\pNow in Macsbugs"); > ... > > at the beginning of my main() procedure. This would be useful during > the debugging process, as I like to be able to go in and set > breakpoints before my code starts executing. How do I tell if the > debugger is running? > I assume you aren't talking about LSC's debugger, which I know nothing about (hence my assumption). For Macsbug et al., this should do the trick: The normal trap which the debugger invokes is $A9FF. Macsbug, TMON, etc. all patch this to point to something other than the in-ROM debugger (the empty dialog box with a '>' prompt, which--I think--accepts only DM, SM, and G commands [display mem, set mem, and go]). So what you want to do is determine whether trap $A9FF invokes the built-in debugger (worthless for breakpoints) or something else (i. e. your better- debugger-of-choice). Taking a clean (debugger-free) system, write a little program to print out the result of NGetTrapAddress($FF,ToolTrap) [cf. IM IV-234]. This is the address which a debuggerless Mac will hit; let's say it's X. Your DebuggerIsActive function is now the comparison NGetTrapAddress($FF,ToolTrap)<>X; i. e. whether someone has patched this to a different (and presumably better) debugger. Caveat: Never used LSC. LSP's DebugStr and other debugger commands CHECK whether Macsbug is installed before executing anyway (I think...maybe this only applies to their menu-invoked debugger calls). Hope this helps. > -- > ** James Moore ** > ** Internet: jamesm@sco.com ** > ** uucp: {decvax!microsoft | uunet | ucbvax!ucscc | amd}!sco!jamesm ** > ** Nil clu no suim ar bith ag SCO ceard a bhfuil me ag scriobh anois. ** -- +-------------------+-jackiw@cs.swarthmore.edu / !rutgers!bpa!swatsun!jackiw-+ | nicholas jackiw | jackiw%campus.swarthmore.edu@swarthmr.bitnet | +-------------------+-VGP/MathDept/Swarthmore College, Swarthmore, PA 19081--+ "Ah...I've got this CHRONIC pain." _True Believer_
holland@m2.csc.ti.com (Fred Hollander) (03/17/89)
In article <2547@ilium.cs.swarthmore.edu> jackiw@ilium.UUCP (Nick Jackiw) writes: >In article <1806@viscous.sco.COM> jamesm@sco.COM (James M. Moore) writes: >> I'd like to be able to do somthing like this in LSC 3.0: >> >> if (DebuggerIsActive()) >> DebugStr("\pNow in Macsbugs"); >> ... >So what you want to do is determine whether trap $A9FF invokes the built-in >debugger (worthless for breakpoints) or something else (i. e. your better- >debugger-of-choice). Taking a clean (debugger-free) system, write a little >program to print out the result of NGetTrapAddress($FF,ToolTrap) [cf. IM >IV-234]. This is the address which a debuggerless Mac will hit; let's say >it's X. Your DebuggerIsActive function is now the comparison >NGetTrapAddress($FF,ToolTrap)<>X; i. e. whether someone has patched this >to a different (and presumably better) debugger. A more general solution would be to check the address against the ROMbase. If it's in ROM, it isn't MacsBug or TMON. Fred Hollander Computer Science Center Texas Instruments, Inc. hollander@ti.com The above statements are my own and not representative of Texas Instruments.