maclab@reed.UUCP ( S. Gillespie ) (09/25/85)
This article contains a bit of documentation for a new desk accessory (SegWatcher) which gives programmers the opportunity to observe the loading and unloading of CODE segments at run-time. I have also posted the following file to Net.Sources.Mac: SegWatcher.hqx -- The desk accessory, as an Apple Font/DA Mover file, in BinHex 4.0 format. (about a 2.7K D/A). It is not too sophisticated, but it does the job. It was, of course, written with the Rascal Development System, and I will send the source directly to anyone who is interested. Scott Gillespie Reed College UUCP: {decvax, ucbvax, pur-ee, uw-beaver, masscomp, cbosg, aat, mit-ems, psu-cs, uoregon, orstcs, ihnp4, uf-cgrl, ssc-vax}!tektronix \ +--!reed!maclab {teneron, ogcvax, muddcs, cadic, oresoft, grpwre, / harvard, psu-cs, omen, isonvax, nsc-pdc}------------+ ------------------------------------------------------------- SegWatcher.Doc V.85.09.24.spg SegWatcher is a Desk Accessory which tracks the loading and unloading of program segments. The CODE segment numbers of the current application are listed in the D/A window; squares to the right of the segment numbers indicate: (M) -- Segment is in Memory (L) -- Segment is Locked As long as the current application calls SystemEvent regularly (as it should), SegWatcher will update itself 5 times per second. Note: Code Segment 0 (the jump table) is not included in the display. Another Note: The SegWatcher display will screw up if the current application has more than about 26 segments. Some Applications (notably, Rascal!), will close desk accessories before beginning some operations. Selecting items from the standard Edit menu while SegWatcher is the front window will cause SegWatcher to hide itself for a few seconds (the window's WindowKind field is changed to a positive number, and the window is hidden), thus tricking the application into thinking there are no D/A windows open : Cut: Hide for 2 seconds; Copy: Hide for 4 seconds; Paste: Hide for 6 seconds; Clear: Hide for 8 seconds; Holding the mouse button down with the cursor in SegWatcher's window will cause everything to stop (if the application is calling GetNextEvent, as it should), until you let up on the mouse button (SegWatcher does this so that you can freeze the display at any particular moment). A typical SegWatcher display might look like this (interpretation follows): ------------| # M L | 1 X X | 2 | 3 X | 4 | 5 X X | 6 X | 7 | ------------- A display such as that above, would indicate the following: -- CODE segment 1 is in memory, and Locked (as it should be: segment 1 is the blank segment). -- Segments 2, 4 and 7 are not in memory. -- Segments 3 and 6 are in memory, but they have been marked 'purgeable.' i.e. the segment has been 'unloaded.' -- Segment 5 is in memory, and locked. End of documentation. ----------
gus@Shasta.ARPA (09/27/85)
> > Some Applications (notably, Rascal!), will close desk accessories before > beginning some operations. Selecting items from the standard Edit menu > while SegWatcher is the front window will cause SegWatcher to hide itself > for a few seconds (the window's WindowKind field is changed to a positive > number, and the window is hidden), thus tricking the application into > thinking there are no D/A windows open : > > Cut: Hide for 2 seconds; > Copy: Hide for 4 seconds; > Paste: Hide for 6 seconds; > Clear: Hide for 8 seconds; > CAVEAT: This is not a good idea. Most applications assume that windows with positive windowkinds belong to them. This 'trick' done by SegWatcher might cause applications to fail when they see a windowkind which they don't know how to handle. Why should RASCAL close all DA's? This seems to be the real problem. Gus Fernandez