Using SoftICE®
Version 3.2
Technical support is available from our Technical Support Hotline or via our FrontLine Support Web site.
Technical Support Hotline: 1-800-538-7822 FrontLine Support Web Site: http://frontline.compuware.com
This document and the product referenced in it are subject to the following legends: Access is limited to authorized users. Use of this product is subject to the terms and conditions of the user’s License Agreement with Compuware Corporation. © 2004 Compuware Corporation. All rights reserved. Unpublished - rights reserved under the Copyright Laws of the United States. U.S. GOVERNMENT RIGHTS Use, duplication, or disclosure by the U.S. Government is subject to restrictions as set forth in Compuware Corporation license agreement and as provided in DFARS 227.7202-1(a) and 227.7202-3(a) (1995), DFARS 252.227-7013(c)(1)(ii)(OCT 1988), FAR 12.212(a) (1995), FAR 52.227-19, or FAR 52.227-14 (ALT III), as applicable. Compuware Corporation. This product contains confidential information and trade secrets of Compuware Corporation. Use, disclosure, or reproduction is prohibited without the prior express written permission of Compuware Corporation. DriverStudio, SoftICE Driver Suite, DriverNetworks, DriverWorks, TrueCoverage, and DriverWorkbench are trademarks of Compuware Corporation. BoundsChecker, SoftICE, and TrueTime are registered trademarks of Compuware Corporation.
Acrobat® Reader copyright © 1987-2003 Adobe Systems Incorporated. All rights reserved. Adobe, Acrobat, and Acrobat Reader are trademarks of Adobe Systems Incorporated. All other company or product names are trademarks of their respective owners. US Patent Nos.: Not Applicable. Doc. 11577a December 10, 2004
Table of Contents
Preface Purpose of This Manual ...... xiii What This Manual Covers ...... xiv Conventions Used In This Manual ...... xvi Accessibility ...... xvi How to Use This Manual ...... xvii Other Useful Documentation ...... xvii Customer Assistance ...... xviii For Non-Technical Issues ...... xviii For Technical Issues ...... xviii Chapter 1 Choosing Your SoftICE Version SoftICE or Visual SoftICE? ...... 1 Single Machine Debugging: SoftICE ...... 2 Dual Machine Debugging: Visual SoftICE ...... 3 But Which One Should I Use? ...... 4 Chapter 2 Welcome to SoftICE Product Overview ...... 7 Benefits of SoftICE ...... 7 How SoftICE is Implemented ...... 9 SoftICE User Interface ...... 9 About Symbol Loader ...... 11
iii
Chapter 3 SoftICE Tutorial Introduction ...... 13 Loading SoftICE ...... 14 Controlling the SoftICE Screen ...... 15 Moving and Resizing SoftICE Windows ...... 18 Overview of the Sample Software ...... 19 Building the Sample Code ...... 20 Launching the Application ...... 21 Tracing and Stepping through the Source Code ...... 23 Viewing and Editing Local Data ...... 24 Editing Local Data ...... 25 Setting Point-and-Shoot Breakpoints ...... 26 Setting a One-Shot Breakpoint ...... 26 Setting a Sticky Breakpoint ...... 27 Setting a Conditional Breakpoint ...... 29 Editing a Breakpoint ...... 29 Setting a Read-Write Memory Breakpoint ...... 30 Using SoftICE Informational Commands ...... 32 Using Symbols and Symbol Tables ...... 34 Using Symbol Loader ...... 36 Single File Mode ...... 37 Workspace View Mode ...... 38 A Word on Symbol Server Technology ...... 42 Chapter 4 Loading Code into SoftICE Debugging Concepts ...... 43 Preparing to Debug Applications ...... 44 Preparing to Debug Device Drivers and VxDs ...... 44 Loading SoftICE ...... 45 Early Loading of SoftICE ...... 45 Loading SoftICE Manually ...... 46 Building Applications with Debug Information ...... 46 Using Symbol Loader to Translate and Load Files ...... 48 Modifying Module Settings ...... 49 Modifying General Settings ...... 50 Modifying Translation Settings ...... 51 Modifying Debugging Settings ...... 53 iv Using SoftICE
Specifying Modules and Files ...... 55 Modifying Source Files ...... 56 Deleting Symbol Tables ...... 58 Downloading Symbols from a Symbol Server ...... 60 Using Symbol Loader From an MS-DOS Prompt ...... 61 Using the Symbol Loader Command-Line Utility ...... 62 NMSYM Command Syntax ...... 63 Using NMSYM to Translate Symbol Information ...... 64 Using NMSYM to Load a Module and Symbol Information ...... 68 Using NMSYM to Load Symbol Tables or Exports ...... 71 Using NMSYM to Unload Symbol Information ...... 72 Using NMSYM to Save History Logs ...... 73 Getting Information about NMSYM ...... 74 Chapter 5 Navigating Through SoftICE Introduction ...... 75 Universal Video Driver ...... 76 Setting the Video Memory Size ...... 77 Popping Up the SoftICE Screen ...... 78 Disabling SoftICE at Startup ...... 78 Stopping SoftICE at Startup ...... 78 Using the SoftICE Screen ...... 79 Resizing the SoftICE Screen ...... 81 Controlling SoftICE Windows ...... 81 User-definable Pop-up Menus ...... 84 Inline Editing ...... 86 Copying and Pasting Data ...... 87 Entering Commands from the Mouse ...... 88 Obtaining Help ...... 89 Using the Command Window ...... 90 Scrolling the Command Window ...... 90 Entering Commands ...... 90 Recalling Commands ...... 93 Regular Expressions in SoftICE ...... 94 Using Run-time Macros ...... 96 Saving the Command Window History Buffer to a File ...... 98 Associated Commands ...... 99 Using the Code Window ...... 99 Controlling the Code Window ...... 99 Viewing Information ...... 101
Table of Contents v
Entering Commands From the Code Window ...... 104 Using the Locals Window ...... 105 Controlling the Locals Window ...... 105 Expanding and Collapsing Stacks ...... 106 Associated Commands ...... 106 Using the Watch Window ...... 106 Controlling the Watch Window ...... 106 Setting an Expression to Watch ...... 107 Viewing Information ...... 108 Expanding and Collapsing Typed Expressions ...... 108 Associated Commands ...... 108 Using the Register Window ...... 108 Controlling the Register Window ...... 109 Viewing Information ...... 109 Editing Registers and Flags ...... 110 Associated Commands ...... 110 Using the Data Window ...... 111 Controlling the Data Window ...... 111 Viewing Information ...... 112 Changing the Memory Address and Format ...... 113 Editing Memory ...... 113 Assigning Expressions ...... 114 Associated Commands ...... 114 Using the Stack Window ...... 114 Using the Thread Window ...... 115 Controlling the Thread Window ...... 115 Using the Pentium III/IV Register Window ...... 116 Using the FPU Stack Window ...... 116 Viewing Information ...... 117 Chapter 6 Using SoftICE Debugging Multiple Programs at Once ...... 119 Trapping Faults ...... 120 Ring 0 Driver Code (Kernel Mode Device Drivers) ...... 120 Ring 3 (32-bit) Protected Mode (Win32 Programs) ...... 121 Ring 3 (16-bit) Protected Mode (16-bit Windows Programs) ...... 121 SoftICE Crash Dump Utility ...... 122 About Address Contexts ...... 126 Using INT 0x41 .DOT Commands ...... 127 Understanding Transitions From Ring 3 to Ring 0 ...... 129 vi Using SoftICE
Chapter 7 Using Breakpoints Introduction ...... 131 Types of Breakpoints Supported by SoftICE ...... 132 Breakpoint Options ...... 133 Execution Breakpoints ...... 134 Memory Breakpoints ...... 135 Interrupt Breakpoints ...... 135 I/O Breakpoints ...... 137 Window Message Breakpoints ...... 138 Module Load/Unload Breakpoints ...... 139 Understanding Breakpoint Contexts ...... 139 Virtual Breakpoints ...... 140 Setting a Breakpoint Action ...... 140 Conditional Breakpoints ...... 141 Conditional Breakpoint Count Functions ...... 143 Using Local Variables in Conditional Expressions ...... 146 Referencing the Stack in Conditional Breakpoints ...... 147 Performance ...... 149 Duplicate Breakpoints ...... 149 Elapsed Time ...... 149 Breakpoint Statistics ...... 150 Referring to Breakpoints in Expressions ...... 150 Manipulating Breakpoints ...... 150 Using Embedded Breakpoints ...... 151 Chapter 8 Using Expressions Expressions ...... 153 Using the Expression Evaluator ...... 154 Supported Operators ...... 154 Pointer Operations ...... 156 Operator Precedence ...... 157 Forming Expressions ...... 158 Registers ...... 158 Literals ...... 159 Symbols ...... 161 Symbol Sources and Search Order ...... 163
Table of Contents vii
Built-in Functions ...... 164 Eaddr Function ...... 166 Evalue Function ...... 167 Expression Evaluator Type System ...... 167 Results Types ...... 167 Typecasting ...... 168 Result Formats ...... 170 Chapter 9 Loading Symbols for System Components Loading Export Symbols for DLLs and EXEs ...... 171 Using Unnamed Entry Points ...... 172 Using Export Names in Expressions ...... 173 Loading Exports Dynamically ...... 173 Using the Windows NT family Symbol Files with SoftICE ...... 173 Using Windows 9x Symbol (.SYM) Files with SoftICE ...... 174 Chapter 10 Remote Debugging with SoftICE Introduction ...... 175 Types of Remote Connections ...... 175 DSR Namespace Extension ...... 177 Remote Target State Icons ...... 179 Remote Debugging Details ...... 181 Specialized Network Drivers ...... 181 Universal Network Driver ...... 183 Serial Connection ...... 186 Modem ...... 188 SIREMOTE Utility (Host Computer) ...... 189 NET Command (Target Computer) ...... 190 Chapter 11 Customizing SoftICE Modifying SoftICE Initialization Settings ...... 191 Modifying General Settings ...... 193 Initialization ...... 193 History Buffer Size ...... 194 Trace BufferSize (Windows 9x Only) ...... 194 Total RAM (Windows 9x Only) ...... 194 viii Using SoftICE
Display Diagnostic Messages ...... 194 Trap NMI ...... 195 Lowercase Disassembly ...... 195 Support Power Management ...... 195 Headless ...... 196 Enable SoftICE Public Interface ...... 196 Pre-Loading Symbols and Source Code ...... 196 Adding Symbol Files to the Symbols List ...... 197 Removing Symbols and Source Code Pre-Loading ...... 197 Reserving Symbol Memory ...... 197 Pre-Loading Exports ...... 198 Serial Debugging ...... 198 Configuring Remote Debugging with a Modem ...... 199 Configuring Network Debugging ...... 199 Requirements for Remote SoftICE Support ...... 200 Setting Up SoftICE for Remote Debugging ...... 200 Enabling Remote Debugging from the Target Side ...... 200 Starting the Remote Debugging Session ...... 202 Modifying Keyboard Mappings ...... 203 Command Syntax ...... 204 Modifying Function Keys ...... 204 Creating Function Keys ...... 204 Deleting Function Keys ...... 205 Restoring Function Keys ...... 205 Working with Persistent Macros ...... 205 Creating Persistent Macros ...... 206 Starting and Stopping Persistent Macros ...... 207 Setting Troubleshooting Options ...... 208 Disable Mouse Support ...... 208 Disable Num Lock and Caps Lock Programming ...... 208 Do Not Patch Keyboard Driver (Windows NT family Only) ...... 209 Disable Mapping of Non-Present Pages ...... 209 Disable Pentium Support ...... 209 Disable Thread-Specific Stepping ...... 209 Specifying Advanced Options ...... 209
Table of Contents ix
Chapter 12 Exploring Windows NT Overview ...... 211 Resources for Advanced Debugging ...... 212 Inside the Windows NT Kernel ...... 217 Managing the Intel Architecture ...... 218 Windows NT System Memory Map ...... 223 Win32 Subsystem ...... 231 Inside CSRSS ...... 231 USER and GDI Objects ...... 232 Process Address Space ...... 237 Heap API ...... 238 Appendix A Error Messages Appendix B Supported Display Adapters Appendix C Troubleshooting SoftICE Appendix D Kernel Debugger Extensions Appendix E SoftICE and VMware OS Support ...... 263 Hardware Support ...... 263 Setup/Installation ...... 264 Limitations and Restrictions ...... 264 Remote Debugging ...... 264 Configuration ...... 265 Mouse ...... 267 Universal Video Driver ...... 267
x Using SoftICE
Appendix F SoftICE API Specification The Purpose of Having a Public Interface and API ...... 269 Setting Up SoftICE for API Access ...... 270 Running the Sample Driver ...... 270 Setting Up Your Driver ...... 271 Checking for the Existence of SoftICE ...... 271 Using the SoftICE API ...... 272 API Calls from a Driver ...... 272 API Calls from a Ring3 Application ...... 273 API Definition ...... 273 Glossary ...... 243 Index ...... 245
Table of Contents xi
xii Using SoftICE
Preface