[comp.sys.mac.programmer] Monitor trap

andwi@majestix.ida.liu.se (Andreas Wickberg) (09/28/89)

When working in THINK-C I sometimes get different result (= bombs)
when running the program from within THINK-C or as a stand alone
application. I've tried to find a way of calling the monitor (eg.
Macsbug) from the program to do the debugging from there, but without
luck. THINK can do this (cmd-M when debuggin), but how?

mnkonar@manyjars.SRC.Honeywell.COM (Murat N. Konar) (09/28/89)

In article <1363@majestix.ida.liu.se> andwi@majestix.ida.liu.se (Andreas Wickberg) writes:
>
>When working in THINK-C I sometimes get different result (= bombs)
>when running the program from within THINK-C or as a stand alone
>application. I've tried to find a way of calling the monitor (eg.
>Macsbug) from the program to do the debugging from there, but without
>luck. THINK can do this (cmd-M when debuggin), but how?

There are two calls which should be callable from C.

In Pascal they are:

procedure debugger;
{simply drops you into the debugger}

procedure debugStr(theStr:str255);
{drops you into the debugger and displays a string}
{there.  Very, very handy.}

These calls are trap based but I can't recall the 
trap words.

____________________________________________________________________
Have a day. :^|
Murat N. Konar        Honeywell Systems & Research Center, Camden, MN
mnkonar@SRC.honeywell.com (internet) {umn-cs,ems,bthpyd}!srcsip!mnkonar(UUCP)

siegel@endor.harvard.edu (Rich Siegel) (09/28/89)

In article <1363@majestix.ida.liu.se> andwi@majestix.ida.liu.se (Andreas Wickberg) writes:
>
>When working in THINK-C I sometimes get different result (= bombs)
>when running the program from within THINK-C or as a stand alone
>application. I've tried to find a way of calling the monitor (eg.
>Macsbug) from the program to do the debugging from there, but without
>luck. THINK can do this (cmd-M when debuggin), but how?

	Debugger() or DebugStr() will do the trick; when under the source
debugger, the pass control to the source debugger, but when running standalone,
they wil enter TMON or MacsBug (whichever you have installed).

	You might also try a TRAP $F, which TMON will  intercept, but I don't
know about MacsBug.

R.

~~~~~~~~~~~~~~~
 Rich Siegel
 Staff Software Developer
 Symantec Corporation, Language Products Group
 Internet: siegel@endor.harvard.edu
 UUCP: ..harvard!endor!siegel

"There is no personal problem which cannot be solved by sufficient
application of high explosives."

~~~~~~~~~~~~~~~

yahnke@vms.macc.wisc.edu (Ross Yahnke, MACC) (09/28/89)

In article <32890@srcsip.UUCP>, mnkonar@manyjars.SRC.Honeywell.COM (Murat N. Konar) writes...
{In article <1363@majestix.ida.liu.se> andwi@majestix.ida.liu.se (Andreas Wickberg) writes:
{>.........I've tried to find a way of calling the monitor (eg.
{>Macsbug) from the program to do the debugging from there, but without
{>luck. THINK can do this (cmd-M when debuggin), but how?
{ 
{There are two calls which should be callable from C.
{ 
{In Pascal they are:
    ^^^^^^
    Hey babe, he wants C not Pascal!

{procedure debugger;
{{simply drops you into the debugger}
In C this is:
  Debugger();

{procedure debugStr(theStr:str255);
{{drops you into the debugger and displays a string}
{{there.  Very, very handy.}
In C this is:
  DebugStr("\pYour String Here");

>>>      Internet: yahnke@macc.wisc.edu        <<<
>>>   Mille voix chuchottent <<c'est vrai>>    <<<

ech@cbnewsk.ATT.COM (ned.horvath) (09/28/89)

In article <1363@majestix.ida.liu.se> andwi@majestix.ida.liu.se (Andreas Wickberg) writes:

>When working in THINK-C I sometimes get different result (= bombs)
>when running the program from within THINK-C or as a stand alone
>application. I've tried to find a way of calling the monitor (eg.
>Macsbug) from the program to do the debugging from there, but without
>luck. THINK can do this (cmd-M when debuggin), but how?
 
From article <32890@srcsip.UUCP>, by mnkonar@manyjars.SRC.Honeywell.COM (Murat N. Konar):
> There are two calls which should be callable from C.

> In Pascal they are:

> procedure debugger;
> {simply drops you into the debugger}

> procedure debugStr(theStr:str255);
> {drops you into the debugger and displays a string}
> {there.  Very, very handy.}

> These calls are trap based but I can't recall the 
> trap words.

These are known to TC4; spelling is consistent with Inside Mac, i.e.

	Debugger();	/* trap a9ff */
	DebugStr("\PHello Debugger!");	/* abff */

=Ned Horvath=

chaffee@reed.UUCP (Alex Chaffee) (09/29/89)

In C, the interrupt commands are Debugger() and DebugStr("\pOops...").  With
the THINK Debugger active they stop the program and activate the debugger,
but from there you can just press CMD-M to get into MacsBug.  

Note that pressing the rear programmer's switch will also drop you into
Macsbug, but if you do this with the debugger active, you'll be debugging
the debugger, hence CMD-M, which switches context before the interrupt.

Alex Chaffee
chaffee@reed.UUCP
___________________
-- 
Alex Chaffee
chaffee@reed.UUCP
____________________