home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 5 / FreshFish_July-August1994.bin / bbs / util / heartbeat-1.0.lha / HeartBeat-1.0 / README < prev    next >
Encoding:
Text File  |  1994-05-30  |  10.5 KB  |  278 lines

  1. *****************************************************************************
  2. *                                        *
  3. *    Conditions of use                HeartBeat 1.0        *
  4. *    -----------------                -------------        *
  5. *                                        *
  6. *    This program has been provided for the enjoyment of the masses.        *
  7. *    It is Public Domain.                            *
  8. *    Since the author doesn't ask for anything in return, the user        *
  9. *    will accept the following conditions:                    *
  10. *                                        *
  11. *    1) In no case whatsoever shall the author be liable for any        *
  12. *       damages, losses etc... due to the use of this program.        *
  13. *    2) Distribution of the program is only allowed subject to the        *
  14. *       following restrictions:                        *
  15. *                                        *
  16. *    2.a) No file part of this distribution will be omitted or        *
  17. *         modified in any way.                        *
  18. *    2.b) None of the files which are part of this distribution        *
  19. *         should be stored on environmentally unfriendly media.        *
  20. *         (e.g. paper! (listings, faxes))                    *
  21. *                                        *
  22. *                    Laurence Vanhelsuwé            *
  23. *                    22-APR-92                *
  24. *                                        *
  25. *****************************************************************************
  26.  
  27. Program Title : HeartBeat (HB)    (Version 1.0)
  28. -------------------------
  29. Author : Laurence Vanhelsuwé
  30. ----------------------------
  31.  
  32. 0. Short description:
  33.    ------------------
  34.  
  35.     HeartBeat (short: HB) is a system call monitor which allows all
  36.     system calls accessible through libraries, devices or resources
  37.     to be snooped on. Generic argument snooping is also provided.
  38.  
  39.  
  40. 1. Requirements/Installation:
  41.    --------------------------
  42.  
  43.     This program makes heavy use of the new 2.0 system calls.
  44.     Additionally HeartBeat assumes a logical directory (assign) called
  45.  
  46.         FD:
  47.  
  48.     which contains ".fd" files (as many as you can lay your hands on).
  49.     These files are normally distributed on Workbench disks and describe
  50.     system library, device and resource calls.
  51.  
  52.     For example, my system contains the following files in FD:
  53.  
  54.     ( DIR FD: )
  55.  
  56.       amigaguide_lib.fd                asl_lib.fd
  57.       battclock_lib.fd                 battmem_lib.fd
  58.       bullet_lib.fd                    cardres_lib.fd
  59.       cia_lib.fd                       colorwheel_lib.fd
  60.       commodities_lib.fd               console_lib.fd
  61.       datatypes_lib.fd                 diskfont_lib.fd
  62.       disk_lib.fd                      dos_lib.fd
  63.       dtclass_lib.fd                   exec_lib.fd
  64.       expansion_lib.fd                 gadtools_lib.fd
  65.       graphics_lib.fd                  icon_lib.fd
  66.       iffparse_lib.fd                  input_lib.fd
  67.       intuition_lib.fd                 keymap_lib.fd
  68.       layers_lib.fd                    locale_lib.fd
  69.       mathffp_lib.fd                   mathieeedoubbas_lib.fd
  70.       mathieeedoubtrans_lib.fd         mathieeesingbas_lib.fd
  71.       mathieeesingtrans_lib.fd         mathtrans_lib.fd
  72.       misc_lib.fd                      potgo_lib.fd
  73.       ramdrive_lib.fd                  rexxsyslib_lib.fd
  74.       timer_lib.fd                     translator_lib.fd
  75.       utility_lib.fd                   wb_lib.fd
  76.  
  77.  
  78. 2. How to use it:
  79.    --------------
  80.  
  81.     Just type the following at any Shell prompt:
  82.  
  83.         RUN HB
  84.  
  85.     I suggest you "run" HeartBeat because HB currently changes the
  86.     current directory but does not restore it before exiting (sorry).
  87.     Using a "RUN" shields you from this side-effect.
  88.  
  89.     Check out the menus and you'll get:
  90.  
  91.         PROJECT   OPTIONS   LIBRARIES A-I   LIBRARIES J-Z
  92.  
  93.     Your main menus are the two library menus which list all the
  94.     libraries that HeartBeat knows about (and devices and resources).
  95.  
  96.     Select any library you're familiar with and you'll be presented
  97.     with a list of its system calls (any function names highlighted in
  98.     inverse video means they don't point to ROM code (could be virus?)).
  99.  
  100.     Now select a system call by moving the highlight over the function
  101.     and click... you are now monitoring this call.
  102.     A seperate window popped up to display your monitored function.
  103.  
  104.     Using a similar select-and-click method in this second window you can
  105.     bring up the register template window and define an "arguments match
  106.     template".
  107.     You are presented with 32 string gadgets: one pair for every data and
  108.     address register of the 680x0. One for the register's value (or bits
  109.     you want to see set or cleared) and one for a mask defining which bits
  110.     you care about (0 means you don't care at all what value this register
  111.     is).
  112.     Note that the string gadgets accept decimal and hexadecimal numbers
  113.     (prefixed with $).
  114.     The default values which initially appear are explained as follows:
  115.      - register A7 has a mask of $FFFFFFFF and a value of $00000000.
  116.        (this ensures a "no match" WHATEVER the settings of the other
  117.        registers are since the SP can never point to 0!).
  118.      - register D0 has a mask of $FFFFFFFF and a garbage value of $A1B2C3D4
  119.        (this gives a very high probability of a "no match" as detected by
  120.        the wedge routine since it starts with D0,D1,D2...)
  121.  
  122.     Basically this is done to prevent matches occuring before you've
  123.     defined the template yourself (the matching process is active all the
  124.     time).
  125.  
  126.     You can select between two match action modes:
  127.      - just count matches    (a separate counter is used for matches)
  128.      - freeze calling Task    (a "!" will turn into a "*" in output window)
  129.  
  130.     The freezing option only works if you explicitly tell HeartBeat
  131.     which Task in the system you want to monitor.
  132.     This is done by selecting the "Watch Task..." option in the OPTIONS
  133.     menu.
  134.  
  135.     The project menu allows you to load and save a HeartBeat "session".
  136.     A session is just the collection of system functions that you are
  137.     currently monitoring.
  138.  
  139.     When loading a previously saved session, the window with monitored
  140.     functions might contain less functions as originally saved.
  141.     This is because the library (device or resource) to which these
  142.     functions belong might not be accessible this time round (not opened).
  143.     (e.g. the rexxsyslib might have been accessible by HeartBeat when
  144.     saving a session but not any more when loading).
  145.  
  146.  
  147. 3. HeartBeat: it's uses.
  148.    ---------------------
  149.  
  150.     HeartBeat is a system call monitor.
  151.  
  152.     HB complements programs like MonIDCMP, SnoopDOS or SPY, although HB
  153.     does not have any bias towards a particular library like SnoopDOS
  154.     or SPY.
  155.     Because of this general-purpose nature, HB can't give you very
  156.     detailed information of what the parameters passed to a routine
  157.     are. In fact, it doesn't give you any. (ha!)
  158.     It just counts each call made, whether by a specific Task in the
  159.     system or globally (by any Task).
  160.     In this simple mode HeartBeat can be viewed as a higher level
  161.     extension to my other system utility :
  162.         ISAN (Instruction Stream ANalyzer)
  163.     which has also been put in the Public Domain.
  164.  
  165.     To make the program a bit more useful, you can also define a
  166.     register arguments template on a per-function basis: you could for
  167.     example count the number of times AllocMem() is called with the
  168.     MEMF_CHIP flag set.
  169.     You would do this by defining a value and mask for data register
  170.     D1 (where the memory type argument has to be passed) and specifying
  171.     "don't care" masks for all other registers of the 680x0.
  172.  
  173.     To make the program somewhat more productive you can ask HeartBeat
  174.     to freeze the calling Task when an argument template matches.
  175.     You can obviously un-freeze such a Task too (by clicking on the
  176.     function when its frozen marker "*" has appeared).
  177.  
  178.     Example uses:
  179.  
  180.     - work out whether a program uses OS 2.0 calls or not.
  181.  
  182.     - snooping on programs to see if they use system calls when..
  183.        a) they should (to allocate memory for example) or when
  184.        b) they shouldn't
  185.         (for example THE bottleneck of a brilliant ecology simulator
  186.         program called "Jitter" could very well be its use of
  187.         RectFill(); to draw just 4 pixels RectFill() uses nothing
  188.         less than the Blitter to do its stuff and this could be
  189.         re-coded to be at least ten times faster in optimized
  190.         assembler!!)
  191.  
  192.     - learn about the Amiga and surprise yourself at how often or how
  193.       rarely functions get called... and wonder whether the frequently
  194.       called ones are implemented efficiently or not...
  195.  
  196.     - catching faulty programs or viri by intercepting calls with
  197.       particular pararmeters. (a virus might well make AllocAbs() or
  198.       SetFunction() calls).
  199.  
  200. 4. Internals:
  201.    ----------
  202.  
  203.     HeartBeat gets all its "knowledge" of Amiga system internals from
  204.     the .fd files in the FD: directory.
  205.  
  206.     From these files it extracts:
  207.  
  208.         a) library names (or device or resource names)
  209.         b) function LVOs and names
  210.         c) function accessability
  211.  
  212.     c) Means that HeartBeat does not allow you to access system private
  213.     functions (##private).
  214.  
  215.  
  216. 5. HeartBeat Limitations/Warnings:
  217.    -------------------------------
  218.  
  219. !CRASH!    Be careful when monitoring Exec and other low-level and/or critical
  220.     libraries.
  221.     In particular all Exec routines which rely on privilege exception
  222.     trapping tricks will crash the system when attempting to monitor them.
  223.     Similarly the SumLibrary() function crashes because of SetFunction()
  224.     interactions.
  225.  
  226. !CRASH!    Be very careful too with HeartBeat's freeze option.
  227.     Freezing any system Task which disables any part of the system that
  228.     you in turn need to unfreeze the Task (e.g. mouse input routines,
  229.     sprite moving routines, Text printing routines...) will effectively
  230.     result in freezing the entire machine !
  231.  
  232. 6. History:
  233.    --------
  234.  
  235.     I like low-level system utilities like this.
  236.     I think they should be provided as standard when you buy a machine
  237.     like the Amiga.
  238.  
  239.     AmigaDOS' "STATUS FULL" and "BREAK" commands are just pathetic
  240.     when you compare them with what a UNIX hacker has at his disposal.
  241.     Since the Amiga has quite a lot in common (complexity wise) with
  242.     UNIX machines the Amiga user should also have an arsenal of tools
  243.     at his side to make better use of his machine.
  244.  
  245. 7. Future:
  246.    -------
  247.  
  248.     Some ideas for future versions of HeartBeat are already:
  249.     - allow function RESULTS to be trapped too (handy for errors)
  250.     - allow argument register mappings to be defined (SetAPen(1)->SetAPen(2))
  251.  
  252.     - remove all bugs in current version...
  253.  
  254.     To any programmers thinking of enhancing HB: please don't "adopt"
  255.     HeartBeat yet. I know it's far from robust and complete at this moment,
  256.     but it's already useful enough to be released.
  257.     I'd like to get some feedback and work one the next release myself.
  258.  
  259. 8. Credits:
  260.    --------
  261.  
  262.     Since I'm still stuck with old 1.2 Rom Kernal Manuals and the like,
  263.     I could not have written this program without the source codes of
  264.     various 2.0 programs in the Fish library.
  265.     I am especially grateful to Steve Tibbett for adding the source
  266.     to his PSX release (even though it's a bit sparse on comments !!).
  267.  
  268.     Any comments, ideas or bug reports? 
  269.     My name and address are:
  270.     
  271.     Laurence Vanhelsuwé
  272.     Christinastraat 105
  273.     B-8400 Oostende
  274.     BELGIUM
  275.  
  276.  
  277.                             Enjoy !
  278.