[comp.sys.mac.programmer] TMON and LSD

nopuklic@ndsuvax.UUCP (Blayne Puklich) (08/24/88)

	Here's what I think is a mildly interesting question involving
using LSD with TMON underneath it.  I read as much as I could find
about it last night, and I didn't find out anything except that there
is no simple way to do it (see page 145 of the LSC 3.0 manual).

	Say for example I wanted to have TMON watch the heap and watch
all traps (heap check only, strict trap discipline).  TMON then finds
a problem with either the heap or one of the trap calls, and is entered,
giving me a description of the problem.  How exactly can I have TMON
exit and wakeup LSD so LSD points at the source line that caused the
problem (or somewhere close)?  Is this truly impossible to do?
TMON will let me know what trap caused the problem, but what if that
was called from a ROM routine which called another ROM routine which did
the same thing?  I know about the stack crawl function and that *can*
get me close, but that's no fun to use when you have a source-level
debugger sitting there doing nothing.  Another problem is that if LSD
is used, the stack crawl doesn't seem to point to the right spot (it
points somewhere inside LSD I suppose).

	I've found a boneheaded way to do it but I hate all the time
it takes me to step through my code.  What I do is move all the windows
I can out of the way of the Source window.  I then enter TMON before
starting my application and set the check and discipline.  I start my
application and wait until it hits a certain breakpoint.  Then I have
LSD trace through the code (using command- or option-t), and I sit
back and wait until TMON gets excited.  If everything works out
correctly the Source window will be sitting within a few lines of
that problem line (note there will probably be no "arrow").

	My only problem is that I can't afford to spend all the time
in LSD's trace mode.  Is there a way I can have LSD wake up from TMON?
Do I need to alter the User Area in some way, say, by adding a few new
labels?  There's no problem doing that, I guess.  Or am I completely
missing something simple here?  (If I am it sure ain't the first time.)

	I guess I'm just curious if there is another way to do this.
What I'm doing is pretty well-behaved, but soon I'll want to try and
get it to barf after running for a long time, and I'll sure want to
have a better idea of where it occurred than a silly guess.  Any help
with this sure would be appreciated, since I have this sneaky feeling
that I'm asking for way too much.

	Thanks in advance.

	Oh, by the way, I'm using a Mac II, 2mb RAM, Finder 6.0 and
System 4.2.  I gave up on System Release 6.0, and I can't find 6.0.1
in this stupid town (I'm in Bismarck now).

||+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++||
||	Blayne Puklich			nopuklic@plains.NoDak.edu	   ||
||	NDSU Student ACM     use this-> NU087763@NDSUVM1.bitnet		   ||
||	Chairperson		  North Dakota State University, Fargo, ND ||
||									   ||
||		"Everyone should have a Corvette, I think."		   ||
||-------------------------------------------------------------------------||