home *** CD-ROM | disk | FTP | other *** search
/ AMIGA PD 1 / AMIGA-PD-1.iso / Programme_zum_Heft / Programmieren / Kurztests / Mungwall / mungwall.doc < prev    next >
Text File  |  1993-03-03  |  11KB  |  231 lines

  1. 25-Feb-93 Mungwall 37.64 doc.
  2.  
  3. Mungwall munges memory and watches for illegal FreeMem's.
  4. Mungwall is especially useful in combination with Enforcer.
  5. Output is either serial or parallel (mungwall.par), or local by
  6. using both mungwall and a local serial debug capture tool such
  7. as Sushi.
  8.  
  9. Revisions
  10. =========
  11.  
  12. Since 37.49 MungWall, NAMETAG option tags each allocation with the name
  13. of the allocator.  The new "MUNGLIST" program examines used memory areas
  14. for mungwall tag info, and outputs a list of who owns the various
  15. pieces of allocated memory, their sizes, etc.  If you have used the
  16. NAMETAG option of MungWall, this list will include the name of the
  17. task or command that allocated the memory.  Note that certain
  18. allocations belonging to your program may be displayed as belonging
  19. to another task (such as the task of a disk device that you
  20. locked a file on or accessed).
  21.  
  22. Mungwall 37.51 adds an AvailMem wedge which reduces reported available
  23. memory by the size which Mungwall will add to any allocation.  It also
  24. correct a problem which had caused the NAMETAG option to crash on a
  25. 68000.
  26.  
  27. Mungwall 37.52 fixes Enforcer hits in task name comparisons and adds
  28. better A6 handling when calling the real memory functions.
  29.  
  30. Mungwall 37.53 should finally fix mungwall crashes on 68000 when
  31. using taskname-related options.
  32.  
  33. Mungwall 37.54 - some fixes to output during initialization
  34.  
  35. Mungwall 37.55 - fixes a bug in Mungwall where last chunk of memory
  36.    could be lost, and fixes a similar bug in munglist which could occur
  37.    if munglist's buffer filled.  Also added munglist bufsize argument.
  38.  
  39. Mungwall 37.57 - stops null terminating cli_CommandName in place which
  40.    makes mungwall name options again compatible with DMAKE and ARexx
  41.    scripts with 1-character names.  Adds new SHOWFAIL option which
  42.    tells Mungwall to report all failed allocations.  Changes the output
  43.    text "(at 0xhhhhhhh)" to "(task 0xhhhhhhh)" to be easier to understand.
  44.  
  45. Mungwall 37.58 - adds matching NO and UPDATE options for SHOWSTACK,
  46.    NAMETAG, and SHOWFAIL.
  47.  
  48. Mungwall 37.60 - adds SHOWPC dump of memory at A: and C: caller addresses
  49.    and a matching NOSHOWPC option.  Does not show a supposed PC address
  50.    if it is not RAM according to TypeOfMem().  This is to help prevent
  51.    enforcer hits or worse, possible reads (or read-triggered writes)
  52.    to hardware registers.
  53.  
  54. Mungwall 37.61 and Munglist 37.4 - Add the important capability for
  55.    Mungwall to distinguish between old mungwall cookies left over in
  56.    memory after rebooting, and new ones.  The mungwall info area on
  57.    each allocation has been enlarged by 8 bytes and now contains a
  58.    second per-session cookie which is based on the datestamp
  59.    when mungwall is first started.   Munglist has been enhanced
  60.    to show the addresses applications received when they allocated
  61.    memory, not the address of the larger piece mungwall allocated.
  62.    Some changes to output format.
  63.  
  64. Mungwall 37.62 implements a new default rolling fill character for
  65.    the walls surrounding memory allocations.  Each allocation gets
  66.    a new fill character between $81 and $FF.  This allows Mungwall to
  67.    generally catch errors where too much memory has been copied
  68.    from one allocation to another.  Note that the explicit FILLCHAR
  69.    option of Mungwall now disables the rolling fillchar feature.
  70.    Do not use the FILLCHAR option if you want the protection of the
  71.    rolling fill char.  Some changes to output format.
  72.  
  73. Mungwall 37.63 adds SHOWHUNK and NOSHOWHUNK options.  With SHOWHUNK,
  74.    mungwall will attempt to show the hunk and offset for the probable
  75.    C or Asm PC addresses of the caller generating the hit if the PC
  76.    address is in RAM and also within the seglist of the caller's process.
  77.  
  78. Mungwall 37.64 adds SegTracker support.  If SHOWHUNK is option is on,
  79.    if SegTracker is installed, mungwall will get hunk/offset info
  80.    from SegTracker, else mungwall can only check if the probable
  81.    PC addresses are in the calling process's own SegList.
  82.  
  83.  
  84. What Mungwall Does
  85. ==================
  86.  
  87. Memory munging:
  88.  
  89.  - Except when Enforcer is running, location 0 is set to $C0DEDBAD, i.e.
  90.    programs referencing location zero will not f.e. find a null string.
  91.  
  92.  - On startup all free memory is munged with $ABADCAFE. If this number
  93.    shows up, someone is referencing memory in the free list.
  94.  
  95.  - Except when MEMF_CLEAR is set, memory is pre-munged on allocation with
  96.    $DEADFOOD. When this is used in an Enforcer report, the caller is
  97.    allocating memory and doesn't initialize it before using it. Note that
  98.    only memory which has a cookie attached will be pre-munged.
  99.  
  100.  - Memory is filled with $DEADBEEF before it is freed, encouraging
  101.    programs reusing free'ed memory to crash.
  102.  
  103. Memory watching:
  104.  
  105. Mungwall places a magic cookie before the memory allocation.
  106. Along with a wall of bytes on either side of the allocation to keep an
  107. eye on the memory just before or after the allocation. If the
  108. memory wall is trashed, mungwall complains and shows the damaged area.
  109. If memory is trashed so bad that the cookie is completely gone, Mungwall
  110. will not consider it a walled memory allocation and lets it go. Changes
  111. are you'll be corrupting the memory list and/or overwriting other memory
  112. allocation and crash soon after that. If a mungwall hit occurs, memory
  113. will not be munged or free'ed, to give you a change to look at what was
  114. written there.
  115.  
  116. Both null pointer FreeMem()'s and null sized Alloc/FreeMem()'s trigger
  117. mungwall. Mungwall also gets upset when a memoryblock is free'ed with a
  118. size different from the one used for allocating the memoryblock, and will
  119. say so. The integrity of the walls will be tested according to the size
  120. specified on allocation time, but will not be free'ed.
  121.  
  122. Pointers passed to FreeMem() will be rejected if they are non-longword
  123. alligned. Thus possible catching bogus pointers otherwise left untouched
  124. by mungwall.
  125.  
  126. Unless a specific task(s) is watched and that task leaves before mungwall
  127. does, mungwall will always lose some memory.
  128.  
  129. NOTES:
  130.  
  131. Other debugging tools which SetFunction() AllocMem() and/or
  132. FreeMem() and JSR to what they think is the old memory routine,
  133. should be run BEFORE mungwall. Mungwall needs to know the returnaddress
  134. of the initial caller. Running other debugging tools after mungwall
  135. will result in false reports about layers.library and invalid
  136. mungwall reports about the caller. The 'scratcher' for example must
  137. be run before mungwall, 'memoration' can be run afterwards, since it
  138. JMP's.
  139.  
  140. When mungwall is being stopped, the walls around the original allocations
  141. which are not free'ed at that point, will never get free'ed, only the block
  142. within. Thus causing memory fragmentation and memory loss.
  143. In addition, stopping and restarting mungwall can cause numerous
  144. bogus mungwall hits if applications allocate uncleared memory
  145. (containing unlceared mungwall cookies) while mungwall is off and then
  146. free it when mungwall is back on.
  147.  
  148.  
  149. Memory allocations larger than 3 gigabytes will not be marked by mungwall.
  150.  
  151.  
  152.  
  153. MUNGWALL [UPDATE] [[TASK name][WAIT]] [SNOOP] [NOSNOOP] [NOWAIT] [INFO]
  154.          [SHOWSTACK] [NOSHOWSTACK] [NAMETAG] [NONAMETAG] [SHOWPC][NOSHOWPC]
  155.      [SHOWFAIL] [NOSHOWFAIL] [PRESIZE n] [POSTSIZE n] [FILLCHAR 0xXX]
  156.      [SHOWHUNK] [NOSHOWHUNK]
  157.  
  158. TASK name   - Watch only the task(s), or all but the task(s) specified
  159.               with 'name'. Multiple tasknames are indicated by placing
  160.               a '|' between the names. If the names are preceeded by an
  161.               exclamation mark, all tasks except the ones indicated are
  162.               tracked. ALL is a reserved name, indicating all tasks
  163.               should be tracked. Default ALL.
  164.  
  165. PRESIZE     - Size of wall before memory allocation in bytes. Minimum 4,
  166.               maximum 64. Default 32.
  167.  
  168. POSTSIZE    - Size of wall after memory allocation in bytes. Minimum 4,
  169.               maximum 64. The actual number of bytes after the allocation
  170.               may vary slightly, since it's upped to the nearest longword.
  171.               Default 32.
  172.  
  173. FILLCHAR n  - Character to build the memory wall with. Can be indicated
  174.               both hexadecimal and decimal. Default is a rolling fillchar
  175.           which uses a new odd number between $81 and $FF for each
  176.           new allocation.  This makes it possible for Mungwall to
  177.           usually catch errors where too much memory is copied
  178.           from one allocation to another.  Specifying a FILLCHAR
  179.           disables the default rolling fillchar feature.
  180.           
  181. SNOOP       - Produce snoop compatible output. No snoop output is given
  182.               for illegal FreeMem's. Default OFF. Layers AllocMem's and
  183.               FreeMem's are never snooped. SNOOP is particulary useful
  184.               in combination with TASK. Snoop output can be filtered
  185.               with 'snoopstrip' to find the origin of memory loss.
  186.  
  187. WAIT        - Halt task causing a hit and wait for Ctrl-C. Make sure you
  188.             - can issue a break to the task. WAIT can be used without
  189.               specifying a specific taskname to watch. Default OFF.
  190.  
  191. INFO        - Show configuration information.
  192.  
  193. SHOWSTACK   - Show 32 longwords of the stack whenever a hit/snoop occurs
  194.  
  195. NAMETAG     - Tag each allocation with allocating task or command's name
  196.  
  197. SHOWFAIL    - Tells mungwall to report all memory allocation failures
  198.  
  199. SHOWPC        - Show a dump of memory at the A: and C: possible PC
  200.           (program counter) addresses (one should be correct)
  201.               Does not show a supposed PC address if it is not RAM
  202.               according to TypeOfMem().  This is to help prevent enforcer
  203.               hits or worse, possible reads (or read-triggered writes)
  204.               to hardware registers.
  205.  
  206. SHOWHUNK    - On a hit or snoop, if the probable PC address of a reported
  207.           call to AllocMem or FreeMem is within the calling process's
  208.           seglist, attempt to show hunk and offset information.
  209.  
  210. UPDATE      - Indicates an already running mungwall task should be up-
  211.               dated with new parameters. Presize, postsize and fillchar
  212.               can never be updated.  NOTE - when doing an UPDATE, the
  213.           UPDATE option must be the first command line arg
  214.  
  215. The following are extra updating parameters.
  216.  
  217. NOSNOOP     - Turn snooping off.
  218.  
  219. NOWAIT      - No longer halt a task in case of an error.
  220.  
  221. NONAMETAG   - Turn off taskname storage
  222.  
  223. NOSHOWSTACK - Turn off showstack option
  224.  
  225. NOSHOWFAIL  - Turn off option that displays memory allocation failures
  226.  
  227. NOSHOWPC    - Turn off option that displays dump of memory at caller PC
  228.  
  229. NOSHOWHUNK  - Turn off options that displays hunk and offset information
  230.  
  231.