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

  1.   CHAPTER 4
  2.  
  3.  Using Break Point Commands
  4.     4.1 Introduction
  5.     4.2 Setting Break Points
  6.     4.3 Manipulating Break Points
  7.  
  8.      51
  9.  
  10. 4.1 Introduction
  11.  
  12. Soft-ICE has break point capability that has traditionally only been
  13. available with hardware debuggers. The power and flexibility of the 80386
  14. chip allows advanced break point capability without additional hardware.
  15.  
  16. Break points can be set on memory location reads and writes, memory range
  17. reads and writes, program execution and port accesses. Soft-ICE assigns a
  18. one-digit hexadecimal number (0-F) to each break point. This break-number
  19. is used to identify break points when you set delete, disable, enable, or
  20. edit them.
  21.  
  22. All of Soft-ICE's break points are sticky. That means they don't disappear
  23. automatically after they've been used; you must intentionally clear or
  24. disable them using the BC or the BD commands. Soft-ICE can handle 16 break
  25. points at one time. You can have up to ten break points of a single type
  26. except for break points on memory location (BPMs), of which you can only
  27. have four, due to restrictions of the 80386 processor.
  28.  
  29. Break points can be specified with a count parameter. The count parameter
  30. tells Soft-ICE how many times the break point should be ignored before the
  31. break point action occurs.
  32.  
  33.      52 
  34.  
  35. 4.2 Setting Break Points
  36.  
  37. Commands: 
  38.      BPM, BPMB, BPMW, BPMD -- Set break point on memory
  39.                        access or execution 
  40.      BPR -- Set break point on memory range 
  41.      BPIO -- Set break point on I/O port access 
  42.      BPINT -- Set break point on interrupt 
  43.      BPX -- Set/clear break point on execution 
  44.      CSIP -- Set CS:IP range qualifier 
  45.      BPAND -- Wait for multiple break points
  46.                     to occur
  47.  
  48.      53 
  49.  
  50.  BPM, BPMB, BPMW, BPMD
  51.  
  52.  BPM, BPMB, BPMW, BPMD -- Set break point on memory access or execution
  53.  
  54. Syntax:
  55.    BPM[size]address[verb][qualifier value][C=count]
  56.    size -- B, W, D
  57.                      B -- Byte
  58.                      W -- Word
  59.                      D -- Double Word
  60.                      The size is actually a range covered by
  61.                      this break point. For example, if
  62.                      double word is used, and the third
  63.                      byte of the double is modified, then a
  64.                      break point will occur. The size is
  65.                      also important if the optional qualifier
  66.                      is specified (see below).
  67.   verb -- R, W, RW, or X
  68.   qualifier -- EQ, NE, GT, LT, M
  69.                      EQ -- Equal
  70.                      NE -- Not Equal
  71.                      GT -- Greater than
  72.                      LT -- Less Than
  73.                      M -- Mask
  74.                      These qualifiers are only applicable to
  75.                      the read and write break points.
  76.   value -- A byte, word, or double word value,
  77.                      depending on the size specified.
  78.  
  79.      54
  80.  
  81. Comments:
  82.  
  83. The BPM commands allow you to set a break point on memory reads or writes
  84. or execution.
  85.  
  86. If a verb is not specified, RW is the default.
  87.  
  88. If a size is not specified, byte is the default.
  89.  
  90. All of the verb types except X cause the program to execute the
  91. instruction that caused the break point. The current CS:IP will be the
  92. instruction after the break point. If the verb type is X, the current
  93. CS:IP will be the instruction where the break point was set.
  94.  
  95. If R is specified, then the break point will occur on read access and on
  96. write operations that do not change the value of the memory location.
  97.  
  98. If the verb type is R, W or RW, executing an instruction at the specified
  99. address will not cause the break point action to occur.
  100.  
  101. Note:
  102. If BPMW is used, the specified address must start on a word boundary. If
  103. BPMD is used, the specified address must point to a double word boundary.
  104.  
  105. Example:
  106.    BPM 1234:SI W EQ 10 C=3
  107.     This command defines a break point on memory byte
  108.     access. The third time that 10 hexadecimal is written to
  109.     location 1234:SI, the break point action will occur.
  110.    BPM CS:1235 X
  111.     This command defines a break point on execution.
  112.     The break point action will occur the first time that the
  113.  
  114.      55
  115.  
  116. instruction at address CS:1235 is reached. The current CS:IP will be the
  117. instruction where the break point was set.
  118.  
  119. BPMW DS:FOO W EQ M 0XXX XXXX XXXX XXX1
  120.  
  121. This command defines a word break point on memory write. The break point
  122. action will occur the first time that location DS:FOO has a value written
  123. to it that sets the high order bit to 0 and the low order bit to 1. The
  124. other bits can be any value.
  125.  
  126. BPM DS:1000 W GT 5
  127.  
  128. This command defines a byte break point on memory write. The break point
  129. action will occur the first time that location DS:1000 has a value written
  130. to it that is greater than 5.
  131.  
  132.      56
  133.  
  134.            BPR
  135.  
  136. BPR -- Set break point on memory range
  137.  
  138. Syntax:
  139.     BPR start-address end-address [verb] [C=count]
  140.     start-address,
  141.     end-address -- start-address and end-address specify
  142.                       memory range.
  143.     verb -- R, W, RW, T or TW 
  144.  
  145. Comments:
  146.  
  147. The BPR command allows you to set a break point across a range of memory.
  148.  
  149. All of the verb types except T or TW cause the program to execute the
  150. instruction that caused the break point. The current CS:IP will be the
  151. instruction after the break point.
  152.  
  153. There is no range break point on execution. If a range break point is
  154. desired on execution, R must be used. An instruction fetch is considered a
  155. read for range break points.
  156.  
  157. If a verb is not specified, W is the default.
  158.  
  159. The range break point will degrade system performance in certain
  160. circumstances. Any read or write within the 4K page that contains the
  161. break point range is analyzed by Soft-ICE. This performance degradation is
  162. usually not noticeable, however, degradation could be extreme in exception
  163. cases.
  164.  
  165. The T and TW verbs enable back trace ranges on the specified range. They
  166. do not cause break points, but instead log instruction information that
  167. can be displayed later with the SHOW or TRACE commands. For more
  168. information on back trace ranges, see chapter 9.
  169.  
  170.      57
  171.  
  172. Example:
  173.    BPR B000:0 B000:1000 W
  174.    This command defines a break point on memory range.
  175.    The break point will occur if there are any writes to the
  176.    monochrome adapter video memory region.
  177.  
  178.      58
  179.  
  180.             BPIO
  181.  
  182. BPIO -- Set break point on I/O port access
  183.  
  184. Syntax :
  185.     BPIO port [verb] [qualifier value] [C=count]
  186.     port -- A byte or word value
  187.     verb -- R, W, or RW
  188.                    R -- Read (IN)
  189.                    W -- Write (OUT)
  190.     qualifier -- EQ, NE, GT, LT, M
  191.                    EQ -- Equal
  192.                    NE -- Not Equal
  193.                    GT -- Greater Than
  194.                    LT -- Less Than
  195.                    M -- Mask
  196.     value -- A byte or word value
  197.  
  198. Comments:
  199.  
  200. The BPIO command allows you to set a break point on I/O port reads or
  201. writes.
  202.  
  203. If value is specified, it is compared with the actual data value read or
  204. written by the IN or OUT instruction causing the break point. The value
  205. may be a byte or a word. If the I/O is to a byte port, then the lower 8
  206. bits are used in the comparison.
  207.  
  208. The instruction pointer (CS:IP) will point to the instruction after the IN
  209. or OUT instruction that caused the break point.
  210.  
  211. If a verb is not specified, RW is the default.
  212.  
  213.      59
  214.  
  215. Example:
  216.   BPIO 21 W NE FF
  217.  
  218.    This command defines a break point on I/O port
  219.    access. The break point will occur if the interrupt
  220.    controller one mask register is written with a value
  221.    other than FFH.
  222.  
  223.   BPIO 3FE R EQ M 11XX XXXX 
  224.  
  225.    This command defines a byte break point on I/O port
  226.    read. The break point action will occur the first time
  227.    that I/0 port 3FE is read with a value that has the two
  228.    high order bits set to 1. The other bits can be any value.
  229.  
  230.      60
  231.  
  232.            BPINT
  233.  
  234. BPINT -- Set break point on interrupt
  235.  
  236. Syntax:
  237.   BPINT int-number [ < AL | AH | AX >= value] [C = count]
  238.   int-number -- Interrupt number from 0 - FF hex
  239.   value -- A byte or a word value
  240.  
  241. Comments:
  242.  
  243. The BPINT command allows breaking on the execution of a hardware or a
  244. software interrupt. By optionally qualifying the AX register with a value,
  245. specific DOS or BIOS calls can be easily isolated.
  246.  
  247. If no value is specified, a break point will occur when the interrupt
  248. specified by int-number occurs. This interrupt can be a hardware,
  249. software, or internal interrupt.
  250.  
  251. The optional value is compared with the specified register (AH, AL, or AX)
  252. when the interrupt occurs. If the value matches the specified register,
  253. then the break point will occur.
  254.  
  255. When the break point occurs, if the interrupt was a hardware interrupt,
  256. the instruction pointer (CS:IP) will point to the first instruction within
  257. the interrupt routine. The INT? command can be used to see where execution
  258. was when the interrupt occurred. If the interrupt was a software
  259. interrupt, when the break point occurs, the instruction pointer (CS:IP)
  260. will point to the INT instruction causing the interrupt.
  261.  
  262.      61 
  263.  
  264. Example :
  265.   BPINT 21 AH=4C
  266.  
  267.    This command defines a break point on interrupt 21H
  268.    The break point will occur when DOS function call
  269.    4CH (terminate program) is called.
  270.  
  271.      62
  272.  
  273.   BPX
  274.  
  275. BPX -- Set/clear break point on execution
  276.  
  277. Syntax:
  278.  
  279.     BX [address] [C=count]
  280.  
  281. Comments:
  282.  
  283. The BPX command allows you to set or clear a point-and-shoot execution
  284. break point in source. When the cursor is in the code window the address
  285. is not required. The execution break point is set at the address of the
  286. current cursor location. If an execution break point has already been set
  287. at the address of the current cursor location, then the break point is
  288. cleared.
  289.  
  290. If the code window is not visible or the cursor is not in the code window
  291. then the address must be specified. If an offset only is specified then
  292. the current CS register value used as the segment.
  293.  
  294. Technical Note:
  295. BPX uses an interrupt 3 style of break point unless the specified address
  296. is ROM. This is used instead of a break point register to make more
  297. execution break points available. If your circumstances require the use of
  298. a break point register for some reason (code not loaded yet for example)
  299. you can set an execution break point with the BPM command.
  300.  
  301. Example:
  302.    BPX.1234
  303.     This sets an execution break point at source line 1234.
  304.  
  305.      63
  306.  
  307.              CSIP
  308.  
  309. CSIP -- Set CS:IP range qualifier
  310.  
  311. Syntax: 
  312.     CSIP [OFF | [NOT] start-address end-address]
  313.     NOT -- When NOT is specified, the break point
  314.                      will only occur if the CS:IP pointer is
  315.                      outside the specified range.
  316.     OFF -- Turns off CS:IP checking
  317.  
  318. Comments:
  319.  
  320. The CSIP command causes a break point to be dependent upon the location of
  321. the instruction pointer when the break point conditions are met. This
  322. function is often useful when a program is suspected of accidentally
  323. modifying code outside of its boundaries.
  324.  
  325. When break point conditions are met, the CS:IP registers are compared with
  326. a specified range. If they are within the range, the break point is
  327. activated. To activate the break point when CS:IP is outside the range,
  328. use the NOT parameter.
  329.  
  330. When a CSIP range is specified, it applies to ALL break points that are
  331. currently active.
  332.  
  333. If no parameters are specified, the current CSIP range is displayed.
  334. Example:
  335.  
  336.    CSIP NOT F000:0 FFFF:0
  337.  
  338.    This command causes the break points to occur only
  339.    the CS:IP is NOT in the ROM BIOS when the break
  340.    point conditions are met.
  341.  
  342.      64 
  343.  
  344.           BPAND
  345.  
  346. BPAND -- Wait for multiple break points to occur
  347.  
  348. Syntax:
  349.    BPAND list | * | OFF
  350.     list -- A series of break-numbers
  351.                    separated by commas or spaces
  352.     * -- ANDs together all break points
  353.  
  354. Comments:
  355.  
  356. The BPAND command does a logical AND of two or more break points,
  357. activating the break point only when conditions for all break points are
  358. met.
  359.  
  360. Sometimes conditions arise when you don't want a break point to occur
  361. until several different conditions are met. The BPAND command allows
  362. specifying two or more break points that must occur before the action is
  363. generated. This function allows more complex break point conditions to be
  364. set.
  365.  
  366. Each time the BPAND command is used, the specified break point numbers are
  367. added to the list until BPAND OFF is used.
  368.  
  369. You can tell which of the break-numbers are ANDed together by listing the
  370. break points with the BL command. The break points that are ANDed together
  371. will have an ampersand (&) after their break-number.
  372.  
  373. Once break points have been ANDed together, each remains ANDed until it is
  374. cleared, or until BPAND is turned off.
  375.  
  376.      65
  377.  
  378.  
  379. Example:
  380. BPAND 0,2,3
  381.  
  382. This command causes the conditions of the break points 0, 2, and 3 to be
  383. logically tied together. The break occurs only when the conditions of all
  384. three are met. For example, if the conditions of break points 2 and 3 have
  385. both been met at least once, but the conditions of break point 0 have not
  386. been met at all yet, then the action will not occur until break point 0
  387. conditions are met.
  388.  
  389.      66 
  390.  
  391. 4.3 Manipulating Break Points
  392.  
  393. Soft-ICE provides several commands for manipulating break points.
  394. Manipulation commands allow listing, modifying, deleting, enabling, and
  395. disabling of break points. Break points are identified by break-numbers
  396. which are hexadecimal digits from 0 to F. The break point manipulation
  397. commands are:
  398.  
  399. BD -- Disable break points 
  400. BE -- Enable break points 
  401. BL -- List break points 
  402. BPE -- Edit break point 
  403. BPT -- Use break point as a template 
  404. BC -- Clear break points
  405.  
  406.      67
  407.  
  408.                BD
  409.  
  410. BD -- Disable break points
  411.  
  412. Syntax:
  413.    BD list | *
  414.    list -- A series of break-numbers separated
  415.                       by commas or spaces
  416.    * -- Disables all break points
  417.  
  418. Comments:
  419.  
  420. The BD command is used to temporarily deactivate break points. The break
  421. points can be reactivated with the BE (Enable break points) command.
  422.  
  423. You can tell which of the break-numbers are disabled by listing the break
  424. points with the BL command. The break points that are disabled will have
  425. an asterisk (*) after their break-number.
  426.  
  427. Example:
  428.    BD 1,3
  429.  
  430.    This command temporarily disables break points 1 and
  431.    3.
  432.  
  433.      68
  434.  
  435.                          BE
  436.  
  437. BE -- Enable break points
  438.  
  439. Syntax:
  440.     BE list | *
  441.     list -- A series of break-numbers separated
  442.                        by commas or spaces
  443.     * -- Enables all break points
  444.  
  445. Comments:
  446.  
  447. The BE command is used to reactivate break points that were deactivated by
  448. the BD (Disable break points) command.
  449.  
  450. Note that a break point is automatically enabled when it first defined.
  451.  
  452. Example:
  453.    BE 3
  454.  
  455.    This command enables break point 3.
  456.  
  457.      69
  458.  
  459.                        BL
  460.  
  461. BL -- List break points
  462.  
  463. Syntax:
  464.    BL
  465.  
  466. Comments:
  467.  
  468. The BL command displays all break points that are currently set. For each
  469. break point, BL lists the break-number, break point conditions, break
  470. point state, and count.
  471.  
  472. The state of a break point is either enabled or disabled. If the break
  473. point is disabled, an asterisk (*) is displayed after its break-number. If
  474. an enabled break point was used in a BPAND command, an ampersand (&) is
  475. displayed after its break-number. The break point that most recently
  476. caused an action to occur is highlighted.
  477.  
  478. The BL command has no parameters.
  479.  
  480. Example:
  481.    BL
  482.  
  483.  
  484.    This command displays all the break points that have
  485.    been defined. A sample display, which shows four
  486.    break points, follows:
  487.  
  488.        0) BPMB 1234:0000 W EQ 0010 C=03
  489.        1) BPR B000:0000 B000:1000 W C=01
  490.        2) BPIO 0021 W NE 00FF C=01
  491.        3) BPINT 21 AH=4C C=01
  492.  
  493.     Note that in this example, break point 1 is preceded
  494.     with an asterisk (*), showing that it has been disabled.
  495.  
  496.      70
  497.  
  498.             BPE
  499.  
  500. BPE -- Edit break point
  501.  
  502. Syntax:
  503.    BE break-number
  504.  
  505. Comments:
  506.  
  507. The BPE command loads the break point description into the edit line for
  508. modification. The command can then be edited using the editing keys, and
  509. re-entered by pressing the ENTER . This command offers a quick way to
  510. modify the parameters of an existing break point.
  511.  
  512. Example:
  513.   BPE 1
  514.  
  515.    This command moves a description of break point 1
  516.    into the edit line and removes break point 1. Pressing
  517.    the ENTER key will cause the break point to be
  518.    re-entered.
  519.  
  520.      71 
  521.  
  522.                    BPT 
  523.  
  524. BPT -- Use break point as a template
  525.  
  526. Syntax:
  527.    BT break-number
  528.  
  529. Comments:
  530.  
  531. The BPT command uses an existing break point description as a template for
  532. a new break point.
  533.  
  534. A description of the existing break point is loaded into the edit line.
  535. The break point referenced by break-number is not altered. This command
  536. offers a quick way to create a new break point that is similar to an
  537. existing break point.
  538.  
  539. Example:
  540.   BPT 3
  541.  
  542.    This command moves a template of break point 3 into
  543.    the edit line. When the ENTER key is pressed, a
  544.    new break point is added.
  545.  
  546.      72
  547.  
  548.                           BC
  549.  
  550. BC -- Clear break points
  551.  
  552. Syntax:
  553.     BC list | *
  554.     list -- A series of break-numbers separated
  555.                        by commas or spaces
  556.     *    -- Clears all break points
  557.  
  558. Comments:
  559.  
  560. The BC command is used to permanently delete one or more break points.
  561.  
  562. Example:
  563.    BC *
  564.     
  565.      This command clears all break points.
  566.  
  567.      73
  568.  
  569. PAGE 74 IS EMPTY
  570.  
  571.      74
  572.