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

  1.   CHAPTER 12
  2.  
  3.  Special Debugging Problems
  4.    12.1 Loadable Device Drivers
  5.    12.2 Boot Loaders
  6.    12.3 Interrupt Routines
  7.    12.4 Non-DOS Operating Systems
  8.  
  9.      221 
  10.  
  11. Soft-ICE can be a powerful tool in stand-alone mode. This chapter
  12. describes techniques for debugging system-level components using Soft-ICE
  13. in stand-alone mode. When using Soft-ICE as a stand-alone debugger, the
  14. ACTION must be set to HERE.
  15.  
  16. 12.1 Loadable Device Drivers
  17.  
  18. Debugging DOS loadable device drivers requires a debugger that does not
  19. make DOS calls. Soft-ICE can be used in stand-alone mode if your debugger
  20. uses DOS.
  21.  
  22. There are two methods for debugging loadable device drivers:
  23.     1. Use the MAP command to find the location of your
  24.         loadable driver. Display the device driver header
  25.         to find the strategy or interrupt entry point.
  26.         Setting a break point at the entry to strategy or
  27.         interrupt will give you control within the device
  28.         driver. Single step, or set break points further on,
  29.         to continue debugging.
  30.         Debugging the device driver initialization code
  31.         requires resetting the system with the BOOT
  32.         command. Use the technique stated above to set a
  33.         break point within the driver code. The BOOT
  34.         command will retain Soft-ICE and break points.
  35.     2. The second method requires placing special code in
  36.         your driver. Do this with the 13HERE ON
  37.         command (see section 5.4). Place an INT 3 opcode
  38.         (CCH) in your device driver at the point where
  39.         control is desired. When the INT 3 executes,
  40.         control comes to Soft-ICE. You can then use an
  41.         RIP command to set the instruction pointer to get
  42.         around the INT 3.
  43.  
  44. If you wish to debug your initialization sequence, make sure that Soft-ICE
  45. is loaded in CONFIG.SYS prior to the driver you are trying to debug. Place
  46. the 13HERE ON command
  47.  
  48.      222 
  49.  
  50. in the INIT string in Soft-ICE.DAT. With this method you do not have to
  51. use the BOOT command. 
  52.  
  53. If you are debugging your device driver symbolically or with source you
  54. must load the symbol file and the source files separately from the device
  55. driver. The symbol file and source files are loaded with the Soft-ICE
  56. program loader LDR.EXE. When LDR.EXE is used to load only the symbols and
  57. source you must use it in the form:
  58.  
  59.       LDR file-name.SYM
  60.  
  61. The extension of the symbol file must be specified. See section 7.4 for
  62. more details about LDR.EXE.
  63.  
  64. After loading the symbol file and source files with LDR.EXE you must enter
  65. Soft-ICE and relocate the symbols relative to the start of your device
  66. driver. Symbols are relocated with the Soft-ICE SYMLOC command. The syntax
  67. of the SYMLOC command is:
  68.  
  69.       SYMLOC segment
  70.  
  71. The segment value is obtained from the MAP command. See the description of
  72. the SYMLOC command for more details.
  73.  
  74.  12.2 Boot Loaders
  75.  
  76. Debugging boot loaders or self-booting programs requires using Soft-ICE as
  77. a stand-alone debugger. You must first boot into DOS and load Soft-ICE.
  78. The easiest method of debugging boot loaders is to set a break point at a
  79. known address within the boot loader, and then use the BOOT command to
  80. reset the system. Soft-ICE is retained throughout the boot process with
  81. the break points still set. If a known address is difficult to find an
  82. execution break point can be set at 7C0:0H before the
  83.  
  84.      223 
  85.  
  86. BOOT command. This is the address where the ROM BIOS loads the boot sector
  87. into memory.
  88.  
  89. Another method requires turning 13HERE mode on (see section 5.4). Place an
  90. INT 3 opcode (CCH) in your program at the point where control is desired.
  91. When the INT 3 executes, control comes to Soft-ICE,
  92. You may also use both symbols and source debugging while debugging a boot
  93. loader. See the SYMLOC command for more information on how to relocate
  94. your symbols and source to the segment where your boot loader has been
  95. loaded
  96.  
  97.  12.3 Interrupt Routines
  98.  
  99. Soft-ICE allows break points and single stepping within hardware interrupt
  100. service routines (timer, keyboard, etc.).
  101. Single stepping and setting break points in interrupt service routines is
  102. allowed with Soft-ICE. You can even single step through the keyboard
  103. interrupt routine while Soft-ICE is using the keyboard for input.
  104. In most cases, Soft-ICE must be used as a stand-alone debugger when
  105. debugging interrupt service routines. To set a break point on the address
  106. of the interrupt service routine, use one of the following methods:
  107.     1. Use the display double command:
  108.          DD interrupt-number * 4 L 1
  109.          The address displayed is the address of the first
  110.          instruction of the interrupt service routine. Set a
  111.          execution break point on this address.
  112.     2. Use the command:
  113.          BPINT interrupt-number
  114.  
  115.      224 
  116.  
  117. 12.4 Non-DOS Operating Systems
  118.  
  119. Non-DOS real address mode operating systems can be debugged with Soft-ICE.
  120. If the operating system is not very DOS compatible you may have to load
  121. Soft-ICE under DOS, and then use the BOOT command to start the non-DOS
  122. operating system. Follow the instructions for debugging boot sequences and
  123. self-booting programs explained in section 12.2.
  124.  
  125. The MAP and WARN commands may not function properly under a non-DOS
  126. operating system, but break points and the other debugging commands will
  127. work correctly.
  128.  
  129. If debugging with symbols or source you must load symbol files and source
  130. files while still under DOS or in the DOS compatible mode of your
  131. operating system.
  132.  
  133.      225
  134.  
  135.  Page 226 is BLANK
  136.  
  137.      226
  138.  
  139.