home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / SOFTIC~1.ZIP / DOC-TXT.ZIP / CHAP9 < prev    next >
Text File  |  1992-05-24  |  6KB  |  166 lines

  1.   CHAPTER 9
  2.  
  3.  Back Trace Ranges
  4.    9.1 Introduction
  5.    9.2 Using Back Trace Ranges
  6.    9.3 Special Notes
  7.  
  8.      197 
  9.  
  10. 9.1 Introduction
  11.  
  12. Soft-ICE can collect instruction information in a back trace history
  13. buffer as your program executes. These instructions can then be displayed
  14. after a bug has occurred. This allows you to go back and retrace a
  15. program's action to determine the actual flow of instructions preceding a
  16. break point.
  17.  
  18. Instruction information is collected on accesses within a specified
  19. address range, rather than system wide. The ranges can be from 1 byte to 1
  20. megabyte, so if desired, complete system information can be obtained.
  21. Using specific ranges rather than collecting all instructions is useful
  22. for two reasons:
  23.  
  24.    1. The back trace history buffer is not cluttered by
  25.         extraneous information that you are not interested
  26.         in. For example, you may not be interested in
  27.         interrupt activity and execution within MSDOS.
  28.    2. Back trace ranges degrade system performance while
  29.         they are active. By limiting the range to an area
  30.         that you are interested in, you can improve system
  31.         performance greatly.
  32.  
  33. Soft-ICE has two methods of utilizing the instructions in the back trace
  34. history buffer:
  35.  
  36.    1. The SHOW command allows you to display
  37.         instructions from the back trace history buffer.
  38.         You must specify how many instructions you wish
  39.         to go back in the buffer.
  40.    2. The TRACE command allows you to go back and
  41.         replay instructions from the back trace history
  42.         buffer, This way you can see the instruction flow
  43.         within the context of the surrounding program
  44.         code or source code.
  45.  
  46.      198 
  47.  
  48. 9.2 Using Back Trace Ranges
  49.  
  50. To use back trace ranges you must do the following:
  51.     1. Allocate a back trace history buffer of the desired
  52.         size by inserting the /TRA switch on the
  53.         S-ICE.EXE line in CONFIG.SYS. For example,
  54.         to create a back trace buffer of 100K you might
  55.         have the following line in your CONFIG.SYS file:
  56.         DEVICE = S-ICE.EXE 100
  57.         A back trace history buffer of 10K is allocated by
  58.         default. If this is suitable for your needs you do not
  59.         have to allocate a larger buffer.
  60.         The history buffer size is only limited by the
  61.         amount of extended memory available.
  62.    2. Enable back trace ranges by creating a memory range
  63.         break point with the T or TW verb. For example:
  64.         BPR 1000:0 2000:0 T
  65.         The T and TW verbs do not cause break points
  66.         instead they log instruction information that can be
  67.         displayed later with the SHOW or TRACE
  68.         commands.
  69.    3. Set any other break points if desired.
  70.    4. Exit from Soft-ICE with the X command.
  71.    5. After a break point has occurred, or you have
  72.         popped Soft-ICE up with the hot key, you can
  73.         display instructions in the buffer with the SHOW
  74.         command. For example, to go back 50 instructions
  75.         in the buffer and display instructions type:
  76.         SHOW 50
  77.  
  78.      199
  79.  
  80.    6. To replay a series of instructions you must first
  81.       enter trace simulation mode with the TRACE
  82.       command. To begin replaying the sequence of
  83.       instructions starting back 50 in the buffer type:
  84.  
  85.       TRACE 50
  86.  
  87.    7. After you have entered trace simulation mode, you
  88.       can trace through the sequence of instructions by
  89.       using the XT, XP, or XG commands. This allows
  90.       you to re-enact the program flow. For example,
  91.       you can single step through the sequence of
  92.       instructions in the buffer, starting at the instruction
  93.       specified by the TRACE command, by typing:
  94.  
  95.       XT
  96.       XT
  97.       .
  98.       .
  99.       .
  100.       XT
  101.  
  102.       The XT command single steps through the back
  103.       trace history buffer. The XP command program
  104.       steps through the back trace history buffer. The
  105.       XG command goes to an address in the back trace
  106.       history buffer.
  107.    8. To exit from trace simulation mode type:
  108.  
  109.       TRACE OFF
  110.  
  111.    9. To reset the back trace history buffer, use the X
  112.       command.
  113.  
  114.  9.3 Special Notes
  115.  
  116. While in trace simulation mode, most Soft-ICE commands work as normal,
  117. including displaying the memory map, and displaying and editing data. The
  118. exceptions are:
  119.  
  120.     1. Register information is not logged in the back trace
  121.         history buffer, so the register values do not change
  122.         as you trace through the buffer, except for CS and
  123.         IP.
  124.     2. Commands that normally exit from Soft-ICE do not
  125.         work while in trace simulation mode. These are X,
  126.         T, P, G, EXIT.
  127.  
  128. As you peruse instructions from the back trace history buffer with the
  129. SHOW and TRACE commands, you may notice peculiarities in instruction
  130. execution. These are caused by jumps in and out of the specified range.
  131. These usually occur at jumps, calls, returns and entry points.
  132. When you have a hang problem or other difficult bug that requires back
  133. trace ranges, you must often use very large ranges in order to narrow the
  134. scope of the problem. Once you have a better idea of the specific problem
  135. area, you go to smaller ranges.
  136.  
  137. Large back trace ranges are often very slow. When using large ranges you
  138. are usually trying to get a general idea where the problem is. Soft-ICE
  139. has a special 'COARSE' mode for doing large ranges. This speeds up the
  140. ranges a factor of three or more, but limits the amount of instructions in
  141. the history buffer.
  142.  
  143. Coarse mode only collects instructions that do a memory write within the
  144. specified range. As you are replaying instructions with trace simulation
  145. mode after a 'coarse' range you will notice that the flow skips around
  146. rather than sequentially executing instructions.
  147.  
  148.      201 
  149.  
  150. Coarse ranges work best for large ranges and tend to be less effective for
  151. small ranges.
  152.  
  153. To enable a 'coarse' back trace range, use the BPR command with the TW
  154. verb instead of the T verb. For example:
  155.  
  156.   BPR 1000:0 2000:0 TW
  157.  
  158. For further information on back trace ranges see the command descriptions
  159. for:
  160.  
  161.   SHOW, TRACE, XT, XP, XG, XRSET, BPR
  162.  
  163.  
  164. 202
  165.  
  166.