WinDbg Help
WinDbg Help
Page 1 of 1651
Introduction
Purpose
This edition of the Debugging Tools for Windows documentation describes four Microsoft debuggers: WinDbg, KD, CDB, and NTSD. It also describes additional debugging
tools, as well as various debugging techniques.
WinDbg, KD, CDB, and NTSD Debuggers
These Microsoft debuggers are fully capable of running on computers with x86-based, Itanium, or x64-based processors. The debuggers can debug the Windows operating
system, applications, services, and drivers that run on the operating system. The following operating systems are supported:
Windows 7
Windows Server 2008
Windows Vista
Windows Server 2003
Windows XP
Windows 2000
The CDB and NTSD debuggers are virtually identical. In this documentation set, references to "CDB" refer to both CDB and NTSD. Any differences between the two
debuggers are stated explicitly. For more information, see CDB and NTSD.
A copy of NTSD resides in the System32 directory of Windows prior to Windows Vista. This documentation describes the version of NTSD in the Debugging Tools for
Windows packageit might not match the version of NTSD in the System32 directory.
If you need to perform debugging on an older version of Windows, see Installation and Setup.
32-Bit and 64-Bit Packages
There are three versions of the debugger package: a 32-bit version for x86-based and x64-based binaries, a 64-bit version for Itanium-based binaries, and a 64-bit version for
x64-based binaries. Since debugging typically involves multiple applications, or multiple operating systems, selecting a debugger package is not as straightforward as it is
with other applications. For more information, see Choosing a 32-bit or 64-bit Debugger Package.
Other Tools in Debugging Tools for Windows
For a full list of the tools and where they are documented, see List of Tools and Documentation.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Legal Information
Debugging Tools for Windows
Information in this document, including URL and other Internet Web site references, is subject to change without notice. The entire risk of the use or the results of the use of
this document remains with the user. Unless otherwise noted, the example companies, organizations, products, domain names, e-mail addresses, logos, people, places and
events depicted herein are fictitious, and no association with any real company, organization, product, domain name, e-mail address, logo, person, place or event is intended or
should be inferred. Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright, no part of this document may be
reproduced, stored in or introduced into a retrieval system, or transmitted in any form or by any means (electronic, mechanical, photocopying, recording, or otherwise), or for
any purpose, without the express written permission of Microsoft Corporation.
Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in this document. Except as expressly
provided in any written license agreement from Microsoft, the furnishing of this document does not give you any license to these patents, trademarks, copyrights, or other
intellectual property.
2008 Microsoft Corporation. All rights reserved.
Microsoft, Microsoft Press, MSN, MS-DOS, Windows, Windows NT, Windows Server, Windows Vista, Win32, Win64, CodeView, MSDN, Visual C++, and Visual Studio
are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries.
Intel is a registered trademark of Intel Corporation.
Itanium is a registered trademark of Intel Corporation.
The names of actual companies and products mentioned herein may be the trademarks of their respective owners.
2009 Microsoft Corporation
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 2 of 1651
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 3 of 1651
Debuggers
This section includes:
Debuggers in this Package
Installation and Setup
Debugger Operation
Symbols
Crash Dump Files
Security Considerations
Debugger Reference
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 4 of 1651
CDB
Microsoft Console Debugger (CDB) is a character-based console program that enables low-level analysis of Windows user-mode memory and constructs.
CDB is extremely powerful for debugging a program that is currently running or has recently crashed ("live analysis"), yet simple to set up. It can be used to investigate the
behavior of a working application. In the case of a failing application, CDB can be used to obtain a stack trace or to look at the guilty parameters. It works well across a
network (using a remote access server), as it is character-based.
With CDB, you can display and execute program code, set breakpoints, and examine and change values in memory. CDB can analyze binary code by "disassembling" it and
displaying assembly instructions. It can also analyze source code directly.
Because CDB can access memory locations through addresses or global symbols, you can refer to data and instructions by name rather than by address, making it easy to
locate and debug specific sections of code. You can also display disassembled machine code. CDB supports debugging multiple threads and processes. It is extensible, and
can read and write both paged and non-paged memory.
If the target application is itself a console application, the target will share the console window with CDB. To spawn a separate console window for a target console
application, use the -2 command-line option.
NTSD
There is a variation of the CDB debugger named Microsoft NT Symbolic Debugger (NTSD). It is identical to CDB in every way, except that it spawns a new text window
when it is started, whereas CDB inherits the Command Prompt window from which it was invoked.
Like CDB, NTSD is fully capable of debugging both console applications and graphical Windows programs. (The name "Console Debugger" is used to indicate the fact that
CDB is classified as a console application; it does not imply that the target application must be a console application.)
Since the start command can also be used to spawn a new console window, the following two constructions will give the same results:
start cdb parameters
ntsd parameters
NTSD in the System32 Directory
Whereas CDB is only available as part of the Debugging Tools for Windows package, NTSD is available both in this package and as part of the Windows system itself. It can
be found in the system32 directory of Windows.
If you are planning on using the NTSD that appears in the system32 directory, there are two important facts you should be aware of:
This version of NTSD cannot be used for Remote Debugging Through the Debugger.
This version of NTSD may not match the version of the documentation you are currently reading.
To avoid these issues, it is recommended that you use only the version of NTSD or CDB that was installed as part of the Debugging Tools for Windows package.
Controlling CDB or NTSD from the Kernel Debugger
It is possible to redirect the input and output from CDB or NTSD so that it can be controlled from a kernel debugger (either KD or WinDbg).
If this technique is used with CDB, the CDB window will appear but will not be useable for input and output. If this is used with NTSD, no console window will appear at all.
Controlling NTSD from the kernel debugger is therefore especially useful, since it results in an extremely light-weight debugger that places almost no burden on the computer
containing the target application. This combination can be used to debug system processes, shutdown, and the later stages of boot up. See Controlling the User-Mode
Debugger from the Kernel Debugger for details.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
KD
Microsoft Kernel Debugger (KD) is a character-based console program that enables in-depth analysis of kernel-mode activity on all NT-based operating systems.
KD can be used to debug kernel-mode programs and drivers, or to monitor the behavior of the operating system itself. KD also supports multiprocessor debugging.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 5 of 1651
Typically, the KD tool will not be run on the computer being debugged. Two machines (the host computer and the target computer) are needed for kernel-mode debugging.
Most KD commands cannot be targeted to specific processes or threads, as they can in CDB, NTSD, and WinDbg.
Debugging different target platforms
KD is capable of debugging a target computer which is running on an x86, Itanium, or x64 platform.
The debugger will automatically detect the platform on which the target is running. You do not need to specify the target on the KD command line. The older syntax (using
the name I386KD or IA64KD) is obsolete.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
WinDbg
Microsoft Windows Debugger (WinDbg) is a powerful Windows-based debugging tool. It is capable of both user-mode and kernel-mode debugging.
WinDbg provides full source-level debugging for the Windows kernel, kernel-mode drivers, and system services, as well as user-mode applications and drivers.
WinDbg uses the Microsoft Visual Studio debug symbol formats for source-level debugging. It can access any symbol or variable from a module that has PDB symbol files,
and can access any public function's name that is exposed by modules that were compiled with COFF symbol files (such as Windows .dbg files).
WinDbg can view source code, set breakpoints, view variables (including C++ objects), stack traces, and memory. Its Debugger Command window allows the user to issue a
wide variety of commands.
For kernel-mode debugging, WinDbg requires two machines (the host computer and the target computer). Kernel debugging is only supported on NT-based Windows
operating systems.
WinDbg also supports various remote debugging options for both user-mode and kernel-mode targets.
WinDbg is the graphical-interface counterpart to CDB / NTSD and to KD.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Debugger Installation
Microsoft Debugging Tools for Windows is available in three different versions: a 32-bit package and two 64-bit packages. You can install these packages from the Customer
Support Diagnostics CD, the Microsoft Windows SDK, the Windows Driver Kit (WDK), or the Web. You can customize the installation in several ways.
This section includes the following topics:
Choosing a 32-Bit or 64-Bit Debugger Package
Installing from the Customer Support Diagnostics CD
Installing from the Windows SDK
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 6 of 1651
If you are analyzing a dump file, and if the dump file was made on Microsoft Windows XP or a later version of Windows, you can use the 32-bit package or the Itanium
package. (It is not important whether the dump file is a user-mode dump file or a kernel-mode dump file, and it is not important whether the dump file was made on an
x86-based or an Itanium-based platform.)
If you are analyzing a dump file, and if the dump file was made on Windows 2000, you should use the 32-bit package. (It is not important whether the dump file is a
user-mode dump file or a kernel-mode dump file)
If you are performing live kernel-mode debugging, and if the target computer is running Windows XP or a later version of Windows, you can use the 32-bit package or
the Itanium package. (This situation applies to both x86-based and Itanium-based targets.)
If you are performing live kernel-mode debugging, and if the target computer is running Windows 2000, you should use the 32-bit package.
If you are performing live user-mode debugging, always use the Itanium package. It is not important whether the target is a 64-bit application or a 32-bit application.
The debugger that is included in the Itanium package can debug any kind of application and the WOW64 emulator.
If you are analyzing a dump file, and if the dump file was made on Windows XP or a later version of Windows, you can use either the 32-bit package or the x64
package. (It is not important whether the dump file is a user-mode dump file or a kernel-mode dump file, and it is not important whether the dump file was made on an
x86-based or an x64-based platform.)
If you are analyzing a dump file, and if the dump file was made on Windows 2000 operating system, you should use the 32-bit package. (It is not important whether the
dump file is a user-mode dump file or a kernel-mode dump file)
If you are performing live kernel-mode debugging, and if the target computer is running Windows XP or a later version of Windows, you can use either the 32-bit
package or the x64 package. (This situation applies to both x86-based and x64-based targets.)
If you are performing live kernel-mode debugging, and if the target computer is running Windows 2000, you should use the 32-bit package.
If you are performing live user-mode debugging, use the x64 package for debugging WOW64 with both 64-bit and 32-bit code. To debug other targets, use a 32-bit
debugger to debug 32-bit code.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 7 of 1651
Debugging Tools for Windows Web site and follow the instructions.
The Debugging Tools for Windows package is frequently updated. Update your tools from the Web site to make sure that you have the latest debugging tools.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 8 of 1651
By default, the Debuggers feature is selected. If you leave this feature selected, the installation includes the debuggers (WinDbg, KD, CDB, and NTSD), associated
modules (such as DbgHelp), the symbol server (SymSrv), the source server (SrcSrv), the dump file tool (ADPlus), the remoting tool (DbgSrv), and several extension
libraries.
Note Another copy of NTSD exists in the \system32 directory of Microsoft Windows. This Help documentation corresponds to the version of NTSD that is included in
the Debugging Tools for Windows package. But this documentation might not match the version of NTSD that is installed with Windows.
By default, the Tools feature and its Helpful Tools subfeature are selected. If you leave these features selected, the installation includes the SymStore, SymChk,
DbgRpc, Logger, LogViewer, KDbgCtrl, DumpChk, GFlags.exe, TList.exe, Kill.exe, List.exe, Breakin.exe, UMDH, and the remoting tools (Remote.exe, DbEngPrx, and
KdSrv).
By default, the Documentation feature and its Debugging Tools subfeature are selected. If you leave these options selected, the installation includes the Debugging
Tools for Windows documentation (Debugger.chm). This documentation is the Help file that you are currently reading.
By default, the SDK feature and its subfeatures are not selected. If you select these features, the installation includes the headers and libraries that you must have to
build debugger extensions, several sample extensions and other samples, and the Debug Help Library documentation (Dbghelp.chm).
By default, the Location for the installation is a subdirectory of C:\Program Files. To choose a different installation location, click Browse and navigate to an alternate
path.
For more information about each tool in this package and where they are documented, see List of Tools and Documentation.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Kernel-Mode Setup
This section includes the following topics:
Configuring Hardware for Kernel-Mode Debugging
Configuring Software on the Target Computer
Configuring Software on the Host Computer
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 9 of 1651
The target computer and host computer do not have to use the same platform or the same version of Windows.
Kernel debugging does not require specific combinations of the free or checked builds. You can debug a free system from a free or checked system, and you can debug a
checked system from a free or checked system. However, typically, there is no reason for the host computer to run the slower checked build.
Note If you are running the debuggers from an Itanium-based host computer, make sure that you are using the correct version of the binaries. For more information about
which version of the debugger package to use, see Choosing a 32-bit or 64-bit Debugger Package.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 10 of 1651
Software Setup
For information about how to configure the boot entries on the target computer, see Boot Parameters to Enable Debugging. For more information about how to start a kernel
debugging session, see Attaching to a Target Computer (Kernel Mode).
Note Before you perform kernel debugging over a 1394 cable, you must configure some additional software on the target computer and the host computer. For more
information about this configuration, see Disabling the 1394 Host Controller and Installing the 1394 Virtual Driver.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
A USB 2.0 debug cable. This cable is not a standard USB 2.0 cable, because it has an extra hardware component that makes it compatible with the USB2 Debug
Device Functional Specification. You can find these cables with an Internet search for "USB 2.0 debug cable".
The host computer must have a USB 2.0 controller that is compatible with the Enhanced Host Controller Interface (EHCI) specification.
The target computer must have a USB 2.0 controller that is compatible with the EHCI specification, and which supports kernel debugging. Not all EHCI-compatible
controllers have this support, and there is no programmatic method to determine whether a given computer does have this support.
If the EHCI-compatible controller provides kernel debugging support, you must use Port 1 of the controller on the target computer for the debug connection. The USB
debugging port must be exposed to the outside of the target computer. (A few computers have a USB 2.0 controller that supports debugging through a certain physical
port that is not accessible from the outside of the computer.) You can use the USBView utility that helps to identify which port number is assigned to each USB
connector.
Windows PowerShell.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 11 of 1651
1. Connect the null-modem serial cable between the host and the target.
2. Run the PowerShell tool from the Start menu on either the host or the target machine and enter the following command:
PS> [System.IO.Ports.SerialPort]::getportnames()
3. If more than one port is displayed, you will need to validate the selected one. This can be performed by entering the following commands in the PowerShell window:
PS>
PS>
PS>
PS>
In the Connection Description box, enter a name for the new connection. (The name is not important.)
In the Connect To box, in the Connect using list, select the COM port that corresponds to the port that the null-modem cable is connected to on this computer.
In the next window, accept the defaults for the COM port properties.
Repeat steps 1 through 4 for the target computer.
Hyperterminal is now ready for testing. Type a string of characters on the host system. If the null-modem cable is installed correctly and you chose the correct COM ports
within HyperTerminal on both computers, the string of characters that you type on the host computer should be displayed in the HyperTerminal window of the target system.
If the string does not appear on the target system, confirm the cable is plugged into both computers. Also make sure that the cable is a null-modem cable instead of a passthough serial cable.
If the cable is correct, the problem might be the COM ports. Create a new connection in HyperTerminal on the target system by using a different COM port. If the problem is
not fixed, try changing the COM port on the host system. If the problem persists, change the target system's COM port setting back to the original setting and retest.
Eventually, you should find the correct configuration, and the test will succeed.
If, you forget which computer is using which port, on the File menu in HyperTerminal, click Properties to reveal the current COM port setting for the debug session.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 12 of 1651
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 13 of 1651
The [boot loader] section contains option settings that apply to all boot entries on the system. The options include timeout, the boot menu time-out value, and default,
the location of the default operating system.
The following sample shows the [boot loader] section of a Boot.ini file.
[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
The [operating systems] section is comprised of one or more boot entries for each operating system or bootable program installed on the computer.
A boot entry is a set of options that defines a load configuration for an operating system or bootable program. The boot entry specifies an operating system or bootable
program and the location of its files. It can also include parameters that configure the operating system or program.
The following sample shows the [operating systems] section of a Boot.ini file on a computer with two operating systems, Microsoft Windows XP and Microsoft
Windows 2000. It has two boot entries, one for each operating system.
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect
multi(0)disk(0)rdisk(0)partition(2)\WINNT="Microsoft Windows 2000 Professional" /fastdetect
The location of the operating system. The Boot.ini file uses the Advanced RISC Computing (ARC) naming convention to display the path to the disk partition and
directory where the operating system resides. For example:
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
A friendly name for the boot entry. The friendly name represents the boot entry in the boot menu. The friendly name is surrounded by quotation marks and represents
the boot entry in the boot menu. For example:
"Microsoft Windows XP Professional"
Boot entry parameters, also known as boot parameters or load options enable, disable, and configure operating system features. Boot parameters resemble commandline parameters, each beginning with a forward slash (/), such as /debug. You can have zero or more boot parameters on each boot entry.
For a list of boot parameters that are relevant to driver testing and debugging, see Boot.ini Boot Parameter Reference.
You can have multiple boot entries for the same operating system, each with a different set of boot parameters. Windows creates a standard boot entry when you install the
operating system, and you can create additional, customized entries for an operating system by editing the Boot.ini file.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 14 of 1651
You must be a member of the Administrators group on the computer to use Bootcfg. For detailed instructions about using Bootcfg, see Help and Support Center.
Editing in Notepad
You can edit use a text editor, such as Notepad, to edit the Boot.ini file. However, because this method is prone to error, use it only when Bootcfg is not available.
Before editing the Boot.ini file, you must remove the file attributes that Windows uses to protect the file from inadvertent changes. When the Boot.ini file is on an NTFS
drive, you must be a member of the Administrators group on the computer to change its attributes.
Use the following procedure to prepare the Boot.ini file for manual editing. This procedure removes the system, hidden, and read-only attributes of the file.
To configure the Boot.ini file attributes for editing
1. At a command prompt, navigate to the root of the boot directory.
2. Type the following text at the command line:
attrib -s -h -r Boot.ini
System, hidden, and read-only attributes are removed from the file.
3. When your editing is complete, you can restore the file attributes to protect the Boot.ini file. However, Ntldr can use the Boot.ini file with any attribute set. At a
command prompt, type the following text:
attrib +s +h +r Boot.ini
This restores the attributes that protect the Boot.ini file.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 15 of 1651
Globally-defined variables that apply to all bootable devices and bootable programs on the computer.
Boot option variables that apply only to a particular load configuration of a bootable device or program, such as an operating system. The system-specific variables
comprise a boot entry for each configuration of a bootable device or bootable program on the computer.
The Bootcfg tool (discussed in Editing Boot Options in EFI and documented in Windows Help and Support) allows you to view and edit the boot options in EFI NVRAM.
The following sample shows a Bootcfg display of a computer with an Itanium processor.
Boot Options
-----------Timeout:
Default:
CurrentBootEntryID:
30
\Device\HarddiskVolume3\WINDOWS
1
Boot Entries
-----------Boot entry ID:
1
OS Friendly Name: Windows Server 2003, Enterprise
OsLoadOptions: /debug /debugport=COM1 /baudrate=57600
BootFilePath:
\Device\HarddiskVolume1\EFI\Microsoft\WINNT50\ia64ldr.efi
OsFilePath:
\Device\HarddiskVolume3\WINDOWS
Boot entry ID:
2
OS Friendly Name: EFI Shell [Built-in]
The following table describes the elements of the Bootcfg display of boot data in EFI NVRAM.
Field
Boot Options
Timeout
Description
Contains options that apply to all boot entries.
Determines how long the boot menu is displayed. When this value expires, the boot loader
loads the default operating system.
Default
Specifies the location of the default operating system.
CurrentBootEntryID Identifies the boot entry that was used to start the current session of the operating system.
Boot Entries
Contains system-specific data. It is comprised of one or more boot entries for each operating
system or bootable program installed on the computer.
Example
(Section heading)
Timeout:
30
\Device\HarddiskVolume3\WINDOWS
CurrentBootEntryID: 1
(Section heading)
A boot entry is a set of options that defines a load configuration for an operating system or
bootable program.
Boot entry ID
Identifies the boot entry to Bootcfg. This value changes when you reorder the boot entries.
This is not the EFI boot entry ID, which is a persistent identifier for the EFI components.
OS Friendly Name
OsLoadOptions
Specifies the boot parameters for the entry. Boot parameters are commands to enable,
disable, and configure features of the operating system. The EFI Boot Manager passes these
parameters to the bootable device or system to be interpreted and implemented.
For a list of the boot parameters that are related to driver debugging and testing, see Boot.ini
Boot Parameter Reference.
BootFilePath
Specifies the location of the EFI boot loader for the operating system. On EFI-based systems, BootFilePath: \Device\HarddiskVolume1
\EFI\Microsoft\WINNT50\ia64ldr.efi
each operating system or bootable device has its own copy of the boot loader on the EFI
partition.
In EFI NVRAM, the boot loader file path is stored as a binary EFI device path that uses a
globally unique identifier (GUID) to identify the EFI partition .
Bootcfg uses the NT device name of the partition in its path display.
OsFilePath
OsFilePath: \Device\HarddiskVolume3
\WINDOWS
In NVRAM, this value is stored as an EFI device path that uses the GUID of the boot disk
partition and the path to the directory that contains the operating system.
Bootcfg uses the NT device name of the partition in its path display.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 16 of 1651
In addition, there is an important element of an EFI boot entry that Bootcfg does not display, the EFI boot entry ID. The EFI boot entry is a unique identifier for an EFI boot
entry. This identifier is assigned when the boot entry is created, and it does not change. It represents the boot entry in several lists, including the BootOrder array, and it is the
name of the directory on disk in which the system stores data related to the boot entry, including backup copies of the boot entry. An EFI boot entry ID has the format,
Bootxxxx, where xxxx is a hexadecimal number that reflects the order in which the boot entries are created.
Note The Boot entry ID field in Bootcfg and the boot entry number in Nvrboot do not display the EFI boot entry ID. The Bootcfg and Nvrboot IDs are line numbers that
represent the order of the boot entry in the Boot Entries section and change when the entries are reordered.
For a detailed description of boot options on Itanium-based systems, see the Extensible Firmware Interface Specification. You can download a copy of the specification from
the Intel Extensible Firmware Interface Web site.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 17 of 1651
Bootxxxx, where Bootxxxx is the NVRAM ID for the boot entry. Setup stores the boot entry backup copy in a new directory on the EFI partition, along with the EFI boot
loader for the new installation.By default, the installation directory is in the \EFI\Microsoft\ subdirectory.
However, the system does not save backup copies of the boot entries that you create and it does not update backup copies of boot entries after you edit them.
To save backup copies of boot entries that you create and edit, and to save extra backup copies of the entries that Setup creates, use Nvrboot (nvrboot.efi). Nvrboot saves the
entries in the binary format that Setup and the EFI components use. Then, if the boot entry for an installation is lost or corrupted, you can use the import command (nvrboot i)
in Nvrboot to import the backup copy of the boot entry into NVRAM.
This section includes:
Exporting and Importing Boot Entries in EFI
Identifying Backup Files for Existing Boot Entries
Identifying Backup Files for Deleted Boot Entries
Recognizing Unusable Boot Entry Backup Files
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
1
Windows Server 2003, Enterprise
/debug /debugport=COM1 /baudrate=115200
\Device\HarddiskVolume1\EFI\Microsoft\WINNT50\ia64ldr.efi
\Device\HarddiskVolume3\WINDOWS
In the following sample of an Nvrboot display, the path to the boot loader file for an operating system installation appears in the EFIOSLoaderFilePath field.
Nvrboot displays the file location as a partition GUID followed by the path to the boot loader file.
1.
2.
3.
4.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 18 of 1651
In both cases, the boot loader file (and the Bootxxxx boot entry backup file) for the operating system are in the WINNT50 directory of the EFI system partition
(EFI\Microsoft\WINNT50).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
4
Windows Server 2003 - mydebug
/debug /debugport=com1 /baudrate=115200
(null)
(null)
In this case, you must recreate the boot entry by copying another boot entry from the operating system installation, and then changing the parameters.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
In this configuration, the Windows Boot Manager is generic and unaware of the specific requirements for each operating system while the system-specific boot loaders are
optimized for the system that they load.
When a computer with multiple boot entries includes at least one entry for Windows Vista or a later version of Windows, the Windows Boot Manager, which resides in the
root directory, starts the system and interacts with the user. It displays the boot menu, loads the selected system-specific boot loader, and passes the boot parameters to the
boot loader.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 19 of 1651
The boot loaders reside in the root directory of each Windows partition. Once selected, the boot loaders take over the boot process and load the operating system in
accordance with the selected boot parameters.
Boot Configuration Data
On Windows Vista and later versions of Windows, boot options are stored in the Boot Configuration Data (BCD) store on BIOS-based and EFI-based computers.
BCD replaces the traditional Boot.ini text file in BIOS-based systems. Storing boot parameters in a text file, however simple, was considered to be too vulnerable to malicious
attacks to justify its use. On EFI-based computers, where boot options are stored in NVRAM, you use the same BCD methods to edit boot options as you would use on a
BIOS-based computer, instead of accessing NVRAM directly using Windows APIs or specialized tools.
BCD provides a common, firmware-independent boot option interface for all computers running Windows Vista and later versions of Windows. It is more secure than
previous boot option storage configurations, because it permits secure lockdown of the BCD store and lets Administrators assign rights for managing boot options. BCD is
available at run time and during all phases of setup. You can even call BCD during power state transitions and use it to define the boot process for resuming after hibernation.
You can manage BCD remotely and manage BCD when the system boots from media other than the media on which the BCD store resides. This feature is extremely
important for debugging and troubleshooting, especially when a BCD store must be restored while running Startup Repair from a CD, from USB-based storage media, or even
remotely.
BCD is easy to use. The BCD store, with its familiar object-and-element architecture, uses GUIDs to precisely identify boot-related applications.
This new data format for BCD uses a new set of boot options. Most of the Windows boot options that were used in pre-Vista versions of Windows, such
as /debug, /maxmem, and /pae, have been preserved; however, in some cases, the names of the options might have changed to better suite their function. For more
information about these boot options, see BCD Boot Options Reference.
Multiboot Scenarios
If multiple Windows operating systems are installed on the computer, and one of the them is Windows Vista, or a later version of Windows, the Windows Boot Manager
works with the booting components for older ("legacy") versions of Windows to interact with the user and start the selected operating system.
When a multiboot computer is started, the following scenario occurs:
The Windows Boot Manager displays a menu with the boot entries for Windows Vista and later versions of Windows, and a Legacy option.
If you select a boot entry for Windows Vista or a later version of Windows, the Windows Boot Manager loads the system-specific boot loader for that operating system
and passes the parameters for that boot entry to the system-specific boot loader. The system-specific boot loader loads the operating system in accordance with the boot
parameters.
If you select Legacy, the Windows Boot Manager starts Ntldr, the boot manager for NT-based Windows operating systems prior to Windows Vista. From this point
forward, the boot process proceeds as it did prior to Windows Vista.
If the computer includes multiple installations of pre-Windows Vista Windows, Ntldr displays a boot menu consisting of the entries for Windows Server 2003,
Windows XP, Windows 2000, and Windows NT operating systems. This boot menu is generated from the entries in the Boot.ini file on BIOS-based systems and the
boot entries stored in EFI-NVRAM on EFI-based systems. When you select a boot entry, Ntldr loads the operating system in accordance with the boot parameters.
Add a new boot entry for the operating system by copying an existing boot entry from the same operating system.
Change the friendly name of the newly created boot entry so that you can identify it in the boot menu.
Add parameters to the boot entry that enable and configure Windows features.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 20 of 1651
Change the boot menu time-out. You can shorten the boot menu time-out so that Windows boots quickly. Or, lengthen the boot menu time-out so that you have ample
time to select the preferred boot entry.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 21 of 1651
{bootmgr}
partition=C:
Windows Boot Manager
en-US
{globalsettings}
{current}
{current}
{18b123cd-2bf6-11db-bfae-00e018e2b8db}
{memdiag}
30
{current}
partition=C:
\Windows\system32\winload.exe
Microsoft Windows Vista
en-US
{bootloadersettings}
partition=C:
\Windows
{d7094401-2641-11db-baba-00e018e2b8db}
OptIn
{18b123cd-2bf6-11db-bfae-00e018e2b8db}
partition=C:
\Windows\system32\winload.exe
Debugger Boot
en-US
{bootloadersettings}
partition=C:
\Windows
{d7094401-2641-11db-baba-00e018e2b8db}
OptIn
Yes
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 22 of 1651
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 23 of 1651
2
Microsoft Windows XP 64-Bit Edition
/fastdetect /debug /debugport=COM1 /baudrate=115200
\Device\HarddiskVolume1\EFI\Microsoft\WINNT50C\ia64ldr.efi
\Device\HarddiskVolume3\WINDOWS.0
To add a boot parameter to a boot entry, use the Bootcfg parameter-specific switches, such as /ems, /debug, and /dbg1394, or the Bootcfg /addsw or /raw switches. For a
complete list of Bootcfg switches, at a command prompt, type bootcfg /?.
For example, the following Bootcfg command uses the Bootcfg /addsw switch with the /MM argument and a value of 512 to add the /maxmem boot parameter to the second
entry in the Boot Entries section and to set the value of /maxmem to 512 (MB). The /ID switch with a value of 2 identifies the second boot entry (line number 2).
bootcfg /addsw /MM 512 /ID 2
The resulting entry is shown in a sample display from the 64-bit version of Bootcfg.
Boot entry ID:
OS Friendly Name:
OsLoadOptions:
BootFilePath:
OsFilePath:
2
Microsoft Windows XP 64-Bit Edition
/fastdetect /debug /debugport=COM1 /baudrate=115200 /maxmem=512
\Device\HarddiskVolume1\EFI\Microsoft\WINNT50C\ia64ldr.efi
\Device\HarddiskVolume3\WINDOWS.0
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 24 of 1651
The <ID> is the GUID that is associated with the boot entry. If you do not specify an <ID>, the command modifies the operating system that is currently active. The
following command turns on the kernel debugger for a boot entry, called DebugEntry:
bcdedit /debug {49916baf-0e08-11db-9af4-000bdbd316a0} on
To view the current boot entries, type bcdedit at the command prompt. The boot entry for DebugEntry shows that the kernel debugger is turned on.
Windows Boot Loader
------------------identifier
device
path
description
locale
inherit
osdevice
systemroot
resumeobject
nx
pae
debug
{49916baf-0e08-11db-9af4-000bdbd316a0}
partition=C:
\Windows\system32\winload.exe
DebugEntry
en-US
{bootloadersettings}
partition=C:
\Windows
{3e3a9f69-024a-11db-b5fc-a50a1ad8a70e}
OptIn
ForceEnable
Yes
On computers with BIOS firmware, Bootcfg displays the boot entries in the order in which they appear in the Boot.ini file. In this display, the default boot entry is the
first entry in the Bootcfg Boot Entries section that starts the default operating system.
On computers with EFI firmware, Bootcfg displays the boot entries in boot order. Thus, the first boot entry listed is the default boot entry. (Bootcfg adds a default
parameter to the display, but it is not stored in EFI NVRAM.)
To change the default boot entry on either type of system, use the Bootcfg /default switch. The following command makes the second boot entry (line number two) the
default boot entry.
bootcfg /default /ID 2
The effect of the Bootcfg /default switch is slightly different on each type of system. On systems with BIOS firmware, the /default switch changes the value of the Boot.ini
default parameter and/or reorders the boot entries as necessary to make the selected boot entry the default. On systems with EFI firmware, the Bootcfg /default switch
changes the boot order. As a result, the specified boot entry appears first in the Bootcfg Boot Entries section.
For complete instructions about using Bootcfg, see Help and Support Services. For examples, see Using Boot Parameters.
Note The Boot entry ID field in Bootcfg and the boot entry number in Nvrboot do not display the value of the EFI boot entry ID. The Bootcfg and Nvrboot IDs are line
numbers that represent the order of the boot entry in the Boot Entries section and change when the entries are reordered.
Editing the Boot.ini File
Before changing the default boot entry, you have to identify the current default boot entry. The following elements of the Boot.ini file determine which boot entry is the
default:
The default boot entry is the first entry in the [operating systems] section that starts the default operating system.
For example, the following sample Boot.ini file has two boot entries for Windows 2000 and two boot entries for Windows XP. The default parameter specifies the operating
system in the WINNT directory on disk 0, partition 1, that is, Windows 2000. The default boot entry, named "Microsoft Windows 2000 Professional", is shown in bold type in
the following sample. It is the first entry in the [operating systems] section that boots Windows 2000 (the operating system in the WINNT directory on disk 0, partition 1).
[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINNT
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 25 of 1651
[operating systems]
multi(0)disk(0)rdisk(0)partition(3)\WINDOWS="Microsoft Windows XP Professional" /fastdetect
multi(0)disk(0)rdisk(0)partition(3)\WINDOWS="Windows XP Debug" /fastdetect /debug /debugport=COM1 /baudrate=19200
multi(0)disk(0)rdisk(0)partition(1)\WINNT="Microsoft Windows 2000 Professional" /fastdetect
multi(0)disk(0)rdisk(0)partition(1)\WINNT="Microsoft Windows 2000 Debug" /fastdetect /debug /debugport=COM1 /baudrate=19200
Use the following procedure to change the default boot entry.
To change the default boot entry
1. Copy the operating system location from the new default entry, and then paste it in the value of the default parameter.
2. Reorder the boot entries so that the new default entry appears before any other boot entries for that operating system.
The following sample shows the result of these changes. In this revised Boot.ini file, Windows XP is the default operating system, and the "Windows XP Debug" entry is the
default boot entry.
[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(3)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINNT="Microsoft Windows 2000 Debug" /fastdetect /debug /debugport=COM1 /baudrate=19200
multi(0)disk(0)rdisk(0)partition(1)\WINNT="Microsoft Windows 2000 Professional" /fastdetect
multi(0)disk(0)rdisk(0)partition(3)\WINDOWS="Windows XP Debug" /fastdetect /debug /debugport=COM1 /baudrate=19200
multi(0)disk(0)rdisk(0)partition(3)\WINDOWS="Microsoft Windows XP Professional" /fastdetect
Using Nvrboot
On systems that store boot options in EFI NVRAM, you can use the nvrboot p (push) command, which "pushes" a boot entry to the top of the boot entries list, making it the
first entry in the Boot Entries section.
Like Bootcfg, the nvrboot p command reorders the values in the BootOrder array so that the NVRAM boot ID of the specified boot entry is the first item the array.
Using BCDEdit
For Windows Vista and later versions of Windows, you can specify the default boot entry using the /default option. The syntax to specify the default operating system is as
follows:
bcdedit /default <ID>
The <ID> is the GUID for the Windows boot loader boot entry that is associated with the operating system that you want to designate as the default. You must include the
braces ({ }) around the GUID, for example:
bcdedit /default {cbd971bf-b7b8-4885-951a-fa03044f5d71}
To change the default boot entry to the earlier Windows operating system loader on a multiboot computer, set <ID> to {ntldr}, which is the reserved name for the GUID that
is associated with Ntldr. This might present another menu depending on entries in Boot.ini file.
bcdedit /default {ntldr}
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
-----------Timeout:
Default:
CurrentBootEntryID:
Page 26 of 1651
2
\Device\HarddiskVolume3\WINDOWS
1
For complete instructions for using Bootcfg, see Help and Support Services. For examples, see Using Boot Parameters.
Editing the Boot.ini file
The timeout parameter in the [boot loader] section of the Boot.ini file determines the boot menu time-out. Valid values are from 0 through 9999 and 1. When the value of
timeout is 1, the time-out is indefinite, that is, the operating system does not boot until you select an item from the boot menu.
To change the boot menu time-out in the Boot.ini file, type a new value for the timeout parameter in the [boot loader] section. For example, the boot menu time-out in the
following Bootcfg sample is 30 seconds, which is the preset value on all versions of Windows.
[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(3)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINNT="Microsoft Windows 2000 Professional" /fastdetect
multi(0)disk(0)rdisk(0)partition(3)\WINDOWS="Microsoft Windows XP Professional" /fastdetect
Using BCDEdit
To specify the boot menu time-out value, use the /timeout option:
bcdedit /timeout <timeout>
Use the /timeout option and specify the timeout value in seconds. For example, to specify a 15-second timeout value:
bcdedit /timeout 15
Available Switch
/3GB
On 32-bit versions of Windows, the /3GB parameter enables 4 GT RAM Tuning, a feature that enlarges the user-mode virtual address space to 3 GB and restricts the kernelmode components to the remaining 1 GB.
/3GB [ /userva=SizeInMB ]
Subparameters
/userva
Specifies an alternate amount of user-mode virtual address space for operating systems booted with the /3GB parameter.
SizeInMB
Specifies the amount of memory, in megabytes, for user-mode virtual address space. This variable can have any value between 2048 (2 GB) and 3072 (3 GB) megabytes
in decimal notation. Windows uses the remaining address space (4 GB minus the specified amount) as its kernel-mode address space.
Comments
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 27 of 1651
The /3GB parameter is supported on Windows Server 2003, Windows XP, and Windows 2000. On Windows Vista and later versions of Windows, use the IncreaseUserVA
element in BCDEdit.
On Windows, by default, the lower 2 GB are reserved for user-mode programs and the upper 2 GB are reserved for kernel-mode programs. You can use this parameter to test
the performance of your driver when it is running in a 1 GB kernel.
The 4 GT RAM Tuning feature is fully functional on Microsoft Windows 2000 Advanced Server, Microsoft Windows 2000 Datacenter Server, and all editions of
Windows XP, Windows Server 2003, Windows Vista, and later versions of Windows.
On other versions of Windows 2000, this feature restricts the kernel to addresses above the 3 GB boundary. However, user-mode applications cannot access more than 2 GB
of address space.
The /userva subparameter is designed for computers that need more than 2 GB but less than 3 GB of user-mode address space, particularly those that are running memoryintensive user-mode programs. When used without the /3GB parameter, /userva is ignored.
The /3GB and /userva parameters are valid only on boot entries for 32-bit versions of Windows on computers with x86 or x64-based processors.
To take advantage of the 3 GB available to user-mode programs, the program must be linked with the /LARGEADDRESSAWARE option.
On 64-bit versions of Windows Server 2003, the system automatically expands the virtual address space available to 32-bit user-mode programs linked with
the /LARGEADDRESSAWARE option as needed without the /3GB boot parameter. On Windows Server 2003 RTM (without Service Pack 1), these 32-bit programs can
access up to 3 GB of virtual address space. On Windows Server 2003 with Service Pack 1, they can access up to 4 GB of virtual address space. Native 64-bit user-mode
programs can access up to 8 TB of virtual address space.
Booting with the /3GB parameter decreases the amount of kernel virtual address space on the system. In order to fit all of the kernel resources within the remaining 1 GB of
virtual memory, NT-based Windows operating systems prior to Windows Vista restrict physical memory to frames below the 16 GB physical boundary. Windows Vista and
later versions of Windows restrict physical memory to frames below the 64 GB boundary. Because allocation of memory resources in Windows Vista and later is dynamic
and, therefore, more adaptable and efficient, the system can devote more memory space to addressing, thereby accommodating more physical memory.
The following table lists the physical memory limits of 32-bit Windows operating systems that support the use of more than 4 GB of physical memory with and without
the /3GB boot parameter.
Operating system
Physical memory limit without /3GB Physical memory limit with /3GB
Windows Vista
4 GB
4 GB (no effect)
Windows Vista, Datacenter Edition
128 GB
64 GB
Windows Server 2003, Enterprise Edition
32 GB
16 GB
Windows Server 2003, Enterprise Edition SP1 64 GB
16 GB
Windows Server 2003, Datacenter Edition
128 GB
16 GB
Windows Server 2003, Datacenter Edition SP1 128 GB
16 GB
Windows XP (all editions)
4 GB
4 GB (no effect)
On Windows XP, some drivers, especially video adapter drivers with onboard RAM, cannot run with the /3GB parameter because they require more address space than the
1 GB kernel address space permits.
Examples
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Windows Server 2003, Enterprise" /fastdetect /3GB
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Windows Server 2003, Enterprise" /fastdetect /3GB /userva=3030
Bootcfg Commands
bootcfg /raw "/3GB" /A /ID 1
bootcfg /raw "/3GB /userva=3030" /A /ID 2
/basevideo
The /basevideo parameter directs Windows to use VGA video mode.
/basevideo
Example
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect /basevideo
Bootcfg Command
bootcfg /addsw BV /ID 1
Comments
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 28 of 1651
The /basevideo parameter is supported only on Windows Server 2003, Windows XP, and Windows 2000. On Windows Vista and later, set the vga parameter using BCDEdit,
see BCDEdit /set.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
/bootlog
The /bootlog parameter records the names of drivers as they load during the boot process and saves the ordered list in the %SystemRoot%\ntbtlog.txt file.
/bootlog
Comments
The /bootlog parameter is supported only on Windows Server 2003, Windows XP, and Windows 2000. On Windows Vista and later versions of Windows, use the
LogInitialization element in BCDEdit.
Example
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect /bootlog
Bootcfg Command
bootcfg /raw "/bootlog" /A /ID 1
/break
The /break parameter sets a breakpoint at HAL initialization.
/break
Comments
The /break parameter is supported only on Windows Server 2003, Windows XP, and Windows 2000. On Windows Vista and later versions of Windows, use the
HALBreakPoint element in BCDEdit.
When the /break parameter is used with the /debug parameter, the HAL waits at the breakpoint indefinitely until a debugger is connected.
When the /break parameter is used without the /debug parameter, Windows issues Bug Check 0x78: PHASE0_EXCEPTION and displays a blue screen when it hits the
breakpoint.
This parameter is used primarily in HAL development and debugging.
Example
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /break /debug
Bootcfg Command
bootcfg /raw "/break /debug" /A /ID 1
/burnmemory
The /burnmemory parameter reduces the amount of memory available to Windows by the specified amount.
/burnmemory=SizeInMB
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 29 of 1651
Subparameter
SizeInMB
Specifies an amount of memory (in megabytes). Enter a decimal integer. This value is subtracted from the amount of memory otherwise allocated to the system.
Comments
The /burnmemory parameter is supported only on Windows Server 2003, Windows XP, and Windows 2000. On Windows Vista and later versions of Windows, use the
removememory option with BCDEdit.
This parameter is similar to the /maxmem parameter, which specifies the amount of memory available to Windows. However, because /maxmem actually sets an upper
bound for memory addresses available to Windows, and because there might be gaps in the allocation of system memory, the /burnmemory parameter is more precise than
the /maxmem parameter.
Example
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /burnmemory=256
Bootcfg Command
bootcfg /raw "/burnmemory=256" /A /ID 1
/crashdebug
The /crashdebug parameter establishes a kernel debugger connection, but does not enable debugging unless a bug check occurs. Until then, the port that is usually reserved
for debugging is free for other uses.
This option is designed for Windows 2000 and Windows XP. For Windows Server 2003, use the /debug=disable parameter. For details, see /debug.
/crashdebug [/debugport=COMx] [/baudrate=BaudRate]
Subparameters
/debugport
Specifies the serial port used by the kernel debugger for crash-only debugging.
COMx
Specifies a communications port on the computer. Valid values for COMx are any valid COM port, such as COM1 or COM2. The default is the highest enumerated port.
/baudrate
Specifies the speed of the kernel debugger connection.
BaudRate
Specifies the speed of the kernel debugger connection in bits per second (BPS). Valid values for BaudRate are 9600, 19200, 38400, 57600, and 115200. The default is
19200.
Comments
This parameter is useful for debugging random kernel errors.
If a boot entry includes both /debug and /crashdebug, the /debug parameter is ignored.
Examples
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /crashdebug
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /crashdebug /debugport=COM1 /baudrate=57600
Bootcfg Commands
bootcfg /raw "/crashdebug" /A /ID 1
bootcfg /raw "crashdebug /debugport=COM1 /baudrate=57600" /A /ID=2
/debug
The /debug parameter establishes a kernel debugging connection.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 30 of 1651
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 31 of 1651
To enable debugging with an IEEE 1394 (FireWire) cable, use the /debug parameter with the /debugport=1394 and /channel subparameters.
Because the /debugport subparameter reserves the specified port, do not use it unless you plan to debug the computer.
When you enable kernel debugging on a serial port, Windows removes the specified port from the system device list. As a result, on computers with an ACPI BIOS, the port
does not appear in any device lists, such as the one in Device Manager. On computers that do no have an ACPI BIOS, the port appears with an error message, such as "Not
enough resources to use this port." These messages indicate that the port is under the control of the host debugging computer; they do not indicate a malfunction.
To test a cable connection, start your test after connecting the cable, but before enabling debugging.
When you configure a boot entry for debugging, the boot loader appends a bracketed phrase, [debugger enabled], to the friendly name that appears in the boot menu.
However, the boot loader omits the bracketed phrase from the boot menu when the friendly name and the bracketed phrase together exceed 70 characters. To restore the
bracketed phrase, shorten the friendly name.
On Windows Server 2003, you can use the autoenable, disable, and noumex subparameters of /debug to enable the debugger only when you need it. You can use more than
one subparameter at a time. To use multiple subparameters, separate each subparameter with a comma. (Do not type /debug more than once. If you do, Windows uses the first
instance and ignores all others.)
For example, /debug=autoenable,noumex enables the kernel debugger on an exception or critical event, but not for user-mode events.
For detailed examples of the use of the /debug parameter and its variations, see Boot Parameters to Enable Debugging.
Examples
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect /debug
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /debug /debugport=COM1 /baudrate=115200
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /debug /debugport=1394 /channel=44
/execute
The /execute parameter disables Data Execution Prevention (DEP) and Physical Address Extension (PAE).
Note DEP is a highly effective security feature. Do not disable DEP unless you have no other alternative.
Note The /execute parameter is supported in in Windows Server 2003 with SP1 to disable both DEP and PAE . To disable DEP and PAE in Windows XP with Service
Pack 2 (SP2), use /noexecute=alwaysoff. For more information, see /noexecute.
For more information about using the /execute parameter and the other parameters that affect DEP configuration, see Boot Parameters to Configure DEP and PAE.
/execute
Comments
What is DEP?
DEP consists of hardware and software methods. Software-enforced DEP, which protects only user-mode processes, must be supported by the operating system. Hardwareenforced DEP sets a bit in the page table entry that prevents code from being executed from a virtual memory page that should contain only data. Hardware-enforced DEP
must be supported by the operating system and the processor on the computer. If the operating system supports DEP, but the processor does not, only software-enforced DEP
is enabled on the system.
Operating System Support
DEP is supported in Windows Server 2003 with SP1, Windows XP with SP2, Windows Vista, and later versions of Windows. The /execute option is supported only on
Windows Server 2003 with SP1 and Windows XP with SP2. On Windows Vista and later versions of Windows, use the NX element in BCDEdit.
32-bit and 64-bit Support
The /execute parameter is effective only on 32-bit processes. On 64-bit processes, DEP is enabled by default and cannot be disabled. For these processes, the /execute
parameter is ignored. On a 64-bit operating system, the /execute parameter affects only on 32-bit processes running on the system.
Enabling and Configuring DEP
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 32 of 1651
To enable, disable, and configure DEP on Windows Server 2003 with SP1 and Windows XP with SP2, use the/noexecute boot parameter.
DEP and PAE
On 32-bit operating systems, hardware-enforced DEP requires PAE. Therefore, when DEP is enabled on a computer that supports hardware-enforced DEP, 32-bit versions of
the Windows operating system automatically enable PAE (see /pae).
The /execute parameter disables both DEP and PAE.
On Windows XP, Windows Vista and later versions of Windows when you disable DEP, Windows also disables PAE. On Windows XP, the /execute parameter has the same
effect as the /noexecute=alwaysoff and noexecute=alwaysoff /nopae parameters; they all disable both DEP and PAE.
However, on Windows Server 2003 with SP1, the /noexecute=alwaysoff parameter disables DEP, but it does not disable PAE, and the system ignores /nopae. To disable
both DEP and PAE on Windows Server 2003 with SP1, you must use /execute.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
/fastdetect
The /fastdetect parameter disables NTDETECT serial and parallel port device detection at the specified communications ports. If you do not specify a communications port,
this parameter disables detection on all serial and parallel ports.
/fastdetect[=COMx | =COMx,y,z...]
Subparameter
COMx, y, z
Limits the /fastdetect parameter only to the specified ports. The x, y, and z subparameter represent one or more communication ports on the computer.
Comments
Because the /fastdetect parameter permits Plug and Play (PnP) to detect devices on these ports and prevents detection of unsupported devices, it typically results in a faster,
more reliable boot.
Setup adds the /fastdetect parameter (without specified ports) to the boot entries that it creates for Windows Server 2003, Windows XP, and Windows 2000.
You can omit the /fastdetect parameter when using devices known only to the BIOS (not to Windows). For example, you should omit /fastdetect to test a port that is hidden
from PnP.
This boot parameter is supported only on Windows Server 2003, Windows XP, and Windows 2000.
Examples
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect=COM2
Bootcfg Commands
bootcfg /raw "/fastdetect" /A /ID 1
bootcfg /raw "/fastdetect=COM2" /A /ID 2
/hal
The /hal parameter directs the boot loader to load an alternate hardware abstraction layer (HAL) file for the operating system. The default HAL file is hal.dll.
/hal=HALFile
Subparameter
HALFile
Specifies a HAL file. The specified file must be located in the %SystemRoot%\system32 directory, and its file name must conform to 8.3character format.
Comments
The /hal option is supported only on Windows Server 2003 with SP1 and Windows XP with SP2. On Windows Vista and later versions of Windows, use the HAL element in
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 33 of 1651
BCDEdit.
You can use this parameter to test a HAL patch or use it with the /kernel parameter to load a partial checked build installation.
Do not use this parameter unless you have deliberately installed a different HAL.
Example
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect /hal=HALtest.dll
Bootcfg Command
bootcfg /raw "/hal=HALtest.dll" /A /ID 1
/kernel
The /kernel parameter directs the boot loader to load an alternate kernel file for the operating system.
/kernel=KernelFile
Subparameter
KernelFile
Specifies a kernel file. The specified file must be located in the %SystemRoot%\system32 directory, and its file name must conform to 8.3character format.
Comments
The /execute option is supported only on Windows Server 2003 with SP1 and Windows XP with SP2. On Windows Vista and later versions of Windows, use the Kernel
element in BCDEdit.
For computers with less than 4 GB of memory, the default kernel file is ntoskrnl.exe. For computers with 4 GB or more of memory, the default kernel file is ntkrnlpa.exe.
Do not use this parameter unless you have deliberately installed a different kernel. You can use this parameter to test a kernel patch, or use it with the /hal parameter to load a
partial checked build installation.
Example
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect /hal=KRNLtest.dll
Bootcfg Command
bootcfg /raw "/kernel=KRNLtest.dll" /A /ID 1
/maxmem
The /maxmem parameter limits the physical memory available to Windows.
/maxmem=SizeInMB
Subparameter
SizeInMB
Specifies the maximum amount of physical memory available to Windows. Enter a decimal number that represents the amount of memory in megabytes.
Comments
This parameter actually limits Windows to memory addresses less than or equal to the specified value. Because some memory within the remaining address space might be
reserved for nonsystem use, the actual memory available to Windows might be less than the amount that you specify.
The /maxmem parameter is supported only on Windows Server 2003, Windows XP, and Windows 2000. On Windows Server 2003 and Windows XP, use /burnmemory to
limit system memory more precisely. On Windows Vista and later versions of Windows, use the removememory or truncatememory parameters with the BCDEdit /set
command
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 34 of 1651
You can use this parameter to test a driver in low memory conditions. For example, you can use this parameter to limit a computer with 1 GB of memory to 256 MB of
memory.
Example
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect /maxmem=256
Bootcfg Command
bootcfg /addsw /MM 256 /ID 1
/nodebug
The /nodebug parameter disables kernel debugging.
/nodebug
Comments
The /nodebug option is supported only on Windows Server 2003 with SP1 and Windows XP with SP2. On Windows Vista and later versions of Windows, in BCDEdit, use
the /debug command with a value of OFF (bcdedit /debug [ID] OFF).
If you include the /nodebug parameter, then the /debug parameter and its /debugport, /baudrate, and /targetname subparameters are ignored. If you include
the /crashdebug parameter, then the /nodebug parameter is ignored.
You can use this parameter to disable a debugging configuration without deleting it from the boot options on your computer.
Examples
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect /nodebug
/noguiboot
The /noguiboot parameter suppresses all bit-mapped graphics during the boot process, including the splash screen and progress bar that precede the logon prompt and the blue
background of a bug check screen.
/noguiboot
Comments
This boot parameter is supported only on Windows Server 2003, Windows XP, and Windows 2000.
The /noguiboot option is supported only on Windows Server 2003 with SP1 and Windows XP with SP2.
OnWindows Vista and later, use the quietboot option with BCDEdit. The quietboot option controls the display of a high-resolution bitmap in place of the Windows boot
screen display and animation.
When /noguiboot is used, the system does not initialize bootvid.dll, the software component that provides basic video support before the computer's graphics drivers are
loaded. Because bootvid.dll is not operating, the computer cannot display bit-mapped graphics during the boot process.
You can use this parameter to investigate problems with video devices.
Example
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect /noguiboot
Bootcfg command
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 35 of 1651
/noexecute
The /noexecute parameter enables, disables, and configures Data Execution Prevention (DEP), a set of hardware and software technologies designed to prevent harmful code
from running in protected memory locations.
For more information about using the /noexecute parameter and the other parameters that affect DEP configuration, see Boot Parameters to Configure DEP and PAE.
Note DEP is a highly effective security feature. Do not disable DEP unless you have no alternative.
/noexecute={alwayson | optout | optin | alwaysoff}
Subparameter
alwayson
Enables DEP for the operating system and all processes, including the Windows kernel and drivers. All attempts to disable DEP are ignored.
optout
Enables DEP for the operating system and all processes, including the Windows kernel and drivers. However, administrators can disable DEP on selected executable files
by using System in Control Panel.
optin
Enables DEP only for operating system components, including the Windows kernel and drivers. Administrators can enable DEP on selected executable files by using the
Application Compatibility Toolkit (ACT).
alwaysoff
Disables DEP. Attempts to enable DEP selectively are ignored.
On Windows XP with SP2, this subparameter also disables Physical Address Extension (PAE). This subparameter does not disable PAE on Windows Server 2003 with
SP1.
Comments
What is DEP?
Data Execution Prevention (DEP) consists of hardware and software methods. Software-enforced DEP, which protects only user-mode processes, must be supported by the
operating system. Hardware-enforced DEP sets a bit in the page table entry that prevents code from being executed from a virtual memory page that should contain only data.
Hardware-enforced DEP must be supported by the operating system and the processor on the computer. If the operating system supports DEP, but the processor does not, only
software-enforced DEP is enabled on the system.
Operating System Support
DEP is supported in Windows Server 2003 with SP1, Windows XP with SP2, Windows Vista, and later versions of Windows.
The /noexecute parameter is supported only on Windows Server 2003 with SP1 and Windows XP with SP2. On Windows Vista and later versions of Windows, use the NX
element in BCDEdit.
32-bit and 64-bit Support
The /noexecute parameter is effective only on 32-bit processes. It enables software-enforced DEP and, if the processor supports DEP, it also enables hardware-enforced DEP.
On 64-bit processes, DEP is enabled by default and cannot be disabled (equivalent to /noexecute=alwayson). For these processes, the /noexecute parameter is ignored. On a
64-bit operating system, the /noexecute parameter affects only 32-bit processes running on the system.
Default Values
On Windows XP with SP2, the installation program adds /noexecute=optin to the boot entry.
On Windows Server 2003 with SP1, the installation program adds /noexecute=optout to the boot entry.
However, on all operating systems that support DEP, if the /noexecute parameter is not present in the boot options, the system behaves as though the setting
is /noexecute=optin.
DEP and PAE
On 32-bit operating systems, hardware-enforced DEP requires Physical Address Extension (PAE). Therefore, when DEP is enabled on a computer that supports hardwareenforced DEP, 32-bit versions of the Windows operating system automatically enable PAE and ignores /nopae.
On Windows XP with SP2, , when you disable DEP by using /noexecute=alwaysoff, Windows disables both DEP and PAE. This is the equivalent of
using /noexecute=alwaysoff /nopae. To enable PAE without DEP on a system with hardware-enforced DEP, use /noexecute=alwaysoff /pae. This explicitly enables PAE
while disabling DEP.
However, on Windows Server 2003 with SP1, when you disable DEP by using /noexecute=alwaysoff, Windows disables only DEP. PAE is still enabled and the system
ignores explicit attempts to disable PAE, such as the /nopae parameter. To disable both DEP and PAE on Windows Server 2003 with SP1, use /execute.
For a table that describes these parameters and their effects, see Boot Parameters to Configure DEP and PAE.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 36 of 1651
Changes to Functionality in Microsoft Windows XP Service Pack 2, Part 3: Memory Protection Technologies.
Example
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect /noexecute=alwayson
Bootcfg command
bootcfg /raw "/noexecute=alwayson" /A /ID 1
/nolowmem
The /nolowmem parameter loads the operating system, device drivers, and all applications into addresses above the 4 GB boundary, and directs Windows to allocate all
memory pools at addresses above the 4 GB boundary.
/nolowmem
Comments
This parameter is valid only on boot entries for 32-bit versions of Windows on computers with x86 or x64-based processors, and only when Physical Address Extension
(PAE) is enabled.
This boot parameter is supported only on Windows Server 2003, Windows XP, and Windows 2000.
On versions of Windows prior to Windows Server 2003 with Service Pack 1, if a boot entry includes both /nolowmem and /3GB, then /nolowmem is ignored. These
parameters can be used together in Windows Server 2003 with Service Pack 1.
On Windows Vista and later versions of Windows, use the NoLowMem element in BCDEdit.
Example
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect /nolowmem
Bootcfg command
bootcfg /raw "\nolowmem" /A /ID 1
See Also
/pae
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
/nopae
The /nopae parameter disables Physical Address Extension (PAE) and forces the boot loader to load the non-PAE version of the Windows kernel.
For more information about using the /nopae parameter and the other parameters that affect PAE configuration, see Boot Parameters to Configure DEP and PAE.
/nopae
Comments
This parameter is valid only on boot entries for 32-bit versions of Windows that run on computers with x86 and x64-based processors.
The /nopae option is supported only on Windows Server 2003 with SP1 and Windows XP with SP2. On Windows Vista and later versions of Windows, use the PAE element
in BCDEdit with a value of ForceDisable.
Consider using this parameter on systems on which a device does not operate properly when PAE is enabled.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 37 of 1651
Typically, this parameter is not necessary because PAE is not enabled unless you use the /pae boot parameter. However, on computers with x86 processors, Windows
automatically enables PAE when the computer is configured for hot-add memory devices in memory ranges beyond the 4 GB region, as defined by the Static Resource
Affinity Table (SRAT). Hot-add memory supports memory devices that you can add without rebooting or turning off power to the computer. In this case, because PAE must
be enabled when the system starts, it is enabled automatically so that the system can immediately address extended memory that is added between restarts. (Disabling PAE on
these systems disables hot-add memory.) Hot-add memory is supported only on Windows Server 2003, Datacenter Edition; Windows Server 2003, Enterprise Edition;
Windows Server 2008, Datacenter Edition; Windows Server 2008, Enterprise IA64 Edition; and on the datacenter and enterprise editions of all later versions of Windows
Server. Moreover, for versions of Windows prior to Windows Server 2008, hot-add memory is supported only on computers with an ACPI BIOS, an x86 processor, and
specialized hardware. For Windows Server 2008 and later versions of Windows Server, it is supported for all processor architectures.
On a computer that supports hardware-enabled Data Execution Protection (DEP) and is running a 32-bit version of the Windows operating system that supports DEP, PAE is
automatically enabled when DEP is enabled, even if /nopae is set. On all 32-bit versions of Windows that support DEP, except Windows Server 2003 with SP1, when you
disable DEP, Windows automatically disables PAE, but you can use /pae to enable it. For information about DEP, see /noexecute.
PAE is supported in Windows 2000 and later versions of Windows.
Example
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Windows Server 2003, Enterprise" /fastdetect /nopae
Bootcfg Command
bootcfg /raw "/nopae" /A /ID 1
See Also
/pae
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
/pae
The /pae parameter enables Physical Address Extension (PAE). This parameter directs the system to load the PAE version of the Windows kernel.
For more information about using the /pae parameter and the other parameters that affect PAE configuration, see Boot Parameters to Configure DEP and PAE.
/pae
Comments
The /pae parameter is supported only on Windows Server 2003, Windows XP, and Windows 2000. On Windows Vista and later versions of Windows, use the PAE element
with the BCDEdit /set command.
PAE is an addressing strategy that uses a page-translation hierarchy to enable systems with 32-bit addressing to address more than 4 GB of physical memory. PAE also
supports several advanced system and processor features, such as Data Execution Prevention (DEP; "No execute"), Non-Uniform Memory Architecture (NUMA), and hot-add
memory, so it is also used on computers with less than 4 GB of memory. PAE must be supported by the processor and by the operating system.
PAE is supported beginning with the Windows 2000 operating system.
Operating system
Maximum memory support with PAE
Windows 2000 Advanced Server
8 GB of physical RAM
Windows 2000 Datacenter Server
32 GB of physical RAM
Windows XP (all versions)
4 GB of physical RAM*
Windows Server 2003 (and SP1), Standard Edition 4 GB of physical RAM*
Windows Server 2003, Enterprise Edition
32 GB of physical RAM
Windows Server 2003, Datacenter Edition
64 GB of physical RAM
Windows Server 2003 SP1, Enterprise Edition
64 GB of physical RAM
Windows Server 2003 SP1, Datacenter Edition
128 GB of physical RAM
* Total physical address space is limited to 4 GB on these versions of Windows. When 4 GB of memory is installed and PAE is enabled, the amount of available memory
could be less than what you would expect. For more information about memory usage, see article Q888137, "The amount of RAM reported by the System Properties dialog
box and the System Information tool is less than you expect after you install Windows XP Service Pack 2" in the Microsoft Knowledge Base.
The /pae parameter is valid only on boot entries for 32-bit versions of Windows that run on computers with x86 and x64-based processors. On 32-bit versions of Windows,
PAE is disabled by default. You must use the /pae boot parameter to enable PAE.
However, Windows automatically enables PAE when the computer is configured for hot-add memory devices in memory ranges beyond the 4 GB region, as defined by the
Static Resource Affinity Table (SRAT). Hot-add memory supports memory devices that you can add without rebooting or turning off the computer. In this case, because PAE
must be enabled when the system starts, it is enabled automatically so that the system can immediately address extended memory that is added between restarts. Hot-add
memory is supported only on Windows Server 2003, Datacenter Edition; Windows Server 2003, Enterprise Edition; Windows Server 2008, Datacenter Edition; Windows
Server 2008, Enterprise IA64 Edition; and on the datacenter and enterprise editions of all later versions of Windows Server. Moreover, for versions of Windows prior to
Windows Server 2008, hot-add memory is supported only on computers with an ACPI BIOS, an x86 processor, and specialized hardware. For Windows Server 2008 and later
versions of Windows Server, it is supported for all processor architectures.
On a computer that supports hardware-enabled Data Execution Prevention (DEP) and is running a 32-bit version of the Windows operating system that supports DEP, PAE is
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 38 of 1651
automatically enabled when DEP is enabled and, on all 32-bit versions of the Windows operating system, except Windows Server 2003 with SP1, PAE is disabled when you
disable DEP. To enable PAE when DEP is disabled, you must enable PAE explicitly, by using /noexecute=alwaysoff /pae. For more information about DEP, see /noexecute
and /execute.
PAE is required to support Cache Coherent Non-Uniform Memory Architecture (known as ccNUMA or NUMA) on computers with x86 processors, although Windows can
run in non-NUMA mode on NUMA-capable computers without PAE. Even when it is required, PAE is not enabled automatically. NUMA is supported in all editions of
Windows XP and Windows Vista, and in the Enterprise and Datacenter editions of Windows Server 2003.
Example
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Windows Server 2003, Enterprise" /fastdetect /pae
Bootcfg command
bootcfg /raw "/pae" /A /ID 1
/pcilock
The /pcilock parameter prevents the HAL from reallocating I/O and IRQ resources on the PCI bus. The I/O and memory resources set by the BIOS are preserved.
/pcilock
Comments
This parameter is valid only on boot entries for 32-bit versions of Windows that run on computers with x86 or x64-based processors.
The /pcilock parameter is supported only on Windows Server 2003, Windows XP, and Windows 2000. On Windows Vista and later versions of Windows, use the
UseFirmwarePCISettings element in BCDEdit.
Example
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Windows Server 2003, Standard" /fastdetect /pcilock
Bootcfg Command
bootcfg /raw "/pcilock" /A /ID 1
/redirect
The /redirect parameter enables Emergency Management Services (EMS) console redirection on a Windows server.
Computers with ACPI BIOS firmware and an SPCR table
In the [boot loader] section:
redirect=COMx
[redirectbaudrate=BaudRate]
- OR redirect=USEBIOSSETTINGS
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 39 of 1651
redirect=COMx
[redirectbaudrate=BaudRate]
Parameters
redirect=
Establishes a port for EMS console redirection. This should be the same port that the computer uses for out-of-band management.
This parameter is required and valid only on computers with BIOS firmware. It appears in the [boot loader] section of the Boot.ini file and applies to all boot entries on
the computer.
The following table describes the values of the redirect= statement.
Value
COMx
Description
Specifies a serial port. Valid values are COM1, COM2, COM3, and COM4. Set this value to the serial port that is designated for out-of-band
management in the firmware. You cannot use the same port for debugging and for EMS console redirection.
This value is required on computers with BIOS firmware that do not have an ACPI Serial Port Console Redirection (SPCR) table.
When used on computers that have an SPCR table, this value is used instead of the settings in the SPCR table.
USEBIOSSETTINGS Uses the port and connection speed that are designated for out-of-band management in the firmware.
Valid only on computers with a BIOS firmware and an ACPI Serial Port Console Redirection (SPCR) table.
redirectbaudrate=
Establishes the connection speed for EMS transmission. This parameter is optional and valid only with redirect=COMx. If you omit this parameter on any computer
with BIOS firmware, the default connection speed for EMS transmission is 9600 kilobits per second (Kbps).
When redirect=COMx and redirectbaudrate= are used on computers with an SPCR table, the specified COM port and transmission rate are used instead of the settings
in the SPCR table.
The following table describes the value of the redirectbaudrate= parameter.
Value
Description
BaudRate Specifies the connection speed for EMS transmission. Valid values are 9600, 19200, 57600, and 115200 in kilobits per second (Kbps). (38400 is not a valid
value.) The default value is 9600 Kbps.
/redirect
Enables EMS console redirection on a Windows server operating system associated with the boot entry. This parameter is valid on boot entries for Windows Server 2003
and later version of Windows server systems on all computers.
Comments
The /redirect parameter is supported only on Windows Server 2003, Windows XP, and Windows 2000. In Windows Vista and later versions of Windows, use BCDEdit and
the /emssettings parameter and its subparameters to establish EMS settings for all boot entries. Then, use the /ems parameter to enable EMS for a particular boot entry.
EMS allows users to control particular components of a server remotely, even when the server is not connected to the network or to other standard remote-administration
tools. For information about EMS, search for Emergency Management Services on the Microsoft TechNet Web site.
EMS is supported on all versions of Windows Server 2003 and later and versions of Windows server systems for x86-, x64-, and Itanium-based computers.
To properly enable EMS console redirection after Windows is installed, Windows needs to know the port and transmission rate that the computer uses for out-of-band
communication. Windows uses these same settings for EMS console redirection.
On computers with EFI firmware, Windows automatically retrieves the out-of-band settings from the EFI firmware. On computers with BIOS firmware, Windows must find
the out-of-band settings in the Boot.ini file.
On computers with BIOS firmware and an ACPI Serial Port Console Redirection (SPCR) table, Windows can find the out-of-band settings established in the BIOS by reading
entries in the SPCR table. On these systems, you can add the redirect=USEBIOSSETTINGS parameter to the Boot.ini file to direct Windows to look in the SPCR table for
the port settings, or you can use the redirect=COMx and redirectbaudrate= parameters to override the settings in the SPCR table.
On computers that have BIOS firmware, but do not have an SPCR table, repeat the out-of-band settings in the Boot.ini file. Use the redirect=COMx parameter to specify the
port and the redirectbaudrate= parameter to specify the transmission rate.
On all systems, use the /redirect parameter on a boot entry to enable EMS console redirection on the operating system that the boot entry loads.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 40 of 1651
The boot parameters described in this section enable EMS console redirection after Windows is installed. For information about enabling EMS during a new installation or
upgrade of Windows, search for "Enabling Emergency Management Services" on the Microsoft TechNet Web site.
For a detailed example, see Boot Parameters to Enable EMS Redirection.
For more information about EMS, see "Emergency Management Services" in Help and Support. Also, review the topics in the "Headless Server and Emergency
Management Services Design" section of the Server Platform Design - Overview page on the Windows Hardware Developer Central Web site.
Examples
Computers with no SPCR table (or to override the SPCR table)
[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
redirect=COM1
redirectbaudrate=115200
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Windows Server 2003, Standard" /fastdetect /redirect
Computers with an SPCR table
[boot loader]
timeout=2
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
redirect=USEBIOSSETTINGS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Windows Server 2003, Standard" /fastdetect /redirect
Computers with EFI firmware (Bootcfg display)
Boot Options
-----------Timeout:
Default:
CurrentBootEntryID:
30
\Device\HarddiskVolume3\WINDOWS
1
Boot Entries
-----------Boot entry ID:
OS Friendly Name:
OsLoadOptions:
BootFilePath:
OsFilePath:
1
Microsoft Windows .NET Enterprise Server
/redirect
\Device\HarddiskVolume1\EFI\Microsoft\WINNT50\ia64ldr.efi
\Device\HarddiskVolume3\WINDOWS
Bootcfg Commands
bootcfg
bootcfg
bootcfg
bootcfg
/ems
/ems
/ems
/ems
/sos
The /sos parameter displays the names of the drivers as they load during the boot process.
/sos
Comments
The /sos parameter is supported only on Windows Server 2003, Windows XP, and Windows 2000. On Windows Vista and later versions of Windows, use the SOS option
with BCDEdit.
Example
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect /sos
Bootcfg Command
bootcfg /addsw SO /ID n
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 41 of 1651
increaseuserva
vga
BCDEdit option
/BOOTLOG
bootlog
BcdOSLoaderBoolean_BootLogInitialization
/BREAK
halbreakpoint
BcdOSLoaderBoolean_DebuggerHalBreakpoint
/CRASHDEBUG
/dbgsettings /start
/DEBUG
/bootdebug
BcdLibraryBoolean_DebuggerEnabled
/debug
BcdOSLoaderBoolean_KernelDebuggerEnabled
/DEBUGPORT=
BcdLibraryInteger_DebuggerType
BcdLibraryInteger_SerialDebuggerPort
BcdLibraryInteger_SerialDebuggerBaudRate
BcdLibraryInteger_1394DebuggerChannel
BcdLibraryString_UsbDebuggerTargetName
/EXECUTE
nx
BcdOSLoaderInteger_NxPolicy
/FASTDETECT
/HAL=
hal
BcdOSLoaderString_HalPath
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 42 of 1651
/KERNEL=
kernel
BcdOSLoaderString_KernelPath
/MAXMEM=
truncatememory
BcdLibraryInteger_TruncatePhysicalMemory
/NODEBUG
/debug
/NOEXECUTE
nx {
BcdOSLoaderInteger_NxPolicy
/NOGUIBOOT
quietboot
BcdOSLoaderBoolean_DisableBootDisplay
/NOLOWMEM
nolowmem
BcdOSLoaderBoolean_NoLowMemory
/NOPAE
/ONECPU
pae
onecpu
BcdOSLoaderInteger_PAEPolicy
BcdOSLoaderBoolean_UseBootProcessorOnly
/PAE
/PCILOCK
pae
usefirmwarepcisettings
BcdOSLoaderInteger_PAEPolicy
BcdOSLoaderInteger_UseFirmwarePciSettings
/REDIRECT
/ems
BcdOSLoaderBoolean_EmsEnabled
/emssettings [ BIOS ] |
[ EMSPORT:{port} | [EMSBAUDRATE: {baudrate}] ]
/SOS
sos
BCDEdit /bootdebug
The /bootdebug boot option enables or disables boot debugging of the current or specified Windows operating system boot entry.
bcdedit /bootdebug [{ID}] { on | off }
Parameters
{ID}
The {ID} is the GUID that is associated with the boot entry. If you do not specify an {ID}, the command modifies the operating system that is currently active. If a boot
entry is specified, the GUID associated with the boot entry must be enclosed in braces { }.
on
Enables boot debugging of the specified boot entry. If a boot entry is not specified, boot debugging is enabled for the current operating system.
off
Disables boot debugging of the specified boot entry. If a boot entry is not specified, boot debugging is disabled for the current operating system.
Comments
The /bootdebug boot option enables boot debugging for a specific boot entry. Use the /dbgsettings option to configure the type of debugging connection (debugtype) to use
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 43 of 1651
and the connection parameters. If no /dbgsettings are specified for the boot entry, the global debug settings are used. The default values for the global settings are shown in
the following table.
dbgsetting parameter Default value
Debugtype
Serial
Debugport
1
Baudrate
115200
The following command disables boot debugging of Windows Boot Manager (Bootmgr.exe). Windows Boot Manager selects which operating system will start, and then
loads the Windows boot loader.
bcdedit /bootdebug {bootmgr} off
The following command enables boot debugging of the Windows boot loader for the current operating system. The Windows boot loader (Winload.exe) controls the progress
bar and loads the kernel boot drivers.
bcdedit /bootdebug on
In the following example, the first command sets the global debugger settings for a 1394 kernel debugging connection. The next three commands enable debugging of
Windows Boot Manager, the boot loader, and then kernel debugging of the operating system. This combination allows debugging at every stage of startup. If this combination
is used, the target computer will break into the debugger three times: when Windows Boot Manager loads, when the boot loader loads, and when the operating system starts
up.
bcdedit
bcdedit
bcdedit
bcdedit
BCDEdit /dbgsettings
The /dbgsettings option sets or displays the current global debugger settings for the computer. To enable or disable the kernel debugger, use the BCDEdit /debug option.
bcdedit /dbgsettings SERIAL [DEBUGPORT:port] [BAUDRATE:baud] [/start startpolicy] [/noumex]
bcdedit /dbgsettings 1394 [CHANNEL:channel] [/start startpolicy] [/noumex]
bcdedit /dbgsettings USB TARGETNAME:targetname [/start startpolicy] [/noumex]
Parameters
SERIAL
Specifies that the target machine and the host machine will use a serial connection for debugging. When this option is used, the DEBUGPORT and BAUDRATE
parameters can be included as well.
1394
Specifies that the target machine and the host machine will use an IEEE 1394 (FireWire) connection for debugging. When this option is used, the CHANNEL parameter
can be included as well.
USB
Specifies that the target machine and the host machine will use a USB 2.0 connection for debugging. When this option is used, the TARGETNAME parameter must be
included as well.
DEBUGPORT:port
(Only used when the connection type is SERIAL.) Specifies the serial port to use as the debugging port. This is an optional setting. The default port is 1 (COM 1).
BAUDRATE:baud
(Only used when the connection type is SERIAL.) Specifies the baud rate to use. This parameter is optional. Valid values for baud are 9600, 19200, 38400, 57600, and
115200. The default baud rate is 115200 bps.
Note If the Windows Special Administration Console (SAC) application is running on a target machine that is configured for kernel mode debug through a serial port,
the SAC application may cause the debugger connection to drop. This event occurs because the COM port baud value changes after the debugger connection is
established. Either close the SAC application before running the debugger or change the debugger COM port baud value to 9600.
CHANNEL:channel
(Only used when the connection type is 1394.) Specifies the 1394 channel to use. The value for channel must be a decimal integer between 0 and 62, inclusive, and must
match the channel number used by the host computer. The channel specified in this parameter does not depend on the physical 1394 port chosen on the adapter. The
default value for channel is 0.
TARGETNAME:targetname
(Only used when the connection type is USB.) Specifies a string value to use for the target name. This string can be any value.
/start startpolicy
This option specifies the debugger start policy. The following table shows the options for the startpolicy.
startpolicy
Description
ACTIVE
Specifies that the kernel debugger is active.
AUTOENABLE Specifies that the kernel debugger is enabled automatically when an exception or other critical event occurs. Until then, the debugger is active but is
disabled.
DISABLE.
Specifies that the kernel debugger is enabled when you type kdbgctrl to clear the enable block. Until then, the debugger is active but is disabled.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 44 of 1651
BCDEdit /debug
The /debug boot option enables or disables kernel debugging of the Windows operating system associated with the specified boot entry or the current boot entry.
bcdedit /debug [{ID}] { on | off }
Parameters
{ID}
The {ID} is the GUID that is associated with the boot entry. If you do not specify an {ID}, the command modifies the operating system that is currently active. If a boot
entry is specified, the GUID associated with the boot entry must be enclosed in braces { }.
on
Enables kernel debugging of the specified boot entry. If a boot entry is not specified, kernel debugging is enabled for the current operating system.
off
Disables kernel debugger of the specified boot entry. If a boot entry is not specified, kernel debugging is disabled for the current operating system.
Comments
The /debug boot option enables kernel debugging for a specific boot entry. Use the /dbgsettings option to configure the type of debugging connection to use and the
connection parameters. If no /dbgsettings are specified for the boot entry, the global debug settings are used. The default values for the global settings are shown in the
following table.
dbgsetting parameter Default value
Connection type
Serial
Debug port
1
Baud rate
115200
The following example enables kernel debugging of the boot entry with the GUID of 49916baf-0e08-11db-9af4-000bdbd316a0.
bcdedit /debug {49916baf-0e08-11db-9af4-000bdbd316a0} on
In the following example, the first command sets the global debugger settings for USB 2.0 and names the target myVistaTarget. The second command enables the debugger
for the current session.
bcdedit /dbgsettings usb targetname:myVistaTarget
bcdedit /debug ON
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 45 of 1651
BCDEdit /ems
The /ems option enables or disables Emergency Management Services (EMS) for the specified operating system boot entry.
bcdedit /ems [{ID}] { on | off }
Parameters
{ID}
The {ID} is the GUID that is associated with the boot entry. If you do not specify an {ID}, the command modifies the current operating system boot entry. If a boot entry
is specified, the GUID associated with the boot entry must be enclosed in braces { }.
Comments
InWindows Vista and later, use BCDEdit /emssettings command and its parameters to establish EMS settings for all boot entries. Then, use the BCDEdit /ems command to
enable EMS for a particular boot entry.
EMS allows users to control particular components of a server remotely, even when the server is not connected to the network or to other standard remote-administration
tools. For information about EMS, search for Emergency Management Services on the Microsoft TechNet Web site.
Example
The following command enables EMS for a boot entry with the identifier of {49916baf-0e08-11db-9af4-000bdbd316a0}.
bcdedit /ems {49916baf-0e08-11db-9af4-000bdbd316a0} on
BCDEdit /emssettings
The /emssettings option sets the global Emergency Management Services (EMS) settings for the computer. To enable or disable EMS, use the /ems option. The /emssettings
option does not enable or disable EMS for any boot entry.
bcdedit /emssettings [ BIOS ] | [ EMSPORT: port | [EMSBAUDRATE: baudrate] ]
Parameters
BIOS
Specifies that the system will use BIOS settings for the EMS configuration. This works only on systems that have EMS support provided by the BIOS.
EMSPORT: port
Specifies the serial port to use as the EMS port. This parameter should not be specified with the BIOS option.
EMSBAUDRATE: baudrate
Specifies the serial baud rate to use for EMS. This command should not be specified with the BIOS. The baudrate is optional, and the default is 9,600 bps.
Comments
To properly enable EMS console redirection after Windows is installed, Windows needs to know the port and transmission rate that the computer uses for out-of-band
communication. Windows uses these same settings for EMS console redirection.
On computers with BIOS firmware and an ACPI Serial Port Console Redirection (SPCR) table, Windows can find the out-of-band settings established in the BIOS by reading
entries in the SPCR table. On these systems, you can use the BIOS parameter to direct Windows to look in the SPCR table for the port settings, or you can use the
emsport:port and emsbaudrate:baudrate parameters to override the settings in the SPCR table.
On computers that have BIOS firmware, but do not have an SPCR table, use BCDEdit and the /emssettings command with the emsport:port parameter to specify the port
and with the emsbaudrate:baudrate parameter to specify the transmission rate.
On all systems, use the BCDEdit /ems command and specify the boot entry to enable EMS console redirection on the operating system that the boot entry loads.
The boot parameters described in this section enable EMS console redirection after Windows is installed. For information about enabling EMS during a new installation or
upgrade of Windows, search for "Enabling Emergency Management Services" on the Microsoft TechNet Web site.
For a detailed example, see Boot Parameters to Enable EMS Redirection.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 46 of 1651
BCDEdit /set
The /set command sets a boot entry option value in the boot configuration data store. Use this command to configure specific boot entry elements, such as kernel debugger
settings, data execution protection (DEP) and processor address extension (PAE) options, and to load alternate hardware abstraction layer (HAL) and kernel files.
bcdedit
Parameters
[{ID}]
The {ID} is the GUID that is associated with the boot entry. If you do not specify an {ID}, the command modifies the current operating system boot entry. If a boot entry
is specified, the GUID associated with the boot entry must be enclosed in braces { }. To view the GUID identifiers for all of the active boot entries, use the
bcdedit /enum command.
Possible values of datatype value
bootlog [ yes | no]
Enables the system initialization log. This log is stored in the Ntbtlog.txt file in the %WINDIR% directory. It includes a list of loaded and unloaded drivers in text format.
groupsize maxsize
Sets the maximum number of logical processors in a single processor group, where maxsize is any power of 2 between 1 and 64 inclusive. By default, processor groups
have a maximum size of 64 logical processors. You can use this boot configuration setting to override the size and makeup of a computers processor groups for testing
purposes. Processor groups provide support for computers with greater than 64 logical processors. This boot option is available on 64-bit versions of Windows 7 and
Windows Server 2008 R2 and later versions. This boot option has no effect on the 32-bit versions of Windows 7.
Use the groupsize option if you want to force multiple groups and the computer has 64 or fewer active logical processors. For more information about using this option,
see Boot Parameters to Test Drivers for Multiple Processor Group Support.
groupaware [ on | off ]
Forces drivers to be aware of multiple groups in a multiple processor group environment. Use this option to help expose cross-group incompatibilities in drivers and
components. Processor groups provide support for computers with greater than 64 logical processors. This boot option is available on 64-bit versions of Windows 7
and Windows Server 2008 R2 and later versions. This boot option has no effect on the 32-bit versions of Windows 7. You can use the groupaware option and the
groupsize option to test driver compatibility to function with multiple groups when computer has 64 or fewer active logical processors.
The groupaware on setting ensures that processes are started in a group other than group 0. This increases the chances of cross-group interaction between drivers and
components. The option also modifies the behavior of the legacy functions, KeSetTargetProcessorDpc, KeSetSystemAffinityThreadEx, and
KeRevertToUserAffinityThreadEx, so that they always operate on the highest numbered group that contains active logical processors. Drivers that call any of these
legacy functions should be changed to call their group-aware counterparts (KeSetTargetProcessorDpcEx, KeSetSystemGroupAffinityThread, and
KeRevertToUserGroupAffinityThread).
For more information about using this option, see Boot Parameters to Test Drivers for Multiple Processor Group Support.
hal file
Directs the operating system loader to load an alternate HAL file. The specified file must be located in the %SystemRoot%\system32 directory, and its file name must
conform to 8.3character format.
increaseuserva Megabytes
Specifies the amount of memory, in megabytes, for user-mode virtual address space. This variable can have any value between 2048 (2 GB) and 3072 (3 GB) megabytes
in decimal notation. Windows uses the remaining address space (4 GB minus the specified amount) as its kernel-mode address space.
kernel file
Directs the operating system loader to load an alternate kernel. The specified file must be located in the %SystemRoot%\system32 directory, and its file name must
conform to 8.3character format.
loadoptions busparams=Bus.Device.Function
Specifies the target controller when multiple controllers exist. This syntax is appropriate when using either a 1394 cable or a USB 2.0 debug cable for debugging. Bus
specifies the bus number, Device specifies the device number, and Function specifies the function number.
Note For 1394 debugging, the bus parameters must be specified in decimal, regardless of which version of Windows is being configured. The format of the bus
parameters used for USB 2.0 debugging depends on the Windows version. In Windows Vista and Windows Server 2008, the USB 2.0 bus parameters must be specified
in hexadecimal. In Windows 7 and later versions of Windows, the USB 2.0 bus parameters must be specified in decimal.
maxgroup [ on | off ]
Maximizes the number of groups created in a processor group configuration.
The maxgroup on setting assigns NUMA nodes to groups in a manner that maximizes the number of groups for a particular computer. The number of groups created is
either the number of NUMA nodes the computer has, or the maximum number of groups supported by this version of Windows, whichever is smaller. The default
behavior (maxgroup off) is to pack the NUMA nodes tightly into as few groups as possible.
Use this option if you want to use multiple groups, the computer has 64 or fewer active logical processors, and the computer already has multiple NUMA nodes. This
option can also be used to alter the default group configuration of a computer that has more than 64 logical processors.
Processor groups provide support for computers with greater than 64 logical processors. This option is available on 64-bit versions of Windows 7 and Windows Server
2008 R2 and later versions. This boot option has no effect on the 32-bit versions of Windows 7.
For more information about using this option, see Boot Parameters to Test Drivers for Multiple Processor Group Support.
nolowmem [ on | off ]
Controls the use of low memory. When nolowmem on is specified, this option loads the operating system, device drivers, and all applications into addresses above the 4
GB boundary, and directs Windows to allocate all memory pools at addresses above the 4 GB boundary.
nx [Optin |OptOut | AlwaysOn |AlwaysOff]
Enables, disables, and configures Data Execution Prevention (DEP), a set of hardware and software technologies designed to prevent harmful code from running in
protected memory locations. For information about how to use the Control Panel to change the DEP settings, see the Change Data Execution Prevention settings page
on the Windows Help and How-to Web site.
Optin
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 47 of 1651
Enables DEP only for operating system components, including the Windows kernel and drivers. Administrators can enable DEP on selected executable files by using
the Application Compatibility Toolkit (ACT).
Optout
Enables DEP for the operating system and all processes, including the Windows kernel and drivers. However, administrators can disable DEP on selected executable
files by using System in Control Panel.
AlwaysOn
Enables DEP for the operating system and all processes, including the Windows kernel and drivers. All attempts to disable DEP are ignored.
AlwaysOff
Disables DEP. Attempts to enable DEP selectively are ignored.
On Windows Vista, this parameter also disables Physical Address Extension (PAE). This parameter does not disable PAE on Windows Server 2008.
onecpu [ on | off ]
Forces only the boot CPU to be used in a computer that has more than one logical processor.
For example, the following command configures the current operating system loader to use one processor.
bcdedit /set onecpu on
pae [ Default | ForceEnable | ForceDisable ]
Enables or disables Physical Address Extension (PAE). When PAE is enabled, the system loads the PAE version of the Windows kernel.
The pae parameter is valid only on boot entries for 32-bit versions of Windows that run on computers with x86-based and x64-based processors. On 32-bit versions of
Windows, PAE is disabled by default. However, Windows automatically enables PAE when the computer is configured for hot-add memory devices in memory ranges
beyond the 4 GB region, as defined by the Static Resource Affinity Table (SRAT). Hot-add memory supports memory devices that you can add without rebooting or
turning off the computer. In this case, because PAE must be enabled when the system starts, it is enabled automatically so that the system can immediately address
extended memory that is added between restarts. Hot-add memory is supported only on Windows Server 2003, Datacenter Edition; Windows Server 2003, Enterprise
Edition; Windows Server 2008, Datacenter Edition; Windows Server 2008, Enterprise IA64 Edition; and on the datacenter and enterprise editions of all later versions of
Windows Server. Moreover, for versions of Windows prior to Windows Server 2008, hot-add memory is supported only on computers with an ACPI BIOS, an x86
processor, and specialized hardware. For Windows Server 2008 and later versions of Windows Server, it is supported for all processor architectures.
On a computer that supports hardware-enabled Data Execution Prevention (DEP) and is running a 32-bit version of the Windows operating system that supports DEP,
PAE is automatically enabled when DEP is enabled and, on all 32-bit versions of the Windows operating system, except Windows Server 2003 with SP1, PAE is
disabled when you disable DEP. To enable PAE when DEP is disabled, you must enable PAE explicitly, by using /set nx AlwaysOff and /set pae ForceEnable. For
more information about DEP, see Boot Parameters to Configure DEP and PAE.
PAE is required to support Cache Coherent Non-Uniform Memory Architecture (known as ccNUMA or NUMA) on computers with x86 processors, although Windows
can run in non-NUMA mode on NUMA-capable computers without PAE. Even when it is required, PAE is not enabled automatically. NUMA is supported in all editions
of Windows XP and Windows Vista, and in the Enterprise and Datacenter editions of Windows Server 2003.
For more information about using the pae parameter and the other parameters that affect PAE configuration, see Boot Parameters to Configure DEP and PAE.
If you are running a 32-bit version of Windows Vista on a computer that has 4 GB of memory installed, the amount of RAM available for use could be less than what you
would expect. For more information about memory usage, see article Q929605, "The system memory that is reported in the System Information dialog box in
Windows Vista is less than you expect if 4 GB of RAM is installed" in the Microsoft Knowledge Base.
quietboot [ on | off ]
Controls the display of a high-resolution bitmap in place of the Windows boot screen display and animation. In operating systems prior to Windows Vista,
the /noguiboot serves a similar function.
removememory Megabytes
Removes memory from the total available memory that the operating system can use.
For example, the following command removes 256 MB of memory from the total available to the operating system associated with the specified boot entry.
bcdedit /set {49916baf-0e08-11db-9af4-000bdbd316a0} removememory 256
sos [ on | off ]
Controls the display of the names of the drivers as they load during the boot process. Use sos on to display the names. Use sos off to suppress the display.
testsigning [ on | off ]
Controls whether Windows 7, Windows Server 2008, or Windows Vista will load any type of test-signed kernel-mode code. This option is not set by default, which
means test-signed kernel-mode drivers on 64-bit versions of Windows 7, Windows Server 2008, and Windows Vista will not load by default. After you run the BCDedit
command, restart the computer so that the change takes effect. For more information, see Introduction to Test-Signing in the Windows Driver Kit (WDK)
documentation.
truncatememory address
Limits the amount of physical memory available to Windows. When you use this option, Windows ignores all memory at or above the specified physical address. Specify
the address in bytes.
For example, the following command sets the physical address limit at 1 GB. You can specify the address in decimal (1073741824) or hexadecimal (0x40000000).
bcdedit /set {49916baf-0e08-11db-9af4-000bdbd316a0} truncatememory 0x40000000
usefirmwarepcisettings [ yes | no ]
Enables or disables the use of BIOS-configured peripheral component interconnect (PCI) resources.
vga [ on | off ]
Forces the use of the VGA display driver.
Comment
For more information about specific BCD elements and boot options, you can use the commands BCDEdit /? OSLOADER and BCDEdit /? TYPES OSLOADER.
To view the current boot entries and their settings, use the bcdedit /enum command. This command displays the active boot entries and their associated globally unique
identifiers (GUID). Use the identifiers with the /set command to configure options for a specific boot entry.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 48 of 1651
To delete a boot option value that you have set, use the /deletevalue option. The syntax for the command is as follows:
bcdedit [{ID}] /deletevalue datatatype
For example, if you change the processor group option, groupsize, to a new value for testing purposes, you can revert to the default value of 64 by typing the following
command and then restarting the computer.
bcdedit /deletevalue groupsize
Any change to a boot option requires a restart to take effect. For information about commonly used BCDEdit commands, see
Asked Questions.
Boot Parameters for Local Debugging in Operating Systems Prior to Windows Vista
To enable kernel debugging on a single computer, add the /debug parameter to a boot entry. Do not add any other debugging-related parameters to a boot entry.
The first boot entry in the following sample Boot.ini file includes the /debug parameter.
[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Local Debugging" /fastdetect /debug
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect
The following Bootcfg command enables local debugging. The Bootcfg /debug switch, with a value of ON, adds the /debug parameter to a boot entry. The /ID switch
identifies the boot entry.
bootcfg /debug ON /ID 1
The following sample Bootcfg display of a system with a Boot.ini file shows the result. The first boot entry is configured for local debugging.
Boot Entries
------------
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 49 of 1651
1
Windows XP Local Debugging
multi(0)disk(0)rdisk(0)partition(2)\WINDOWS
/fastdetect /debug
2
Microsoft Windows XP
multi(0)disk(0)rdisk(0)partition(2)\WINDOWS
/fastdetect
{18b123cd-2bf6-11db-bfae-00e018e2b8db} on
You can use the bcdedit /enum command to view the current boot entries, their settings, and to identify the GUID associated with each entry.
For more details, see BCDEdit /debug.
Boot Parameters to Debug with a Null-modem Cable in Operating Systems prior to Windows Vista
To enable debugging with a null-modem cable, add the /debug parameter with the /debugport and /baudrate subparameters to a boot entry.
The first boot entry in the following sample Boot.ini file is configured for debugging with a null modem cable.
[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Debugging with Cable" /fastdetect /debug /debugport=COM1 /baudrate=57600
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect
Set the value of the /debugport subparameter to a COM port on the computer. Set the value of the /baudrate subparameter to the connection speed of the cable. (19200 bits
per second is the default.)
The following Bootcfg command enables debugging on the first boot entry. It sets the debugging port to COM1, and it sets the baud rate to 57,600 BPS.
The Bootcfg /debug switch with a value of ON adds the /debug parameter to the boot entry. The Bootcfg /port switch adds the /debugport subparameter with a value of
COM1. The Bootcfg /baud switch adds the /baudrate subparameter with a value of 57600. The /ID switch identifies the boot entry.
bootcfg /debug ON /port COM1 /baud 57600 /ID 1
The following Bootcfg sample shows the resulting boot entry on an Itanium-based system. The newly added parameters are displayed in bold type.
Boot Entries
-----------Boot entry ID:
OS Friendly Name:
OsLoadOptions:
BootFilePath:
OsFilePath:
1
Windows Server 2003, Enterprise
/debug /debugport=COM1 /baudrate=57600
\Device\HarddiskVolume1\EFI\Microsoft\WINNT50\ia64ldr.efi
\Device\HarddiskVolume3\WINDOWS
Boot Options to Debug with a Null-modem Cable in Windows Vista and Later
To enable debugging with a null-modem cable in Windows Vista and later, use BCDEdit and set the debugging connection type to "SERIAL". You can set this globally by
using the BCDEdit /dbgsettings command followed by serial, or set it for a specific boot entry by using the BCDEdit /set command followed by debugtype serial. You
must also use the BCDEdit /debug command to enable kernel debugging globally or for the desired operating system.
If BCDEdit has not been used, the default global debug settings are for serial communications, using COM1 and a baud rate of 115,200.
To display the current settings, use the following command:
bcdedit /dbgsettings
debugtype
debugport
Serial
1
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
baudrate
Page 50 of 1651
115200
To use BCDEdit, open a Command Prompt window with elevated privileges (right click Command Prompt and click Run as administrator from the shortcut menu).
To set the global debug settings to serial communications, use the following syntax:
bcdedit /dbgsettings serial [DEBUGPORT:port] [BAUDRATE:baud]
The following example shows how to specify serial communications as the global debug setting.
bcdedit /dbgsettings serial debugport:1 baudrate:115200
To set the debug settings to serial for a specific boot entry, or for the current entry, use the following syntax:
bcdedit /set [{ID}] [ debugtype serial | [DEBUGPORT port] | [BAUDRATE baud] ]
If no {ID} is specified, the settings apply to the currently active boot entry.
The following example shows how to specify the serial debug settings for a specific boot entry.
bcdedit /set {18b123cd-2bf6-11db-bfae-00e018e2b8db} debugtype serial
bcdedit /set {18b123cd-2bf6-11db-bfae-00e018e2b8db} debugport 1
bcdedit /set {18b123cd-2bf6-11db-bfae-00e018e2b8db} baudrate 115200
You can use the bcdedit /enum command to view the current boot entries and their settings.
For more details, see BCDEdit /debug and BCDEdit /dbgsettings.
Boot Parameters to Debug with a 1394 Cable in Operating Systems prior to Windows Vista
If your host computer and target computer are both running Windows XP or later, you can perform kernel debugging with an IEEE 1394 (FireWire) cable.
To enable debugging with an IEEE 1394 cable, add the /debug parameter with the /debugport and /channel subparameters to a boot entry. Set the value of the /debugport
subparameter to 1394. Set the value of the /channel subparameter to the cable channel.
The first boot entry in the following sample Boot.ini file is configured for debugging with a 1394 cable.
[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Debugging with 1394" /fastdetect /debug /debugport=1394 /channel=44
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect
The following Bootcfg command enables debugging with a 1394 cable and sets the debugging channel to 44. The /dbg1394 switch with a value of ON adds the /debug
parameter and /debugport=1394 subparameter to the boot entry, and the /ch switch adds the /channel subparameter to the boot entry. The /id switch identifies the second
boot entry.
bootcfg /dbg1394 ON /ch 44 /id 2
The following Bootcfg displays shows the result of the command on a system with a Boot.ini file. The newly added parameters are displayed in bold type. The computer now
has boot options for both a nondebug startup of Windows XP and a startup that enables debugging with a 1394 cable. The nondebugging startup is the default.
Boot Entries
-----------Boot entry ID:
Friendly Name:
Path:
OS Load Options:
1
"Microsoft Windows XP Professional"
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
/fastdetect
2
"1394 Debug Windows XP"
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
/fastdetect /debug /debugport=1394 /channel=44
Note Before performing kernel debugging over a 1394 cable, you must properly configure the software on both the target and the host. See Disabling the 1394 Host
Controller and Installing the 1394 Virtual Driver for details.
Boot Parameters to Debug with a 1394 Cable in Windows Vista and Later
To enable debugging with an IEEE 1394 cable in Windows Vista and later, use BCDEdit and set the debugging connection type to "1394". You can set this globally by using
the BCDEdit /dbgsettings command followed by 1394, or set it for a specific boot entry by using the BCDEdit /set command followed by debugtype 1394. You must also
use the BCDEdit /debug command to enable kernel debugging globally or for the desired operating system.
To use BCDEdit, open a Command Prompt window with elevated privileges (right click Command Prompt and click Run as administrator from the shortcut menu).
To set the debug settings for 1394 globally, use the following syntax:
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 51 of 1651
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 52 of 1651
1
"Microsoft Windows XP Professional"
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
/fastdetect /burnmemory=896
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 53 of 1651
Boot parameters to debug in a low-memory environment in operating systems prior to Windows Vista
To simulate a low-memory environment on Windows 2000, add the /maxmem parameter to a boot entry. Set its value to the desired memory size for the test.
The first boot entry in the following sample Boot.ini file includes the /maxmem parameter.
[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Low Memory" /fastdetect /maxmem=128
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect
In this example, the /maxmem parameter is used to limit Windows to 128 MB of memory and the computer is configured for debugging with a debug (null modem) cable.
This configuration requires two Bootcfg commands.
The first Bootcfg command uses the Bootcfg /addsw (add switch) switch with the /MM argument and a value of 128 to add the /maxmem parameter and to set it to a value of
128 (MB). The /ID switch identifies the boot entry.
bootcfg /addsw /MM 128 /ID 1
The second Bootcfg command uses the Bootcfg /debug switch with a value of ON to add the /debug parameter to the boot entry. It uses the /port switch with a value of
COM1 to add the /debugport parameter and to set it to COM1, and it uses the /baud switch with a value of 19200 to add the /baudrate parameter and set it to 19,200 BPS.
The /ID parameter identifies the boot entry.
bootcfg /debug ON /port COM1 /baud 19200 /ID 1
The following Bootcfg sample shows the resulting boot entry. The newly added parameters are displayed in bold type.
Boot Entries
-----------Boot entry ID:
Friendly Name:
Path:
OS Load Options:
1
"Windows XP 128MB Debug"
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
/fastdetect /maxmem=128 /debug /debugport=COM1 /baudrate=19200
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 54 of 1651
Boot Entries
-----------Boot entry ID: 1
OS Friendly Name: Windows Server 2003, Enterprise
OsLoadOptions: /fastdetect /kernel=ntoskrnl.chk /hal=halacpi.chk
BootFilePath: Device\HarddiskVolume1\EFI\Microsoft\WINNT50\ia64ldr.efi
OsFilePath: \Device\HarddiskVolume3\WINDOWS
Configuring a Partial Checked Build in Windows Vista and Later
To configure a partial checked build on Windows Vista and later, use the BCDedit /set command and the kernel and hal options.
The following commands configure a boot entry to use the checked versions of the kernel and hardware abstraction layer (HAL).
bcdedit /set {18b123cd-2bf6-11db-bfae-00e018e2b8db} kernel ntoskrnl.chk
bcdedit /set {18b123cd-2bf6-11db-bfae-00e018e2b8db} hal halacpi.chk
To view the results of the commands, type bcdedit /enum. The /enum option lists all of the boot entries. The boot entry that has been modified to use the checked versions of
the kernel and HAL has also been configured for kernel debugging over a serial connection.
Windows Boot Loader
------------------identifier
device
path
description
locale
inherit
debugtype
debugport
baudrate
osdevice
systemroot
kernel
hal
resumeobject
nx
debug
{18b123cd-2bf6-11db-bfae-00e018e2b8db}
partition=C:
\Windows\system32\winload.exe
PartialCheckedBuild
en-US
{bootloadersettings}
serial
1
115200
partition=C:
\Windows
ntoskrnl.chk
halacpi.chk
{d7094401-2641-11db-baba-00e018e2b8db}
OptIn
Yes
Notes This topic explains how to enable EMS on computers running Windows Server 2003. The boot parameters described in this section are not supported on Windows
Vista or later versions of Windows.
When a boot entry is configured for EMS on a computer with BIOS firmware, the boot loader appends a bracketed phrase, [ems enabled], to the friendly name that appears on
the boot menu. However, the boot loader omits the bracketed phrase from the boot menu when the friendly name and the bracketed phrase together exceed 70 characters. To
restore the bracketed phrase, shorten the friendly name.
To determine whether a computer has ACPI firmware, use Device Manager (devmgmt.msc). In Device Manager, expand the Computer node. On computers with ACPI
firmware, the name of node under Computer includes the word, ACPI.
Enabling EMS on a computer without an ACPI SPCR table in operating systems prior to Windows Server 2008
To enable EMS console redirection on a computer that has BIOS firmware, but does not have an ACPI Serial Port Console Redirection (SPCR) table, add the
redirect=COMx and the redirectbaudrate= parameters to the [boot loader] section of the Boot.ini file. These parameters set the port and transmission rate for EMS console
redirection. Use the same port and transmission rate that are established for out-of-band communication in the BIOS. Then, add the /redirect parameter to a boot entry.
The following Bootcfg command enables EMS console redirection on the first boot entry in the list. It sets the port for COM2 and sets the transmission rate to 115,200
kilobits per second (Kbps). These are the same port and baud rate settings that the administrator set in the BIOS for the out-of-band port.
bootcfg /ems ON /port COM2 /baud 115200 /id 1
The following Bootcfg display shows the result of the command. The newly added parameters are displayed in bold type.
Boot Loader Settings
--------------------
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
timeout:
default:
redirect:
redirectbaudrate:
Boot Entries
-----------Boot entry ID:
Friendly Name:
Path:
OS Load Options:
Page 55 of 1651
3
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
COM2
115200
1
"Windows Server 2003, Standard with EMS"
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
/fastdetect /redirect
The following sample shows the result of the same command on a sample Boot.ini file.
[boot loader]
timeout=1
default=multi(0)disk(0)rdisk(0)partition(2)\WINDOWS
redirect=COM2
redirectbaudrate=115200
[operating systems]
multi(0)disk(0)rdisk(0)partition(2)\WINDOWS="EMS boot" /fastdetect /redirect
multi(0)disk(0)rdisk(0)partition(2)\WINDOWS="Windows Server 2003, Standard" /fastdetect
Enabling EMS on a Computer without an ACPI SPCR Table in Windows Server 2008
To enable EMS console redirection on a computer that has BIOS firmware, but does not have an ACPI Serial Port Console Redirection (SPCR) table, use the
BCDEdit /emssettings command to set the COM port and baud rate.
These parameters set the global port and transmission rate for EMS console redirection. Use the same port and transmission rate that are established for out-of-band
communication in the BIOS.
Then, use the BCDEdit /ems command to enable EMS for a boot entry.
The following commands set the global EMS redirection settings to use COM2 and a baud rate of 115200, and enable EMS for the specified boot entry.
bcdedit /emssettings EMSPORT:2 EMSBAUDRATE:115200
bcdedit /ems {18b123cd-2bf6-11db-bfae-00e018e2b8db} on
Enabling EMS on a computer with an SPCR table in operating systems prior to Windows Server 2008
To enable EMS on a computer with ACPI BIOS firmware and an ACPI SPCR table, you can either use the redirect=USEBIOSSETTINGS parameter or the
redirect=COMx and redirectbaudrate= parameters. Then, you can add the /redirect parameter to a boot entry.
The following example demonstrates use of the redirect=USEBIOSSETTINGS parameter. The following Bootcfg command enables EMS console redirection on the first
boot entry in the list.
bootcfg /ems ON /port BIOSSET /id 1
The following Bootcfg display shows the result of the command. The newly added parameters are displayed in bold type.
Boot Loader Settings
-------------------timeout: 1
default: multi(0)disk(0)rdisk(0)partition(2)\WINDOWS
redirect:USEBIOSSETTINGS
Boot Entries
-----------Boot entry ID:
OS Friendly Name:
Path:
OS Load Options:
1
EMS boot
multi(0)disk(0)rdisk(0)partition(2)\WINDOWS
/fastdetect /redirect
2
Windows Server 2003, Standard
multi(0)disk(0)rdisk(0)partition(2)\WINDOWS
/fastdetect
The following sample shows the result of the same command on a sample Boot.ini file.
[boot loader]
timeout=1
default=multi(0)disk(0)rdisk(0)partition(2)\WINDOWS
redirect=USEBIOSSETTINGS
[operating systems]
multi(0)disk(0)rdisk(0)partition(2)\WINDOWS="EMS boot" /fastdetect /redirect
multi(0)disk(0)rdisk(0)partition(2)\WINDOWS="Windows Server 2003, Standard" /fastdetect
Enabling EMS on a Computer with an SPCR Table in Windows Server 2008
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 56 of 1651
To enable EMS on a computer with ACPI BIOS firmware and an ACPI SPCR table, you can use the BCDEdit /emssettings and specify either the BIOS parameter or the
emsport and emsbaudrate parameters. To enable EMS for a boot entry, use the BCDEdit /ems command.
The following example demonstrates how to use the BIOS parameter. The following BCDEdit command enables EMS console redirection on the current boot entry.
bcdedit /emssettings bios
bcdedit /ems on
Enabling EMS on a computer with EFI firmware in operating systems prior to Windows Server 2008
To enable EMS on a computer with EFI firmware, use Bootcfg to add the /redirect parameter to a boot entry. Windows finds the out-of-band port and its settings in the
firmware by reading the SPCR table and uses the same port and rate for EMS console redirection.
The following Bootcfg command enables EMS redirection on an Itanium-based computer. It uses the Bootcfg /ems switch with the ON argument to add the /redirect
parameter to the boot entry. The /id switch identifies the boot entry.
bootcfg /ems ON /id 1
The following Bootcfg display of boot options in EFI NVRAM shows the result of the Bootcfg command. The first boot entry is configured to load the operating system with
EMS console redirection enabled.
Boot Options
-----------Timeout:
Default:
CurrentBootEntryID:
Boot Entries
-----------Boot entry ID:
OS Friendly Name:
OsLoadOptions:
BootFilePath:
OsFilePath:
30
\Device\HarddiskVolume3\WINDOWS
1
1
Windows Server 2003, Enterprise with EMS
/fastdetect /redirect
\Device\HarddiskVolume1\EFI\Microsoft\WINNT50\ia64ldr.efi
\Device\HarddiskVolume3\WINDOWS
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 57 of 1651
For example, the following command enables EMS on a specific boot entry that has an identifier of {173075c9-2cb2-11dc-b426-001558c41f5c}..
bcdedit /ems {173075c9-2cb2-11dc-b426-001558c41f5c} on
To disable EMS on the current boot entry, use the following command.
bcdedit /ems off
Note Each boot entry uses a GUID as an identifier. If you do not specify an identifier, the BCDEdit command modifies the current operating system boot entry. If a boot
entry is specified, the GUID associated with the boot entry must be enclosed in braces { }. To view the GUID identifiers for all the active boot entries, use the bcdedit /enum
command.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
On Windows Vista and later, DEP and PAE are enabled at boot time and are configured by setting values for the nx and pae parameters using the BCDEdit /set command.
These boot parameters have conflicting effects. To configure DEP and PAE, use only the parameter combinations that are described in the documentation for each parameter
and discussed in this topic. Do not experiment with conflicting parameters, especially on a production system.
The Interaction of DEP and PAE Boot Parameters
There are two types of DEP:
Hardware-enforced DEP enables DEP for both kernel-mode and user-mode processes. It must be supported by the processor and the operating system.
Software-enforced DEP enables DEP only on user-mode processes. It must be supported by the operating system.
DEP is supported by Windows XP with SP2, Windows Server 2003 with SP1, Windows Vista, and later versions of Windows.
On 32-bit versions of Windows, hardware-enforced DEP requires PAE, which is supported by all Windows operating systems that support DEP. When DEP is enabled on a
computer with a processor that supports hardware-enforced DEP, Windows automatically enables PAE and ignores the boot parameter values that disable it.
The parameter combinations for each Windows operating system are summarized in the following section.
DEP and PAE Parameter Combinations
The following list describes the boot parameter combinations that can be used to configure DEP and PAE.
Note In the examples for Windows Vista and later, the optional {ID} is the GUID for the specific Windows boot loader boot entry that you want to configure. If you do not
specify an {ID}, the command modifies the current operating system boot entry. For more information, see the BCDEdit /set command .
Action
To enable DEP
(Select one parameter combination)
When DEP is enabled on computers that support hardware-enforced DEP, these parameter
combinations also enable PAE.
To enable DEP and PAE on systems with software-enforced DEP
/noexecute=alwayson /pae
/noexecute=optin /pae
/noexecute=optout /pae
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 58 of 1651
On computers that support hardware-enforced DEP, PAE is automatically enabled when you enable
DEP.
/set [{ID}] nx OptIn
/set [{ID}] pae default
/noexecute=alwaysoff /pae
/noexecute=alwayoff
/noexecute=alwaysoff /pae
/noexecute=alwaysoff
/noexecute=alwaysoff /nopae
(Windows XP with SP2)
/execute
(Windows Server 2003 with SP1 only)
Supporting System that Have More than 64 Logical Processors: Guideline for
To help identify potential processor group-related problems in drivers and components, you can use the BCDEdit /set options. The two BCD boot configuration settings,
groupsize and maxgroup, can configure any computer that has multiple logical processors to support multiple processor groups. The groupaware option modifies the
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 59 of 1651
behavior of certain DDIs and manipulates the group environment for testing purposes.
Create Multiple Processor Groups by Changing the Group Size
The groupsize option specifies the maximum number of logical processors in a group. By default, the groupsize option is not set, and any computer with 64 or fewer logical
processors has one group, which is group 0.
Note A physical processor, or processor package, can have one or more cores, or processor units, each of which can contain one or more logical processors. The operating
system considers a logical processor as one logical computing engine.
To create multiple processor groups, run BCDEdit /set in an elevated Command Prompt window and specify a new maxsize value for groupsize that is less than the total
number of logical processors. Note that the group size setting is for testing and you should not configure shipping systems with this setting. The command uses the following
syntax:
bcdedit.exe /set groupsize maxsize
For example, the following command sets the maximum number of processors in a group to 2.
bcdedit.exe /set groupsize 2
If a non-NUMA computer has 8 logical processors, setting the groupsize to 2 creates 4 processor groups with 2 logical processors each.
Group 0: 1 NUMA node containing 1 package of 2 logical processors
Group 1: 1 NUMA node containing 1 package of 2 logical processors
Group 2: 1 NUMA node containing 1 package of 2 logical processors
Group 3: 1 NUMA node containing 1 package of 2 logical processors
By design, a non-NUMA computer is considered to have one NUMA node. Because NUMA nodes cannot span groups, the system creates a node for each group after you
restart the computer.
If groupsize is set to a value less than the number of logical processors in a physical processor package (socket), the system redefines its concept of a package upon restart
such that the package does not span a group. This means that more packages than that are actually present are reported by processor topology APIs. This also means that the
Windows (package-level) processor licensing limits might prevent some processor packages from starting when groupsize is set.
A processor package can span groups if it has multiple NUMA nodes defined within it and the system assigns these nodes to different groups.
Windows limits the number of groups supported. This number could change with new versions of Windows or in service pack releases. Drivers or components should not
depend on the number of groups Windows supports as being constant. The limit on the number of groups could restrict the number of logical processors allowed to start when
small values are used for the groupsize boot option.
To remove the groupsize setting you used for testing and return to the default setting of 64 logical processors per group, use the following BCDEdit command.
bcdedit.exe /deletevalue groupsize
This command is the equivalent of setting groupsize to 64.
Maximize the Number of Processor Groups
The maxgroup option is another way to create processor groups on a computer with multiple logical processors and NUMA nodes. The maxgroup boot option has no effect
on non-NUMA computers.
To maximize the number of groups, run the BCDEdit /set command in an elevated Command Prompt window. The command uses the following syntax:
bcdedit.exe /set maxgroup on
For example, consider a computer that has 2 NUMA nodes, 1 processor package per node, and 4 processor cores per package, for a total of 8 logical processors.
The default group configuration is:
Group 0: 8 logical processors, 2 packages, 2 NUMA nodes
If you enter a bcdedt.exe /set maxgroup on command followed by a restart, the command yields the following group configuration:
Group 0: 4 logical processors, 1 package, 1 NUMA node
Group 1: 4 logical processors, 1 package, 1 NUMA node
Note that NUMA nodes are assigned to groups in a manner that maximizes the number of groups.
To change back to the default the setting, use the following BCDEdit command.
bcdedit.exe /set maxgroup off
Test Multiple-Group Compatibility by Setting the Group Aware Boot Option
Windows 7 and Windows Server 2008 R2 have introduced a new BCD option (groupaware) that forces drivers and components to be aware of multiple groups in a multiple
processor group environment. The groupaware option changes the behavior of a set of device driver functions to help expose cross-group incompatibilities in drivers and
components. You can use the groupaware boot option along with the groupsize and maxgroup options to test driver compatibility with multiple groups when a computer
has 64 or fewer active logical processors.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 60 of 1651
When the groupaware boot option is set, the operating system ensures that processes are started in a group other than group 0. This increases the chances of cross-group
interaction between drivers and components. The option also modifies the behavior of the legacy functions that are not group-aware, KeSetTargetProcessorDpc,
KeSetSystemAffinityThreadEx, and KeRevertToUserAffinityThreadEx, so that they always operate on the highest numbered group that contains active logical
processors. Drivers that call any of these legacy functions should be changed to call their group-aware counterparts (KeSetTargetProcessorDpcEx,
KeSetSystemGroupAffinityThread, and KeRevertToUserGroupAffinityThread),
To test for compatibility, use the following BCDEdit /set command.
bcdedit.exe /set groupaware on
Legacy non-group aware functions Windows 7 group-aware replacement
KeSetTargetProcessorDpc
KeSetTargetProcessorDpcEx
KeSetSystemAffinityThreadEx
KeSetSystemGroupAffinityThread
KeRevertToUserAffinityThreadEx KeRevertToUserGroupAffinityThread
To reset the computer to the default setting, use the following BCDEdit command.
bcdedit.exe /set groupaware off
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 61 of 1651
Note Before performing kernel debugging over a 1394 cable, you must also configure the software on the host computer. For more details, see Installing the 1394 Virtual
Driver.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Using KDbgCtrl
The KDbgCtrl (Kernel Debugging Control, kdbgctrl.exe) tool can be used to control the kernel debugging connection from the target computer.
To use this tool, your target computer must be running Windows Server 2003 or a later version of Windows.
KDbgCtrl can control four different settings: Full Kernel Debugging, Automatic Kernel Debugging, User-Mode Error Handling, and the size of the DbgPrint buffer.
To use KDbgCtrl, you must have already enabled kernel debugging in the boot settings of the target computer before the last boot. KDbgCtrl cannot be used to enable kernel
debugging if this was not done. See Boot Parameters to Enable Debugging for details on these boot settings.
Full Kernel Debugging
When Full Kernel Debugging is enabled, a kernel debugger running on the host computer can break into the target computer. The target computer will break into the kernel
debugger if a kernel-mode exception is hit. Messages from the target to the host, such as DbgPrint output, symbol load messages, and redirected user-mode debuggers, are
also allowed.
If this setting is disabled, all signals from the host computer will be ignored by the target.
Full Kernel Debugging is enabled by default. To check the current setting value, use kdbgctrl -c. To disable this setting, use kdbgctrl -d. To enable this setting, use kdbgctrl
-e.
If you wish to check the current setting and use it to control execution within a batch file, you can use the kdbgctrl -cx command. For details on this command, see KDbgCtrl
Command-Line Options.
Automatic Kernel Debugging
If Full Kernel Debugging is enabled, the current setting for Automatic Kernel Debugging is immaterial all communication is permitted.
When Full Kernel Debugging is disabled and Automatic Kernel Debugging is enabled, only the target computer can initiate a debugging connection.
In this case, only a kernel-mode exception, breakpoint, or other kernel-mode event will cause a connection to be established. The connection will not be established for
DbgPrint output, symbol load messages, redirected user-mode debugger input and output, or other similar messages these will be stored in the DbgPrint buffer instead of
being sent to the kernel debugger.
If an exception or event causes the target to break into the kernel debugger, then Full Kernel Debugging will be automatically turned on, just as if you had executed kdbgctrl e.
Automatic Kernel Debugging is disabled by default (although this is immaterial unless Full Kernel Debugging is disabled as well). To check the current setting value, use
kdbgctrl -ca. To disable this setting, use kdbgctrl -da. To enable this setting, use kdbgctrl -ea.
User-Mode Error Handling
When User-Mode Error Handling is enabled, some user-mode events will cause the target computer to break into the kernel debugger.
Specifically, all int 3 interrupts such as breakpoints inserted into the code by a debugger or calls to DbgBreakPoint will cause a break into the kernel debugger.
However, standard exceptions such as access violations and division by zero will usually not be sent to the kernel debugger.
If a user-mode debugger is already attached to the process, this debugger will capture all user-mode errors, and the kernel debugger will not be alterted. For the precedence
ranking of the various user-mode error handlers, see Enabling Postmortem Debugging.
For User-Mode Error Handling to function, either Full Kernel Debugging or Automatic Kernel Debugging must be enabled as well.
User-Mode Error Handling is enabled by default. To check the current setting value, use kdbgctrl -cu. To disable this setting, use kdbgctrl -du. To enable this setting, use
kdbgctrl -eu.
The DbgPrint Buffer Size
The DbgPrint buffer stores messages that the target computer has sent to the kernel debugger.
If Full Kernel Debugging is enabled, these messages will automatically appear in the kernel debugger. But if this option is disabled, these messages will be stored in the
buffer. At a later point in time, you can enable kernel debugging, connect to a kernel debugger, and use the !dbgprint extension to see the contents of this buffer. For more
information about this buffer, see The DbgPrint Buffer.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 62 of 1651
The default size of the DbgPrint buffer is 4 KB on a free build of Windows, and 32 KB on a checked build of Windows. To determine the current buffer size, use kdbgctrl cdb. To change the buffer size, use kdbgctrl -sdb Size, where Size specifies the new buffer size. For syntax details, see KDbgCtrl Command-Line Options.
Examples
To display all the current settings, use the following command:
kdbgctrl -c -ca -cu -cdb
To restore the default settings, use the following command:
kdbgctrl -e -da -eu -sdb 0x1000
To lock out the host computer so that it only is contacted on exceptions, use the following command:
kdbgctrl -d -ea -eu
To disable all kernel debugging, use the following command:
kdbgctrl -d -da
If you are disabling all kernel debugging, you may also wish to increase the size of the DbgPrint buffer. This insures that all messages will be saved in case you need to see
them later. If you have a megabyte of memory to spare, you might use the following command:
kdbgctrl -sdb 0x1000000
Host computer and target computer connected through the COM ports.
Host computer and target computer connected by a 1394 cable. This is supported only if both the host and the target are running Windows XP or later. Before you can
debug over a 1394 cable, you must properly configure the software on both the target and the host. See Disabling the 1394 Host Controller and Installing the 1394
Virtual Driver for details.
Host computer and target computer connected by a USB 2.0 debug cable. This is supported only if the host computer is running Windows, and the target computer is
running Windows Vista or later. Additional configuration is required; see Setting Up a USB 2.0 Debug Cable Connection for details.
Host computer and target computer communicating through a modem.
Debugger and virtual machine (on the same computer or a different computer) communicating through a named pipe.
Local kernel debugging on a single computer. This is supported only on Windows XP and later.
There are three ways to configure the kernel debugging settings: through environment variables, on the debugger command line, or through the WinDbg graphical interface. If
none of these methods are used, the debugger will default to a COM port connection, using COM1 and 19200 baud.
Environment Variables
If you are configuring a COM port connection with environment variables, the following two variables should be used:
set _NT_DEBUG_PORT = ComPort
set _NT_DEBUG_BAUD_RATE = BaudRate
If you are configuring a 1394 connection with environment variables, the following three variables should be used:
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 63 of 1651
...
...
...
...
...
...
...
-k com:port=ComPort,baud=BaudRate ...
-k 1394:channel=1394Channel[,symlink=1394Protocol] ...
-k usb2:targetname=USBString ...
-k com:pipe,port=\\VMHost\pipe\PipeName[,resets=0][,reconnect] ...
-k com:modem ...
-kl ...
...
...
...
...
...
...
...
-k com:port=ComPort,baud=BaudRate ...
-k 1394:channel=1394Channel[,symlink=1394Protocol] ...
-k usb2:targetname=USBString ...
-k com:pipe,port=\\VMHost\pipe\PipeName[,resets=0][,reconnect] ...
-k com:modem ...
-kl ...
-k ...
The COM tab indicates that the connection will use a COM port. In the Baud Rate box, enter the BaudRate. In the Port box, enter the ComPort.
The 1394 tab indicates that the connection will use 1394. In the Channel box, enter the 1394Channel.
The USB 2.0 tab indicates that the connection will use USB 2.0. In the Target Name box, enter the USBString.
The Local tab indicates that WinDbg will perform local kernel debugging. Local kernel debugging is supported only on Windows XP and later versions of Windows.
This dialog box cannot be used to set up debugging over a modem or a named pipe.
Parameters
The parameters used for these environment variables, command line options, and the WinDbg dialog box have the following possible values:
ComPort
Specifies the name of the COM port. This can be in the format "com2" or in the format "\\.\com2", but should not simply be a number.
BaudRate
Specifies the baud rate. This can be 9600, 19200, 38400, 57600, or 115200.
1394Channel
Specifies the 1394 channel number. Valid channel numbers are any integer between 0 and 62, inclusive. 1394Channel must match the number used by the target
computer, but does not depend on the physical 1394 port chosen on the adapter.
Note 1394 kernel debugging is supported only if both the host and the target are running Windows XP or later. Before you can debug over a 1394 cable, you must
properly configure the software on both the target and the host. See Disabling the 1394 Host Controller and Installing the 1394 Virtual Driver for details.
1394Protocol
Specifies the connection protocol to be used for the 1394 kernel connection. This can almost always be omitted, since the debugger will automatically choose the correct
protocol. If you wish to set this manually, and the target computer is running Windows XP, 1394Protocol should be set equal to "channel". If the target computer is
running Windows Server 2003 or later, 1394Protocol should be set equal to "instance". If it is omitted, the debugger will default to the protocol appropriate for the
current target computer. This can only be specified through the command line or the environment variables, not through the WinDbg graphical interface.
USBString
Specifies a USB 2.0 connection string. This must match the string specified with the /targetname boot option. For information on this boot option prior to Windows
Vista, see /debug. For information on this boot option in Windows Vista and later versions of Windows, see BCDEdit / dbgsettings.
Note USB 2.0 kernel debugging is supported only if the host computer is running Windows, and the target computer is running Windows Vista or later. Additional
configuration is required; see Setting Up a USB 2.0 Debug Cable Connection for details.
VMHost
When debugging a virtual machine, VMHost specifies the name of the physical computer on which the virtual machine is running. The virtual machine documentation
usually refers to this as the virtual machine host. If the virtual machine is running on the same computer as the kernel debugger itself, use a single period (.) for VMHost.
PipeName
Specifies the name of the pipe created by the virtual machine for the debugging connection.
resets=0
Specifies that an unlimited number of reset packets can be sent to the target when the host and target are synchronizing. This parameter is only needed when debugging
certain kinds of virtual machines. See Attaching to a Virtual Machine (Kernel Mode) for details.
reconnect
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 64 of 1651
Causes the debugger to automatically disconnect and reconnect the pipe if a read/write failure occurs. Additionally, if the named pipe is not found when the debugger is
started, the reconnect parameter will cause it to wait for a pipe of this name to appear. This parameter is only needed when debugging certain kinds of virtual machines.
See Attaching to a Virtual Machine (Kernel Mode) for details.
modem
Causes the debugger to connect through a modem.
-kl
Causes the debugger to perform local kernel debugging. Only users that have debug privileges can start this process. For local kernel debugging to work, the x86 boot.ini
file or the Itanium OsLoadOptions settings must include the /debug option. See Performing Local Kernel Debugging for features peculiar to this technique.
For a list of other useful environment variables and command line options, see Environment Variables and Command-Line Options.
Examples
The following batch file could be used to set up a COM connection:
set
set
set
set
kd
_NT_SYMBOL_PATH=d:\mysymbols
_NT_DEBUG_PORT=com1
_NT_DEBUG_BAUD_RATE=19200
_NT_DEBUG_LOG_FILE_OPEN=d:\debuggers\logfile1.log
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 65 of 1651
User-Mode Setup
This section includes:
Configuring Hardware for User-Mode Debugging
Configuring Software for User-Mode Debugging
Enabling Postmortem Debugging
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 66 of 1651
You must install the symbol files for the user-mode process that is being debugged. If this is an application you have written, it should be built with full symbol files. If it is a
commercial application, the symbol files may be on the product disk; if not, contact the manufacturer.
If possible, you should also install the symbol files for the version of Microsoft Windows on which the user-mode process is running.
If you are performing remote debugging, the symbol file location depends on the method you are using:
If you are performing remote debugging through the debugger, the symbol files should be on the computer with the debugging server.
If you are performing remote debugging through remote.exe, the symbol files should be on the computer with the debugger.
If you are performing remote debugging through a process server or a KD connection server, the symbol files should be on computer with the smart client.
If you are controlling the user-mode debugger from the kernel debugger, the symbol files need to be on both computers.
For more information about the proper installation of symbol files, see Symbols.
Configuring Environment Variables
The debugger uses a variety of environment variables to indicate a number of important settings.
For a complete list of environment variables used in user-mode debugging, see General Environment Variables.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Configuring tools.ini
The file tools.ini contains information to initialize the command-line debuggers. On startup, the debugger searches for the appropriate section header in the tools.ini file and
extracts initialization information from the entries under the header. Each command-line debugger has its own section header - [CDB], [NTSD], and [KD]. The environment
variable INIT must point to the directory containing the tools.ini file.
WinDbg does not use the tools.ini file. Instead, WinDbg saves initialization settings in workspaces.
The tools.ini entries are shown in the following table.
Keywords must be separated from the values by white space or a colon. Keywords are not case-sensitive.
For TRUE or FALSE values, "FALSE" is the only false value. Anything else is TRUE.
Entry
$u0: value
...
$u9: value
DebugChildren: flag
DebugOutput: flag
IniFile: file
LazyLoad: flag
Description
Assign values to fixed-name aliases. You can specify numeric values n or 0xn or any other string. See Using Aliases for details. No command-line
equivalent.
TRUE or FALSE. If TRUE, CDB debugs the specified application as well as any child processes that it might spawn. Command-line equivalent is o.
TRUE or FALSE. If TRUE, CDB sends output and receives input through a terminal. If FALSE, output goes to the user screen. The command-line
option -d is similar but not identical.
Specifies the name of the script file that CDB or KD takes commands from at startup. The default is the ntsd.ini file in the current directory.
Command-line equivalent is -cf. For details, see Using Script Files.
TRUE or FALSE. If TRUE, CDB performs lazy symbol loading; that is, symbols are not loaded until required. Command-line equivalent is -s.
For details, and other methods of setting this option, see Deferred Symbol Loading.
SetDll: filename
Set extension DLL. The .dll filename extension should be omitted. Default is userexts.dll. Command-line equivalent is -a.
For details, and other methods of setting this default, see Loading Debugger Extension DLLs.
StopFirst: flag
StopOnProcessExit:
flag
sxd: event
sxe: event
True or false. If true, CDB stops on the breakpoint at the end of the image-loading process. Command-line equivalent is -g.
TRUE or FALSE. If TRUE, CDB stops when it receives a process termination notification. Command-line equivalent is -G.
Sets the debugger response and the handling status for the specified exception or event.
Exceptions and events may be specified in the following ways:
*: Default exception
n: Exception n (decimal)
0xn: Exception 0xn (hexadecimal)
(other): Event code
See Controlling Exceptions and Events for details of this process and for other methods of controlling these settings.
VerboseOutput: flag
TRUE or FALSE. If TRUE, CDB will display detailed information about symbol handling, event notification, and other run-time occurrences.
Command-line equivalent is -v.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 67 of 1651
sxe: 3c
sxe: cc
$u0: VeryLongName
VerboseOutput:true
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 68 of 1651
If Windows does attempt to contact a kernel debugger but there is no debugger running at the other end of the connection, Windows will freeze until kernel debugger is
activated.
In the kernel debugger, you can use gh (Go With Exception Handled) to disregard the error and continue running the target. You can use gn (Go With Exception Not
Handled) to bypass the kernel debugger and go on to step 4.
4. If the conditions in steps 1, 2, and 3 do not apply, Windows will activate a debugging tool. Any program can be selected in advance as the tool to use in this situation.
The chosen program is referred to as the postmortem debugger. This is also known as the just-in-time debugger or the JIT debugger.
If the postmortem debugger is a standard user-mode debugger (such as CDB, WinDbg, or Microsoft Visual Studio), this debugger will start up and break into your
application.
If the postmortem debugger is a tool for writing dump files (such as Dr. Watson), a memory dump file will be created, and then the application will be terminated.
Note If Dr. Watson is activated on Windows XP or a later version of Windows, a message box will appear. This window gives you the option of sending an error report to
Microsoft. If you choose Don't Send, a dump file will created and stored on your hard disk. If you choose Send Error Report, a dump file will be created and stored on your
hard disk, and will also be transmitted to Microsoft over the internet.
If you have not reconfigured Windows' postmortem settings, Dr. Watson is used as the default postmortem debugger. This setting can be changed programmatically or
through the registry; any changes take effect immediately.
To change the postmortem debugger to WinDbg, run windbg -I. (The I must be capitalized.) This command will display a success or failure message after it is used.
When WinDbg is the postmortem debugger, it will be activated whenever an application crashes.
To change the postmortem debugger to CDB, run cdb -iae or cdb -iaec KeyString. When the -iaec parameter is used, KeyString specifies a string to be appended to the
end of command line used to launch the postmortem debugger. If KeyString contains spaces, it must be enclosed in quotation marks. This command will display no
message if it succeeds, but will display a failure message if it fails. When CDB is the postmortem debugger, it will be activated whenever an application crashes.
To change the postmortem debugger to NTSD, run ntsd -iae or ntsd -iaec KeyString. When the -iaec switch is used, KeyString specifies a string to be appended to the
end of command line used to launch the postmortem debugger. If KeyString contains spaces, it must be enclosed in quotation marks. This command will display no
message if it succeeds, but will display a failure message if it fails. When NTSD is the postmortem debugger, it will be activated whenever an application crashes.
To change the postmortem debugger back to Dr. Watson, run drwtsn32 -i. When Dr. Watson is the postmortem debugger, a memory dump file will be written to disk if
an application crashes. See Dr. Watson Command-Line Options for details.
These methods will set the appropriate registry values so that the debugger will be automatically launched whenever an applicaiton crashes. The debugger command line will
include the argument string -p %ld -e %ld -g. The -p %ld parameter specifies the process ID that will be debugged, the -e %ld parameter provides the event that caused the
exception, and the -g parameter causes the debugger to skip the initial breakpoint. If the -iaec switch is used when installing CDB or NTSD as the postmortem debugger, the
additional arguments specified as KeyString will then follow.
Note Because the -p %ld -e %ld -g parameters always appear first on the command line of the postmortem debugger, you should not use the -iaec switch to specify the
-server parameter because -server will not work unless it appears first on the command line. To install a postmortem debugger that includes this parameter, you must edit the
registry manually.
Only a system administrator can alter the postmortem settings.
If a postmortem debugger has been installed, you can deliberately break into the debugger from a user-mode application by calling the DebugBreak function.
Editing the Registry
The postmortem debugging settings are stored in the registry. If you wish to control these settings, it is recommended that you use the WinDbg, CDB, NTSD, or Dr. Watson
commands described above; these will automatically change the relevant registry keys. If you do need to manually edit the registy, do so very carefully, since improper
changes to the registry may render Windows unusable.
On an x86 computer, the postmortem settings are stored in the \\HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\AeDebug key.
On an Intel Itanium computer, there are two registry keys used for postmortem debugging:
1. A failing 64-bit application will be debugged according to the settings stored in the
\\HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\AeDebug key.
2. A failing 32-bit application will be debugged according to the settings stored in the
\\HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\Windows NT\CurrentVersion\AeDebug key. However, if the Debugger value in this key
specifies an application in the %windir%\system32 directory, Windows will look in %windir%\syswow64 instead.
When using an Itanium computer, it is often simplest to place identical values in each of these keys. In particular, if you are using WinDbg, CDB, or NTSD as your
postmortem debugger, the same version will work for 32-bit and 64-bit user-mode applications on an Itanium computer. See Choosing a 32-bit or 64-bit Debugger Package
for details.
There are two registry values that should appear in these keys:
Debugger
This REG_SZ value specifies the debugger that will handle postmortem debugging. The full path to the debugger must be listed, unless the debugger is located in a
directory that is in the default path.
Auto
This REG_SZ value is always either 0 or 1. If Auto is set to 0, a message box will be displayed prior to postmortem debugging.
When an unhandled application error occurs, Windows checks to see if the Debugger and Auto registry values exist.
If the Auto value is 0, a message box will appear.
In Windows 2000, the message box will have one of the following formats:
If the Debugger value contains the name of a valid debugger or Dr. Watson, the message box will have two buttons: OK and Cancel. If the OK button is pressed, the
application will be terminated. If the Cancel button is pressed, the tool specified in the Debugger value will be started.
If the Debugger value is empty, the message box will have only an OK button and no debugger will start.
In Windows XP and later versions of Windows, the message box will have one of the following formats:
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 69 of 1651
If the Debugger value contains the name of a valid debugger or Dr. Watson, the message box will have three buttons: Send Error Report, Don't Send, and Debug. If
the Don't Send button is pressed, the application will be terminated. If the Send Error Report button is pressed, a minidump file will be sent to Microsoft and the
application will be terminated. If the Debug button is pressed, the tool specified in the Debugger value will be started. (Note that all of these buttons have different
effects than the buttons on the message window for Dr. Watson when the Auto value does not equal 0.)
If the Debugger value is empty, the message box will have only the Send Error Report and Don't Send buttons.
If the Auto value equals 1, no message box appears. The debugger referred to in the Debugger value is automatically started.
Registry Examples
The following registry values can be used to set Dr. Watson as the postmortem debugger (this is the default):
Debugger = "drwtsn32 -p %ld -e %ld -g"
Auto = 1
The following values can be used to set WinDbg as the postmortem debugger:
Debugger = "Path\WinDbg -p %ld -e %ld"
Auto = 1
The following values can be used to set CDB as the postmortem debugger:
Debugger = "Path\CDB -p %ld -e %ld -g"
Auto = 1
In these examples, Path is the directory where the debugger is located, -p %ld specifies the process ID that will be debugged, -e %ld provides the event that caused the
exception, and -g causes the debugger to skip the initial breakpoint. (Dr. Watson ignores the -g option.)
Security Vulnerabilities
If you are considering enabling postmortem debugging on a computer that you share with other people, see Security During Postmortem Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 70 of 1651
Windows NT 4.0
Debugging Tools for Windows no longer supports the debugging of Windows NT 4.0 targets.
If you want to debug a Windows NT 4.0 target computer or perform user-mode debugging on Windows NT 4.0, you should use Debugging Tools for Windows version
6.7.5.1. You can install this package from the Debugging Tools for Windows Web site.
When using an older version of Debugging Tools for Windows, refer to the documentation included in that package, not a more recent version of the Debugging Tools for
Windows documentation.
Alpha Host Computer or Target Computer
Debugging Tools for Windows no longer runs on or debugs the Alpha (RISC) processor.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Debugger Operation
This section includes the following topics:
Starting the Debugger
The Debugger Command Window
The WinDbg Graphical Interface
Debugger Configuration
Debugger Operation (General)
Debugger Operation (User Mode)
Debugger Operation (Kernel Mode)
Debugger Extensions
Remote Debugging
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 71 of 1651
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 72 of 1651
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 73 of 1651
If a user-mode application is already running, the debugger can debug it noninvasively. With noninvasive debugging, you do not have as many debugging actions. However,
you can minimize the debugger's interference with the target application.
In noninvasive debugging, the debugger does not actually attach to the target application. The debugger suspends all of the target's threads and has access to the target's
memory, registers, and other such information. However, the debugger cannot control the target, so commands like g (Go) do not work.
If you try to execute commands that are not permitted during noninvasive debugging, you receive an error message that states, "The debugger is not attached, so process
execution cannot be monitored."
When you end the debugging session, the debugger releases the target application, and the application continues running. You should close the session by using q (Quit),
.detach (Detach from Process), or WinDbg's Debug | Detach Debuggee or Debug | Stop Debugging command. (If you close the debugging session by closing the debugger
window or by using the Exit command on the File menu in WinDbg, your target application typically stops responding.)
Noninvasive debugging is useful if you do not want to end the target application at the end of the session, and the target application is running on Microsoft Windows 2000.
(These operating systems do not support detaching from a target that the debugger has actually attached to.) Noninvasive debugging is also useful if the target application has
stopped responding and cannot open the break thread that you need to attach.
Selecting the Process to Debug
You can specify the target application by the process ID (PID) or process name.
If you specify the application by name, you should use the complete name of the process, including the file name extension. If two processes have the same name, you must
use the process ID instead.
For more information about how to determine the process ID and the process name, see Finding the Process ID.
The following sections in this topic describe several ways to begin a noninvasive debugging session, organized by the location from which you are starting the session.
CDB Command Line
To noninvasively debug a running process from the CDB command line, specify the -pv option, the -p option, and the process ID, in the following syntax.
cdb -pv -p ProcessID
Or, to noninvasively debug a running process by specifying the process name, use the following syntax instead.
cdb -pv -pn ProcessName
There are several other useful command-line options. For more information about the command-line syntax, see CDB Command-Line Options.
WinDbg Command Line
To noninvasively debug a running process from the WinDbg command line, specify the -pv option, the -p option, and the process ID, in the following syntax.
windbg -pv -p ProcessID
Or, to noninvasively debug a running process by specifying the process name, use the following syntax instead.
windbg -pv -pn ProcessName
There are several other useful command-line options. For more information about the command-line syntax, see WinDbg Command-Line Options.
WinDbg Menu
When WinDbg is in dormant mode, you can noninvasively debug a running process by clicking Attach to a Process on the File menu or by pressing F6.
When the Attach to Process dialog box appears, select the Noninvasive check box. Then, select the line that contains the process ID and name that you want. (You can also
enter the process ID in the Process ID box.) Finally, click OK.
Debugger Command Window
If the debugger is already active, you can noninvasively debug a running process by using the .attach -v (Attach to Process) command in the Debugger Command window.
You can use the .attach command if the debugger is already debugging one or more processes invasively. You can use this command in CDB if it is dormant, but not in a
dormant WinDbg.
If the .attach -v command is successful, the debugger debugs the specified process the next time that the debugger issues an execution command. Because execution is not
permitted during noninvasive debugging, the debugger cannot noninvasively debug more than one process at a time. This restriction also means that using the .attach -v
command might make an existing invasive debugging session less useful.
Beginning the Debugging Session
For more information about how to begin a debugging session, see Debugger Configuration, Symbols, Debugger Operation (General) and Debugger Operation (User Mode).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 74 of 1651
[-y
[-y
[-y
[-y
[-y
[-y
SymbolPath]
SymbolPath]
SymbolPath]
SymbolPath]
SymbolPath]
SymbolPath]
-k com:port=ComPort,baud=BaudRate
-k 1394:channel=1394Channel[,symlink=1394Protocol]
-k usb2:targetname=String
-k com:modem
-kl
If you do not include the -k command-line option, the connection settings are based on the values of certain environment variables. For more information about the kernel
connection options and the restrictions on their use, see Choosing Kernel Debugging Settings. For more information about other options, see KD Command-Line Options.
You can change the kernel debugging baud rate after the session has begun by using CTRL+A.
WinDbg Command Line
To begin a kernel debugging session from the WinDbg command line, use one of the following commands.
windbg
windbg
windbg
windbg
windbg
windbg
[-y
[-y
[-y
[-y
[-y
[-y
SymbolPath]
SymbolPath]
SymbolPath]
SymbolPath]
SymbolPath]
SymbolPath]
-k com:port=ComPort,baud=BaudRate
-k 1394:channel=1394Channel[,symlink=1394Protocol]
-k usb2:targetname=String
-k com:modem
-kl
-k
If you do not include the -k command-line option, the connection settings are based on the values of certain environment variables. For more information about the kernel
connection options and the restrictions on their use, see Choosing Kernel Debugging Settings. For more information about other options, see WinDbg Command-Line
Options.
You can change the kernel debugging baud rate after the session has begun by clicking the Debug | Kernel Connection | Cycle Baud Rate command or pressing
CTRL+ALT+A.
WinDbg Menu
When WinDbg is in dormant mode, you can begin a kernel debugging session by clicking Kernel Debug on the File menu or by pressing CTRL+K.
When the Kernel Debugging dialog box appears, click the COM tab, the 1394 tab, or the Local tab. Each tab specifies a different connection method. For more information
about the dialog box and its entries, see File | Kernel Debug.
If you leave the boxes in the Kernel Debugging dialog box blank, the connection settings are based on the values of certain environment variables. For more information
about these settings, see Choosing Kernel Debugging Settings.
Beginning the Session
After the debugger on the host side has started and is waiting to connect, start the target computer. If the target computer is debugger-enabled (as described in Boot Parameters
to Enable Debugging), the target computers debugger will connect automatically, early in the startup process.
If the target computer has stopped responding, the target computer is still stopped because of an earlier kernel debugging action, or you used the -b command-line option, the
debugger breaks into the target computer immediately.
Otherwise, the target computer continues running until the debugger orders it to break.
For more information about the next steps, see Debugger Configuration, Symbols, Debugger Operation (General) and Debugger Operation (Kernel Mode).
1394 Configuration
When you first start the kernel debugger after enabling debugging over a 1394 connection, a driver is installed on your host computer. You must be logged on as an
Administrator on the host computer during this debugging session. For more information about this driver, see Installing the 1394 Virtual Driver.
You must also configure the target computer for kernel debugging over a 1394 cable. For more information about this configuration, see Disabling the 1394 Host Controller.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 75 of 1651
For more information about opening and analyzing a kernel-mode crash dump file by using KD, WinDbg, or KAnalyze, see Analyzing a Kernel-Mode Dump File.
For more information about opening and analyzing a user-mode crash dump file with CDB or WinDbg, see Analyzing a User-Mode Dump File.
For more information about how dump files are created, and a description of the different types of dump files, see Crash Dump Files.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 76 of 1651
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 77 of 1651
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 78 of 1651
Starting the Debugging Session describes how to begin a session where the user-mode debugger is controlled from the kernel debugger.
Switching Modes describes the four different modes that are involved, and how to alternate between them.
When to Use This Technique describes scenarios where this technique is particularly useful.
Combining This Method with Remote Debugging describes how to control the user-mode debugger from a kernel debugger, and use it as a debugging server at the
same time. This combination can be useful if your user-mode symbols are located on a symbol server.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 79 of 1651
Switching Modes
When you control user-mode debugging from the kernel debugger, you encounter four different modes, and can switch between them in a variety of ways.
Note In describing this scenario, target application refers to the user-mode application that is being debugged, target computer refers to the computer that contains the target
application and the CDB or NTSD process, and host computer refers to the computer that contains the kernel debugger.
The following four modes will be encountered:
User-mode debugging
The target computer and target application are frozen. The user-mode debugging prompt appears in the Debugger Command window of the kernel debugger. In WinDbg,
the prompt in the lower panel of the WinDbg window displays Input>. You can enter commands at this prompt, as if they are entered during user-mode debugging, to
analyze the target application's state or cause it to run or step through its execution. Symbol files, extension DLLs, and other files that the debugger accesses will be those
files on the target computer, not the host computer.
Target application execution
The target computer is running, the target application is running, and the debugger is waiting. This mode is the same as letting the target run in ordinary debugging.
Sleep mode
The target computer is running, but the target application is frozen, and both debuggers are frozen. This mode is useful if you have to do something on the target
computer but you do not want to change the state of the debugging session.
Kernel-mode debugging
The target computer and the target application are frozen. The kernel-mode debugging prompt kd> appears in the Debugger Command window of the kernel debugger.
This mode is the typical kernel-mode debugging state.
The session begins in user-mode debugging mode. The following actions and events cause the mode to change:
To switch from user-mode debugging to target application execution, use the g (Go) command at the Input> prompt.
To temporarily switch from user-mode debugging to target application execution and then return to user-mode debugging, use a step, trace, or other temporary
execution command. For a list of such commands, see Controlling the Target.
To switch from user-mode debugging to sleep mode, use the .sleep (Pause Debugger) command. This command is timed. When the time expires, the system returns to
user-mode debugging.
To switch from user-mode debugging to kernel-mode debugging, use the .breakin (Break to the Kernel Debugger) command. Note that .breakin might fail with an
access denied error if the calling process does not have administrator rights. In this case, switch to KD by issuing a short .sleep command and pressing CTRL+C.
You can switch from target application execution to user-mode debugging only in certain environments. If the target computer is running Microsoft Windows XP or a
later version of the Windows operating system, you can use the !bpid extension command. If you are using CDB (not NTSD), you can activate the CDB window on the
target computer and press CTRL+C.
If the target application hits a breakpoint, encounters an exception, encounters some other controlled event, or ends, the system switches from target application
execution to user-mode debugging. You should plan such events in advance, especially when you are using NTSD. For more information about these events, see Using
Breakpoints and Controlling Exceptions and Events.
To switch from target application execution to kernel-mode debugging, press CTRL+C in the KD window, press CTRL+BREAK or click Break on the Debug menu in
the WinDbg window, or press SYSRQ or ALT+SYSRQ on the target computer keyboard. (If your kernel debugger is KD and if you press CTRL+C at the same time
that the kernel debugger is communicating with the user-mode debugger, the user-mode debugger might capture you pressing CTRL+C.)
If the debugger encounters a kernel error or if you use the Breakin.exe tool, the system switches from target application execution to kernel-mode debugging.
To switch from sleep mode to user-mode debugging, wait for the sleep time to expire, start a new CDB process on the target computer by using the -wake commandline option, or use the .wake (Wake Debugger) command in a different copy of CDB or NTSD on the target computer.
To switch out of kernel-mode debugging, use the g (Go) command at the kd> prompt. This command returns to user-mode debugging or target application execution
(whichever of the two was the most recently-used state).
When you need to perform user-mode debugging, but also need control over the Windows kernel that the user-mode target is running on or need to use some kernelmode debugging features to analyze the problem.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 80 of 1651
When your user-mode target is a Windows process such as CSRSS or WinLogon. For a detailed description of how to debug these targets, see Debugging CSRSS and
Debugging WinLogon.
When your user-mode target is a service application. For a detailed description of how to debug these targets, see Debugging a Service Application.
There are two different user-mode debugging modes. When the target computer is running, the debugging server is controlled by the debugging client as in any other
remote debugging session; this is called remote-controlled user-mode debugging. When the kernel-mode debugger is broken in to the target computer and the Input>
prompt is showing, the user-mode debugger is controlled by the kernel debugger; this is called kernel-controlled user-mode debugging.
These two modes are never available at the same time. When the kernel debugger is broken in to the target computer, even though the user-mode debugger may be
active, the target computer is unable to process the remote transport protocol, and therefore the user-mode debugger will not be able to receive remote input across this
connection.
If your user-mode symbols are located on a symbol server, any debugger commands that require symbol access should be issued while in remote-controlled user-mode
debugging mode.
To switch from kernel-controlled user-mode debugging to remote-controlled user-mode debugging, use the .sleep (Pause Debugger) command. When the user-mode
debugger wakes from the sleep command, it will be in remote-controlled user-mode debugging mode.
To switch from remote-controlled user-mode debugging to kernel-mode debugging, enter any command from the Input> prompt. If this prompt is not visible, switch
to kernel-mode debugging, and then use the g (Go) command at the kd> prompt.
Internally, a user-mode debugger started with -ddefer gives first priority to input from the debugging client, and second priority to input from the kernel debugger. However,
there can never be a conflict between simultaneous inputs, because when the kernel debugger has broken in to the target computer, the remote connection is unavailable.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 81 of 1651
This window is always open at the beginning of a debugging session. You can reopen or switch to this window by clicking Command on the View menu, pressing ALT+1, or
clicking the Command (Alt+1) button (
) on the toolbar.
You can use the UP ARROW and DOWN ARROW keys to scroll through the command history. When a previous command appears, you can edit it and then press ENTER
to execute the previous command (or the edited version of the previous command). The cursor does not have to be at the end of the line for this procedure to work correctly.
Debugger Command Window Prompt
When you are performing user-mode debugging, the prompt in the Debugger Command window looks like the following example.
2:005>
In the preceding example, 2 is the current process number, and 005 is the current thread number.
If you attach the debugger to more than one computer, the system number is included before the process and thread number, as in the following example.
3:2:005>
In this example, 3 is the current system number, 2 is the current process number, and 005 is the current thread number.
When you are performing kernel-mode debugging on a target computer that has only one processor, the prompt looks like the following example.
kd>
However, if the target computer has multiple processors, the number of the current processor appears before the prompt, as in the following example.
0: kd>
If the debugger is busy processing a previously issued command, new commands will temporarily not be processed, although they can be added to the command buffer. In
addition, you can still use control keys in KD and CDB, and you can still use menu commands and shortcut keys in WinDbg. When KD or CDB is in this busy state, no
prompt is displayed. When WinDbg is in this busy state, the following indicator will appear in place of the prompt:
*BUSY*
You can use the .pcmd (Set Prompt Command) command to add text to this prompt.
Kinds of Commands
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 82 of 1651
WinDbg, KD, and CDB support a variety of commands. Some commands are shared between the debuggers, and some are available only on one or two of the debuggers.
Some commands are available only in live debugging, and other commands are available only when you debug a dump file.
Some commands are available only during user-mode debugging, and other commands are available only during kernel-mode debugging.
Some commands are available only when the target is running on certain processors. For more information about all of the commands and their restrictions, see Debugger
Commands.
Editing, Repeating, and Canceling Commands
You can use standard editing keys when you enter a command:
Use the UP ARROW and DOWN ARROW keys to find previous commands.
Edit the current command with the BACKSPACE, DELETE, INSERT, and LEFT ARROW and RIGHT ARROW keys.
Press the ESC key to clear the current line.
You can press the TAB key to automatically complete your text entry. In any of the debuggers, press the TAB key after you enter at least one character to automatically
complete a command. Press the TAB key repeatedly to cycle through text completion options, and hold down the SHIFT key and press TAB to cycle backward. You can also
use wildcard characters in the text and press TAB to expand to the full set of text completion options. For example, if you type fo*!ba and then press TAB, the debugger
expands to the set of all symbols that start with "ba", in all modules with module names that start with "fo". As another example, you can complete all extension commands
that have "prcb" in them by typing !*prcb and then pressing TAB.
When you use the TAB key to perform text completion, if your text fragment begins with a period (.), the text is matched to a dot command. If your text fragment begins with
an exclamation point (!), the text is matched to an extension command. Otherwise, the text is matched with a symbol. When you usee the TAB key to enter symbols, pressing
the TAB key completes code and type symbols and module names. If no module name is apparent, local symbols and module names are completed. If a module or module
pattern is given, symbol completion completes code and type symbols from all matches.
You can right-click in the Debugger Command window to automatically paste the contents of the clipboard into the command that you are typing.
The maximum command length is 4096 characters. However, if you are controlling the user-mode debugger from the kernel debugger, the maximum line length is 512
characters.
In CDB and KD, press the ENTER key by itself to repeat the previous command. In WinDbg, you can enable or disable this behavior. For more information about this
behavior, see ENTER (Repeat Last Command).
If the last command that you issued presents a long display and you want to cut it off, use the CTRL+C key in CDB or KD. In WinDbg, use Debug | Break or press
CTRL+BREAK.
In kernel-mode debugging, you can cancel commands from the keyboard of the target computer by pressing CTRL+C.
You can use the .cls (Clear Screen) command to clear all of the text from the Debugger Command window. This command clears the whole command history. In WinDbg,
you can clear the command history by using the Edit | Clear Command Output command or by clicking Clear command output on the shortcut menu of the Debugger
Command window.
Expression Syntax
Many commands and extension commands accept expressions as their arguments. The debugger evaluates these expressions before executing the command. For more
information about expressions, see Evaluating Expressions.
Aliases
Aliases are text macros that you can use to avoid having to retype complex phrases. There are two kinds of aliases. For more information about aliases, see Using Aliases.
Self-Repeating Commands
You can use the following commands to repeat an action or conditionally execute other commands:
For more information about each command, see the individual command topics.
Controlling Scrolling
You can use the scrollbar to view your previous commands and their output.
When you are using CDB or KD, any keyboard entry automatically scrolls down the Debugger Command window back to the bottom.
In WinDbg, the display automatically scrolls down to the bottom whenever a command produces output or you press the ENTER key. If you want to disable this automatic
scrolling, click the Options on the View menu and then clear the Automatically scroll check box.
WinDbg Text Features
In WinDbg, you can use several additional features to change how text is displayed in the Debugger Command window. You can access some of these features in the WinDbg
window, some in the shortcut menu in the Debugger Command window, and some by clicking on the appropriate menu icon.
The Word wrap command on the shortcut menu turns on and off the word wrap status. This command affects the whole window, not only commands that you use after
this state is changed. Because many commands and extensions produce formatted displays, we typically do not recommend word wrap.
The Edit | Add to Command Output menu command adds a comment in the Debugger Command window. The Add to command output command on the shortcut
menu has the same effect.
You can customize the colors that are used for the text and the background of the Debugger Command window. You can specify different colors for different kinds of
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 83 of 1651
text. For example, you can display the automatic register output in one color, error messages in another color, and DbgPrint messages in a third color. For more
information about this customization, see View | Options.
You can use all of the features common to WinDbg's debugging information windows, such as customizing the fonts and using special editing commands. For more
information about these features, see Using Debugging Information Windows.
Remote Debugging
When you are performing remote debugging through the debugger, the debugging client can access a limited number of commands. To change the number of commands that
the client can access, use the -clines command-line option or the _NT_DEBUG_HISTORY_SIZE environment variable.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Evaluating Expressions
The debugger understands two different forms of expressions: MASM expressions and C++ expressions.
Microsoft Macro Assembler (MASM) expressions are used in the examples in this Help documentation, except when otherwise noted. In MASM expressions, all symbols are
treated as addresses.
C++ expressions are the same as those used in actual C++ code. In these expressions, symbols are understood as the appropriate data types.
When Each Syntax is Used
You can select the default expression evaluator in one of the following ways:
If you do not use one of the preceding methods, the debugger uses the MASM expression evaluator.
If you want to evaluate an expression without changing the debugger state, you can use the ? (Evaluate Expression) command.
All commands and debugging information windows interpret their arguments through the default expression evaluator, with the following exceptions:
The ?? (Evaluate C++ Expression) command always uses the C++ expression evaluator.
The Watch window always uses the C++ expression evaluator.
The Locals window always uses the C++ expression evaluator.
Some extension commands always use the MASM expression evaluator (and other extension commands accept only numeric arguments instead of full expressions).
If any part of an expression is enclosed in parentheses and you insert two at signs (@@) before the expression, the expression is evaluated by the expression evaluator
that would not typically be used in this case.
The two at signs (@@) enable you to use two different evaluators for different parameters of a single command. It also enables you to evaluate different pieces of a long
expression by different methods. You can nest the two at signs. Each appearance of the two at signs switches to the other expression evaluator.
Warning C++ expression syntax is useful for manipulating structures and variables, but it is not well-suited as a parser for the parameters of debugger commands. When you
are using debugger commands for general purposes or you are using debugger extensions, you should set MASM expression syntax as the default expression evaluator. If you
must have a specific parameter use C++ expression syntax, use the two at sign (@@) syntax.
For more information about the two different expression types, see Numerical Expression Syntax.
Numbers in Expressions
Numbers in MASM expressions are interpreted according to the current radix. The n (Set Number Base) command can be used to set the default radix to 16, 10, or 8. All unprefixed numbers will be interpreted in this base. The default radix can be overridden by specifying the 0x prefix (hexadecimal), the 0n prefix (decimal), the 0t prefix (octal),
or the 0y prefix (binary).
Numbers in C++ expressions are interpreted as decimal numbers unless you specify differently. To specify a hexadecimal integer, add 0x before the number. To specify an
octal integer, add 0 (zero) before the number. (However, in the debugger's output, the 0n decimal prefix is sometimes used.)
If you want to display a number in several bases at the same time, use the .formats (Show Number Formats) command.
Symbols in Expressions
The two types of expressions interpret symbols differently:
In MASM expressions, each symbol is interpreted as an address. Depending on what the symbol refers to, this address is the address of a global variable, local variable,
function, segment, module, or any other recognized label.
In C++ expressions, each symbol is interpreted according to its type. Depending on what the symbol refers to, it might be interpreted as an integer, a data structure, a
function pointer, or any other data type. A symbol that does not correspond to a C++ data type (such as an unmodified module name) creates a syntax error.
If a symbol might be ambiguous, precede it with the module name and an exclamation point ( ! ). If the symbol name could be interpreted as a hexadecimal number, precede it
with the module name and an exclamation point ( ! ) or only an exclamation point. In order to specify that a symbol is meant to be local, omit the module name, and include a
dollar sign and an exclamation point ( $! ) before the symbol name. For more information about interpreting symbols, see Symbol Syntax and Symbol Matching.
Operators in Expressions
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 84 of 1651
Using Aliases
Aliases are character strings that are automatically replaced with other character strings. You can use them in debugger commands and to avoid retyping certain common
phrases.
An alias consists of an alias name and an alias equivalent. When you use an alias name as part of a debugger command, the name is automatically replaced by the alias
equivalent. This replacement occurs immediately, before the command is parsed or executed.
The debugger supports three kinds of aliases:
The alias name can be any string that does not contain white space.
The alias equivalent can be any string. If you enter it at the keyboard, the alias equivalent cannot contain leading spaces or carriage returns. Alternatively, you can set it
equal to a string in memory, the value of a numeric expression, the contents of a file, the value of an environment variable, or the output of one or more debugger
commands.
Both the alias name and the alias equivalent are case sensitive.
To define or redefine a user-named alias, use the as (Set Alias) or aS (Set Alias) command.
To remove an alias, use the ad (Delete Alias) command.
To list all current user-named aliases, use the al (List Aliases) command.
Defining a Fixed-Name Alias
There are 10 fixed-name aliases. Their alias names are $u0, $u1, ..., $u9. Their alias equivalents can be any string that does not contain the ENTER keystroke.
Use the r (Registers) command to define the alias equivalents for fixed-name aliases. When you define a fixed-name alias, you must insert a period (.) before the letter "u".
The text after the equal sign (=) is the alias equivalent. The alias equivalent can include spaces or semicolons, but leading and trailing spaces are ignored. You should not
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 85 of 1651
enclose the alias equivalent in quotation marks (unless you want quotation marks in the results).
Note Do not be confused by using the r (Registers) command for fixed-name aliases. These aliases are not registers or pseudo-registers, even though you use the r command
to set their alias equivalents. You do not have to add an at (@) sign before these aliases, and you cannot use the r command to display the value of one of these aliases.
By default, if you do not define a fixed-name alias, it is an empty string.
Automatic Aliases
The debugger sets the following automatic aliases.
Alias name
$ntnsym
$ntwsym
Alias equivalent
The most appropriate module for NT symbols on the computer's native architecture. This alias can equal either ntdll or nt.
The most appropriate module for NT symbols during 32-bit debugging that uses WOW64. This alias could be ntdll32 or some other 32-bit
version of Ntdll.dll.
$ntsym
The most appropriate module for NT symbols that match the current machine mode. When you are debugging in native mode, this alias is the
same as $ntnsym. When you are debugging in a non-native mode, the debugger tries to find a module that matches this mode. (For example,
during 32-bit debugging that uses WOW64, this alias is the same as $ntwsym.)
$CurrentDumpFile
The name of the last dump file that the debugger loaded.
$CurrentDumpPath
The directory path of the last dump file that the debugger loaded.
$CurrentDumpArchiveFile The name of the last dump archive file (CAB file) that the debugger loaded.
$CurrentDumpArchivePath The directory path of the last dump archive file (CAB file) that the debugger loaded.
Automatic aliases are similar to automatic pseudo-registers, except that you can use automatic aliases with alias-related tokens (such as ${ }), while you cannot use pseudoregisters with these tokens.
Using an Alias in the Debugger Command Window
After you define an alias, you can use it in any command entry. The alias name is automatically replaced with the alias equivalent. Therefore, you can use the alias as an
expression or as a macro.
An alias name expands correctly even if it is enclosed in quotation marks. Because the alias equivalent can include any number of quotation marks or semicolons, the alias
equivalent can represent multiple commands.
A user-named alias is recognized only if its name is separated from other characters by white space. The first character of its alias name must begin the line or follow a space,
a semicolon, or a quotation mark. The last character of its alias name must end the line or be followed by a space, a semicolon, or a quotation mark.
Note Any text that you enter into the Debugger Command window that begins with "as", "aS", "ad", or "al" does not receive alias replacement. This restriction prevents the
alias commands from being rendered inoperable. However, this restriction also means that commands that follow ad or al on a line do not have their aliases replaced. If you
want aliases to be replaced in a line that begins with one of these strings, add a semicolon before the alias.
However, you can use the ${ } token to expand a user-named alias even when it is next to other text. You can also use this token together with certain switches to prevent an
alias from being expanded or to display certain alias-related values. For more information about these situations, see ${ } (Alias Interpreter).
A fixed-name alias expands correctly from any point within a line, regardless of how it is embedded within the text of the line.
You cannot use commands that are available only in WinDbg (.open, .write_cmd_hist (Write Command History), .lsrcpath, and .lsrcfix) and a few additional commands
(.hh, .cls, .wtitle, .remote, kernel-mode .restart, and user-mode .restart) with aliases.
Using an Alias in a Script File
When you use an alias in a script file, you must take special care to make sure that the alias is expanded at the correct time. Consider the following script:
.foreach (value {dd 610000 L4})
{
as /x ${/v:myAlias} value + 1
.echo value myAlias
}
ad myAlias
The first time through the loop, the as, aS (Set Alias) command assigns a value to the myAlias. The value assigned to myAlias is 1 plus 610000 (the first output of the dd
command). However, when the .echo (Echo Comment) command is executed, myAlias has not yet been expanded, so instead of seeing 610001, we see the text "myAlias".
0:001> $$>< c:\Script02.txt
00610000 myAlias
00905a4d 0x610001
00000003 0x905a4e
00000004 0x4
0000ffff 0x5
The problem is that myAlias is not expanded until a new block of code is entered. The next entry to the loop is a new block, so myAlias gets expanded to 610001. But it is too
late: we should have seen 610001 the first time through the loop, not the second time.We can fix this problem by enclosing the .echo (Echo Comment) command in a new
block as shown in the following script.
.foreach (value {dd 610000 L4})
{
as /x ${/v:myAlias} value + 1
.block{.echo value myAlias}
}
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 86 of 1651
ad myAlias
With the altered script, we get the following correct output.
0:001> $$>< c:\Script01.txt
00610000 0x610001
00905a4d 0x905a4e
00000003 0x4
00000004 0x5
0000ffff 0x10000
For more information, see .block and ${ } (Alias Interpreter).
Examples
You can use aliases so that you do not have to type long or complex symbol names, as in the following example.
0:000> as Short usersrv!NameTooLongToWantToType
0:000> dw Short +8
The following example is similar to the preceding example but it uses a fixed-name alias.
0:000> r $.u0=usersrv!NameTooLongToWantToType
0:000> dw $u0+8
You can use aliases as macros for commands that you use frequently. The following example increments the eax and ebx registers two times.
0:000> as GoUp r eax=eax+1; r ebx=ebx+1
0:000> GoUp
0:000> GoUp
The following example uses an alias to simplify typing of commands.
0:000> as Cmd "dd esp 14; g"
0:000> bp MyApi Cmd
The following example is similar to the preceding example but it uses a fixed-name alias.
0:000> r $.u5="dd esp 14; g"
0:000> bp MyApi $u5
Both of the preceding examples are equivalent to the following command.
0:000> bp MyApi "dd esp 14; g"
Recursive Aliases
You can use a fixed-name alias in the definition of any alias. You can also use a user-named alias in the definition of a fixed-name alias. However, to use a user-named alias
in the definition of another user-named alias, you have to add a semicolon before the as or aS command, or else the alias replacement does not occur on that line.
When you are using recursive definitions of this type, each alias is translated as soon as it is used. For example, the following example displays 3, not 7.
0:000> r
0:000> r
0:000> r
0:000> ?
Evaluate
$.u2=2
$.u1=1+$u2
$.u2=6
$u1
expression: 3 = 00000003
$.u0=2
$.u0=7+$u0
$u0
expression: 9 = 00000009
Tools.ini File
In CDB (and NTSD), you can predefine fixed-name aliases in the tools.ini file. To predefine a fixed-name alias, add the $u fields that you want to your [NTSD] entry, as in
the following example.
[NTSD]
$u1:_ntdll!_RtlRaiseException
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 87 of 1651
(KD and CDB only; only when the debugger starts) Create a script file that is named Ntsd.ini and put it in the directory where you are starting the debugger from. The
debugger automatically executes this file when the debugger starts. To use a different file for the startup script file, specify the path and file name by using the -cf
command-line option or by using the IniFile entry in the Tools.ini file.
(KD and CDB only; when each session starts) Create a script file and specify its path and file name by using the -cfr command-line option. The debugger automatically
executes this script file when the debugger starts and every time that the target is restarted.
Use the $<, $><, $$<, and $$>< commands to execute a script file after the debugger is running. For more information about the syntax, see $<, $><, $><, $$>< (Run
Script File).
The $>< and $$>< commands differ from the other methods of running scripts in one important way. When you use these commands, the debugger opens the specified script
file, replaces all carriage returns with semicolons, and executes the resulting text as a single command block. These commands are useful for running scripts that contain
debugger command programs. For more information about these programs, see Using Debugger Command Programs.X
You cannot use commands that are available only in WinDbg (such as .lsrcfix (Use Local Source Server), .lsrcpath (Set Local Source Path), .open (Open Source File),
and .write_cmd_hist (Write Command History)) in script files, even if the script file is executed in WinDbg. In addition, you cannot use the .beep (Speaker Beep),
.cls (Clear Screen), .hh (Open HTML Help File), .idle_cmd (Set Idle Command), .remote (Create Remote.exe Server), kernel-mode .restart (Restart Kernel
Connection), user-mode .restart (Restart Target Application), or .wtitle (Set Window Title) commands in a script file.
Note WinDbg supports the same scripts as KD and CDB, with one minor exception. You can use the .remote_exit (Exit Debugging Client) command only in a script file
that KD or CDB uses. You cannot exit from a debugging client though a script that is executed in WinDbg.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 88 of 1651
You must enclose each block of commands that is executed conditionally or repeatedly in braces, even if there is only one such command. For example, you cannot
omit the braces in the following command.
0:000> .if (ebx>0) { r ebx }
Each condition must be a expression. Commands are not permitted. For example, the following example produces a syntax error.
0:000> .while (r ebx) { .... }
The final command before a closing brace does not have to be followed by a semicolon.
The following control flow tokens are supported within a debugger command program. For more information about the syntax of each token, see the individual reference
topics.
The !for_each_module, !for_each_frame, and !for_each_local extensions are also useful with a debugger command program.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 89 of 1651
Enter all of the statements in the Debugger Command window as a single string, with individual statements and commands separated by semicolons.
Add all of the statements in a script file on a single line, with individual statements and commands separated by semicolons. Then, run this script file by using one of the
methods described in Using Script Files.
Add all of the statements in a script file, with each statement on a separate line. (Alternatively, separate statements by any combination of carriage returns and
semicolons.) Then, run this script file by using the $>< (Run Script File) or $$>< (Run Script File) command. These commands open the specified script file, replace
all carriage returns with semicolons, and execute the resulting text as a single command block.
The $t0, $t1, and $t2 pseudo-registers are used as variables in this program. The program also uses aliases named Procc and $ImageName.
This program uses the MASM expression evaluator. However, the @@c++( ) token appears one time. This token causes the program to use the C++ expression
evaluator to parse the expression within the parentheses. This usage enables the program to use the C++ structure tokens directly.
The ? flag is used with the r (Registers) command. This flag assigns typed values to the pseudo-register $t2.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 90 of 1651
The following example walks through the user-mode LDR_DATA_TABLE_ENTRY list and displays the base address and full path of each list entry.
Like the preceding example, this program should be saved in a file and executed with the $$>< (Run Script File) command.
This example illustrates the following features:
This program uses the MASM expression evaluator. However, in two places, the @@c++( ) token appears. This token causes the program to use the C++ expression
evaluator to parse the expression within the parentheses. This usage enables the program to use C++ structure tokens directly.
The ? flag is used with the r (Registers) command. This flag assigns typed values to the pseudo-registers $t0 and $t1. In the body of the loop, $t1 has the type ntdll!
_LDR_DATA_TABLE_ENTRY*, so the program can make direct member references.
The user-named aliases $Base and $Mod are used in this program. The dollar signs reduce the possibility that these aliases have been used previously in the current
debugger session. The dollar signs are not necessary. The ${/v: } token interprets the alias literally, preventing it from being replaced if it was defined before the script
is run. You can also use this token together with any block to prevent alias definitions before the block from being used.
The .block token is used to add an extra alias replacement step. Alias replacement occurs one time for the whole script when it is loaded and one time when each block
is entered. Without the .block token and its braces, the .echo command does not receive the values of the $Mod and $Base aliases that are assigned in the previous
lines.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 91 of 1651
Opening a Window
When WinDbg begins a debugging session, the Debugger Command window automatically opens. The Disassembly window also automatically opens, unless you deselect
Automatically Open Disassembly on the Window menu.
Whenever WinDbg discovers a source file that corresponds to the current program counter, WinDbg opens a Source window for that file. For other ways to open Source
windows, see Source Path.
You can use the following menu commands, toolbar buttons, and shortcut keys to switch to these windows. That is, if a window is not open, it opens. If a window is open but
inactive, it becomes active. If a window is docked and there is a floating window in front of it, the docked window becomes active but the floating window stays in front of
the docked window.
Window
Menu command
Debugger Command window View | Command
Watch window
View | Watch
ALT+2
Locals window
View | Locals
ALT+3
Registers window
View | Registers
ALT+4
Memory window
View | Memory
ALT+5
Calls window
ALT+6
Disassembly window
View | Disassembly
ALT+7
Scratch Pad
ALT+8
ALT+9
CTRL+O
You can also activate a window by selecting it from the list of open windows at the bottom of the Window menu.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Closing a Window
To close a debugging information window, click the Close button in the upper-right corner of the window.
If you want to close the active window, you can also click Close Current Window on the File menu or press CTRL+F4.
You can close one of the debugging information windows by pressing ALT+SHIFT+number, where ALT+number are the shortcut keys that open this window. (For a list of
the possible shortcut keys, see Opening a Window.)
To close all Source windows at the same time, click Close All Source Windows on the Window menu. This command will not close a Source window that has been
designated as a tab-dock target. For more information on this setting, see the Source Window topic.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Configuring a Window
Each debugging information window has a shortcut menu that you can access by right-clicking the title bar of the window or by clicking the icon near the upper-right corner
of the title bar. You can use the commands on this shortcut menu to configure the window.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 92 of 1651
Many debugging information windows also have toolbars that contain buttons. Most of these buttons have features that are the same as commands on the shortcut menu.
For more information about a specific window's shortcut menu and toolbar, see Debugging Information Windows.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 93 of 1651
keys to delete the selection. If you select text and then type any characters, the new characters replace what you selected.
Copying Text
To copy text, select that text and then do one of the following:
Press the right mouse button. (This method works only in some locations. For more information about how to use the right mouse button, see The Right Mouse Button.)
Press CTRL+C.
Press CTRL+INSERT.
(Docked and tabbed windows only) Click Copy on the Edit menu.
) on the toolbar.
Cutting Text
To cut text and move it to the clipboard, select the text and then do one of the following:
Press CTRL+X.
Press SHIFT+DELETE.
(Docked and tabbed windows only) Click Cut on the Edit menu.
) on the toolbar.
You can cut text from the bottom pane of the Debugger Command window, from the left column of the Watch window, and from any dialog box (that is, from any location
that supports text entry).
Pasting Text
To paste text from the clipboard, put the cursor where you want to insert the text (or select the text that you want to replace) and then do one of the following:
Press the right mouse button. (This method works only in some locations, and you cannot use this method to replace text. For more inormation about how to use this
method, see The Right Mouse Button.)
Press CTRL+V.
Press SHIFT+INSERT.
(Docked and tabbed windows only) Click Paste on the Edit menu.
) on the tooblar.
You can paste text into the bottom pane of the Debugger Command window, into the left column of the Watch window, and into any dialog box (that is, into any location that
supports text entry).
If you select text in either pane of the Debugger Command window, in the Scratch Pad, in the Disassembly window, or in any Source window, and then you press the
right mouse button, the text is copied to the clipboard. However, if QuickEdit Mode has been deselected in View | Options, right-clicking in these locations will pop
up the menu most relevant to the current location.
If you put the cursor (without selecting any text) in either pane of the Debugger Command window, in the Scratch Pad, or in the text entry space of the Watch window,
and then you press the right mouse button, the contents of the clipboard are pasted into the window. However, if QuickEdit Mode has been deselected in View |
Options, right-clicking in these locations will pop up the menu most relevant to the current location.
If you put the cursor in any box and then press the right mouse button, a menu with Undo, Cut, Copy, Paste, and Select All options appears. You can choose any of
these options.
) on the toolbar.
In the Font dialog box, select the font, style, and size from the appropriate lists, and then click OK. All of the available fonts are fixed-pitch, because these kinds of fonts are
the most useful for viewing code.
Setting the Tab Width
To change the tab width settings, click Options on the View menu or click the Options button (
) on the toolbar.
The Options dialog box then appears. In the Tab width box, enter the number of spaces that the tab width should be equivalent to, and then click OK.
The tab settings affect the display of the code in any Source window.
2009 Microsoft Corporation
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 94 of 1651
Docking a Window
To dock a floating window, do one of the following:
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 95 of 1651
When you dock a window by any method other than dragging it, WinDbg automatically positions the docked window. If the window has never been docked before, WinDbg
moves the window to a new untabbed location within the WinDbg window. If the window has been docked before, WinDbg returns the window to its most recent docking
location, which might be tabbed or untabbed.
When you dock a window by dragging it, you can control its destination position. As you drag the window, you will see a semi-transparent outline of the window appear. This
outline shows where the window will be docked if you release the mouse button at that point. The following rules determine where a dragged window is docked:
If you drag the mouse pointer over the WinDbg window when the window is empty or over an empty dock, and then you release the mouse button, the dragged window
is docked in that location and completely fills the frame or dock.
If you drag the mouse pointer over the left, right, top, or bottom portion of an already-docked window and then you release the mouse button, the dragged window is
docked to the left, right, top, or bottom of the already-docked window, respectively.
When you drag the mouse pointer over a floating window (including the original position of the window that you are dragging), no docking occurs. This exception
means that you might have to drag other windows out of the way (or drag the current window two times) before you can move the window to where you want it.
If you drag the mouse pointer to a position that is not inside the WinDbg frame or any other dock and then you release the mouse button, the dragged window remains
floating.
All of the preceding rules apply to the mouse pointer location itself. They do not depend on where you originally clicked within the title bar of the window that you are
dragging.
Re-docking
If you let WinDbg automatically dock a floating window that was previously docked, WinDbg tries to put the window in the same docking position that it previously
occupied. Also, if you load a workspace, WinDbg tries to restore all of the debugging information windows to their previous positions, whether docked or floating.
However, multiple instances of Memory windows and Source windows are not distinguished when the docking position is saved. For example, if you combine the Locals
window together with a Memory window in a tabbed collection, and this state is saved and later restored, the Locals window joins a Memory window in a tabbed collection,
but it might not be the same Memory window as before.
If you load a workspace that includes one or more Source windows when the source files are inaccessible, those Source windows are not reopened. When this situation occurs,
other windows that were tabbed together with those windows might return to the floating state. If you want to keep all of your Source windows tabbed together, you should
include at least one source file that is always present, or include an additional window in the tabbed collection.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Tabbing a Window
To tab a floating or docked window, drag it on top of another docked window. Drag the window with the mouse pointer over the center of an already-docked window, and
then release the mouse button. The dragged window joins the already-docked window as a tabbed window collection.
All Source windows can be grouped automatically into a tabbed collection by selecting one Source window and designating it as the tab-dock target for all Source windows
by choosing the Set as tab-dock target for window type option in its short-cut menu. Once this is done, all future Source windows that are opened will automatically be
included in a tabbed collection with this first Source window. The Source window marked as the tab-dock target will not be closed when the Window | Close All Source
Windows menu command is selected. Thus you can set up a placeholder window for the Source windows without worrying that it will be closed when you don't want it to be.
The same process also works for Memory windows.
Note If you want a window to join another window in a tabbed window collection, watch the outline of the window that moves as you drag the window. When this outline
completely surrounds the window that you want to join, release the mouse button.
A set of tabs always controls the window immediately above the tabs. In the following illustration, the Debugger Command window is selected and is visible above the tabs.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 96 of 1651
Undocking a Window
To undock a window and make it a floating window, do one of the following:
When you undock a window by one of the preceding methods, the window returns to its previous undocked position.
You can also drag a docked window by clicking its title bar. This action enables you to move the window to a different docked position or undock it. (Dragging a docked
window to a new position works exactly like dragging a floating window to a new position. For more information about dragging a floating window to a new position, see
Docking a Window.)
When you try to undock or drag a tabbed window by any of these methods, only the active window in the tabbed collection is moved.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 97 of 1651
Arranging Windows
One useful window arrangement is to combine all of your Source windows into a single tabbed collection. The easiest way to do this is by marking your first source window
as the tab-dock target for all Source windows by selecting the Set as tab-dock target for window type option in the Source window's short-cut menu. Once this is done, all
future Source windows that are opened will automatically be included in a tabbed collection with this first Source window. The Source window marked as the tab-dock target
will not be closed when the Window | Close All Source Windows menu command is selected. Thus you can set up a placeholder window for the Source windows that will
only be closed when you want it to be.
This collection can occupy half of the WinDbg window or you can put it in a separate dock.
If you want each debugging information window to be completely separate, you can create one dock for each window. This arrangement enables you to minimize or
maximize each window separately.
If you want all of your windows to be floating, you should select Always floating on each window's shortcut menu so that you can drag each window independently to any
location.
Alternatively, you can use the MDI Emulation command on the Window menu. This command makes all of the windows floating windows and constrains them within the
frame window. This behavior emulates the behavior of WinDbg before the introduction of docking mode.
If you are using dual monitors, you can put the WinDbg window in one monitor and an extra dock in the other.
Some standard window arrangements for various debugging scenarios are included in the Debugging Tools for Windows package. For details on these arrangements, see
Using and Customizing WinDbg Themes.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Using Workspaces
When you exit WinDbg, it saves your session configuration in a workspace. A workspace enables you to easily preserve your settings from one session to another. You can
also save or clear the workspaces manually, or even use a workspace to save a debugging session that is still in progress.
This section includes the following topics:
Creating and Opening a Workspace
Workspace Contents
Using and Customizing WinDbg Themes
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
When WinDbg creates a user-mode process for debugging, a workspace is created for that executable file. Each created executable file has its own workspace.
When WinDbg analyzes a dump file, a workspace is created for that dump file analysis session. Each dump file has its own workspace.
When you begin a debugging session, the appropriate workspace is loaded. When you end a debugging session or exit WinDbg, a dialog box is displayed and asks you if you
want to save the changes that you have made to the current workspace. If you start WinDbg with the -QY command-line option, this dialog box does not appear, and
workspaces are automatically saved. Also, if you start WinDbg by the -Q command-line option, this dialog box does not appear, and no changes are saved.
Workspaces load in a cumulative manner. The base workspace is always loaded first. When you begin a particular debugging action, the appropriate workspace is loaded. So
most debugging is completed after two workspaces have been loaded. Kernel-mode debugging is completed after three workspaces have been loaded (the base workspace, the
default kernel-mode workspace, and the processor-specific workspace).
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 98 of 1651
For greatest efficiency, you should save settings in lower-level workspaces if you want them to apply to all of your WinDbg work.
Note The layout of the debugging information windows is one exception to the cumulative behavior of workspaces. The position, docking status, and size of each window are
determined by only the most recent workspace that you opened. This behavior includes the contents of the Watch window and the locations that you viewed in each Memory
window. The command history in the Debugger Command window is not cleared when a new workspace is opened, but all other window states are reset.
To access the base workspace, start WinDbg with no target, or click Stop Debugging on the Debug menu after your session is complete. You can then make any edits that are
allowed in the base workspace.
Named Workspaces
You can also give workspaces names and then save or load them individually. After you load a named workspace, all automatic loading and saving of default workspaces is
disabled.
Named workspaces contain some additional information that default workspaces do not. For more information about this additional information, see Workspace Contents.
Opening, Saving, and Clearing Workspaces
To control workspaces, you can do the following::
Workspace Contents
Each workspace preserves the following information about the current debugging session. This information is applied cumulatively, starting with the base workspace and
ending with the most recently-loaded workspace.
All break and handling information for exceptions and events. For more information about the break and handling information, see Breakpoints in Workspaces.
All open source files. If a source file is not found, an error message appears. You can close these error messages individually or by using the Window | Close All Error
Windows command.
All user-defined aliases.
Each workspace preserves the following information about the debugger configuration settings. This information is applied cumulatively, starting with the base workspace
and ending with the most recently-loaded workspace.
All default workspaces and named workspaces preserve the following information about the WinDbg graphical interface. This information is loaded cumulatively, starting
with the base workspace and ending with the most recently-loaded workspace.
All default workspaces and named workspaces preserve the following information about the WinDbg graphical interface. This information is not applied cumulatively. It
depends only on the most recently-loaded workspace.
Named Workspaces
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Page 99 of 1651
Named workspaces contain additional information that is not stored in default workspaces.
This additional information includes information about the current session state. When a named workspace is saved, the current session is saved. If this workspace is later
opened, this session is automatically restarted.
You can start only kernel debugging, dump file debugging, and debugging of spawned user-mode processes in this manner. Remote sessions and user-mode processes that the
debugger attached to do not have this session information saved in their workspaces.
You cannot open this kind of named workspace if another session is already active.
Debugging Clients and Workspaces
When you use WinDbg as a debugging client, its workspace saves only values that you set through the graphical interface. Changes that you make through the Debugger
Command window are not saved. (This restriction guarantees that only changes that the local client made are reflected, because the Debugger Command window accepts
input from all clients and the debugging server.) For more information, see Controlling a Remote Debugging Session.
Breakpoints in Workspaces
In addition, breakpoint information is saved in workspaces, including the break address and status. Breakpoints that are active when a session ends are active when the next
session is started. However, some of these breakpoints might be unresolved if the proper modules have not yet been loaded.
Breakpoints that you specify by a symbol expression, by a line number, by a numeric address, or by using the mouse in a Source window are all saved in workspaces.
Breakpoints that you specify by using the mouse in a Disassembly or Calls window are not saved in workspaces.
If you are debugging multiple user-mode processes, only breakpoints that are associated with process zero are saved.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Loading a Theme
Before loading a theme, we recommend that you clear all of your workspace data. This can be done in three ways:
By using the WinDbg user-interface. Under the File menu, select Clear Workspace... Select Clear All in the pop-up window and then click OK.
By deleting the registry key under HKCU\Software\Microsoft\Windbg\Workspaces.
By running the command reg delete HKCU\Software\Microsoft\Windbg.
After all of your workspace data has been cleared, run one of the themes. These are stored as .reg files in the Themes directory of your Debugging Tools for Windows
installation. Running a theme imports its settings into the registry, redefining your base workspace.
After you have loaded a theme, you may alter it to more closely suit your preferences. For more details on some common options, see Customizing a Theme.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Customizing a Theme
Before customizing a theme, it must first be loaded. See Loading a Theme for details.
After the theme is loaded, start WinDbg with no command-line parameters. This opens the base workspace. There are two common areas of focus for customizing a theme:
setting paths and adjusting window position.
After you have completed any wanted adjustments, exit WinDbg and save your workspace by selecting Save Workspace from the File menu. If you want to save your new
settings to a .reg file, open Regedit and export the registry key under HKCU\Software\Microsoft\Windbg\Workspaces to a .reg file.
Setting Paths
By setting the appropriate paths, you can ensure that WinDbg can locate all of the files that it needs to debug effectively. There are three main paths to set: the symbol path,
the source path, and the executable image path.
Here are examples of how to set the symbol and source path. The executable image path is typically the same as your symbol path. For more details, see Setting Paths and
Loading Files.
To set your symbol path:
SRV*c:\MySymCache*\\CompanySymbolServer\Symbols;SRV*c:\WinSymCache*http://msdl.microsoft.com/download/symbols
To set your source path:
SRV*;d:\MySourceRoot
Adjusting Window Position
Before using your theme, you should adjust the window positioning so that WinDbg handles your source files correctly. This ensures that Source windows knows where to
dock.
Begin by opening a Source window in WinDbg. Tab-dock this window with the placeholder set aside for your Source windows. In order for the proper relationship to be
made, the placeholder window must be the uppermost window in the dock before you perform this tab-docking operation. Now close the source window but not the
placeholder window.
Because debugging information windows "remember" their last docking operation, each source window's last docking operation is associated with one of the placeholder
windows after you have performed this procedure. Because of this memory attribute, you should not close any of your placeholder windows. Further, if you choose to change
the theme's configuration, any window you reposition in a dock should always be tab-docked with a placeholder file.
The sample themes included with the Debugging Tools for Windows were created using the following actions:
Place and position the placeholder*.c files into the dock.
Tab-dock every window type above the wanted placeholder window.
For further information about adjusting window position in WinDbg, see Positioning the Windows.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Standard.reg Theme
Standardvs.reg
The Standardvs.reg theme can be used for most debugging purposes, but is more similar in layout to Visual Studio. In this arrangement, the WinDbg window is divided
horizontally into thirds. The upper third is further divided vertically into halves. The left half of the upper third contains a tabbed collection that includes the Watch, Locals,
Registers, Memory, Disassembly, and Scratchpad windows. The right half of the upper third contains a tabbed collection that includes the Calls and Processes and Threads
windows. The lower third of the WinDbg window is taken by the Debugger Command window. The middle third is filled by a placeholder window that indicates where the
Source windows are opened in a tabbed collection.
In each docking location, a placeholder window is also included as a point of reference for the other windows. The placeholder windows should not be closed because closing
them may change the configuration of the windows. All of the windows in this arrangement are docked.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Standardvs.reg Theme
Srcdisassembly.reg
The Srcdisassembly.reg theme includes a Disassembly window, for debugging in assembly mode. In this arrangement, the WinDbg window is divided in half vertically, and
each half formed is further divided into thirds horizontally. On the right half, the upper third is a tabbed collection of the Locals and Watch windows, the middle third is the
Debugger Command window, and the lower third is a tabbed collection of the Processes and Threads and Calls windows. On the left half, the upper two-thirds are taken by a
placeholder window that indicates where the Source windows opens in a tabbed collection; the lower third is taken up by the Disassembly window.
In each docking location, a placeholder window is also included as a point of reference for the other windows. The placeholder windows should not be closed because closing
them may change the configuration of the windows. All of the windows in this arrangement are docked.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Srcdisassembly.reg Theme
Multimon.reg
The Multimon.reg theme is set up for debugging with multiple monitors. In this arrangement, a new dock is created so that the WinDbg window can be viewed on one
monitor and the new dock can be viewed on the other monitor. The WinDbg window is filled by a placeholder window that indicates where the Source windows open in a
tabbed collection. The new dock is divided into fourths. The upper left contains a tabbed collection that includes the Watch and Locals windows. The upper right contains a
tabbed collection that includes the Registers, Memory, Disassembly, Scratchpad, and Processes and Threads windows. The lower left contains the Debugger Command
window. The lower right contains the Calls window.
In each docking location, a placeholder window is also included as a point of reference for the other windows. The placeholder windows should not be closed because closing
them may change the configuration of the windows. All of the windows in this arrangement are docked.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Multimon.reg Theme
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Toolbar
The toolbar buttons have various effects. Most of them are equivalent to menu commands. To execute the command that is associated with a toolbar button, click the toolbar
button. When you cannot use a button, it appears unavailable.
For more information about each button, see Toolbar Buttons.
Using the Status Bar
Status bar
The following table describes the sections of the WinDbg status bar.
Section
Description
Message Displays messages from the debugger.
Ln, Col Displays the line number and column number at the cursor in the active Source window.
Sys
Shows the internal decimal number of the system that you are debugging, followed by its computer name (or <Local> if it is the same as the computer as the
debugger is running on).
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Proc
Thrd
ASM
OVR
CAPS
NUM
Shows the internal decimal number of the process that you are debugging, followed by its hexadecimal process ID.
Shows the internal decimal number of the thread that you are debugging, followed by its hexadecimal thread ID.
Indicates that WinDbg is in assembly mode. If ASM is unavailable, WinDbg is in source mode.
Indicates that overtype mode is active. If OVR is unavailable, insert mode is active.
Indicates that CAPS LOCK is on.
Indicates that NUM LOCK is on.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Click Start, point to All Programs, point to Debugging Tools for Windows, and then click Debugging Help.
Open Windows Explorer, locate the Debugger.chm file, and then double-click it.
At a command prompt, browse to the folder that contains Debugger.chm and run hh debugger.chm.
In any Windows debugger, use the .hh (Open HTML Help File) command.
In WinDbg, click Contents on the Help menu. This command open the Help documentation and opens the Contents tab.
In WinDbg, click Index on the Help menu. This command open the Help documentation and opens the Index tab.
In WinDbg, click Search on the Help menu. This command opens the Help documentation and opens the Search tab.
Many dialog boxes in WinDbg have Help buttons. Click Help to open this documentation and open the relevant page.
(CDB and KD only) Before you start the debugger, set the _NT_DEBUG_LOG_FILE_OPEN environment variable.
When you start the debugger, use the -logo command-line option.
Use the .logopen (Open Log File) command. If you use the /t option, the date and time are appended to your specified file name. If you use the /u option, the log file is
written in Unicode instead of in ASCII.
(WinDbg only) Use the Edit | Open/Close Log File command.
(CDB and KD only) Before you start the debugger, set the _NT_DEBUG_LOG_FILE_APPEND environment variable.
When you start the debugger, use the -loga command-line option.
Use the .logappend (Append Log File) command. If you are appending to a Unicode log file, you must use the /u option.
(WinDbg only) Use the Edit | Open/Close Log File command, and then selct Append.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The event can cause a break into the debugger as soon as it occurs (the "first chance").
The event can break in after other error handlers have been given an opportunity to respond (the "second chance").
The event can also send the debugger a message but continue executing.
The debugger can ignore the event.
The debugger can also set the handling status for each exception and event. The debugger can treat the event like a handled exception or an unhandled exception. (Of course,
events that are not actually errors do not require any handling.)
You can control the break status and handling status by doing one of the following:
Use the SXE, SXD, SXN, or SXI command in the Debugger Command window.
(CDB only) Use the -x, -xe, -xd, -xn, or -xi option on the CDB command line.
(CDB only) Use the sxe or sxd keyword in the Tools.ini file.
(WinDbg only) Click Event Filters on the Debug menu to open the Event Filters dialog box, and then choose the options that you want.
The SX* command, the -x* command-line option, and the sx* Tools.ini keyword typically set the break status of the specified event. You can add the -h option to cause the
handling status to be set instead.
There are four special event codes (cc, hc, bpec, and ssec) that always specify handling status instead of break status.
You can display the most recent exception or event by using the .lastevent (Display Last Event) command.
Controlling Break Status
When you set the break status of an exception or event, you can use the following options.
Command Status name
SXE
Break
or
-xe
(Enabled)
SXD
or
-xd
Description
When this exception occurs, the target immediately breaks into the debugger. This break in occurs before any other error handlers are activated.
This method is called first-chance handling.
Second chance The debugger does not break in for this kind of first-chance exception (although a message is displayed). If other error handlers cannot address
break
this exception, execution stops and the target breaks into the debugger. This method is called second-chance handling.
(Disabled)
SXN
or
-xn
Output
SXI
or
-xi
Ignore
When this exception occurs, the target application does not break into the debugger at all. However, a message is displayed that informs the
user of this exception.
(Notify)
When this exception occurs, the target application does not break into the debugger, and no message is displayed.
If an exception is not anticipated by an SX* setting, the target application breaks into the debugger on the second chance. The default status for events is listed in the
following "Event Definitions and Defaults" section of this topic.
To set break status by using the WinDbg graphical interface, Event Filters on the Debug menu, click the event that you want from the list in the Event Filters dialog box,
and then select Enabled, Disabled, Output, or Ignore.
Controlling Handling Status
All events are considered unhandled, unless you use the gh (Go with Exception Handled) command.
All exceptions are considered unhandled, unless you use the sx* command together with the -h option.
Additionally, SX* options can configure the handling status for invalid handles, STATUS_BREAKPOINT break instructions, and single-step exceptions. (This configuration
is separate from their break configuration.) When you configure their break status, these events are named ch, bpe, and sse, respectively. When you configure their handling
status, these events are named hc, bpec, and ssec, respectively. (For the full listing of events, see the following "Event Definitions and Defaults" section.)
You can configure the handling status for the CTRL+C event (cc), but not its break status. If an application receives a CTRL+C event, the application always breaks into the
debugger.
When you use the SX* command on cc, hc, bpec, and ssec events, or when you use the SX* command together with the -h option on an exception, the following actions
occur.
Command Status name
Description
SXE
Handled
The event is considered handled when execution resumes.
SXD,
Not Handled The event is considered not handled when execution resumes.
SXN,
SXI
To set handling status by using the WinDbg graphical interface, click Event Filters on the Debug menu, click the event that you want from the list in the Event Filters dialog
box, and then select Handled or Not Handled.
Automatic Commands
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The debugger also enables you to set commands that are automatically executed if the event or exception causes a break into the debugger. You can set a command string for
the first-chance break and a command string for the second-chance break. You can set these strings with the SX* command or the Debug | Event Filters command. Each
command string can contain multiple commands that are separated with semicolons.
These commands are executed regardless of the break status. That is, if the break status is "Ignore," the command is still executed. If the break status is "Second-chance
break," the first-chance command is executed when the exception first occurs, before any other exception handlers are involved. The command string can end with an
execution command such as g (Go), gh (Go with Exception Handled), or gn (Go with Exception Not Handled).
Event Definitions and Defaults
You can change the break status or handling status of the following exceptions. Their default break status is indicated.
The following exceptions' default handling status is always "Not Handled". Be careful about changing this status. If you change this status to "Handled", all first-chance and
second-chance exceptions of this type are considered handled, and this configuration bypasses all of the exception-handling routines.
Event code
asrt
Assertion failure
av
Access violation
dm
Data misaligned
dz
Divide by zero
eh
C++ EH exception
gp
Guard page violation
ii
Illegal instruction
iov
Integer overflow
ip
In-page I/O error
isc
Invalid system call
lsq
Invalid lock sequence
sbo
Stack buffer overflow
sov
Stack overflow
wkd
Wake debugger
aph
Application hang
Meaning
This exception is triggered if the Windows operating system concludes that a process has stopped responding (that is, is hung).
3c
ch
hc
Number
Second-chance break
Break
Second-chance break
Note You can override the asrt break status for a specific address by using the ah (Assertion Handling) command. The ch and hc event codes refer to the same exception.
When you are controlling its break status, use sx* ch. When you are controlling its handling status, use sx* hc.
You can change the break status or handling status of the following exceptions. Their default break status is indicated.
The following exceptions' default handling status is always "Handled". Because these exceptions are used to communicate with the debugger, you should not typically change
their status to "Not Handled". This status causes other exception handlers to catch the exceptions if the debugger ignores them.
An application can use DBG_COMMAND_EXCEPTION (dbce) to communicate with the debugger. This exception is similar to a breakpoint, but you can use the SX*
command to react in a specific way when this exception occurs.
Event code
Meaning
Default break status
dbce
Special debugger command exception
Ignore
vcpp
Special Visual C++ exception
Ignore
wos
WOW64 single-step exception
Break
wob
WOW64 breakpoint exceptionBreak
sse
Single-step exception
Break
ssec
bpe
Breakpoint exception
Break
bpec
cce
CTRL+C or CTRL+BREAK
Break
cc
This exception is triggered if the target is a console application and CTRL+C or CTRL+BREAK is passed to it.
Note The final three exceptions in the preceding table have two different event codes. When you are controlling their break status, use sse, bpe, and cce. When you are
controlling their handling status, use ssec, bpec, and cc.
You can change the break status of the following events. Because these events are not exceptions, their handling status is irrelevant.
Event
Meaning
code
ser
System error
cpr
Process creation
[:Process]
Setting the break status of this event applies only to user-mode debugging. This event does not occur in kernel
mode.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
You can control this event only if you have activated debugging of child processes in CDB or WinDbg, either
through the -o command-line option or through the .childdbg (Debug Child Processes) command.
The process name can include an optional file name extension and an asterisk (*) or question mark (?) as
wildcard characters. The debugger remembers only the most recent cpr setting. Separate settings for separate
processes are not supported. Include a colon or a space between cpr and Process.
If Process is omitted, the setting applies to any child process creation.
epr
Process exit
[:Process]
Setting the break status of this event applies only to user-mode debugging. This event does not occur in kernel
mode.
Ignore
You can control this event only if you have activated debugging of child processes in CDB or WinDbg, either
through the -o command-line option or through the .childdbg (Debug Child Processes) command.
The process name can include an optional file name extension and an asterisk (*) or question mark (?) as
wildcard characters. The debugger remembers only the most recent epr setting. Separate settings for separate
processes are not supported. Include a colon or a space between epr and Process.
If Process is omitted, the setting applies to any child process exit.
ct
Thread creation
et
Thread exit
ld
Load module
[:Module]
If you specify Module, the break occurs when the module with this name is loaded. Module can specify the
name or the address of the module. If the name is used, Module might contain a variety of wildcard characters
and specifiers. (For more information about the syntax, see String Wildcard Syntax.)
Ignore
Ignore
Output
The debugger remembers only the most recent ld setting. Separate settings for separate modules are not
supported. Include a colon or a space between ld and Module.
If Module is omitted, the event is triggered when any module is loaded.
Output
ud
Unload module
[:Module]
If you specify Module, the break occurs when the module with this name, or at this base address, is unloaded.
Module can specify the name or the address of the module. If the name is used, Module can be an exact name or
include wildcard characters. If Module is an exact name, it is immediately resolved to a base address by using
the current debugger module list and it is stored as an address. If Module contains wildcard characters, the
pattern string is kept for later matching when unload events occur.
Rarely, the debugger does not have name information for unload events and matches only by the base address.
Therefore, if Module contains wildcard characters, the debugger cannot perform a name match in this particular
unload case and breaks when any module is unloaded.
The debugger remembers only the most recent ud setting. Separate settings for separate modules are not
supported. Include a colon or a space between ld and Module.
If Module is omitted, the event is triggered when any module is loaded.
out
Target application output
Ignore
[:Output]
If you specify Output, the break occurs only when output that matches the specified pattern is received. Output
can contain a variety of wildcard characters and specifiers. (For more information about the syntax, see String
Wildcard Syntax.) However, Output cannot contain a colon or spaces. The match is not case sensitive. Include a
colon or space between out and Output.
ibp
iml
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Before you start the debugger, use the _NT_EXECUTABLE_IMAGE_PATH environment variable to set the path. If you try to add an invalid directory through this
environment variable, the debugger ignores this directory.
When you start the debugger, use the -i command-line option to set the path.
Use the .exepath command to display, set, change, or append to the path.
(WinDbg only) Use the File | Image File Path command or press CTRL+I to display, set, change, or append to the path.
If you use the -sins command-line option, the debugger ignores the executable image path environment variable.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Symbol Path
The symbol path specifies the directories where the symbol files are located. For more information about symbols and symbol files, see Symbols.
Some compilers (such as Microsoft Visual Studio) put symbol files in the same directory as the binary files. The symbol files and the checked binary files contain path and
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file name information. This information frequently enables the debugger to find the symbol files automatically. If you are debugging a user-mode process on the computer
where the executable was built, and if the symbol files are still in their original location, the debugger can locate the symbol files without you setting the symbol path.
In most other situations, you have to set the symbol path to point to your symbol file locations.
Symbol Path Syntax
The debugger's symbol path is a string that consists of multiple directory paths, separated by semicolons.
Relative paths are supported. However, unless you always start the debugger from the same directory, you should add a drive letter or a network share before each path.
Network shares are also supported.
For each directory in the symbol path, the debugger looks in three directories. For example, if the symbol path includes the c:\MyDir directory, and the debugger is looking
for symbol information for a DLL, the debugger first looks in c:\MyDir\symbols\dll, then in c:\MyDir\dll, and finally in c:\MyDir. The debugger then repeats this process for
each directory in the symbol path. Finally, the debugger looks in the current directory and then in the current directory with \dll appended to it. (The debugger appends dll,
exe, or sys, depending on which binaries it is debugging.)
However, because symbol files have date and time stamps, you do not have to worry that the debugger will use the wrong symbols because they are the symbols found first in
this sequence. The debugger always looks for the symbols that match the time stamp on the binary files that it is debugging. For more information about responses in case the
symbols files are not available, see Compensating for Symbol-Matching Problems.
Note If you are connected to the Internet or a corporate network, the most efficient way to access symbols is to use a symbol server. You can use a symbol server by using the
srv* or symsrv* string within your symbol path. For more information about symbol servers, see Symbol Stores and Symbol Servers.
Lazy Symbol Loading
The debugger's default behavior is to use lazy symbol loading (also known as deferred symbol loading). This kind of loading means that symbols are not loaded until they are
required. However, if the symbol path is changed, all already-loaded symbols are immediately reloaded. For more information about lazy symbol loading and how to activate
and deactivate it, see Deferred Symbol Loading.
You can turn off lazy symbol loading in CDB and KD by using the -s command-line option. You can also force symbol loading by using the ld (Load Symbols) command or
by using the .reload (Reload Module) command together with the /f option.
Controlling the Symbol Path
To control the symbol path, you can do one of the following:
Before you start the debugger, use the _NT_SYMBOL_PATH and _NT_ALT_SYMBOL_PATH environment variables to set the path. The symbol path is created by
appending _NT_SYMBOL_PATH after _NT_ALT_SYMBOL_PATH. (Typically, the path is set through the _NT_SYMBOL_PATH. However, you might want to use
_NT_ALT_SYMBOL_PATH to override these settings in special cases, such as if you have private versions of shared symbol files.) If you try to add an invalid
directory through these environment variables, the debugger ignores this directory.
When you start the debugger, use the -y command-line option to set the path.
Use the .sympath command to display, set, change, or append to the path. If you are using a source server, the .symfix (Set Symbol Store Path) command is similar
to .sympath but saves you typing.
(WinDbg only) Use the File | Symbol File Path command or press CTRL+S to display, set, change, or append to the path.
If you use the -sins command-line option, the debugger ignores the symbol path environment variable.
cache*localsymbolcache
If you include the string cache*localsymbolcache in your symbol path, the specified directory localsymbolcache will be used to store any symbols loaded from any element
that appears in your symbol path to the right of this string. This allows you to use a local cache for symbols downloaded from any location, not just those downloaded by a
symbol server.
For example, if you set your symbol path with the following .sympath command, the directory c:\mysymbols will be used to store files from both of the \\private shares, but
not from \\someshare:
.sympath \\someshare\that\cachestar\ignores;cache*c:\mysymbols;\\private\binary\symbol\location;\\private\test\build\symbol\share
This can be easily combined with the Microsoft public symbol store by using the following initial setting:
_NT_SYMBOL_PATH=srv*c:\mysymbols*http://msdl.microsoft.com/download/symbols;cache*c:\mysymbols
After this, you can expand the symbol path with the .sympath+ command, which will append additional locations to the right of the current path. Symbols from these new
locations will be cached in c:\mysymbols because they are listed to the right of the cache* string in the path; symbols from the symbol server will be stored in c:\mysymbols
because of the usual syntax used by the symbol server (see Using a Symbol Server).
Using AgeStore to Reduce the Cache Size
You can use the AgeStore tool to delete cached files that are older than a specified date, or to delete enough old files that the resulting size of the cache is less than a specified
amount. This can be useful if your downstream store is too large. For details, see AgeStore.
For more information about symbol servers and symbol stores, see Symbol Stores and Symbol Servers.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Source Path
The source path specifies the directories where the C and C++ source files are located.
If you are debugging a user-mode process on the computer where the executable file was built, and if the source files are still in their original location, the debugger can
automatically locate the source files.
In most other situations, you have to set the source path or load the individual source files.
When you are performing remote debugging through the debugger, the debugging server uses the source path. If you are using WinDbg as your debugger, each debugging
client also has its own local source path. All source-related commands access the source files on the local computer. You have to set the proper paths on any client or server
that you want to use source commands.
This multiple-path system also enables a debugging client to use source-related commands without actually sharing the source files with other clients or with the server. This
system is useful if there are private or confidential source files that one of the users has access to.
You can also load source files at any time, regardless of the source path.
Source Path Syntax
The debugger's source path is a string that consists of multiple directory paths, separated by semicolons.
Relative paths are supported. However, unless you always start the debugger from the same directory, you should add a drive letter or a network share before each path.
Network shares are also supported.
Note If you are connected to a corporate network, the most efficient way to access source files is to use a source server. You can use a source server by using the srv* string
within your source path. For more information about source servers, see Using a Source Server.
Controlling the Source Path
To control the source path and local source path, you can do one of the following:
Before you start the debugger, use the _NT_SOURCE_PATH environment variable to set the source path. If you try to add an invalid directory through this
environment variable, the debugger ignores this directory.
When you start the debugger, use the -srcpath command-line option to set the source path.
Use the .srcpath (Set Source Path) command to display, set, change, or append to the source path. If you are using a source server, .srcfix (Use Source Server) is
slightly easier.
(WinDbg only) Use the .lsrcpath (Set Local Source Path) command to display, set, change, or append to the local source path. If you are using a source server,
.lsrcfix (Use Local Source Server) is slightly easier. You can also use the WinDbg Command-Line with the parameter lscrpath. For more information, see WinDbg
Command-Line Options.
(WinDbg only) Use the File | Source File Path command or press CTRL+P to display, set, change, or append to the source path or the local source path.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
You can also directly open or close a source file by doing one of the following:
Use the lsf (Load or Unload Source File) command to open or close a source file.
(WinDbg only) Use the .open (Open Source File) command to open a source file.
(WinDbg only) Use the File | Open Source File command or press CTRL+O to open a source file. You can also use the Open source file (Ctrl+O) button (
toolbar.
) on the
Note When you use File | Open Source File (or its shortcut menu or button equivalents) to open a source file, the path of that file is automatically appended to the
source path.
(WinDbg only) Use the File | Recent Files command to open one of the four source files that you most recently opened in WinDbg.
(WinDbg only) Use the File | Close Current Window command or click the Close button in the corner of the Source window to close a source file.
For more information about how to use source files, see Debugging in Source Mode.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Command Forms
Most commands for starting or controlling the targets execution exist as text commands, menu commands, toolbar buttons, and shortcut keys. As basic text commands, you
can use these commands in CDB, KD, or WinDbg. (The text form of the commands frequently supports additional options, such as changing the location of the program
counter or executing a fixed number of instructions.) You can use the menu commands, toolbar buttons, and shortcut keys in WinDbg.
You can use the commands in the following forms.
Command
WinDbg
button
WinDbg
command
Debug | Run to
Cursor
WinDbg
shortcut
keys
F7
Effect
(WinDbg only) Executes until it reaches the line that the cursor marks.
CTRL + F10
(CDB/KD only)
CTRL+C
Debug | Stop
Debugging
Debug | Break
SHIFT + F5
CTRL +
BREAK
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
.restart (Restart
Target Application)
g (Go)
gc (Go from
Conditional
Breakpoint)
gh (Go with
Exception Handled)
Debug | Restart
Debug | Go
CTRL +
SHIFT + F5
F5
gn (Go with
Exception Not
Handled)
gu (Go Up)
Debug | Go
Same as g (Go), except that the current exception is treated as handled.
Handled
Exception
Same as g (Go), except that the current exception is treated as unhandled.
Debug | Go
Unhandled
Exception
Debug | Step Out SHIFT + F11 Target executes until the current function is complete.
p (Step)
pa (Step to Address)
pc (Step to Next Call)
pct (Step to Next Call
or Return)
ph (Step to Next
Branching
Instruction)
pt (Step to Next
Return)
t (Trace)
Target executes one instruction. If this instruction is a function call, that function is executed as a
single step.
Target executes until it reaches the specified address. All steps in this function are displayed (but
steps in called functions are not).
Target executes until the next call instruction. If the current instruction is a call instruction, this call is
executed completely and execution continues until the next call.
Target executes until it reaches a call instruction or a return instruction.
Target executes until it reaches any kind of branching instruction, including conditional or
unconditional branches, calls, returns, and system calls.
Target executes until it reaches a return instruction.
Target executes one instruction. If this instruction is a function call, debugger traces into that call.
F8
ta (Trace to Address)
tb (Trace to Next
Branch)
tc (Trace to Next
Call)
tct (Trace to Next
Call or Return)
th (Trace to Next
Branching
Instruction)
tt (Trace to Next
Return)
wt (Trace and Watch
Data)
Target executes until it reaches the specified address. All steps in this function and called functions
are displayed.
(All modes, except kernel mode, only on x86-based systems) Target executes until it reaches the next
branch instruction.
Target executes until the next call instruction. If the current instruction is a call instruction, the
instruction is traced into until a new call is reached.
Target executes until it reaches a call instruction or return instruction. If the current instruction is a
call instruction or return instruction, the instruction is traced into until a new call or return is
reached.
Target executes until it reaches any kind of branching instruction, including conditional or
unconditional branches, calls, returns, and system calls. If the current instruction is a branching
instruction, the instruction is traced into until a new branching instruction is reached.
Target executes until it reaches a return instruction. If the current instruction is a return instruction,
the instruction is traced into until a new return is reached.
Target executes until the completion of the whole specified function. Statistics are then displayed.
For more information about how to restart the target computer, see Crashing and Rebooting the Target Computer.
Command-Line Options
If you do not want the application to stop immediately when it starts or loads, use CDB or WinDbg together with the -g command-line option. For more information about this
situation, see Initial Breakpoint.
CDB and WinDbg also support the -G command-line option. This option causes the debugging session to end if the application completes properly.
The following command tries to run the application from start to finish, and the debugger prompt appears only if an error occurs.
cdb -g -G ApplicationName
You can use the -pt command-line option to set the break time-out. There are certain problems that can make the target unable to communicate with the debugger. If a break
command is issued and the debugger cannot break into the target after this time, the debugger displays a "Break-in timed out" message.
At this point, the debugger stops trying to break into the target. Instead, the debugger pauses the target and enables you to examine (but not control) the target application.
The default time-out is 30 seconds.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Using Breakpoints
A breakpoint is a location in executable code at which the operating system stops execution and breaks into the debugger. This allows you to analyze the target and issue
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
debugger commands.
This section includes the following topics:
Methods of Controlling Breakpoints
Breakpoint Syntax
Unresolved Breakpoints (bu Breakpoints)
Processor Breakpoints (ba Breakpoints)
Initial Breakpoint
User Space and System Space
Risks Entailed When Setting Breakpoints
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
If you are debugging more than one process in user mode, the collection of breakpoints depends on the current process. To view or change a process' breakpoints, you must
select the process as the current process. For more information about the current process, see Controlling Processes and Threads.
Methods of Controlling and Displaying Breakpoints
To control or display breakpoints, you can use the following methods:
Use the bl (Breakpoint List) command to list existing breakpoints and their current status.
Use the .bpcmds (Display Breakpoint Commands) command to list all breakpoints along with the commands that were used to create them.
Use the bp (Set Breakpoint) command to set a new breakpoint.
Use the bu (Set Unresolved Breakpoint) command to set a new breakpoint. Breakpoints that are set with bu are called unresolved breakpoints; they have different
characteristics than breakpoints that are set with bp. For complete details, see Unresolved Breakpoints (bu Breakpoints).
Use the bm (Set Symbol Breakpoint) command to set new breakpoints on symbols that match a specified pattern. A breakpoint set with bm will be associated with an
address (like a bp breakpoint) if the /d switch is included; it will be unresolved (like a bu breakpoint) if this switch is not included.
Use the ba (Break on Access) command to set a processor breakpoint, also known as a data breakpoint. These breakpoints can be triggered when the memory location
is written to, when it is read, when it is executed as code, or when kernel I/O occurs. For complete details, see Processor Breakpoints (ba Breakpoints).
Use the bc (Breakpoint Clear) command to permanently remove one or more breakpoints.
Use the bd (Breakpoint Disable) command to temporarily disable one or more breakpoints.
Use the be (Breakpoint Enable) command to re-enable one or more disabled breakpoints.
Use the br (Breakpoint Renumber) command to change the ID of an existing breakpoint.
Use the bs (Update Breakpoint Command) command to change the command associated with an existing breakpoint.
Use the bsc (Update Conditional Breakpoint) command to change the condition under which an existing conditional breakpoint occurs.
(WinDbg only) The Disassembly window and the Source windows highlight lines that have breakpoints set. Enabled breakpoints are red, disabled breakpoints are
yellow, and a breakpoint that corresponds to the current program counter location is purple.
(WinDbg only) The Edit | Breakpoints command or the ALT+F9 shortcut key open the Breakpoints dialog box. This dialog box lists all breakpoints, and you can use
it to disable, enable, or clear existing breakpoints or to set new breakpoints.
(WinDbg only) If you set the cursor on a specific line in the Disassembly window or in a Source window, you can press F9 or click the Insert or remove button (
on the toolbar to set a breakpoint at that line. If you press the shortcut key or click the button when the active window is not the Disassembly window or a Source
window, it has the same effect as Edit | Breakpoints.
Each breakpoint has a decimal number called the breakpoint ID associated with it. This number identifies the breakpoint in various commands.
Breakpoint Commands
You can include a command in a breakpoint that is automatically executed when the breakpoint is hit.
For example, the following command breaks at MyFunction+0x47, writes a dump file, and then resumes execution.
0:000> bu MyFunction+0x47 ".dump c:\mydump.dmp; g"
Note If you are controlling the user-mode debugger from the kernel debugger, do not use g (Go) in the breakpoint command string. The serial interface might be unable to
keep up with this command, and you will be unable to break back into CDB. For more information about this situation, see Controlling the User-Mode Debugger from the
Kernel Debugger.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Number of Breakpoints
In kernel mode, you can use a maximum of 32 software breakpoints. In user mode, you can use any number of software breakpoints.
The number of processor breakpoints that are supported depends on the target processor architecture.
Conditional Breakpoints
You can set a breakpoint that is triggered only under certain conditions. For more information about these kinds of breakpoints, see Setting a Conditional Breakpoint.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Breakpoint Syntax
The following syntax elements can be used when creating a breakpoint, either through the Debugger Command window or through the WinDbg graphical interface.
Addresses in Breakpoints
Breakpoints support many kinds of address syntax, including virtual addresses, function offsets, and source line numbers. For example, you can use any of the following
commands to set breakpoints:
0:000> bp 0040108c
0:000> bp main+5c
0:000> bp `source.c:31`
For more information about this syntax, see Numerical Expression Syntax, Source Line Syntax, and the individual command topics.
Breakpoints on Methods
If you want to put a breakpoint on the MyMethod method in the MyClass class, you can use two different syntaxes:
In MASM expression syntax, you can indicate a method by a double colon or by a double underscore.
0:000> bp MyClass::MyMethod
0:000> bp MyClass__MyMethod
If you want to use a more complex breakpoint command, you should use MASM expression syntax. For more information about expression syntax, see Evaluating
Expressions.
Breakpoints Using Complicated Text
To set a breakpoint on complicated functions, including functions that contain spaces, as well as a member of a C++ public class, enclose the expression in parentheses. For
example, use bp (??MyPublic) or bp (operator new).
A more versatile technique is to use the @!"chars" syntax. This is a special escape in the MASM evaluator that enables you to provide arbitrary text for symbol resolution.
You must start with the three symbols @!" and end with a quotation mark ("). Without this syntax, you cannot use spaces, angle brackets (<, >), or other special characters in
symbol names in the MASM evaluator. This syntax is exclusively for names, and not parameters. Templates and overloads are the primary sources of symbols that require this
quote notation. You can also set the bu command by using the @!"chars" syntax, as the following code example shows.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
b?[@$t0]
Breakpoint Pseudo-Registers
If you want to refer to a breakpoint address in an expression, you can use a pseudo-register with the $bpNumber syntax, where Number is the breakpoint ID. For more
information about this syntax, see Pseudo-Register Syntax.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
A bp breakpoint location is always converted to an address. If a module change moves the code at which a bp breakpoint was set, the breakpoint remains at the same
address. On the other hand, a bu breakpoint remains associated with the symbolic value (typically a symbol plus an offset) that was used, and it tracks this symbolic
location even if its address changes.
If a bp breakpoint address is found in a loaded module, and if that module is later unloaded, the breakpoint is removed from the breakpoint list. On the other hand, bu
breakpoints persist after repeated unloads and loads.
Breakpoints that you set with bp are not saved in WinDbg workspaces. Breakpoints that are set with bu are saved in workspaces.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
overlapping operation. In such a situation, whether the breakpoint is triggered is processor-dependent. For details of how this situation is handled on a specific processor,
consult the processor archictecture manual and look for "debug register" or "debug control register". To take one specific processor type as an example, on an x86 processor, a
read or write breakpoint is triggered whenever the accessed range overlaps the breakpoint range.
Similarly, if an e (execute) breakpoint is set on the address 0x00401003, and then a two-byte instruction spanning the addresses 0x00401002 and 0x00401003 is executed, the
result is processor-dependent. Again, consult the processor architecture manual for details.
The processor distinguishes between breakpoints set by a user-mode debugger and breakpoints set by a kernel-mode debugger. A user-mode processor breakpoint does not
affect any kernel-mode processes. A kernel-mode processor breakpoint might or might not affect a user-mode process, depending on whether the user-mode code is using the
debug register state and whether there is a user-mode debugger that is attached.
To apply the current process' existing data breakpoints to a different register context, use the .apply_dbp (Apply Data Breakpoint to Context) command.
On a multiprocessor computer, each processor breakpoint applies to all processors. For example, if the current processor is 3 and you use the command ba e1 MyAddress
to put a breakpoint at MyAddress, any processor not only processor 3 that executes at that address triggers the breakpoint. This holds for software breakpoints as well.
Software Breakpoints
Software breakpoints, unlike processor breakpoints, are controlled by the debugger. When the debugger sets a software breakpoint at some location, it temporarily replaces the
contents of that memory location with a break instruction. The debugger remembers the original contents of this location, so that if this memory is displayed in the debugger,
the debugger will show the original contents of that memory location, not the break instruction. When the target process executes the code at this location, the break
instruction causes the process to break into the debugger. After you have performed whatever actions you choose, you can cause the target to resume execution, and execution
will resume with the instruction that was originally in that location.
Availability of Processor Breakpoint Types
On Windows Server 2003 with Service Pack 1 (SP1), on an Itanium-based computer that uses WOW64 to emulate x86, processor breakpoints do not work with the e
(execute) option but they do work with the r (read/write) and w (write) options.
The i (i/o) option is available only during kernel-mode debugging, with a target computer that is running Windows XP or a later version of Windows on an x86-based
processor.
Not all data sizes can be used with all processor breakpoint types. The permitted sizes depend on the processor of the target computer. For details, see ba (Break on Access).
Limitations of Software Breakpoints and Processor Breakpoints
It is possible to specify a data address rather than a program address when using the bp or bm /a commands. However, even if a data location is specified, these commands
create software breakpoints, not processor breakpoints. When the debugger places a software breakpoint at some location, it temporarily replaces the contents of that memory
location with a break instruction. This does not corrupt the executable image, because the debugger remembers the original contents of this location, and when the target
process attempts to execute this code the debugger can respond appropriately. But when a software breakpoint is set in a data location, the resulting overwrite can lead to data
corruption. Therefore, setting a software breakpoint on a data location is safe only if you are certain that this location will be used only as executable code.
The bp, bu, and bm commands set software breakpoints by replacing the processor instruction with a break instruction. Therefore these cannot be used in read-only code or
any other code that cannot be overwritten. To set a breakpoint in such code, you must use ba (Break on Access) with the e (execute) option.
You cannot create multiple processor breakpoints at the same address that differ only in the command that is automatically executed when the breakpoint is triggered.
However, you can create multiple breakpoints at the same address that differ in their other restrictions (for example, you can create multiple breakpoints at the same address
by using the ba command with different values of the /p, /t, /c, and /C options).
The initial breakpoint in a user-mode process (typically set on the main function or its equivalent) cannot be a processor breakpoint.
The number of processor breakpoints that are supported depends on the target processor architecture.
Controlling Software Breakpoints and Processor Breakpoints
Software breakpoints can be created with the bp (Set Breakpoint), bm (Set Symbol Breakpoint), and bu (Set Unresolved Breakpoint) commands. Processor breakpoints
can be created with the ba (Break on Access) command. Commands that disable, enable, and modify breakpoints apply to all kinds of breakpoints. Commands that display a
list of breakpoints include all breakpoints, and indicate the type of each. For a listing of these commands, see Methods of Controlling Breakpoints.
The WinDbg Breakpoints dialog box displays all breakpoints, indicating processor breakpoints with the notation "e", "r", "w", or "i' followed by the size of the block. This
dialog box can be used to modify any breakpoint. The Command text box on this dialog box can be used to create any type of breakpoint.If a processor breakpoint is desired,
begin the input with "ba". For details, see Edit | Breakpoints. When you set a breakpoint by using the mouse in the WinDbg Disassembly window or Source window, the
debugger creates an unresolved software breakpoint.
Processor breakpoints are stored in the processor's debug registers. It is possible to set a breakpoint by manually editing a debug register value, but this is strongly
discouraged.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Initial Breakpoint
When the debugger starts a new target application, an initial breakpoint automatically occurs after the main image and all statically-linked DLLs are loaded before any DLL
initialization routines are called.
When the debugger attaches to an existing user-mode application, an initial breakpoint occurs immediately.
The -g command-line option causes WinDbg or CDB to ignore the initial breakpoint. You can automatically execute a command at this point. For more information about this
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
5e
5b
c9
c21000
837ddc00
pop
pop
leave
ret
cmp
esi
ebx
0x10
dword ptr [ebp-0x24],0x0
The first three instructions are only one byte long. However, the fourth instruction is three bytes long. (It includes bytes 0x770000F4, 0x770000F5, and 0x770000F6.) If you
want to put a breakpoint on this instruction by using the bp, bu, or ba command, you must specify the 0x770000F4 address.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
If you put a breakpoint in the 0x770000F5 address by using the ba command, the processor puts a breakpoint at that location. But this breakpoint would never be triggered,
because the processor considers 0x770000F4 to be the actual address of the instruction.
If you put a breakpoint in the 0x770000F5 address by using the bp or bu commands, the debugger writes a breakpoint at that location. However, this breakpoint might corrupt
the target because of how the debugger creates breakpoints:
1. The debugger saves the contents of 0x770000F5 and overwrites this memory with a breakpoint instruction.
2. If you try to display this memory in the debugger, the debugger does not show the breakpoint instruction that it has written. Instead, the debugger shows the memory
that "should" be there. That is, the debugger shows the original memory, or any modifications to that memory that you have made since inserting the breakpoint.
3. If you use the BC command to remove the breakpoint, the debugger restores the original memory to its proper location.
When you put a breakpoint at 0x770000F5, the debugger saves this byte and a break instruction is written here. However, when the application runs, it reaches the
0x770000F4 address and recognizes this address as the first byte of a multibyte instruction. The processor then tries to combine 0x770000F4, 0x770000F5, and possibly some
later bytes into a single instruction. This combination can create a variety of behaviors, none of which are desirable.
Therefore, when you put breakpoints by using a bp, bu, or ba command, make sure that you always put the breakpoints at the proper address. If you are using the WinDbg
graphical interface to add breakpoints, you do not have to be concerned about this situation because the correct address is chosen automatically.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
The d* (Display Memory) command displays the contents of a specified memory address or range.
The e* (Enter Values) command writes a value to the specified memory address.
(WinDbg only) The Memory window displays the contents of a specified memory range and writes to any location in that range.
You can use the following commands to handle more specialized data types:
The dt (Display Type) command finds a variety of data types and displays data structures that have been created by the application that is being debugged. This
command is highly versatile and has many variations and options.
The ds, dS (Display String) command displays a STRING, ANSI_STRING, or UNICODE_STRING data structure.
The dl (Display Linked List) command traces and displays a linked list.
The d*s (Display Words and Symbols) command finds double-words or quad-words that might contain symbol information and then displays the data and the symbol
information.
The !address extension command displays information about the properties of the memory that is located at a specific address.
The m (Move Memory) command moves the contents of one memory range to another.
The f (Fill Memory) command writes a pattern to a memory range, repeating it until the range is full.
The c (Compare Memory) command compares the contents of two memory ranges.
The s (Search Memory) command searches for a specified pattern within a memory range or searches for any ASCII or Unicode characters that exist in a memory
range.
The .holdmem (Hold and Compare Memory) command compares one memory range to another.
In most situations, these commands interpret their parameters in the current radix. Therefore, you should add 0x before hexadecimal addresses if the current radix is not 16.
However, the display output of these commands is typically in hexadecimal format, regardless of the current radix. (For more information about the output, see the individual
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
command topics.) The Memory window displays integers and real numbers in decimal format and displays other formats in hexadecimal format.
To change the default radix, use the n (Set Number Base) command. To quickly convert numbers from one base to another, use the ? (Evaluate Expression) command or
the .formats (Show Number Formats) command.
When you are performing user-mode debugging, the meaning of virtual addresses is determined by the current process. When you are performing kernel-mode debugging, the
meaning of virtual addresses can be controlled by the debugger. For more information, see Process Context.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
00000053
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The dv (Display Local Variables) command displays the names and values of all local variables.
(WinDbg only) The Locals window displays the names and values of all local variables. You can also use this window to change the values of these variables.
The !for_each_local extension enables you to execute a single command repeatedly, once for each local variable.
However, there is one primary difference between local and global variables. When an application is executing, the meaning of local variables depends on the location of the
program counter, because the scope of such variables extends only to the function in which they are defined.
The debugger interprets local variables according to the local context. By default, this context matches the location of the program counter. But the debugger can change the
context. For more information about the local context, see Local Context.
When the local context is changed, the Locals window is immediately updated to reflect the new collection of local variables. The DV command also shows the new
variables. All of these variable names are then interpreted correctly by the memory commands that are described earlier. You can then read or write to these variables.
When you are debugging optimized code, some local variables might be collapsed, replaced with a register, or perhaps even temporarily stored on the stack. If you want to use
source files or local variables while you are debugging, you should not optimize your code.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Use the r (Registers) command to display or control the registers. You can customize this display by using several options or by using the rm (Register Mask)
command.
(WinDbg only) Use the Registers window to display or control the registers. You can customize the window to display the registers in any order.
(WinDbg only) Use the Watch window to display any list of registers or variables. You cannot use this window to alter the value of registers.
Registers are also automatically displayed every time that the target stops. If you are stepping through your code with the p (Step) or t (Trace) commands, you see a register
display at every step. To stop this display, use the r option when you use these commands.
On an x86-based processor, the r option also controls several one-bit registers known as flags. To change these flags, you use a slightly different syntax than changing regular
registers. For more information about these flags and an explanation of this syntax, see x86 Flags.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
To display the call stack, you can use the following methods:
The k (Display Stack Backtrace) command is the basic stack trace command. This command displays the base pointer for the stack frame, the return address, and the
name of the function. If source line information is available, k also displays source modules and line numbers.
The kb (Display Stack Backtrace) command displays the same stack as the k command and displays the first three parameters that were passed to the function.
The kp (Display Stack Backtrace) command displays the same stack as the kb command and displays a full listing of the parameters that were passed to each function.
The kv (Display Stack Backtrace) command displays the same stack as the kb command and displays additional frame pointer omission (FPO) information. On an
x86-based processor, this command also displays calling convention information. On an Itanium-based processor, this command also displays nonvolatile registers.
The kd (Display Stack Backtrace) command displays the raw stack data, without any formatting.
(WinDbg only) The Calls window displays call stack information. You can customize this window to display different stack data. You can also use this window to
quickly jump to the corresponding function in a Source window or Disassembly window.
If you try to display the call stack at the very beginning of a function (before the function prolog has been executed), you probably see incorrect results. The debugger uses the
frame register to compute the current backtrace, and this register is not set correctly for a function until its prolog has been executed.
The call stack that is displayed is based on the current program counter, unless you change the register context. For more information about how to change the register
context, see Changing Contexts.
A variety of problems can make it difficult to obtain an accurate stack trace. For more information about this matter, see Getting a Stack Trace.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
The u (Unassemble) command disassembles and displays a specified section of machine language.
The uf (Unassemble Function) command disassembles and displays a function.
The up (Unassemble from Physical Memory) command disassembles and displays a specified section of machine language that has been stored in physical memory.
The ur (Unassemble Real Mode BIOS) command disassembles and displays a specified 16-bit real-mode code.
The ux (Unassemble x86 BIOS) command disassembles and displays the x86-based BIOS code instruction set at a specified address.
(WinDbg only) The Disassembly window disassembles and displays a specified section of machine language. This window is automatically active if you select the
Automatically Open Disassembly command on the Window menu. You can also open this window by clicking Disassembly on the View menu, pressing ALT+7, or
pressing the Disassembly (Alt+7) button (
The disassembly display appears in four columns: address offset, binary code, assembly language mnemonic, and assembly language details. The following example shows
this display.
0040116b
0040116c
0040116d
45
fc
8945b0
inc
cld
mov
ebp
eax,[ebp-0x1c]
To the right of the line that represents the current program counter, the display shows the values of any memory locations or registers that are being accessed. If this line
contains a branch instruction, the notation [br=1] or [br=0] appears. This notation indicates a branch that is or is not taken, respectively.
You can use the .asm (Change Disassembly Options) command to change how the disassembled instructions are displayed.
In WinDbg's Disassembly window, the line that represents the current program counter is highlighted in green. Lines where breakpoints are set are highlighted in red (an
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
enabled breakpoint), yellow (a disabled breakpoint), or purple (a breakpoint that coincides with the current program counter).
You can also use the following commands to manipulate assembly code:
The # (Search for Disassembly Pattern) command searches a region of memory for a specific pattern. This command is equivalent to searching the four columns of
the disassembly display.
The a (Assemble) command can take assembly instructions and translate them into binary machine code.
Use the l+, l- (Set Source Options) command to control the mode. The l-t command activates assembly mode.
(WinDbg only) Clear the Source Mode command on the Debug menu to cause the debugger to enter assembly mode.You can also click the Source mode off button (
) on the toolbar.
In WinDbg, when you are in assembly mode, ASM appears visible on the status bar.
The shortcut menu in WinDbg's Disassembly window includes the Highlight instructions from the current source line command. This command highlights all of the
instructions that correspond to the current source line. Frequently, a single source line corresponds to multiple assembly instructions. If code has been optimized, these
assembly instructions might not be consecutive. The Highlight instructions from the current source line command enables you to find all of the instructions that were
assembled from the current source line.
Assembly Language Source Files
If your application was written in assembly language, the disassembly that the debugger produces might not exactly match your original code. In particular, NO-OPs and
comments will not be present.
If you want to debug your code by referencing the original .asm files, you must use source mode debugging. You can load the assembly file like a C or C++ source file. For
more information about this kind of debugging, see Debugging in Source Mode.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
If the application throws an exception, it breaks into the debugger. Source information is available at this point. However, if you issue a break by using the CTRL+C,
CTRL+BREAK, or Debug | Break command, the debugger creates a new thread, so you cannot see your source code.
After you have reached a thread that you have source files for, you can use the Debugger Command window to execute source debugging commands. If you are using
WinDbg, the Source window appears. If you have already opened a Source window by clicking Open Source File on the File menu, WinDbg typically create a new window
for the source. You can close the previous window without affecting the debugging process.
Source Debugging in the WinDbg GUI
If you are using WinDbg, a Source window appears as soon as the program counter is in code that the debugger has source information for.
WinDbg displays one Source window for each source file that you or WinDbg opened. For more information about the text properties of this window, see Source Windows.
You can then step through your application or execute to a breakpoint or to the cursor. For more information about stepping and tracing commands, see Controlling the
Target.
If you are in source mode, the appropriate Source window moves to the foreground as you step through your application. Because there are also Microsoft Windows routines
that are called during the application's execution, the debugger might move a Disassembly window to the foreground when this kind of call occurs (because the debugger does
not have access to the source for these functions). When the program counter returns to known source files, the appropriate Source window becomes active.
As you move through the application, WinDbg highlights your location in the Source window and the Disassembly window in green. Lines at which breakpoints are set are
also highlighted in red (enabled breakpoints), yellow (disabled breakpoints), or purple (if a breakpoint coincides with the current program counter). The source code is colored
according to the parsing of the language. If the Source window has been selected, you can hover over a symbol with the mouse to evaluate it. For more information about
these features and how to control them, see Source Windows.
To activate source mode in WinDbg, use the l+t command, click Source Mode on the Debug menu, or click the Source mode on button (
) on the toolbar.
When source mode is active, the ASM indicator appears unavailable on the status bar.
You can view or alter the values of any local variables as you step through a function in source mode. For more information, see Reading and Writing Memory.
Source Debugging in the Debugger Command Window
If you are using CDB, you do not have a separate Source window. However, you can still view your progress as you step through the source.
Before you can do source debugging in CDB, you have to load source line symbols by issuing the .lines (Toggle Source Line Support) command or by starting the debugger
with the -lines command-line option.
If you execute an l+t command, all program stepping is performed one source line at a time. Use l-t to step one assembly instruction at a time. If you are using WinDbg, this
command has the same effect as selecting or clearing Source Mode on the Debug menu or using the toolbar buttons.
The l+s command displays the current source line and line number at the prompt. If you want to see only the line number, use l+l instead.
If you use l+o and l+s, only the source line is displayed while you step through the program. The program counter, disassembly code, and register information are hidden.
This kind of display enables you to quickly step through the code and view nothing but the source.
You can use the lsp (Set Number of Source Lines) command to specify exactly how many source lines are displayed when you step through or execute the application.
The following sequence of commands is an effective way to step through a source file.
.lines
bp main
l+t
l+s
g
pr
p
Because ENTER repeats the last command, you can now step through the application by using the ENTER key. Each step causes the source line, memory offset, and
assembly code to appear.
For more information about how to interpret the disassembly display, see Debugging in Assembly Mode.
When the assembly code is displayed, any memory location that is being accessed is displayed at the right end of the line. You can use the d* (Display Memory) and e*
(Enter Values) commands to view or change the values in these locations.
If you have to view each assembly instruction to determine offsets or memory information, use l-t to step by assembly instructions instead of source lines. The source line
information can still be displayed. Each source line corresponds to one or more assembly instructions.
All of these commands are available in WinDbg and in CDB. You can use the commands to view source line information from WinDbg's Debugger Command window
instead of from the Source window.
Source Lines and Offsets
You can also perform source debugging by using the expression evaluator to determine the offset that corresponds to a specific source line.
The following command displays a memory offset.
? `[[module!]filename][:linenumber]`
If you omit filename, the debugger searches for the source file that corresponds to the current program counter.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The debugger reads linenumber as a decimal number unless you add 0x before it, regardless of the current default radix. If you omit linenumber, the expression evaluates to
the initial address of the executable file that corresponds to the source file.
This syntax is understood in CDB only if the .lines command or the -lines command-line option has loaded source line symbols.
This technique is very versatile, because you can use it regardless of where the program counter is pointing. For example, this technique enables you to set breakpoints in
advance, by using commands such as the following.
bp `source.c:31`
For more information, see Source Line Syntax and Using Breakpoints.
Stepping and Tracing in Source Mode
When you are debugging in source mode, there can be multiple function calls on a single source line. You cannot use the p and t commands to separate these function calls.
For example, in the following command, the t command steps into both GetTickCount and printf, while the p command steps over both function calls.
printf( "%x\n", GetTickCount() );
If you want to step over certain calls while tracing into other calls, use .step_filter (Set Step Filter) to indicate which calls to step over.
You can use _step_filter to filter out framework functions (for example, Microsoft Foundation Classes (MFC) or Active Template Library (ATL) calls).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
The current or active system is the system that you are currently debugging.
Acquiring Multiple Targets
The first target is acquired in the usual manner.
You can debug additional live user-mode applications by using the .attach (Attach to Process) or .create (Create Process) command, followed by the g (Go) command.
You can debug additional dump files by using the .opendump (Open Dump File) command, followed by the g (Go) command. You can also open multiple dump files when
the debugger is started. To open multiple dump files, include multiple -z switches in the command, each followed by a different file name.
You can use the preceding commands even if the processes are on different systems. You must start a process server on each system and then use the -premote parameter
with .attach or .create to identify the proper process server. If you use the .attach or .create command again without specifying the -premote parameter, the debugger
attaches to, or creates, a process on the current system.
Manipulating Systems and Targets
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
When debugging begins, the current system is the one that the debugger most recently attached to. If an exception occurs, the current system switches to the system that this
exception occurred on.
To close one target and continue to debug the other targets, use the .kill (Kill Process) command. On Microsoft Windows XP and later versions of Windows, you can use
the .detach (Detach from Process) command or WinDbg's Debug | Detach Debuggee menu command instead. These commands detach the debugger from the target but
leave the target running.
To control the debugging of multiple systems, you can use the following methods:
The || (System Status) command displays information about one or more systems
The ||s (Set Current System) command enables you to select the current system
(WinDbg only) The Processes and Threads window enables you display or select systems, processes, and threads
By using these commands to select the current system, and by using the standard commands to select the current process and thread, you can determine the context of
commands that display memory and registers.
However, you cannot separate execution of these processes. The g (Go) command always causes all targets to execute together.
Note We recommend that you do not debug live targets and dump targets together, because commands behave differently for each type of debugging. For example, if you use
the g (Go) command when the current system is a dump file, the debugger begins executing, but you cannot break back into the debugger, because the break command is not
recognized as valid for dump file debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Issue a q (Quit) command in KD to save the log file, end the debugging session, and exit the debugger. The target computer remains locked.
Press CTRL+B and then press ENTER to end the debugger abruptly. If you want the target computer to continue to run after the debugger is ended, you must use this
method. Because CTRL+B does not remove breakpoints, you should use the following commands first.
kd>
kd>
kd>
bc *
g
<CTRL+B> <ENTER>
Exiting the debugger by using CTRL+B does not clear kernel-mode breakpoints, but attaching a new kernel debugger does clear these breakpoints.
When you are perfomring remote debugging, q ends the debugging session. CTRL+B exits the debugger but leaves the session active. This situation enables another debugger
to connect to the session.
If the q command does not work, press CTRL+R and then press ENTER on the host computer's keyboard, and then retry the q command. If this procedure does not work, you
must use CTRL+B to exit the debugger.
Exiting WinDbg
You can exit WinDbg by clicking Exit on the File menu or by pressing ALT+F4.
If you are performing user-mode debugging, these commands close the application that you are debugging, unless you used the -pd command-line option when you started the
debugger.
If you are performing kernel-mode debugging, the target computer remains in its current state. This situation enables you to leave the target running or frozen. (If you leave
the target frozen, any future connection from a kernel debugger can resume debugging where you left it.)
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
) on the toolbar
To end a user-mode debugging session, return the debugger to dormant mode, and set the target application running again, you can use the following methods:
(Windows XP and later versions of Windows) The .detach (Detach from Process) command. If you are debugging multiple targets, this command detaches from the
current target and continues the debugging session with the remaining targets.
(Windows XP and later versions of Windows, WinDbg only) The Debug | Detach Debuggee command. If you are debugging multiple targets, this command detaches
from all current targets.
(Windows XP and later versions of Windows) The qd (Quit and Detach) command.
(Windows XP and later versions of Windows) The q (Quit) command, if you started the debugger with the -pd option.
You can detach from a target only in Windows XP and later versions of Windows. On Windows 2000, the qd command or the -pd option generates a warning message and
has no effect. These operating systems do not allow a debugger to detach from its target application. If the target must not end, you should use noninvasive debugging instead.
For more information, see Noninvasive Debugging (User Mode).
To end a user-mode debugging session, return the debugger to dormant mode, but leave the target application in the debugging state, you can use the following method:
(Windows XP and later versions of Windows) The .abandon (Abandon Process) command
For more information about reattaching to the target, see Reattaching to the Target Application.
Ending a Kernel-Mode Session Without Exiting
To end a kernel-mode debugging session, return the debugger to dormant mode, and leave the target computer frozen, you can use the following methods:
(WinDbg only) The Q (Quit) command (unless you started the debugger with the -pd option)
(WinDbg only) The Debug | Stop Debugging menu command
(WinDbg only) The SHIFT+F5 shortcut key
) on the toolbar
When a WinDbg session ends, you are prompted to save the workspace for the current session, and then WinDbg returns to dormant mode. At this point, you can use all
starting options. That is, you can start to debug a running process, spawn a new process, attach to a target computer, open a crash dump, or connect to a remote debugging
session. For more information about all of these options, see Starting the Debugger.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Debug Privilege
Debug privilege is a security policy setting that allows users to attach a debugger to a process or to the kernel. An administrator can modify a security policy for a user group
to include or to remove this functionality. Developers who are debugging their own applications do not need this user privilege. Developers who are debugging system
components or who are debugging remote components will need this user privilege. This user privilege provides complete access to sensitive and critical operating system
components. By default, this property is enabled for users with Administrator rights. A user with Administrator privileges can enable this property for other user groups.
Modifying Debug Privilege for a Process
A developer can programmatically alter the debug privilege for a specific process to prevent anyone from debugging that process. Disabling this privilege from within a
process prevents anyone from attaching a debugger to the process. The following example illustrates how one can disable the debug privilege.
//
// SetPrivilege enables/disables process token privilege.
//
BOOL SetPrivilege(HANDLE hToken, LPCTSTR lpszPrivilege, BOOL bEnablePrivilege)
{
LUID luid;
BOOL bRet=FALSE;
if (LookupPrivilegeValue(NULL, lpszPrivilege, &luid))
{
TOKEN_PRIVILEGE tp;
tp.PrivilegeCount=1;
tp.Privileges[0].Luid=luid;
tp.Privileges[0].Attributes=(bEnablePrivilege) ? SE_PRIVILEGE_ENABLED: 0;
//
// Enable the privilege or disable all privileges.
//
if (AdjustTokenPrivileges(hToken, FALSE, &tp, NULL, (PTOKEN_PRIVILEGES)NULL, (PDWORD)NULL))
{
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
//
// Check to see if you have proper access.
// You may get "ERROR_NOT_ALL_ASSIGNED".
//
bRet=(GetLastError() == ERROR_SUCCESS);
}
}
return bRet;
}
The following example shows how to use this function:
HANDLE hProcess=GetCurrentProcess();
HANDLE hToken;
if (OpenProcessToken(hProcess, TOKEN_ADJUST_PRIVILEGES, &hToken))
{
SetPrivilege(hToken, SE_DEBUG_NAME, FALSE);
CloseHandle(hToken);
}
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The ~n (Suspend Thread) command increments the specified thread's suspend count by one.
The ~m (Resume Thread) command decrements the specified thread's suspend count by one.
The most common use for these commands is to raise a specific thread's suspend count from one to two. When the debugger executes or detaches from the process, the thread
then has a suspend count of one and remains suspended, even if other threads in the process are executing.
You can suspend threads even when you are performing noninvasive debugging.
The debugger can also freeze a thread. This action is similar to suspending the thread in some ways. However, "frozen" is only a debugger setting. Nothing in the Windows
operating system recognizes that anything is different about this thread.
By default, all threads are unfrozen. When the debugger causes a process to execute, threads that are frozen do not execute. However, if the debugger detaches from the
process, all threads unfreeze.
To freeze and unfreeze individual threads, you can use the following methods:
In any event, threads that belong to the target process never execute when the debugger has broken into the target. The suspend count of a thread affects the thread's behavior
only when the debugger executes the process or detaches. The frozen status affects the thread's behavior only when the debugger executes the process.
Threads and Processes in Other Commands
You can add thread specifiers or process specifiers before many other commands. For more information, see the individual command topics.
You can add the ~e (Thread-Specific Command) qualifier before many commands and extension commands. This qualifier causes the command to be executed with respect
to the specified thread. This qualifier is especially useful if you want to apply a command to more than one thread. For example, the following command repeats the !gle
extension command for every thread that is being debugged.
~*e !gle
Multiple Systems
The debugger can attach to multiple targets at the same time. When these processes include dump files or include live targets on more than one computer, the debugger
references a system, process, and thread for each action. For more information about this kind of debugging, see Debugging Multiple Targets.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
By default, Microsoft Visual C++ .NET does not build managed applications. You must request this kind of build through a command-line switch or through the graphical
interface.
Debugging Managed Code
You can debug managed code by using the Sos.dll extension. This extension is located in the \clr10 subdirectory of the Debugging Tools for Windows installation.
To use this extension, load it and then type !clr10\sos.help..
This command lists all available extension commands and their parameters.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
To set an automatic breakpoint when the first kernel module loads, use the -d command-line option.
To set an automatic breakpoint when the kernel initializes, use the -b command-line option.
You can also change the break state after the debugger is running:
Control the initial module load and kernel initialization breakpoints like all exceptions and events. You can break into the debugger when these events occur, or ignore
them. You can also have a specified command automatically execute when these breakpoints are hit. For more information, see Controlling Exceptions and Events.
Use the CTRL+K shortcut keys in KD, the CTRL+ALT+K shortcut keys in WinDbg, and the Debug | Kernel Connection | Cycle Initial Break command in WinDbg
to change the break state. Every time that you use these commands, the debugger switches between three states: no automatic break, break upon kernel initialization,
and break on first kernel module load. This method cannot activate both automatic breakpoints at the same time.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The .restart (Restart Kernel Connection) command provides a more powerful method of resynchronization. This command is equivalent to exiting the debugger and then
attaching a new debugger to the existing session. This command is available only in KD, not in WinDbg.
The .restart command is most useful when you are performing remote debugging through remote.exe. (In this kind of debugging, it might be difficult to end and restart the
debugger.) However, you cannot use .restart from a debugging client if you are performing remote debugging through the debugger.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Changing Contexts
In kernel-mode debugging, there are many processes, threads, and sometimes user sessions that are executing at the same time. Therfore, phrases such as "virtual address
0x80002000" or "the eax register" are ambiguous. You must specify the context in which such phrases can be understood.
The debugger has five different contexts that you can set while you are debugging:
1. The session context indicates the default user session. (This context applies to only Microsoft Windows XP and later versions of Windows. These operating systems
allow multiple logon sessions to coexist.)
2. The process context determines how the debugger interprets virtual addresses.
3. The user-mode address context is almost never set directly. This context is automatically set when you change the process context.
4. The register context determines how the debugger interprets registers and also controls the results of a stack trace. This context is also known as the thread context,
although that term is not completely accurate. An explicit context is also a type of register context. If you specify an explicit context, that context is used instead of the
current register context.
5. The local context determines how the debugger interprets local variables. This context is also known as the scope.
Session Context
In Windows XP and later versions of Windows, multiple logon sessions can run at the same time. Each logon session has its own processes.
The !session extension displays all logon sessions or changes the current session context.
The session context is used by the !sprocess and !spoolused extensions when the session number is entered as "-2".
When the session context is changed, the process context is automatically changed to the active process for that session.
Process Context
Each process has its own page directory that records how virtual addresses are mapped to physical addresses. When any thread within a process is executing, the Windows
operating system uses this page directory to interpret virtual addresses.
During user-mode debugging, the current process determines the process context. Virtual addresses that are used in debugger commands, extensions, and debugging
information windows are interpreted by using the page directory of the current process.
During kernel-mode debugging, you can set the process context by using the .process (Set Process Context) command. Use this command to select which process's page
directory is used to interpret virtual addresses. After you set the process context, you can use this context in any command that takes addresses. You can even set breakpoints
at this address. By including a /i option in the .process command to specify invasive debugging, you can also use the kernel debugger to set breakpoints in user space.
You can also set user-mode breakpoints from the kernel debugger by using a process-specific breakpoint on a kernel-space function. Set strategic breakpoints and wait for the
appropriate context to come up.
The user-mode address context is part of the process context. Typically, you do not have to set the user-mode address context directly. If you set the process context, the usermode address context automatically changes to the directory base of the relevant page table for the process. However, on an Itanium-based processor, a single process might
have more than one page directory. In this situation, you can use the .context (Set User-Mode Address Context) command to change the user-mode address context.
When you set the process context during kernel-mode debugging, that process context is retained until another .process command changes the context. The user-mode address
context is also retained until a .process or .context command changes it. These contexts are not changed when the target computer executes, and they are not affected by
changes to the register context or the local context.
Register Context
Each thread has its own register values. These values are stored in the CPU registers when the thread is executing and are stored in memory when another thread is executing.
During user-mode debugging, the current thread typically determines the register context. Any reference to registers in debugger commands, extensions, and debugging
information windows is interpreted according to the current thread's registers.
You can change the register context to a value other than the current thread while you are performing user-mode debugging by using one of the following commands:
.cxr (Display Context Record)
.ecxr (Display Exception Context Record)
During kernel-mode debugging, you can control the register context by using a variety of debugger commands, including the following commands:
.thread (Set Register Context)
.cxr (Display Context Record)
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Local Context
When a program is executing, the meaning of local variables depends on the location of the program counter, because the scope of such variables extends only to the function
that they are defined in.
When you are performing user-mode or kernel-mode debugging, the debugger uses the scope of the current function (the current frame on the stack) as the local context. To
change this context, use the .frame (Set Local Context) command, or double-click the desired frame in the Calls window.
In user-mode debugging, the local context is always a frame within the stack trace of the current thread. In kernel-mode debugging, the local context is always a frame within
the stack trace of the current register context's thread.
You can use only one stack frame at a time for the local context. Local variables in other frames cannot be accessed.
The local context is reset if any of the following events occur:
The !for_each_frame extension enables you to execute a single command repeatedly, once for each frame in the stack. This command changes the local context for each
frame, executes the specified command, and then returns the local context to its original value.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Use the .kdfiles (Set Driver Replacement Map) command after you start the kernel debugger.
D:\Debugging Tools for Windows> kd
kd> .kdfiles d:\Map_Files\mymap.ini
KD file associations loaded from 'd:\Map_Files\mymap.ini'
You can also use the .kdfiles command to display the current driver replacement map file or to delete the driver replacement map. If you do not use this
command, the map persists until you exit the debugger.
After you complete this procedure, the driver replacement map takes effect.
Whenever the target computer is about to load a driver, it queries the kernel debugger to determine whether this driver has been mapped. If the driver has been mapped, the
replacement file is sent over the kernel connection and copied over the old driver file. The new driver is then loaded.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Because the target computer bypasses its Boot.ini file, you cannot set the kernel connection protocol in the typical manner. You must make the connection through the COM1
port on the target computer. The baud rate is 115200. Therefore, the kernel debugger on the host computer should be configured to use a COM connection at the 115200
speed.
This special method applies only to boot drivers (that is, Acpi.sys, Classpnp.sys, Disk.sys, and anything else that lm t n displays at the initial Windows breakpoint). If you
have to replace a standard driver that MmLoadSystemImage loads after the boot has been completed, you should use the standard method described earlier.
You cannot replace boot drivers on a computer that uses EFI firmware instead of the Boot.ini file (for example, an Itanium-based computer).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Execution commands, such as g (Go), p (Step), t (Trace), wt (Trace and Watch Data), tb (Trace to Next Branch), gh (Go with Exception Handled), and gn (Go
with Exception Not Handled)
Shutdown and dump file commands, such as .crash, .dump, and .reboot
Breakpoint commands, such as bp, bu, ba, bc, bd, be, and bl
Register display commands, such as r and variations
Stack trace commands, such as k and variations
If you are performing local kernel debugging with WinDbg, all of the equivalent menu commands and buttons are also unavailable.
Commands That Are Available
All memory input and output commands are available. You can freely read from user memory and kernel memory. You can also write to memory. Make sure that you do not
write to the wrong part of kernel memory, because it can corrupt data structures and frequently causes the computer to stop responding (that is, crash).
Difficulties in Performing Local Kernel Debugging
Local kernel debugging is a very delicate operation. Be careful that you do not corrupt or crash the system.
One of the most difficult aspects of local kernel debugging is that the machine state is constantly changing. Memory is paged in and out, the active process constantly changes,
and virtual address contexts do not remain constant. However, under these conditions, you can effectively analyze things that change slowly, such as certain device states.
Kernel-mode drivers and the Windows operating system frequently send messages to the kernel debugger by using DbgPrint and related functions. These messages are not
automatically displayed during local kernel debugging. You can display them by using the !dbgprint extension.
LiveKD
The LiveKD tool simulates local kernel debugging. This tool creates a "snapshot" dump file of the kernel memory, without actually stopping the kernel while this snapshot is
made. (Therefore, the snapshot might not actually show a single instant state of the computer.)
LiveKD is not part of the Debugging Tools for Windows package. You can download
Debugger Extensions
CDB, KD, and WinDbg all allow the use of debugger extension commands. These extensions give these three Microsoft debuggers a great degree of power and flexibility.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Debugger extension commands are used much like the standard debugger commands. However, while the built-in debugger commands are part of the debugger binaries
themselves, debugger extension commands are exposed by DLLs distinct from the debugger.
This allows you to write new debugger commands which are tailored to your specific need. In addition, a number of debugger extension DLLs are shipped with the debugging
tools themselves.
This section includes:
Loading Debugger Extension DLLs
Using Debugger Extension Commands
Writing New Debugger Extensions
For information about specific extension commands, see the Debugger Extension Commands reference section.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
(Before starting the debugger) Use the _NT_DEBUGGER_EXTENSION_PATH environment variable to set the default path for extension DLLs. This can be a
number of directory paths, separated by semicolons.
Use the .load (Load Extension DLL) command to load a new DLL.
Use the .unload (Unload Extension DLL) command to unload a DLL.
Use the .unloadall (Unload All Extension DLLs) command to unload all debugger extensions.
(Before starting the debugger; CDB only) Use the tools.ini file to set the default extension DLL.
(Before starting the debugger) Use the -a command-line option to set the default extension DLL.
Use the .extpath (Set Extension Path) command to set the extension DLL search path.
Use the .setdll (Set Default Extension DLL) command to set the default extension DLL.
Use the .chain (List Debugger Extensions) command to display all loaded debugger extension modules, in their default search order.
You can also load an extension DLL simply by using the full !module.extension syntax the first time you issue a command from that module. See Using Debugger Extension
Commands for details.
The extension DLLs that you are using must match the operating system of the target computer. The extension DLLs that ship with the Debugging Tools for Windows
package are each placed in a different subdirectory of the installation directory:
The w2kfre directory contains extensions that can be used with the free build of Microsoft Windows 2000.
The w2kchk directory contains extensions that can be used with the checked build of Windows 2000.
The winxp directory contains extensions that can be used with Windows XP and later versions of Windows.
The winext directory contains extensions that can be used with any version of Windows. The dbghelp.dll module, located in the base directory of Debugging Tools for
Windows, also contains extensions of this type.
If you write your own debugger extensions, you can place them in any directory. However, it is advised that you place them in a new directory and add that directory to the
debugger extension path.
There can be as many as 32 extension DLLs loaded.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Search Order
If the module name is not specified, the debugger will search the loaded extension modules for this export.
The default search order is as follows:
1. The extension modules that work with all operating systems and in both modes: dbghelp.dll and winext\ext.dll.
2. The extension module that works in all modes but is operating-system-specific. For Windows XP and later versions of Windows, this is winxp\exts.dll. There is no
corresponding module for Windows 2000.
3. The extension module that works with all operating systems but is mode-specific. For kernel mode, this is winext\kext.dll. For user mode, this is winext\uext.dll.
4. The extension module that is both operating-system-specific and mode-specific. The following table specifies this module.
Windows Build
User Mode
Kernel Mode
Windows 2000
w2kfre \ ntsdexts.dll w2kfre \ kdextx86.dll
(free build)
Windows 2000
w2kchk \ ntsdexts.dll w2kchk \ kdextx86.dll
(checked build)
Windows XP and later winxp \ ntsdexts.dll winxp \ kdexts.dll
When an extension module is unloaded, it is removed from the search chain. When an extension module is loaded, it is added to the beginning of the search order.
The .setdll (Set Default Extension DLL) command can be used to promote any module to the top of the search chain. By using this command repeatedly, you can completely
control the search chain.
Use the .chain (List Debugger Extensions) command to display a list of all loaded extension modules in their current search order.
If you attempt to execute an extension command that is not in any of the loaded extension modules, you will get an Export Not Found error message.
Additional Information
For information about specific extension commands, see the Debugger Extension Commands reference section.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
DbgEng extensions. These are based on the prototypes in the dbgeng.h header file, and also those in the wdbgexts.h header file.
WdbgExts extensions. These are based on the prototypes in the wdbgexts.h header file alone.
For information about how to write debugger extensions, see Writing DbgEng Extensions and Writing WdbgExts Extensions.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Remote Debugging
This section includes:
Choosing the Best Remote Debugging Method
Remote Debugging Through the Debugger
Remote Debugging Through Remote.exe
Other Methods of Remote Debugging
Remote user-mode debugging involves two computers: the client and the server. The server is the machine that has the application to be debugged and the user-mode
debugger. The client is the machine that will remotely control the debugging session.
Remote kernel-mode debugging involves three computers: the client, the server, and the target computer. The target computer is the machine to be debugged. The server is a
machine with a kernel debugger, located at the same physical location as the target computer. The client is the machine that will remotely control the debugging session. See
Configuring Hardware for Kernel-Mode Debugging for details on the connection between the server and the target computer.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Remote debugging through the debugger is usually the best method. If you simply have one server and one client and they can freely connect to each other, the same
debugger binaries are installed on both the client and the server, and the debugging technician who will be operating the client will be able to talk to someone in the
room with the server, this is the recommended method.
The client and the server can be running any version of Windows. They do not have to be running the same version as each other.
If the client is unable to send a connection request to the server, but the server is able to send a request to the client, you can use remote debugging through the debugger
with a reverse connection by using the clicon parameter.
Remote debugging through remote.exe is used to remotely control a Command Prompt window. It can be used to remotely control KD, CDB, or NTSD. It cannot be
used with WinDbg.
If your client does not have copies of the debugger binaries, you must use the remote.exe method.
A process server or a KD connection server can be used if the debugging technician will not be able to talk to someone in the room with the server. All the actual
debugging work is done by the client (called the smart client); this removes the need to have a second person present at the server itself.
Process servers are used for user-mode debugging; KD connection servers are used for kernel-mode debugging. Other than this distinction, they behave in similar ways.
This method is also useful if the computer where the server will be running cannot handle heavy process loads, or if the technician running the client has access to
symbol files or source files that are confidential and cannot be accessed by the server. However, this method is not as fast or efficient as remote debugging through the
debugger. This method cannot be used for dump-file debugging.
See Process Servers (User Mode) and KD Connection Servers (Kernel Mode) for details.
A repeater is a lightweight proxy server that relays data between two computers. You can add a repeater between the client and the server if you are performing remote
debugging through the debugger or if you are using a process server.
Using a repeater may be necessary if your client and your server are unable to talk directly to each other, but can each access an outside computer. You can use reverseconnections with repeaters as well. It is even possible to use two repeaters in a row, but this is rarely necessary.
See Repeaters for details.
It is also possible to control CDB (or NTSD) from the kernel debugger. This is yet another form of remote debugging. See Controlling the User-Mode Debugger from
the Kernel Debugger for details.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
specifies the network name or IP address of the computer on which the debugging client exists or will be created. The two initial backslashes (\\) are optional.
Since the server is looking for one specific client, you cannot connect multiple clients to the server if you use this method. If the connection is refused or is broken you
will have to restart the server connection. A reverse-connection server will not appear when another debugger displays all active servers.
Note When clicon is used, it is best to start the debugging client before the debugging server is created, although the usual order (server before client) is also permitted.
port=COMPort
When COM protocol is used, COMPort specifies the COM port to be used. The prefix "COM" is optional for example, both "com2" and "2" are acceptable.
baud=BaudRate
When COM protocol is used, BaudRate specifies the baud rate at which the connection will run. Any baud rate that is supported by the hardware is permitted.
channel=COMChannel
If COM protocol is used, COMChannel specifies the COM channel to be used in communicating with the debugging client. This can be any value between 0 and 254,
inclusive. You can use a single COM port for multiple connections using different channel numbers. (This is different from the use of a COM ports for a debug cable
in that situation you cannot use channels within a COM port.)
proto=Protocol
If SSL or SPIPE protocol is used, Protocol specifies the Secure Channel (S-Channel) protocol. This can be any one of the strings tls1, pct1, ssl2, or ssl3.
Cert
If SSL or SPIPE protocol is used, Cert specifies the certificate. This can either be the certificate name or the certificate's thumbprint (the string of hexadecimal digits
given by the certificate's snapin). If the syntax certuser=Cert is used, the debugger will look up the certificate in the system store (the default store). If the syntax
machuser=Cert is used, the debugger will look up the certificate in the machine store. The specified certificate must support server authentication.
hidden
Prevents the server from appearing when another debugger displays all active servers.
password=Password
Requires a client to supply the specified password in order to connect to the debugging session. Password can be any alphanumeric string.
Caution Using a password with TCP, NPIPE, or COM protocol only offers a small amount of protection, because the password is not encrypted. When a password is
used with SSL or SPIPE protocol, it is encrypted. If you want to establish a secure remote session, you must use SSL or SPIPE protocol!
ipversion=6
(Debugging Tools for Windows 6.6.07 and earlier only) Forces the debugger to use IP version 6 rather than version 4 when using TCP to connect to the Internet. In
Windows Vista and later versions, the debugger attempts to auto-default to IP version 6, making this option unnecessary.
-noio
If the debugging server is created with the -noio option, no input or output can be done through the server itself. The debugger will only accept input from the debugging
client (plus any initial command or command script specified by the -c command-line option). All output will be directed to the debugging client. The -noio option is
only available with KD, CDB, and NTSD. If NTSD is used for the server, no console window will be created at all.
IcfEnable
(Windows XP and later versions only) Causes the debugger to enable the necessary port connections for TCP or named pipe communication when the Internet
Connection Firewall is active. By default, the Internet Connection Firewall disables the ports used by these protocols. When IcfEnable is used with a TCP connection,
the debugger causes Windows to open the port specified by the Socket parameter. When IcfEnable is used with a named pipe connection, the debugger causes Windows
to open the ports used for named pipes (ports 139 and 445). The debugger does not close these ports after the connection terminates.
Options
Any additional command-line parameters can be placed here. See Command-Line Options for a full list.
You can use the .server command to start multiple servers using different protocol options. This allows different kinds of debugging clients to join the session.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Once the debugging server has been activated, you can start a debugging client on another computer and connect to the debugging session.
There are two ways to start a debugging client: by using the -remote command-line option, or by using the WinDbg graphical interface.
The protocol of the client must match the protocol of the server. The general syntax for starting a debugging client depends on the protocol used. The following options exist:
Debugger -remote npipe:server=Server,pipe=PipeName[,password=Password]
Debugger -remote tcp:server=Server,port=Socket[,password=Password][,ipversion=6]
Debugger -remote tcp:clicon=Server,port=Socket[,password=Password][,ipversion=6]
Debugger -remote com:port=COMPort,baud=BaudRate,channel=COMChannel[,password=Password]
Debugger -remote spipe:proto=Protocol,{certuser=Cert|machuser=Cert},server=Server,pipe=PipeName[,password=Password]
Debugger -remote ssl:proto=Protocol,{certuser=Cert|machuser=Cert},server=Server,port=Socket[,password=Password]
Debugger -remote ssl:proto=Protocol,{certuser=Cert|machuser=Cert},clicon=Server,port=Socket[,password=Password]
To use the graphical interface to connect to a remote debugging session, WinDbg must be in dormant mode it must either have been started with no command-line
parameters, or it must have ended the previous debugging session. Select the File | Connect to Remote Session menu command, or press the CTRL+R shortcut key. When
the Connect to Remote Debugger Session dialog box appears, enter one of the following strings into the Connection string text box:
npipe:server=Server,pipe=PipeName[,password=Password]
tcp:server=Server,port=Socket[,password=Password][,ipversion=6]
tcp:clicon=Server,port=Socket[,password=Password][,ipversion=6]
com:port=COMPort,baud=BaudRate,channel=COMChannel[,password=Password]
spipe:proto=Protocol,{certuser=Cert|machuser=Cert},server=Server,pipe=PipeName[,password=Password]
ssl:proto=Protocol,{certuser=Cert|machuser=Cert},server=Server,port=Socket[,password=Password]
ssl:proto=Protocol,{certuser=Cert|machuser=Cert},clicon=Server,port=Socket[,password=Password]
Alternatively, you can use the Browse button to locate active debugging servers. See File | Connect to Remote Session for details.
The parameters in the preceding commands have the following possible values:
Debugger
This does not have to be the same debugger as the one used by the debugging client WinDbg, KD, and CDB are all interchangeable for purposes of remote debugging
through the debugger.
Server
This is the network name or IP address of the computer on which the debugging server was created. The two initial backslashes (\\) are optional on the command line, but
are not permitted in the WinDbg dialog box.
pipe=PipeName
If NPIPE or SPIPE protocol is used, PipeName is the name that was given to the pipe when the server was created.
port=Socket
If TCP or SSL protocol is used, Socket is the same socket port number that was used when the server was created.
clicon
Specifies that the debugging server will try to connect to the client through a reverse connection. The client must use clicon if and only if the server is using clicon. In
most cases, the debugging client is started before the debugging server when a reverse connection is used.
port=COMPort
If COM protocol is used, COMPort specifies the COM port to be used. The prefix "COM" is optional for example, both "com2" and "2" are acceptable.
baud=BaudRate
If COM protocol is used, BaudRate should match the baud rate chosen when the server was created.
channel=COMChannel
If COM protocol is used, COMChannel should match the channel number chosen when the server was created.
proto=Protocol
If SSL or SPIPE protocol is used, Protocol should match the secure protocol used when the server was created.
Cert
If SSL or SPIPE protocol is used, you should use the identical certuser=Cert or machuser=Cert parameter that was used when the server was created.
password=Password
If a password was used when the server was created, Password must be supplied in order to create the debugging client. It must match the original password. Passwords
are case-sensitive. If the wrong password is supplied, the error message will specify "Error 0x80004005."
ipversion=6
(Debugging Tools for Windows 6.6.07 and earlier only) Forces the debugger to use IP version 6 rather than version 4 when using TCP to connect to the Internet. In
Windows Vista and later versions, the debugger attempts to auto-default to IP version 6, making this option unnecessary.
Command-line options used to start new debugging sessions (like -p) cannot be used by the debugging client, but only by the server. Configuration options (like -n) will work
from either the client or the server.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
See Setting Paths and Loading Files for details on these paths.
This multiple-path system allows a debugging client to use source-related commands without actually sharing the source files with other clients or with the server. This is
useful if there are private or confidential source files which one of the users has access to.
Canceling the Debugging Server
The .endsrv (End Debugging Server) command can be used to terminate a debugging server. If the debugger has established multiple debugging servers, you can cancel
some of them while leaving others running.
Terminating a server will prevent any future clients from attaching to it. It will not cut off any clients that are currently attached through the server.
Exiting the Debugger and Terminating the Session
To exit from one debugging client without terminating the server, you must issue a command from that specific client. If this client is KD or CDB, use the CTRL+B key to
exit. If you are using a script to run KD or CDB, use .remote_exit (Exit Debugging Client). If this client is WinDbg, choose Exit from the File menu to exit.
To terminate the entire session and exit the debugging server, use the q (Quit) command. This command can be entered from any server or client, and it will terminate the
entire session for all users.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
To prepare for the remote session, you should customize this window to increase its usability. Open a Command Prompt window. Right-click on the title bar and select
Properties. Select the Layout tab. Go to the section titled "Screen Buffer Size" and type 90 in the Width box and a value between 4000 and 9999 in the Height box. This
enables scroll bars in the remote session on the kernel debugger.
Change the values for the height and width of the "Windows Size" section if you want to alter the shape of the command prompt. Select the Options tab. Enable the Edit
Options quickedit mode and insert mode. This allows you to cut and paste information in the command prompt session. Click OK to apply the changes. Select the option to
apply the changes to all future sessions when prompted.
Starting the Remote.exe Server: First Method
The general syntax for starting a Remote.exe Server is as follows:
remote /s "Command_Line" Unique_Id [/f Foreground_Color] [/b Background_Color]
This can be used to start KD or CDB on the remote computer, as in the following examples:
remote /s "KD [options]" MyBrokenBox
remote /s "CDB [options]" MyBrokenApp
This starts the Remote.exe Server in the Command Prompt window, and starts the debugger.
You cannot use this method to start NTSD directly, because the NTSD process runs in a different window than the one in which it was invoked.
Starting the Remote.exe Server: Second Method
There is an alternate method that can start a Remote.exe Server. This method involves first starting the debugger, and then using the .remote (Create Remote.exe Server)
command to start the server.
Since the .remote command is issued after the debugger has started, this method works equally well with KD, CDB, and NTSD.
Here is an example. First, start the debugger in the normal fashion:
KD [options]
Once the debugger is running, use the .remote command:
.remote MyBrokenBox
This results in a KD process that is also a Remote.exe Server with an ID of "MyBrokenBox", exactly as in the first method.
One advantage of this method is that you do not have to decide in advance if you intend to use remote debugging. If you are debugging with one of the console debuggers and
then decide that you would prefer someone in a remote location to take over, you can use the .remote command and then they can connect to your session.
Starting the Remote.exe Client
The general syntax for starting a Remote.exe Client is as follows:
remote /c ServerNetBIOSName Unique_ID [/l Lines_to_Get] [/f Foreground_Color] [/b Background_Color]
For example, if the "MyBrokenBox" session, described above, was started on a local host computer whose network name was "Server2", you can connect to it with the
command:
remote /c server2 MyBrokenBox
Anyone on the network with appropriate permission can connect to this debug session, as long as they know your machine name and the session ID.
Issuing Commands
Commands are issued through the Remote.exe Client and are sent to the Remote.exe Server. You can enter any command into the client as if you were directly entering it into
the debugger.
To exit from the remote.exe session on the Remote.exe Client, enter the @Q command. This leaves the Remote.exe Server and the debugger running.
To end the server session, enter the @K command on the Remote.exe Server.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The log file holds a copy of everything you see on the Debug screen during your debug session. All input from the person doing the debugging, and all output from the kernel
debugger on the target system, is written to that log file.
A sample batch file for running a debugging session on the local host is:
set _NT_DEBUG_PORT=com2
set _NT_DEBUG_BAUD_RATE=19200
set _NT_SYMBOL_PATH=c:\winnt\symbols
set _NT_LOG_FILE_OPEN=c:\temp\debug.log
remote /s "KD -v" debug
Note If this batch file is not in the same directory as Remote.exe, and Remote.exe is not in a directory listed in the system path, then you should give the full path to the utility
when invoking Remote.exe in this batch file.
After this batch file is run, anyone with a Windows computer that is networked to the local host computer can connect to the debug session by using the following command:
remote /c computername debug
where computername is the NetBIOS name of the local host computer.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
to open the ports used for named pipes (ports 139 and 445). The debugger does not close these ports after the connection terminates.
-sifeo Executable
Suspends the Image File Execution Option (IFEO) value for the given image. Executable should include the file name of the executable image, including the file name
extensions. The -sifeo option allows DbgSrv to be set as the IFEO debugger for an image created by the -c option, without causing recursive invocation due to the IFEO
setting. This option can be used only if -c is used.
-c
Causes DbgSrv to create a new process. You can use this to create a process that you intend to debug. This is similar to spawning a new process from the debugger,
except that this process will not be debugged when it is created. To debug this process, determine its PID and use the -p option when starting the smart client to debug
this process.
s
Causes the newly-created process to be immediately suspended. If you are using this option, it is recommended that you use CDB as your smart client, and that you start
the smart client with the -pb command-line option, in conjunction with -p PID. If you include the -pb option on the command line, the process will resume when the
debugger attaches to it; otherwise you can resume the process with the ~*m command.
AppCmdLine
Specifies the full command line of the process to be created. AppCmdLine can be either a Unicode or ASCII string, and can include any printable character. All text that
appears after the -c[s] parameter will be taken to form the string AppCmdLine.
-x
Causes the remainder of the command line to be ignored. This option is useful if you are launching DbgSrv from an application that may append unwanted text to its
command line.
-pc
Causes the remainder of the command line to be ignored. This option is useful if you are launching DbgSrv from an application that may append unwanted text to its
command line. A syntax error results if -pc is the final element on the DbgSrv command line. Aside from this restriction, -pc is identical to -x.
You can start any number of process servers on one computer. However, this is generally unnecessary, since one process server can be used by any number of smart clients
(each engaged in a different debugging session).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Here is another example. In this case, NPIPE protocol is chosen, and CDB is used instead of WinDbg. The first user chooses a pipe name. This can be any alphanumeric
string in this example, "AnotherPipe". The process server is started with this command:
E:\Debugging Tools for Windows> dbgsrv -t npipe:pipe=AnotherPipe
The technician is not sure what name was used, so he or she queries the network for pipe names:
G:\Debugging Tools> cdb -QR \\BOX17
Servers on \\BOX17:
Debugger Server - npipe:Pipe=MainPipe
Remote Process Server - npipe:Pipe=AnotherPipe
Two pipes are shown. However, only one is a process server the other is a debugging server, and we are not interested in that. So AnotherPipe must be the correct name.
Then the following command can be used to start the smart client:
G:\Debugging Tools> cdb -premote npipe:server=BOX17,pipe=AnotherPipe -v sol.exe
For a more complicated example using a process server, see Symbols in the Middle.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
ipversion=6
(Debugging Tools for Windows 6.6.07 and earlier only) Forces the debugger to use IP version 6 rather than version 4 when using TCP to connect to the Internet. In
Windows Vista and later versions, the debugger attempts to auto-default to IP version 6, making this option unnecessary.
IcfEnable
(Windows XP and later versions only) Causes the debugger to enable the necessary port connections for TCP or named pipe communication when the Internet
Connection Firewall is active. By default, the Internet Connection Firewall disables the ports used by these protocols. When IcfEnable is used with a TCP connection,
the debugger causes Windows to open the port specified by the Socket parameter. When IcfEnable is used with a named pipe connection, the debugger causes Windows
to open the ports used for named pipes (ports 139 and 445). The debugger does not close these ports after the connection terminates.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
ssl:proto=Protocol,{certuser=Cert|machuser=Cert},server=Server,port=Socket[,password=Password]
ssl:proto=Protocol,{certuser=Cert|machuser=Cert},clicon=Server,port=Socket[,password=Password]
Alternatively, you can use the Browse button to locate active KD connection servers. See File | Connect to Remote Stub for details.
The parameters in the preceding commands have the following possible values:
Debugger
This can be KD or WinDbg.
Server
This is the network name or IP address of the computer on which the KD connection server was created.The two initial backslashes (\\) are optional on the command line,
but are not permitted in the WinDbg dialog box.
pipe=PipeName
If NPIPE or SPIPE protocol is used, PipeName is the name that was given to the pipe when the KD connection server was created.
port=Socket
If TCP or SSL protocol is used, Socket is the same socket port number that was used when the KD connection server was created.
clicon
Specifies that the KD connection server will try to connect to the smart client through a reverse connection. The client must use clicon if and only if the server is using
clicon. In most cases, the smart client is started before the KD connection server when a reverse connection is used.
port=COMPort
If COM protocol is used, COMPort specifies the COM port to be used. The prefix "COM" is optional for example, both "com2" and "2" are acceptable.
baud=BaudRate
If COM protocol is used, BaudRate should match the baud rate chosen when the KD connection server was created.
channel=COMChannel
If COM protocol is used, COMChannel should match the channel number chosen when the KD connection server was created.
proto=Protocol
If SSL or SPIPE protocol is used, Protocol should match the secure protocol used when the KD connection server was created.
Cert
If SSL or SPIPE protocol is used, you should use the identical certuser=Cert or machuser=Cert parameter that was used when the KD connection server was created.
password=Password
If a password was used when the KD connection server was created, Password must be supplied in order to create the smart client. It must match the original password.
Passwords are case-sensitive. If the wrong password is supplied, the error message will specify "Error 0x80004005."
ipversion=6
(Debugging Tools for Windows 6.6.07 and earlier only) Forces the debugger to use IP version 6 rather than version 4 when using TCP to connect to the Internet. In
Windows Vista and later versions, the debugger attempts to auto-default to IP version 6, making this option unnecessary.
trans=@{ConnectType}
Tells the debugger how to connect to the target. The following kernel connection protocols are permitted:
com:port=ComPort,baud=BaudRate
1394:channel=1394Channel[,symlink=1394Protocol]
usb2:targetname=String
com:pipe,port=\\VMHost\pipe\PipeName[,resets=0][,reconnect]
com:modem
For information about these protocols, see Choosing Kernel Debugging Settings. You can omit any of the parameters for these protocols for example, you can say
trans=@{com:} and the debugger will default to the values specified by the environment variables on the computer where KdSrv is running.
Options
Any additional command-line parameters can be placed here. See Command-Line Options for a full list.
Since the KD connection server simply acts as a gateway for the smart client, the additional Options will be the same as those you would use if you were starting a kernel
debugger on computer where KdSrv is running. The exception to this is any option that specifies a path or filename will be taken as a path on the computer where the smart
client is running.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Repeaters
A repeater is a lightweight proxy server that runs on a computer and relays data between two other computers. The repeater does not process the data in any way. The two
other computers barely notice the repeater; from their perspective it seems as if they are directly connected to each other.
The processes running on these two other computers are called the server and the client. There is not any fundamental difference between them from the repeater's point of
view, except that in most cases the server is started first, then the repeater, and finally the client.
The Debugging Tools for Windows package includes a repeater called DbEngPrx (dbengprx.exe).
This section includes:
Activating a Repeater
Using a Repeater
Repeater Examples
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Activating a Repeater
To activate the repeater connection, you will usually first start the server, then start the repeater, then start the client.
It is also possible to start the repeater first and then the server. But unless you are using the clicon parameter to establish a reverse connection, the client must always be
started last.
Step One: Starting the Server
The server can be a debugging server, a process server, or a KD connection server. You start this as you normally would, except that the transport protocol settings will be
used to connect to the repeater, not the client. For details, see Activating a Debugging Server, Activating a Process Server, or Activating a KD Connection Server.
If you use a password when creating the server, this password will be required when the client attaches, but not when the repeater is created.
If you use the hidden parameter, the server will be hidden as usual. The repeater itself is always hidden.
Step Two: Starting the Repeater
The repeater that is included in Debugging Tools for Windows is called DbEngPrx (dbengprx.exe).
DbEngPrx understands the following transport protocols: named pipe (NPIPE), TCP, and COM port.
If your client and server are using secure sockets layer (SSL) protocol, you should use TCP protocol for the repeater. If your client and server are using secure pipe (SPIPE)
protocol, you should use NPIPE protocol for the repeater. The repeater will pass on whatever data it receives it does not interpret, encrypt, or decrypt any information. All
encryption and decryption will be done by the client and the server.
The syntax for the DbEnPrx command line is as follows:
dbengprx [-p] -c ClientTransport -s ServerTransport
The parameters in the previous commands have the following possible values:
-p
Causes DbEngPrx to continue existing even after all connections to it are dropped.
ClientTransport
Specifies the protocol settings to be used in connecting to the server. The protocol should match that used when the server was created. The protocol syntaxes are as
follows:
npipe:server=Server,pipe=PipeName[,password=Password]
tcp:server=Server,port=Socket[,password=Password][,ipversion=6]
tcp:clicon=Server,port=Socket[,password=Password][,ipversion=6]
com:port=COMPort,baud=BaudRate,channel=COMChannel[,password=Password]
The protocol parameters have the following meanings:
Server
This is the network name or IP address of the computer on which the server was created. The two initial backslashes (\\) are optional.
pipe=PipeName
If NPIPE or SPIPE protocol is used, PipeName is the name that was given to the pipe when the server was created.
port=Socket
If TCP or SSL protocol is used, Socket is the same socket port number that was used when the server was created.
clicon
Specifies that the server will try to connect to the repeater through a reverse connection. ClientTransport must use clicon if and only if the server is using clicon. In
most cases, the repeater is started before the server when a reverse connection is used.
port=COMPort
If COM protocol is used, COMPort specifies the COM port to be used. The prefix "COM" is optional for example, both "com2" and "2" are acceptable.
baud=BaudRate
If COM protocol is used, BaudRate should match the baud rate chosen when the server was created.
channel=COMChannel
If COM protocol is used, COMChannel should match the channel number chosen when the server was created.
password=Password
If a password was used when the server was created, Password must be supplied in order to create the debugging client. It must match the original password.
Passwords are case-sensitive. If the wrong password is supplied, the error message will specify "Error 0x80004005."
ipversion=6
(Debugging Tools for Windows 6.6.07 and earlier only) Forces the debugger to use IP version 6 rather than version 4 when using TCP to connect to the Internet. In
Windows Vista and later versions, the debugger attempts to auto-default to IP version 6, making this option unnecessary.
ServerTransport
Specifies the protocol settings that will be used when the client connects to the repeater. The possible protocol syntaxes are:
npipe:pipe=PipeName[,hidden][,password=Password][,IcfEnable]
tcp:port=Socket[,hidden][,password=Password][,IcfEnable]
tcp:port=Socket,clicon=Client[,password=Password]
com:port=COMPort,baud=BaudRate,channel=COMChannel[,hidden][,password=Password]
The protocol parameters have the following meanings:
pipe=PipeName
When NPIPE or SPIPE protocol is used, PipeName is a string that will serve as the name of the pipe. Each pipe name should identify a unique repeater. If you
attempt to reuse a pipe name, you will receive an error message. PipeName must not contain spaces or quotation marks. PipeName can include a numerical printf-
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
style format code, such as %x or %d. The repeater will replace this with the process ID of DbEngPrx. A second such code will be replaced with the thread ID of
DbEngPrx.
port=Socket
When TCP or SSL protocol is used, Socket is the socket port number.
It is also possible to specify a range of ports separated by a colon. DbEngPrx will check each port in this range to see if it is free. If it finds a free port and no error
occurs, the repeater will be created. The client will have to specify the actual port being used to connect to the repeater. To determine the actual port, search for the
repeater; when this repeater is displayed, the port will be followed by two numbers separated by a colon. The first number will be the actual port used; the second
can be ignored. For example, if the port was specified as port=51:60, and port 53 was actually used, the search results will show "port=53:60". (If you are using the
clicon parameter to establish a reverse connection, the client can specify a range of ports in this manner, while the repeater must specify the actual port used.)
clicon=Client
When TCP or SSL protocol is used and the clicon parameter is specified, a reverse connection will be opened. This means that the repeater will try to connect to the
client, instead of letting the client initiate the contact. This can be useful if you have a firewall that is preventing a connection in the usual direction. Client specifies
the network name or IP address of the computer on which the client exists or will be created. The two initial backslashes (\\) are optional.
Since the repeater is looking for one specific client, you cannot connect multiple clients to the repeater if you use this method. If the connection is refused or is
broken you will have to restart the repeater.
When clicon is used, it is best to start the client before the repeater is created, although the usual order (repeater before client) is also permitted.
port=COMPort
When COM protocol is used, COMPort specifies the COM port to be used. The prefix "COM" is optional for example, both "com2" and "2" are acceptable. You
cannot use the same COM port in the ClientTransport and the ServerTransport.
baud=BaudRate
When COM protocol is used, BaudRate specifies the baud rate at which the connection will run. Any baud rate that is supported by the hardware is permitted. If you
are using COM protocol in both the ClientTransport and the ServerTransport you may specify different baud rates, but naturally the slower rate will be the limit on
how fast the client and server can communicate with each other.
channel=COMChannel
If COM protocol is used, COMChannel specifies the COM channel to be used in communicating with the client. This can be any value between 0 and 254, inclusive.
You can use a single COM port for multiple connections using different channel numbers. (This is different from the use of a COM ports for a debug cable in that
situation you cannot use channels within a COM port.)
hidden
Prevents the server from appearing when another debugger displays all active servers.
password=Password
Requires a client to supply the specified password in order to connect to the debugging session. Password can be any alphanumeric string.
IcfEnable
(Windows XP and later versions only) Causes the debugger to enable the necessary port connections for TCP or named pipe communication when the Internet
Connection Firewall is active. By default, the Internet Connection Firewall disables the ports used by these protocols. When IcfEnable is used with a TCP
connection, the debugger causes Windows to open the port specified by the Socket parameter. When IcfEnable is used with a named pipe connection, the debugger
causes Windows to open the ports used for named pipes (ports 139 and 445). The debugger does not close these ports after the connection terminates.
Step Three: Starting the Client
The client should be a debugging client or a smart client whichever corresponds to your server type. For details, see Activating a Debugging Client, Activating a Smart
Client, or Activating a Smart Client (Kernel Mode).
If the server rejects the connection (for example, if you supply an incorrect password), both the repeater and the client will be shut down. You will have to restart both of them
to reestablish contact with the server.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Using a Repeater
A repeater connection obeys very simple rules:
Any communication that the server and client intend for each other passes through the repeater without alteration.
Any action that the server performs with respect to the transport connection affects the repeater (and only indirectly affects the client).
Any action that the client performs with respect to the transport connection affects the repeater (and only indirectly affects the server).
This means that any debugging commands, debugger output, control keys, and file access will take place exactly as if the client and server were directly connected. The
repeater will be invisible to all these commands.
Actions that terminate the connection itself will affect the repeater. For example, if you issue a qq (Quit) command from the client, the server will shut down and will send a
shutdown signal to the transport. This will cause the repeater to exit (unless it was started with the -p option). As another example, the .clients (List Debugging Clients)
command will list the client's computer name, but it will show the connection protocol used to connect the server with the repeater.
If the server is shut down, the repeater will automatically exit (unless it was started with the -p option). When the repeater shuts down, this will cause a debugging client to
exit as well, although a smart client will not. If for some reason you need to terminate the repeater directly, you can use Task Manager or the kill.exe tool.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Repeater Examples
Let us suppose you have three computers, \\BOXA, \\BOXB, and \\BOXC, and you wish to use them as the server, the repeater, and the client, respectively.
You can start a debugging server on \\BOXA, using process 122 as the target, in the following manner:
E:\Debugging Tools for Windows> cdb -server tcp:port=1025,password=wrought -p 122
Then you can start a repeater on \\BOXB as follows:
C:\Misc> dbengprx -c tcp:server=BOXA,port=1025 -s npipe:pipe=MyPipe
Finally, start a debugging client on \\BOXC in the following manner:
G:\Debugging Tools> windbg -remote npipe:server=BOXB,pipe=MyPipe,password=wrought
Here is another example. Your symbols are at the remote location, 127.0.0.30. So you decide to use a process server on the computer where the target is, 127.0.0.10. You put
a repeater at 127.0.0.20.
You also decide to use reverse connections. So you begin by starting the client on 127.0.0.30:
G:\Debugging Tools> windbg -premote tcp:clicon=127.0.0.20,port=1033 notepad.exe
Then start the repeater on 127.0.0.20:
C:\Misc> dbengprx -c tcp:clicon=127.0.0.10,port=1025 -s tcp:port=1033,clicon=127.0.0.10
And finally start the process server on 127.0.0.10:
E:\Debugging Tools for Windows> dbgsrv -t tcp:port=1025,clicon=127.0.0.20
For a more complicated example using repeaters, see Two Firewalls.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Two Firewalls
In this scenario, you need to perform kernel debugging on a computer in Building A. Your technician is located in Building C, and he or she has access to symbols there.
However, both buildings have firewalls that will not allow incoming connections.
You need to set up a repeater at a neutral site say, Building B. Then you can connect A outward to B, and connect C outward to B.
There will be four computers involved in this scenario:
First, make sure the target computer is configured for debugging and is attached to the local host computer. In this example, a 1394 cable is used.
Second, start the repeater on 127.0.20.20:
dbengprx -p -s tcp:port=9001 -c tcp:port=9000,clicon=127.0.10.10
Third, start the KD connection server on 127.0.10.10 in Building A as follows:
kdsrv -t tcp:port=9000,clicon=127.0.20.20,password=longjump
Finally, start the smart client on 127.0.30.30 in Building C. (This can actually be done before or after starting the server in Building A.)
windbg -k kdsrv:server=@{tcp:server=127.0.20.20,port=9001,password=longjump},trans=@{1394:channel=9} -y SymbolPath
Five-Computer Scenario
This scenario can be made even more complicated if you suppose that the symbols are on one computer in Building C, but the technician is at a different computer.
Suppose that 127.0.30.30 has the symbols, as before, and that its local name is \\BOXC. The smart client can be started with the same command as above but with an
additional -server parameter. Since no one will be using this machine, it will take less processing time if you use KD instead of WinDbg:
kd -server npipe:pipe=randomname -k kdsrv:server=@{tcp:server=127.0.20.20,port=9001,password=longjump},trans=@{1394:channel=9}
Then the technician, elsewhere in the building, can start a debugging client as follows:
windbg -remote npipe:server=\\BOXC,pipe=randomname
Notice that the password must be supplied by the first non-repeater in the chain (the smart client on \\BOXC), not by the final debugger in the chain.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Symbols
This section includes:
Introduction to Symbols
Accessing Symbols for Debugging
How the Debugger Recognizes Symbols
Symbol Problems While Debugging
These topics explain what symbols are, how to access them during a debugging session, how to control the debugger's symbol options and symbol matching, and how to
respond to various symbol-related problems during debugging.
If you simply want to configure your debugger to access symbols for your own programs and for Windows, you may find it quicker to read the less-detailed introductory
topics Symbol Path and Using a Symbol Server.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Introduction to Symbols
This section includes:
Symbols and Symbol Files
Public and Private Symbols
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Global variables
Local variables
Function names and the addresses of their entry points
Frame pointer omission (FPO) records
Source-line numbers
Each of these items is called, individually, a symbol. For example, a single symbol file Myprogram.pdb might contain several hundred symbols, including global variables and
function names and hundreds of local variables. Often, software companies release two versions of each symbol file: a full symbol file containing both public symbols and
private symbols, and a reduced (stripped) file containing only public symbols. For details, see Public and Private Symbols.
When debugging, you must make sure that the debugger can access the symbol files that are associated with the target you are debugging. Both live debugging and debugging
crash dump files require symbols. You must obtain the proper symbols for the code that you wish to debug, and load these symbols into the debugger.
Windows Symbols
Microsoft Windows 2000 keeps its symbols in files with the extensions .pdb and .dbg. Windows XP and later versions of Windows use .pdb files exclusively. Windows
drivers can follow either model.
The compiler and the linker control the symbol format. The Visual C++ 5.0 Linker creates both .pdb and .dbg symbol files the .dbg files it creates are essentially pointers
to the .pdb files. The Visual C++ 6.0 Linker, as well as the linkers of later versions of Visual Studio, places all symbols into .pdb files.
The Windows operating system is built in two versions. The free build (or retail build) has relatively small binaries, and the checked build (or debug build) has larger binaries,
with more debugging symbols in the code itself. Each of these builds has its own symbol files. When debugging a target on Windows, you must use the symbol files that
match the build of Windows on the target.
The following table lists several of the directories which exist in a standard Windows symbol tree:
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Directory
Contains Symbol Files for
ACM
Microsoft Audio Compression Manager files
COM
Executable files (.com)
CPL
Control Panel programs
DLL
Dynamic-link library files (.dll)
DRV
Driver files (.drv)
EXE
Executable files (.exe)
SCR
Screen-saver files
SYS
Driver files (.sys)
Data Types
All types created by typedefs within your own code will be present, as long as they have actually been used in your program. However, types that are defined in your headers
but never actually used will not be stored in the .pdb symbol files and will not be accessible to the debugger. If you wish to make such a type available to the debugger, you
should use it as the input of a typedef statement. For example, if the following appears in your code, the structure MY_DATA will be stored in the .pdb symbol file and can
be displayed by the debugger:
typedef struct _MY_DATA {
. . .
} MY_DATA;
typedef MY_DATA *PMY_DATA;
On the other hand, the following code would not suffice, because both MY_DATA and PMY_DATA are defined by the initial typedef, and therefore MY_DATA has not
itself been used as the input of any typedef statement:
typedef struct _MY_DATA {
. . .
} MY_DATA, *PMY_DATA;
In any event, type information is included only in a full symbol file, not a symbol file that has been stripped of all private symbol information. For more information, see
Public and Private Symbols.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Functions
Global variables
Local variables
Information about user-defined structures, classes, and data types
The name of the source file and the line number in that file corresponding to each binary instruction
As a general rule, the public symbol table contains exactly those items that are accessible from one source file to another. Items visible in only one object filesuch as static
functions, variables that are global only within a single source file, and local variablesare not included in the public symbol table.
These two collections of data also differ in what information they include for each item. The following information is typically included for each item contained in the private
symbol data:
On the other hand, the public symbol table stores only the following information about each item included in it:
In other words, the public symbol data can be thought of as a subset of the private symbol data in two ways: it contains a shorter list of items, and it also contains less
information about each item. For example, the public symbol data does not include local variables at all. Each local variable is included only in the private symbol data, with
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
its address, data type, and scope. Functions, on the other hand, are included both in the private symbol data and public symbol table, but while the private symbol data
includes the function name, address, FPO records, input parameter names and types, and output type, the public symbol table includes just the function name, address, and
FPO record.
There is one other difference between the private symbol data and the public symbol table. Many of the items in the public symbol table have names that are decorated with a
prefix, a suffix, or both. These decorations are added by the C compiler, the C++ compiler, and the MASM assembler. Typical prefixes include a series of underscores or the
string __imp_ (designating an imported function). Typical suffixes include one or more at signs ( @ ) followed by addresses or other identifying strings. These decorations
are used by the linker to disambiguate the symbol, since it is possible that function names or global variable names could be repeated across different modules. These
decorations are an exception to the general rule that the public symbol table is a subset of the private symbol data.
Full Symbol Files and Stripped Symbol Files
A full symbol file contains both the private symbol data and the public symbol table. This kind of file is sometimes referred to as a private symbol file, but this name is
misleading, for such a file contains both private and public symbols.
A stripped symbol file is a smaller file that contains only the public symbol table or, in some cases, only a subset of the public symbol table. This file is sometimes referred
to as a public symbol file.
Creating Full and Stripped Symbol Files
If you build your binaries with Visual Studio, you can create either full or stripped symbol files. When building a "debug build" of a binary, Visual Studio typically will create
full symbol files. When building a "retail build", Visual Studio typically creates no symbol files, but a full or stripped symbol file will be created if the proper options are set.
If you build your binaries with the Build utility, the utility will create full symbol files.
Using the BinPlace tool, you can create a stripped symbol file from a full symbol file. When the most common BinPlace options are used (-a -x -s -n), the stripped symbol
files are placed in the directory that is listed after the -s switch, and the full symbol files are placed in the directory that is listed after the -n switch. When BinPlace strips a
symbol file, the stripped and full versions of the file are given identical signatures and other identifying information. This allows you to use either version for debugging.
Using the PDBCopy tool, you can create a stripped symbol file from a full symbol file by removing the private symbol data. PDBCopy can also remove a specified subset of
the public symbol table. For details, see PDBCopy.
Using the SymChk tool, you can determine whether a symbol file contains private symbols. For details, see SymChk.
Viewing Public and Private Symbols in the Debugger
You can use WinDbg, KD, or CDB to view symbols. When one of these debuggers has access to a full symbol file, it has both the information listed in the private symbol
data and the information listed in the public symbol table. The private symbol data is more detailed, while the public symbol data contains symbol decorations.
When accessing private symbols, private symbol data is always used because these symbols are not included in the public symbol table. These symbols are never decorated.
When accessing public symbols, the debugger's behavior depends on certain symbol options:
When the SYMOPT_UNDNAME option is on, decorations are not included when the name of a public symbol is displayed. Moreover, when searching for symbols,
decorations are ignored. When this option is off, decorations are displayed when displaying public symbols, and decorations are used in searches. Private symbols are
never decorated in any circumstances. This option is on by default in all debuggers.
When the SYMOPT_PUBLICS_ONLY option is on, private symbol data is ignored, and only the public symbol table is used. This option is off by default in all
debuggers.
When the SYMOPT_NO_PUBLICS option is on, the public symbol table is ignored, and searches and symbol information use the private symbol data alone. This
option is off by default in all debuggers.
When the SYMOPT_AUTO_PUBLICS option is on (and both SYMOPT_PUBLICS_ONLY and SYMOPT_NO_PUBLICS are off), the first symbol search is
performed in the private symbol data. If the desired symbol is found there, the search terminates. If not, the public symbol table is searched. Since the public symbol
table contains a subset of the symbols in the private data, normally this results in the public symbol table being ignored.
When the SYMOPT_PUBLICS_ONLY, SYMOPT_NO_PUBLICS, and SYMOPT_AUTO_PUBLICS options are all off, both private symbol data and the public
symbol table are searched each time a symbol is needed. However, when matches are found in both places, the match in the private symbol data is used. Therefore, the
behavior in this instance is the same as when SYMOPT_AUTO_PUBLICS is on, except that using SYMOPT_AUTO_PUBLICS may cause symbol searches to happen
slightly faster.
Here is an example in which the command x (Examine Symbols) is used three times. The first time, the default symbol options are used, and so the information is taken from
the private symbol data. Note that this includes information about the address, size, and data type of the array typingString. Next, the command .symopt+ 4000 is used,
causing the debugger to ignore the private symbol data. When the x command is then run again, the public symbol table is used; this time there is no size and data type
information for typingString. Finally, the command .symopt- 2 is used, which causes the debugger to include decorations. When the x command is run this final time, the
decorated version of the function name, _typingString, is shown.
0:000> x /t /d *!*typingstring*
00434420 char [128] TimeTest!typingString = char [128] ""
0:000> .symopt+ 4000
0:000> x /t /d *!*typingstring*
00434420 <NoType> TimeTest!typingString = <no type information>
0:000> .symopt- 2
0:000> x /t /d *!*typingstring*
00434420 <NoType> TimeTest!_typingString = <no type information>
Viewing Public and Private Symbols with the DBH Tool
Another way to view symbols is by using the the DBH tool. DBH uses the same symbol options as the debugger. Like the debugger, DBH leaves
SYMOPT_PUBLICS_ONLY and SYMOPT_NO_PUBLICS off by default, and turns SYMOPT_UNDNAME and SYMOPT_AUTO_PUBLICS on by default. These
defaults can be overridden by a command-line option or by a DBH command.
Here is an example in which the DBH command addr 414fe0 is used three times. The first time, the default symbol options are used, and so the information is taken from the
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
private symbol data. Note that this includes information about the address, size, and data type of the function fgets. Next, the command symopt +4000 is used, which causes
DBH to ignore the private symbol data. When the addr 414fe0 is then run again, the public symbol table is used; this time there is no size and data type information for the
function fgets. Finally, the command symopt -2 is used, which causes DBH to include decorations. When the addr 414fe0 is run this final time, the decorated version of the
function name, _fgets, is shown.
pid:4308 mod:TimeTest[400000]: addr 414fe0
fgets
name
addr
size
flags
type
modbase
value
reg
scope
tag
index
:
:
:
:
:
:
:
:
:
:
:
fgets
414fe0
113
0
7e
400000
0
0
SymTagNull (0)
SymTagFunction (5)
7d
:
:
:
:
:
:
:
:
:
:
:
fgets
414fe0
0
0
0
400000
0
0
SymTagNull (0)
SymTagPublicSymbol (a)
7f
:
:
:
:
:
:
:
:
:
:
:
_fgets
414fe0
0
0
0
400000
0
0
SymTagNull (0)
SymTagPublicSymbol (a)
7f
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
build numbers. Debugging Tools for Windows contains a symbol server called SymSrv. The symbol server is activated by including a certain text string in the symbol path.
Each time the debugger needs to load symbols for a newly loaded module, it calls the symbol server to locate the appropriate symbol files.
If you wish to use a different method for your symbol search than that provided by SymSrv, you can create your own symbol server DLL. For details on implementing such a
symbol server, see Other Symbol Servers.
If you are performing user-mode debugging, you will need symbols for the target application. If you are performing kernel-mode debugging, you will need symbols for the
driver you are debugging, as well as the Windows public symbols. Microsoft has created a symbol store with public symbols for Microsoft products; this symbol store is
available on the internet. These symbols can be loaded using the .symfix (Set Symbol Store Path) command, as long as you have access to the internet while your debugger
is running. For more information or to determine how to manually install these symbols, see Installing Windows Symbol Files.
This section includes:
Installing Windows Symbol Files
Symbol Stores and Symbol Servers
Deferred Symbol Loading
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Make sure you have at least 500 MB of available space on the disk drive of the host computer.
Insert the Windows 2000 Customer Support Diagnostics CD.
Click on Install Symbols.
Select either Install Retail Symbols (free build) or Install Debug Symbols (checked build). The symbols must match the version of the operating system being
debugged.
5. Enter the path where the symbols are to be stored, or accept the default path. The default path is %windir%\symbols.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
SymStore
SymStore (symstore.exe) is a tool for creating symbol stores. It is included in the Debugging Tools for Windows package.
SymStore stores symbols in a format that enables the debugger to look up the symbols based on the time stamp and size of the image (for a .dbg or executable file), or
signature and age (for a .pdb file). The advantage of the symbol store over the traditional symbol storage format is that all symbols can be stored or referenced on the same
server and retrieved by the debugger without any prior knowledge of which product contains the corresponding symbol.
Note that multiple versions of .pdb symbol files (for example, public and private versions) cannot be stored on the same server, because they each contain the same signature
and age.
This section includes:
SymStore Transactions
File System References and Symbol Files
SymStore Compressed Files
Symbol Storage Format
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SymStore Transactions
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Every call to SymStore is recorded as a transaction. There are two types of transactions: add and delete.
When the symbol store is created, a directory, called "000admin", is created under the root of the server. The 000admin directory contains one file for each transaction, as well
as the log files server.txt and history.txt. The server.txt file contains a list of all transactions that are currently on the server. The history.txt file contains a chronological history
of all transactions.
Each time SymStore stores or removes symbol files, a new transaction number is created. Then, a file, whose name is this transaction number, is created in 000admin. This
file contains a list of all the files or pointers that have been added to the symbol store during this transaction. If a transaction is deleted, SymStore will read through its
transaction file to determine which files and pointers it should delete.
The add and del options specify whether an add or delete transaction is to be performed. Including the /p option with an add operation specifies that a pointer is to be added;
omitting the /p option specifies that the actual symbol file is to be added.
It is also possible to create the symbol store in two separate stages. In the first stage, you use SymStore with the /x option to create an index file. In the second stage, you use
SymStore with the /y option to create the actual store of files or pointers from the information in the index file.
This can be a useful technique for a variety of reasons. For instance, this allows the symbol store to be easily recreated if the store is somehow lost, as long as the index file
still exists. Or perhaps the computer containing the symbol files has a slow network connection to the computer on which the symbol store will be created. In this case, you
can create the index file on the same machine as the symbol files, transfer the index file to the second machine, and then create the store on the second machine.
For a full listing of all SymStore parameters, see SymStore Command-Line Options.
Note SymStore does not support simultaneous transactions from multiple users. It is recommended that one user be designated "administrator" of the symbol store and be
responsible for all add and del transactions.
Transaction Examples
Here are two examples of SymStore adding symbol pointers for build 2195 of Windows 2000 to \\MyDir\symsrv:
symstore add /r /p /f \\BuildServer\BuildShare\2195free\symbols\*.* /s \\MyDir\symsrv /t "Windows 2000" /v "Build 2195 x86 free"
symstore add /r /p /f \\BuildServer\BuildShare\2195free\symbols\*.* /s \\MyDir\symsrv /t "Windows 2000" /v "Build 2195 x86 checke
In the following example, SymStore adds the actual symbol files for an application project in \\largeapp\appserver\bins to \\MyDir\symsrv:
symstore add /r /f \\largeapp\appserver\bins\*.* /s \\MyDir\symsrv /t "Large Application" /v "Build 432" /c "Sample add"
Here is an example of how an index file is used. First, SymStore creates an index file based on the collection of symbol files in \\largeapp\appserver\bins\. In this case, the
index file is placed on a third computer, \\hubserver\hubshare. You use the /g option to specify that the file prefix "\\largeapp\appserver" might change in the future:
symstore add /r /p /g \\largeapp\appserver /f \\largeapp\appserver\bins\*.* /x \\hubserver\hubshare\myindex.txt
Now suppose you move all the symbol files off of the machine \\largeapp\appserver and put them on \\myarchive\appserver. You can then create the symbol store itself from
the index file \\hubserver\hubshare\myindex.txt as follows:
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
If you use a del transaction to undo the original add transactions, these lines will be removed from server.txt, and the following line will be added to history.txt:
0000000105,del,0000000096
The fields for the delete transaction are described as follows.
Field
Description
0000000105 Transaction ID number, as created by SymStore.
del
Type of transaction. This field can be either add or del.
0000000096 Transaction that was deleted.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
10/04/1999
10/06/1999
10/06/1999
11:21a
05:38p
05:46p
<DIR>
<DIR>
<DIR>
37f03cf7277c0
37fa7f00277e0
37fa7f01620a0
In this example, the lookup path for the acpi.dbg symbol file might look like this: \\mybuilds\symsrv\acpi.dbg\37cdb03962040.
Three files may exist inside the lookup directory:
1. acpi.dbg, if the file was stored
2. file.ptr with a path to the actual symbol file, if a pointer was stored
3. refs.ptr, which contains a list of all the current locations for acpi.dbg with this timestamp and image size that are currently added to the symbol store
Displaying the directory listing of \\mybuilds\symsrv\acpi.dbg\37cdb03962040 gives the following:
10/04/1999
10/04/1999
01:54p
01:54p
52 file.ptr
67 refs.ptr
The file file.ptr contains the text string "\\mybuilds\symbols\x86\2128.chk\symbols\sys\acpi.dbg". Since there is no file called acpi.dbg in this directory, the debugger will try
to find the file at \\mybuilds\symbols\x86\2128.chk\symbols\sys\acpi.dbg.
The contents of refs.ptr are used only by SymStore, not the debugger. This file contains a record of all transactions that have taken place in this directory. A sample line from
refs.ptr might be:
0000000026,ptr,\\mybuilds\symbols\x86\2128.chk\symbols\sys\acpi.dbg
This shows that a pointer to \\mybuilds\symbols\x86\2128.chk\symbols\sys\acpi.dbg was added with transaction "0000000026".
Some symbol files stay constant through various products or builds or a particular product. One example of this is the Windows 2000 file msvcrt.pdb. A directory listing of
\\mybuilds\symsrv\msvcrt.pdb shows that only two versions of msvcrt.pdb have been added to the symbols server:
Directory of \\mybuilds\symsrv\msvcrt.pdb
10/06/1999 05:37p
<DIR>
.
10/06/1999 05:37p
<DIR>
..
10/04/1999 11:19a
<DIR>
37a8f40e2
10/06/1999 05:37p
<DIR>
37f2c2272
However, a directory listing of \\mybuilds\symsrv\msvcrt.pdb\37a8f40e2 shows that refs.ptr has several pointers in it.
Directory of \\mybuilds\symsrv\msvcrt.pdb\37a8f40e2
10/05/1999 02:50p
54
file.ptr
10/05/1999 02:50p
2,039
refs.ptr
The contents of \\mybuilds\symsrv\msvcrt.pdb\37a8f40e2\refs.ptr are the following:
0000000001,ptr,\\mybuilds\symbols\x86\2137\symbols\dll\msvcrt.pdb
0000000002,ptr,\\mybuilds\symbols\x86\2137.chk\symbols\dll\msvcrt.pdb
0000000003,ptr,\\mybuilds\symbols\x86\2138\symbols\dll\msvcrt.pdb
0000000004,ptr,\\mybuilds\symbols\x86\2138.chk\symbols\dll\msvcrt.pdb
0000000005,ptr,\\mybuilds\symbols\x86\2139\symbols\dll\msvcrt.pdb
0000000006,ptr,\\mybuilds\symbols\x86\2139.chk\symbols\dll\msvcrt.pdb
0000000007,ptr,\\mybuilds\symbols\x86\2140\symbols\dll\msvcrt.pdb
0000000008,ptr,\\mybuilds\symbols\x86\2140.chk\symbols\dll\msvcrt.pdb
0000000009,ptr,\\mybuilds\symbols\x86\2136\symbols\dll\msvcrt.pdb
0000000010,ptr,\\mybuilds\symbols\x86\2136.chk\symbols\dll\msvcrt.pdb
0000000011,ptr,\\mybuilds\symbols\x86\2135\symbols\dll\msvcrt.pdb
0000000012,ptr,\\mybuilds\symbols\x86\2135.chk\symbols\dll\msvcrt.pdb
0000000013,ptr,\\mybuilds\symbols\x86\2134\symbols\dll\msvcrt.pdb
0000000014,ptr,\\mybuilds\symbols\x86\2134.chk\symbols\dll\msvcrt.pdb
0000000015,ptr,\\mybuilds\symbols\x86\2133\symbols\dll\msvcrt.pdb
0000000016,ptr,\\mybuilds\symbols\x86\2133.chk\symbols\dll\msvcrt.pdb
0000000017,ptr,\\mybuilds\symbols\x86\2132\symbols\dll\msvcrt.pdb
0000000018,ptr,\\mybuilds\symbols\x86\2132.chk\symbols\dll\msvcrt.pdb
0000000019,ptr,\\mybuilds\symbols\x86\2131\symbols\dll\msvcrt.pdb
0000000020,ptr,\\mybuilds\symbols\x86\2131.chk\symbols\dll\msvcrt.pdb
0000000021,ptr,\\mybuilds\symbols\x86\2130\symbols\dll\msvcrt.pdb
0000000022,ptr,\\mybuilds\symbols\x86\2130.chk\symbols\dll\msvcrt.pdb
0000000023,ptr,\\mybuilds\symbols\x86\2129\symbols\dll\msvcrt.pdb
0000000024,ptr,\\mybuilds\symbols\x86\2129.chk\symbols\dll\msvcrt.pdb
0000000025,ptr,\\mybuilds\symbols\x86\2128\symbols\dll\msvcrt.pdb
0000000026,ptr,\\mybuilds\symbols\x86\2128.chk\symbols\dll\msvcrt.pdb
0000000027,ptr,\\mybuilds\symbols\x86\2141\symbols\dll\msvcrt.pdb
0000000028,ptr,\\mybuilds\symbols\x86\2141.chk\symbols\dll\msvcrt.pdb
0000000029,ptr,\\mybuilds\symbols\x86\2142\symbols\dll\msvcrt.pdb
0000000030,ptr,\\mybuilds\symbols\x86\2142.chk\symbols\dll\msvcrt.pdb
This shows that the same msvcrt.pdb was used for multiple builds of symbols for Windows 2000 stored on \\mybuilds\symsrv.
Here is an example of a directory that contains a mixture of file and pointer additions:
Directory of E:\symsrv\dbghelp.dbg\38039ff439000
10/12/1999 01:54p
141,232
dbghelp.dbg
10/13/1999 04:57p
49
file.ptr
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
10/13/1999
04:57p
306
refs.ptr
SymSrv
SymSrv (symsrv.dll) is a symbol server that is included in the Debugging Tools for Windows package.
Many users of Debugging Tools for Windows use the public symbol store on the Microsoft Web site to access symbols for Microsoft products. If this is your goal, you only
need to read the first topic listed below.
This section includes:
Microsoft Public Symbols
Advanced SymSrv Use
Firewalls and Proxy Servers
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
In addition, the symbol path can contain several directories or symbol servers, separated by semicolons. This allows you to locate symbols from multiple locations (or even
multiple symbol servers). If a binary has a mismatched symbol file, the debugger cannot locate it using the symbol server because it checks only for the exact parameters.
However, the debugger may find a mismatched symbol file with the correct name, using the traditional symbol path, and successfully load it. Even though the file is
technically not the correct symbol file, it might provide useful information.
Compressed Files
SymSrv is compatible with symbol stores that contain compressed files, as long as this compression has been done with the compress.exe tool that is distributed with the
Microsoft Windows SDK. Compressed files should have an underscore as the last character in their file extensions (for example, module1.pd_ or module2.db_). For details,
see SymStore.
If the files on the store are compressed, you must use a downstream store. SymSrv will uncompress all files before caching them on the downstream store.
Deleting the Cache
If you are using a DownstreamStore as a cache, you can delete this directory at any time to save disk space.
It is possible to have a vast symbol store that includes symbol files for many different programs or Windows versions. If you upgrade the version of Windows used on your
target computer, the cached symbol files will all match the earlier version. These cached files will not be of any further use, and therefore this might be a good time to delete
the cache.
Cascading Downstream Stores
You can specify any number of downstream stores, separated by asterisks. These stores are known as cascading symbol stores.
After the initial srv* or symsrv*ServerDLL*, each subsequent token represents a symbol location. The token furthest left is checked first. An empty token indicated by
two asterisks in a row, or by an asterisk at the end of the string represents the default downstream store.
Here is an example of a symbol path that uses two downstream stores to hold information from the main symbol store being accessed. These could be called the master store,
the mid-level store, and the local cache:
srv*c:\localcache*\\interim\store*http://msdl.microsoft.com/download/symbols
In this scenario, SymSrv will first look in c:\localcache for a symbol file. If it is found there, it will return a path to it. If it is not found there, it will look in \\interim\store. If
the symbol file is found there, SymSrv will copy it to c:\localcache and return the path. If it is not found there, SymSrv will look in the Microsoft public symbol store at
http://msdl.microsoft.com/download/symbols; if the file is found there, SymSrv will copy it to both \\interim\store and c:\localcache.
A similar behavior would be obtained by using the following path:
srv**\\interim\store*http://internetsite
In this case, the local cache is the default downstream store and the master store is an internet site. A mid-level store of \\interim\store has been specified for use in between
the other two.
When SymSrv processes a path that contains cascading stores, it will skip any store that it cannot read or write to. So if a share goes down, it will copy the file to the store
downstream from the missing store without any error. A nice side effect of this error is that the user can specify more than one master store that feeds a single stream of
downstream stores as long as the master stores are not writable.
When a compressed symbol file is retrieved from the master store, it will be stored in compressed form in any mid-level store. The file will be uncompressed in the bottommost store in the path.
cache*localsymbolcache
Another way to create a local cache of symbols is by using the cache*localsymbolcache string in your symbol path. This is not part of the symbol server element, but a
separate element in your symbol path. The debugger will use the specified directory localsymbolcache to store any symbols loaded from any element that appears in your
symbol path to the right of this string. This allows you to use a local cache for symbols downloaded from any location, not just those downloaded by a symbol server.
For example, the following symbol path will not cache symbols taken from \\someshare. It will use c:\mysymbols to cache symbols taken from \\anothershare, because the
element beginning with \\anothershare appears to the right of the cache*c:\mysymbols element. It will also use c:\mysymbols to cache symbols taken from the Microsoft
public symbol store, because of the usual syntax used by the symbol server (srv with two or more asterisks). Moreover, if you subsequently use the .sympath+ command to
add additional locations to this path, these new elements will also be cached, since they will be appended to the right side of the path.
_NT_SYMBOL_PATH=\\someshare\that\cachestar\ignores;srv*c:\mysymbols*http://msdl.microsoft.com/download/symbols;cache*c:\mysymbols
How SymSrv Locates Files
SymSrv creates a fully-qualified UNC path to the desired symbol file. This path begins with the path to the symbol store recorded in the _NT_SYMBOL_PATH environment
variable. The SymbolServer routine is then used to identify the name of the desired file; this name is appended to the path as a directory name. Another directory name,
consisting of the concatenation of the id, two, and three parameters passed to SymbolServer, is then appended. If any of these values is zero, they are omitted.
The resulting directory is searched for the symbol file, or a symbol store pointer file.
If this search is successful, SymbolServer passes the path to the caller and returns TRUE. If the file is not found, SymbolServer returns FALSE.
Using AgeStore to Reduce the Cache Size
The AgeStore tool can be used to delete cached files that are older than a specified date, or to reduce the contents of the cache below a specified size. This can be useful if
your downstream store is too large. For details, see AgeStore.
2009 Microsoft Corporation
Send feedback on this topic
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The symbol store can now be used for debugging by another computer with a symbol path of srv*\\SymMachineName\symstore, or it can be further configured for use with
authentication or with SymProxy.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
At this point, IIS is now ready to serve the files in your symbol store using anonymous authentication. It is also possible to configure IIS to use Integrated Windows
Authentication (IWA) so that clients such as WinDbg can automatically authenticate against IIS without prompting the end-user for credetials. However, SymSrv does not
currently support Kerberos authentication when connecting to IIS, so Kerberos must be removed as an option.
To configure the authentication method
1.
2.
3.
4.
5.
6.
7.
8.
To remove the option for Kerberos authentication, the Web site identifier is needed. If you are not using the default Web site (which is site "1"), you must determine the
correct Web site identifier by highlighting the Web Sites folder and looking at the identifier listed in the right-hand panel for the appropriate Web site. Replace "1" in these
directions with the correct identifier number.
To force NTLM authentication, thus removing Kerberos authentication
1. Open a Command Prompt window
2. Navigate to the directory c:\inetpub\AdminScripts.
3. Type the following, including the quotation marks:
cscript adsutil.vbs set W3SVC/1/root/Symbols/NtAuthenticationProviders "NTLM"
IIS is now ready to serve files from the symbol store.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SymProxy
You can configure your HTTP-based symbol store to act as a proxy between client computers and other symbol stores. The implementation is through an Internet Server
Application Programming Interface (ISAPI) filter called SymProxy (Symproxy.dll). The SymProxy server can be used as a gateway computer to the Internet or other sources
within your company network.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
You are debugging many systems within a lab environment in which the computers are not attached to the company network, but the symbols are stored in the network
and must be accessed using Integrated Windows Authentication (IWA).
Your corporate computing environment includes a firewall that prevents access to the Internet from computers that are debugging and you must obtain symbols from an
internet Web site.
You want to present a single symbol path for all users in your company so that they need not know or care about where symbols are located, and you can add new
symbol stores without user intervention.
You have a remote site that is physically far from the rest of your company resources, and network access is slow. This system can be used to acquire symbols and
cache them to the remote site.
To install SymProxy, you must manually copy the files to the correct location, configure the registry, choose network security credentials, and configure Internet Information
Services (IIS). To ensure that your HTTP symbol store is properly configured, see HTTP Symbol Stores.
This section includes:
Installing SymProxy
Configuring the Registry
Choosing Network Security Credentials
Configuring IIS for SymProxy
Setting Up Exclusion Lists
Dealing with Unavailable Symbol Stores
Checking and Updating Status
Handling File Pointers
Caching Acquired Symbol Files
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Installing SymProxy
To install SymProxy on the server, copy Symproxy.dll and Symsrv.dll to %WINDIR%\system32\inetsrv.
In order to prevent problems that could occur in accessing the Microsoft Symbol Store at http://msdl.microsoft.com/downloads/symbols, you must also create a file called %
WINDIR%\system32\inetsrv\symsrv.yes. The contents of this file are of no consequence.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Registry Example
In this example, SymProxy first searches for symbols in \\symbols\symbols. If the files are not found there, the Microsoft Symbol Store will be used.
You can also define a global source for all symbol files by generating a SymbolPath value directly in the Web Directories key. However, we do not recommend this because
it causes malformed symbol requests from debugging clients to generate spurious directories and files in the root of your Web site.
Logging
SymProxy reports its activity to the Application Event Viewer. The value stored in Loglevel determines the level of reporting. This is a REG_DWORD located in the
Symbol Server Proxy key. Typically, the default setting is 0, but you can change this to any of the following values:
Loglevel Reporting Level
0
quiet
1
error
2
succss
3
info
4
warning
5
debug
If you have trouble moving files into the symbol store, you can adjust these values to determine what is happening. If you set Loglevel to 5, all activity is available in the
Event Viewer. To determine where files come from and to examine the initialization, set Loglevel to 3.
In order to complete the logging configuration, you must register SymProxy with the Application Event Viewer.
To register SymProxy with the Application Event Viewer
1. Create the registry key
HKLM\SYSTEM\CurrentControlSet\Services\EventLog\Application\SymProxy
2. Within this key, create a new Expandable String Value (REG_EXPAND_SZ) named EventMessageFile.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
In Windows 2000, Windows XP, and Windows Server 2003, use the ProxyCfg tool (Proxycfg.exe). For instructions, type the following in a Command Prompt window:
proxycfg -?
In Windows Vista, Windows Server 2008, and later versions of Windows, use the Netsh tool (netsh.exe). For instructions, type the following in a Command Prompt
window:
netsh winhttp -?
The default behavior of SymProxy is to use whatever HTTP proxy is designated by either ProxyCfg or Netsh. If no HTTP proxy is configured, SymProxy uses a dummy
proxy to allow access to secure HTTP sites within your intranet. As a side effect, this technique prevents SymProxy from working with direct connections to the external
Internet. If you wish to permit SymProxy to operate with a direct connection to the Internet, create a REG_DWORD value named NoInternetProxy in the Symbol Server
Proxy key of your registry. Set the value of NoInternetProxy to 1 and verify that there is no HTTP proxy indicated by ProxyCfg.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Allow access to the Authenticated Users group on the external store or Internet proxy.
Allow access to the Machine Account corp\SymMachineName$. This option is more secure because it limits access to just the symbol proxy server's "Network Service"
account.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
1.
2.
3.
4.
5.
6.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
This causes IIS to return file not found to the debugging client for all transactions on the Web site. However, it does not prevent SymProxy from populating the virtual root
with the file.
After you remove the IIS configuration for MIME types, configure the debugger clients to look for symbols first in the HTTP store and in the share that maps to the virtual
root of the store with the command:
srv**http://server/symbols;srv*\\server\symbols
In the preceding example, the first element of the symbol path (srv**http://server/symbols) says to get files from the HTTP store and copy them to the default symbol store as
a local cache. The specified cache is of no importance because no file is ever received from the HTTP store. After this failure, it attempts to obtain the file from the actual
location of the virtual root of the store (srv*\\server\symbols). This attempt succeeds because the file is copied to that location as a side effect of the previous path processing.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The central portion of the server is the code that communicates with DbgHelp to find the symbols. Every time DbgHelp requires symbols for a newly loaded module, it calls
the symbol server to locate the appropriate symbol files. The symbol server locates each file according to unique parameters such as the time stamp or image size. The server
returns a validated path to the requested file. To implement this, the server must export the SymbolServer function.
The server should also support the SymbolServerSetOptions and SymbolServerGetOptions functions. And DbgHelp will call the SymbolServerClose function, if it is
exported by the server. See Symbol Server API for information about where these routines are documented.
You must not change the actual symbol file name returned by your symbol server. DbgHelp stores the name of a symbol file in multiple locations. Therefore, the server must
return a file of the same name as that specified when the symbol was requested. This restriction is needed to assure that the symbol names displayed during symbol loading
are the ones that the programmer will recognize.
Restrictions on Multiple Symbol Servers
DbgHelp supports the use of only one symbol server at a time. Your symbol path can contain multiple instances of the same symbol server DLL, but not two different symbol
server DLLs. This is not much of a restriction, since you are still free to include multiple instances of a symbol server in your symbol path, each pointing to a different symbol
store. But if you want to switch between two different symbol server DLLs, you will have to change the symbol path each time.
Installing Your Symbol Server
The details of your symbol server installation will depend on your situation. You might wish to set up an installation process that copies your symbol server DLL and sets the
_NT_SYMBOL_PATH environment variable automatically.
Depending on the technology used in your server, you may also need to install or access the symbol data itself.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
addition to general rules for symbol syntax, there are also symbol syntax rules that apply in each of these cases.
General Symbol Syntax Rules
A symbol name consists of one or more characters, but always begins with a letter, underscore (_), question mark (?), or dollar sign ($).
A symbol name may be qualified by a module name. An exclamation mark (!) separates the module name from the symbol (for instance, mymodule!main). If no module
name is used, the symbol can still be prefixed with an exclamation mark. Using an exclamation mark with no module name can be especially useful, even for local variables,
to indicate to a debugger command that a parameter is a name and not a hexadecimal number. For example, the variable fade will be read by the dt (Display Type) command
as an address, unless it is prefixed by an exclamation mark or the -n option is used. However, to specify that a symbol is local, precede it with a dollar sign ( $ ) and an
exclamation point ( ! ), as in $!lime.
Symbol names are completely case-insensitive. This means that the presence of a myInt and a MyInt in your program will not be correctly understood by the debuggers; any
command that references one of these may access the other one, regardless of how the command is capitalized.
Symbol Syntax in Numerical Expressions
The debugger understands two different kinds of expressions: Microsoft Macro Assembler (MASM) expressions and C++ expressions. As far as symbols are concerned, these
two forms of syntax differ as follows:
In MASM expressions, each symbol is interpreted as an address. Depending on what the symbol refers to, this will be the address of a global variable, local variable,
function, segment, module, or any other recognized label.
In C++ expressions, each symbol is interpreted according to its type. Depending on what the symbol refers to, it may be interpreted as an integer, a data structure, a
function pointer, or any other data type. A symbol that does not correspond to a C++ data type (such as an unmodified module name) will result in a syntax error.
For an explanation of when and how to use each type of syntax, see Evaluating Expressions.
If you are using MASM expression syntax, any symbol that could be interpreted as a hexadecimal number or as a register (e.g., BadFeed, ebX) should always be prefixed by
an exclamation point. This makes sure the debugger recognizes it as a symbol.
The ss (Set Symbol Suffix) command can be used to set the symbol suffix. This instructs the debugger to automatically append "A" or "W" to any symbol name it cannot find
otherwise.
Many Win32 routines exist in both ASCII and Unicode versions. These routines often have an "A" or "W" appended to the end of their names, respectively. Using a symbol
suffix will aid the debugger when searching for these symbols.
Suffix matching is not active by default.
Symbol Syntax in Text Expressions
Symbols can be used in the text parameters of some commands for example, bm (Set Breakpoint) and x (Examine Symbols).
These text parameters support a variety of wildcards and specifiers. See String Wildcard Syntax for details. In addition to the standard string wildcards, a text expression used
to specify a symbol can be prefixed with a leading underscore. When matching this to a symbol, the debugger will treat this as any quantity of underscores, even zero.
The symbol suffix is not used when matching symbols in text expressions.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Symbol Options
A number of options are available to control how symbols are loaded and used. These options can be set in a variety of ways.
The following table lists these symbol options:
Flag
0x1
0x2
0x4
0x8
0x10
Option Name
SYMOPT_CASE_INSENSITIVE
SYMOPT_UNDNAME
SYMOPT_DEFERRED_LOADS
SYMOPT_NO_CPP
SYMOPT_LOAD_LINES
0x20
0x40
0x80
0x100
0x200
0x400
0x800
0x1000
0x2000
SYMOPT_OMAP_FIND_NEAREST
On
SYMOPT_LOAD_ANYTHING
Off
SYMOPT_IGNORE_CVREC
Off
SYMOPT_NO_UNQUALIFIED_LOADS
Off
SYMOPT_FAIL_CRITICAL_ERRORS
On
SYMOPT_EXACT_SYMBOLS
Off
SYMOPT_ALLOW_ABSOLUTE_SYMBOLS Off
SYMOPT_IGNORE_NT_SYMPATH
Off
SYMOPT_INCLUDE_32BIT_MODULES
Off
Off
Off
Off
Off
Off
On
On
Off
Off
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
0x4000
0x8000
0x10000
0x20000
0x40000
0x80000
SYMOPT_PUBLICS_ONLY
SYMOPT_NO_PUBLICS
SYMOPT_AUTO_PUBLICS
SYMOPT_NO_IMAGE_SEARCH
SYMOPT_SECURE
SYMOPT_NO_PROMPTS
Off
Off
On
On
Off
On in KD and CDB
Off
Off
On
Off
Off
Off
Off in WinDbg
0x80000000 SYMOPT_DEBUG
Off
Off
SYMOPT_CASE_INSENSITIVE
This symbol option causes all searches for symbol names to be case-insensitive.
This option is on by default in all debuggers. Once the debugger is running, it can be turned on or off by using .symopt+0x1 or .symopt-0x1, respectively.
This option is on by default in DBH. Once DBH is running, it can be turned on or off by using symopt +1 or symopt -1, respectively.
SYMOPT_UNDNAME
This symbol option causes public symbol names to be undecorated when they are displayed, and causes searches for symbol names to ignore symbol decorations. Private
symbol names are never decorated, regardless of whether this option is active. For information on symbol name decorations, see Public and Private Symbols.
This option is on by default in all debuggers. Once the debugger is running, it can be turned on or off by using .symopt+0x2 or .symopt-0x2, respectively.
This option is on by default in DBH. It is turned off if the -d command-line option is used. Once DBH is running, it can be turned on or off by using symopt +2 or symopt -2,
respectively.
SYMOPT_DEFERRED_LOADS
This symbol option is called deferred symbol loading or lazy symbol loading. When it is active, symbols are not actually loaded when the target modules are loaded. Instead,
symbols are loaded by the debugger as they are needed. See Deferred Symbol Loading for details.
This option is on by default in all debuggers. In CDB and KD, the -s command-line option will turn this option off. It can also be turned off in CDB by using the LazyLoad
variable in the tools.ini file. Once the debugger is running, this option can be turned on or off by using .symopt+0x4 or .symopt-0x4, respectively.
This option is off by default in DBH. Once DBH is running, it can be turned on or off by using symopt +4 or symopt -4, respectively.
SYMOPT_NO_CPP
This symbol option turns off C++ translation. When this symbol option is set, :: is replaced by __ in all symbols.
This option is off by default in all debuggers. It can be activated by using the -snc command-line option. Once the debugger is running, it can be turned on or off by
using .symopt+0x8 or .symopt-0x8, respectively.
This option is off by default in DBH. Once DBH is running, it can be turned on or off by using symopt +8 or symopt -8, respectively.
SYMOPT_LOAD_LINES
This symbol option allows line number information to be read from source files. This option must be on for source debugging to work correctly.
In KD and CDB, this option is off by default; in WinDbg, this option is on by default. In CDB and KD, the -lines command-line option will turn this option on. Once the
debugger is running, it can be turned on or off by using .symopt+0x10 or .symopt-0x10, respectively. It can also be toggled on and off by using the .lines (Toggle Source
Line Support) command.
This option is on by default in DBH. Once DBH is running, it can be turned on or off by using symopt +10 or symopt -10, respectively.
SYMOPT_OMAP_FIND_NEAREST
When code has been optimized and there is no symbol at the expected location, this option causes the nearest symbol to be used instead.
This option is on by default in all debuggers. Once the debugger is running, it can be turned on or off by using .symopt+0x20 or .symopt-0x20, respectively.
This option is on by default in DBH. Once DBH is running, it can be turned on or off by using symopt +20 or symopt -20, respectively.
SYMOPT_LOAD_ANYTHING
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
This symbol option reduces the pickiness of the symbol handler when it is attempting to match symbols.
This option is off by default in all debuggers. Once the debugger is running, it can be turned on or off by using .symopt+0x40 or .symopt-0x40, respectively.
This option is off by default in DBH. Once DBH is running, it can be turned on or off by using symopt +40 or symopt -40, respectively.
SYMOPT_IGNORE_CVREC
This symbol option causes the symbol handler to ignore the CV record in the loaded image header when searching for symbols.
This option is off by default in all debuggers. It can be activated by using the -sicv command-line option. Once the debugger is running, it can be turned on or off by
using .symopt+0x80 or .symopt-0x80, respectively.
This option is off by default in DBH. Once DBH is running, it can be turned on or off by using symopt +80 or symopt -80, respectively.
SYMOPT_NO_UNQUALIFIED_LOADS
This symbol option disables the symbol handler's automatic loading of modules. When this option is set and the debugger attempts to match a symbol, it will only search
modules which have already been loaded.
This option can be used as a defense against mistyping a symbol name. Normally, a mistyped symbol will cause the debugger to pause while it searches all unloaded symbol
files. When this option is active, a mistyped symbol will not be found in the loaded modules, and then the search will terminate.
This option is off by default in all debuggers. It can be activated by using the -snul command-line option. Once the debugger is running, it can be turned on or off by
using .symopt+0x100 or .symopt-0x100, respectively.
This option is off by default in DBH. Once DBH is running, it can be turned on or off by using symopt +100 or symopt -100, respectively.
SYMOPT_FAIL_CRITICAL_ERRORS
This symbol option causes file access error dialog boxes to be suppressed.
If this option is off, file access errors, such as "drive not ready", encountered during symbol loading, will result in dialog boxes appearing. If this option is on, these boxes are
suppressed and all access errors receive a "fail" response.
This option is on by default in all debuggers. It can be deactivated by using the -sdce command-line option. Once the debugger is running, it can be turned on or off by
using .symopt+0x200 or .symopt-0x200, respectively.
This option is off by default in DBH. Once DBH is running, it can be turned on or off by using symopt +200 or symopt -200, respectively.
SYMOPT_EXACT_SYMBOLS
This symbol option causes the debugger to perform a strict evaluation of all symbol files.
When this option is on, even the slightest discrepancy between the symbol files and the symbol handler's expectations will cause the symbols to be ignored.
This option is off by default in all debuggers. It can be activated by using the -ses command-line option. Once the debugger is running, it can be turned on or off by
using .symopt+0x400 or .symopt-0x400, respectively.
The -failinc command-line option also turns on SYMOPT_EXACT_SYMBOLS. In addition, if you are debugging a user-mode minidump or a kernel-mode minidump,
-failinc will prevent the debugger from loading any modules whose images can't be mapped.
This option is on by default in DBH. Once DBH is running, it can be turned on or off by using symopt +400 or symopt -400, respectively.
SYMOPT_ALLOW_ABSOLUTE_SYMBOLS
This symbol option allows DbgHelp to read symbols that are stored at an absolute address in memory. This option is not needed in the vast majority of cases.
This option is off by default in all debuggers. Once the debugger is running, it can be turned on or off by using .symopt+0x800 or .symopt-0x800, respectively.
This option is on by default in DBH. Once DBH is running, it can be turned on or off by using symopt +800 or symopt -800, respectively.
SYMOPT_IGNORE_NT_SYMPATH
This symbol option causes the debugger to ignore the environment variable settings for the symbol path and the executable image path.
This option is off by default in all debuggers. It can be activated by using the -sins command-line option. However, it cannot be controlled by .symopt once the debugger is
running, because the environment variables are only read at startup.
This option is off by default in DBH, and is ignored by DBH in all cases.
SYMOPT_INCLUDE_32BIT_MODULES
This symbol option forces DbgHelp and ImageHlp to enumerate 32-bit modules on an Intel Itanium processor.
This option is off by default in all debuggers. Once the debugger is running, it can be turned on or off by using .symopt+0x2000 or .symopt-0x2000, respectively.
This option is off by default in DBH. Once DBH is running, it can be turned on or off by using symopt +2000 or symopt -2000, respectively.
SYMOPT_PUBLICS_ONLY
This symbol option causes DbgHelp to ignore private symbol data, and search only the public symbol table for symbol information. This emulates the behavior of DbgHelp
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
before support for these types was added. see Public and Private Symbols.
This option is off by default in all debuggers. Once the debugger is running, it can be turned on or off by using .symopt+0x4000 or .symopt-0x4000, respectively.
This option is off by default in DBH. It is turned on if the -d command-line option is used. Once DBH is running, it can be turned on or off by using symopt +4000 or
symopt -4000, respectively.
SYMOPT_NO_PUBLICS
This symbol option prevents DbgHelp from searching the public symbol table. This can make symbol enumeration and symbol searches much faster. If you are concerned
solely with search speed, the SYMOPT_AUTO_PUBLICS option is generally preferable to this one. For information on the public symbol table, see Public and Private
Symbols.
This option is off by default in all debuggers. Once the debugger is running, it can be turned on or off by using .symopt+0x8000 or .symopt-0x8000, respectively.
This option is off by default in DBH. Once DBH is running, it can be turned on or off by using symopt +8000 or symopt -8000, respectively.
SYMOPT_AUTO_PUBLICS
This symbol option causes DbgHelp to search the public symbol table in a .pdb file only as a last resort. If any matches are found when searching the private symbol data, the
public symbols will not be searched. This improves symbol search speed.
This option is on by default in all debuggers. It can be deactivated by using the -sup command-line option. Once the debugger is running, it can be turned on or off by
using .symopt+0x10000 or .symopt-0x10000, respectively.
This option is on by default in DBH. It is turned off if the -d command-line option is used. Once DBH is running, it can be turned on or off by using symopt +10000 or
symopt -10000, respectively.
SYMOPT_NO_IMAGE_SEARCH
This symbol option prevents DbgHelp from searching the disk for a copy of the image when symbols are loaded.
This option is on by default in all debuggers. Once the debugger is running, it can be turned on or off by using .symopt+0x20000 or .symopt-0x20000, respectively.
This option is off by default in DBH. Once DBH is running, it can be turned on or off by using symopt +20000 or symopt -20000, respectively.
SYMOPT_SECURE
(Kernel mode only) This symbol option indicates whether Secure Mode is active.
Secure Mode is off by default in all debuggers. It can be activated by using the -secure command-line option. If the debugger is running, is in dormant mode, and has not
established any Debugging Servers, Secure Mode can be turned on by using .symopt+0x40000 or .secure (Activate Secure Mode).
This option is off by default in DBH. Once DBH is running, it can be turned on or off by using symopt +40000 or symopt -40000, respectively.
Secure mode can never be turned off once it has been activated.
SYMOPT_NO_PROMPTS
This symbol option suppresses authentication dialog boxes from the proxy server. This may result in SymSrv being unable to access a symbol store on the internet.
For details, see Firewalls and Proxy Servers.
In KD and CDB, this option is on by default; in WinDbg, this option is off by default. Once the debugger is running, it can be turned on or off by using .symopt+0x80000 or
.symopt-0x80000, respectively, followed by the .reload (Reload Module) command. It can also be turned on and off by using the !sym prompts off and !sym prompts
extension commands, followed by the .reload (Reload Module) command.
This option is off by default in DBH. Once DBH is running, it can be turned on or off by using symopt +80000 or symopt -80000, respectively.
SYMOPT_DEBUG
This symbol option turns on noisy symbol loading. This instructs the debugger to display information about its search for symbols.
The name of each symbol file will be displayed as it is loaded. If the debugger cannot load a symbol file, it will display an error message. Error messages for .pdb files will be
displayed in text. Error messages for .dbg files will be in the form of an error code; these codes are explained in the winerror.h file.
If an image file is loaded solely to recover symbolic header information, this will be displayed as well.
This option is off by default in all debuggers. It can be activated by using the -n command-line option. Once the debugger is running, it can be turned on or off by
using .symopt+0x80000000 or .symopt-0x80000000, respectively. It can also be turned on and off by using the !sym noisy and !sym quiet extension commands.
Note This option should not be confused with noisy source loading that is controlled by the .srcnoisy (Noisy Source Loading) command.
This option is off by default in DBH. It can be activated by using the -n command-line option. Once DBH is running, it can be turned on or off by using symopt +80000000
or symopt -80000000, respectively. It can also be turned on and off by using the verbose on and verbose off commands.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Verifying Symbols
Symbol problems can show up in a variety of ways. Perhaps a stack trace shows incorrect information or fails to identify the names of the functions in the stack. Or perhaps a
debugger command failed to understand the name of a module, function, variable, structure, or data type.
If you suspect that the debugger is not loading symbols correctly, there are several steps you can take to investigate this problem.
First, use the lm (List Loaded Modules) command to display the list of loaded modules with symbol information. The most useful form of this command is the following:
0:000> lml
If you are using WinDbg, the Debug | Modules menu command will let you see this information as well.
Pay particular attention to any notes or abbreviations you may see in these displays. For an interpretation of these, see Symbol Status Abbreviations.
If you don't see the proper symbol files, the first thing to do is to check the symbol path:
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
0:000> .sympath
Current Symbol Path is: d:\MyInstallation\i386\symbols\retail
If your symbol path is wrong, fix it. If you are using the kernel debugger make sure your local %WINDIR% is not on your symbol path.
Then reload symbols using the .reload (Reload Module) command:
0:000> .reload ModuleName
If your symbol path is correct, you should activate noisy mode so you can see which symbol files dbghelp is loading. Then reload your module. See Setting Symbol Options
for information about how to activate noisy mode.
Here is an example of a "noisy" reload of the Microsoft Windows symbols:
kd>
kd>
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
!sym noisy
.reload nt
Kernel Version 2081 MP Checked
Kernel base = 0x80400000 PsLoadedModuleList = 0x80506fa0
DBGHELP: FindExecutableImageEx-> Looking for D:\MyInstallation\i386\ntkrnlmp.exe...mismatched timestamp
DBGHELP: No image file available for ntkrnlmp.exe
DBGHELP: FindDebugInfoFileEx-> Looking for
d:\MyInstallation\i386\symbols\retail\symbols\exe\ntkrnlmp.dbg... no file
DBGHELP: FindDebugInfoFileEx-> Looking for
d:\MyInstallation\i386\symbols\retail\symbols\exe\ntkrnlmp.pdb... no file
DBGHELP: FindDebugInfoFileEx-> Looking for d:\MyInstallation\i386\symbols\retail\exe\ntkrnlmp.dbg... OK
DBGHELP: LocatePDB-> Looking for d:\MyInstallation\i386\symbols\retail\exe\ntkrnlmp.pdb... OK
*** WARNING: symbols checksum and timestamp is wrong 0x0036a4ea 0x00361a83 for ntkrnlmp.exe
The symbol handler first looks for an image that matches the module it is trying to load (lines three and four). The image itself is not always necessary, but if an incorrect one
is present, the symbol handler will often fail. These lines show that the debugger found an image at D:\MyInstallation\i386\ntkrnlmp.exe, but the time-date stamp didn't
match. Because the time-date stamp didn't match, the search continues. Next, the debugger looks for a .dbg file and a .pdb file that match the loaded image. These are on lines
6 through 10. Line 11 indicates that even though symbols were loaded, the time-date stamp for the image did not match (that is, the symbols were wrong).
If the symbol-search encountered a catastrophic failure, you would see a message of the form:
ImgHlpFindDebugInfo(00000000, module.dll, c:\MyDir;c:\SomeDir, 0823345, 0) failed
This could be caused by items such as file system failures, network errors, and corrupt .dbg files.
Diagnosing Symbol Loading Errors
When in noisy mode, the debugger may print out error codes when it cannot load a symbol file. The error codes for .dbg files are listed in winerror.h. The .pdb error codes
come from another source and the most common errors are printed in plain English text.
Some common error codes for .dbg files from winerror.h are:
0xB
ERROR_BAD_FORMAT
0x3
ERROR_PATH_NOT_FOUND
0x35
ERROR_BAD_NETPATH
It's possible that the symbol file cannot be loaded because of a networking error. If you see ERROR_BAD_FORMAT or ERROR_BAD_NETPATH and you are loading
symbols from another machine on the network, try copying the symbol file to your host computer and put its path in your symbol path. Then try to reload the symbols.
Verifying Your Search Path and Symbols
Let "c:\MyDir;c:\SomeDir" represent your symbol path. Where should you look for debug information?
In cases where the binary has been stripped of debug information, such as the free builds of Windows, first look for a .dbg file in the following locations:
c:\MyDir\symbols\exe\ntoskrnl.dbg
c:\SomeDir\symbols\exe\ntoskrnl.dbg
c:\MyDir\exe\ntoskrnl.dbg
c:\SomeDir\exe\ntoskrnl.dbg
c:\MyDir\ntoskrnl.dbg
c:\SomeDir\ntoskrnl.dbg
current-working-directory\ntoskrnl.dbg
Next, look for a .pdb file in the following locations:
c:\MyDir\symbols\exe\ntoskrnl.pdb
c:\MyDir\exe\ntoskrnl.pdb
c:\MyDir\ntoskrnl.pdb
c:\SomeDir\symbols\exe\ntoskrnl.pdb
c:\SomeDir\exe\ntoskrnl.pdb
c:\SomeDir\ntoskrnl.pdb
current-working-directory\ntoskrnl.pdb
Note that in the search for the .dbg file, the debugger interleaves searching through the MyDir and SomeDir directories, but in the .pdb search it does not.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Windows XP and later versions of Windows do not use any .dbg symbol files. See Symbols and Symbol Files for details.
Mismatched Builds
One of the most common problems in debugging failures on a machine that is often updated is mismatched symbols from different builds. Three common causes of this
problem are: pointing at symbols for the wrong build, using a privately built binary without the corresponding symbols, and using the uniprocessor hardware abstraction level
(HAL) and kernel symbols on a multiprocessor machine. The first two are simply a matter of matching your binaries and symbols; the third can be corrected by renaming your
hal*.dbg and ntkrnlmp.dbg to hal.dbg and ntoskrnl.dbg.
To find out what build of Windows is installed on the target computer, use the vertarget (Show Target Computer Version) command:
kd> vertarget
Windows XP Kernel Version 2505 UP Free x86 compatible
Built by: 2505.main.010626-1514
Kernel base = 0x804d0000 PsLoadedModuleList = 0x80548748
Debug session time: Mon Jul 02 14:41:11 2001
System Uptime: 0 days 0:04:53
Testing the Symbols
Testing the symbols is more difficult. It involves verifying a stack trace on the debugger and seeing if the debug output is correct. Here's one example to try:
kd> u videoprt!videoportfindadapter2
Loading symbols for 0xf2860000
videoprt.sys ->
VIDEOPRT!VideoPortFindAdapter2:
f2856f42 55
push
f2856f43 8bec
mov
f2856f45 81ecb8010000
sub
f2856f4b 8b4518
mov
f2856f4e 53
push
f2856f4f 8365f400
and
f2856f53 8065ff00
and
f2856f57 56
push
videoprt.sys
ebp
ebp,esp
esp,0x1b8
eax,[ebp+0x18]
ebx
dword ptr [ebp-0xc],0x
byte ptr [ebp-0x1],0x0
esi
The u command unassembles the videoportfindadapter string in videoprt.sys. The symbols are correct on the debugger because common stack commands like push and mov
show up on the stack. Most functions begin with an add, sub, or push operation using either the base pointer (ebp) or the stack pointer (esp).
It's usually obvious when the symbols aren't working correctly. Glintmp.sys doesn't have symbols in this example because a function isn't listed next to Glintmp:
kd> kb
Loading symbols for 0xf28d0000
videoprt.sys ->
videoprt.sys
Loading symbols for 0xf9cdd000
glintmp.sys ->
glintmp.sys
*** ERROR: Symbols could not be loaded for glintmp.sys
ChildEBP RetAddr Args to Child
f29bf1b0 8045b5fa 00000001 0000a100 00000030 ntoskrnl!RtlpBreakWithStatusInstruction
f29bf1b0 8044904e 00000001 0000a100 00000030 ntoskrnl!KeUpdateSystemTime+0x13e
f29bf234 f28d1955 f9b7d000 ffafb2dc f9b7d000 ntoskrnl!READ_REGISTER_ULONG+0x6
f29bf248 f9cde411 f9b7d000 f29bf2b0 f9ba0060 VIDEOPRT!VideoPortReadRegisterUlong+0x27
00000002 00000000 00000000 00000000 00000000 glintMP+0x1411 [No function listed.]
The wrong build symbols were loaded for this stack trace. Notice how there are no functions listed for the first two calls. This stack trace looks like a problem with win32k.sys
drawing rectangles:
1: kd>
1: kd> kb
[Local
9:50 AM]
Loading symbols for 0xf22b0000
agpcpq.sys ->
agpcpq.sys
*** WARNING: symbols checksum is wrong 0x0000735a 0x00000000 for agpcpq.sys
*** ERROR: Symbols could not be loaded for agpcpq.sys
Loading symbols for 0xa0000000
win32k.sys ->
win32k.sys
*** WARNING: symbols checksum is wrong 0x00191a41 0x001995a9 for win32k.sys
ChildEBP RetAddr Args to Child
be682b18 f22b372b 82707128 f21c1ffc 826a70f8 agpCPQ+0x125b [No function listed.]
be682b4c a0140dd4 826a72f0 e11410a8 a0139605 agpCPQ+0x372b [No function listed.]
be682b80 a00f5646 e1145100 e1cee560 e1cee560 win32k!vPatCpyRect1_6x6+0x20b
00000001 00000000 00000000 00000000 00000000 win32k!RemoteRedrawRectangle+0x32
Here's the correct stack trace. The problem is really with AGP440.sys. The first item appearing on a stack trace is usually at fault. Notice that the win32k.sys rectangle error is
gone:
1: kd> kb
ChildEBP RetAddr
be682b18 f22b372b
be682b30 f20a385c
be682b4c a0140dd4
be682b58 a0139605
be682b64 a00e5f0a
be682b80 a00f5646
be682b9c a00f5c20
be682bac a00da510
be682bc4 a00da787
be682bec a00d59fb
[Local
Args to Child
82707128 f21c1ffc 826a70f8
82703638 e183ec68 00000000
826a72f0 e11410a8 a0139605
e1cee560 e11410a8 a00e5f0a
e1cee560 e11410a8 e1cee560
e1145100 e1cee560 e1cee560
e1cee008 e1cee008 be682c0c
e1cee008 00000000 be682c0c
00000000 e1843df8 e1843de8
00000000 e1843de8 00000000
9:49 AM]
agpCPQ!AgpReleaseMemory+0x88
agpCPQ!AgpInterfaceReleaseMemory+0x8b
VIDEOPRT!AgpReleasePhysical+0x44
win32k!OsAGPFree+0x14
win32k!AGPFree+0xd
win32k!HeapVidMemFini+0x49
win32k!vDdDisableDriver+0x3a
win32k!vDdDisableDirectDraw+0x2d
win32k!PDEVOBJ__vDisableSurface+0x27
win32k!PDEVOBJ__vUnreferencePdev+0x204
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
be682c04
be682ce0
be682d20
be682d48
be682d48
a00d7421
a00a9e7f
a008b543
8045d119
77e63660
e1cee008
e1843e10
00000000
00000000
00000000
82566a98
e184a008
00000000
00000000
00000000
00000001
00000000
00000000
00000000
00000000
win32k!DrvDestroyMDEV+0x30
win32k!DrvChangeDisplaySettings+0x8b3
win32k!xxxUserChangeDisplaySettings+0x106
win32k!NtUserChangeDisplaySettings+0x48
ntkrnlmp!KiSystemService+0xc9
Determine which COM port the debug cable is connected to on the test system.
Check the boot.ini settings of the test system. Look for the /debug switch and check the baud rate and COM port settings.
Network problems can interfere with debugging if the symbols files are accessed through the network.
.dll and .sys files with the same name (for example mga64.sys and mga64.dll) will confuse the debugger if they aren't separated into the proper directories of the
symbol tree.
The kernel debugger doesn't always like replacing the build symbol files with private symbol files. Double check the symbol path and do a .reload FileName on the
misbehaving symbol. The !dlls command is sometimes useful.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Make a second copy of the kernel itself. It is probably easiest to put this on a network share.
Append the root directory of this share to the symbol path. See Symbol Path for the ways to change the symbol path.
Use the .reload (Reload Module) command.
Use the !sym noisy extension command to see more verbose output. If this is used, you will be able to see which symbols are loaded from the module images on the
target computer, and which are loaded from the copy of the kernel modules.
This technique must be used with care, since the debugger has no way of verifying whether the file copies actually match the originals. So it is crucial that the version of
Windows used on the network share matches the version used on the target computer.
This technique is only used for kernel-mode debugging. The operating system is capable of paging in any headers required during user-mode debugging (unless the disk
holding the paging file is dismounted or otherwise inaccessible).
Here is an example of this technique being used:
kd> .reload
Connected to Windows XP 2268 x86 compatible target, ptr64 FALSE
Loading Kernel Symbols
..........Unable to read image header for dmload.sys at fe0be000 - NTSTATUS 0xC0000001
..........Unable to read image header for dmboot.sys at fda93000 - NTSTATUS 0xC0000001
.....................................Unable to read image header for fdc.sys at fdfc2000 - NTSTATUS 0xC0000001
...Unable to read image header for flpydisk.sys at fde4a000 - NTSTATUS 0xC0000001
.Unable to read image header for Fs_Rec.SYS at fe0c8000 - NTSTATUS 0xC0000001
.Unable to read image header for Null.SYS at fe2c4000 - NTSTATUS 0xC0000001
...................Unable to read image header for win32k.sys at a0000000 - NTSTATUS 0xC0000001
..Unable to read image header for dxg.sys at a0194000 - NTSTATUS 0xC0000001
.......Unable to read image header for ati2draa.dll at a01a4000 - NTSTATUS 0xC0000001
..Unable to read image header for ParVdm.SYS at fe116000 - NTSTATUS 0xC0000001
.......
Loading unloaded module list
..............
Loading User Symbols
Unable to retrieve the PEB address. This is usually caused
by being in the wrong process context or by paging
Notice that many images have inaccessible headers. Check the symbols from one of these files (in this example, fs_rec.sys):
kd> x fs_rec!*
*** ERROR: Module load completed but symbols could not be loaded for fs_rec.sys
These headers are apparently paged out. So you need to add the proper images to the symbol path:
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Then use the !vad extension to list the VAD tree associated with the process. Those VADs labelled "EXECUTE_WRITECOPY" belong to DLLs.
kd> !vad e000012601a35e70
VAD
level
start
end
commit
e0000126019f9790 ( 6)
3fff0
3fff7
e000012601be1080 ( 7)
37d9bd30 37d9bd3e
e000012600acd970 ( 5)
37d9bec0 37d9bece
e000012601a5cba0 ( 7)
37d9c910 37d9c924
-1
2
2
2
Private
Mapped Exe
Mapped Exe
Mapped Exe
READONLY
EXECUTE_WRITECOPY
EXECUTE_WRITECOPY
EXECUTE_WRITECOPY
Then use the !vad extension again to find the starting address and size of the paged out memory which holds the DLL of interest. This confirms that you have found the
correct DLL:
kd> !vad e000012601be1080 1
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
VAD @ e000012601be1080
Start VPN:
37d9bd30 End VPN: 37d9bd3e Control Area: e00001260197b8d0
First ProtoPte: e0000006013e00a0 Last PTE fffffffffffffffc Commit Charge
Secured.Flink
0 Blink
0 Banked/Extend:
0
File Offset
0
ImageMap ViewShare EXECUTE_WRITECOPY
2 (2.)
File: \Windows\System32\ExplorerFrame.dll
The "Start VPN" field in this case, 0x37D9BD30 indicates the starting virtual page number. This must be converted to an actual address, by multiplying it by the page
size. You can use the ? (Evaluate Expression) command to multiply this value by 0x2000, which is the page size for the Itanium-based machine the example comes from.
kd> ? 37d9bd3e*2000
Evaluate expression: 7676040298496 = 000006fb`37a7c000
Then the size of the range can be converted to bytes:
kd> ? 37d9bd3e-37d9bd30+1
<-computes the number of pages
Evaluate expression: 15 = 00000000`0000000f
kd> ? f*2000
Evaluate expression: 122880 = 00000000`0001e000
So ExplorerFrame.dll starts at address 0x000006Fb`37A7C000 and is 0x1E000 bytes large. You can load its symbols with:
kd> .reload /f ExplorerFrame.dll=6fb`37a7c000,1e000
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
kd> u f864b4cb
tcpip!IPTransmit+e48:
f864b4cb f3a4
f864b4cd 8b75cc
f864b4d0 8b4d10
f864b4d3 8b7da4
f864b4d6 8bc6
f864b4d8 6a10
f864b4da 034114
f864b4dd 57
rep
mov
mov
mov
mov
push
add
push
movsb
esi,[ebp-0x34]
ecx,[ebp+0x10]
edi,[ebp-0x5c]
eax,esi
0x10
eax,[ecx+0x14]
edi
You can see from the breakpoint list that the address of IPTransmit is 0xF8640CA6.
When you unassemble a section of code within this function at 0xF864B4CB, the output indicates that this is 0xE48 bytes past the beginning of the function. However, if you
subtract the base of the function from this address, the actual offset appears to be 0xA825.
What is happening is this: The debugger is indeed showing a disassembly of the binary instructions beginning at 0xF864B4CB. But instead of computing the offset by simple
subtraction, the debugger displays as best it can the offset to the function entry as it existed in the original code before the optimizations were performed. That value is
0xE48.
On the other hand, if you try to look at IPTransmit+0xE48, you will see this:
kd> u tcpip!iptransmit+e48
tcpip!ARPTransmit+d8:
f8641aee 0856ff
or
f8641af1 75fc
jnz
f8641af3 57
push
f8641af4 e828eeffff
call
f8641af9 5f
pop
f8641afa 5e
pop
f8641afb 5b
pop
f8641afc c9
leave
[esi-0x1],dl
tcpip!ARPTransmit+0xd9 (f8641aef)
edi
tcpip!ARPSendData (f8640921)
edi
esi
ebx
What is happening here is that the debugger recognizes the symbol IPTransmit as equivalent to the address 0xF8640CA6, and the command parser performs a simple
addition to find that 0xF8640CA6 + 0xE48 = 0xF8641AEE. This address is then used as the argument for the u (Unassemble) command. But once this location is analyzed,
the debugger discovers that this is not IPTransmit plus an offset of 0xE48. Indeed, it is not part of this function at all. Rather, it corresponds to the function ARPTransmit
plus an offset of 0xD8.
The reason this happens is that performance optimization is not reversible through address arithmetic. While the debugger can take an address and deduce its original symbol
and offset, it does not have enough information to take a symbol and offset and translate it to the correct address. Consequently, disassembly is not useful in these cases.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
This section covers how to create and analyze a kernel-mode memory dump file. There are three different varieties of crash dump files. However, it should be remembered
that no dump file can ever be as useful and versatile as a live kernel debugger attached to the system that has failed.
This section includes:
Varieties of Kernel-Mode Dump Files
Creating a Kernel-Mode Dump File
Analyzing a Kernel-Mode Dump File
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The bug check message and parameters, as well as other blue-screen data.
The processor context (PRCB) for the processor that crashed.
The process information and kernel context (EPROCESS) for the process that crashed.
The thread information and kernel context (ETHREAD) for the thread that crashed.
The kernel-mode call stack for the thread that crashed. If this is longer than 16 KB, only the topmost 16 KB will be included.
A list of loaded drivers.
In Windows XP and later versions of Windows, the following items are also included:
This kind of dump file can be useful when space is greatly limited. However, due to the limited amount of information included, errors that were not directly caused by the
thread executing at time of crash may not be discovered by an analysis of this file.
Since this kind of dump file does not contain images of any executables residing in memory at the time of the crash, you may also need to set the executable image path if
these executables turn out to be important.
If a second bug check occurs and a second Small Memory Dump file is created, the previous file will be preserved. Each additional file will be given a distinct name, which
contains the date of the crash encoded in the filename. For example, mini022900-01.dmp is the first memory dump file generated on February 29, 2000. A list of all Small
Memory Dump files is kept in the directory %SystemRoot%\Minidump.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The settings that you select will apply to any kernel-mode dump file created by a system crash, regardless of whether the system crash was accidental or whether it was caused
by the debugger. See Forcing a System Crash for details on causing a deliberate crash.
However, these settings do not affect dump files created by the .dump command. See Creating a Dump File Without a System Crash for details on using this command.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
If an experienced debugging technician is present, he or she can hook up a kernel debugger and analyze the problem. For some tips on what to look for when this situation
occurs, see Debugging a Stalled System.
However, if no technician is present, you may wish to create a kernel-mode dump file and send it to an off-site technician. This dump file can be used to analyze the cause of
the error.
There are two ways to deliberately cause a system crash:
Forcing a System Crash from the Debugger
Forcing a System Crash from the Keyboard
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
3. With USB keyboards, you must enable the keyboard-initiated crash in the registry. In the registry key
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\kbdhid\Parameters, create a value named CrashOnCtrlScroll, and set it equal to a
REG_DWORD value of 0x01.
You must restart the system for these settings to take effect.
After this is completed, the keyboard crash can be initiated by using the following hotkey sequence: Hold down the rightmost CTRL key, and press the SCROLL LOCK key
twice.
The system then calls KeBugCheck and issues bug check 0xE2 (MANUALLY_INITIATED_CRASH). Unless crash dumps have been disabled, a crash dump file is written
at this point.
If a kernel debugger is attached to the crashed machine, the machine will break into the kernel debugger after the crash dump file has been written.
For more information on using this feature, refer to the article
Defining Alternate Keyboard Shortcuts to Force a System Crash from the Keyboard
You can configure values under the following registry subkeys for different keyboard shortcut sequences to generate the memory dump file:
You must create the following registry REG_DWORD values under these subkeys:
Dump1Keys
The Dump1Keys registry value is a bit map of the first hot key to use. For example, instead of using the rightmost CTRL key to initiate the hot key sequence, you can set
the first hot key to be the leftmost SHIFT key.
The values for the first hot key are described in the following table.
Value First key used in the keyboard shortcut sequence
0x01 Rightmost SHIFT key
0x02 Rightmost CTRL key
0x04 Rightmost ALT key
0x10 Leftmost SHIFT key
0x20 Leftmost CTRL key
0x40 Leftmost ALT key
Note You can assign Dump1Keys a value that enables one or more keys as the first key used in the keyboard shortcut sequence. For example, assign Dump1Keys a
value of 0x11 to define both the rightmost and leftmost SHIFT keys as the first key in the keyboard shortcut sequence.
Dump2Key
The Dump2Key registry value is the index into the scancode table for the keyboard layout of the target computer. The following is the actual table in the driver.
const UCHAR keyToScanTbl[134] = {
0x00,0x29,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,
0x0A,0x0B,0x0C,0x0D,0x7D,0x0E,0x0F,0x10,0x11,0x12,
0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x00,
0x3A,0x1E,0x1F,0x20,0x21,0x22,0x23,0x24,0x25,0x26,
0x27,0x28,0x2B,0x1C,0x2A,0x00,0x2C,0x2D,0x2E,0x2F,
0x30,0x31,0x32,0x33,0x34,0x35,0x73,0x36,0x1D,0x00,
0x38,0x39,0xB8,0x00,0x9D,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0xD2,0xD3,0x00,0x00,0xCB,
0xC7,0xCF,0x00,0xC8,0xD0,0xC9,0xD1,0x00,0x00,0xCD,
0x45,0x47,0x4B,0x4F,0x00,0xB5,0x48,0x4C,0x50,0x52,
0x37,0x49,0x4D,0x51,0x53,0x4A,0x4E,0x00,0x9C,0x00,
0x01,0x00,0x3B,0x3C,0x3D,0x3E,0x3F,0x40,0x41,0x42,
0x43,0x44,0x57,0x58,0x00,0x46,0x00,0x00,0x00,0x00,
0x00,0x7B,0x79,0x70 };
Note Index 124 (sysreq) is a special case because an 84-key keyboard has a different scan code.
If you define alternate keyboard shortcuts to force a system crash from a USB or PS/2 keyboard, you must either set the CrashOnCtrlScroll registry value to 0 or remove it
from the registry.
Limitations
It is possible for a system to freeze in such a way that the keyboard shortcut sequence will not work. However, this should be a very rare occurrence. Using the keyboard
shortcut sequence to initiate a crash will work even in many instances where CTRL+ALT+DELETE does not work.
Forcing a system crash from the keyboard does not work if the computer stops responding at a high interrupt request level (IRQL). This limitation exists because the
Kbdhid.sys driver, which allows the memory dump process to run, operates at a lower IRQL than the i8042prt.sys driver.
2009 Microsoft Corporation
Send feedback on this topic
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
DumpExam
The DumpExam tool is obsolete. It is no longer needed in the analysis of a crash dump file.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Knowledge Base Article Q253066 and follow the instructions on that page.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The difference between these dump files is one of size. Minidumps are usually more compact, and can be easily sent to an analyst.
Note Much information can be obtained by analyzing a dump file. However, no dump file can provide as much information as actually debugging the crash directly with a
debugger.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Minidumps
A user-mode dump file that includes only selected parts of the memory associated with a process is called a minidump.
The size and contents of a minidump file vary depending on the program being dumped and the application doing the dumping. Sometimes, a minidump file is fairly large and
includes the full memory and handle table. Other times, it is much smaller for example, it might only contain information about a single thread, or only contain information
about modules that are actually referenced in the stack.
The name "minidump" is misleading, because the largest minidump files actually contain more information than the "full" user-mode dump. For example, .dump /mf
or .dump /ma will create a larger and more complete file than .dump /f. For this reason, .dump /m[MiniOptions] recommended over .dump /f for all user-mode dump file
creation.
If you are creating a minidump file with the debugger, you can choose exactly what information to include. A simple .dump /m command will include basic information
about the loaded modules that make up the target process, thread information, and stack information. This can be modified by using any of the following options:
.dump option
Effect on dump file
/ma
Creates a minidump with all optional additions. The /ma option is equivalent to /mfFhut it adds full memory data, handle data, unloaded module
information, basic memory information, and thread time information to the minidump.
/mf
Adds full memory data to the minidump. All accessible committed pages owned by the target application will be included.
/mF
Adds all basic memory information to the minidump. This adds a stream to the minidump that contains all basic memory information, not just information
about valid memory. This allows the debugger to reconstruct the complete virtual memory layout of the process when the minidump is being debugged.
/mh
Adds data about the handles associated with the target application to the minidump.
/mu
Adds unloaded module information to the minidump. This is only available in Windows Server 2003 and later versions of Windows.
/mt
Adds additional thread information to the minidump. This includes thread times, which can be displayed by using .ttime (Display Thread Times) when
debugging the minidump.
/mi
Adds secondary memory to the minidump. Secondary memory is any memory referenced by a pointer on the stack or backing store, plus a small region
surrounding this address.
/mp
Adds process environment block (PEB) and thread environment block (TEB) data to the minidump. This can be useful if you need access to Windows system
information regarding the application's processes and threads.
/mw
Adds all committed read-write private pages to the minidump.
/md
Adds all read-write data segments within the executable image to the minidump.
/mc
Adds code sections within images.
/mr
Deletes from the minidump those portions of the stack and store memory that are not useful for recreating the stack trace. Local variables and other data type
values are deleted as well. This option does not make the minidump smaller (since these memory sections are simply zeroed), but it is useful if you wish to
protect the privacy of other applications.
/mR
Deletes the full module paths from the minidump. Only the module names will be included. This is a useful option if you wish to protect the privacy of the
user's directory structure.
/mk
(Windows Vista only) Creates a kernel-mode minidump in addition to the user-mode minidump. The kernel-mode minidump will be restricted to the same
"FileName" threads that are stored in the user-mode minidump. FileName must be enclosed in quotation marks.
These options can be combined. For example, the command .dump /mfiu can be used to create a fairly large minidump, or the command .dump /mrR can be used to create a
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
minidump that preserves the user's privacy. For full syntax details, see .dump (Create Dump File).
For details on the internals of minidump files, see the DbgHelp Reference in the Microsoft Windows SDK.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Yes
No
Yes
No
No
No
CDB UserDump
and
WinDbg
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
No
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
When CDB or WinDbg is debugging a user-mode application, you can also the .dump (Create Dump File) command to create a dump file.
This command does not cause the target application to terminate. By selecting the proper command options, you can create a minidump file that contains exactly the amount
of information you wish.
Shrinking an Existing Dump File
CDB and WinDbg can also be used to shrink a dump file. To do this, begin debugging an existing dump file, and then use the .dump command to create a dump file of
smaller size.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
UserDump
The UserDump tool (Userdump.exe), also known as User-Mode Process Dump, can create user-mode dump files.
UserDump and its documentation are part of the OEM Support Tools package.
To download these tools, go to
Knowledge Base Article Q253066 and follow the instructions on that page.
The default postmortem setting is for a dump file to be written by Dr. Watson. For details on how to alter this, see Enabling Postmortem Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
or by using .opendump to add additional dump files as debugger targets. For information about how to control a multiple-target session, see Debugging Multiple Targets.
Dump files generally end with the extension .dmp or .mdmp. You can use network shares or Universal Naming Convention (UNC) file names for the memory dump file.
It is also common for dump files to be packed into a CAB file. If you specify the file name (including the .cab extension) after the -z option or as the argument to
an .opendump command, the debugger can read the dump files directly out of the CAB. However, if there are multiple dump files stored in a single CAB, the debugger will
only be able to read one of them. The debugger will not read any additional files from the CAB, even if they are symbol files or executables associated with the dump file.
Analyzing a Full User Dump File
Analysis of a full user dump file is similar to analysis of a live debugging session. See the Debugger Commands reference section for details on which commands are
available for debugging dump files in user mode.
Analyzing Minidump Files
Analysis of a user-mode minidump file is done in the same way as a full user dump. However, since much less memory has been preserved, you are much more limited in the
actions you can perform. Commands that attempt to access memory beyond what is preserved in the minidump file will not function properly.
Additional Techniques
For techniques that can be used to read specific kinds of information from a dump file, see Extracting Information from a Dump File.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Security Considerations
This section includes:
Security Vulnerabilities
Secure Mode
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Security Vulnerabilities
This section includes:
Security During Kernel-Mode Debugging
Security During User-Mode Debugging
Security During Postmortem Debugging
Security During Remote Debugging
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
If you use corrupt or destructive extension DLLs, they could cause your debugger to take unexpected actions, possibly affecting the host computer.
It is possible that corrupt or destructive symbol files could also cause your debugger to take unexpected actions, possibly affecting the host computer.
If you are running a remote debugging session, an unexpected client might attempt to link to your server. Or perhaps the client you are expecting might attempt to
perform actions that you do not anticipate.
If you want to prevent a remote user from performing actions on your host computer, use Secure Mode.
For suggestions on how to guard against unexpected remote connections, see Security During Remote Debugging.
If you are not performing remote debugging, you should still beware of bad symbol files and extension DLLs. Do not load symbols or extensions that you distrust!
Local Kernel Debugging
Only users who have debug privileges can start a local kernel debugging session. If you are the administrator of a machine that has multiple user accounts, you should be
aware that any user with these privileges can start a local kernel debugging session, effectively giving them control of all processes on the computer and therefore giving
them access to all peripherals as well.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
If you use corrupt or destructive extension DLLs, they could cause your debugger to take unexpected actions, possibly affecting applications other than your target.
It is possible that corrupt or destructive symbol files could also cause your debugger to take unexpected actions, possibly affecting applications other than your target.
If you are running a remote debugging session, an unexpected client might attempt to link to your server. Or perhaps the client you are expecting might attempt to
perform actions that you do not anticipate.
For suggestions on how to guard against unexpected remote connections, see Security During Remote Debugging. After a remote client has joined a user-mode debugging
session, there is no way to restrict its access to processes on your computer.
If you are not performing remote debugging, you should still beware of bad symbol files and extension DLLs. do not load symbols or extensions that you distrust!
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Secure Mode
When you are performing kernel-mode debugging, you can run the debugger in Secure Mode. This prevents the debugger from affecting the host computer, yet does not
significantly decrease its freedom to debug the target computer.
Secure Mode is recommended if you are going to allow remote clients to join your debugging session.
This section includes:
Features of Secure Mode
Activating Secure Mode
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
The .attach (Attach to Process), .create (Create Process), .detach (Detach from Process), .abandon (Abandon Process), .kill (Kill Process), .tlist (List Process
IDs), .dump (Create Dump File), .opendump (Open Dump File), .writemem (Write Memory to File), .netuse (Control Network Connections),
and .quit_lock (Prevent Accidental Quit) commands are not available.
The File | Attach to a Process, File | Open Executable, Debug | Detach Debuggee, Debug | Stop Debugging, File | Open Crash Dump WinDbg menu commands
are not available.
The .shell (Command Shell) command is not available.
Extension DLLs must be loaded from a local disk; they cannot be loaded from UNC paths.
Only the two standard types of extension DLLs (wdbgexts.h and dbgeng.h) are permitted. Other types of DLLs cannot be loaded as extensions.
If you are using a symbol server, there are several restrictions. Only SymSrv (symsrv.dll) is permitted; other symbol server DLLs will not be accepted. You may not use
a downstream store for your symbols, and any existing downstream store will be ignored. HTTP and HTTPS connections are not permitted.
The source server is disabled.
If you have an existing kernel debugging session and need to discover whether you are already in Secure Mode, use the .secure command with no arguments. This will tell
you the current status of Secure Mode.
After Secure Mode has been activated, it cannot be turned off. Even ending the debugging session will not turn it off. Secure Mode persists as long as the debugger itself is
running.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Debugger Reference
This reference section includes:
Command-Line Options
Environment Variables
Debugger Commands
Debugger Extension Commands
Debugger-Related APIs
Debugger Error and Warning Messages
WinDbg Graphical Interface Features
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Command-Line Options
This reference section includes:
CDB Command-Line Options
KD Command-Line Options
WinDbg Command-Line Options
DbgSrv Command-Line Options
KdSrv Command-Line Options
DbEngPrx Command-Line Options
KDbgCtrl Command-Line Options
DbgRpc Command-Line Options
SymStore Command-Line Options
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
cdb -iae
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
-cfr "filename"
Specifies the path and name of a script file. This script file is executed as soon as the debugger is started, and any time the target is restarted. If filename contains spaces it
must be enclosed in quotation marks. If the path is omitted, the current directory is assumed. If the file does not exist, no error occurs. For details, see Using Script Files.
-cimp
Directs CDB/NTSD to start with a DbgSrv implicit command line instead of an explicit process to run. This option is the client side of dbgsrv -pc.
-clines lines
Sets the approximate number of commands in the command history which can be accessed during remote debugging. For details, and for other ways to change this
number, see Using Debugger Commands.
-d
Passes control of this debugger to the kernel debugger. If you are debugging CSRSS, this control redirection always is active, even if -d is not specified. (This option
cannot be used during remote debugging use -ddefer instead.) See Controlling the User-Mode Debugger from the Kernel Debugger for details. This option cannot be
used in conjunction with either the -ddefer option or the -noio option.
-ddefer
Passes control of this debugger to the kernel debugger, unless a debugging client is connected. (This is a variation of -d that can be used from a debugging server.) See
Controlling the User-Mode Debugger from the Kernel Debugger for details. This option cannot be used in conjunction with either the -d option or the -noio option.
-e Event
Signals the debugger that the specified event has occurred. This option is only used when starting the debugger programmatically.
-ee {masm|c++}
Sets the default expression evaluator. If masm is specified, MASM expression syntax will be used. If c++ is specified, C++ expression syntax will be used. If the -ee
option is omitted, MASM expression syntax is used as the default. See Evaluating Expressions for details.
-failinc
Causes the debugger to ignore any questionable symbols. When debugging a user-mode or kernel-mode minidump file, this option will also prevent the debugger from
loading any modules whose images can't be mapped. For details and for other methods of controlling this, see SYMOPT_EXACT_SYMBOLS.
-g
Ignores the initial breakpoint in target application. This option will cause the target application to continue running after it is started or CDB attaches to it, unless another
breakpoint has been set. See Initial Breakpoint for details.
-G
Ignores the final breakpoint at process termination. By default, CDB stops during the image run-down process. This option will cause CDB to exit immediately when the
child terminates.
-hd
(Microsoft Windows XP and later) Specifies that the debug heap should not be used. See Behavior of Spawned Processes for details.
-i ImagePath
Specifies the location of the executables that generated the fault. If the path contains spaces, it should be enclosed in quotation marks. For details, and for other ways to
change this path, see Executable Image Path.
-iae
Installs CDB as the postmortem debugger. For details, see Enabling Postmortem Debugging. If this action succeeds, no message is displayed; if it fails, an error message
is displayed.
The -iae parameter must not be used with any other parameters. This command will not actually start CDB.
-iaec KeyString
Installs CDB as the postmortem debugger. The contents of KeyString will be appended to the end of the AeDebug registry key. If KeyString contains spaces, it must be
enclosed in quotation marks. For details, see Enabling Postmortem Debugging. If this action succeeds, no message is displayed; if it fails, an error message is displayed.
The -iaec parameter must not be used with any other parameters. This command will not actually start CDB.
-isd
Turns on the CREATE_IGNORE_SYSTEM_DEFAULT flag for any process creations.
-iu KeyString
Registers debugger remoting as an URL type so that users can auto-launch a debugger remote client with an URL. KeyString has the format
remdbgeng://RemotingOption. RemotingOption is a string that defines the transport protocol as defined in the topic Activating a Debugging Client. If this action
succeeds, no message is displayed; if it fails, an error message is displayed.
The -iu parameter must not be used with any other parameters. This command will not actually start CDB.
-kqm
Starts CDB/NTSD in quiet mode.
-lines
Enables source line debugging. If this option is omitted, the .lines (Toggle Source Line Support) command will have to be used before source debugging will be
allowed. For other methods of controlling this, see SYMOPT_LOAD_LINES.
-log{a|au|o|ou} LogFile
Begins logging information to a log file. If the specified file already exists, it will be overwritten if -logo is used, or output will be appended to the file if -loga is used.
The -logau and -logou options operate similar to -loga and -logo respectively, except that the log file is a Unicode file. For more details, see Keeping a Log File.
-myob
If there is a version mismatch with dbghelp.dll, the debugger will continue to run. (Without the -myob switch, this is considered a fatal error.)
-n
Noisy symbol load: Enables verbose output from the symbol handler. For details and for other methods of controlling this, see SYMOPT_DEBUG.
-noinh
Prevents processes created by the debugger from inheriting handles from the debugger. For other methods of controlling this, see Spawning a New Process (User Mode).
-noio
Prevents the debugging server from being used for input or output. Input will only be accepted from the debugging client (plus any initial command or command script
specified by the -c command-line option). All output will be directed to the debugging client. If NTSD is used for the server, no console window will be created at all.
For more details, see Activating a Debugging Server. This option cannot be used in conjunction with either the -d option or the -ddefer option.
-noshell
Prohibits all .shell commands. This prohibition will last as long as the debugger is running, even if a new debugging session is begun. For details, and for other ways to
disable .shell commands, see Using Shell Commands.
-o
Debugs all processes launched by the target application (child processes). By default, processes created by the one you are debugging will run as they normally do. For
other methods of controlling this, see Spawning a New Process (User Mode).
-p PID
Specifies the decimal process ID to be debugged. This is used to debug a process that is already running. For details, see Attaching to a Running Process (User Mode).
-pb
(Windows XP and later) Prevents the debugger from requesting an initial break-in when attaching to a target process. This can be useful if the application is already
suspended, or if you wish to avoid creating a break-in thread in the target. See Attaching to a Running Process (User Mode).
-pd
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
(Windows XP and later) Causes the target application not to be terminated at the end of the debugging session. See Ending the Debugging Session for details.
-pe
(Windows XP and later) Indicates that the target application is already being debugged. See Re-attaching to the Target Application for details.
-pn Name
Specifies the name of the process to be debugged. (This name must be unique.) This is used to debug a process that is already running. For details, see Attaching to a
Running Process (User Mode).
-pr
(Windows XP and later) Causes the debugger to start the target process running when it attaches to it. This can be useful if the application is already suspended and you
wish it to resume execution. See Attaching to a Running Process (User Mode).
-psn ServiceName
Specifies the name of a service contained in the process to be debugged. This is used to debug a process that is already running. For details, see Attaching to a Running
Process (User Mode).
-pt Seconds
Specifies the break time-out, in seconds. The default is 30. See Controlling the Target for details.
-pv
Specifies that the debugger should attach to the target process noninvasively. For details, see Noninvasive Debugging (User Mode).
-pvr
Works like -pv except that the target process is not suspended.
-QR Server
Lists all debugging servers running on the specified network server. The double backslash (\\) preceding Server is optional. See Searching for Debugging Servers for
details.
The -QR parameter cannot be used with any other parameters. This command will not actually start CDB.
-r BreakErrorLevel
Specifies the error level that will cause the target to break into the debugger. This is a decimal number equal to 0, 1, 2, or 3. Possible values are as follows:
Value
Constant
Meaning
0
NONE
Do not break on any errors.
1
ERROR
Break on ERROR level debugging events.
2
MINORERROR Break on MINORERROR and ERROR level debugging events.
3
WARNING
Break on WARNING, MINORERROR, and ERROR level debugging events.
This error level only has meaning in checked builds of Microsoft Windows. The default value is 1.
-robp
This allows CDB to set a breakpoint on a read-only memory page. (The default is for such an operation to fail.)
-s
Disables lazy symbol loading. This will slow down process startup. For details and for other methods of controlling this, see SYMOPT_DEFERRED_LOADS.
-sdce
Causes the debugger to display File access error dialog boxes during symbol load. For details and for other methods of controlling this, see
SYMOPT_FAIL_CRITICAL_ERRORS.
-ses
Causes the debugger to perform a strict evaluation of all symbol files and ignore any questionable symbols. For details and for other methods of controlling this, see
SYMOPT_EXACT_SYMBOLS.
-sflags 0xNumber
Sets all the symbol handler options at once. Number should be a hexadecimal number prefixed with 0x a decimal without the 0x is permitted, but the symbol options
are binary flags and therefore hexadecimal is recommended. This option should be used with care, since it will override all the symbol handler defaults. For details, see
Setting Symbol Options.
-sicv
Causes the symbol handler to ignore the CV record. For details and for other methods of controlling this, see SYMOPT_IGNORE_CVREC.
-sins
Causes the debugger to ignore the symbol path and executable image path environment variables. For details, see SYMOPT_IGNORE_NT_SYMPATH.
-snc
Causes the debugger to turn off C++ translation. For details and for other methods of controlling this, see SYMOPT_NO_CPP.
-snul
Disables automatic symbol loading for unqualified names. For details and for other methods of controlling this, see SYMOPT_NO_UNQUALIFIED_LOADS.
-srcpath SourcePath
Specifies the source file search path. Separate multiple paths with a semicolon (;). If the path contains spaces, it should be enclosed in quotation marks. For details, and
for other ways to change this path, see Source Path.
-sup
Causes the symbol handler to search the public symbol table during every symbol search. For details and for other methods of controlling this, see
SYMOPT_AUTO_PUBLICS.
-t PrintErrorLevel
Specifies the error level that will cause the debugger to display an error message. This is a decimal number equal to 0, 1, 2, or 3. Possible values are as follows:
Value
Constant
Meaning
0
NONE
Do not display any errors.
1
ERROR
Display ERROR level debugging events.
2
MINORERROR Display MINORERROR and ERROR level debugging events.
3
WARNING
Display WARNING, MINORERROR, and ERROR level debugging events.
This error level only has meaning in checked builds of Microsoft Windows. The default value is 1.
-v
Enables verbose output from the debugger.
-version
Prints the debugger version string.
-vf[:Flags]
Causes the target process to be run under Application Verifier. If Flags is specified, these flags are passed to Application Verifier. If the colon and Flags are omitted, the
flag value of zero is passed to Application Verifier. For more information, see Application Verifier.
-w
Specifies to debug 16-bit applications in a separate VDM.
-wake PID
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Causes sleep mode to end for the user-mode debugger whose process ID is specified by PID. This command must be issued on the target machine during sleep mode. See
Controlling the User-Mode Debugger from the Kernel Debugger for details.
The -wake parameter should not be used with any other parameters. This command will not actually start CDB.
-x{e|d|n|i} Exception
Controls the debugger's behavior when the specified event occurs. The Exception can be either an exception number or an event code. You can specify this option
multiple times to control different events. See Controlling Exceptions and Events for details and for other methods of controlling these settings.
-x
Disables first-chance break on access violation exceptions. The second occurrence of an access violation will break into the debugger. This is the same as -xd av.
-y SymbolPath
Specifies the symbol search path. Separate multiple paths with a semicolon (;). If the path contains spaces, it should be enclosed in quotation marks. For details, and for
other ways to change this path, see Symbol Path.
-z DumpFile
Specifies the name of a crash dump file to debug. If the path and file name contain spaces, this must be surrounded by quotation marks. It is possible to open several
dump files at once by including multiple -z options, each followed by a different DumpFile value. For details, see Analyzing a User-Mode Dump File with CDB.
-zp PageFile
Specifies the name of a modified page file. This is useful if you are debugging a dump file and want to use the .pagein (Page In Memory) command. You cannot use -zp
with a standard Windows page file only specially-modified page files can be used.
executable
Specifies the command line of an executable process. This is used to launch a new process and debug it. This has to be the final item on the command line. All text after
the executable name is passed to the executable as its argument string. For details, see Spawning a New Process (User Mode).
-?
Displays command-line help text.
When you are starting the debugger from Start | Run or from a Command Prompt window, specify arguments for the target application after the application's file name.
For instance:
cdb myexe arg1 arg2
KD Command-Line Options
First-time users of KD should begin with the Debugger Operation section.
The KD command line uses the following syntax.
kd [ -server ServerTransport | -remote ClientTransport ]
[-b | -x] [-d] [-bonc] [-m] [-myob] [-lines] [-n] [-r] [-s]
[-v] [-clines lines] [-failinc] [-noio] [-noshell]
[-secure] [-sdce] [-ses] [-sicv] [-sins] [-snc] [-snul]
[-sup] [-sflags 0xNumber] [-log{a|au|o|ou} LogFile]
[-aExtension] [-zp PageFile]
[-i ImagePath] [-y SymbolPath] [-srcpath SourcePath]
[-k ConnectType | -kl | -kqm | -kx ExdiOptions] [-ee {masm|c++}]
[-z DumpFile] [-cf "filename"] [-cfr "filename"] [-c "command"]
[-t PrintErrorLevel] [-version]
kd -iu KeyString
kd -QR Server
kd -wake PID
kd -?
Descriptions of the KD command-line options follow. Only the -remote and -server options are case-sensitive. The initial hyphen can be replaced with a forward-slash (/).
Options which do not take any additional parameters can be concatenated so kd -r -n -v can be written as kd -rnv.
If the -remote or -server option is used, it must appear before any other options on the command line.
Parameters
-server ServerTransport
Creates a debugging server that can be accessed by other debuggers. For an explanation of the possible ServerTransport, see Activating a Debugging Server. When this
parameter is used, it must be the first parameters on the command line.
-remote ClientTransport
Creates a debugging client, and connects to a debugging server that is already running. For an explanation of the possible ClientTransport values, see Activating a
Debugging Client. When this parameter is used, it must be the first parameters on the command line.
-aExtension
Sets the default extension DLL. The default is kdextx86.dll or kdexts.dll. There must be no space after the "a", and the .dll file name extension must not be included. For
details, and other methods of setting this default, see Loading Debugger Extension DLLs.
-b
This option has two effects:
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
1. The debugger will break into the target computer immediately upon connection.
2. After a reboot, the debugger will break into the target computer once the kernel is initialized. See Crashing and Rebooting the Target Computer for details and for
other methods of changing this status.
-bonc
If this option is specified, the debugger will break into the target as soon as the session begins. This is especially useful when connecting to a debugging server that might
not be currently broken into the target.
-c "command"
Specifies the initial debugger command to run at start-up. This command must be surrounded with quotation marks. Multiple commands can be separated with
semicolons. (If you have a long command list, it may be easier to put them in a script and then use the -c option with the $<, $><, $><, $$>< (Run Script File)
command.)
If you are starting a debugging client, this command must be intended for the debugging server. Client-specific commands, such as .lsrcpath, are not allowed.
-cf "filename"
Specifies the path and name of a script file. This script file is executed as soon as the debugger is started. If filename contains spaces it must be enclosed in quotation
marks. If the path is omitted, the current directory is assumed. If the -cf option is not used, the file ntsd.ini in the current directory is used as the script file. If the file does
not exist, no error occurs. For details, see Using Script Files.
-cfr "filename"
Specifies the path and name of a script file. This script file is executed as soon as the debugger is started, and any time the target is restarted. If filename contains spaces it
must be enclosed in quotation marks. If the path is omitted, the current directory is assumed. If the file does not exist, no error occurs. For details, see Using Script Files.
-clines lines
Sets the approximate number of commands in the command history which can be accessed during remote debugging. For details, and for other ways to change this
number, see Using Debugger Commands.
-d
After a reboot, the debugger will break into the target computer as soon as a kernel module is loaded. (This break is earlier than the break from the -b option.) See
Crashing and Rebooting the Target Computer for details and for other methods of changing this status.
-ee {masm|c++}
Sets the default expression evaluator. If masm is specified, MASM expression syntax will be used. If c++ is specified, C++ expression syntax will be used. If the -ee
option is omitted, MASM expression syntax is used as the default. See Evaluating Expressions for details.
-failinc
Causes the debugger to ignore any questionable symbols. When debugging a user-mode or kernel-mode minidump file, this option will also prevent the debugger from
loading any modules whose images can't be mapped. For details and for other methods of controlling this, see SYMOPT_EXACT_SYMBOLS.
-i ImagePath
Specifies the location of the executables that generated the fault. If the path contains spaces, it should be enclosed in quotation marks. For details, and for other ways to
change this path, see Executable Image Path.
-iu KeyString
Registers debugger remoting as an URL type so that users can auto-launch a debugger remote client with an URL. KeyString has the format
remdbgeng://RemotingOption. RemotingOption is a string that defines the transport protocol as defined in the topic Activating a Debugging Client. If this action
succeeds, no message is displayed; if it fails, an error message is displayed.
The -iu parameter must not be used with any other parameters. This command will not actually start KD.
-k ConnectType
Tells the debugger how to connect to the target. For details, see Choosing Kernel Debugging Settings.
-kl
(Windows XP and later) Starts a kernel debugging session on the same machine as the debugger. For more details, see Attaching to a Target Computer (Kernel Mode).
-kqm
Starts KD in quiet mode.
-kx ExdiOptions
Starts a kernel debugging session using an EXDI driver. EXDI drivers are not described in this documentation. If you have an EXDI interface to your hardware probe or
hardware simulator, please contact Microsoft for debugging information.
-lines
Enables source line debugging. If this option is omitted, the .lines (Toggle Source Line Support) command will have to be used before source debugging will be
allowed. For other methods of controlling this, see SYMOPT_LOAD_LINES.
-log{a|au|o|ou} LogFile
Begins logging information to a log file. If LogFile already exists, it will be overwritten if -logo is used, or output will be appended to the file if -loga is used. The -logau
and -logou options operate similar to -loga and -logo respectively, except that the log file is a Unicode file. For more details, see Keeping a Log File.
-m
Indicates that the serial port is connected to a modem. Instructs the debugger to watch for the carrier-detect signal.
-myob
If there is a version mismatch with dbghelp.dll, the debugger will continue to run. (Without the -myob switch, this is considered a fatal error.)
A secondary effect of this option is that the warning that normally appears when breaking into the target computer is suppressed.
-n
Noisy symbol load: Enables verbose output from symbol handler. For details and for other methods of controlling this, see SYMOPT_DEBUG.
-noio
Prevents the debugging server from being used for input or output. Input will only be accepted from the debugging client (plus any initial command or command script
specified by the -c command-line option). All output will be directed to the debugging client. For more details, see Activating a Debugging Server.
-noshell
Prohibits all .shell commands. This prohibition will last as long as the debugger is running, even if a new debugging session is begun. For details, and for other ways to
disable shell commands, see Using Shell Commands.
-QR Server
Lists all debugging servers running on the specified network server. The double backslash (\\) preceding Server is optional. See Searching for Debugging Servers for
details.
The -QR parameter must not be used with any other parameters. This command will not actually start KD.
-r
Displays registers.
-s
Disables lazy symbol loading. This will slow down process startup. For details and for other methods of controlling this, see SYMOPT_DEFERRED_LOADS.
-sdce
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Causes the debugger to display File access error dialog boxes during symbol load. For details and for other methods of controlling this, see
SYMOPT_FAIL_CRITICAL_ERRORS.
-secure
Activates Secure Mode.
-ses
Causes the debugger to perform a strict evaluation of all symbol files and ignore any questionable symbols. For details and for other methods of controlling this, see
SYMOPT_EXACT_SYMBOLS.
-sflags 0xNumber
Sets all the symbol handler options at once. Number should be a hexadecimal number prefixed with 0x a decimal without the 0x is permitted, but the symbol options
are binary flags and therefore hexadecimal is recommended. This option should be used with care, since it will override all the symbol handler defaults. For details, see
Setting Symbol Options.
-sicv
Causes the symbol handler to ignore the CV record. For details and for other methods of controlling this, see SYMOPT_IGNORE_CVREC.
-sins
Causes the debugger to ignore the symbol path and executable image path environment variables. For details, see SYMOPT_IGNORE_NT_SYMPATH.
-snc
Causes the debugger to turn off C++ translation. For details and for other methods of controlling this, see SYMOPT_NO_CPP.
-snul
Disables automatic symbol loading for unqualified names. For details and for other methods of controlling this, see SYMOPT_NO_UNQUALIFIED_LOADS.
-srcpath SourcePath
Specifies the source file search path. Separate multiple paths with a semicolon (;). If the path contains spaces, it should be enclosed in quotation marks. For details, and
for other ways to change this path, see Source Path.
-sup
Causes the symbol handler to search the public symbol table during every symbol search. For details and for other methods of controlling this, see
SYMOPT_AUTO_PUBLICS.
-t PrintErrorLevel
Specifies the error level that will cause the debugger to display an error message. This is a decimal number equal to 0, 1, 2, or 3. The values are described as follows:
Value
Constant
Meaning
0
NONE
Do not display any errors.
1
ERROR
Display ERROR level debugging events.
2
MINORERROR Display MINORERROR and ERROR level debugging events.
3
WARNING
Display WARNING, MINORERROR, and ERROR level debugging events.
This error level only has meaning in checked builds of Microsoft Windows. The default value is 1.
-v
Generates verbose messages for loads, deferred loads, and unloads.
-version
Prints the debugger version string.
-wake PID
Causes sleep mode to end for the user-mode debugger whose process ID is specified by PID. This command must be issued on the target machine during sleep mode. See
Controlling the User-Mode Debugger from the Kernel Debugger for details.
The -wake parameter must not be used with any other parameters. This command will not actually start KD.
-x
Causes the debugger to break in when an exception first occurs, rather than letting the application or module that caused the exception deal with it. (Same as -b, except
with an initial eb nt!NtGlobalFlag 9;g command.)
-y SymbolPath
Specifies the symbol search path. Separate multiple paths with a semicolon (;). If the path contains spaces, it should be enclosed in quotation marks. For details, and for
other ways to change this path, see Symbol Path.
-z DumpFile
Specifies the name of a crash dump file to debug. If the path and file name contain spaces, this must be surrounded by quotation marks. It is possible to open several
dump files at once by including multiple -z options, each followed by a different DumpFile value. For details, see Analyzing a Kernel-Mode Dump File with KD.
-zp PageFile
Specifies the name of a modified page file. This is useful if you are debugging a dump file and want to use the .pagein (Page In Memory) command. You cannot use -zp
with a standard Windows page file only specially-modified page files can be used.
-?
Displays command-line help text.
KD will automatically detect the platform on which the target is running. You do not need to specify the target on the KD command line. The older syntax (using the
name I386KD or IA64KD) is obsolete.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Registers debugger remoting as an URL type so that users can auto-launch a debugger remote client with an URL. KeyString has the format
remdbgeng://RemotingOption. RemotingOption is a string that defines the transport protocol as defined in the topic Activating a Debugging Client. If this action
succeeds, no message is displayed; if it fails, an error message is displayed.
The -IU parameter must not be used with any other parameters. Although a WinDbg window may appear for a moment, this command will not actually start WinDbg.
-i ImagePath
Specifies the location of the executables that generated the fault. If the path contains spaces, it should be enclosed in quotation marks. For details, and for other ways to
change this path, see Executable Image Path.
-j
Allow journaling.
-k [ConnectType]
(Kernel mode only) Starts a kernel debugging session. For details, see Choosing Kernel Debugging Settings. If -k is used without any ConnectType options following it,
it must be the final entry on the command line.
-kl
(Windows XP and later, kernel mode only) Starts a kernel debugging session on the same machine as the debugger. For more details, see Attaching to a Target Computer
(Kernel Mode).
-kx ExdiOptions
(Kernel mode only) Starts a kernel debugging session using an EXDI driver. EXDI drivers are not described in this documentation. If you have an EXDI interface to your
hardware probe or hardware simulator, please contact Microsoft for debugging information.
-log{o|a} LogFile
Begins logging information to a log file. If the specified log file already exists, it will be overwritten if -logo is used. If loga is used, the output will be appended to the
file. For more details, see Keeping a Log File.
-lsrcpath
Sets the local source path for a remote client. This option must follow -remote on the command line.
-n
Noisy symbol load: Enables verbose output from symbol handler. For details and for other methods of controlling this, see SYMOPT_DEBUG.
-noinh
(User mode only) Prevents processes created by the debugger from inheriting handles from the debugger. For other methods of controlling this, see Spawning a New
Process (User Mode).
-noprio
Prevents any priority change. This parameter will prevent WinDbg from taking priority for CPU time while active.
-noshell
Prohibits all .shell commands. This prohibition will last as long as the debugger is running, even if a new debugging session is begun. For details, and for other ways to
disable shell commands, see Using Shell Commands.
-o
(User mode only) Debugs all processes launched by the target application (child processes). By default, processes created by the one you are debugging will run as they
normally do. For other methods of controlling this, see Spawning a New Process (User Mode).
-p PID
Specifies the decimal process ID to be debugged. This is used to debug a process that is already running. For details, see Attaching to a Running Process (User Mode).
-pb
(Windows XP and later, user mode only) Prevents the debugger from requesting an initial break-in when attaching to a target process. This can be useful if the application
is already suspended, or if you wish to avoid creating a break-in thread in the target. See Attaching to a Running Process (User Mode).
-pd
(Windows XP and later, user mode only) Causes the target application not to be terminated at the end of the debugging session. See Ending the Debugging Session for
details.
-pe
(Windows XP and later, user mode only) Indicates that the target application is already being debugged. See Re-attaching to the Target Application for details.
-pn Name
Specifies the name of the process to be debugged. (This name must be unique.) This is used to debug a process that is already running. For details, see Attaching to a
Running Process (User Mode).
-pr
(Windows XP and later, user mode only) Causes the debugger to start the target process running when it attaches to it. This can be useful if the application is already
suspended and you wish it to resume execution. See Attaching to a Running Process (User Mode).
-psn ServiceName
Specifies the name of a service contained in the process to be debugged. This is used to debug a process that is already running. For details, see Attaching to a Running
Process (User Mode).
-pt Seconds
Specifies the break timeout, in seconds. The default is 30. See Controlling the Target for details.
-pv
(User mode only) Specifies that the debugger should attach to the target process noninvasively. For details, see Noninvasive Debugging (User Mode).
-Q
Suppresses the "Save Workspace?" dialog box. Workspaces are not automatically saved. See Using Workspaces for details.
-QS
Suppresses the "Reload Source?" dialog box. Source files are not automatically reloaded.
-QSY
Suppresses the "Reload Source?" dialog box and automatically reloads source files.
-QY
Suppresses the "Save Workspace?" dialog box and automatically saves workspaces. See Using Workspaces for details.
-robp
This allows CDB to set a breakpoint on a read-only memory page. (The default is for such an operation to fail.)
-sdce
Causes the debugger to display File access error messages during symbol load. For details and for other methods of controlling this, see
SYMOPT_FAIL_CRITICAL_ERRORS.
-secure
Activates Secure Mode.
-ses
Causes the debugger to perform a strict evaluation of all symbol files and ignore any questionable symbols. For details and for other methods of controlling this, see
SYMOPT_EXACT_SYMBOLS.
-sflags 0xNumber
Sets all the symbol handler options at once. Number should be a hexadecimal number prefixed with 0x a decimal without the 0x is permitted, but the symbol options
are binary flags and therefore hexadecimal is recommended. This option should be used with care, since it will override all the symbol handler defaults. For details, see
Setting Symbol Options.
-sicv
Causes the symbol handler to ignore the CV record. For details and for other methods of controlling this, see SYMOPT_IGNORE_CVREC.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
-sins
Causes the debugger to ignore the symbol path and executable image path environment variables. For details, see SYMOPT_IGNORE_NT_SYMPATH.
-snc
Causes the debugger to turn off C++ translation. For details and for other methods of controlling this, see SYMOPT_NO_CPP.
-snul
Disables automatic symbol loading for unqualified names. For details and for other methods of controlling this, see SYMOPT_NO_UNQUALIFIED_LOADS.
-srcpath SourcePath
Specifies the source file search path. Separate multiple paths with a semicolon (;). If the path contains spaces, it should be enclosed in quotation marks. For details, and
for other ways to change this path, see Source Path.
-sup
Causes the symbol handler to search the public symbol table during every symbol search. For details and for other methods of controlling this, see
SYMOPT_AUTO_PUBLICS.
-T Title
Sets WinDbg window title.
-v
Enables verbose output from debugger.
-W Workspace
Loads the given named workspace. If the workspace name contains spaces, enclose it in quotation marks. If no workspace of this name exists, you will be given the
option of creating a new workspace with this name or abandoning the load attempt. For details, see Using Workspaces.
-WF Filename
Loads the workspace from the given file. Filename should include the file and the extension (usually .wew). If the workspace name contains spaces, enclose it in
quotation marks. If no workspace file with this name exists, you will be given the option of creating a new workspace file with this name or abandoning the load attempt.
For details, see Using Workspaces.
-WX
Disables automatic workspace loading. For details, see Using Workspaces.
-y SymbolPath
Specifies the symbol search path. Separate multiple paths with a semicolon (;). If the path contains spaces, it should be enclosed in quotation marks. For details, and for
other ways to change this path, see Symbol Path.
-z DumpFile
Specifies the name of a crash dump file to debug. If the path and file name contain spaces, this must be surrounded by quotation marks. It is possible to open several
dump files at once by including multiple -z options, each followed by a different DumpFile value. For details, see Analyzing a User-Mode Dump File with WinDbg or
Analyzing a Kernel-Mode Dump File with WinDbg.
-zp PageFile
Specifies the name of a modified page file. This is useful if you are debugging a dump file and want to use the .pagein (Page In Memory) command. You cannot use -zp
with a standard Windows page file only specially-modified page files can be used.
executable
Specifies the command line of an executable process. This is used to launch a new process and debug it. This has to be the final item on the command line. All text after
the executable name is passed to the executable as its argument string. For details, see Spawning a New Process (User Mode).
-?
Pops up this HTML Help window.
When you are running the debugger from the command line, specify arguments for the target application after application's file name. For instance:
windbg myexe arg1 arg2
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Causes the remainder of the command line to be ignored. This option is useful if you are launching DbgSrv from an application that may append unwanted text to its
command line.
-pc
Causes the remainder of the command line to be ignored. This option is useful if you are launching DbgSrv from an application that may append unwanted text to its
command line. A syntax error results if -pc is the final element on the DbgSrv command line. Aside from this restriction, -pc is identical to -x.
-?
Displays a message box with help text for the DbgSrv command line.
For information about using DbgSrv, see Process Servers (User Mode).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
kdbgctrl -?
Parameters
-e
Enables the Full Kernel Debugging setting.
-d
Disables the Full Kernel Debugging setting.
-c
Displays the current Full Kernel Debugging setting.
-ea
Enables the Automatic Kernel Debugging setting.
-da
Disables the Automatic Kernel Debugging setting.
-ca
Displays the Automatic Full Kernel Debugging setting.
-eu
Enables the User-Mode Error Handling setting.
-du
Disables the User-Mode Error Handling setting.
-cu
Displays the User-Mode Error Handling setting.
-sdb Size
Sets the size of the DbgPrint buffer. If Size is prefixed with 0x it will be interpreted as a hexadecimal number. If it is prefixed with 0 (zero), it will be interpreted as octal.
Otherwise, it will be interpreted as decimal.
-cdb
Displays the current size of the DbgPrint buffer, in bytes.
-cx
Determines the current Full Kernel Debugging setting and returns an appropriate value. This option cannot be combined with other options, and it does not display any
output. It is designed for use in a batch file where the return value of the KDbgCtrl program can be tested. Possible return values are as follows:
Value
Meaning
0x10001
Full Kernel Debugging is enabled.
0x10002
Full Kernel Debugging is disabled.
Any other value An error occurred. KDbgCtrl was unable to determine the current status of Full Kernel Debugging.
-?
Displays command-line help for KDbgCtrl.
Additional Information
For a description of all the KDbgCtrl settings, see Using KDbgCtrl.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
CellID1.CellID2
Specifies the number of the cell to be displayed.
-e
Searches the system's RPC state information for endpoint information. For an example, see Get RPC Endpoint Information.
EndpointName
Specifies the number of the endpoint to be displayed. If omitted, the endpoints for all processes on the system are displayed.
-t
Searches the system's RPC state information for thread information. For an example, see Get RPC Thread Information.
ThreadID
Specifies the thread ID of the thread to be displayed. If omitted, all threads in the specified process will be displayed.
-c
Searches the system's RPC state information for server-side call (SCALL) information. For an example, see Get RPC Call Information.
-a
Searches the system's RPC state information for client call (CCALL) information. For an example, see Get RPC Client Call Information. This option requires full RPC
state information.
CallID
Specifies the call ID. This parameter is optional; include it only if you want to display calls matching a specific CallID value.
IfStart
Specifies the first DWORD of the interface's universally unique identifier (UUID) on which the call was made. This parameter is optional; include it only if you want to
display calls matching a specific IfStart value.
ProcNum
Specifies the procedure number of this call. (The RPC Run-Time identifies individual routines from an interface by numbering them by position in the IDL file the
first routine in the interface is 0, the second 1, and so on.) This parameter is optional; include it only if you want to display calls matching a specific ProcNum value.
Additional Information
For more information about debugging Microsoft Remote Procedure Call (RPC), see RPC Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Environment Variables
This reference section includes:
General Environment Variables
Kernel-Mode Environment Variables
For information about using environment variables for kernel-mode debugging, see Configuring Software on the Host Computer. For information about using environment
variables for user-mode debugging, see Basic User-Mode Configuration.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
_NT_SYMBOL_PROXY = Proxy:Port
_NT_DEBUG_HISTORY_SIZE = Number
_NT_DEBUG_LOG_FILE_OPEN =
Filename
Meaning
Specifies the path that the debugger will first search for extension DLLs. Path can contain a drive letter followed by a colon
(:). Separate multiple directories with semicolons (;). For details, see Loading Debugger Extension DLLs.
Specifies the path containing the binary executable files. Path can contain a drive letter followed by a colon (:). Separate
multiple directories with semicolons (;). For details, and for other ways to change this path, see Executable Image Path.
Specifies the path containing the source files for the target. Path can contain a drive letter followed by a colon (:). Separate
multiple directories with semicolons (;). For details, and for other ways to change this path, see Source Path.
Specifies the root of a directory tree containing the symbol files. Path can contain a drive letter followed by a colon (:).
Separate multiple directories with semicolons (;). For details, and for other ways to change this path, see Symbol Path.
Specifies an alternate symbol path searched before _NT_SYMBOL_PATH. This is useful for keeping private versions of
symbol files. Path can contain a drive letter followed by a colon (:). Separate multiple directories with semicolons (;). For
details, see Symbol Path.
Specifies the proxy server to be used by SymSrv. For details, see Firewalls and Proxy Servers.
Specifies the number of commands in the command history that can be accessed during remote debugging. Because commands
vary in length, the number of lines available may not exactly match Number. For details, and for other ways to change this
number, see Using Debugger Commands.
(CDB and KD only) Specifies the log file to which the debugger should send output. For details, and for other methods of
writing to log files, see Keeping a Log File.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
_NT_DEBUG_LOG_FILE_APPEND =
Filename
_NT_EXPR_EVAL = {masm | c++}
_NO_DEBUG_HEAP
DBGENG_NO_DEBUG_PRIVILEGE
DBGHELP_HOMEDIR
SRCSRV_INI_FILE
(CDB and KD only) Specifies the log file to which the debugger should append output. For details, and for other methods of
appending to log files, see Keeping a Log File.
Specifies the default expression evaluator. If masm is specified, MASM expression syntax will be used. If c++ is specified,
C++ expression syntax will be used. MASM expression syntax is the default. See Evaluating Expressions for details.
(Windows XP and later) Specifies that the debug heap should not be used for user-mode debugging. See Behavior of Spawned
Processes for details.
Prevents processes spawned by the debugger from inheriting SeDebugPrivilege.
Specifies the path for the root of the default downstream store used by SymSrv and SrcSrv. Path can contain a drive letter
followed by a colon (:). Separate multiple directories with semicolons (;).
Specifies the path and name of the configuration file used by SrcSrv. By default, the path is the srcsrv subdirectory of the
Debugging Tools for Windows installation directory, and the file name is Srcsrv.ini. See Source Indexing for details.
Meaning
Specifies the COM port to be used in a kernel connection. For details, see Choosing Kernel Debugging Settings.
Specifies the baud rate to be used over the COM port connection. For details, see Choosing Kernel Debugging Settings.
Specifies that kernel debugging will be done over a 1394 cable connection.
Specifies the channel to be used for the 1394 kernel connection. For details, see Choosing Kernel Debugging Settings.
Specifies the connection protocol to be used for the 1394 kernel connection. For details, see Choosing Kernel Debugging
Settings.
If KDQUIET is defined, the debugger will run in quiet mode. Quiet mode involves three distinct effects:
1. The debugger does not display messages each time an extension DLL is loaded or unloaded.
2. The r (Registers) command no longer requires an equal sign in its syntax.
3. The debugger will not display a warning message when breaking into the target computer.
Quiet mode can also be controlled by using the sq (Set Quiet Mode) command.
_NT_DEBUG_CACHE_SIZE
= Size
_NT_DEBUG_OPTIONS = Option
Specifies the maximum kernel debugging cache size, in bytes. This cache holds data received by the host computer from the
serial connection. The default is 1,024,000.
Specifies one of the following two values:
NOEXTWARNING tells the debugger not to output a warning when it cannot find an extension command.
NOVERSIONCHECK tells the debugger not to check the version of debugger extensions.
These options can be modified or displayed by using the so (Set Kernel Options) command.
_NT_KD_FILES = MapFile
Specifies a driver replacement map file. For details and for other methods of controlling driver replacement, see Mapping
Driver Files.
Debugger Commands
This section includes the following topics:
Syntax Rules
Command Tokens
Commands
Meta-Commands
Control Keys
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Syntax Rules
This section describes the syntax rules that you must follow to use debugger commands.
When you are debugging, you should obey the following general syntax rules:
You can use any combination of uppercase and lowercase letters in commands and arguments, except when specifically noted in the topics in this section.
You can separate multiple command parameters by one or more spaces or by a comma (,).
You can typically omit the space between a command and its first parameter . You can frequently omit other spaces if this omission does not cause any ambiguity.
The command reference topics in this section use the following items:
Characters in bold font style indicate items that you must literally type.
Characters in italic font style indicate parameters that are explained in the Parameters section of the reference topic.
Parameters in brackets ([ xxx ]) are optional. Brackets with a vertical bar ([ xxx | yyy ]) indicate that you can use one, or none, of the enclosed parameters.
Braces with vertical bars ({ xxx | yyy }) indicate that you must use exactly one of the enclosed parameters .
The following topics describe the syntax that the following parameter types use:
Numerical Expression Syntax
String Wildcard Syntax
Register Syntax
Pseudo-Register Syntax
Source Line Syntax
Address and Address Range Syntax
Thread Syntax
Process Syntax
System Syntax
Multiprocessor Syntax
Syntax also plays an important role in using symbols. For further details, see Symbol Syntax and Symbol Matching.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Integer division
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Addition
Subtraction
<<
Left shift
>>
>>>
= (or ==)
Equal to
<
Less than
>
Greater than
<=
>=
!=
Not equal to
Meaning
Interprets the RetVal value as a return value for the function that is located at the FnAddress address. If this return value qualifies as a success code,
$fnsucc returns TRUE. Otherwise, $fnsucc returns FALSE.
If the return type is BOOL, bool, HANDLE, HRESULT, or NTSTATUS, $fnsucc correctly understands whether the specified return value qualifies as a
success code. If the return type is a pointer, all values other than NULL qualify as success codes. For any other type, success is defined by the value of
Flag. If Flag is 0, a nonzero value of RetVal is success. If Flag is 1, a zero value of RetVal is success.
$iment (Address)
Returns the address of the image entry point in the loaded module list. Address specifies the Portable Executable (PE) image base address. The entry is
found by looking up the image entry point in the PE image header of the image that Address specifies.
You can use this function for both modules that are already in the module list and to set unresolved breakpoints by using the bu command.
$scmp("String1",
"String2")
$sicmp("String1",
"String2")
$spat("String",
"Pattern")
$vvalid(Address,
Length)
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Meaning
Class ::~Member
:: Name
Global
Structure . Field
Field in a structure
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Name [integer]
Array subscript
LValue ++
LValue --
dynamic_cast <type>(Value)
static_cast <type>(Value)
(type) Value
sizeof value
Size of expression
sizeof( type )
++ LValue
-- LValue
~ Value
Bit complement
! Value
Not (Boolean)
- Value
Unary minus
+ Value
Unary plus
& LValue
* Value
Dereference
Structure . * Pointer
Value * Value
Multiplication
Value / Value
Division
Value % Value
Modulus
Value + Value
Addition
Value - Value
Subtraction
Value == Value
Equal (comparison)
Value != Value
Bitwise AND
Bitwise XOR (exclusive OR)
Bitwise OR
Logical AND
Logical OR
Assign
LValue *= Value
LValue /= Value
LValue %= Value
LValue += Value
LValue -= Value
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
LValue |= Value
OR and assign
LValue ^= Value
Conditional evaluation
Evaluate all values, and then discard all except the rightmost value
Return Value
Returns the base address of an instance of a structure, given the type of the structure and the address of a field within the
structure.
Returns the byte offset of a named field in a known structure type.
Indicates whether the given byte size includes the desired field.
Returns the size of a field in a structure of known type, without requiring the type of the field.
Returns the number of elements in a statically sized array.
Returns the size of a structure of known type, up through and including a specified field.
In an MASM expression, the numeric value of any symbol is its memory address. In a C++ expression, the numeric value of a variable is its actual value, not its
address. Data structures do not have numeric values. Instead, they are treated as actual structures and you must use them accordingly. The value of a function name or
any other entry point is the memory address and is treated as a function pointer. If you use a symbol that does not correspond to a C++ data type (such as an unmodified
module name), a syntax error occurs.
The MASM expression evaluator treats all numbers as ULONG64 values. The C++ expression evaluator casts numbers to ULONG64 and preserves type information of
all data types.
The MASM expression evaluator lets you to use any operator together with any number. The C++ expression evaluator generates an error if you use an operator
together with an incorrect data type.
In the MASM expression evaluator, all arithmetic is performed literally. In the C++ expression evaluator, pointer arithmetic is scaled properly and is not permitted
when inappropriate.
An MASM expression can use two underscores ( __ ) or two colons ( :: ) to indicate members of a class. The C++ expression evaluator uses only the two-colon syntax.
Debugger output always uses two colons.
In an MASM expression, you should add an at sign (@) before all except the most common registers. If you omit this at sign, the register name might be interpreted as a
hexadecimal number or as a symbol. In a C++ expression, this prefix is required for all registers.
MASM expressions might contain references to source lines. These references are indicated by grave accents ( ` ). You cannot reference source line numbers in a C++
expression.
Expression Examples
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
This topics contains examples of MASM and C++ expressions that are used in various commands.
All other sections of this Help documentation use MASM expression syntax in the examples (unless otherwise noted). C++ expression syntax is very useful for manipulating
structures and variables, but it does not parse the parameters of debugger commands very well.
If you are using debugger commands for general purposes or using debugger extensions, you should set MASM expression syntax as the default syntax. If you must have a
specific parameter to use C++ expression syntax, use the @@( ) syntax.
Conditional Breakpoints
You can use comparison operators to create conditional breakpoints. The following code example uses MASM expression syntax. Because the current default radix is 16, the
example uses the 0n prefix so that the number 20 is understood as a decimal number.
0:000> bp MyFunction+0x43 "j ( poi(MyVar)>0n20 ) ''; 'gc' "
In the previous example, MyVar is an integer in the C source. Because the MASM parser treats all symbols as addresses, the example must have the poi operator to
dereference MyVar.
Conditional Expressions
The following example prints the value of ecx if eax is greater than ebx, 7 if eax is less than ebx, and 3 if eax equals ebx. This example uses the MASM expression evaluator,
so the equal sign (=) is a comparison operator, not an assignment operator.
0:000> ? ecx*(eax>ebx) + 7*(eax<ebx) + 3*(eax=ebx)
In C++ syntax, the @ sign indicates a register, a double equal sign (==) is the comparison operator, and code must explicitly cast from BOOL to int. Therefore, in C++
syntax, the previous command becomes the following.
0:000> ?? @ecx*(int)(@eax>@ebx) + 7*(int)(@eax<@ebx) + 3*(int)(@eax==@ebx)
C++ Expression Examples
If myInt is a ULONG32 value and if you are using the MASM expression evaluator, the following two examples show the value of MyInt.
0:000> ?? myInt
0:000> dd myInt L1
However, the following example shows the address of myInt.
0:000> ? myInt
Mixed Expression Examples
You cannot use source-line expressions in a C++ expression. The following example uses the @@( ) syntax to nest an MASM expression within a C++ expression. This
example sets MyPtr equal to the address of line 43 of the Myfile.c file.
0:000> ?? MyPtr = @@( `myfile.c:43` )
The following examples set the default expression evaluator to MASM and then evaluate Expression2 as a C++ expression, and evaluate Expression1 and Expression3 as
MASM expressions.
0:000> .expr /s masm
0:000> bp Expression1 + @@( Expression2 ) + Expression3
If myInt is a ULONG64 value and if you know that this value is followed in memory by another ULONG64, you can set an access breakpoint at that location by using one of
the following examples. (Note the use of pointer arithmetic.)
0:000> ba r8 @@( &myInt + 1 )
0:000> ba r8 myInt + 8
Structures
The C++ expression evaluator casts pseudo-registers to their appropriate types. For example, $teb is cast as a TEB*. The following example displays the process ID.
kd> ??
@$teb->ClientId.UniqueProcess
Sign Extension
When a 32-bit signed integer is negative, its highest bit is equal to one. When this 32-bit signed integer is cast to a 64-bit number, the high bits can be set to zero (preserving
the unsigned integer and hexadecimal value of the number) or the high bits can be set to one (preserving the signed value of the number). The latter situation is called sign
extension.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The debugger follows different rules for sign extension in MASM expressions, in C++ expressions, and when displaying numbers.
Sign Extension in MASM Expressions
Under certain conditions, numbers are automatically sign extended by the MASM expression evaluator. Sign extension can affect only numbers from 0x80000000 through
0xFFFFFFFF. That is, sign extension affects only numbers that can be written in 32 bits with the high bit equal to 1.
The number 0x12345678 always remains 0x00000000`12345678 when the debugger treats it as a 64-bit number. On the other hand, when 0x890ABCDE is treated as a 64-bit
value, it might remain 0x00000000`890ABCDE or the MASM expression evaluator might sign extend it to 0xFFFFFFFF`890ABCDE.
A number from 0x80000000 through 0xFFFFFFFF is sign extended based on the following criteria:
Numeric constants are never sign extended in user mode. In kernel mode, a numeric constant is sign extended unless it contains a grave accent ( ` ) before the low bytes.
For example, in kernel mode, the hexadecimal numbers EEAA1122 and 00000000EEAA1122 are sign extended, but 00000000`EEAA1122 and 0`EEAA1122 are not.
A 32-bit register is sign extended in both modes.
Pseudo-registers are always stored as 64-bit values. They are not sign extended when they are evaluated. When a pseudo-register is assigned a value, the expression that
is used is evaluated according to the standard C++ criteria.
Individual numbers and registers in an expression can be sign extended, but no other calculations during expression evaluation are sign extended. As a result, you can
mask the high bits of a number or register by using the following syntax.
( 0x0`FFFFFFFF & expression )
If the high 32 bits of a number are all zeros (that is, if the number is from 0x00000000`00000000 through 0x00000000`FFFFFFFF), the debugger displays the number
as a 32-bit number.
If the high 32 bits of a number are all ones and if the highest bit of the low 32 bits is also a one (that is, if the number is from 0xFFFFFFFF`80000000 through
0xFFFFFFFF`FFFFFFFF), the debugger assumes the number is a sign-extended 32-bit number and displays it as a 32-bit number.
If the previous two condition do not apply (that is, if the number is from 0x00000001`00000000 through 0xFFFFFFFF`7FFFFFFF) the debugger displays the number as
a 64-bit number.
Because of these display rules, when a number is displayed as a 32-bit number from 0x80000000 through 0xFFFFFFFF, you cannot confirm whether the high 32 bits are all
ones or all zeros. To distinguish between these two cases, you must perform an additional computation on the number (such as masking one or more of the high bits and
displaying the result).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Parameters that specify symbols also support some additional features. In addition to the standard string wildcard characters, you can use an underscore (_) before a text
expression that you use to specify a symbol. When matching this expression to a symbol, the debugger treats the underscore as any quantity of underscores, even zero. This
feature applies only when you are matching symbols. It does not apply to string wildcard expressions in general. For more information about symbol syntax, see Symbol
Syntax and Symbol Matching.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Register Syntax
The debugger can control registers and floating-point registers. (For more information about commands that can control registers, see Reading and Writing Registers and
Flags.)
When you use a register in an expression, you should add an at sign ( @ ) before the register. This at sign tells the debugger that the following text is the name of a register.
If you are using MASM expression syntax, you can omit the at sign for certain very common registers. On x86-based systems, you can omit the at sign for the eax, ebx, ecx,
edx, esi, edi, ebp, eip, and efl registers. However, if you specify a less common register without an at sign, the debugger first tries to interpret the text as a hexadecimal
number. If the text contains non-hexadecimal characters, the debugger next interprets the text as a symbol. Finally, if the debugger does not find a symbol match, the debugger
interprets the number as a register.
If you are using C++ expression syntax, the at sign is always required.
The r (Registers) command is an exception to this rule. The debugger always interprets its first argument as a register. (An at sign is not required or permitted.) If there is a
second argument for the r command, it is interpreted according to the default expression syntax. If the default expression syntax is C++, you must use the following command
to copy the ebx register to the eax register.
0:000> r eax = @ebx
For more information about the registers and instructions that are specific to each processor, see Processor Architecture.
Flags on an x86-based Processor
x86-based processors also use several 1-bit registers known as flags. For more information about these flags and the syntax that you can use to view or change them, see x86
Flags.
Registers and Threads
Each thread has its own register values. These values are stored in the CPU registers when the thread is executing and in memory when another thread is executing.
In user mode, any reference to a register is interpreted as the register that is associated with the current thread. For more information about the current thread, see Controlling
Processes and Threads.
In kernel mode, any reference to a register is interpreted as the register that is associated with the current register context. You can set the register context to match a specific
thread, context record, or trap frame. You can display only the most important registers for the specified register context, and you cannot change their values.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Pseudo-Register Syntax
The debugger supports several pseudo-registers that hold certain values.
The debugger sets automatic pseudo-registers to certain useful values. User-defined pseudo-registers are integer variables that you can write to or read.
All pseudo-registers begin with a dollar sign ($). If you are using MASM syntax, you can add an at sign ( @ ) before the dollar sign. This at sign tells the debugger that the
following token is a register or pseudo-register, not a symbol. If you omit the at sign, the debugger responds more slowly, because it has to search the whole symbol table.
For example, the following two commands produce the same output, but the second command is faster.
0:000> ?
Evaluate
0:000> ?
Evaluate
$exp
expression: 143 = 0000008f
@$exp
expression: 143 = 0000008f
If a symbol exists with the same name as the pseudo-register, you must add the at sign.
If you are using C++ expression syntax, the at sign ( @ ) is always required.
The r (Registers) command is an exception to this rule. The debugger always interprets its first argument as a register or pseudo-register. (An at sign is not required or
permitted.) If there is a second argument for the r command, it is interpreted according to the default expression syntax. If the default expression syntax is C++, you must use
the following command to copy the $t2 pseudo-register to the $t1 pseudo-register.
0:000> r $t1 = @$t2
Automatic Pseudo-Registers
The debugger automatically sets the following pseudo-registers.
Pseudoregister
Description
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
$ea
$ea2
$exp
$ra
The effective address of the last instruction that was executed. If this instruction does not have an effective address, the debugger displays "Bad register
error". If this instruction has two effective addresses, the debugger displays the first address.
The second effective address of the last instruction that was executed. If this instruction does not have two effective addresses, the debugger displays "Bad
register error".
The last expression that was evaluated.
The return address that is currently on the stack.
This address is especially useful in execution commands. For example, g @$ra continues until the return address is found (although gu (Go Up) is a more
precise effective way of "stepping out" of the current function).
$ip
$eventip
$previp
$relip
$scopeip
$exentry
$retreg
The instruction pointer at the time of the current event. This pointer typically matches $ip, unless you switched threads or manually changed the value of the
instruction pointer.
The instruction pointer at the time of the previous event. (Breaking into the debugger counts as an event.)
An instruction pointer that is related to the current event. When you are branch tracing, this pointer is the pointer to the branch source.
The instruction pointer for the current local context (also known as the scope).
The address of the entry point of the first executable of the current process.
The primary return value register.
x86-based processors: The same as eax.
Itanium-based processors: The same as ret0.
x64-based processors: The same as rax.
$retreg64
$csp
The current call stack pointer. This pointer is the register that is most representative of call stack depth.
x86-based processors: The same as esp.
Itanium-based processors: The same as bsp.
x64-based processors: The same as rsp.
$p
$proc
$thread
$peb
$teb
$tpid
$tid
$bpNumber
$frame
$dbgtime
$callret
$lastclrex
$ptrsize
$pagesize
Some of these pseudo-registers might not be available in certain debugging scenarios. For example, you cannot use $peb, $tid, and $tpid when you are debugging a usermode minidump or certain kernel-mode dump files. There will be situations where you can learn thread information from ~ (Thread Status) but not from $tid. You cannot
use the $previp pseudo-register on the first debugger event. You cannot use the $relip pseudo-register unless you are branch tracing. If you use an unavailable pseudoregister, a syntax error occurs.
A pseudo-register that holds the address of a structure such as $thread, $proc, $teb, $peb, and $lastclrex will be evaluated according to the proper data type in the C++
expression evaluator, but not in the MASM expression evaluator. For example, the command ? $teb displays the address of the TEB, while the command ?? @$teb displays
the entire TEB structure. For more information, see Evaluating Expressions.
On an Itanium-based processor, the iip register is bundle-aligned, which means that it points to slot 0 in the bundle containing the current instruction, even if a different slot is
being executed. So iip is not the full instruction pointer. The $ip pseudo-register is the actual instruction pointer, including the bundle and the slot. The other pseudo-registers
that hold address pointers ($ra, $retreg, $eventip, $previp, $relip, and $exentry) have the same structure as $ip on all processors.
You can use the r command to change the value of $ip. This change also automatically changes the corresponding register. When execution resumes, it resumes at the new
instruction pointer address. This register is the only automatic pseudo-register that you can change manually.
Note In MASM syntax, you can indicate the $ip pseudo-register with a period ( . ). You do not add an at sign (@) before this period, and do not use the period as the first
parameter of the r command. This syntax is not permitted within a C++ expression.
Automatic pseudo-registers are similar to automatic aliases. But you can use automatic aliases together with alias-related tokens (such as ${ }), and you cannot use pseudoregisters with such tokens.
User-Defined Pseudo-Registers
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
There are 20 user-defined pseudo-registers ($t0, $t1, ..., $t19). These pseudo-register are variables that you can read and write through the debugger. You can store any
integer value in these pseudo-registers. They can be especially useful as loop variables.
To write to one of these pseudo-registers, use the r (Registers) command, as the following example shows.
0:000> r $t0 = 7
0:000> r $t1 = 128*poi(MyVar)
Like all pseudo-registers, you can use the user-defined pseudo-register in any expression, as the following example shows.
0:000> bp $t3
0:000> bp @$t4
0:000> ?? @$t1 + 4*@$t2
A pseudo-register is always typed as an integer, unless you use the ? switch together with the r command. If you use this switch, the pseudo-register acquires the type of
whatever is assigned to it. For example, the following command assigns the UNICODE_STRING** type and the 0x0012FFBC value to $t15.
0:000> r? $t15 = * (UNICODE_STRING*) 0x12ffbc
User-defined pseudo-registers use zero as the default value when the debugger is started.
Note The aliases $u0, $u1, ..., $u9 are not pseudo-registers, despite their similar appearance. For more information about these aliases, see Using Aliases.
Example
The following example sets a breakpoint that is hit every time that the current thread calls NtOpenFile. But this breakpoint is not hit when other threads call NtOpenFile.
kd> bp /t @$thread nt!ntopenfile
Example
The following example executes a command until the register holds a specified value. First, put the following code for conditional stepping in a script file named eaxstep.
.if (@eax == 1234) { .echo 1234 } .else { t "$<eaxstep" }
Next, issue the following command.
t "$<eaxstep"
The debugger performs a step and then runs your command. In this case, the debugger runs the script, which either displays 1234 or repeats the process.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Meaning
The absolute address in virtual memory space, with a type that corresponds to the current execution mode. For example, if the current execution mode is
16 bit, the offset is 16 bit. If the execution mode is 32-bit segmented, the offset is 32-bit segmented.
The real address. x86-based and x64-based.
A segmented 32-bit or 64-bit address. x86-based and x64-based.
An absolute address (32-bit or 64-bit) in virtual memory space. x86-based and x64-based.
A flat 32-bit or 64-bit address. name can be any symbol. offset specifies the offset. This offset can be whatever address mode its prefix indicates. No prefix
specifies a default mode address. You can specify the offset as a positive (+) or negative () value.
0x00001007
To specify an address range by an address and object count, specify an address argument, the letter L (uppercase or lowercase), and a value argument. The address specifies
the starting address. The value specifies the number of objects to be examined or displayed. The size of the object depends on the command. For example, if the object size is
1 byte, the following example is a range of 8 bytes, beginning at the address 0x00001000.
0x00001000
L8
However, if the object size is a double word (32 bits or 4 bytes), the following two ranges each give an 8-byte range.
0x00001000
0x00001000
0x00001007
L2
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
There are two other ways to specify the value (the LSize range specifier):
L?Size (with a question mark) means the same as LSize, except that L?Size removes the debugger's automatic range limit. Typically, there is a range limit of 256 MB,
because larger ranges are typographic errors. If you want to specify a range that is larger than 256 MB, you must use the L?Size syntax.
L-Size (with a hyphen) specifies a range of length Size that ends at the given address. For example, 80000000 L20 specifies the range from 0x80000000 through
0x8000001F, and 80000000 L-20 specifies the range from 0x7FFFFFE0 through 0x7FFFFFFF.
Some commands that ask for address ranges accept a single address as the argument. In this situation, the command uses some default object count to compute the size of the
range. Typically, commands for which the address range is the final parameter permit this syntax. For the exact syntax and the default range size for each command, see the
reference topics for each command.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Thread Syntax
Many debugger commands have thread identifiers as their parameters. A tilde ( ~ ) appears before the thread identifier.
The thread identifier can be one of the following values.
Thread identifier
Description
~.
The current thread.
~#
The thread that caused the current exception or debug event.
~*
All threads in the process.
~Number
The thread whose ordinal is Number.
~~[TID]
The thread whose thread ID is TID. (The brackets are required And you cannot add a space between the second tilde and the opening bracket.)
~[Expression]
The thread whose thread ID is the integer to which the numerical Expression resolves.
Threads are assigned ordinals as they are created. Note that this number differs from the thread ID that the Microsoft Windows operating system uses.
When debugging begins, the current thread is the one that caused the present exception or debug event (or the active thread when the debugger attached to the process). That
thread remains the current thread until you specify a new one by using a ~s (Set Current Thread) command or by using the Processes and Threads window in WinDbg.
Thread identifiers typically appear as command prefixes. Note that not all wildcard characters are available in all commands that use thread identifiers.
An example of the ~[Expression] syntax would be ~[@$t0]. In this example, the thread changes depending on the value of a user-defined pseudo-register. This syntax
allows debugger scripts to programmatically select a thread.
Controlling Threads in Kernel Mode
In kernel mode, you cannot control threads by using thread identifiers. For more information about how to access thread-specific information in kernel mode, see Changing
Contexts.
Note You can use the tilde character ( ~ ) to specify threads during user-mode debugging. In kernel-mode debugging, you can use the tilde to specify processors. For more
information about how to specify processors, see Multiprocessor Syntax.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Process Syntax
Many debugger commands have process identifiers as their parameters. A vertical bar ( | ) appears before the process identifier.
The process identifier can be one of the following values.
Process identifier
Description
|.
The current process.
|#
The process that caused the current exception or debug event.
|*
All processes.
|Number
The process whose ordinal is Number.
|~[PID]
The process whose process ID is PID. (The brackets are required and you cannot add a space between the tilde (~) and the opening bracket.)
|[Expression]
The process whose process ID is the integer to which the numerical Expression resolves.
Processes are assigned ordinals as they are created. Note that this number differs from the process ID (PID) that the Microsoft Windows operating system uses.
The current process defines the memory space and the set of threads that are used. When debugging begins, the current process is the one that caused the present exception or
debug event (or the process that the debugger attached to). That process remains the current process until you specify a new one by using a |s (Set Current Process)
command or by using the Processes and Threads window in WinDbg.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Process identifiers are used as parameters in several commands, frequently as the command prefix. Note that WinDbg and CDB can debug child processes that the original
process created. WinDbg and CDB can also attach to multiple unrelated processes.
An example of the |[Expression] syntax would be [|@$t0]. In this example, the process changes depending on the value of a user-defined pseudo-register. This syntax allows
debugger scripts to programmatically select a process.
Controlling Processes in Kernel Mode
In kernel mode, you cannot control processes by using process identifiers. For more information about how to access process-specific information in kernel mode, see
Changing Contexts.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
System Syntax
Many debugger commands have process identifiers as their parameters.
Two vertical bars ( || ) appear before the system identifier. The system identifier can be one of the following values.
System identifier
Description
||.
The current system
||#
The system that caused the current exception or debug event.
||*
All systems.
||ddd
The system whose ordinal is ddd.
Systems are assigned ordinals in the order that the debugger attaches to them.
When debugging begins, the current system is the one that caused the present exception or debug event (or the one that the debugger most recently attached to). That system
remains the current system until you specify a new one by using a ||s (Set Current System) command or by using the Processes and Threads window in WinDbg.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Multiprocessor Syntax
KD and kernel-mode WinDbg support multiple processor debugging. You can perform this kind of debugging on any multiprocessor platform.
Processors are numbered zero through n.
If the current processor is processor 0 (that is, if it is the processor that currently caused the debugger to be active), you can examine the other non-current processors
(processors one through n). However, you cannot change anything in the non-current processors. You can only view their state.
Selecting a Processor
You can use the .echocpunum (Show CPU Number) command to display the processor numbers of the current processor. The output from this command enables you to
immediately tell when you are working on a multiple processor system by the text in the kernel debugging prompt.
In the following example, 0: in front of the kd> prompt indicates that you are debugging the first processor in the computer.
0: kd>
Use the ~s (Change Current Processor) command to switch between processors, as the following example shows.
0: kd> ~1s
1: kd>
Now you are debugging the second processor in the computer.
You might have to change processors on a multiprocessor system if you encounter a break and you cannot understand the stack trace. The break might have occurred on a
different processor.
Specifying Processors in Other Commands
You can add a processor number before several commands. This number is not preceded by a tilde (~), except in the ~S command.
Note In user-mode debugging, the tilde is used to specify threads. For more information about this syntax, see Thread Syntax.
Processor IDs do not have to be referred to explicitly. Instead, you can use a numerical expression that resolves to an integer that corresponds to a processor ID. To indicate
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
that the expression should be interpreted as a processor, use the following syntax.
||[Expression]
In this syntax, the square brackets are required, and Expression stands for any numerical expression that resolves to an integer that corresponds to a processor ID.
In the following example, the processor changes depending on the value of a user-defined pseudo-register.
||[@$t0]
Examples
The following example uses the k (Display Stack Backtrace) command to display a stack trace from processor two.
1: kd> 2k
The following example uses the r (Registers) command to display the eax register of processor three.
1: kd> 3r eax
However, the following command gives a syntax error, because you cannot change the state of a processor other than the current processor.
1: kd> 3r eax=808080
Breakpoints
During kernel debugging, the bp, bu, bm (Set Breakpoint) and ba (Break on Access) commands apply to all processors of a multiple processor computer.
For example, if the current processor is three, you can enter the following command to put a breakpoint at SomeAddress.
1: kd> bp SomeAddress
Then, any processor (not only processor one) that executes at that address causes a breakpoint trap.
Displaying Processor Information
You can use the !running extension to display the status of each processor on the target computer. For each processor, !running can also display the current and next thread
fields from the process control block (PRCB), the state of the 16 built-in queued spinlocks, and a stack trace.
You can use the !cpuinfo and !cpuid extensions to display information about the processors themselves.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Command Tokens
This section of the reference discusses the various tokens used within debugger commands and meta-commands.
These tokens include:
; (Command Separator)
{ } (Block Delimiter)
${ } (Alias Interpreter)
$$ (Comment Specifier)
* (Comment Line Specifier)
.block
.break
.catch
.continue
.do
.else
.elsif
.for
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
.foreach
.if
.leave
.printf
.while
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
; (Command Separator)
The semicolon ( ; ) character is used to separate multiple commands on a single line.
Syntax
Command1 ; Command2 [; Command3 ...]
Parameters
Command1, Command2, ...
The commands to be executed.
Comments
Commands are executed sequentially from left to right. All commands on a single line refer to the current thread, unless otherwise specified. If a command causes the thread
to execute, the remaining commands on the line will be deferred until that thread stops on a debug event.
A small number of commands cannot be followed by a semicolon, because they automatically take the entire remainder of the line as their argument. These include as (Set
Alias), $< (Run Script File), $>< (Run Script File), and any command beginning with the * (Comment Line Specifier) token.
Here is an example. This executes the current program to source line 123, prints the value of counter, then resumes execution:
0:000> g `:123`; ? poi(counter); g
{ } (Block Delimiter)
A pair of braces ( { } ) is used to surround a block of statements within a debugger command program.
Syntax
Statements { Statements } Statements
Comments
When each block is entered, all aliases within the block are evaluated. If you alter the value of an alias at some point within a command block, commands subsequent to that
point will not use the new alias value unless they are within a subordinate block.
Each block must begin with a control flow token. If you wish to create a block for the sole purpose of evaluating aliases, you should prefix it with the .block token.
Additional Information
For information about debugger command programs and control flow tokens, see Using Debugger Command Programs.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
${ } (Alias Interpreter)
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
A dollar sign followed by a pair of braces ( ${ } ) evaluates to a variety of values related to the specified user-named alias.
Syntax
Text
Text
Text
Text
Text
${Alias} Text
${/d:Alias} Text
${/f:Alias} Text
${/n:Alias} Text
${/v:Alias} Text
Parameters
Alias
Specifies the name of the alias to be expanded or evaluated. Alias must be a user-named alias or the Variable value used by the .foreach token.
/d
Evaluates to one or zero depending on whether the alias is currently defined. If the alias is defined, ${/v:Alias} is replaced by 1; if the alias is not defined, ${/v:Alias} is
replaced by 0.
/f
Evaluates to the alias equivalent if the alias is currently defined. If the alias is defined, ${/f:Alias} is replaced by the alias equivalent; if the alias is not defined, ${/f:Alias}
is replaced by an empty string.
/n
Evaluates to the alias name if the alias is currently defined. If the alias is defined, ${/n:Alias} is replaced by the alias name; if the alias is not defined, ${/n:Alias} is not
replaced but retains its literal value of ${/n:Alias}.
/v
Prevents any alias evaluation. Regardless of whether Alias is defined, ${/v:Alias} always retains its literal value of ${/v:Alias}.
Comments
If no switches are used and the alias is currently defined, ${Alias} is replaced by the alias equivalent. If no switches are used and the alias is not defined, ${Alias} always
retains its literal value of ${Alias}.
One advantage of using the ${ } token is that the alias will be evaluated even if it is adjacent to other characters. Without this token, the debugger only replaces aliases that are
separated from other tokens by a space.
As indicated, there are circumstances where the ${ } token is not replaced by anything but retains its literal value. This occurs when no switch is used and Alias is undefined,
when the /n switch is used and Alias is undefined, and always when the /v switch is used. In these circumstances, the token retains its literal value, including the dollar sign
and the braces. Therefore, if this is used as the parameter of a command, a syntax error will result, unless that parameter accepts arbitrary text strings.
There is, however, one exception to this. If you use ${/v:Alias} as the first parameter to the as (Set Alias) or aS (Set Alias) command, this token will be treated as the string
Alias alone, not as the string ${/v:Alias}. This only works with the as, aS, and ad commands, and it only works when the /v switch is used it will not work with ${/n:Alias}
or ${Alias} when they retain their literal values.
Alias must be a user-named alias or the Variable value used by the .foreach token not a fixed-name alias. If there is a fixed-name alias within the string Alias, it will be
replaced before the ${ } token is evaluated.
Additional Information
For an explanation of how to use aliases, see Using Aliases.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
$$ (Comment Specifier)
If two dollar signs ( $$ ) appear at the start of a command, then the rest of the line is treated as a comment, unless the comment is terminated by a semicolon.
Syntax
$$ [any text]
Comments
The $$ token is parsed like any other debugger command. Therefore, if you want to create a comment after another command, you must precede the $$ token with a
semicolon.
The $$ token will cause the text after it to be ignored until the end of the line or until a semicolon is encountered. A semicolon terminates the comment; text after the
semicolon is parsed as a standard command. This differs from * (Comment Line Specifier), which makes the remainder of the line a comment even if a semicolon is
present.
For example, the following command will display eax and ebx, but not ecx:
0:000> r eax; $$ some text; r ebx; * more text; r ecx
Text prefixed by the * or $$ tokens is not processed in any way. If you are performing remote debugging, a comment entered in the debugging server will not be visible in the
debugging client, nor vice-versa. If you wish to make comment text appear in the Debugger Command window in a way visible to all parties, you should use .echo (Echo
Comment).
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
.block
The .block token performs no action; it is used solely to introduce a block of statements.
Syntax
Commands ; .block { Commands } ; Commands
Comments
Blocks of commands are surrounded by braces. When each block is entered, all aliases within the block are evaluated. If you alter the value of an alias at some point within a
command block, commands subsequent to that point will not use the new alias value unless they are within a subordinate block.
Each block must begin with a control flow token. If you wish to create a block for the sole purpose of evaluating aliases, you should prefix it with the .block token, since this
token has no effect other than to allow a block to be introduced.
Additional Information
For information about using a new block to evaluate an alias, see Using Aliases and as, aS (Set Alias).
For information about other control flow tokens and their use in debugger command programs, see Using Debugger Command Programs.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
.break
The .break token behaves like the break keyword in C.
Syntax
.for (...) { ... ; .if (Condition) .break ; ... }
.while (...) { ... ; .if (Condition) .break ; ... }
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
.catch
The .catch token is used to prevent a program from terminating if an error occurs.
It does not behave like the catch keyword in C++.
Syntax
Commands ; .catch { Commands } ; Commands
Comments
The .catch token is followed by braces enclosing one or more commands.
If a command within a .catch block generates an error, the error message is displayed, all remaining commands within the braces are ignored, and execution resumes with the
first command after the closing brace.
If .catch is not used, an error will terminate the entire debugger command program.
You can use .leave to exit from a .catch block.
Additional Information
For information about other control flow tokens and their use in debugger command programs, see Using Debugger Command Programs.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
.continue
The .continue token behaves like the continue keyword in C.
Syntax
.for (...) { ... ; .if (Condition) .continue ; ... }
.while (...) { ... ; .if (Condition) .continue ; ... }
.do { ... ; .if (Condition) .continue ; ... } (...)
Comments
The .continue token can be used within any .for, .while, or .do loop.
Since there is no control flow token equivalent to the C goto statement, you will usually use the .continue token within an .if conditional, as shown in the syntax examples
above. However, this is not actually required.
Additional Information
For information about other control flow tokens and their use in debugger command programs, see Using Debugger Command Programs.
2009 Microsoft Corporation
Send feedback on this topic
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
.do
The .do token behaves like the do keyword in C, except that the word "while" is not used before the condition.
Syntax
.do { Commands } (Condition)
Syntax Elements
Commands
Specifies one or more commands that will be executed repeatedly as long as the condition is true but will always be executed at least once. This block of commands
needs to be enclosed in braces, even if it consists of a single command. Multiple commands should be separated by semicolons, but the final command before the closing
brace does not need to be followed by a semicolon.
Condition
Specifies a condition. If this evaluates to zero, it is treated as false; otherwise it is true. Enclosing Condition in parentheses is optional. Condition must be an expression,
not a debugger command. It will be evaluated by the default expression evaluator (MASM or C++). For details, see Numerical Expression Syntax.
Comments
The .break and .continue tokens can be used to exit or restart the Commands block.
Additional Information
For information about other control flow tokens and their use in debugger command programs, see Using Debugger Command Programs.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
.else
The .else token behaves like the else keyword in C.
Syntax
.if (Condition) { Commands } .else { Commands }
.if (Condition) { Commands } .elsif (Condition) { Commands } .else { Commands }
Syntax Elements
Commands
Specifies one or more commands that will be executed conditionally. This block of commands needs to be enclosed in braces, even if it consists of a single command.
Multiple commands should be separated by semicolons, but the final command before the closing brace does not need to be followed by a semicolon.
Additional Information
For information about other control flow tokens and their use in debugger command programs, see Using Debugger Command Programs.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
.elsif
The .elsif token behaves like the else if keyword combination in C.
Syntax
.if (Condition) { Commands } .elsif (Condition) { Commands }
.if (Condition) { Commands } .elsif (Condition) { Commands } .else { Commands }
Syntax Elements
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Condition
Specifies a condition. If this evaluates to zero, it is treated as false; otherwise it is true. Enclosing Condition in parentheses is optional. Condition must be an expression,
not a debugger command. It will be evaluated by the default expression evaluator (MASM or C++). For details, see Numerical Expression Syntax.
Commands
Specifies one or more commands that will be executed conditionally. This block of commands needs to be enclosed in braces, even if it consists of a single command.
Multiple commands should be separated by semicolons, but the final command before the closing brace does not need to be followed by a semicolon.
Additional Information
For information about other control flow tokens and their use in debugger command programs, see Using Debugger Command Programs.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
.for
The .for token behaves like the for keyword in C, except that multiple increment commands must be separated by semicolons, not by commas.
Syntax
.for (InitialCommand ; Condition ; IncrementCommands) { Commands }
Syntax Elements
InitialCommand
Specifies a command that will be executed before the loop begins. Only a single initial command is permitted.
Condition
Specifies a condition. If this evaluates to zero, it is treated as false; otherwise it is true. Enclosing Condition in parentheses is optional. Condition must be an expression,
not a debugger command. It will be evaluated by the default expression evaluator (MASM or C++). For details, see Numerical Expression Syntax.
IncrementCommands
Specifies one or more commands that will be executed at the conclusion of each loop. If you wish to use multiple increment commands, separate them by semicolons but
do not enclose them in braces.
Commands
Specifies one or more commands that will be executed repeatedly as long as the condition is true. This block of commands needs to be enclosed in braces, even if it
consists of a single command. Multiple commands should be separated by semicolons, but the final command before the closing brace does not need to be followed by a
semicolon.
Comments
If all the work is being done by the increment commands, you can omit Commands entirely and simply use an empty pair of braces.
Here is an example of a .for statement with multiple increment commands:
0:000> .for (r eax=0; @eax < 7; reax=eax+1; rebx=ebx+1) { .... }
The .break and .continue tokens can be used to exit or restart the Commands block.
Additional Information
For information about other control flow tokens and their use in debugger command programs, see Using Debugger Command Programs.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
.foreach
The .foreach token parses the output of one or more debugger commands and uses each value in this output as the input to one or more additional commands.
Syntax
.foreach [Options] ( Variable
{ InCommands } ) { OutCommands }
"InString" ) { OutCommands }
"InFile" ) { OutCommands }
Syntax Elements
Options
Can be any combination of the following options:
/pS InitialSkipNumber
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Causes some initial tokens to be skipped. InitialSkipNumber specifies the number of output tokens that will not be passed to the specified OutCommands.
/ps SkipNumber
Causes tokens to be skipped repeatedly each time a command is processed. After each time a token is passed to the specified OutCommands, a number of tokens
equal to the value of SkipNumber will be ignored.
Variable
Specifies a variable name. This variable will be used to hold the output from each command in the InCommands string; you can reference Variable by name in the
parameters passed to the OutCommands. Any alphanumeric string can be used, although using a string that can also pass for a valid hexadecimal number or debugger
command is not recommended. If the name used for Variable happens to match an existing global variable, local variable, or alias, their values will not be affected by
the .foreach command.
InCommands
Specifies one or more commands whose output will be parsed; the resulting tokens will be passed to OutCommands. The output from InCommands is not displayed.
InString
Used with /s. Specifies a string that will be parsed; the resulting tokens will be passed to OutCommands.
InFile
Used with /f. Specifies a text file that will be parsed; the resulting tokens will be passed to OutCommands. The file name InFile must be enclosed in quotation marks.
OutCommands
Specifies one or more commands which will be executed for each token. Whenever the Variable string occurs it will be replaced by the current token.
Note When the string Variable appears within OutCommands, it must be surrounded by spaces. If it is adjacent to any other text even a parenthesis it will not be
replaced by the current token value, unless you use the ${ } (Alias Interpreter) token.
Comments
When the output from InCommands, the InString string, or the InFile file is parsed, any number of spaces, tabs, or carriage returns is treated as a single delimiter. Each of the
resulting pieces of text is used to replace Variable when it appears within OutCommands.
Here is an example of a .foreach statement that uses the dds command on each token found in the file myfile.txt:
0:000> .foreach /f ( place "g:\myfile.txt") { dds place }
The /pS and /ps flags can be used to pass only certain tokens to the specified OutCommands. For example, the following statement will skip the first two tokens in the
myfile.txt file and then pass the third to dds. After each token that is passed, it will skip four tokens. The result is that dds will be used with the 3rd, 8th, 13th, 18th, and 23rd
tokens, and so on:
0:000> .foreach /pS 2 /ps 4 /f ( place "g:\myfile.txt") { dds place }
For more examples that use the .foreach token, see Debugger Command Program Examples.
Additional Information
For information about other control flow tokens and their use in debugger command programs, see Using Debugger Command Programs.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
.if
The .if token behaves like the if keyword in C.
Syntax
.if (Condition) { Commands }
.if (Condition) { Commands } .else { Commands }
.if (Condition) { Commands } .elsif (Condition) { Commands }
.if (Condition) { Commands } .elsif (Condition) { Commands } .else { Commands }
Syntax Elements
Condition
Specifies a condition. If this evaluates to zero, it is treated as false; otherwise it is true. Enclosing Condition in parentheses is optional. Condition must be an expression,
not a debugger command. It will be evaluated by the default expression evaluator (MASM or C++). For details, see Numerical Expression Syntax.
Commands
Specifies one or more commands that will be executed conditionally. This block of commands needs to be enclosed in braces, even if it consists of a single command.
Multiple commands should be separated by semicolons, but the final command before the closing brace does not need to be followed by a semicolon.
Additional Information
For information about other control flow tokens and their use in debugger command programs, see Using Debugger Command Programs.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
.leave
The .leave token is used to exit from a .catch block.
Syntax
.catch { ... ; .if (Condition) .leave ; ... }
Comments
When a .leave token is encountered within a .catch block, the program exits from the block, and execution resumes with the first command after the closing brace.
Since there is no control flow token equivalent to the C goto statement, you will usually use the .leave token within an .if conditional, as shown in the syntax examples above.
However, this is not actually required.
Additional Information
For information about other control flow tokens and their use in debugger command programs, see Using Debugger Command Programs.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
.printf
The .printf token behaves like the printf statement in C.
Syntax
.printf [Option] "FormatString" [Arguments ...]
Syntax Elements
Option
(WinDbg only) Specifies the type of text message that WinDbg should interpret the FormatString as. WinDbg assigns each type of Debugger Command window message
a background and text color; choosing one of these options causes the message to be displayed in the appropriate colors. The default is to display the text as a normallevel message. For more information on message colors and how to set them, see View | Options.
The following options are available:
Option
/od
/oD
/oe
/on
/op
/oP
/os
/ov
/ow
FormatString
Specifies the format string, as in printf. In general, conversion characters work exactly as in C. For the floating-point conversion characters the 64-bit argument is
interpreted as a 32-bit floating-point number unless the l modifier is used.
The %p conversion character is supported, but it represents a pointer in the target's virtual address space. It may not have any modifiers and it uses the debugger's
internal address formatting. The following additional conversion characters are supported:
Character
Argument Type
%p
ULONG64
%N
DWORD_PTR (32 or 64 bits,
depending on the host's architecture)
%I
ULONG64
Argument
Pointer in the target's virtual address space
Pointer in the host's virtual address space
%ma
ULONG64
%mu
ULONG64
Text printed
The value of the pointer.
The value of the pointer. (This is equivalent to the standard C %p
character.)
The specified value. If this is greater than 0xFFFFFFFF it is
printed as a 64-bit address, otherwise it is printed as a 32-bit
address.
The specified string.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
%msa
ULONG64
%msu
ULONG64
%y
ULONG64
%ly
ULONG64
Arguments
Specifies arguments for the format string, as in printf. The number of arguments specified should match the number of conversion characters in FormatString. Each
argument is an expression that will be evaluated by the default expression evaluator (MASM or C++). For details, see Numerical Expression Syntax.
Comments
The color settings that can be chosen using the Options parameter are by default all set to black text on a white background. To make best use of these options, you must first
use View | Options to open the Options dialog box and change the color settings for Debugger Command window messages.
Additional Information
For information about other control flow tokens and their use in debugger command programs, see Using Debugger Command Programs.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
.while
The .while token behaves like the while keyword in C.
Syntax
.while (Condition) { Commands }
Syntax Elements
Condition
Specifies a condition. If this evaluates to zero, it is treated as false; otherwise it is true. Enclosing Condition in parentheses is optional. Condition must be an expression,
not a debugger command. It will be evaluated by the default expression evaluator (MASM or C++). For details, see Numerical Expression Syntax.
Commands
Specifies one or more commands that will be executed repeatedly as long as the condition is true. This block of commands needs to be enclosed in braces, even if it
consists of a single command. Multiple commands should be separated by semicolons, but the final command before the closing brace does not need to be followed by a
semicolon.
Comments
The .break and .continue tokens can be used to exit or restart the Commands block.
Additional Information
For information about other control flow tokens and their use in debugger command programs, see Using Debugger Command Programs.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Commands
This section of the reference discusses the various debugger commands that you can use in CDB, KD, and WinDbg.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The ENTER key repeats the last command that you typed.
Syntax
ENTER
Environment
Modes
User mode, kernel mode
Targets Live, crash dump
Platforms All
Comments
In CDB and KD, pressing the ENTER key by itself at a command prompt reissues the command that you previously entered.
In WinDbg, the ENTER key can have no effect or you can use it to repeat the previous command. You can set this option in the Options dialog box. (To open the Options
dialog box, click Options on the View menu or click the Options button (
) on the toolbar.)
If you set ENTER to repeat the last command, but you want to create white space in the Debugger Command window, use the * (Comment Line Specifier) token and then
press ENTER several times.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Token Space permitted before the file name? Condenses the script into a single command block?
$<
No
No
$>< No
Yes
$$< Yes
No
$$>< Yes
Yes
$$>a< Yes
Yes
When the debugger executes a script file, the commands and their output are displayed in the Debugger Command window. When the end of the script file is reached, control
returns to the debugger.
The $<, $><, $$<, and $$>< commands echo the commands contained in the script file and display the output of these commands. The $$>a< command does not echo the
commands found in the script file, but merely displays their output.
Script files can be nested. If the debugger encounters one of these tokens in a script file, execution moves to the new script file and returns to the previous location when the
new script file has been completed. Scripts can also be called recursively.
In WinDbg, you can paste the additional command text in the Debugger Command window.
Example
The following example demonstrates how to pass arguments to a script file, Myfile.txt. Assume that the file contains the following text:
.echo The first argument is ${$arg1}.
.echo The second argument is ${$arg2}.
Then you can pass arguments to this file by using a command like this:
0:000> $$>a<myfile.txt myFirstArg mySecondArg
The result of this command would be:
The first argument is myFirstArg.
The second argument is mySecondArg.
Here is an example of what happens when the wrong number of argument is supplied. Assume that the file My Script.txt contains the following text:
.echo The first argument is ${$arg1}.
.echo The fifth argument is ${$arg5}.
.echo The fourth argument is ${$arg4}.
Then the following semicolon-delimited command line produces output thus:
0:000> $$>a< "c:\binl\my script.txt" "First one" Two "Three More" Four; recx
The first argument is First one.
The fifth argument is ${$arg5}.
The fourth argument is Four.
ecx=0021f4ac
In the preceding example, the file name is enclosed in quotation marks because it contains a space, and arguments that contain spaces are enclosed in quotation marks as well.
Although a fifth argument seems to be expected by the script, the semicolon terminates the $$>a< command after the fourth argument.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
? (Command Help)
The question mark (?) character displays a list of all commands and operators.
Note A question mark by itself displays command help. The ? expression syntax evaluates the given expression.
Syntax
?
Environment
Modes
User mode, kernel mode
Targets Live, crash dump
Platforms All
Comments
For more information about standard commands, use ?. For more information about meta-commands, use .help. For more information about extension commands, use !help.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
? (Evaluate Expression)
The question mark (?) command evaluates and displays the value of an expression.
Note A question mark by itself (?) displays command help. The ? expression command evaluates the given expression.
Syntax
? Expression
Parameters
Expression
Specifies the expression to evaluate.
Environment
Modes
User mode, kernel mode
Targets Live, crash dump
Platforms All
Comments
The input and output of the ? command depend on whether you are using MASM expression syntax or C++ expression syntax. For more information about these kinds of
expression syntax, see Evaluating Expressions and Numerical Expression Syntax.
If you are using MASM syntax, the input and output depend on the current radix. To change the radix, use the n (Set Number Base) command.
The ? command evaluates symbols in the expression in the context of the current thread and process.
Some strings may contain escapes, such as \n, \", \r, and \b, that are meant to be read literally, rather than interpreted by the evaluator. If an escape within a string is
interpreted by the evaluator, errors in evaluation can occur. For example:
0:000> as AliasName c:\dir\name.txt
0:000> al
Alias
Value
------------AliasName
c:\dir\name.txt
0:001> ? $spat( "c:\dir\name.txt", "*name*" )
Evaluate expression: 0 = 00000000
0:001> ? $spat( "${AliasName}", "*name*" )
Evaluate expression: 0 = 00000000
0:001> ? $spat( "c:\dir\", "*filename*" )
Syntax error at '( "c:\dir\", "*filename*" )
In the first two examples, even though the string does match the pattern, the evaluator is returning a value of FALSE. In the third, the evaluator cannot make a comparison
because the string ends in a backslash ( \ ), and so the \" is translated by the evaluator.
To get the evaluator to interpret a string literally, you must use the @"String" syntax. The following code example shows the correct results:
0:000> ?
Evaluate
0:000> ?
Evaluate
0:001> ?
Evaluate
In the preceding examples, the $spat MASM operator checks the first string to determine whether it matches the pattern of the second string. For more information about
MASM operators, see the MASM Numbers and Operators topic.
See Also
?? (Evaluate C++ Expression), .formats (Show Number Formats)
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
45
fc
8945b0
inc
cld
mov
ebp
eax,[ebp-0x1c]
The # command can search for text within any single part of the disassembly display. For example, you could use # eax 0040116b to find the mov eax,[ebp-0x1c] instruction
at address 0040116d. The following commands also find this instruction.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
#
#
#
#
[ebp?0x 0040116b
mov 0040116b
8945* 0040116b
116d 0040116b
However, you cannot search for mov eax* as a single unit, because mov and eax appear in different parts of the display.
As an additional example, you could issue the following command to search for the first reference to the strlen function after the entry point main.
# strlen main
Similarly, you could issue the following two commands to find the first jnz instruction after address 0x779F9FBA and then find the next jnz instruction after that.
# jnz 779f9fba#
When you omit Pattern or Address, their values are based on the previous use of the # command. If you omit either parameter the first time that you issue the # command, no
search is performed. However, the values of Pattern and Address are initialized even in this situation.
If you include Pattern or Address, its value is set to the entered value. If you omit Address, it is initialized to the current value of the program counter. If you omit Pattern, it is
initialized to an empty pattern.
Additional Information
For more information about assembly debugging and related commands, see Debugging in Assembly Mode.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
|| (System Status)
The double vertical bar (||) command prints status for the specified system or for all systems that you are currently debugging.
Do not confuse this command with the | (Process Status) command.
Syntax
|| System
Parameters
System
Specifies the system to display. If you omit this parameter, all systems that you are debugging are displayed. For more information about the syntax, see System Syntax.
Environment
Modes
Multiple target debugging
Targets Live, crash dump
Platforms All
Comments
The || command is useful only when you are debugging multiple targets. Many, but not all, multiple-target debugging sessions involve multiple systems. For more information
about these sessions, see Debugging Multiple Targets.
Each system listing includes the server name and the protocol details. The system that the debugger is running on is identified as <Local>.
The following examples show you how to use this command. The following command displays all systems.
3:2:005> ||
The following command also displays all systems.
3:2:005> ||*
The following command displays the currently active system.
3:2:005> ||.
The following command displays the system that had the most recent exception or break.
3:2:005> ||#
The following command displays system number 2.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
3:2:005> ||2
| (Process Status)
The pipe (|) command displays status for the specified process, or for all processes that you are currently debugging.
Do not confuse this command with the || (System Status) command.
Syntax
| Process
Parameters
Process
Specifies the process to display. If you omit this parameter, all processes that you are debugging are displayed. For more information about the syntax, see Process
Syntax.
Environment
Modes
User mode only
Targets Live, crash dump
Platforms All
Comments
You can specify processes only in user mode.
You can add a process symbol before many commands. For more information about the meaning of a pipe (|) followed by a command, see the entry for the command itself.
Unless you enabled the debugging of child processes when you started the debugging session, there is only one process that is available to the debugger.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The following examples show you how to use this command. The following command displays all processes.
2:005> |
The following command also displays all processes.
2:005> |*
The following command displays the currently active process.
2:005> |.
The following command displays the process that originally caused the exception (or that the debugger originally attached to).
2:005> |#
The following command displays process number 2.
2:005> |2
The previous command displays the following output.
0:002> |
# 0 id: 224
1 id: 228
. 2 id: 22c
name: myprog.exe
name: onechild.exe
name: anotherchild.exe
On the first line of this output, 0 is the decimal process number, 224 is the hexadecimal process ID, and Myprog.exe is the application name of the process. The period (.)
before process 2 means that this process is the current process. The number sign (#) before process 0 means that this process was the one that originally caused the exception
or that the debugger attached to.
Additional Information
For more information and other methods of displaying or controlling processes and threads, see Controlling Processes and Threads.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
~ (Thread Status)
The tilde (~) command displays status for the specified thread or for all threads in the current process.
Syntax
~ Thread
Parameters
Thread
Specifies the thread to display. If you omit this parameter, all threads are displayed. For more information about the syntax, see Thread Syntax.
Environment
Modes
User mode only
Targets Live, crash dump
Platforms All
Comments
You can specify threads only in user mode. In kernel mode, the tilde (~) refers to a processor.
You can add a thread symbol before many commands. For more information about the meaning of a tilde (~) followed by a command, see the entry for the command itself.
The following examples show you how to use this command. The following command displays all threads.
0:001> ~
The following command also displays all threads.
0:001> ~*
The following command displays the currently active thread.
0:001> ~.
The following command displays the thread that originally caused the exception (or that was active when the debugger attached to the process).
0:001> ~#
The following command displays thread number 2.
0:001> ~2
The previous command displays the following output.
0:001> ~
0 id: 4dc.470 Suspend: 0 Teb 7ffde000 Unfrozen
. 1 id: 4dc.534 Suspend: 0 Teb 7ffdd000 Unfrozen
# 2 id: 4dc.5a8 Suspend: 0 Teb 7ffdc000 Unfrozen
On the first line of this output, 0 is the decimal thread number, 4DC is the hexadecimal process ID, 470 is the hexadecimal thread ID, 0x7FFDE000 is the address of the TEB,
and Unfrozen is the thread status. The period (.) before thread 1 means this thread is the current thread. The number sign (#) before thread 2 means this thread was the one
that originally caused the exception or it was active when the debugger attached to the process.
Additional Information
For more information and other methods of displaying or controlling processes and threads, see Controlling Processes and Threads.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
~e (Thread-Specific Command)
The ~e command executes one or more commands for a specific thread or for all threads in the target process.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
~f (Freeze Thread)
The ~f command freezes the given thread, causing it to stop and wait until it is unfrozen.
Do not confuse this command with the f (Fill Memory) command.
Syntax
~Thread f
Parameters
Thread
Specifies the thread to freeze. For more information about the syntax, see Thread Syntax.
Environment
Modes
User mode only
Targets Live, crash dump
Platforms All
Comments
You can specify threads only in user mode. In kernel mode, the tilde (~) refers to a processor.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The ~f command causes the specified thread to freeze. When the debugger enables the target application to resume execution, other threads execute as expected while this
thread remains stopped.
The following examples show you how to use this command. The following command displays the current status of all threads.
0:000> ~* k
The following command freezes the thread that caused the current exception.
0:000> ~# f
The following command checks that the status of this thread is suspended.
0:000> ~* k
The following command unfreezes thread number 123.
0:000> ~123 u
Additional Information
For more information about how frozen threads behave and a list of other commands that control the freezing and suspending of threads, see Controlling Processes and
Threads.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
~u (Unfreeze Thread)
The ~u command unfreezes the specified thread.
Do not confuse this command with the U (Unassemble) command.
Syntax
~Thread u
Parameters
Thread
Specifies the thread or threads to unfreeze. For more information about the syntax, see Thread Syntax.
Environment
Modes
User mode only
Targets Live, crash dump
Platforms All
Comments
You can specify threads only in user mode. In kernel mode, the tilde (~) refers to a processor.
The following examples show you how to use the ~ commands.
The following command displays the current status of all threads.
0:000> ~* k
The following command freeze the thread that caused the current exception.
0:000> ~# f
The following command checks that the status of this thread is suspended.
0:000> ~* k
The following command unfreezes thread number 123.
0:000> ~123 u
Additional Information
For more information about how frozen threads behave and a list of other commands that control the freezing and suspending of threads, see Controlling Processes and
Threads.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
~n (Suspend Thread)
The ~n command suspends execution of the specified thread.
Do not confuse this command with the n (Set Number Base) command.
Syntax
~Thread n
Parameters
Thread
Specifies the thread or threads to suspend. For more information about the syntax, see Thread Syntax.
Environment
Modes
User mode only
Targets Live debugging only
Platforms All
Comments
You can specify threads only in user mode. In kernel mode, the tilde (~) refers to a processor.
Every time that you use the ~n command, the thread's suspend count is increased by one.
The thread's start address is displayed when you use this command.
Additional Information
For more information about the suspend count and how suspended threads behave and for a list of other commands that control the suspending and freezing of threads, see
Controlling Processes and Threads.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
~m (Resume Thread)
The ~m command resumes execution of the specified thread.
Do not confuse this command with the m (Move Memory) command.
Syntax
~Thread m
Parameters
Thread
Specifies the thread or threads to resume. For more information about the syntax, see Thread Syntax.
Environment
Modes
User mode only
Targets Live debugging only
Platforms All
Comments
You can specify threads only in user mode. In kernel mode, the tilde (~) refers to a processor.
Every time that you use the ~m command, the thread's suspend count is decreased by one.
Additional Information
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
For more information about the suspend count and how suspended threads behave and for a list of other commands that control the suspending and freezing of threads, see
Controlling Processes and Threads.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
You can immediately tell when you are working on a multiple processor system by the shape of the kernel debugging prompt. In the following example, 0: means that you are
debugging the first processor in the computer.
0: kd>
Use the following command to switch between processors:
0: kd> ~1s
1: kd>
Now the second processor in the computer that is being debugged.
See Also
Multiprocessor Syntax
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
a (Assemble)
The a command assembles instruction mnemonics and puts the resulting instruction codes into memory.
Syntax
a [Address]
Parameters
Address
Specifies the beginning of the block in memory where the resulting codes are put. For more information about the syntax, see Address and Address Range Syntax.
Environment
Modes
User mode, kernel mode
Targets Live, crash dump
Platforms All
Comments
If you do not specify an address, the assembly starts at the address that the current value of the instruction pointer specifies. To assemble a new instruction, type the desired
mnemonic and press ENTER. To end assembly, press only ENTER.
Because the assembler searches for all of the symbols that are referred to in the code, this command might take time to complete. During this time, you cannot press
CTRL+Cto end the a command.
Additional Information
For more information about assembly debugging and related commands, see Debugging in Assembly Mode.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ad (Delete Alias)
The ad command deletes an alias from the alias list.
Syntax
ad [/q] Name
ad *
Parameters
/q
Specifies quiet mode. This mode hides the error message if the alias that Name specifies does not exist.
Name
Specifies the name of the alias to delete. If you specify an asterisk (*), all aliases are deleted (even if there is an alias whose name is "*").
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Environment
Modes
User mode, kernel mode
Targets Live, crash dump
Platforms All
Comments
You can use the ad command to delete any user-named alias. But you cannot use this command to delete a fixed-name alias ($u0 to $u9).
Additional Information
For more information about how to use aliases, see Using Aliases.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ah (Assertion Handling)
The ah command controls the assertion handling status for specific addresses.
Syntax
ahb [Address]
ahi [Address]
ahd [Address]
ahc
ah
Parameters
ahb
Breaks into the debugger if an assertion fails at the specified address.
ahi
Ignores an assertion failure at the specified address.
ahd
Deletes any assertion-handling information at the specified address. This deletion causes the debugger to return to its default state for that address.
Address
Specifies the address of the instruction whose assertion-handling status is being set. If you omit this parameter, the debugger uses the current program counter.
ahc
Deletes all assertion-handling information for the current process.
ah
Displays the current assertion-handling settings.
Environment
Modes
User mode, kernel mode
Targets Live debugging only
Platforms All
Comments
The ah* command controls the assertion handling status for a specific address. The sx* asrt command controls the global assertion handling status. If you use ah* for a
certain address and then an assert occurs there, the debugger responds based on the ah* settings and ignores the sx* asrt settings.
When the debugger encounters an assertion, the debugger first checks whether handling has been configured for that specific address. If you have not configured the handling,
the debugger uses the global setting.
The ah* command affects only the current process. When the current process ends, all status settings are lost.
Assertion handling status affects only STATUS_ASSERTION_EXCEPTION exceptions. This handling does not affect the kernel-mode ASSERT routine.
Additional Information
For more information about break status and handling status, descriptions of all event codes, a list of the default status for all events, and details about other methods of
controlling this status, see Controlling Exceptions and Events.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
al (List Aliases)
The al command displays a list of all currently defined user-named aliases.
Syntax
al
Environment
Modes
User mode, kernel mode
Targets Live, crash dump
Platforms All
Comments
The al command lists all user-named aliases. But this command does not list fixed-name aliases ($u0 to $u9).
Additional Information
For more information about how to use aliases, see Using Aliases.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Name EquivalentLine
Name EquivalentPhrase
Name "EquivalentPhrase"
/e Name EnvironmentVariable
/ma Name Address
/mu Name Address
/msa Name Address
/msu Name Address
/x Name Expression
/f Name File
/c Name CommandString
Parameters
Name
Specifies the alias name. This name can be any text string that does not contain a space or the ENTER keystroke and does not begin with "al", "as", "aS", or "ad". Name
is case sensitive.
EquivalentLine
Specifies the alias equivalent. EquivalentLine is case sensitive. You must add at least one space between Name and EquivalentLine. The number of spaces between these
two parameters is not important. The alias equivalent never contains leading spaces. After these spaces, EquivalentLine includes the rest of the line. Semicolons,
quotation marks, and spaces are treated as literal characters, and trailing spaces are included.
EquivalentPhrase
Specifies the alias equivalent. EquivalentPhrase is case sensitive. You must add at least one space between Name and EquivalentPhrase. The number of spaces between
these two parameters is not important. The alias equivalent never contains leading spaces.
You can enclose EquivalentPhrase in quotation marks ("). Regardless of whether you use quotation marks, EquivalentPhrase can contain spaces, commas, and single
quotation marks ('). If you enclose EquivalentPhrase in quotation marks, it can include semicolons, but not additional quotation marks. If you do not enclose
EquivalentPhrase in quotation marks, it can include quotation marks in any location other than the first character, but it cannot include semicolons. Trailing spaces are
included regardless of whether you use quotation marks.
/e
Sets the alias equivalent equal to the environment variable that EnvironmentVariable specifies.
EnvironmentVariable
Specifies the environment variable that is used to determine the alias equivalent. The debugger's environment is used, not the target's. If you started the debugger at a
Command Prompt window, the environment variables in that window are used.
/ma
Sets the alias equivalent equal to the null-terminated ASCII string that begins at Address.
/mu
Sets the alias equivalent equal to the null-terminated Unicode string that begins at Address.
/msa
Sets the alias equivalent equal to the ANSI_STRING structure that is located at Address.
/msu
Sets the alias equivalent equal to the UNICODE_STRING that is structure located at Address.
Address
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Specifies the location of the virtual memory that is used to determine the alias equivalent.
/x
Sets the alias equivalent equal to the 64-bit value of Expression.
Expression
Specifies the expression to evaluate. This value becomes the alias equivalent. For more information about the syntax, see Numerical Expression Syntax.
/f
Sets the alias equivalent equal to the contents of the File file. You should always use the /f switch together with aS, not with as.
File
Specifies the file whose contents become the alias equivalent. File can contain spaces, but you should never enclose File in quotation marks. If you specify an invalid
file, you receive an "Out of memory" error message.
/c
Sets the alias equivalent equal to the output of the commands that CommandString specify. The alias equivalent includes carriage returns if they are present within the
command display and a carriage return at the end of the display of each command (even if you specify only one command).
CommandString
Specifies the commands whose outputs become the alias equivalent. This string can include any number of commands that are separated by semicolons.
Environment
Modes
User mode, kernel mode
Targets Live, crash dump
Platforms All
Comments
If you do not use any switches, the as command uses the rest of the line as the alias equivalent.
You can end the aS command by a semicolon. This technique is useful in a script when you have to put all commands on a single line. Note that if the portion of the line after
the semicolon requires expansion of the alias, you must enclose that second portion of the line in a new block. The following example produces the expected output, 0x6.
0:001> aS /x myAlias 5 + 1; .block{.echo myAlias}
0x6
If you omit the new block, you do not get the expected output. That is because the expansion of a newly set alias does not happen until a new code block is entered. In the
following example, the new block is omitted, and the output is the text "myAlias" instead of the expected value 0x6.
0:001> aS /x myAlias 5 + 1; .echo myAlias
myAlias
For more information about using aliases in scripts, see Using Aliases.
If you use a /e, /ma, /mu, /msa, /msu, or /x switch, the as and aS commands work the same and the command ends if a semicolon is encountered.
If Name is already the name of an existing alias, that alias is redefined.
You can use the as or aS command to create or change any user-named alias. But you cannot use the command to control a fixed-name alias ($u0 to $u9).
You can use the /ma, /mu, /msa, /msu, /f, and /c switches to create an alias that contains carriage returns. However, you cannot use an alias that contains carriage returns to
execute multiple commands in sequence. Instead, you must use semicolons.
Additional Information
For more information about how to use aliases, see Using Aliases.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ba (Break on Access)
The ba command sets a processor breakpoint (often called, less accurately, a data breakpoint). This breakpoint is triggered when the specified memory is accessed.
Syntax
User-Mode
[~Thread] ba[ID] Access Size [Options] [Address [Passes]] ["CommandString"]
Kernel-Mode
ba[ID] Access Size [Options] [Address [Passes]] ["CommandString"]
Parameters
Thread
Specifies the thread that the breakpoint applies to. For more information about syntax, see Thread Syntax. You can specify threads only in user mode.
ID
Specifies an optional number that identifies the breakpoint. If you do not specify ID, the first available breakpoint number is used. You cannot add space between ba and
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
the ID number. Each processor supports only a limited number of processor breakpoints, but there is no restriction on the value of the ID number. If you enclose ID in
square brackets ([]), ID can include any expression. For more information about the syntax, see Numerical Expression Syntax.
Access
Specifies the type of access that satisfies the breakpoint. This parameter can be one of the following values.
Option
Action
e (execute) Breaks into the debugger when the CPU retrieves an instruction from the specified address.
r
Breaks into the debugger when the CPU reads or writes at the specified address.
(read/write)
w (write)
Breaks into the debugger when the CPU writes at the specified address.
i (i/o)
(Microsoft Windows XP and later versions, kernel mode only, x86-based systems only) Breaks into the debugger when the I/O port at the specified Address
is accessed.
You cannot add space between Access and Size.
Note On Windows Server 2003 with Service Pack 1 (SP1), on an Itanium-based computer that uses WOW64 to emulate x86, processor breakpoints do not work with the
execute option but they do work with the read and write options.
Size
Specifies the size of the location, in bytes, to monitor for access. On an x86-based processor, this parameter can be 1, 2, or 4. However, if Access equals e, Size must be 1.
On an x64-based processor, this parameter can be 1, 2, 4, or 8. However, if Access equals e, Size must be 1.
On an Itanium-based processor, this parameter can be any power of 2, from 1 to 0x80000000.
You cannot add space between Access and Size.
Options
Specifies breakpoint options. You can use any number of the following options, except as indicated:
/1
Creates a "one-shot" breakpoint. After this breakpoint is triggered, the breakpoint is permanently removed from the breakpoint list.
/f PredNum
(Itanium only, user mode only) Specifies a predicate number. The breakpoint is predicated with the corresponding predicate register (for example, bp /f 4 address
sets a breakpoint that is predicated with the p4 predicate register). For more information about predicate registers, see Itanium Architecture.
/p EProcess
(Kernel mode only) Specifies a process that is associated with this breakpoint. EProcess should be the actual address of the EPROCESS structure, not the PID. The
breakpoint is triggered only if it is encountered in the context of this process.
/t EThread
(Kernel mode only) Specifies a thread that is associated with this breakpoint. EThread should be the actual address of the ETHREAD structure, not the thread ID.
The breakpoint is triggered only if it is encountered in the context of this thread. If you use /p EProcess and /t EThread , you can enter them in either order.
/c MaxCallStackDepth
Causes the breakpoint to be active only when the call stack depth is less than MaxCallStackDepth. You cannot combine this option together with /C.
/C MinCallStackDepth
Causes the breakpoint to be active only when the call stack depth is larger than MinCallStackDepth. You cannot combine this option together with /c.
Address
Specifies any valid address. If the application accesses memory at this address, the debugger stops execution and displays the current values of all registers and flags.
This address must be an offset and suitably aligned to match the Size parameter. (For example, if Size is 4, Address must be a multiple of 4.) If you omit Address, the
current instruction pointer is used. For more information about the syntax, see Address and Address Range Syntax.
Passes
Specifies the number of times the breakpoint is passed by until it activates. This number can be any 16-bit value. The number of times the program counter passes
through this point without breaking is one less than the value of this number. Therefore, omitting this number is the same as setting it equal to 1. Note also that this
number counts only the times that the application executes past this point. Stepping or tracing past this point does not count. After the full count is reached, you can reset
this number only by clearing and resetting the breakpoint.
CommandString
Specifies a list of commands to execute every time that the breakpoint is encountered the specified number of times. These commands are executed only if the breakpoint
is hit after you issue a g (Go) command, instead of after a t (Trace) or p (Step) command. Debugger commands in CommandString can include parameters.
You must enclose this command string in quotation marks, and you should separate multiple commands by semicolons. You can use standard C control characters (such
as \n and \"). Semicolons that are contained in second-level quotation marks (\") are interpreted as part of the embedded quoted string.
This parameter is optional.
Environment
Modes
User mode, kernel mode
Targets Live debugging only
Platforms All
Comments
The debugger uses the ID number to refer to the breakpoint in later bc (Breakpoint Clear), bd (Breakpoint Disable), and be (Breakpoint Enable) commands.
Use the bl (Breakpoint List) command to list all existing breakpoints, their ID numbers, and their status.
Use the .bpcmds (Display Breakpoint Commands) command to list all existing breakpoints, their ID numbers, and the commands that were used to create them.
Each processor breakpoint has a size associated with it. For example, a w (write) processor breakpoint could be set at the address 0x70001008 with a size of four bytes. This
would monitor the block of addresses from 0x70001008 to 0x7000100B, inclusive. If this block of memory is written to, the breakpoint will be triggered.
It can happen that the processor performs an operation on a memory region that overlaps with, but is not identical to, the specified region. In this example, a single write
operation that includes the range 0x70001000 to 0x7000100F, or a write operation that includes only the byte at 0x70001009, would be an overlapping operation. In such a
situation, whether the breakpoint is triggered is processor-dependent. You should consult the processor manual for specific details. To take one specific instance, on an x86
processor, a read or write breakpoint is triggered whenever the accessed range overlaps the breakpoint range.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Similarly, if an e (execute) breakpoint is set on the address 0x00401003, and then a two-byte instruction spanning the addresses 0x00401002 and 0x00401003 is executed, the
result is processor-dependent. Again, consult the processor architecture manual for details.
The processor distinguishes between breakpoints set by a user-mode debugger and breakpoints set by a kernel-mode debugger. A user-mode processor breakpoint does not
affect any kernel-mode processes. A kernel-mode processor breakpoint might or might not affect a user-mode process, depending on whether the user-mode code is using the
debug register state and whether there is a user-mode debugger that is attached.
To apply the current process' existing data breakpoints to a different register context, use the .apply_dbp (Apply Data Breakpoint to Context) command.
On a multiprocessor computer, each processor breakpoint applies to all processors. For example, if the current processor is 3 and you use the command ba e1 MyAddress
to put a breakpoint at MyAddress, any processor not only processor 3 that executes at that address triggers the breakpoint. (This holds for software breakpoints as well.)
You cannot create multiple processor breakpoints at the same address that differ only in their CommandString values. However, you can create multiple breakpoints at the
same address that have different restrictions (for example, different values of the /p, /t, /c, and /C options).
For more details on processor breakpoints, and additional restrictions that apply to them, see Processor Breakpoints (ba Breakpoints).
The following examples show the ba command. The following command sets a breakpoint for read access on 4 bytes of the variable myVar.
0:000> ba r4 myVar
The following command adds a breakpoint on all serial ports with addresses from 0x3F8 through 0x3FB. This breakpoint is triggered if anything is read or written to these
ports.
kd> ba i4 3f8
Additional Information
For more information on processor breakpoints, see Processor Breakpoints (ba Breakpoints). For more information about and examples of using breakpoints, other breakpoint
commands and methods of controlling breakpoints, and information about how to set breakpoints in user space from a kernel debugger, see Using Breakpoints. For more
information about conditional breakpoints, see Setting a Conditional Breakpoint.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
bc (Breakpoint Clear)
The bc command permanently removes previously set breakpoints from the system.
Syntax
bc Breakpoints
Parameters
Breakpoints
Specifies the ID numbers of the breakpoints to remove. You can specify any number of breakpoints. You must separate multiple IDs by spaces or commas. You can
specify a range of breakpoint IDs by using a hyphen (-). You can use an asterisk (*) to indicate all breakpoints. If you want to use a numeric expression for an ID, enclose
it in brackets ([]). If you want to use a string with wildcard characters to match a breakpoint's symbolic name, enclose it in quotation marks ( " " ).
Environment
Modes
User mode, kernel mode
Targets Live debugging only
Platforms All
Comments
Use the bl (Breakpoint List) command to list all existing breakpoints, their ID numbers, and their status.
Use the .bpcmds (Display Breakpoint Commands) command to list all existing breakpoints, their ID numbers, and the commands that were used to create them.
Additional Information
For more information about how to use breakpoints, other breakpoint commands and methods of controlling breakpoints, and how to set breakpoints in user space from a
kernel debugger, see Using Breakpoints. For more information about conditional breakpoints, see Setting a Conditional Breakpoint.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
bd (Breakpoint Disable)
The bd command disables, but does not delete, previously set breakpoints.
Syntax
bd Breakpoints
Parameters
Breakpoints
Specifies the ID numbers of the breakpoints to disable. You can specify any number of breakpoints. You must separate multiple IDs by spaces or commas. You can
specify a range of breakpoint IDs by using a hyphen (-). You can use an asterisk (*) to indicate all breakpoints. If you want to use a numeric expression for an ID, enclose
it in brackets ([]). If you want to use a string with wildcard characters to match a breakpoint's symbolic name, enclose it in quotation marks ( " " ).
Environment
Modes
User mode, kernel mode
Targets Live debugging only
Platforms All
Comments
When a breakpoint is disabled, the system does not check whether the conditions that are specified in the breakpoint are valid.
Use the be (Breakpoint Enable) command to re-enable a disabled breakpoint.
Use the bl (Breakpoint List) command to list all existing breakpoints, their ID numbers, and their status.
Use the .bpcmds (Display Breakpoint Commands) command to list all existing breakpoints, their ID numbers, and the commands that were used to create them.
Additional Information
For more information about how to use breakpoints, other breakpoint commands and methods of controlling breakpoints, and how to set breakpoints in user space from a
kernel debugger, see Using Breakpoints. For more information about conditional breakpoints, see Setting a Conditional Breakpoint.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
be (Breakpoint Enable)
The be command restores one or more breakpoints that were previously disabled.
Syntax
be Breakpoints
Parameters
Breakpoints
Specifies the ID numbers of the breakpoints to enable. You can specify any number of breakpoints. You must separate multiple IDs by spaces or commas. You can
specify a range of breakpoint IDs by using a hyphen (-). You can use an asterisk (*) to indicate all breakpoints. If you want to use a numeric expression for an ID, enclose
it in brackets ([]). If you want to use a string with wildcard characters to match a breakpoint's symbolic name, enclose it in quotation marks ( " " ).
Environment
Modes
User mode, kernel mode
Targets Live debugging only
Platforms All
Comments
Use the bl (Breakpoint List) command to list all existing breakpoints, their ID numbers, and their status.
Use the .bpcmds (Display Breakpoint Commands) command to list all existing breakpoints, their ID numbers, and the commands that were used to create them.
Additional Information
For more information about and examples of how to use breakpoints, other breakpoint commands and methods of controlling breakpoints, and how to set breakpoints in user
space from a kernel debugger, see Using Breakpoints. For more information about conditional breakpoints, see Setting a Conditional Breakpoint.
2009 Microsoft Corporation
Send feedback on this topic
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
bl (Breakpoint List)
The bl command lists information about existing breakpoints.
Syntax
bl [/L] [Breakpoints]
Parameters
/L
Forces bl to always display breakpoint addresses instead of showing source file and line numbers.
Breakpoints
Specifies the ID numbers of the breakpoints to list. If you omit Breakpoints, the debugger lists all breakpoints. You can specify any number of breakpoints. You must
separate multiple IDs by spaces or commas. You can specify a range of breakpoint IDs by using a hyphen (-). You can use an asterisk (*) to indicate all breakpoints. If
you want to use a numeric expression for an ID, enclose it in brackets ([]). If you want to use a string with wildcard characterss to match a breakpoint's symbolic name,
enclose it in quotation marks ( " " ).
Environment
Modes
User mode, kernel mode
Targets Live debugging only
Platforms All
Comments
The following example shows the output from a bl command.
0:000> bl
0 e 010049e0
0001 (0001)
0:**** stst!main
The breakpoint ID. This ID is a decimal number that you can use to refer to the breakpoint in later commands.
The breakpoint status. The status can be e (enabled) or d (disabled).
(Unresolved breakpoints only) The letter "u" appears if the breakpoint is unresolved. That is, the breakpoint does not match a symbolic reference in any currently loaded
module. For information about these breakpoints, see Unresolved Breakpoints (bu Breakpoints).
The virtual address or symbolic expression that makes up the breakpoint location. If you enabled source line number loading, the bl command displays file and line
number information instead of address offsets. If the breakpoint is unresolved, the address is omitted here and appears at the end of the listing instead.
(Data breakpoints only) Type and size information are displayed for data breakpoints. The types can be e (execute), r (read/write), w (write), or i (input/output). These
types are followed with the size of the block, in bytes. For information about these breakpoints, see Processor Breakpoints (ba Breakpoints).
The number of passes that remain until the breakpoint is activated, followed by the initial number of passes in parentheses. For more information about this kind of
breakpoint, see the description of the Passes parameter in bp, bu, bm (Set Breakpoint).
The associated process and thread. If thread is given as three asterisks ("***"), this breakpoint is not a thread-specific breakpoint.
The module and function, with offset, that correspond to the breakpoint address. If the breakpoint is unresolved, the breakpoint address appears here instead, in
parentheses. If the breakpoint is set on a valid address but symbol information is missing, this field is blank.
The command that is automatically executed when this breakpoint is hit. This command is displayed in quotation marks.
If you are not sure what command was used to set an existing breakpoint, use .bpcmds (Display Breakpoint Commands) to list all breakpoints along with the commands
that were used to create them.
Example
The following example shows the output of a bl command.
0:000> bl
0 e 010049e0
0001 (0001)
0:**** stst!main
The breakpoint ID is 0.
The breakpoint status is e (enabled).
The breakpoint is not unresolved (there is no u in the output).
The virtual address of the breakpoint is 010049e0.
The breakpoint is active on the first pass through the code and the code has not yet been executed under the debugger. This information is indicated by a value of 1
(0001) in the "passes remaining" counter and a value of 1 ((0001)) in the initial passes counter.
This breakpoint is not a thread-specific breakpoint (****).
The breakpoint is set on main in the stst module.
Additional Information
For more information about and examples of how to use breakpoints, other breakpoint commands and methods of controlling breakpoints, and how to set breakpoints in user
space from a kernel debugger, see Using Breakpoints. For more information about conditional breakpoints, see Setting a Conditional Breakpoint.
2009 Microsoft Corporation
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
This parameter creates a counter that is decremented on each pass through the code. To see the initial and current values of the Passes counter, use bl (Breakpoint List).
The Passes counter is decremented only when the application executes past the breakpoint in response to a g (Go) command. The counter is not decremented if you are
stepping through the code or tracing past it. When the Passes counter reaches 1, you can reset it only by clearing and resetting the breakpoint.
CommandString
Specifies a list of commands that are executed every time that the breakpoint is encountered the specified number of times. You must enclose the CommandString
parameter in quotation marks. Use semicolons to separate multiple commands.
Debugger commands in CommandString can include parameters. You can use standard C-control characters (such as \n and \"). Semicolons that are contained in secondlevel quotation marks (\") are interpreted as part of the embedded quoted string.
The CommandString commands are executed only if the breakpoint is reached while the application is executing in response to a g (Go) command. The commands are
not executed if you are stepping through the code or tracing past this point.
Any command that resumes program execution after a breakpoint (such as g or t) ends the execution of the command list.
SymbolPattern
Specifies a pattern. The debugger tries to match this pattern to existing symbols and to set breakpoints on all pattern matches. SymbolPattern can contain a variety of
wildcard characters and specifiers. For more information about this syntax, see String Wildcard Syntax. Because these characters are being matched to symbols, the
match is not case sensitive, and a single leading underscore (_) represents any quantity of leading underscores.
Environment
Modes
User mode, kernel mode
Targets Live debugging only
Platforms All
Comments
The bp, bu, and bm commands set new breakpoints, but they have different characteristics:
The bp (Set Breakpoint) command sets a new breakpoint at the address of the breakpoint location that is specified in the command. If the debugger cannot resolve the
address expression of the breakpoint location when the breakpoint is set, the bp breakpoint is automatically converted to a bu breakpoint. Use a bp command to create a
breakpoint that is no longer active if the module is unloaded.
The bu (Set Unresolved Breakpoint) command sets a deferred or unresolved breakpoint. A bu breakpoint is set on a symbolic reference to the breakpoint location that
is specified in the command (not on an address) and is activated whenever the module with the reference is resolved. For more information about these breakpoints, see
Unresolved Breakpoints (bu Breakpoints).
The bm (Set Symbol Breakpoint) command sets a new breakpoint on symbols that match a specified pattern. This command can create more than one breakpoint. By
default, after the pattern is matched, bm breakpoints are the same as bu breakpoints. That is, bm breakpoints are deferred breakpoints that are set on a symbolic
reference. However, a bm /d command creates one or more bp breakpoints. Each breakpoint is set on the address of a matched location and does not track module state.
If you are not sure what command was used to set an existing breakpoint, use .bpcmds (Display Breakpoint Commands) to list all breakpoints along with the commands
that were used to create them.
There are three primary differences between bp breakpoints and bu breakpoints:
A bp breakpoint location is always converted to an address. If a module change moves the code at which a bp breakpoint was set, the breakpoint remains at the same
address. On the other hand, a bu breakpoint remains associated with the symbolic value (typically a symbol plus an offset) that was used, and it tracks this symbolic
location even if its address changes.
If a bp breakpoint address is found in a loaded module, and if that module is later unloaded, the breakpoint is removed from the breakpoint list. On the other hand, bu
breakpoints persist after repeated unloads and loads.
Breakpoints that you set with bp are not saved in WinDbg workspaces. Breakpoints that are set with bu are saved in workspaces.
The bm command is useful when you want to use wildcard characters in the symbol pattern for a breakpoint. The bm SymbolPattern syntax is equivalent to using
x SymbolPattern and then using bu on each result. For example, to set breakpoints on all of the symbols in the Myprogram module that begin with the string "mem," use the
following command.
0:000> bm myprogram!mem*
4: 0040d070 MyProgram!memcpy
5: 0040c560 MyProgram!memmove
6: 00408960 MyProgram!memset
Because the bm command sets software breakpoints (not processor breakpoints), it automatically excludes data location when it sets breakpoints to avoid corrupting the data.
It is possible to specify a data address rather than a program address when using the bp or bm /a commands. However, even if a data location is specified, these commands
create software breakpoints, not processor breakpoints. If a software breakpoint is placed in program data instead of executable code, it can lead to data corruption. Therefore
you should use these commands in a data location only if you are certain that the memory stored in that location will be used as executable code and not as program data.
Otherwise, you should use the ba (Break on Access) command instead. For more details, see Processor Breakpoints (ba Breakpoints).
For details on how to set a breakpoint on a location specified by a more complicated syntax, such as a member of a C++ public class, or an arbitrary text string containing
otherwise restricted characters, see Breakpoint Syntax.
If a single logical source line spans multiple physical lines, the breakpoint is set on the last physical line of the statement or call. If the debugger cannot set a breakpoint at the
requested position, it puts the breakpoint in the next allowed position.
If you specify Thread, breakpoints are set on the specified threads. For example, the ~*bp command sets breakpoints on all threads, ~#bp sets a breakpoint on the thread that
causes the current exception, and ~123bp sets a breakpoint on thread 123. The ~bp and ~.bp commands both set a breakpoint on the current thread.
When you are debugging a multiprocessor system in kernel mode, breakpoints that you set by using bp or ba (Break on Access) apply to all processors. For example, if the
current processor is 3 and you type bp MemoryAddress to put a breakpoint at MemoryAddress. Any processor that is executing at that address (not only processor 3) causes
a breakpoint trap.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The bp, bu, and bm commands set software breakpoints by replacing the processor instruction with a break instruction. To debug read-only code or code that cannot be
changed, use a ba e command, where e represents execute-only access.
Examples
The following command sets a breakpoint 12 bytes past the beginning of the function MyTest. This breakpoint is ignored for the first six passes through the code, but
execution stops on the seventh pass through the code.
0:000> bp MyTest+0xb 7
The following command sets a breakpoint at RtlRaiseException, displays the eax register, displays the value of the symbol MyVar, and continues.
kd> bp ntdll!RtlRaiseException "r eax; dt MyVar; g"
The following two bm commands set three breakpoints. When the commands are executed, the displayed result does not distinguish between breakpoints created with the /d
switch and those created without it. The .bpcmds (Display Breakpoint Commands) can be used to distinguish between these two types. If the breakpoint was created by bm
without the /d switch, the .bpcmds display indicates the breakpoint type as bu, followed by the evaluated symbol enclosed in the @!"" token (which indicates it is a literal
symbol and not a numeric expression or register). If the breakpoint was created by bm with the /d switch, the .bpcmds display indicates the breakpoint type as bp.
0:000> bm myprog!openf*
0: 00421200 @!"myprog!openFile"
1: 00427800 @!"myprog!openFilter"
0:000> bm /d myprog!closef*
2: 00421600 @!"myprog!closeFile"
0:000> .bpcmds
bu0 @!"myprog!openFile";
bu1 @!"myprog!openFilter";
bp2 0x00421600 ;
Additional Information
For more information about and examples of how to use breakpoints, other breakpoint commands and methods of controlling breakpoints, and how to set breakpoints in user
space from a kernel debugger, see Using Breakpoints. For more information about conditional breakpoints, see Setting a Conditional Breakpoint.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
br (Breakpoint Renumber)
The br command renumbers one or more breakpoints.
Syntax
br OldID NewID [OldID2 NewID2 ...]
Parameters
OldID
Specifies the current ID number of the breakpoint.
NewID
Specifies a new number that becomes the ID of the breakpoint.
Environment
Modes
User mode, kernel mode
Targets Live debugging only
Platforms All
Comments
You can use the br command to renumber any number of breakpoints at the same time. For each breakpoint, list the old ID and the new ID, in that order, as parameters to br.
If there is already a breakpoint with an ID equal to NewID, the command fails and an error message is displayed.
Additional Information
For more information about and examples of how to use breakpoints, other breakpoint commands and methods of controlling breakpoints, and how to set breakpoints in user
space from a kernel debugger, see Using Breakpoints. For more information about conditional breakpoints, see Setting a Conditional Breakpoint.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
c (Compare Memory)
The c command compares the values held in two memory areas.
Syntax
c Range Address
Parameters
Range
The first of the two memory ranges to be compared. For more syntax details, see Address and Address Range Syntax.
Address
The starting address of the second memory range to be compared. The size of this range will be the same as that specified for the first range. For more syntax details, see
Address and Address Range Syntax.
Environment
Modes
user mode, kernel mode
Targets live, crash dump
Platforms all
Comments
If the two areas are not identical, the debugger will display all memory addresses in the first range where they do not agree.
As an example, consider the following code:
void main()
{
char rgBuf1[100];
char rgBuf2[100];
memset(rgBuf1, 0xCC, sizeof(rgBuf1));
memset(rgBuf2, 0xCC, sizeof(rgBuf2));
rgBuf1[42] = 0xFF;
}
To compare rgBuf1 and rgBuf2, use either of the following commands:
0:000> c rgBuf1 (rgBuf1+0n100) rgBuf2
0:000> c rgBuf1 L 0n100 rgBuf2
Additional Information
For an overview of memory manipulation and a description of other memory-related commands, see Reading and Writing Memory.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
d, da, db, dc, dd, dD, df, dp, dq, du, dw, dW, dyb, dyd (Display Memory)
The d* commands display the contents of memory in the given range.
Syntax
d{a|b|c|d|D|f|p|q|u|w|W} [Options] [Range]
dy{b|d} [Options] [Range]
d [Options] [Range]
Parameters
Options
Specifies one or more display options. Any of the following options can be included, except that no more than one /p* option can be indicated:
/c Width
Specifies the number of columns to use in the display. If this is omitted, the default number of columns depends on the display type.
/p
(Kernel-mode only) Uses physical memory addresses for the display. The range specified by Range will be taken from physical memory rather than virtual memory.
/p[c]
(Kernel-mode only) Same as /p, except that cached memory will be read. The brackets around c must be included.
/p[uc]
(Kernel-mode only) Same as /p, except that uncached memory will be read. The brackets around uc must be included.
/p[wc]
(Kernel-mode only) Same as /p, except that write-combined memory will be read. The brackets around wc must be included.
Range
Specifies the memory area to display. For more syntax details, see Address and Address Range Syntax. If you omit Range, the command will display memory starting at
the ending location of the last display command. If Range is omitted and no previous display command has been used, the display begins at the current instruction
pointer.
Environment
Modes
user mode, kernel mode
Targets live, crash dump
Platforms all
Comments
Each line displayed will include the address of the first byte in the line followed by the contents of memory at that and following locations.
If you omit Range, the command will display memory starting at the ending location of the last display command. This allows you to continuously scan through memory.
This command exists in the following forms. The second characters of the dd, dD, dw, and dW commands are case-sensitive, as are the third characters of the dyb and dyd
commands.
Command
Display
d
This displays data in the same format as the most recent d* command. If no previous d* command has been issued, d has the same effect as db.
Notice that d repeats the most recent command that began with d. This includes dda, ddp, ddu, dpa, dpp, dpu, dqa, dqp, dqu, dds, dps, dqs, ds, dS, dg, dl, dt,
and dv, as well as the display commands on this page. If the parameters given after d are not appropriate, errors may result.
da
ASCII characters.
Each line displays up to 48 characters. The display continues until the first null byte or until all characters in range have been displayed. All nonprintable
characters, such as carriage returns and line feeds, are displayed as periods (.).
db
dc
dd
dD
df
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
dp
Pointer-sized values. This command is equivalent to dd or dq, depending on whether the target computer's processor architecture is 32-bit or 64-bit, respectively.
The default count is 32 DWORDs or 16 quad-words (128 bytes).
dq
du
Unicode characters.
Each line displays up to 48 characters. The display continues until the first null byte or until all characters in range have been displayed. All nonprintable
characters, such as carriage returns and line feeds, are displayed as periods (.).
dw
dW
dyb
dyd
If you attempt to display an invalid address, its contents are shown as question marks (?).
Additional Information
For an overview of memory manipulation and a description of other memory-related commands, see Reading and Writing Memory.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
dda, ddp, ddu, dpa, dpp, dpu, dqa, dqp, dqu (Display Referenced Memory)
The dda, ddp, ddu, dpa, dpp, dpu, dqa, dqp, and dqu commands display the pointer at the specified location, dereference that pointer, and then display the memory at the
resulting location in a variety of formats.
Syntax
ddp
dqp
dpp
dda
dqa
dpa
ddu
dqu
dpu
[Options]
[Options]
[Options]
[Options]
[Options]
[Options]
[Options]
[Options]
[Options]
[Range]
[Range]
[Range]
[Range]
[Range]
[Range]
[Range]
[Range]
[Range]
Parameters
Options
Specifies one or more display options. Any of the following options can be included, except that no more than one /p* option can be indicated:
/c Width
Specifies the number of columns to use in the display. If this is omitted, the default number of columns depends on the display type. Because of the way pointers are
displayed by these commands, it is usually best to use the default of only one data column.
/p
(Kernel-mode only) Uses physical memory addresses for the display. The range specified by Range will be taken from physical memory rather than virtual memory.
/p[c]
(Kernel-mode only) Same as /p, except that cached memory will be read. The brackets around c must be included.
/p[uc]
(Kernel-mode only) Same as /p, except that uncached memory will be read. The brackets around uc must be included.
/p[wc]
(Kernel-mode only) Same as /p, except that write-combined memory will be read. The brackets around wc must be included.
Range
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Specifies the memory area to display. For more syntax details, see Address and Address Range Syntax. If you omit Range, the command will display memory starting at
the ending location of the last display command. If Range is omitted and no previous display command has been used, the display begins at the current instruction
pointer. If a simple address is given, the default range length is 128 bytes.
Environment
Modes
user mode, kernel mode
Targets live, crash dump
Platforms all
Comments
The second and third characters of this command are case-sensitive.
The second character of this command determines the pointer size used:
Command
Display
dd*
32-bit pointers used
dq*
64-bit pointers used
dp*
Standard pointer sizes used: 32-bit or 64-bit, depending on the target's processor architecture
The third character of this command determines how the dereferenced memory is displayed:
Command
Display
d*p
Displays the contents of the memory referenced by the pointer in DWORD or QWORD format, depending on the pointer size of the target's processor
architecture. If this value matches any known symbol, this symbol is displayed as well.
d*a
Displays the contents of the memory referenced by the pointer in ASCII character format.
d*u
Displays the contents of the memory referenced by the pointer in Unicode character format.
If line number information has been enabled, source file names and line numbers will be displayed when available.
Additional Information
For an overview of memory manipulation and a description of other memory-related commands, see Reading and Writing Memory.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Comments
The second character of dds is case-sensitive. The third character of all these commands is case-sensitive.
The dds command displays double-word (4 byte) values like the dd command. The dqs command displays quad-word (8 byte) values like the dq command. The dps
command displays pointer-sized values (4 byte or 8 byte, depending on the target computer's architecture) like the dp command.
Each of these words is treated as an address in the symbol table. The corresponding symbol information is displayed for each word.
If line number information has been enabled, source file names and line numbers will be displayed when available.
Additional Information
For an overview of memory manipulation and a description of other memory-related commands, see Reading and Writing Memory.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
dg (Display Selector)
The dg command shows the segment descriptor for the specified selector.
Syntax
dg FirstSelector [LastSelector]
Parameters
FirstSelector
Specifies the hexadecimal selector value of the first selector to be displayed.
LastSelector
Specifies the hexadecimal selector value of the last selector to be displayed. If this is omitted, only one selector will be displayed.
Environment
Modes
user mode, kernel mode
Targets live, crash dump
Platforms x86, Itanium
Comments
No more than 256 selectors can be displayed by this command.
Common selector values are:
Id
decimal hex
KGDT_NULL
0
0x00
KGDT_R0_CODE 8
0x08
KGDT_R0_DATA 16
0x10
KGDT_R3_CODE 24
0x18
KGDT_R3_DATA 32
0x20
KGDT_TSS
40
0x28
KGDT_R0_PCR
48
0x30
KGDT_R3_TEB
56
0x38
KGDT_VDM_TILE 64
0x40
KGDT_LDT
72
0x48
KGDT_DF_TSS
80
0x50
KGDT_NMI_TSS 88
0x58
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
dt (Display Type)
The dt command displays information about a local variable, global variable or data type. This can display information about simple data types, as well as structures and
unions.
Syntax
User-Mode Syntax
dt [-DisplayOpts] [-SearchOpts] [module!]Name [[-SearchOpts] Field] [Address] [-l List]
dt [-DisplayOpts] Address [-l List]
dt -h
Kernel-Mode Syntax
[Processor] dt [-DisplayOpts] [-SearchOpts] [module!]Name [[-SearchOpts] Field] [Address] [-l List]
dt [-DisplayOpts] Address [-l List]
dt -h
Parameters
Processor
Specifies the processor that is running the process containing the information needed. For more information, see Multiprocessor Syntax. Processors can only be specified
in kernel mode.
DisplayOpts
Specifies one or more of the options given in the following table. These options are preceded by a hyphen.
Option
Description
-a
Show each array element on a new line, with its index. A total of quantity elements will be displayed. There must be no space between the a and the quantity.
[quantity] If -a is not followed by a digit, all items in the array are shown. The -a[quantity] switch should appear immediately before each type name or field name that
you want displayed in this manner.
-b
Display blocks recursively. If a displayed structure contains substructures, it is expanded recursively to arbitrary depths and displayed in full. Pointers are
expanded only if they are in the original structure, not in substructures.
-c
Compact output. All fields are displayed on one line, if possible. (When used with the -a switch, each array element takes one line rather than being
formatted as a several-line block.)
-d
When used with a Name that is ended with an asterisk, display verbose output for all types that begin with Name. If Name does not end with an asterisk,
display verbose output.
-e
Forces dt to enumerate types. This option is only needed if dt is mistakenly interpreting the Name value as an instance rather than as a type.
-i
Do not indent the subtypes.
-o
Omit offset values of the structure fields.
-p
Address is a physical address, rather than a virtual address.
-r[depth] Recursively dumps the subtype fields. If depth is given, this recursion will stop after depth levels. The depth must be a digit between 1 and 9, and there must
be no space between the r and the depth. The -r[depth] switch should appear immediately before the address.
-s size
Enumerate only those types whose size in bytes equals the value of size. The -s option is only useful when types are being enumerated. When -s is specified, e is always implied as well.
-t
Enumerate types only.
-v
Verbose output. This gives additional information such as the total size of a structure and the number of its elements. When this is used along with the -y
search option, all symbols are displayed, even those with no associated type information.
SearchOpts
Specifies one or more of the options given in the following table. These options are preceded by a hyphen.
Option
Description
-n
This indicates that the next parameter is a name. This should be used if the next item consists entirely of hexadecimal characters, because it will otherwise be
taken as an address.
-y
This indicates that the next parameter is the beginning of the name, not necessarily the entire name. When -y is included, all matches are listed, followed by
detailed information on the first match in the list. If -y is not included, only exact matches will be displayed.
module
An optional parameter specifying the module that defines this structure. If there is a local variable or type with the same name as a global variable or type, you should
include module to specify that you mean the global variable. Otherwise, the dt command will display the local variable, even if the local variable is a case-insensitive
match and the global variable is a case-sensitive match.
Name
Specifies the name of a type or global variable. If Name ends with an asterisk (*), a list of all matches is displayed. Thus, dt A* will list all data types, globals, and statics
beginning with "A", but will not display the actual instances of these types. (If the -v display option is used at the same time, all symbols will be displayed not just
those with associated type information.) You can also replace Name with a period (.) to signify that you want to repeat the most recently used value of Name. If Name
contains a space, it should be enclosed in parentheses.
Field
Specifies the field(s) to be displayed. If Field is omitted, all fields are displayed. If Field is followed by a period (.), the first-level subfields of this field will be displayed
as well. If Field is followed with a series of periods, the subfields will be displayed to a depth equal to the number of periods. Any field name followed by a period will
be treated as a prefix match, as if the -y search option was used. If Field is followed by an asterisk (*), it is treated as only the beginning of the field, not necessarily the
entire field, and all matching fields are displayed.
Address
Specifies the address of the structure to be displayed. If Name is omitted, Address must be included and must specify the address of a global variable. Address is taken to
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
be a virtual address unless otherwise specified. Use the -p option to specify a physical address. Use an "at" sign ( @ ) to specify a register (for example, @eax).
List
Specifies the field name that links a linked list. The Address parameter must be included.
Environment
Modes
user mode, kernel mode
Targets live, crash dump
Platforms all
Comments
The dt command output will always display signed numbers in base 10, and unsigned numbers in hexadecimal.
All parameters of dt that allow symbol values also allow string wildcards. See String Wildcard Syntax for details.
The -y and -n options can precede any Name or Field. The -y option allows you to specify the beginning of the type or structure name. For example, dt -y ALLEN will
display data about the type ALLENTOWN. However, you could not display the type ALLENTOWN with dt -y A. Instead, you would have to use dt -ny A, because A is a
valid hexadecimal value and would be interpreted as an address without the -n option.
If Name indicates a structure, all fields will be displayed (for example, dt myStruct). If you only want one specific field, you can do dt myStruct myField. This displays the
member that C would call myStruct.myField. However, note that the command dt myStruct myField1 myField2 displays myStruct.myField1 and myStruct.myField2. It
does not display myStruct.myField1.myField2.
If a structure name or field is followed by a subscript, this specifies a single instance of an array. For example, dt myStruct myFieldArray[3] will display the fourth element
of the array in question. But if a type name is followed by a subscript, this specifies an entire array. For example, dt CHAR[8] myPtr will display an eight-character string.
The subscript is always taken as decimal regardless of the current radix; an 0x prefix will cause an error.
Because the command uses type information from the .pdb file, it can freely be used to debug any CPU platform.
The type information used by dt includes all type names created with typedef, including all the Windows-defined types. For example, unsigned long and char are not valid
type names, but ULONG and CHAR are. See the Microsoft Windows SDK for a full list of all Windows type names.
All types created by typedefs within your own code will be present, as long as they have actually been used in your program. However, types that are defined in your headers
but never actually used will not be stored in the .pdb symbol files and will not be accessible to the debugger. To make such a type available to the debugger, use it as the input
of a typedef statement. For example, if the following appears in your code, the structure MY_DATA will be stored in the .pdb symbol file and can be displayed by the dt
command:
typedef struct _MY_DATA {
. . .
} MY_DATA;
typedef MY_DATA *PMY_DATA;
On the other hand, the following code would not suffice because both MY_DATA and PMY_DATA are defined by the initial typedef and, therefore, MY_DATA has not
itself been used as the input of any typedef statement:
typedef struct _MY_DATA {
. . .
} MY_DATA, *PMY_DATA;
In any event, type information is included only in a full symbol file, not a symbol file that has been stripped of all private symbol information. For more information, see
Public and Private Symbols.
If you want to display unicode strings, you need to use the .enable_unicode (Enable Unicode Display) command first. You can control the display of long integers with
the .enable_long_status (Enable Long Integer Display) command.
In the following example, dt displays a global variable:
0:000> dt
+0x000
+0x004
+0x006
+0x008
+0x00c
+0x024
mt1
a
b
c
d
gn
ex
:
:
:
:
:
:
10
98 'b'
0xdd
0xabcd
[6] 0x1
0x0
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
0
0 ''
0x0
0x0
[6] 0x0
0x0
You could repeat this to any depth. For example, the command dt mcl1 a..c. would display all fields to depth four, such that the first field name began with a and the third
field name began with c.
Here is a more detailed example of how subfields can be displayed. First, display the Ldr field:
0:000> dt nt!_PEB Ldr 7ffdf000
+0x00c Ldr : 0x00191ea0
Now expand the pointer type field:
0:000> dt nt!_PEB Ldr Ldr. 7ffdf000
+0x00c Ldr : 0x00191ea0
+0x000 Length : 0x28
+0x004 Initialized : 0x1 ''
+0x008 SsHandle : (null)
+0x00c InLoadOrderModuleList : _LIST_ENTRY [ 0x191ee0 - 0x192848 ]
+0x014 InMemoryOrderModuleList : _LIST_ENTRY [ 0x191ee8 - 0x192850 ]
+0x01c InInitializationOrderModuleList : _LIST_ENTRY [ 0x191f58 - 0x192858 ]
+0x024 EntryInProgress : (null)
Now display the CriticalSectionTimeout field:
0:000> dt nt!_PEB CriticalSectionTimeout 7ffdf000
+0x070 CriticalSectionTimeout : _LARGE_INTEGER 0xffffe86d`079b8000
Now expand the CriticalSectionTimeout structure subfields one level deep:
0:000> dt nt!_PEB CriticalSectionTimeout. 7ffdf000
+0x070 CriticalSectionTimeout : 0xffffe86d`079b8000
+0x000 LowPart
: 0x79b8000
+0x004 HighPart
: -6035
+0x000 u
: __unnamed
+0x000 QuadPart
: -25920000000000
Now expand the CriticalSectionTimeout structure subfields two levels deep:
0:000> dt nt!_PEB CriticalSectionTimeout.. 7ffdf000
+0x070 CriticalSectionTimeout
: 0xffffe86d`079b8000
+0x000 LowPart
: 0x79b8000
+0x004 HighPart
: -6035
+0x000 u
:
+0x000 LowPart
: 0x79b8000
+0x004 HighPart
: -6035
+0x000 QuadPart
: -25920000000000
The following command displays an instance of the data type MYTYPE1 that is located at the address 0x0100297C:
0:000> dt
+0x000
+0x004
+0x006
+0x008
+0x00c
+0x024
0x0100297c MYTYPE1
a
: 22
b
: 43 '+'
c
: 0x0
d
: 0x0
gn
: [6] 0x0
ex
: 0x0
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
[9] 0x0
The following command continues the previous display at a different address. Note that "ULONG" does not need to be re-entered:
0:000> dt -ca4 . 01002d00
Using sym ULONG
[0] 0x12
[1] 0x4ac
[2] 0xbadfeed
[3] 0x2
Here are some examples of type display. The following command displays all types and globals beginning with the string "MY" in the module thismodule. Those prefixed
with an address are actual instances; those without addresses are type definitions:
0:000> dt thismodule!MY*
010029b8 thismodule!myglobal1
01002990 thismodule!myglobal2
thismodule!MYCLASS1
thismodule!MYCLASS2
thismodule!MYCLASS3
thismodule!MYTYPE3::u
thismodule!MYTYPE1
thismodule!MYTYPE3
thismodule!MYTYPE3
thismodule!MYFLAGS
When performing type display, the -v option can be used to display the size of each item. The -s size option can be used to only enumerate items of a specific size. Again,
those prefixed with an address are actual instances; those without addresses are type definitions:
0:001> dt -s 2 -v thismodule!*
Enumerating symbols matching thismodule!*, Size = 0x2
Address
Size Symbol
002 thismodule!wchar_t
002 thismodule!WORD
002 thismodule!USHORT
002 thismodule!SHORT
002 thismodule!u_short
002 thismodule!WCHAR
00427a34
002 thismodule!numberOfShips
00427a32
002 thismodule!numberOfPlanes
00427a30
002 thismodule!totalNumberOfItems
Here is an example of the -b option. The structure is expanded and the OwnerThreads array within the structure is expanded, but the Flink and Blink list pointers are not
followed:
kd> dt nt!_ERESOURCE -b 0x8154f040
+0x000 SystemResourcesList : [ 0x815bb388 - 0x816cd478 ]
+0x000 Flink
: 0x815bb388
+0x004 Blink
: 0x816cd478
+0x008 OwnerTable
: (null)
+0x00c ActiveCount
: 1
+0x00e Flag
: 8
+0x010 SharedWaiters
: (null)
+0x014 ExclusiveWaiters : (null)
+0x018 OwnerThreads
:
[00]
+0x000 OwnerThread
: 0
+0x004 OwnerCount
: 0
+0x004 TableSize
: 0
[01]
+0x000 OwnerThread
: 0x8167f563
+0x004 OwnerCount
: 1
+0x004 TableSize
: 1
+0x028 ContentionCount : 0
+0x02c NumberOfSharedWaiters : 0
+0x02e NumberOfExclusiveWaiters : 0
+0x030 Address
: (null)
+0x030 CreatorBackTraceIndex : 0
+0x034 SpinLock
: 0
Here is an example of dt in kernel mode. The following command produces results similar to !process 0 0:
kd> dt nt!_EPROCESS -l ActiveProcessLinks.Flink -y Ima -yoi Uni 814856f0
ActiveProcessLinks.Flink at 0x814856f0
--------------------------------------------UniqueProcessId : 0x00000008
ImageFileName : [16] "System"
ActiveProcessLinks.Flink at 0x8138a030
--------------------------------------------UniqueProcessId : 0x00000084
ImageFileName : [16] "smss.exe"
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
ActiveProcessLinks.Flink at 0x81372368
--------------------------------------------UniqueProcessId : 0x000000a0
ImageFileName : [16] "csrss.exe"
ActiveProcessLinks.Flink at 0x81369930
--------------------------------------------UniqueProcessId : 0x000000b4
ImageFileName : [16] "winlogon.exe"
....
If you want to execute a command for each element of the list, use the !list extension.
Finally, the dt -h command will display a short help text summarizing the dt syntax.
Additional Information
For an overview of memory manipulation and a description of other memory-related commands, see Reading and Writing Memory.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
/Z
Sorts the output by size, in descending order.
Pattern
Causes the command to only display local variables that match the specified Pattern. The pattern may contain a variety of wildcards and specifiers; see String Wildcard
Syntax for details. If Pattern contains spaces, it must be enclosed in quotation marks. If Pattern is omitted, all local variables will be displayed.
Environment
Modes
user mode, kernel mode
Targets live, crash dump
Platforms all
Comments
In verbose mode, the addresses of the variables are displayed as well. (This can also be done with the x (Examine Symbols) command.)
Data structures and unfamiliar data types are not displayed in full; rather, their type name is displayed. To display the entire structure, or display a particular member of the
structure, use the dt (Display Type) command.
The local context determines which set of local variables will be displayed. By default, this context matches the current position of the program counter. For information about
how this can be changed, see Local Context.
Additional Information
For details on displaying and changing local variables and a description of other memory-related commands, see Reading and Writing Memory.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
e, ea, eb, ed, eD, ef, ep, eq, eu, ew, eza, ezu (Enter Values)
The e* commands enter into memory the values that you specify.
This command should not be confused with the ~E (Thread-Specific Command) qualifier.
Syntax eD ef
e{b|d|D|f|p|q|w} Address [Values]
e{a|u|za|zu} Address "String"
e Address [Values]
Parameters
Address
Specifies the starting address where to enter values. The debugger replaces the value at Address and each subsequent memory location until all Values have been used.
Values
Specifies one or more values to enter into memory. Multiple numeric values should be separated with spaces. If you do not specify any values, the current address and the
value at that address will be displayed, and you will be prompted for input.
String
Specifies a string to be entered into memory. The ea and eza commands will write this to memory as an ASCII string; the eu and ezu commands will write this to
memory as a Unicode string. The eza and ezu commands write a terminal NULL; the ea and eu commands do not. String must be enclosed in quotation marks.
Environment
Modes
user mode, kernel mode
Targets live, crash dump
Platforms all
Comments
This command exists in the following forms. The second characters of the ed and eD commands are case-sensitive.
Command
Enter
e
This enters data in the same format as the most recent e* command. (If the most recent e* command was ea, eza, eu, or ezu, the final parameter will be String
and may not be omitted.)
ea
ASCII string (not NULL-terminated).
eb
Byte values.
ed
Double-word values (4 bytes).
eD
Double-precision floating-point numbers (8 bytes).
ef
Single-precision floating-point numbers (4 bytes).
ep
Pointer-sized values. This command is equivalent to ed or eq, depending on whether the target computer's processor architecture is 32-bit or 64-bit, respectively.
eq
Quad-word values (8 bytes).
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
eu
ew
eza
ezu
Numeric values will be interpreted as numbers in the current radix (16, 10, or 8). To change the default radix, use the n (Set Number Base) command. The default radix can
be overridden by specifying the 0x prefix (hexadecimal), the 0n prefix (decimal), the 0t prefix (octal), or the 0y prefix (binary).
Note The default radix behaves differently when C++ expressions are being used. See Evaluating Expressions for details.
When entering byte values with the eb command, you can use single straight quotation marks to specify characters. If you want to include multiple characters, each must be
surrounded with its own quotation marks. This allows you to enter a character string that is not terminated by a null character. For example:
eb 'h' 'e' 'l' 'l' 'o'
C-style escape characters (such as '\0' or '\n') may not be used with these commands.
If you omit the Values parameter, you will be prompted for input. The address and its current contents will be displayed, and an Input> prompt will appear. You can then do
any of the following:
Additional Information
For an overview of memory manipulation and a description of other memory-related commands, see Reading and Writing Memory.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
f, fp (Fill Memory)
The f and fp commands fill the specified memory range with a repeating pattern.
These commands should not be confused with the ~F (Freeze Thread) command.
Syntax
f Range Pattern
fp [MemoryType] PhysicalRange Pattern
Parameters
Range
Specifies the range in virtual memory to fill. For more syntax details, see Address and Address Range Syntax.
PhysicalRange
(Kernel mode only) Specifies the range in physical memory to fill. The syntax of PhysicalRange is the same as that of a virtual memory range, except that no symbol
names are permitted.
MemoryType
(Kernel mode only) Specifies the type of physical memory, which can be one of the following:
[c]
Cached memory.
[uc]
Uncached memory.
[wc]
Write-combined memory.
Pattern
Specifies one or more byte values with which to fill memory.
Environment
Modes
Comments
This command fills the memory area specified by range with the specified pattern, repeated as many times as necessary.
The pattern parameter must be input as a series of bytes. These can be entered as numeric or as ASCII characters.
Numeric values will be interpreted as numbers in the current radix (16, 10, or 8). To change the default radix, use the n (Set Number Base) command. The default radix can
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
be overridden by specifying the 0x prefix (hexadecimal), the 0n prefix (decimal), the 0t prefix (octal), or the 0y prefix (binary).
Note The default radix behaves differently when C++ expressions are being used. For more information, see the Evaluating Expressions topic.
If ASCII characters are used, each character must be enclosed in single straight quotation marks. C-style escape characters (such as '\0' or '\n') may not be used.
If multiple bytes are specified, they must be separated by spaces.
If pattern has more values than the number of bytes in the range, the debugger ignores the extra values.
Here are some examples. Assuming the current radix is 16, the following command will fill memory locations 0012FF40 through 0012FF5F with the pattern "ABC", repeated
several times:
0:000> f 0012ff40 L20 'A' 'B' 'C'
The following command has the exact same effect:
0:000> f 0012ff40 L20 41 42 43
The following examples show how you can use the physical memory types (c, uc, and wc) with the fp command in kernel mode:
kd> fp [c] 0012ff40 L20 'A' 'B' 'C'
kd> fp [uc] 0012ff40 L20 'A' 'B' 'C'
kd> fp [wc] 0012ff40 L20 'A' 'B' 'C'
Additional Information
For an overview of memory manipulation and a description of other memory-related commands, see Reading and Writing Memory.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
g (Go)
The g command starts executing the given process or thread. Execution will halt at the end of the program, when BreakAddress is hit, or when another event causes the
debugger to stop.
Syntax
User-Mode Syntax
[~Thread] g[a] [= StartAddress] [BreakAddress ... [; BreakCommands]]
Kernel-Mode Syntax
g[a] [= StartAddress] [BreakAddress ... [; BreakCommands]]
Parameters
Thread
(User mode only) Specifies the thread to execute. For syntax details, see Thread Syntax.
a
Causes any breakpoint created by this command to be a processor breakpoint (like those created by ba) rather than a software breakpoint (like those created by bp and
bm). If BreakAddress is not specified, no breakpoint is created and the a flag has no effect.
StartAddress
Specifies the address where execution should begin. If this is not specified, the debugger passes execution to the address specified by the current value of the instruction
pointer. For more syntax details, see Address and Address Range Syntax.
BreakAddress
Specifies the address for a breakpoint. If BreakAddress is specified, it must specify an instruction address (that is, the address must contain the first byte of an
instruction). Up to ten break addresses, in any order, can be specified at one time. If BreakAddress cannot be resolved, it is stored as an unresolved breakpoint. For more
syntax details, see Address and Address Range Syntax.
BreakCommands
Specifies one or more commands to be automatically executed when the breakpoint specified by BreakAddress is hit. The BreakCommands parameter must be preceded
by a semicolon. If multiple BreakAddress values are specified, BreakCommands applies to all of them.
Note The BreakCommands parameter is only available when you are embedding this command within a command string used by another command for example,
within another breakpoint command or within an except or event setting. On a command line, the semicolon will terminate the g command, and any additional commands
listed after the semicolon will be executed immediately after the g command is done.
Environment
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Modes
user mode, kernel mode
Targets live debugging only
Platforms all
Comments
If Thread is specified, then the g command is executed with the specified thread unfrozen and all others frozen. For example, if the ~123g, ~#g, or ~*g command is specified,
the specified threads are unfrozen and all others are frozen.
Additional Information
For other methods of issuing this command and an overview of related commands, see Controlling the Target.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Parameters
Thread
(User mode only) Specifies the thread to execute. This thread must have been stopped by an exception. For syntax details, see Thread Syntax.
a
Causes any breakpoint created by this command to be a processor breakpoint (like those created by ba) rather than a software breakpoint (like those created by bp and
bm). If BreakAddress is not specified, no breakpoint is created and the a flag has no effect.
StartAddress
Specifies the address at which execution should begin. If this is not specified, the debugger passes execution to the address where the exception occurred. For more
syntax details, see Address and Address Range Syntax.
BreakAddress
Specifies the address for a breakpoint. If BreakAddress is specified, it must specify an instruction address (that is, the address must contain the first byte of an
instruction). Up to ten break addresses, in any order, can be specified at one time. If BreakAddress cannot be resolved, it is stored as an unresolved breakpoint. For more
syntax details, see Address and Address Range Syntax.
BreakCommands
Specifies one or more commands to be automatically executed when the breakpoint specified by BreakAddress is hit. The BreakCommands parameter must be preceded
by a semicolon. If multiple BreakAddress values are specified, BreakCommands applies to all of them.
Note The BreakCommands parameter is only available when you are embedding this command within a command string used by another command for example,
within another breakpoint command or within an except or event setting. On a command line, the semicolon will terminate the gh command, and any additional
commands listed after the semicolon will be executed immediately after the gh command is done.
Environment
Modes
user mode, kernel mode
Targets live debugging only
Platforms all
Comments
If you use the BreakAddress parameter to set a breakpoint, this new breakpoint will only be triggered by the current thread. Other threads that execute the code at that location
will not be stopped.
If Thread is specified, then the gh command is executed with the specified thread unfrozen and all others frozen. For example, if the ~123gh, ~#gh, or ~*gh command is
specified, the specified threads are unfrozen and all others are frozen.
Additional Information
For other methods of issuing this command and an overview of related commands, see Controlling the Target.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Parameters
Thread
(User mode only) Specifies the thread to execute. This thread must have been stopped by an exception. For syntax details, see Thread Syntax.
a
Causes any breakpoint created by this command to be a processor breakpoint (like those created by ba) rather than a software breakpoint (like those created by bp and
bm). If BreakAddress is not specified, no breakpoint is created and the a flag has no effect.
StartAddress
Specifies the address where execution should begin. If this is not specified, the debugger passes execution to the address where the exception occurred. For more syntax
details, see Address and Address Range Syntax.
BreakAddress
Specifies the address for a breakpoint. If BreakAddress is specified, it must specify an instruction address (that is, the address must contain the first byte of an
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
instruction). Up to ten break addresses, in any order, can be specified at one time. If BreakAddress cannot be resolved, it is stored as an unresolved breakpoint. For more
syntax details, see Address and Address Range Syntax.
BreakCommands
Specifies one or more commands to be automatically executed when the breakpoint specified by BreakAddress is hit. The BreakCommands parameter must be preceded
by a semicolon. If multiple BreakAddress values are specified, BreakCommands applies to all of them.
Note The BreakCommands parameter is only available when you are embedding this command within a command string used by another command for example,
within another breakpoint command or within an except or event setting. On a command line, the semicolon will terminate the command, and any additional commands
listed after the semicolon will be executed immediately after the gn or gN command is done.
Environment
Modes
user mode, kernel mode
Targets live debugging only
Platforms all
Comments
If the debugger is not stopped at a breakpoint, gn and gN behave identically. If the debugger is stopped at a breakpoint, gn will not work; you must capitalize the "N" to
execute this command. This is a safety precaution, since it is rarely wise to continue a breakpoint unhandled.
If you use the BreakAddress parameter to set a breakpoint, this new breakpoint will only be triggered by the current thread. Other threads that execute the code at that location
will not be stopped.
If Thread is specified, then the gn command is executed with the specified thread unfrozen and all others frozen. For example, if the ~123gn, ~#gn, or ~*gn command is
specified, the specified threads are unfrozen and all others are frozen.
Additional Information
For other methods of issuing this command and an overview of related commands, see Controlling the Target.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
gu (Go Up)
The gu command causes the target to execute until the current function is complete.
Syntax
User-Mode Syntax
[~Thread] gu
Kernel-Mode Syntax
gu
Parameters
Thread
(User mode only) Specifies the thread to execute. This thread must have been stopped by an exception. For syntax details, see Thread Syntax.
Environment
Modes
user mode, kernel mode
Targets live debugging only
Platforms all
Comments
The gu command executes the target until the current function call returns.
If the current function is called recursively, the gu command will not halt execution until the current instance of the current function returns. In this way, gu differs from
g @$ra, which will halt any time the return address of this function is hit.
Note The gu command distinguishes different instances of a function by measuring the call stack depth. Executing this command in assembly mode after the arguments have
been pushed to the stack and just before the call is made may cause this measurement to be incorrect. Function returns that are optimized away by the compiler may similarly
cause this command to stop at the wrong instance of this return. These errors are rare, and can only happen during recursive function calls.
If Thread is specified, then the gu command is executed with the specified thread unfrozen and all others frozen. For example, if the ~123gu, ~#gu, or ~*gu command is
specified, the specified threads are unfrozen and all others are frozen.
Additional Information
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
For other methods of issuing this command and an overview of related commands, see Controlling the Target.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
j (Execute If - Else)
The j command conditionally executes one of the specified commands, depending on the evaluation of a given expression.
Syntax
j Expression Command1 ; Command2
j Expression 'Command1' ; 'Command2'
Parameters
Expression
The expression to evaluate. If this expression evaluates to a nonzero value, Command1 is executed. If this expression evaluates to zero, Command2 is executed. For more
information about the syntax of this expression, see Numerical Expression Syntax.
Command1
The command string to be executed if the expression in Expression evaluates to a nonzero value (TRUE). You can combine multiple commands by surrounding the
command string with single straight quotation marks ( ' ) and separating commands by using semicolons. If the command string is a single command, the single quotation
marks are optional.
Command2
The command string to be executed if the expression in Expression evaluates to zero (FALSE). You can combine multiple commands by surrounding the command string
with single straight quotation marks ( ' ) and separating commands by using semicolons. If the command string is a single command, the single quotation marks are
optional.
Environment
Modes
User mode, kernel mode
Targets Live, crash dump
Platforms All
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Comments
You cannot add a semicolon or additional commands after the j command. If a semicolon appears after Command2, everything after the semicolon is ignored.
The following command displays the value of eax if MySymbol is equal to zero and displays the values of ebx and ecx otherwise.
0:000> j (MySymbol=0) 'r eax'; 'r ebx; r ecx'
You could omit the single quotation marks around r eax, but they make the command easier to read. If you want to omit one of the commands, you can include empty
quotation marks or omit the parameter for that command, as in the following commands.
0:000> j (MySymbol=0) ''; 'r ebx; r ecx'
0:000> j (MySymbol=0) ; 'r ebx; r ecx'
You can also use the j command inside other commands. For example, you can use a j command to create conditional breakpoints.
0:000> bp `mysource.cpp:143` "j (poi(MyVar)>0n20) ''; 'gc' "
For more information about the syntax for conditional breakpoints, see Setting a Conditional Breakpoint.
See Also
z (Execute While)
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Kernel-Mode
[Processor]
[Processor]
[Processor]
[Processor]
Parameters
Thread
Specifies the thread whose stack is to be displayed. If you omit this parameter, the stack of the current thread is displayed. For more information about thread syntax, see
Thread Syntax. You can specify threads only in user mode.
Processor
Specifies the processor whose stack is to be displayed. For more information about processor syntax, see Multiprocessor Syntax. You can specify processors only in
kernel mode.
b
Displays the first three parameters that are passed to each function in the stack trace.
c
Displays a clean stack trace. Each display line includes only the module name and the function name.
p
Displays all of the parameters for each function that is called in the stack trace. The parameter list includes each parameter's data type, name, and value. The p option is
case sensitive. This parameter requires full symbol information.
P
Displays all of the parameters for each function that is called in the stack trace, like the p parameter. However, for P, the function parameters are printed on a second line
of the display, instead of on the same line as the rest of the data.
v
Displays frame pointer omission (FPO) information. On x86-based processors, the display also includes calling convention information.
n
Displays frame numbers.
f
Displays the distance between adjacent frames. This distance is the number of bytes that separate the frames on the actual stack.
L
Hides source lines in the display. L is case sensitive.
FrameCount
Specifies the number of stack frames to display. You should specify this number in hexadecimal format, unless you have changed the radix by using the n (Set Number
Base) command. The default value is 20 (0x14), unless you have changed the default value by using the .kframes (Set Stack Length) command.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
BasePtr
Specifies the base pointer for the stack trace. The BasePtr parameter is available only if there is an equal sign (=) after the command. On an x86-based processor, you can
add one more parameter after BasePtr (which is interpreted as the FrameCount parameter) or two more parameters after BasePtr (which are interpreted as the StackPtr
and InstructionPtr parameters).
StackPtr
(x86-based processor only) Specifies the stack pointer for the stack trace. If you omit StackPtr and InstructionPtr, the command uses the stack pointer that the esp
register specifies and the instruction pointer that the eip register specifies.
InstructionPtr
(x86-based processor only) Specifies the instruction pointer for the stack trace. If you omit StackPtr and InstructionPtr, the command uses the stack pointer that the esp
register specifies and the instruction pointer that the eip register specifies.
WordCount
Specifies the number of DWORD_PTR values in the stack to dump. The default value is 20 (0x14), unless you changed the default value by using the .kframes (Set
Stack Length) command.
Environment
Modes
User mode, kernel mode
Targets Live, crash dump
Platforms All
Comments
When you issue the k, kb, kp, kP, or kv command, a stack trace is displayed in a tabular format. If line loading is enabled, source modules and line numbers are also
displayed.
The stack trace includes the base pointer for the stack frame, the return address, and function names.
If you use the kp or kP command, the full parameters for each function that is called in the stack trace are displayed. The parameter list includes each parameter's data type,
name, and value.
This command might be slow. For example, when MyFunction1 calls MyFunction2, the debugger must have full symbol information for MyFunction1 to display the
parameters that are passed in this call. This command does not fully display internal Microsoft Windows routines that are not exposed in public symbols.
If you use the kb or kv command, the first three parameters that are passed to each function are displayed. If you use the kv command, FPO data is also displayed.
On an x86-based processor, the kv command also displays calling convention information.
On an Itanium-based processor, the kv command also causes nonvolatile registers to be displayed. This information enables you to trace the register stack.
When you use the kv command, the FPO information is added at the end of the line in the following format.
FPO text
FPO: [non-Fpo]
FPO: [N1,N2,N3]
Meaning
No FPO data for the frame.
N1 is the total number of parameters.
N2 is the number of DWORD values for the local variables.
N3 is the number of registers that are saved.
The kd command displays the raw stack data. Each DWORD value is displayed on a separate line. Symbol information is displayed for those lines together with associated
symbols. This format creates a more detailed list than the other k* commands. The kd command is equivalent to a dds (Display Memory) command that uses the stack
address as its parameter.
If you want a stack trace that begins somewhere other than the current stack location, you can use the BasePtr parameter to specify the base pointer value. If you are
specifying the base pointer value on an x86-based processor, you should specify BasePtr, StackPtr, and InstructionPtr. These parameters should be the values of ebp, esp,
and eip that correspond to the stack trace that you want. If you specify BasePtr and omit StackPtr and InstructionPtr, you might receive incorrect results if there are FPO
frames present.
If you use the k command at the beginning of a function (before the function prolog has been executed), you receive incorrect results. The debugger uses the frame register to
compute the current backtrace, and this register is not set correctly for a function until its prolog has been executed.
In user mode, the stack trace is based on the stack of the current thread. For more information about threads, see Controlling Processes and Threads.
In kernel mode, the stack trace is based on the current register context. You can set the register context to match a specific thread, context record, or trap frame.
Additional Information
For more information about stack traces and other ways to display stack traces, see Viewing the Call Stack. For more information about the register context and other context
settings, see Changing Contexts.
2009 Microsoft Corporation
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
ld (Load Symbols)
The ld command loads symbols for the specified module and updates all module information.
Syntax
ld ModuleName [/f FileName]
Parameters
ModuleName
Specifies the name of the module whose symbols are to be loaded. ModuleName can contain a variety of wildcard characters and specifiers.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
/f FileName
Changes the name selected for the match. By default the module name is matched, but when /f is used the file name is matched instead of the module name. FileName
can contain a variety of wildcard characters and specifiers. For more information on the syntax of wildcard characters and specifiers, see String Wildcard Syntax.
Environment
Modes
User mode, kernel mode
Targets Live, crash dump
Platforms All
Comments
The debugger's default behavior is to use lazy symbol loading (also known as deferred symbol loading). This means that symbols are not actually loaded until they are needed.
The ld command, on the other hand, forces all symbols for the specified module to be loaded.
Additional Information
For more information about deferred (lazy) symbol loading, see Deferred Symbol Loading. For more information about other symbol options, see Setting Symbol Options.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Note In most cases, the module name is the file name without the file name extension. For example, if you want to display information about the Flpydisk.sys driver, use
the lm mflpydisk command, not lm mflpydisk.sys. In some cases, the module name differs significantly from the file name. For more information, see Executable Image
Path.
M Pattern
Specifies a pattern that the image path must match. Pattern can contain a variety of wildcard characters and specifiers. For more information about the syntax of this
information, see String Wildcard Syntax.
Environment
Modes
User mode, kernel mode
Targets Live, crash dump
Platforms All
Comments
The lm command lists all of the modules and the status of symbols for each module.
Microsoft Windows Server 2003 and later versions of Windows maintain an unloaded module list for user-mode processes. When you are debugging a user-mode process or
dump file, the lm command also shows these unloaded modules.
This command shows several columns or fields, each with a different title. Some of these titles have specific meanings:
module name is typically the file name without the file name extension. In some cases, the module name differs significantly from the file name. For more information,
see Executable Image Path.
The symbol type immediately follows the module name. This column is not labeled. For more information about the various status values, see Symbol Status
Abbreviations. If you have loaded symbols, the symbol file name follows this column.
The first address in the module is shown as start. The first address after the end of the module is shown as end. For example, if start is "faab4000" and end is
"faab8000", the module extends from 0xFAAB4000 to 0xFAAB7FFF, inclusive.
lmv only: The image path column shows the name of the executable file, including the file name extension. Typically, the full path is included in user mode but not in
kernel mode.
lmv only: The loaded symbol image file value is the same as the image name, unless Microsoft CodeView symbols are present.
lmv only: The mapped memory image file value is typically not used. If the debugger is mapping an image file (for example, during minidump debugging), this value
is the name of the mapped image.
The following code example shows the lm command with a Windows Server 2003 target computer. This example includes the m and s* options, so only modules that begin
with "s" are displayed.
kd> lm m
start
f9f73000
fa04b000
faab7000
facac000
fb008000
fb24f000
s*
end
f9f7fd80
fa09b400
faac8500
facbae00
fb00ba80
fb250000
module name
sysaudio
srv
sr
serial
serenum
swenum
Unloaded
f9f53000
fb0ae000
fb040000
modules:
f9f61000
fb0b0000
fb043000
swmidi.sys
splitter.sys
Sfloppy.SYS
(deferred)
(deferred)
(deferred)
(deferred)
e:\mysymbols\SereEnum.pdb\.......
(deferred)
The following two examples show the lm command once without any options and once with the sm option. Compare the sort order in the two examples.
Example 1:
0:000> lm
start
end
01000000 0100d000
77c10000 77c68000
77dd0000 77e6b000
77e70000 77f01000
7c800000 7c8f4000
7c900000 7c9b0000
module name
stst
(deferred)
msvcrt
(deferred)
ADVAPI32
(deferred)
RPCRT4
(deferred)
kernel32
(deferred)
ntdll
(private pdb symbols) c:\db20sym\ntdll.pdb
Example 2:
0:000> lmsm
start
end
77dd0000 77e6b000
7c800000 7c8f4000
77c10000 77c68000
7c900000 7c9b0000
77e70000 77f01000
01000000 0100d000
module name
ADVAPI32
(deferred)
kernel32
(deferred)
msvcrt
(deferred)
ntdll
(private pdb symbols)
RPCRT4
(deferred)
stst
(deferred)
c:\db20sym\ntdll.pdb
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Filename
Specifies the file to load or unload. If this file is not located in the directory where the debugger was opened from, you must include an absolute or relative path. The file
name must follow Microsoft Windows file name conventions.
Environment
Modes
User mode, kernel mode
Targets Live, crash dump
Platforms All
Comments
The lsf command loads a source file.
The lsf command unloads a source file. You can use this command to unload files that you previously loaded with lsf or automatically loaded source files. You cannot use
lsf to unload files that were loaded through WinDbg's File | Open Source File command or files that a WinDbg workspace loaded.
In CDB or KD, you can view source files in the Debugger Command window. In WinDbg, source files are loaded as new Source windows.
For more information about source files, source paths, and other ways to load source files, see Source Path.
See Also
ls, lsa (List Source Lines), lsc (List Current Source)
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
m (Move Memory)
The m command copies the contents of memory from one location to another.
Do not confuse this command with the ~m (Resume Thread) command.
Syntax
m Range Address
Parameters
Range
Specifies the memory area to copy. For more information about the syntax of this parameter, see Address and Address Range Syntax.
Address
Specifies the starting address of the destination memory area. For more information about the syntax of this parameter, see Address and Address Range Syntax.
Environment
Modes
User mode, kernel mode
Targets Live, crash dump
Platforms All
Comments
The memory area that Address specifies can be part of the memory area that Range specifies. Overlapping moves are handled correctly.
Additional Information
For more information about memory manipulation and a description of other memory-related commands, see Reading and Writing Memory.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
p (Step)
The p command executes a single instruction or source line and optionally displays the resulting values of all registers and flags. When subroutine calls or interrupts occur,
they are treated as a single step.
Syntax
User-Mode
[~Thread] p [r] [= StartAddress] [Count] ["Command"]
Kernel-Mode
p [r] [= StartAddress] [Count] ["Command"]
Parameters
Thread
Specifies the threads to continue executing. All other threads are frozen. For more information about the syntax, see Thread Syntax. You can specify threads only in user
mode.
r
Turns on and off the display of registers and flags. By default, the registers and flags are displayed. You can disable register display by using the pr, tr, or
.prompt_allow -reg commands. All three of these commands control the same setting and you can use any of them to override any previous use of these commands.
You can also disable register display by using the l-os command. This setting is separate from the other three commands. To control which registers and flags are
displayed, use the rm (Register Mask) command.
StartAddress
Specifies the address where execution should begin. If you do not use StartAddress, execution begins at the instruction that the instruction pointer points to. For more
information about the syntax, see Address and Address Range Syntax.
Count
Specifies the number of instructions or source lines to step through before stopping. Each step is displayed as a separate action in the Debugger Command window. The
default value is one.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Command
Specifies a debugger command to execute after the step is performed. This command is executed before the standard p results are displayed. If you also use Count, the
specified command is executed after all stepping is complete (but before the results from the final step are displayed).
Environment
Modes
User mode, kernel mode
Targets Live debugging only
Platforms All
Comments
When you specify Count, each instruction is displayed as it is stepped through.
If the debugger encounters a call instruction or interrupt while stepping, the called subroutine will execute completely unless a breakpoint is encountered. Control is returned
to the debugger at the next instruction after the call or interrupt.
Each step executes a single assembly instruction or a single source line, depending on whether the debugger is in assembly mode or source mode. Use the l+t and l-t
commands or the buttons on the WinDbg toolbar to switch between these modes.
When you are quickly stepping many times in WinDbg, the debugging information windows are updated after each step. If this update causes slower response time,
use .suspend_ui (Suspend WinDbg Interface) to temporarily suspend the refreshing of these windows.
Additional Information
For more information about issuing the p command and an overview of related commands, see Controlling the Target.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
pa (Step to Address)
The pa command executes the program until the specified address is reached, displaying each step.
Syntax
User-Mode
[~Thread] pa [r] [= StartAddress] StopAddress ["Command"]
Kernel-Mode
pa [r] [= StartAddress] StopAddress ["Command"]
Parameters
Thread
Specifies threads to continue executing. All other threads are frozen. For more information about the syntax, see Thread Syntax. You can specify threads only in user
mode.
r
Turns on and off the display of registers and flags. By default, the registers and flags are displayed. You can disable register display by using the par, pr, tr, or
.prompt_allow -reg commands. All of these commands control the same setting and you can use any of them to override any previous use of these commands.
You can also disable register display by using the l-os command. This setting is separate from the other three commands. To control which registers and flags are
displayed, use the rm (Register Mask) command.
StartAddress
Specifies the address where the debugger begins execution. Otherwise, the debugger begins at the instruction that the instruction pointer points to. For more information
about the syntax, see Address and Address Range Syntax.
StopAddress
Specifies the address where execution will stop. This address must match the exact address of an instruction.
Command
Specifies a debugger command to execute after the step is performed. This command is executed before the standard pa results are displayed. If you also use
StopAddress, the specified command is executed after StopAddress is reached (but before the results from the final step are displayed).
Environment
Modes
User mode, kernel mode
Targets Live debugging only
Platforms All
Comments
The pa command causes the target to begin executing. This execution continues until the specified instruction is reached or a breakpoint is encountered.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Note If you use this command in kernel mode, execution stops when an instruction is encountered at the specified virtual address in any virtual address space.
During this execution, all steps are displayed explicitly. Called functions are treated as a single unit. Therefore, the display of this command is similar to what you see if you
execute p (Step) repeatedly until the program counter reaches the specified address.
For example, the following command explicitly steps through the target code until the return address of the current function is reached.
0:000> pa @$ra
The following example demonstrates using the pa command along with the kb command to display the stack trace:
0:000> pa 70b5d2f1 "kb"
Additional Information
For more information about related commands, see Controlling the Target.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Parameters
Thread
Specifies threads to continue executing. All other threads are frozen. For more information about the syntax, see Thread Syntax. You can specify threads only in user
mode.
r
Turns on and off the display of registers and flags. By default, the registers and flags are displayed. You can disable register display by using the phr, pr, tr, or
.prompt_allow -reg commands. All of these commands control the same setting and you can use any of them to override any previous use of these commands.
You can also disable register display by using the l-os command. This setting is separate from the other three commands. To control which registers and flags are
displayed, use the rm (Register Mask) command.
StartAddress
Specifies the address where the debugger begins execution. Otherwise, the debugger begins at the instruction that the instruction pointer points to. For more information
about the syntax, see Address and Address Range Syntax.
Count
Specifies the number of branching instructions that must be encountered for this command to stop. The default value is one.
Environment
Modes
User mode, kernel mode
Targets Live debugging only
Platforms All
Comments
The ph command causes the target to begin executing. This execution continues until a branching instruction is reached or a breakpoint is encountered.
If the program counter is already on a branching instruction, the entire branching instruction is executed. After this branching instruction is returned, execution continues until
another branching instruction is reached. This execution, rather than tracing, of the call is the only difference between ph and th (Trace to Next Branching Instruction).
In source mode, you can associate one source line with multiple assembly instructions. The ph command does not stop at a branching instruction that is associated with the
current source line.
Additional Information
For more information about related commands, see Controlling the Target.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Environment
Modes
User mode, kernel mode
Targets Live debugging only
Platforms All
Comments
The pt command causes the target to begin executing. This execution continues until a return instruction is reached or a breakpoint is encountered.
If the program counter is already on a return instruction, the entire return is executed. After this return is returned, execution continues until another return is reached. This
execution, rather than tracing, of the call is the only difference between pt and tt (Trace to Next Return).
In source mode, you can associate one source line with multiple assembly instructions. The pt command does not stop at a return instruction that is associated with the
current source line.
The following example demonstrates using the pt command along with the kb command to display the stack trace:
0:000> pt "kb"
Additional Information
For more information about related commands, see Controlling the Target.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
q, qq (Quit)
The q and qq commands end the debugging session. (In CDB and KD, this command also exits the debugger itself. In WinDbg, this command returns the debugger to
dormant mode.)
Syntax
q
qq
Environment
Modes
User mode, kernel mode
Targets Live, crash dump
Platforms All
Comments
In user-mode debugging, the q command ends the debugging session and closes the target application.
In kernel-mode debugging, the q command saves the log file and ends the debugging session. The target computer remains locked.
If this command does not work in KD, press CTRL+R+ENTER on the debugger keyboard, and then retry the q command. If this action does not work, you must use
CTRL+B+ENTER to exit the debugger.
The qq command behaves exactly like the q command, unless you are performing remote debugging. During remote debugging, the q command has no effect, but the qq
command ends the debugging server. For more information about this effect, see Remote Debugging Through the Debugger.
Additional Information
For more information about exiting the debugger or detaching from the target, see Ending the Debugging Session.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
qd
Environment
Modes
User mode only
Targets Live debugging only
Platforms All
Comments
The qd command detaches from a target application and ends the debugging session, leaving the target still running. However, this command is supported only on Microsoft
Windows XP and later versions of Windows. On Windows 2000, qd generates a warning message and has no effect.
When you are performing remote debugging through the debugger, you cannot use the qd command from a debugging client.
Additional Information
For more information about exiting the debugger or detaching from the target, see Ending the Debugging Session.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
r (Registers)
The r command displays or modifies registers, floating-point registers, flags, pseudo-registers, and fixed-name aliases.
Syntax
User-Mode
[~Thread] r[M Mask|F|X|?] [ Register[:[Num]Type] [= [Value]] ]
r.
Kernel-Mode
[Processor] r[M Mask|F|X|?] [ Register[:[Num]Type] [= [Value]] ]
r.
Parameters
Processor
Specifies the processor that the registers are read from. The default value is zero. If you specify Processor, you cannot include the Register parameterall registers are
displayed. For more information about the syntax, see Multiprocessor Syntax. You can specify processors only in kernel mode.
Thread
Specifies the thread that the registers are read from. If you do not specify a thread, the current thread is used. For more information about the syntax, see Thread Syntax.
You can specify threads only in user mode.
M Mask
Specifies the mask to use when the debugger displays the registers. The "M" must be an uppercase letter. Mask is a sum of bits that indicate something about the register
display. The meaning of the bits depends on the processor and the mode (see the tables in the following Comments section for more information). If you omit M, the
default mask is used. You can set or display the default mask by using the Rm (Register Mask) command.
F
Displays the floating-point registers. The "F" must be an uppercase letter. This option is equivalent to M 0x4.
X
Displays the SSE XMM registers. The "X" must be an uppercase letter. This option is equivalent to M 0x40.
?
(Pseudo-register assignment only) Causes the pseudo-register to acquire typed information. Any type is permitted. For more information about the r? syntax, see
Debugger Command Program Examples.
Register
Specifies the register, flag, pseudo-register, or fixed-name alias to display or modify. You must not precede this parameter with at (@) sign. For more information about
the syntax, see Register Syntax.
Num
Specifies the number of elements to display. If you omit this parameter but you include Type, the full register length is displayed.
Type
Specifies the data format to display each register element in. You can use Type only with 64-bit and 128-bit vector registers. You can specify multiple types. You can
specify one or more of the following values.
Type Display format
ib
Signed byte
ub Unsigned byte
iw Signed word
uw Unsigned word
id
Signed DWORD
ud Unsigned DWORD
iq
Signed quad-word
uq Unsigned quad-word
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
f
d
32-bit floating-point
64-bit floating-point
Value
Specifies the value to assign to the register. For more information about the syntax, see Numerical Expression Syntax.
.
Displays the registers used in the current instruction. If no registers are used, no output is displayed.
Environment
Modes
User mode, kernel mode
Targets Live, crash dump
Platforms All
Comments
If you do not specify Register, the r command displays all the non-floating-point registers, and the rF command displays all the floating-point registers. You can change this
behavior by using the rm (Register Mask) command.
If you specify Register but you omit the equal sign (=) and the Value parameter, the command displays the current value of the register.
If you specify Register and an equal sign (=) but you omit Value, the command displays the current value of the register and prompts for a new value.
If you specify Register, the equal sign (=), and Value, the command changes the register to contain the value. (If quiet mode is active, you can omit the equal sign. You can
turn on quiet mode by using the sq (Set Quiet Mode) command. In kernel mode, you can also turn on quiet mode by using the KDQUIET environment variable.)
You can specify multiple registers, separated by commas.
In user mode, the r command displays registers that are associated with the current thread. For more information about the threads, see Controlling Processes and Threads.
In kernel mode, the r command displays registers that are associated with the current register context. You can set the register context to match a specific thread, context
record, or trap frame. Only the most important registers for the specified register context are actually displayed, and you cannot change their values. For more information
about register context, see Register Context.
When you specify a floating-point register by name, the F option is not required. When you specify a single floating-point register, the raw hexadecimal value is displayed in
addition to the decimal value.
The following Mask bits are supported for an x86-based processor or an x64-based processor.
Bit Value
Description
0 0x1 Displays the basic integer registers. (Setting one or both of these bits has the same effect.)
1 0x2
2 0x4 Displays the floating-point registers.
3 0x8 Displays the segment registers.
4 0x10 Displays the MMX registers.
5 0x20 Displays the debug registers. In kernel mode, setting this bit also displays the CR4 register.
6 0x40 Displays the SSE XMM registers.
7 0x80 (Kernel mode only) Displays the CR0, CR1, and CR3 registers.
8 0x100 (Kernel mode only) Displays the descriptor and task state registers.
The following Mask bits are supported for an Itanium-based processor.
Bit Value
Description
0 0x1 Displays the basic integer registers. (Setting one or both of these bits has the same effect.)
1 0x2
2 0x4 Displays the floating-point registers.
3 0x8 Displays the high, floating-point registers (f32 to f127).
4 0x10 Displays the user debug registers.
5 0x20 (Kernel mode only) Displays the KSPECIAL_REGISTERS.
The following code examples show r commands for an x86-based processor.
In kernel mode, the following command shows the registers for processor 2.
1: kd> 2r
In user mode, the following command shows the registers for thread 2.
0:000> ~2 r
The following command displays all of the eax registers that are associated with all threads (in thread ordinal order).
0:000> ~* r eax
The following command sets the eax register for the current thread to 0x000000FF.
0:000> r eax=0x000000FF
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The following command sets the st0 register to 1.234e+10 (the F is optional).
0:000> rF st0=1.234e+10
The following command displays the zero flag.
0:000> r zf
The following command displays the xmm0 register as 16 unsigned bytes and then displays the full contents of the xmm1 register in double-precision floating-point format.
0:000> r xmm0:16ub, xmm1:d
If the current syntax is C++, you must precede registers by an at sign (@). Therefore, you could use the following command to copy the ebx register to the eax register.
0:000> r eax = @ebx
The following command displays pseudo-registers in the same way that the r command displays registers.
0:000> r $teb
You can also use the r command to create fixed-name aliases. These aliases are not registers or pseudo-registers, even though they are associated with the r command. For
more information about these aliases, see Using Aliases.
Here is an example of the r. command on an x86-based processor. The last entry of the call stack precedes the command itself.
01004af3 8bec
mov
0:000> r.
ebp=0006ffc0 esp=0006ff7c
ebp,esp
Additional Information
For more information about registers and their manipulation, see Reading and Writing Registers and Flags. For more information about the register context and other context
settings, see Changing Contexts.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
rm (Register Mask)
The rm command modifies or displays the register display mask. This mask controls how registers are displayed by the r (Registers) command.
Syntax
rm
rm ?
rm Mask
Parameters
?
Displays a list of possible Mask bits.
Mask
Specifies the mask to use when the debugger displays the registers. Mask is a sum of bits that indicate something about the register display. The meaning of the bits
depends on the processor and the mode. For more information; see the tables in the following Comments section.
Environment
Modes
User mode, kernel mode
Targets Live, crash dump
Platforms All
Comments
The "m" in the command name must be a lowercase letter.
If you use rm with no parameters, the current value is displayed, along with an explanation about its bits.
To display the basic integer registers, you must set bit 0 (0x1) or bit 1 (0x2). By default, 0x1 is set for 32-bit targets and 0x2 is set for 64-bit targets. You cannot set these two
bits at the same timeif you try to set both bits, 0x2 overrides 0x1.
You can override the default mask by using the r (Registers) command together with the M option.
The following Mask bits are supported for an x86-based processor or an x64-based processor.
Bit Value
Description
0 0x1 Displays the basic integer registers. (Setting one or both of these bits has the same effect.)
1 0x2
2 0x4 Displays the floating-point registers.
3 0x8 Displays the segment registers.
4 0x10 Displays the MMX registers.
5 0x20 Displays the debug registers. In kernel mode, setting this bit also displays the CR4 register.
6 0x40 Displays the SSE XMM registers.
7 0x80 (Kernel mode only) Displays the CR0, CR1, and CR3 registers.
8 0x100 (Kernel mode only) Displays the descriptor and task state registers.
The following Mask bits are supported for an Itanium-based processor.
Bit Value
Description
0 0x1 Displays the basic integer registers. (Setting one or both of these bits has the same effect.)
1 0x2
2 0x4 Displays the floating-point registers.
3 0x8 Displays the high, floating-point registers (f32 to f127).
4 0x10 Displays the user debug registers.
5 0x20 (Kernel mode only) Displays the KSPECIAL_REGISTERS.
Additional Information
For more information about registers and their manipulation, see Reading and Writing Registers and Flags.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
s (Search Memory)
The s command searches through memory to find a specific byte pattern.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Do not confuse this command with the ~s (Change Current Processor), ~s (Set Current Thread), |s (Set Current Process), or ||s (Set Current System) commands.
Syntax
s
s
s
s
Parameters
[Flags]
Specifies one or more search options. Each flag is a single letter. You must enclose the flags in a single set of brackets ([]). You cannot add spaces between the brackets,
except between n or l and its argument. For example, if you want to specify the s and w options, use the command s -[sw]Type Range Pattern.
You can specify one or more of the following flags:
s
Saves all of the results of the current search. You can use these results to repeat the search later.
r
Restricts the current search to the results from the last saved search. You cannot use the s and r flags in the same command. When you use r, the value of Range is
ignored, and the debugger searches only those hits that were saved by the previous s command.
n Hits
Specifies the number of hits to save when you use the s flag. The default value is 1024 hits. If you use n together with other flags, n must be the last flag, followed
by its Hits argument. The space between n and Hits is optional, but you cannot add any other spaces within the brackets. If any later search that uses the s flag
discovers more than the specified number of hits, the Overflow error message is displayed to notify you that not all hits are being saved.
l Length
Causes a search for arbitrary ASCII or Unicode strings to return only strings that are at least Length characters long. The default length is 3. This value affects only
searches that use the -sa or -su flags.
w
Searches only writeable memory regions. You must enclose the "w" in brackets.
1
Displays only the addresses of search matches in the search output. This option is useful if you are using the .foreach token to pipe the command output into another
command's input.
Type
Specifies the memory type to search for. Add a hyphen (-) in front of Type . You can use one of the following Type values.
Type
Description
b
Byte (8 bits)
w
WORD (16 bits)
d
DWORD (32 bits)
q
QWORD (64 bits)
a
ASCII string
(not necessarily a null-terminated string)
u
Unicode string
(not necessarily a null-terminated string)
If you omit Type, byte values are used. However, if you use Flags, you cannot omit Type.
sa
Searches for any memory that contains printable ASCII strings. Use the l Length flag to specify a minimum length of such strings. The default minimum length is 3
characters.
su
Searches for any memory that contains printable Unicode strings. Use the l Length flag to specify a minimum length of such strings. The default minimum length is 3
characters.
Range
Specifies the memory area to search through. This range cannot be more than 256 MB long unless you use the L? syntax. For more information about this syntax, see
Address and Address Range Syntax.
Pattern
Specifies one or more values to search for. By default, these values are byte values. You can specify different types of memory in Type. If you specify a WORD,
DWORD, or QWORD value, enclose it in single quotation marks (for example, 'Tag7'). If you specify a string, enclose it in double quotation marks (for example, "This
string").
-v
Searches for objects of the same type as the specified Object.
Object
Specifies the address of an object or the address of a pointer to an object. The debugger then searches for objects of the same type as the object that Object specifies.
Environment
Modes
User mode, kernel mode
Targets Live, crash dump
Platforms All
Comments
If the debugger finds the byte pattern that you specify, the debugger displays the first memory address in the Range memory area where the pattern was found. The debugger
displays an excerpt of memory that begins at that location in a format that matches the specified Type memory type. If Type is a or u, the memory contents and the
corresponding ASCII or Unicode characters are displayed.
You must specify the Pattern parameter as a series of bytes, unless you specify a different Type value. You can enter byte values as numeric or ASCII characters:
Numeric values are interpreted as numbers in the current radix (16, 10, or 8). To change the default radix, use the n (Set Number Base) command. You can override
the default radix by specifying the 0x prefix (hexadecimal), the 0n prefix (decimal), the 0t prefix (octal), or the 0y prefix (binary).
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Note The default radix behaves differently when you use C++ expressions. For more information about these expressions and the radix, see Evaluating Expressions.
You must enclose ASCII characters in single straight quotation marks. You cannot use C-style escape characters (such as '\0' or '\n').
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
You can also set kernel debugging options using the _NT_DEBUG_OPTIONS environment variable.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
The debugger does not display messages every time that an extension DLL is loaded or unloaded.
The r (Registers) command no longer requires an equal sign (=) in its syntax.
When you break into a target computer while kernel debugging, the long warning message is suppressed.
Do not confuse quiet mode with the effects of the -myob command-line option (in CDB and KD) or the -Q command-line option (in WinDbg).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Description
When this exception occurs, the target immediately breaks into the debugger before any other error handlers are activated. This kind of handling
is called first chance handling.
(Enabled)
sxd
Second chance The debugger does not break for a first-chance exception of this type (although a message is displayed). If other error handlers do not address
break
this exception, execution stops and the target breaks into the debugger. This kind of handling is called second chance handling.
(Disabled)
sxn
Output
When this exception occurs, the target application does not break into the debugger at all. However, a message is displayed that notifies the user
of this exception.
(Notify)
sxi
Ignore
When this exception occurs, the target application does not break into the debugger at all, and no message is displayed.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
When you are setting the handling status, these commands have the following effects:
Command Status name
Description
sxe
Handled
The event is considered handled when execution resumes.
Not Handled The event is considered not handled when execution resumes.
sxd,
sxn,
sxi
You can use the -h option together with exceptions, not events. Using this option with ch, bpe, or sse sets the handling status for hc, bpec, or ssec, respectively. If you use the
-h option with any other event, it has no effect.
Using the -c or -c2 options with hc, bpec, or ssec associates the specified commands with ch, bpe, or sse, respectively.
In the following example, the sxe command is used to set the break status of access violation events to break on the first chance, and to set the first-chance command that will
be executed at that point to r eax. Then the sx- command is used to alter the first-chance command to r ebx, without changing the handling status. Finally, a portion of the sx
output is shown, indicating the current settings for access violation events:
0:000> sxe -c "r eax" av
0:000> sx- -c "r ebx" av
0:000> sx
av - Access violation - break - not handled
Command: "r ebx"
. . .
Additional Information
For more information about break status and handling status, descriptions of all event codes, a list of the default status for all events, and other methods of controlling this
status, see Controlling Exceptions and Events.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
t (Trace)
The t command executes a single instruction or source line and optionally displays the resulting values of all registers and flags. When subroutine calls or interrupts occur,
each of their steps is also traced.
Syntax
User-Mode
[~Thread] t [r] [= StartAddress] [Count] ["Command"]
Kernel-Mode
t [r] [= StartAddress] [Count] ["Command"]
Parameters
Thread
Specifies threads to thaw. All other threads are frozen. For more information about this syntax, see Thread Syntax. You can specify threads only in user mode.
r
Turns on and off the display of registers and flags. By default, the registers and flags are displayed. You can disable register display by using the pr, tr, or
.prompt_allow -reg commands. All three of these commands control the same setting and you can use any of them to override any previous use of these commands.
You can also disable register display by using the l-os command. This setting is separate from the other three commands. To control which registers and flags are
displayed, use the rm (Register Mask) command.
StartAddress
Specifies the address where execution should begin. If you do not use StartAddress, execution begins at the instruction that the instruction pointer points to. For more
information about the syntax, see Address and Address Range Syntax.
Count
Specifies the number of instructions or source lines to trace through before stopping. Each step is displayed as a separate action in the Debugger Command window. The
default value is one.
Command
Specifies a debugger command to execute after the trace is performed. This command is executed before the standard t results are displayed. If you also use Count, this
command is executed after all tracing is complete (but before the results from the final trace are displayed).
Environment
Modes
User mode, kernel mode
Targets Live debugging only
Platforms All
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Comments
When you specify Count, each instruction is displayed as it is stepped through.
Each trace executes a single assembly instruction or a single source line, depending on whether the debugger is in assembly mode or source mode. Use the l+t and l-t
commands or the buttons on the WinDbg toolbar to switch between these modes.
If you want to trace most function calls but skip certain calls, you can use .step_filter (Set Step Filter) to indicate which calls to step over.
You can use the t command to trace instructions in ROM.
When you are quickly tracing many times in WinDbg, the debugging information windows are updated after each trace. If this update causes slower response time,
use .suspend_ui (Suspend WinDbg Interface) to temporarily suspend the updating of these windows.
Additional Information
For more information about how to issue the t command and an overview of related commands, see Controlling the Target.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ta (Trace to Address)
The ta command executes the program until the specified address is reached, displaying each step (including steps within called functions).
Syntax
User-Mode
[~Thread] ta [r] [= StartAddress] StopAddress
Kernel-Mode
ta [r] [= StartAddress] StopAddress
Parameters
Thread
Specifies threads to continue executing. All other threads are frozen. For more information about the syntax, see Thread Syntax. You can specify threads only in user
mode.
r
Turns on and off the display of registers and flags. By default, the registers and flags are displayed. You can disable register display by using the tar, pr, tr, or
.prompt_allow -reg commands. All of these commands control the same setting and use of any of them overrides any previous use of these commands.
You can also disable register display by using the l-os command. This setting is separate from the other four commands. To control which registers and flags are
displayed, use the rm (Register Mask) command.
StartAddress
Specifies the address where the debugger begins execution. If you do not use StartAddress, execution begins at the instruction that the instruction pointer points to. For
more information about the syntax, see Address and Address Range Syntax.
StopAddress
Specifies the address at which execution stops. This address must match the exact address of an instruction.
Environment
Modes
User mode, kernel mode
Targets Live debugging only
Platforms All
Comments
The ta command causes the target to begin executing. This execution continues until the specified instruction is reached or a breakpoint is encountered.
Note If you use the ta command in kernel mode, execution stops when an instruction is encountered at the specified virtual address in any virtual address space.
During this execution, all steps are displayed explicitly. If a function is called, the debugger also traces through that function. Therefore, the display of this command
resembles what you see if you executed t (Trace) repeatedly until the program counter reached the specified address.
For example, the following command explicitly traces through the target code until the return address of the current function is reached.
0:000> ta @$ra
Additional Information
For more information about related commands, see Controlling the Target.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Kernel-Mode
tc [r] [= StartAddress] [Count]
Parameters
Thread
Specifies threads to continue executing. All other threads are frozen. For more information about the syntax, see Thread Syntax. You can specify threads only in user
mode.
r
Turns on and off the display of registers and flags. By default, the registers and flags are displayed. You can disable register display by using the tcr, pr, tr, or
.prompt_allow -reg commands. All of these commands control the same setting and you can use any of them to override any previous use of these commands.
You can also disable register display by using the l-os command. This setting is separate from the other four commands. To control which registers and flags are
displayed, use the rm (Register Mask) command.
StartAddress
Specifies the address where the debugger begins execution. If you do not use StartAddress, execution begins at the instruction that the instruction pointer points to. For
more information about the syntax, see Address and Address Range Syntax.
Count
Specifies the number of call instructions that the debugger must encounter for the tc command to end. The default value is one.
Environment
Modes
User mode, kernel mode
Targets Live debugging only
Platforms All
Comments
The tc command causes the target to begin executing. This execution continues until the debugger reaches a call instruction or encounters a breakpoint.
If the program counter is already on a call instruction, the debugger traces into the call and continues executing until it encounters another call. This tracing, rather than
execution, of the call is the only difference between tc and pc (Step to Next Call).
In source mode, you can associate one source line with multiple assembly instructions. This command does not stop at a call instruction that is associated with the current
source line.
Additional Information
For more information about related commands, see Controlling the Target.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Environment
Modes
User mode, kernel mode
Targets Live debugging only
Platforms All
Comments
The tct command causes the target to begin executing. This execution continues until the debugger reaches a call or return instruction or encounters a breakpoint.
If the program counter is already on a call or return instruction, the debugger traces into the call or return and continues executing until it encounters another call or return.
This tracing, rather than execution, of the call is the only difference between tct and pct (Step to Next Call or Return).
In source mode, you can associate one source line with multiple assembly instructions. This command does not stop at a call or return instruction that is associated with the
current source line.
Additional Information
For more information about related commands, see Controlling the Target.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
For more information about related commands, see Controlling the Target.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
u (Unassemble)
The u command displays an assembly translation of the specified program code in memory.
Do not confuse this command with the ~u (Unfreeze Thread) command.
Syntax
u[b] Range
u[b] Address
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
u[b]
Parameters
Range
Specifies the memory range that contains the instructions to disassemble. For more information about the syntax, see Address and Address Range Syntax. If you use the
b flag, you must specify Range by using the "Address LLength" syntax, not the "Address1 Address2" syntax.
Address
Specifies the beginning of the memory range to disassemble. Eight instructions (on an x86-based processor) or nine instructions (on an Itanium-based processor) are
unassembled. For more information about the syntax, see Address and Address Range Syntax.
b
Determines the memory range to disassemble by counting backward. If ub Address is used, the disassembled range will be the eight or nine byte range ending with
Address. If a range is specifed using the syntax ub Address LLength, the disassembled range will be the range of the specified length ending at Address.
Environment
Modes
User mode, kernel mode
Targets Live, crash dump
Platforms All
Comments
If you do not specify a parameter for the u command, the disassembly begins at the current address and extends eight instructions (on an x86-based processor) or nine
instructions (on an Itanium-based processor). When you use ub without a parameter, the disassembly includes the eight or nine instructions before the current address.
Do not confuse this command with the up (Unassemble from Physical Memory). The u command disassembles only virtual memory, while the up command disassembles
only physical memory.
Additional Information
For more information about assembly debugging and related commands, see Debugging in Assembly Mode.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
uf (Unassemble Function)
The uf command displays an assembly translation of the specified function in memory.
Syntax
uf [Options] Address
Parameters
Options
One or more of the following options:
/c
Displays only the call instructions in a routine instead of the full disassembly. Call instructions can be useful for determination of caller and callee
relationships from disassembled code.
/D
Creates linked callee names for navigation of the call graph.
/m
Relaxes the blocking requirements to permit multiple exits.
/o
Sorts the display by address instead of by function offset. This option presents a memory-layout view of a full function.
/O
Creates linked call lines for accessing call information and creating breakpoints.
/i
Displays the number of instructions in a routine.
Address
Specifies the address of the function to disassemble. For more information about the syntax, see Address and Address Range Syntax.
Environment
Modes
User mode, kernel mode
Targets Live, crash dump
Platforms All
Comments
The display shows the whole function, according to the function order.
Additional Information
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
For more information about assembly debugging and related commands, see Debugging in Assembly Mode.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
If you do not specify Range or Address, the disassembly begins at the current address and extends eight instructions (on an x86-based processor) or nine instructions (on an
Itanium-based processor).
If you are examining 16-bit real-mode code on an x86-based processor, both the ur command and the u (Unassemble) command give correct results.
However, if real-mode code exists in a location where the debugger is not expecting it (for example, a non-x86 computer that is running or emulating x86-based BIOS code
from a plug-in card), you must use ur to correctly disassemble this code.
If you use ur on 32-bit or 64-bit code, the command tries to disassemble the code as if it were 16-bit code. This situation produces meaningless results.
Additional Information
For more information about how to debug BIOS code, see Debugging BIOS Code.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Platforms All
Comments
The wrmsr command can display MSR's on x86-based, Itanium-based, and x64-based platforms. The MSR definitions are platform-specific.
See Also
rdmsr (Read MSR)
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
0
0
0
0
0
0
0
15
66
0
0
0
39
0
[
[
[
[
[
[
[
[
[
[
[
[
[
[
0] MyModule!myFunction
1]
MyModule!ILT+1555(_printf)
1]
MyModule!printf
2]
MyModule!ILT+370(__stbuf)
2]
MyModule!_stbuf
3]
MyModule!ILT+1440(__isatty)
3]
MyModule!_isatty
2]
MyModule!_stbuf
1]
MyModule!printf
2]
MyModule!ILT+980(__output)
2]
MyModule!_output
3]
MyModule!write_char
2]
MyModule!_output
3]
MyModule!write_char
0
11675
11729
11895
11996
83789
0
0
83782
[
[
[
[
[
[
[
[
[
5]
kernel32!__SEH_epilog4
4]
kernel32!ReadFile
3]
MyModule!_read
2]
MyModule!_filbuf
1]
MyModule!fgets
0] MyModule!myFunction
1]
MyModule!ILT+1265(__RTC_CheckEsp)
1]
MyModule!_RTC_CheckEsp
0] MyModule!myFunction
....
11
54
165
100
91
54545
1
2
54547
1
29
40
29
19
29
System Call
ntdll!KiFastSystemCall
In the listing of the trace, the first number specifies the number of instructions that were executed, the second number specifies the number of instructions executed by child
processes of the function, and the third number (in brackets) specifes the depth of the function in the stack (taking the initial function as zero). The indentation of the function
name shows the call depth.
In the preceding example, MyModule!myFunction executes 105 instructions before it calls several subroutines, including printf and fgets, and then executes 54545
additional instructions after calling those functions, but before issuing a few more calls. However, in the final count, the display shows that myFunction executes 112,379
instructions, because this count includes all of the instructions that myFunction and its children execute. (The children of myFunction are functions that are called from
myFunction, either directly or indirectly.)
In the preceding example, note also that ILT+1440 (__isatty) is called 21 times. In the final count, the summary of this function's behavior shows the number of times that it
was called, the smallest number of instructions in any single execution, the largest number of instructions in any single execution, and the average number of instructions per
execution.
If any system calls are made, they appear in the counter and are listed again at the end of the command output.
Additional Information
For more information about issuing the wt command and an overview of related commands, see Controlling the Target.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
x (Examine Symbols)
The x command displays the symbols in all contexts that match the specified pattern.
Syntax
x [Options] Module!Symbol
x [Options] *
Parameters
Options
Specifies symbol searching options. You can use one or more of the following options:
/t
Displays the data type of each symbol, if the data type is known.
/v
Displays the symbol type (local, global, parameter, function, or unknown) of each symbol. This option also displays the size of each symbol. The size of a function
symbol is the size of the function in memory. The size of other symbols is the size of the data type that the symbol represents. Size is always measured in bytes and
displayed in hexadecimal format.
/s Size
Display only those symbols whose size, in bytes, equals the value of Size. The Size of a function symbol is the size of the function in memory. The Size of other
symbols is the size of the data type that the symbol represents. Symbols whose size cannot be determined are always displayed. Size must be a nonzero integer.
/q
Displays symbol names in quoted format.
/p
Omits the space before the opening parenthesis when the debugger displays a function name and its arguments. This kind of display can make it easier if you are
copying function names and arguments from the x display to another location.
/f
Displays the data size of a function.
/d
Displays the data size of data.
/a
Sorts the display by address, in ascending order.
/A
Sorts the display by address, in descending order.
/n
Sorts the display by name, in ascending order.
/N
Sorts the display by name, in descending order.
/z
Sorts the display by size, in ascending order.
/Z
Sorts the display by size, in descending order.
Module
Specifies the module to search. This module can be an .exe, .dll, or .sys file. Module can contain a variety of wildcard characters and specifiers. For more information
about the syntax, see String Wildcard Syntax.
Symbol
Specifies a pattern that the symbol must contain. Symbol can contain a variety of wildcard characters and specifiers. For more information about the syntax, see String
Wildcard Syntax.
Because this pattern is matched to a symbol, the match is not case sensitive, and a single leading underscore (_) represents any quantity of leading underscores. You can
add spaces within Symbol, so that you can specify symbol names that contain spaces (such as "operator new" or "Template<A, B>") without using wildcard characters.
Environment
Modes
User mode, kernel mode
Targets Live, crash dump
Platforms All
Comments
The x command displays all of the public symbols for the specified module (Module) that match the specified pattern (Symbol). For example, the following command finds all
of the symbols in MyModule that contain the string "spin".
0:000> x mymodule!*spin*
The following command quickly locates the "DownloadMinor" and "DownloadMajor" symbols in MyModule.
0:000> x mymodule!downloadm??or
You can also show all symbols in the MyModule by using the following command.
0:000> x mymodule!*
The preceding commands also force the debugger to reload symbol information from MyModule. If you want to reload the symbols in the module with a minimal display, use
the following command.
0:000> x mymodule!*start*
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
A few symbols always contain the string "start". Therefore, the preceding command always displays some output to verify that the command works. But the preceding
command avoids the excessive display length of x mymodule!*.
The display shows the starting address of each symbol and the full symbol name. If the symbol is a function name, the display also includes a list of its argument types. If the
symbol is a global variable, its current value is displayed.
There is one other special case of the x command. To display the addresses and names of all local variables for the current context, use the following command.
0:000> x *
Note In most cases, you cannot access local variables unless private symbols have been loaded. For more information about this situation, see dbgerr005: Private Symbols
Required. To display the values of local variables, use the dv (Display Local Variables) command.
The following code examples show the additional x options. When you use the /v option, the first column of the display shows the symbol type (local, global, parameter,
function, or unknown). The second column is the address of the symbol. The third column is the size of the symbol, in bytes. The fourth column shows the module name and
symbol name. In some cases, this display is followed by an equal sign (=) and then the data type of the symbol. The source of the symbol (public or full symbol information)
is also displayed.
kd> x /v nt!CmType*
global 806c9e68
0
global 806c9e68 150
global 806c9e68
0
global 805bd7b0
0
global 805bd7b0
a8
nt!CmTypeName =
nt!CmTypeName =
nt!CmTypeName =
nt!CmTypeString
nt!CmTypeString
struct _UNICODE_STRING []
struct _UNICODE_STRING [42]
struct _UNICODE_STRING []
= unsigned short *[]
= unsigned short *[42]
In the preceding example, the size is given in hexadecimal format, while the data type is given in decimal format. Therefore, in the last line of the preceding example, the data
type is an array of 42 unsigned short integers. The size of this array is 42*4 = 168, and 168 is displayed in hexadecimal format as 0xA8.
You can use the /s Size option to display only those symbols whose size, in bytes, is a certain value. For example, you can restrict the command in the preceding example to
symbols that represent objects whose size is 0xA8.
kd> x /v /s a8 nt!CmType*
global 805bd7b0
a8 nt!CmTypeString = unsigned short *[42]
The /t option causes the debugger to display information about each symbol's data type. Note that for many symbols, this information is displayed even without the /t option.
When you use /t, such symbols have their data type information displayed twice.
0:001> x prymes!__n*
00427d84 myModule!__nullstring = 0x00425de8 "(null)"
0042a3c0 myModule!_nstream = 512
Type information missing error for _nh_malloc
004021c1 myModule!MyStructInstance = struct MyStruct
00427d14 myModule!_NLG_Destination = <no type information>
0:001> x /t prymes!__n*
00427d84 char * myModule!__nullstring = 0x00425de8 "(null)"
0042a3c0 int myModule!_nstream = 512
Type information missing error for _nh_malloc
004021c1 struct MyStruct myModule!MyStructInstance = struct MyStruct
00427d14 <NoType> myModule!_NLG_Destination = <no type information>
The following example demonstrates the switch /f when used to filter functions on the module notepad.exe.
0:000> x /f /v notepad!*main*
prv func
00000001`00003340 249 notepad!WinMain (struct HINSTANCE__ *, struct HINSTANCE__ *, char *, int)
prv func
00000001`0000a7b0
1c notepad!WinMainCRTStartup$filt$0 (void)
prv func
00000001`0000a540 268 notepad!WinMainCRTStartup (void)
See Also
Verifying Symbols, dv (Display Local Variables)
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
z (Execute While)
The z command executes a command while a given condition is true.
Syntax
User-Mode
Command ; z( Expression )
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Kernel-Mode
Command ; [Processor] z( Expression )
Parameters
Command
Specifies the command to execute while the Expression condition evaluates to a nonzero value. This command is always executed at least once.
Processor
Specifies the processor that applies to the test. For more information about the syntax, see Multiprocessor Syntax. You can specify processors only in kernel mode.
Expression
Specifies the condition to test. If this condition evaluates to a nonzero value, the Command command is executed again and then Expression is tested again. For more
information about the syntax, see Numerical Expression Syntax.
Environment
Modes
User mode, kernel mode
Targets Live, crash dump
Platforms All
Comments
In many debugger commands, the semicolon is used to separate unrelated commands. However, in the z command, a semicolon seperates the "z" from the Command
parameter.
The Command command is always executed at least once, and then Expression is tested. If the condition is a nonzero value, the command is again executed, and then
Expression is tested again. (This behavior is similar to a C-language do - while loop, not a simple while loop.)
If there are several semicolons to the left of the "z", all commands to the left of the "z" repeat as long as the Expression condition is true. Such commands can be any debugger
commands that permit a terminal semicolon.
If you add another semicolon and additional commands after the z command, these additional commands are executed after the loop is complete. We do not typically
recommend a line that begins with "z" because it generates uninteresting output forever unless the condition becomes false because of some other action. Note that you can
nest z commands.
To break a loop that is continuing for too long, use CTRL+C in CDB or KD, or use Debug | Break or CTRL+BREAK in WinDbg.
The following code example shows an unnecessarily complex way to zero the eax register.
0:000> reax = eax - 1 ; z(eax)
The following example increments the eax and ebx registers until one of them is at least 8 and then it increments the ecx register once.
0:000> reax=eax+1; rebx=ebx+1; z((eax<8)|(ebx<8)); recx=ecx+1
The following example uses C++ expression syntax and uses the pseudo-register $t0 as a loop variable.
0:000> .expr /s c++
Current expression evaluator: C++ - C++ source expressions
0:000> db pindexcreate[@$t0].szKey; r$t0=@t0+1; z( @$t0 < cIndexCreate )
See Also
j (Execute If-Else)
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Meta-Commands
This section of the reference discusses the various debugger meta-commands that can be used in CDB, KD, and WinDbg. These commands are preceded by a period (.).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Syntax
.abandon [ /h | /n ]
Parameters
/h
Any outstanding debug event will be continued and marked as handled. This is the default.
/n
Any outstanding debug event will be continued unhandled.
Environment
This command is only supported in Windows XP and later versions of Windows.
Modes
user mode only
Targets live debugging only
Platforms all
Additional Information
If the target is left in a debugging state, a new debugger can be attached to it. See Re-attaching to the Target Application for details. However, after a process has been
abandoned once, it can never be restored to a running state without a debugger attached.
For other methods of exiting the debugger or detaching from the target, see Ending the Debugging Session.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Syntax
.allow_image_mapping [/r] 0
.allow_image_mapping [/r] 1
.allow_image_mapping
Parameters
/r
Reloads all modules in the debugger's module list. This is equivalent to .reload /d.
0
Prevents image files from being mapped.
1
Allows image files to be mapped.
Environment
Modes
user mode and kernel mode
Targets live, crash dump
Platforms all
Comments
With no parameters, .allow_image_mapping will display whether image file mapping is currently allowed. By default, this mapping is allowed.
Image mapping is most common when a minidump is being debugged. Image mapping can also occur if DbgHelp is unable to access debug records (for example, during
kernel debugging when memory has been paged out).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
If it is unclear whether a particular breakpoint is set at an address, at a symbolic reference, or at a symbol, use the .bpcmds command to shows which breakpoint command
was used to creat it. The command that was used to create a breakpoint determines its nature:
The output of .bpcmds reflects the current nature of each breakpoint. Each line of the .bpcmds display begins with the command used to create it (bp, bu, or ba) followed by
the breakpoint ID, and then the location of the breakpoint.
If the breakpoint was created by ba, the access type and size are displayed as well.
If the breakpoint was created by bm without the /d switch, the display indicates the breakpoint type as bu, followed by the evaluated symbol enclosed in the @!"" token
(which indicates it is a literal symbol and not a numeric expression or register). If the breakpoint was created by bm with the /d switch, the display indicates the breakpoint
type as bp.
Here is an example:
0:000> bp notepad!winmain
0:000> .bpcmds
bp0 0x00000001`00003340 ;
0:000> bu myprog!winmain
breakpoint 0 redefined
0:000> .bpcmds
bu0 notepad!winmain;
0:000> bu myprog!LoadFile
0:000> bp myprog!LoadFile+10
0:000> bm myprog!openf*
3: 00421200 @!"myprog!openFile"
4: 00427800 @!"myprog!openFilter"
0:000> bm /d myprog!closef*
5: 00421600 @!"myprog!closeFile"
0:000> ba r2 myprog!LoadFile+2E
0:000> .bpcmds
bu0 notepad!winmain;
bu1 notepad!LoadFile;
bp2 0x0042cc10 ;
bu3 @!"myprog!openFile";
bu4 @!"myprog!openFilter";
bp5 0x00421600 ;
ba6 r2 0x0042cc2e ;
In this example, notice that the output of .bpcmds begins with the relevant command ("bu", "bp", or "ba"), followed by the breakpoint number (with no intervening space).
Notice that because breakpoint number 0 was originally set using bp, and then was redefined using bu, the display shows its type as "bu".
Notice also that breakpoints 3, 4, and 5, which were created by the bm commands shown in this example, are displayed as either type "bp" or type "bu", depending on
whether the /d switch was included when bm was used.
Additional Information
For more information about and examples of how to use breakpoints, other breakpoint commands and methods of controlling breakpoints, see Using Breakpoints.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Parameters
1
Causes all threads to freeze when one thread has reached a breakpoint. After the thread to which the breakpoint applies has stepped through the breakpoint, the other
threads are unfrozen.
0
Allows other threads to continue executing when one thread has reached a breakpoint. This is the default behavior.
Environment
Modes
user mode only
Targets live, crash dump
Platforms all
Comments
With no parameters. the .bpsync command displays the current rule governing breakpoint synchronization behavior.
The .bpsync command applies both to software breakpoints (set with bp, bu, or bm) and to processor breakpoints (set with ba).
If there is a possibility of multiple threads running through the same code, the .bpsync 1 command can be useful for capturing all breakpoint occurrences. Without this
command, a breakpoint occurrence could be missed because the first thread to reach the breakpoint always causes the debugger to temporarily remove the breakpoint. In the
short period when the breakpoint is removed, other threads could reach the same place in the code and not trigger the breakpoint as intended.
The temporary removal of breakpoints is a normal aspect of debugger operation. When the target reaches a breakpoint and is resumed, the debugger has to remove the
breakpoint temporarily so that the target can execute the real code. After the real instruction has been executed, the debugger reinserts the break. To do this, the debugger
restores the code (or turns off data breaks), does a single-step, and then puts the break back.
Note that if you use .bpsync 1, there is a risk of deadlocks among the threads that have been frozen.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Modes
kernel mode only
Targets live debugging only
Platforms all
Comments
If .cache is used with no arguments, the current cache size, status, and options are displayed.
The .cache forcedecodeuser or .cache forcedecodeptes option will only last as long as the debugger remains broken into the target computer. If any stepping or execution of
the target takes place, the noforcedecodeptes state will again take effect. This prevents the debugger from interfering with execution or a reboot in an unproductive manner.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Parameters
/v
Verbose information about the call and its arguments is displayed.
/s Prototype
Allows you to call the function that is specified by Function even though you do not have the correct symbols. In this case, you must have symbols for another function
that has the same calling prototype as the function you are trying to call. The Prototype parameter is the name of this prototype function.
Function
Specifies the function being called. This can be the name of the function (preferably qualified with a module name), or any other expression that evaluates to the function
address. If you need to call a constructor or destructor, you must supply the address or else use a C++ expression to evaluate named syntax for the operators (see
Numerical Expression Syntax for details).
Arguments
Specifies the arguments passed to the function. If you are calling a method, the first argument must be this, and all other arguments follow it. Arguments should be
separated with commas and should match the usual argument syntax. Variable-length argument lists are supported. Expressions within an argument are parsed by the
C++ expression evaluator; see C++ Numbers and Operators for details. You cannot enter a literal string as an argument, but you can use a pointer to a string, or any other
memory accessible to the target process.
/c
Clears any existing call on the current thread.
/C
Clears any existing call on the current thread, and resets the context of the current thread to the context stored by the outstanding call.
Environment
Modes
user mode only
Targets live debugging only
Platforms x86 and x64 only
Comments
The specified function is called by the current thread of the current process.
Only the cdecl, stdcall, fastcall, and thiscall calling conventions are supported. Managed code cannot be called by this command.
After .call is used, the debugger will update the stack, change the instruction pointer to point to the beginning of the called function, and then stop. Use g (Go) to resume
execution, or ~. g to execute just the thread making the call.
When the function returns, a break occurs and the debugger displays the return value of the function. The return value is also stored in the $callret pseudo-register, which
acquires the type of the return value.
If you have broken into the target using CTRL+C or CTRL+BREAK, the current thread is an additional thread created to handle the breakin. If you issue a .call command at
this point, the extra thread will be used for the called function.
If you have reached a predefined breakpoint, there is no extra breakin thread. If you use .call while at a breakpoint in user mode, you could use g to execute the entire process,
or ~. g to execute just the current thread. Using g may distort your program's behavior, since you have taken one thread and diverted it to this new function. On the other hand,
this thread will still have its locks and other attributes, and thus ~. g may risk deadlocks.
The safest way to use .call is to set a breakpoint in your code at a location where a certain function could be safely called. When that breakpoint is hit, you can use .call if you
desire that function to run. If you use .call at a point where this function could not normally be called, a deadlock or target corruption could result.
It may be useful to add extra functions to your source code that are not called by the existing code, but are intended to be called by the debugger. For example, you could add
functions that are used to investigate the current state of your code and its environment and store information about the state in a known memory location. Be sure not to
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
optimize your code, or these functions may be removed by the compiler. Use this technique only as a last resort, because if your application crashes .call will not be available
when debugging the dump file.
The .call /c and .call /C commands should only be used if an attempt to use .call has failed, or if you changed your mind before entering the g command. These should not be
used casually, since abandoning an uncompleted call can lead to a corrupted target state.
The following code example shows how the .call /s command is used.
.call /s KnownFunction UnknownFunction( 1 )
In this example, you have private symbols for KnownFunction, which takes an integer as its only argument and returns, for example, a pointer to an array. You do not have
symbols, or possibly you only have public symbols for UnknownFunction, but you do know that it takes an integer as its only argument and returns a pointer to an array. By
using the /s option, you can specify that UnknownFunction will work the same way that KnownFunction does. Thus, you can successfully generate a call to
UnknownFunction.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
With no parameters, .childdbg will display the current status of child-process debugging.
Additional Information
For more details and other methods of controlling the debugging of child processes, see Spawning a New Process (User Mode).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Syntax
.cls
Environment
Modes
user mode, kernel mode
Targets live, crash dump
Platforms all
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
InheritedAddressSpace:
No
ReadImageFileExecOptions: No
BeingDebugged:
No
ImageBaseAddress:
01000000
Ldr.Initialized: Yes
Ldr.InInitializationOrderModuleList: 71f40 . 77f68
Ldr.InLoadOrderModuleList: 71ec0 . 77f58
Ldr.InMemoryOrderModuleList: 71ec8 . 77f60
01000000 C:\WINNT\system32\regsvc.exe
77F80000 C:\WINNT\System32\ntdll.dll
77DB0000 C:\WINNT\system32\ADVAPI32.dll
77E80000 C:\WINNT\system32\KERNEL32.DLL
77D40000 C:\WINNT\system32\RPCRT4.DLL
77BE0000 C:\WINNT\system32\secur32.dll
SubSystemData:
0
ProcessHeap:
70000
ProcessParameters: 20000
WindowTitle: 'C:\WINNT\system32\regsvc.exe'
ImageFile:
'C:\WINNT\system32\regsvc.exe'
CommandLine: 'C:\WINNT\system32\regsvc.exe'
DllPath:
'C:\WINNT\system32;.;C:\WINNT\System32;C:\WINNT\system;C:\WINNT;C:\WINNT\system32;C:\WINNT;C:\WI
Environment: 0x10000
Additional Information
For more information about the user-mode address context and other context settings, see Changing Contexts.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
If you are only debugging a single target, the debugger will return to dormant mode after it detaches.
If you are debugging multiple targets, the debugging session will continue with the remaining targets.
Additional Information
For other methods of exiting the debugger or detaching from the target, see Ending the Debugging Session.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
include module, thread, and stack information, but no additional data. You can add any of the following MiniOptions to change the contents of the dump file; they
are case-sensitive.
MiniOption
Effect
a
Creates a minidump with all optional additions. The /ma option is equivalent to /mfFhut it adds full memory data, handle data, unloaded module
information, basic memory information, and thread time information to the minidump. Any failure to read inaccessable memory results in termination
of the minidump generation.
A
The /mA option is equivalent to /ma except that it ignores any failure to read inaccessable memory and continues generating the minidump.
f
Adds full memory data to the minidump. All accessible committed pages owned by the target application will be included.
F
Adds all basic memory information to the minidump. This adds a stream to the minidump that contains all basic memory information, not just
information about valid memory. This allows the debugger to reconstruct the complete virtual memory layout of the process when the minidump is
being debugged.
h
Adds data about the handles associated with the target application to the minidump.
u
Adds unloaded module information to the minidump. This is available only in Windows Server 2003 and later versions of Windows.
t
Adds additional thread information to the minidump. This includes thread times, which can be displayed by using the !runaway extension or
the .ttime (Display Thread Times) command when debugging the minidump.
i
Adds secondary memory to the minidump. Secondary memory is any memory referenced by a pointer on the stack or backing store, plus a small
region surrounding this address.
p
Adds process environment block (PEB) and thread environment block (TEB) data to the minidump. This can be useful if you need access to Windows
system information regarding the application's processes and threads.
w
Adds all committed read-write private pages to the minidump.
d
Adds all read-write data segments within the executable image to the minidump.
c
Adds code sections within images.
r
Deletes from the minidump those portions of the stack and store memory that are not useful for recreating the stack trace. Local variables and other
data type values are deleted as well. This option does not make the minidump smaller (because these memory sections are simply zeroed), but it is
useful if you want to protect the privacy of other applications.
R
Deletes the full module paths from the minidump. Only the module names will be included. This is a useful option if you want to protect the privacy of
the user's directory structure.
These MiniOptions can only be used when creating a user-mode minidump. They should follow the /m specifier.
/u
Appends the date, time, and PID to the dump file names. This ensures that dump file names are unique.
/a
Generates dumps for all currently-debugged processes. If /a is used, the /u option should also be used to ensure that each file has a unique name.
/b[a]
Creates a .cab file. If this option is included, FileName is interpreted as the CAB file name, not the dump file name. A temporary dump file will be created, this file
will be packaged into a CAB, and then the dump file will be deleted. If the b option is followed by a, all symbol and image files also will be packaged into the CAB.
/c "Comment"
Specifies a comment string that will be written to the dump file. If Comment contains spaces, it must be enclosed in double quotes. When the dump file is loaded, the
Comment string will be displayed.
/xc Address
(User mode minidumps only) Adds a context record to the dump file. Address must specify the address of the context record.
/xr Address
(User mode minidumps only) Adds an exception record to the dump file. Address must specify the address of the exception record.
/xp Address
(User mode minidumps only) Adds a context record and an exception record to the dump file. Address must specify the address of an EXCEPTION_POINTERS
structure which contains pointers to the context record and the exception record.
/xt ThreadID
(User mode minidumps only) Specifies the thread ID of the system thread that will be used as the exception thread for this dump file.
/kpmf File
(Only when creating a kernel-mode Complete Memory Dump) Specifies a file that contains physical memory page data.
FileName
Specifies the name of the dump file. You can specify a full path and file name or just the file name. If the file name contains spaces, FileName should be enclosed in
quotation marks. If no path is specified, the current directory is used.
-?
Displays help for this command. This text is different in kernel mode and in user mode.
Environment
Modes
user mode, kernel mode
Targets live, crash dump
Platforms all
Comments
This command can be used in a variety of situations:
During live user-mode debugging, this command directs the target application to generate a dump file, but the target application does not terminate.
During live kernel-mode debugging, this command directs the target computer to generate a dump file, but the target computer does not crash.
During crash dump debugging, this command creates a new crash dump file from the old one. This is useful if you have a large crash dump file and want to create a
smaller one.
In kernel mode, to produce a complete memory dump, use the /f option. To produce a small memory dump, use the /m option (or no options). The .dump command
cannot produce a kernel memory dump.
In user mode, .dump /m[MiniOptions] is the best choice. Although "m" stands for "minidump", the dump files created by using this MiniOption can vary in size from
very small to very large. By specifying the proper MiniOptions you can control exactly what information is included. For example, .dump /ma produces a dump with a
great deal of information. The older command, .dump /f, produces a moderately large "standard dump" file and cannot be customized.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
You cannot specify which process is dumped. All running processes will be dumped.
The /xc, /xr, /xp, and /xt options are used to store exception and context information in the dump file. This allows the .ecxr (Display Exception Context Record) command
to be run on this dump file.
The following example will create a user-mode minidump, containing full memory and handle information:
0:000> .dump /mfh myfile.dmp
Handle information can be read by using the !handle extension command.
Additional Information
For a description of kernel-mode dump files and an explanation of their use, see Kernel-Mode Dump Files. For a description of user-mode dump files and an explanation of
their use, see User-Mode Dump Files.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
/b BaseAddress
Specifies the virtual address of the beginning of the allocation.
/r
Reserves the memory in the virtual address space but does not actually allocate any physical memory. If this option is used, the debugger calls VirtualAllocEx with
the flAllocationType parameter equal to MEM_RESERVE. If this option is not used, the value MEM_COMMIT | MEM_RESERVE is used. See the Microsoft
Windows SDK for details.
Size
Specifies the amount of memory to be allocated, in bytes. The amount of memory available to the program will equal Size. The amount of memory actually used may be
slightly larger, since it is always a whole number of pages.
Environment
Modes
user mode only
Targets live debugging only
Platforms all
Comments
The .dvalloc command calls VirtualAllocEx to allocate new memory for the target process. The allocated memory permits reading, writing, and execution.
To free this memory, use .dvfree (Free Memory).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
String
Specifies the text to display. You can also enclose String in quotation marks ("). Regardless of whether you use quotation marks, String can contain any number of
spaces, commas, and single quotation marks ('). If you enclose String in quotation marks, it can include semicolons, but not additional quotation marks. If you do not
enclose String in quotation marks, it can include quotation marks in any location except the first character, but it cannot include semicolons.
Environment
Modes
User mode, kernel mode
Targets Live, crash dump
Platforms All
Comments
The .echo command causes the debugger to display String immediately after you enter the command.
An .echo command is ended if the debugger encounters a semicolon (unless the semicolon occurs within a quoted string). This restriction enables you to use .echo in complex
constructions such as conditional breakpoints, as the following example shows.
0:000> bp `:143` "j (poi(MyVar)>5) '.echo MyVar Too Big'; '.echo MyVar Acceptable; gc' "
The .echo command also provides an easy way for users of debugging servers and debugging clients to communicate with one another. For more information about this
situation, see Controlling a Remote Debugging Session.
The .echo command differs from the $$ (Comment Specifier) token and the * (Comment Line Specifier) token, because these tokens cause the debugger to ignore the
input text without displaying it.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Syntax
.echotime
Environment
Modes
User mode, kernel mode
Targets Live, crash dump
Platforms All
Comments
The .echotime command displays the time to the computer that the debugger is running on.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Modes
User mode only
Targets Crash dump only (minidumps only)
Platforms All
Comments
The .ecxr command locates the current exception's context information and displays the important registers for the specified context record.
This command also instructs the debugger to use the context record that is associated with the current exception as the register context. After you run .ecxr, the debugger can
access the most important registers and the stack trace for this thread. This register context persists until you enable the target to execute, change the current process or thread,
or use another register context command (.cxr or .ecxr). For more information about register contexts, see Register Context.
Additional Information
For more information about the register context and other context settings, see Changing Contexts.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Parameters
0
Displays all long integers in decimal format. This is the default behavior of the debugger.
1
Displays all long integers in the default radix.
Environment
Modes
User mode, kernel mode
Targets Live, crash dump
Platforms All
Comments
The .enable_long_status command affects the output of the dt (Display Type) command.
In WinDbg, .enable_long_status also affects the display in the Locals window and the Watch window. These windows are automatically updated after you
issue .enable_long_status.
This command affects only the display of long integers. To control whether standard integers are displayed in decimal format or the default radix, use
the .force_radix_output (Use Radix for Integers) command.
Note The dv (Display Local Variables) command always displays long integers in the current number base.
To change the default radix, use the n (Set Number Base) command.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The .endpsrv command causes the current process server or KD connection server to close.
Syntax
.endpsrv
Environment
You can use this command only when you are performing remote debugging through a process server or KD connection server.
Modes
User mode, kernel mode
Targets Live, crash dump
Platforms All
Comments
The .endpsrv command terminates the process server or KD connection server currently connected to your smart client.
If you wish to terminate a process server or KD connection server from the computer on which it is running, use Task Manager to end the process (dbgsrv.exe or kdsrv.exe).
The .endpsrv command can terminate a process server or KD connection server, but it cannot terminate a debugging server. For information on how to do that, see
Controlling a Remote Debugging Session.
Additional Information
For more information about these servers, see Process Servers (User Mode) or KD Connection Servers (Kernel Mode)
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
.server
started
.server
started
npipe:pipe=rabbit
with 'npipe:pipe=rabbit'
tcp:port=7
with 'tcp:port=7'
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
- 0xf9c bytes
FF FF 00 00 MZ..............
00 00 00 00 ........@.......
00 00 00 00 ................
............
- 0x298 bytes
00 00 00 00 ..{...{.........
00 00 00 00 KDBG..... M.....
00 00 00 00 T.W......PZ.....
00 00 00 00 @........}P.....
........
In this example, the first batch of secondary data has a GUID ){87654321-0000-0000-0000000000000000}) as its tag, and the second batch of data has a GUID ({123456780000-0000-0000000000000000}) as its tag. However, the data is not in a useful format.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Additional Information
For more information and for other ways of displaying this data, see Reading Bug Check Callback Data.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
/e ExtDLLPattern
Limits the enumeration to extension commands exported by extension DLLs that match the specified pattern string. ExtDLLPattern is matched against the extension
DLL filename.
/n
Excludes the extension name when the extensions are displayed. Thus, if this option is specified, then only the extension name itself will be displayed.
Pattern
Specifies a pattern that the extension must contain. Pattern can contain a variety of wildcard characters and specifiers. For more information about the syntax, see String
Wildcard Syntax.
Environment
Modes
User mode, kernel mode
Targets Live, crash dump
Platforms All
Comments
Here is an example of this command, showing all the loaded extension DLLs that have an export named !help:
0:000> .extmatch help
!ext.help
!exts.help
!uext.help
!ntsdexts.help
The following example lists all extension commands beginning with the string "he" that are exported by extension DLLs whose names begin with the string "ex":
0:000> .extmatch /e ext* he*
!ext.heap
!ext.help
!exts.heap
!exts.help
To display a list of loaded extension DLLs, use the .chain command.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The .f+ command shifts the frame index to the next frame in the current stack. The .f- command shifts the frame index to the previous frame in the current stack.
Syntax
.f+
.fEnvironment
Modes
User mode, kernel mode
Targets Live, crash dump
Platforms All
Comments
The frame specifies the local context (scope) that the debugger uses to interpret local variables
The .f+ and .f- commands are shortcuts for moving to the next and previous frames in the current stack. These commands are equivalent to the following .frame commands,
but the .f commands are shorter for convenience:
The dollar sign ($) identifies the frame value as a pseudo-register. The at sign (@ causes the debugger to access the value more quickly, because it notifies the debugger that a
string is a register or pseudo-register.
When an application is running, the meaning of local variables depends on the location of the program counter, because the scope of such variables extends only to the
function that they are defined in. Unless you use an .f+ or .f- command (or a .frame command), the debugger uses the scope of the current function (the current frame on the
stack) as the local context.
The frame number is the position of the stack frame within the stack trace. You can view this stack trace by using the k, kb, kc, kd, kp, kP, kv (Display Stack Backtrace)
command or the Calls window. The first line (the current frame) represents frame number 0. The subsequent lines represent frame numbers 1, 2, 3, and so on.
You can set the local context to a different stack frame to view new local variable information. However, the actual variables that are available depend on the code that is
executed.
The debugger resets the local context to the scope of the program counter if any program execution occurs. The local context is reset to the top stack frame if the register
context is changed.
Additional Information
For more information about the local context and other context settings, see Changing Contexts. For more information about how to display local variables and other memoryrelated commands, see Reading and Writing Memory.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Syntax
.fnent Address
Parameters
Address
Specifies the address of the function.
Environment
Modes
User mode, kernel mode
Targets Live, crash dump
Platforms All
Comments
The symbol search algorithm for the .fnent command is the same as that of the ln (List Nearest Symbols) command. The display first shows the nearest symbols. Then, the
debugger displays the function entry for the first of these symbols.
If the nearest symbol is not in the function table, no information is displayed.
The following example shows a possible display.
0:001> .fnent 77f9f9e7
Debugger function entry 00b61f50 for:
(77f9f9e7)
ntdll!RtlpBreakWithStatusInstruction
(77f9fa98)
ntdll!DbgPrintReturnControlC
Params:
1
Locals:
0
Registers: 0
0:001> .fnent 77f9fa98
Debugger function entry 00b61f70 for:
(77f9fa98)
ntdll!DbgPrintReturnControlC
(77f9fb21)
ntdll!DbgPrompt
Non-FPO
0:001> .fnent 01005a60
No function entry for 01005a60
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
-s [-fFlag] Address
-d Address
-x Address
-o Address
Address
Parameters
-s
Sets an FPO override at the specified address.
-fFlag
Specifies FPO flags for the override. You must not add a space between -f and Flag. If the flag takes an argument, you must add a space between the flag and that
argument. If you want multiple flags, you must repeat the -f switch (for example, -fb -fp 4 -fe). You can use the -f switch only with -s. You can use one of the following
values for Flag.
Flag
Effect
b
Sets fUseBP equal to TRUE.
e
Sets fUseSEH equal to TRUE.
n
Sets cbFrame equal to FRAME_NONFPO. (By default, cbFrame is set to FRAME_FPO.)
l Term Sets cdwLocals equal to Term. Term should specify the local DWORD count that you want.
p Term Sets cdwParams equal to Term. Term should specify the parameter DWORD count that you want.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
r Term Sets cbRegs equal to Term. Term should specify the register count that you want.
s Term Sets cbProcSize equal to Term. Term should specify the procedure size that you want.
t Term Sets cbFrame equal to Term. Term should specify one of the following frame types:
FRAME_FPO 0
FRAME_TRAP 1
FRAME_TSS 2
FRAME_NONFPO 3
Address
Specifies the address where the debugger sets or removes the override or the address whose overrides the debugger should display. This address must be within a module
in the current module list.
-d
Removes the FPO overrides at the specified address.
-x
Removes all FPO overrides within the module that contains the Address address.
-o
Displays all FPO overrides within the module that contains the Address address.
Environment
Modes
User mode, kernel mode
Targets Live, crash dump
Platforms all
Comments
Without parameters, the .fpo command displays the FPO overrides for the specified address.
Some compilers (including Microsoft Visual Studio 6.0 and earlier versions) generate FPO information to indicate how the stack frame is set up. During stack walking, the
debugger uses these FPO records to understand the stack. If the compiler generated incorrect FPO information, you can use the .fpo command to fix this problem.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
When an application is running, the meaning of local variables depends on the location of the program counter, because the scope of such variables extends only to the
function that they are defined in. If you do not use the .frame command, the debugger uses the scope of the current function (the current frame on the stack) as the local
context.
To change the local context, use the .frame command and specify the frame number that you want.
The frame number is the position of the stack frame within the stack trace. You can view this stack trace with the k (Display Stack Backtrace) command or the Calls
window. The first line (the current frame) is frame number 0. The subsequent lines represent frame numbers 1, 2, 3, and so on.
If you use the n parameter with the k command, the k command displays frame numbers together with the stack trace. These frame numbers are always displayed in
hexadecimal form. On the other hand, the .frame command interprets its argument in the default radix, unless you override this setting with a prefix such as 0x. To change the
default radix, use the n (Set Number Base) command.
You can set the local context to a different stack frame to enable you to view new local variable information. However, the actual variables that are available depend on the
code that is being executed.
The local context is reset to the scope of the program counter if any application execution occurs. The local context is reset to the top stack frame if the register context is
changed.
Additional Information
For more information about the local context and other context settings, see Changing Contexts. For more information about how to display local variables and other memoryrelated commands, see Reading and Writing Memory.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Comments
The .hh command opens the Debugging Tools for Windows documentation (Debugger.chm). If you specify Text, the debugger opens the Index pane in the documentation
and searches for Text as a keyword in the index. If you do not specify Text, the debugger opens the Contents pane of the documentation.
Additional Information
For more information about the Help documentation, see Using the Help File.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
-a Range
-d { Range | Address }
-D
-o
-c Range
Parameters
-a Range
Specifies the memory range to save. For more information about the syntax, see Address and Address Range Syntax.
-d { Range | Address }
Specifies memory ranges to delete. If you specify Address, the debugger deletes any saved range that contains that address. If you specify Range, the debugger deletes
any saved range that overlaps with Range. For more information about the syntax, see Address and Address Range Syntax.
-D
Deletes all saved memory ranges.
-o
Displays all saved memory ranges.
-c Range
Compares the specified range to all saved memory ranges. For more information about the syntax, see Address and Address Range Syntax.
Environment
Modes
User mode, kernel mode
Targets Live, crash dump
Platforms All
Comments
The .holdmem compares memory ranges byte-for-byte.
If any of the specified memory locations do not exist in the virtual address space, the command returns an error.
Additional Information
For more information about how to manipulate memory and a description of other memory-related commands, see Reading and Writing Memory.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
String
Specifies the string to which the idle command should be set.
/d
Clears the idle command.
Environment
This command cannot be used in script files.
Modes
user mode, kernel mode
Targets live, crash dump
Platforms all
Comments
When .idle_cmd is used with no parameters it displays the current idle command.
In WinDbg, idle commands are stored in workspaces.
Here is an example. The idle command is set to r eax. Then, becausethe debugger is already idle, this command immediately executes, displaying the eax register:
windbg> .idle_cmd r eax
Execute when idle: r eax
eax=003b0de8
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Parameters
Options
Any of the following options:
/r Range
Specifies the range to search. For more information about the syntax, see Address and Address Range Syntax. If you specify only one address, the debugger searches
a range that begins at that address and extends 0x10000 bytes.
/l
Loads module information for any image header that is found.
/v
Displays verbose information.
Environment
Modes
User mode, kernel mode
Targets Live, crash dump
Platforms All
Comments
If you do not use the /r parameter, the debugger searches all virtual memory regions.
The .imgscan command displays any image headers that it finds and the header type. Header types include Portable Executable (PE) headers and Microsoft MS-DOS MZ
headers.
The following example shows the .imgscan command.
0:000> .imgscan
MZ at 00400000, prot 00000002, type 01000000 - size 2d000
MZ at 77f80000, prot 00000002, type 01000000 - size 7d000
Name: ntdll.dll
MZ at 7c570000, prot 00000002, type 01000000 - size b8000
Name: KERNEL32.dll
MapFile
-m OldDriver NewDriver
-s SaveFile
-c
Parameters
MapFile
Specifies the driver replacement map file to read.
-m
Adds a driver replacement association to the current association list.
OldDriver
Specifies the path and file name of the previous driver on the target computer. The syntax for OldDriver is the same as that of the first line after map in a driver
replacement file. For more information about this syntax, see Mapping Driver Files.
NewDriver
Specifies the path and file name of the new driver. This driver can be on the host computer or at some other network location. The syntax for NewDriver is the same as
that of the second line after map in a driver replacement file. For more information about this syntax, see Mapping Driver Files.
-s
Creates a file and writes the current driver replacement associations to that file.
SaveFile
Specifies the name of the file to create.
-c
Deletes the existing driver replacement map. (This option does not alter the map file itself. Instead, this option clears the debugger's current map settings.)
Environment
You can use the .kdfiles command in Microsoft Windows XP and later versions of Windows. If you use this command in earlier versions of Windows, the command has no
effect and does not generate an error.
Modes
Kernel mode only
Targets Live debugging only
Platforms x86-based and Itanium-based processors only
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Comments
If you use the .kdfiles command without parameters, the debugger displays the path and name of the current driver replacement map file and the current set of replacement
associations.
When you run this command, the specified MapFile file is read. If the file is not found or if it does not contain text in the proper format, the debugger displays a message that
states, "Unable to load file associations".
If the specified file is in the correct driver replacement map file format, the debugger loads the file's contents and uses them as the driver replacement map. This map remains
until you exit the debugger, or until you issue another .kdfiles command.
After the file has been read, the driver replacement map is not affected by subsequent changes to the file (unless these changes are followed by another .kdfiles command).
Requirements
Versions: Supported in Windows XP and later versions of the Windows operating system.
Additional Information
For more information about and examples of driver replacement and the replacement of other kernel-mode modules, a description of the format for driver replacement map
files, and restrictions for using this feature, see Mapping Driver Files.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
.kill [ /h | /n ]
Kernel-Mode Syntax
.kill Process
Parameters
/h
(User mode only) Any outstanding debug event will be continued and marked as handled. This is the default.
/n
(User mode only) Any outstanding debug event will be continued without being marked as handled.
Process
Specifies the address of the process to be terminated. If Process is omitted or zero, the default process for the current system state will be terminated.
Environment
In kernel mode, this command is supported only on Microsoft Windows Server 2003 and later versions of Windows.
Modes
user mode, kernel mode
Targets live debugging only
Platforms all
Comments
In user mode, the .kill command ends the debugging session, closes the target application, and returns the debugger to dormant mode.
In kernel mode, this command schedules the selected process on the target computer for termination. The next time that the target can run (for example, by using a g (Go)
command), the specified process is ended.
You cannot use this command during local kernel debugging.
Requirements
Versions: (Kernel mode) Supported in Windows Server 2003 and later.
Additional Information
For more information about how to end or detach from a user-mode target, see Ending the Debugging Session.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Additional Information
For more information about how to load, unload, and control extensions, see Loading Debugger Extension DLLs.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Note When you are appending to an existing log file, you should use the /u parameter only if you created the log file by using the /u option. Otherwise, your log file will
contain ASCII and Unicode characters, which might make it more difficult to read.
FileName
Specifies the name of the log file. You can specify a full path or only the file name. If the file name contains spaces, enclose FileName in quotation marks. If you do not
specify the path, the debugger uses the current directory. If you omit FileName, the debugger names the file Dbgeng.log.
Environment
Modes
User mode, kernel mode
Targets Live, crash dump
Platforms All
Comments
If you already have a log file open when you run the .logappend command, the debugger closes the log file. If you specify the name of a file that already exists, the debugger
appends new information to the file. If the file does not exist, the debugger creates it.
Additional Information
For more information and other commands that affect log files, see Keeping a Log File.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Environment
Modes
User mode, kernel mode
Targets Live, crash dump
Platforms All
Comments
The .netuse command behaves like the net use Microsoft MS-DOS command.
If you use .netuse during a remote debugging session, this command affects the debugging server, not the debugging client.
The following example shows this command.
0:000> .netuse "m:" "\\myserver\myshare" "" ""
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The .ofilter command filters the output from the target application or target computer.
Syntax
.ofilter [/!] String
.ofilter ""
.ofilter
Parameters
/!
Reverses the filter so that the debugger displays only output that does not contain String. If you do not use this parameter, the debugger displays only output that contains
String.
String
Specifies the string to match in the target's output. String can include spaces, but you cannot use C-style control characters such as \" and \n. String might contain a
variety of wildcard characters and specifiers. For more information about the syntax, see String Wildcard Syntax.
You can enclose String in quotation marks. However, if String includes a semicolon, leading spaces, or trailing spaces, you must use quotation marks. Alphanumeric
characters in String are converted to uppercase letters, but the actual pattern matching is case insensitive.
Environment
Modes
User mode, kernel mode
Targets Live, crash dump
Platforms All
Comments
If you use the .ofilter command without parameters, the debugger displays the current pattern-matching criteria.
To clear the existing filter, use .ofilter "". This command filters any data that is sent by user-mode routines (such as OutputDebugString) and kernel-mode routines (such as
DbgPrint). However, the debugger always displays prompts that DbgPrompt sends.
The DbgPrintEx and KdPrintEx routines supply another method of filtering debugging messages that you do not want.
Additional Information
For more information about OutputDebugString and other user-mode routines, see the Microsoft Windows SDK documentation. For more information about DbgPrint,
DbgPrintEx, and other kernel-mode routines, see the Windows Driver Kit (WDK).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Additional Information
For more information about source files and source paths and for other ways to load source files, see Source Path.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Preserves the current value of the log file's output mask. If you do not include /l, the log file's output mask is the same as the regular output mask.
/a
Activates all mask flags. This parameter is equivalent to .outmask 0xFFFFFFFF.
/d
Restores the output mask to the default value. This parameter is equivalent to .outmask 0x3F7.
Environment
Modes
User mode, kernel mode
Targets Live, crash dump
Platforms All
Comments
Each output mask flag enables the debugger to display certain output in the Debugger Command Window. If all of the mask flags are set, all output is displayed.
You should remove output mask flags with caution, because you might be unable to read debugger output.
The following flag values exist.
Value Default setting
Description
1
On
Normal output
2
On
Error output
4
On
Warnings
8
Off
Additional output
0x10 On
Prompt output
0x20 On
Register dump before prompt
0x40 On
Warnings that are specific to extension operation
0x80 On
Debug output from the target (for example, OutputDebugString or DbgPrint)
0x100 On
Debug input expected by the target (for example, DbgPrompt)
0x200 On
Symbol messages (for example, !sym noisy)
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
In Windows Server 2003 and Windows XP, you can page in only user-mode addresses by using .pagein. You can override this restriction by using the /f switch, but we do not
recommend that you use this switch. In Windows Vista, you can safely page in user-mode and kernel-mode memory.
Caution If you use .pagein on an address in a kernel stack in Windows Server 2003 or Windows XP, a bug check might occur.
Requirements
Versions: Supported in Windows XP and later versions of Windows.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
jnz
Prymes!isPrime+0xdd (004016cd)
0:000> .ttime
Created: Thu Aug 21 13:18:59 2003
Kernel: 0 days 0:00:00.031
User:
0 days 0:00:00.000
0:000> .pcmd -s "r $tpid, $tid"
Per-prompt command is 'r $tpid, $tid'
0:000> t
Prymes!isPrime+0xdd:
004016cd ebc0
jmp
Prymes!isPrime+0x9f (0040168f)
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
$tpid=0000080c $tid=00000514
0:000> t
Prymes!isPrime+0x9f:
0040168f 8b55fc
mov
$tpid=0000080c $tid=00000514
edx,[ebp-0x4]
ss:0023:0012fea8=00000005
Additional Information
For more information about the Debugger Command window prompt, see Using Debugger Commands.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
(Live debugging only) Translates all transition page table entries (PTEs) to physical addresses before access, if you use /P and Process is nonzero. Unlike the /p option,
the /P option translates the PTEs for all user-mode and kernel-mode processes, not only the specified process. This translation might cause slowdowns, because the
debugger must find the physical addresses for all memory in use. Also, the debugger might have to transfer lots of data across the debug cable. (This behavior is the same
as .cache forcedecodeptes.)
Process
Specifies the address of the process that you want. (More precisely, this parameter specifies the address of the EPROCESS block for this process). The process context is
set to this process. If you omit Process or specify zero, the process context is reset to the default process for the current system state. (If you used the /i option to set
process context, you must use the /i option to reset the process context.)
Environment
Modes
Kernel mode only
Targets Live, crash dump
Platforms All
Comments
Typically, when you are doing kernel debugging, the only visible user-mode address space is the one that is associated with the current process.
The .process command instructs the kernel debugger to use a specific user-mode process as the process context. This usage has several effects, but the most important is that
the debugger has access to the virtual address space of this process. The debugger uses the page tables for this process to interpret all user-mode memory addresses, so you
can read and write to this memory.
The .context (Set User-Mode Address Context) command has a similar effect. However, the .context command sets the user-mode address context to a specific page
directory, while the .process command sets the process context to a specific process. On an x86-based processor, .context and .process have almost the same effect. However,
on an Itanium-based processor, a single process might have more than one page directory. In this situation, the .process command is more powerful, because it enables access
to all of the page directories that are associated with a process. For more information about the process context, see Process Context.
Note If you are performing live debugging, you should use the /i or the /p parameter. Without one of these parameters, you cannot correctly display user-mode or session
memory.
The /i parameter activates the target process. When you use this option, you must execute the target once for this command to take effect. If you execute again, the process
context is lost.
The /p parameter enables the forcedecodeuser setting. (You do not have to use /p if the forcedecodeuser option is already active.) The process context and the
forcedecodeuser state remain only until the target executes again.
If you are performing crash dump debugging, the /i and /p options are not available. However, you cannot access any part of the user-mode process' virtual address space that
were paged to disk when the crash occurred.
If you want to use the kernel debugger to set breakpoints in user space, use the /i option to switch the target to the correct process context.
The following example shows how to use the !process extension to find the address of the EPROCESS block for the desired process.
kd> !process 0 0
**** NT ACTIVE PROCESS DUMP ****
PROCESS fe5039e0 SessionId: 0 Cid: 0008
Peb: 00000000 ParentCid: 0000
DirBase: 00030000 ObjectTable: fe529b68 TableSize: 50.
Image: System
.....
PROCESS fe3c0d60 SessionId: 0 Cid: 0208
Peb: 7ffdf000 ParentCid: 00d4
DirBase: 0011f000 ObjectTable: fe3d0f48 TableSize: 30.
Image: regsvc.exe
Now the example uses the .process command with this process address.
kd> .process fe3c0d60
Implicit process is now fe3c0d60
Notice that this command makes the .context command unnecessary. The user-mode address context already has the desired value.
kd> .context
User-mode page directory base is 11f000
This value enables you to examine the address space in various ways. For example, the following example shows the output of the !peb extension.
kd> !peb
PEB at 7FFDF000
InheritedAddressSpace:
No
ReadImageFileExecOptions: No
BeingDebugged:
No
ImageBaseAddress:
01000000
Ldr.Initialized: Yes
Ldr.InInitializationOrderModuleList: 71f40 . 77f68
Ldr.InLoadOrderModuleList: 71ec0 . 77f58
Ldr.InMemoryOrderModuleList: 71ec8 . 77f60
01000000 C:\WINNT\system32\regsvc.exe
77F80000 C:\WINNT\System32\ntdll.dll
77DB0000 C:\WINNT\system32\ADVAPI32.dll
77E80000 C:\WINNT\system32\KERNEL32.DLL
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
77D40000 C:\WINNT\system32\RPCRT4.DLL
77BE0000 C:\WINNT\system32\secur32.dll
SubSystemData:
0
ProcessHeap:
70000
ProcessParameters: 20000
WindowTitle: 'C:\WINNT\system32\regsvc.exe'
ImageFile:
'C:\WINNT\system32\regsvc.exe'
CommandLine: 'C:\WINNT\system32\regsvc.exe'
DllPath:
'C:\WINNT\system32;.;C:\WINNT\System32;C:\WINNT\system;C:\WINNT;C:\WINNT\system32;C:\WINNT;C:\WI
Environment: 0x10000
Additional Information
For more information about the process context and other context settings, see Changing Contexts.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
src
Do not
dis
reg
Additional Information
For more information about commands that affect execution, see Controlling the Target.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Parameters
/r
Specifies that the current values in the pseudo-registers $t0 to $t19, should be saved. If the /r parameter is not used, these values are not saved by the .push command.
/q
Specifies that the command executes quietly. That is, the command executes without displaying any output.
Environment
Modes
User mode, kernel mode
Targets Live, crash dump
Platforms All
Comments
This command is most useful when used with scripts and debugger command programs so that they can work with one fixed state. To restore the debugger to a state that was
previously saved using this command, use the .pop (Restore Debugger State) command. If the command is successful, no output is displayed.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Without parameters, .quit_lock displays the current lock status, including the full text of the password.
You can repeat the .quit_lock /s command to change an existing password.
When you use .quit_lock /q, the lock is removed. This command does not close the debugger. Instead, the command only enables you to exit the session in the typical manner
when you want to.
Note The password is not "secret". Any remote user who is attached to the debugging session can use .quit_lock to determine the password. The purpose of this command is
to prevent accidental use of the q (Quit) command. This command is especially useful if restarting the debugging session might be difficult (for example, during remote
debugging).
You cannot use the .quit_lock /s command in Secure Mode. If you use this command before Secure Mode is activated, the password protection remains, but you cannot
change or remove the password.
Additional Information
For more information about the various methods of exiting the debugger or detaching from the target, see Ending the Debugging Session.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
For more information about related commands and an explanation of how the restart process affects the debugger, see Crashing and Rebooting the Target Computer.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Reloads user symbols only. (You can use this option only during kernel-mode debugging.)
/v
Turns on verbose mode.
/w
Treats Module as a literal string. This treatment prevents the debugger from expanding wildcard characters.
Module
Specifies the name of an image on the target system for which to reload symbols on the host computer. Module should include the name and file name extension of the
file. Unless you use the /w option, Module might contain a variety of wildcard characters and specifiers. For more information about the syntax, see String Wildcard
Syntax. If you omit Module, the behavior of the .reload command depends on which Options you use.
Address
Specifies the base address of the module. Typically, you have to have this address only if the image header has been corrupted or is paged out.
Size
Specifies the size of the module image. In many situations, the debugger knows the correct size of the module. When the debugger does not know the correct size, you
should specify Size. This size can be the actual module size or a larger number, but the size should not be a smaller number. Typically, you have to have this size only if
the image header has been corrupted or is paged out.
Timestamp
Specifies the timestamp of the module image. In many situations, the debugger knows the correct timestamp of the module. When the debugger does not know the
timestamps, you should specify Timestamp. Typically, you have to have this timestamp only if the image header has been corrupted or is paged out.
-?
Displays a short help text for this command.
Environment
Modes
User mode, kernel mode
Targets Live, crash dump
Platforms All
Comments
The .reload command does not cause symbol information to be read. Instead, this command lets the debugger know that the symbol files might have changed or that a new
module should be added to the module list. This command causes the debugger to revise its module list and delete its symbol information for the specified modules. The
actual symbol information is not read from the individual .pdb files until the information is needed. (This kind of loading is known as lazy symbol loading or deferred symbol
loading.)
You can force symbol loading to occur by using the /f option or by issuing an ld (Load Symbols) command.
The .reload command is useful if the system stops responding (that is, crashes), which might cause you to lose symbols for the target computer that is being debugged. The
command can also be useful if you have updated the symbol tree.
If the image header is incorrect for some reason, such as the module being unloaded, or is paged out, you can load symbols correctly by using the /unl argument, or specifying
both Address and Size.
The .reload /u command performs a broad search. The debugger first tries to match Module with an exact module name, regardless of path. If the debugger cannot find this
match, Module is treated as the name of the loaded image. For example, if the HAL that resides in memory has the module name of halacpi.dll, both of the following
commands unload its symbols.
kd> .reload /u halacpi.dll
kd> .reload /u hal
If you are performing user-mode debugging and want to load a module that is not part of the target application's module list, you must include the /s option, as the following
example shows.
0:000> .reload /u ntdll.dll
Unloaded ntdll.dll
0:000> .reload /s /f ntdll.dll
Additional Information
For more information about deferred (lazy) symbol loading, see Deferred Symbol Loading. For more information about other symbol options, see Setting Symbol Options.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Modes
User mode only
Targets Live debugging only
Platforms All
Comments
CDB and WinDbg can restart a target application if the debugger originally created the application. You can use the .restart command even if the target application has
already closed.
However, if the application is running and the debugger is later attached to the process, the .restart command has no effect.
After the process is restarted, it immediately breaks into the debugger.
In WinDbg, use the View | WinDbg Command Line command if you started your target from the WinDbg command prompt and you want to review this command line
before you decide whether to use .restart.
Additional Information
For more information about how to issue this command and an overview of related commands, see Controlling the Target.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
After
Specifies how many source lines after the line you are scrolling to should be visible in the Source window.
Environment
This command is available only in WinDbg and cannot be used in script files.
Modes
user mode, kernel mode
Targets live, crash dump
Platforms all
Comments
When this command is used with no parameters, the current source scrolling preferences are displayed.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
server is running.
-s
Causes the debugger to copy all loaded symbol files.
Environment
Modes
user mode, kernel mode
Targets live, crash dump
Platforms all
Comments
This command is particularly useful when you have been performing remote debugging through a process server, but wish to begin debugging locally instead. In this case you
can use the .send_file -s command to copy all the symbol files that the debugger has been using to the process server. These symbol files can then be used by a debugger
running on the local computer.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
npipe:pipe=PipeName[,hidden][,password=Password][,IcfEnable]
tcp:port=Socket[,hidden][,password=Password][,ipversion=6][,IcfEnable]
tcp:port=Socket,clicon=Client[,password=Password][,ipversion=6]
com:port=COMPort,baud=BaudRate,channel=COMChannel[,hidden][,password=Password]
spipe:proto=Protocol,{certuser=Cert|machuser=Cert},pipe=PipeName[,hidden][,password=Password]
ssl:proto=Protocol,{certuser=Cert|machuser=Cert},port=Socket[,hidden][,password=Password]
ssl:proto=Protocol,{certuser=Cert|machuser=Cert},port=Socket,clicon=Client[,password=Password]
Parameters
PipeName
When NPIPE or SPIPE protocol is used, PipeName is a string that will serve as the name of the pipe. Each pipe name should identify a unique debugging server. If you
attempt to reuse a pipe name, you will receive an error message. PipeName must not contain spaces or quotation marks. PipeName can include a numerical printf-style
format code, such as %x or %d. The debugger will replace this with the process ID of the debugger. A second such code will be replaced with the thread ID of the
debugger.
Socket
When TCP or SSL protocol is used, Socket is the socket port number.
It is also possible to specify a range of ports separated by a colon. The debugger will check each port in this range to see if it is free. If it finds a free port and no error
occurs, the debugging server will be created. The debugging client will have to specify the actual port being used to connect to the server. To determine the actual port,
use any of the methods described in Searching for Debugging Servers; when this debugging server is displayed, the port will be followed by two numbers separated by a
colon. The first number will be the actual port used; the second can be ignored. For example, if the port was specified as port=51:60, and port 53 was actually used, the
search results will show "port=53:60". (If you are using the clicon parameter to establish a reverse connection, the debugging client can specify a range of ports in this
manner, while the server must specify the actual port used.)
clicon=Client
When TCP or SSL protocol is used and the clicon parameter is specified, a reverse connection will be opened. This means that the debugging server will try to connect to
the debugging client, instead of letting the client initiate the contact. This can be useful if you have a firewall that is preventing a connection in the usual direction. Client
specifies the network name of the machine on which the debugging client exists or will be created. The two initial backslashes (\\) are optional.
Note When clicon is used, it is best to start the debugging client before the debugging server is created, although the usual order (server before client) is also permitted.
A reverse-connection server will not appear when another debugger displays all active servers.
COMPort
When COM protocol is used, COMPort specifies the COM port to be used. The prefix COM is optional (for example, both "com2" and "2" are acceptable).
BaudRate
When COM protocol is used, BaudRate specifies the baud rate at which the connection will run. Any baud rate that is supported by the hardware is permitted.
COMChannel
If COM protocol is used, COMChannel specifies the COM channel to be used in communicating with the debugging client. This can be any value between 0 and 254,
inclusive.
Protocol
If SSL or SPIPE protocol is used, Protocol specifies the Secure Channel (S-Channel) protocol. This can be any one of the strings tls1, pct1, ssl2, or ssl3.
Cert
If SSL or SPIPE protocol is used, Cert specifies the certificate. This can either be the certificate name or the certificate's thumbprint (the string of hexadecimal digits
given by the certificate's snapin). If the syntax certuser=Cert is used, the debugger will look up the certificate in the system store (the default store). If the syntax
machuser=Cert is used, the debugger will look up the certificate in the machine store. The specified certificate must support server authentication.
hidden
Prevents the server from appearing when another debugger displays all active servers.
password=Password
Requires a debugging client to supply the specified password in order to connect to the debugging session. Password can be any alphanumeric string.
ipversion=6
(Debugging Tools for Windows 6.6.07 and earlier only) Forces the debugger to use IP version 6 rather than version 4 when using TCP to connect to the Internet. In
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Windows Vista and later versions, the debugger attempts to auto-default to IP version 6, making this option unnecessary.
IcfEnable
(Windows XP and later versions only) Causes the debugger to enable the necessary port connections for TCP or named pipe communication when the Internet
Connection Firewall is active. By default, the Internet Connection Firewall disables the ports used by these protocols. When IcfEnable is used with a TCP connection,
the debugger causes Windows to open the port specified by the Socket parameter. When IcfEnable is used with a named pipe connection, the debugger causes Windows
to open the ports used for named pipes (ports 139 and 445). The debugger does not close these ports after the connection terminates.
Environment
Modes
user mode, kernel mode
Targets live, crash dump
Platforms all
Comments
This command turns the current debugger into a debugging server. This allows you to start the server after the debugger is already running, whereas the -server command-line
option can only be issued when the debugger is started.
This permits a debugging client to connect to the current debugging session. Note that it is possible to start multiple servers using different options, allowing different kinds of
debugging clients to join the session.
Additional Information
For full details on how to start a debugging server, see Activating a Debugging Server. For examples, see Client and Server Examples.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Parameters
DLLName
The name and path of the extension DLL. If the full path was specified when the DLL was loaded, it needs to be given in full here as well.
Environment
Modes
user mode, kernel mode
Targets live, crash dump
Platforms all
Comments
The debugger maintains a default extension DLL that is implicitly loaded when the debugger is started. This allows the user to specify an extension command without first
having to load an extension DLL. This command allows modification of which DLL is loaded as the default DLL.
When a command is issued, the debugger looks for it in the default extension first. If a match is not found, all other loaded extension DLLs are searched in the order they were
loaded.
Additional Information
For details on loading, unloading, and controlling extensions, see Loading Debugger Extension DLLs. For details on executing extension commands, see Using Debugger
Extension Commands.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
To close this shell and return to the debugger itself, type exit or .shell_quit. (The .shell_quit command is more powerful, because it works even if the shell is frozen.)
This command cannot be used while debugging CSRSS, because new processes cannot be created without CSRSS being active.
You can use the -ci flag to run one or more debugger commands and then pass their output to a shell process. For example, you could pass the output from the !process 0 7
command to a Perl script by using the following command:
0:000> .shell -ci "!process 0 7" perl.exe parsemyoutput.pl
Additional Information
For other ways of accessing the command shell, see Using Shell Commands.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
/ef File
Causes the sound contained in the specified file to be played when WinDbg enters the wait-for-command state.
/d
Disables the playing of sounds.
Environment
This command is available only in WinDbg and cannot be used in script files.
Modes
user mode, kernel mode
Targets live, crash dump
Platforms all
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Syntax
.srcnoisy [Options]
Parameters
Options
Can be any one of the following options:
0
Disables the display of extra messages.
1
Displays information about the progress of source file loading and unloading.
2
Displays information about the progress of symbol file loading and unloading.
3
Displays all information displayed by options 1 and 2.
Environment
Modes
user mode, kernel mode
Targets live, crash dump
Platforms all
Comments
With no parameters, .srcnoisy will display the current status of noisy source loading.
When parameter 2 (or 3) is selected, symbol loading information is filtered so that only symbol loading messages beginning with
are displayed. However, if the symbol information is already set to be displayed because SYMOPT_DEBUG is on, then this option will display symbol loading information
without filtering.
Note Noisy source loading should not be confused with noisy symbol loading that is controlled by the !sym noisy extension and by other means of controlling the
SYMOPT_DEBUG setting.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Parameters
0
Suspends the refresh of WinDbg debugging information windows.
1
Enables the refresh of WinDbg debugging information windows.
Environment
This command is available only in WinDbg and cannot be used in script files.
Modes
kernel mode only
Targets live, crash dump
Platforms all
Comments
Without any parameters, .suspend_ui displays whether debugging information windows are currently suspended.
By default, debugging information windows are refreshed every time the information they display changes.
Suspending the refresh of these windows can speed up WinDbg during a sequence of quick operations for example, when tracing or stepping many times in quick
succession.
Additional Information
For information about debugging information windows, see Using Debugging Information Windows.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Syntax
.symopt+ Flags
.symopt- Flags
.symopt
Parameters
+
Causes the symbol options specified by Flags to be set. If .symopt is used with Flags but no plus or minus sign, a plus sign is assumed.
Causes the symbol options specified by Flags to be cleared.
Flags
Specifies the symbol options to be changed. Flags must be the sum of the bit flags of these symbol options.
Environment
Modes
user mode, kernel mode
Targets live, crash dump
Platforms all
Comments
Without any arguments, .symopt displays the current symbol options.
Additional Information
For a list and description of each symbol option, its bit flag, and other methods of setting and clearing these options, see Setting Symbol Options.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Syntax
.thread [/p [/r] ] [/P] [/w] [Thread]
Parameters
/p
(Live debugging only) If this option is included and Thread is nonzero, all transition page table entries (PTEs) for the process owning this thread will be automatically
translated into physical addresses before access. This may cause slowdowns, because the debugger will have to look up the physical addresses for all the memory used by
this process, and a significant amount of data may need to be transferred across the debug cable. (This behavior is the same as that of .cache forcedecodeuser.)
If the /p option is included and Thread is zero or omitted, this translation will be disabled. (This behavior is the same as that of .cache noforcedecodeuser.)
/r
(Live debugging only) If the /r option is included along with the /p option, user-mode symbols for the process owning this thread will be reloaded after the process and
register contexts have been set. (This behavior is the same as that of .reload /user.)
/P
(Live debugging only) If this option is included and Thread is nonzero, all transition page table entries (PTEs) will be automatically translated into physical addresses
before access. Unlike the /p option, this translates the PTEs for all user-mode and kernel-mode processes, not only the process owning this thread. This may cause
slowdowns, because the debugger will have to look up the physical addresses for all memory in use, and a huge amount of data may need to be transferred across the
debug cable. (This behavior is the same as that of .cache forcedecodeptes.)
/w
(64-bit kernel debugging only) Changes the active context for the thread to the WOW64 32-bit context. The thread specified must be running in a process that has a
WOW64 state.
Thread
The address of the thread. If this is omitted or zero, the thread context is reset to the current thread.
Environment
Modes
kernel mode only
Targets live, crash dump
Platforms all
Comments
Generally, when you are doing kernel debugging, the only visible registers are the ones associated with the current thread.
The .thread command instructs the kernel debugger to use the specified thread as the register context. After this command is executed, the debugger will have access to the
most important registers and the stack trace for this thread. This register context persists until you allow the target to execute or use another register context command
(.thread, .cxr, or .trap). See Register Context for full details.
The /w option can only be used in 64-bit kernel debugging sessions on a thread running in a process that has a WOW64 state. The context retrieved will be the last context
remembered by WOW64; this is usually the last user-mode code executed by Thread. This option can only be used if the target is in native machine mode. For example, if the
target is running on a 64-bit machine that is emulating an x86-based processor using WOW64, this option cannot be used. Using the /w option will cause the machine mode to
switch automatically to an x86-based processor.
This command does not actually change the current thread. In other words, extensions such as !thread and !teb will still default to the current thread if no arguments are used
with them.
Here is an example. Use the !process extension to find the address of the desired thread. (In this case, !process 0 0 is used to list all processes, then !process is used a second
time to list all the threads for the desired process.)
kd> !process 0 0
**** NT ACTIVE PROCESS DUMP ****
PROCESS fe5039e0 SessionId: 0 Cid: 0008
Peb: 00000000 ParentCid: 0000
DirBase: 00030000 ObjectTable: fe529a88 TableSize: 145.
Image: System
.....
PROCESS ffaa5280 SessionId: 0 Cid: 0120
Peb: 7ffdf000 ParentCid: 01e0
DirBase: 03b70000 ObjectTable: ffaa4e48 TableSize: 23.
Image: winmine.exe
kd> !process ffaa5280
PROCESS ffaa5280 SessionId: 0 Cid: 0120
Peb: 7ffdf000 ParentCid: 01e0
DirBase: 03b70000 ObjectTable: ffaa4e48 TableSize: 23.
Image: winmine.exe
VadRoot ffaf6e48 Clone 0 Private 50. Modified 0. Locked 0.
DeviceMap fe502e88
Token
e1b55d70
.....
THREAD ffaa43a0 Cid 120.3a4 Teb: 7ffde000
ffadc6a0 SynchronizationEvent
Not impersonating
Owning Process ffaa5280
WaitTime (seconds)
24323
Context Switch Count
494
LargeStack
.....
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Now use the .thread command with the address of the desired thread. This sets the register context and enables you to examine the important registers and the call stack for
this thread.
kd> .thread ffaa43a0
Using context of thread ffaa43a0
kd> r
Last set context:
eax=00000000 ebx=00000000 ecx=00000000 edx=00000000 esi=00000000 edi=00000000
eip=80403a0d esp=fd581c2c ebp=fd581c60 iopl=0
nv up di pl nz na pe nc
cs=0000 ss=0000 ds=0000 es=0000 fs=0000 gs=0000
efl=00000000
0000:3a0d ??
???
kd> k
*** Stack trace for last set context - .thread resets it
ChildEBP RetAddr
fd581c38 8042d61c ntoskrnl!KiSwapThread+0xc5
00001c60 00000000 ntoskrnl!KeWaitForSingleObject+0x1a1
Additional Information
For more information about the register context and other context settings, see Changing Contexts.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
.typeopt +FlagName
.typeopt -FlagName
.typeopt
Parameters
+
Causes the type options specified by Flags to be set.
Causes the type options specified by Flags to be cleared.
Flags
Specifies the type options to be changed. Flags can be a sum of any of the following values (there is no default):
0x1
Displays values in all Watch windows and the Locals window as having UNICODE data type.
0x2
Displays values in all Watch windows and the Locals window as having LONG data type.
0x4
Displays integers in all Watch windows and the Locals window in the default radix.
0x8
Causes the debugger to choose the matching symbol with the largest size when the Locals window or Watch window references a symbol by name but there is more
than one symbol that matches this name. The size of a symbol is defined as follows: if the symbol is the name of a function, its size is the size of the function in
memory. Otherwise, the size of the symbol is the size of the data type that it represents.
FlagName
Specifies the type options to be changed. Flag can be any one of the following strings (there is no default):
uni
Displays values in all Watch windows and the Locals window as having UNICODE data type. (This has the same effect as 0x1.)
longst
Displays values in all Watch windows and the Locals window as having LONG data type. (This has the same effect as 0x2.)
radix
Displays integers in all Watch windows and the Locals window in the default radix. (This has the same effect as 0x4.)
size
Causes the debugger to choose the matching symbol with the largest size when the Locals window or Watch window references a symbol by name but there is more
than one symbol that matches this name. The size of a symbol is defined as follows: if the symbol is the name of a function, its size is the size of the function in
memory. Otherwise, the size of the symbol is the size of the data type that it represents. (This has the same effect as 0x8.)
Environment
Modes
user mode, kernel mode
Targets live, crash dump
Platforms all
Comments
Without any arguments, .typeopt displays the current symbol options.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The .write_cmd_hist command writes the entire history of the Debugger Command window to a file.
Syntax
.write_cmd_hist Filename
Parameters
Filename
Specifies the path and filename of the file that will be created.
Environment
This command is available only in WinDbg and cannot be used in script files.
Modes
user mode, kernel mode
Targets live, crash dump
Platforms all
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Modes
user mode, kernel mode
Targets live, crash dump
Platforms all
Comments
For CDB, NTSD, or KD, if the .wtitle command has not been used, the window title matches the command line used to launch the debugger.
For WinDbg, if .wtitle has not bee used, the main window title includes the name of the target. If a debugging server is active, its connection string is displayed as well. If
multiple debugging servers are active, only the most recent one is displayed.
When .wtitle is used, Title replaces all this information. Even if a debugging server is started later, Title will not change.
The WinDbg version number is always displayed in the window title bar, regardless of whether this command is used.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Control Keys
This section of the reference discusses the various control keys that can be used in the debuggers.
These control keys work in KD and, in some cases, CDB. Many of these also work in WinDbg (using the CTRL+ALT keys instead of just CTRL).
WinDbg also uses the CTRL key, the ALT key, and the F keys as shortcut keys to toggle the menu options. See Shortcut Keys for a list of their meanings.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ENTER
WinDbg Syntax
CTRL+ALT+A
Environment
Debuggers KD and WinDbg only
Modes
kernel mode only
Targets
live debugging only
Platforms all
Comments
This will cycle through all available baud rates for the kernel debugging connection.
Supported baud rates are 19200, 38400, 57600, and 115200. Each time this control key is used, the next baud rate will be selected. If the baud rate is already at 115200, it will
be reduced to 19200.
In WinDbg, this can also be accomplished by selecting Debug | Kernel Connection | Cycle Baud Rate.
You cannot actually use this control key to change the baud rate at which you are debugging. The baud rate of the host computer and the target computer must match, and the
baud rate of the target computer cannot be changed without rebooting. Therefore, you only need to toggle through the baud rates if the two computers are attempting to
communicate at different rates. In this case, you must change the host computer's baud rate to match that of the target computer.
To change the target computer's baud rate, see Configuring Software on the Target Computer.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
ENTER
Environment
Debuggers CDB and KD only
Modes
user mode, kernel mode
Targets
live, crash dump
Platforms all
Comments
In CDB, the q (Quit) command should be used to exit. CTRL+B should only be used if the debugger is not responding.
In KD, the q command will end the debugging session and leave the target computer locked. If you need to preserve the debugging session (so a new debugger can connect to
it), or if you need to leave the target computer running, you should use CTRL+B.
In WinDbg, the equivalent command is File | Exit or ALT+F4.
Additional Information
For other methods of exiting the debugger or detaching from the target, see Ending the Debugging Session.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
CTRL+C (Break)
The CTRL+C key breaks into the debugger, stopping the target application or target computer, and cancels debugger commands.
Syntax
CDB Syntax
CTRL+C
KD Syntax
CTRL+C
Target Computer Syntax
SYSRQ
ALT+SYSRQ
F12
Environment
Debuggers CDB and KD only
Modes
user mode, kernel mode
Targets
live, crash dump
Platforms all
Comments
When Using CDB:
In user mode, the CTRL+C key causes the target application to break into the debugger. The target application freezes, the debugger becomes active, and debugger commands
can be entered.
If the debugger is already active, CTRL+C does not affect the target application. It can be, however, used to terminate a debugger command. For instance, if you have
requested a long display and no longer want to see it, CTRL+C will end the display and return you to the debugger command prompt.
When performing remote debugging with CDB, CTRL+C can be pressed on the host computer's keyboard. If you want to issue a break from the target computer's keyboard,
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
ENTER
WinDbg Syntax
CTRL+ALT+D
Environment
Debuggers KD and WinDbg only
Modes
kernel mode only
Targets
live debugging only
Platforms all
Comments
When this is toggled on, the debugger outputs information about the communication between the host computer and the target computer.
This key can be used to test whether the debugger has crashed. If you suspect that either the debugger or the target is frozen, use this key. If you see packets being sent, the
target is still working. If you see time-out messages, then the target is not responding. If there are no messages at all, the debugger has crashed.
If the target is not responding, use CTRL+R ENTER CTRL+C. If time-out messages continue to appear, the target has crashed (or the debugger was misconfigured).
This is also useful for debugging the KD debugger itself.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
ENTER
Environment
Debuggers CDB, KD
Modes
user mode, kernel mode
Targets
live, crash dump
Platforms all
Comments
Under typical conditions, CTRL+F is identical to the standard break commands (CTRL+C in KD and CDB, and Debug | Break or CTRL+BREAK in WinDbg.)
However, if you are debugging KD with CDB, these two keys will work differently. CTRL+C will be intercepted by the host debugger (CDB), while CTRL+F will be
intercepted by the target debugger (KD).
See Also
.breakin (Break to the Kernel Debugger)
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ENTER
WinDbg Syntax
CTRL+ALT+K
Environment
Debuggers KD and WinDbg only
Modes
kernel mode only
Targets
live debugging only
Platforms all
Comments
This control key causes the kernel debugger to cycle through the following three states:
No break
In this state, the debugger will not break into the target computer unless you press CTRL+C.
Break on reboot
In this state, the debugger will break into a rebooted target computer after the kernel initializes. This is equivalent to starting KD or WinDbg with the -b command-line
option.
Break on first module load
In this state, the debugger will break into a rebooted target computer after the first kernel module is loaded. (This will cause the break to occur earlier than in the Break
on reboot option.) This is equivalent to starting KD or WinDbg with the -d command-line option.
When CTRL+K is used, the new break state is displayed.
In WinDbg, this can also be accomplished by selecting Debug | Kernel Connection | Cycle Initial Break.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Additional Information
For an overview of related commands and an explanation of how the reboot process affects the debugger, see Crashing and Rebooting the Target Computer.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ENTER
Environment
Debuggers CDB and KD only
Modes
user mode, kernel mode
Targets
live, crash dump
Platforms all
Comments
This is equivalent to launching a new CDB through the remote.exe utility, and using it to debug the debugger that you are already running.
CTRL+P is similar to the .dbgdbg (Debug Current Debugger) command. However,.dbgdbg is more versatile, because it can be used from WinDbg as well as KD and CDB,
and it can be used to debug a debugging server on a remote computer.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
CTRL+R (Re-synchronize)
The CTRL+R key synchronizes with the target computer.
Syntax
KD Syntax
CTRL+R
ENTER
WinDbg Syntax
CTRL+ALT+R
Environment
Debuggers KD and WinDbg only
Modes
kernel mode only
Targets
live debugging only
Platforms all
Comments
This attempts to synchronize the host computer with the target computer. Use this key if the target is not responding.
If you are using a 1394 kernel connection, resynchronization may not always be successful.
Additional Information
For other methods of re-establishing contact with the target, see Synchronizing with the Target Computer.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
ENTER
WinDbg Syntax
CTRL+ALT+V
Environment
Debuggers CDB, KD, WinDbg
Modes
user mode, kernel mode
Targets
live, crash dump
Platforms all
Comments
When verbose mode is turned on, some display commands (such as register dumping) produce more detailed output. Every MODULE LOAD operation that is sent to the
debugger will be displayed. And every time a driver or DLL is loaded by the operating system, the debugger will be notified.
In WinDbg, this can also be accomplished by selecting View | Verbose Output.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ENTER
WinDbg Syntax
CTRL+ALT+W
Environment
Debuggers CDB, KD, WinDbg
Modes
user mode, kernel mode
Targets
live, crash dump
Platforms all
Comments
This has the same effect as the version (Show Debugger Version) command, except that the latter command displays the Windows operating system version as well.
In WinDbg, this can also be accomplished by selecting View | Show Version.
See Also
version (Show Debugger Version), vertarget (Show Target Computer Version)
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
General Extensions
This section describes extension commands that are frequently used during both user-mode and kernel-mode debugging.
The debugger automatically loads the proper version of these extension commands. Unless you have manually loaded a different version, you do not have to keep track of the
DLL versions that are being used. For more information about the default module search order, see Using Debugger Extension Commands. For more information about how
to load extension modules, see Loading Debugger Extension DLLs.
Each extension command reference topics lists the DLLs that expose that command. Use the following rules to determine the proper directory to load this extension DLL
from:
If your target computer is running Microsoft Windows XP or a later version of Windows, use winxp\kdexts.dll, winxp\ntsdexts.dll, winxp\exts.dll, winext\ext.dll, or
dbghelp.dll.
If your target computer is running the free build of Windows 2000, use w2kfre\kdextx86.dll, w2kfre\ntsdexts.dll, winext\ext.dll, or dbghelp.dll.
If your target computer is running the checked build of Windows 2000, use w2kchk\kdextx86.dll, w2kchk\ntsdexts.dll, winext\ext.dll, or dbghelp.dll.
!acl
The !acl extension formats and displays the contents of an access control list (ACL).
Syntax
Syntax in Microsoft Windows XP and later versions
!acl Address [Flags]
Syntax in Windows 2000
!acl Address
Parameters
Address
Specifies the hexadecimal address of the ACL.
Flags
(Windows XP and later) Displays the friendly name of the ACL, if the value of Flags is 1. This friendly name includes the security identifier (SID) type and the domain
and user name for the SID.
DLL
Windows 2000
Kdextx86.dll
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!acl e1bf35d4 1
is:
is: ->AclRevision: 0x2
is: ->Sbz1
: 0x0
is: ->AclSize
: 0x40
is: ->AceCount
: 0x2
is: ->Sbz2
: 0x0
is: ->Ace[0]: ->AceType: ACCESS_ALLOWED_ACE_TYPE
is: ->Ace[0]: ->AceFlags: 0x0
is: ->Ace[0]: ->AceSize: 0x24
is: ->Ace[0]: ->Mask : 0x10000000
is: ->Ace[0]: ->SID: S-1-5-21-518066528-515770016-299552555-2981724 (User: MYDOMAIN\myuser)
ACL
ACL
ACL
ACL
ACL
is:
is:
is:
is:
is:
->Ace[1]:
->Ace[1]:
->Ace[1]:
->Ace[1]:
->Ace[1]:
->AceType: ACCESS_ALLOWED_ACE_TYPE
->AceFlags: 0x0
->AceSize: 0x14
->Mask : 0x10000000
->SID: S-1-5-18 (Well Known Group: NT AUTHORITY\SYSTEM)
Additional Information
For more information about access control lists, see !sid, !sd, and Determining the ACL of an Object. Also, see the Microsoft Windows SDK documentation, the Windows
Driver Kit (WDK) documentation, and Microsoft Windows Internals by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!address
The !address extension displays information about the memory that the target process or target computer uses.
Syntax
User-Mode
!address
!address
!address
!address
Address
-summary
[-f:F1,F2,...] {[-o:{csv | tsv | 1}] | [-c:"Command"]}
-? | -help
Kernel-Mode
!address Address
!address
Parameters
Address
Displays only the region of the address space that contains Address.
-summary
Displays only summary information.
-f:F1, F2,
Displays only the regions specified by the filters F1, F2, and so on.
The following filter values specify memory regions by the way that the target process is using them.
Filter
value
VAR
Busy regions. These regions include all virtual allocation blocks, the SBH heap, memory from custom allocators, and all other regions of the address space
that fall into no other classification.
Free
Free memory. This includes all memory that has not been reserved.
Image
Memory that is mapped to a file that is part of an executable image.
Stack
Memory used for thread stacks.
Teb
Memory used for thread environment blocks (TEBs).
Peb
Memory used for the process environment block (PEB).
Heap
Memory used for heaps.
PageHeap The memory region used for the full-page heap.
CSR
CSR shared memory.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Actx
NLS
FileMap
The following filter values specify memory regions by the memory type.
Filter value
Memory regions displayed
MEM_IMAGE Memory that is mapped to a file that is part of an executable image.
MEM_MAPPED Memory that is mapped to a file that is not part of an executable image. This includes memory that is mapped to the paging file.
MEM_PRIVATE Private memory. This memory is not shared by any other process, and it is not mapped to any file.
The following filter values specify memory regions by the state of the memory.
Filter value
Memory regions displayed
MEM_COMMIT Committed memory.
MEM_FREE
Free memory. This includes all memory that has not been reserved.
MEM_RESERVE Reserved memory.
The following filter values specify memory regions by the protection applied to the memory.
Filter value
Memory regions displayed
PAGE_NOACCESS
Memory that cannot be accessed.
PAGE_READONLY
Memory that is readable, but not writable and not executable.
PAGE_READWRITE
Memory that is readable and writable, but not executable.
PAGE_WRITECOPY
Memory that has copy-on-write behavior.
PAGE_EXECUTE
Memory that is executable, but not readable and not writeable.
PAGE_EXECUTE_READ
Memory that is executable and readable, but not writable.
PAGE_EXECUTE_READWRITE Memory that is executable, readable, and writable.
PAGE_EXECUTE_WRITECOPY Memory that is executable and has copy-on-write behavior.
PAGE_GUARD
Memroy that acts as a guard page.
PAGE_NOCACHE
Memory that is not cached.
PAGE_WRITECOMBINE
Memory that has write-combine access enabled.
-o:{csv | tsv | 1}
Displays the output according to one of the following options.
Option
Output format
csv
Displays the output as comma-separated values.
tsv
Displays the output as tab-separated values.
1
Displays the output in bare format. This format works well when !address is used as input to .foreach.
-c:"Command"
Executes a custom command for each memory region. You can use the following placeholders in your command to represent output fields of the !address extension.
Placeholder Output field
%1
Base address
%2
End address + 1
%3
Region size
%4
Type
%5
State
%6
Protection
%7
Usage
For example, !address -f:Heap -c:".echo %1 %3 %5" displays the base address, size, and state for each memory region of type Heap.
Quotes in the command must be preceded by a back slash (\"). For example, !address -f:Heap -c:"s -a %1 %2 \"pad\"" searches each memory region of type Heap for the
string "pad".
Multiple commands separated by semicolons are not supported.
-?
Displays minimal Help text for this extension in the Debugger Command window.
DLL
Windows 2000
Ext.dll
Windows XP and later Ext.dll
Comments
Without any parameters, the !address extension displays information about the whole address space. The !address -summary command shows only the summary.
In kernel mode, this extension searches only kernel memory, even if you used .process (Set Process Context) to specify a given process' virtual address space. In user mode,
the !address extension always refers to the memory that the target process owns.
In user mode, !address Address shows the characteristics of the region that the specified address belongs to. Without parameters, !address shows the characteristics of all
memory regions. These characteristics include the memory usage, memory type, memory state, and memory protection. For more information about the meaning of this
information, see the earlier tables in the description of the -f parameter.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The following example uses !address to retrieve information about a region of memory that is mapped to kernel32.dll.
0:000> !address 75831234
Usage:
Image
Base Address:
75831000
End Address:
758f6000
Region Size:
000c5000
Type:
01000000MEM_IMAGE
State:
00001000MEM_COMMIT
Protect:
00000020PAGE_EXECUTE_READ
More info:
lmv m kernel32
More info:
!lmi kernel32
More info:
ln 0x75831234
This example uses an Address value of 0x75831234. The display shows that this address is in a memory region that begins with the address 0x75831000 and ends with the
address 0x758f6000. The region has usage Image, type MEM_IMAGE, state MEM_COMMIT, and protection PAGE_EXECUTE_READ. (For more information about
the meaning of these values, see the earlier tables.) The display also lists three other debugger commands that you can use to get more information about this memory address.
If you are starting with an address and trying to determine information about it, the usage information is frequently the most valuable. After you know the usage, you can use
additional extensions to learn more about this memory. For example, if the usage is Heap, you can use the !heap extension to learn more.
The following example uses the s (Search Memory) command to search each memory region of type Image for the wide-character string "Note".
!address /f:Image /c:"s -u %1 %2 \"Note\""
*** Executing:
*** Executing:
00ab2936 004e
00ab2f86 004e
00ab32e4 004e
*** Executing:
. . .
s -u
s -u
006f
006f
006f
s -u
N.o.t.e.p.a.d...
N.o.t.e.p.a.d.\.
N.o.t.e.p.a.d...
In kernel mode, the output of !address is similar to the user mode output but contains less information. The following example example shows the kernel mode output.
kd> !address
804de000 - 00235000
Usage
KernelSpaceUsageImage
ImageName
ntoskrnl.exe
80c00000 - 001e1000
Usage
KernelSpaceUsagePFNDatabase
....
f85b0000 - 00004000
Usage
KernelSpaceUsageKernelStack
KernelStack 817b4da0 : 324.368
f880d000 - 073d3000
Usage
KernelSpaceUsageNonPagedPoolExpansion
The meaning of "usage" is the same as in user mode. "ImageName" indicates the module that is associated with this address. "KernelStack" shows the address of this thread's
ETHREAD block (0x817B4DA0), the process ID (0x324), and the thread ID (0x368).
Additional Information
For more information about how to display and search memory, see Reading and Writing Memory. For additional extensions that display memory properties, see !vm (kernel
mode) and !vprot (user mode).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!analyze
The !analyze extension displays information about the current exception or bug check.
Syntax
User-Mode
!analyze [-v] [-f | -hang] [-D BucketID]
!analyze -c [ -load KnownIssuesFile | -unload | -help ]
Kernel-Mode
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!asd
The !asd extension displays a specified number of failure analysis entries from the data cache, starting at the specified address.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Syntax
!asd Address DataUsed
Parameters
Address
Specifies the address of the first failure analysis entry to display.
DataUsed
Determines the number of tokens to display.
DLL
Windows 2000
Ext.dll
Windows XP and later Ext.dll
Comments
The !asd extension is useful only when you are debugging the !analyze extension.
You can use the !dumpfa extension to debug the !analyze extension.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!atom
The !atom extension displays the formatted atom table for the specified atom or for all atoms of the current process.
Syntax
!atom [Address]
Parameters
Address
Specifies the hexadecimal virtual address of the atom to display. If you omit this parameter or specify zero, the atom table for the current process is displayed. This table
lists all atoms for the process.
DLL
Windows 2000
Kdextx86.dll
Ntsdexts.dll
Windows XP and later Exts.dll
Additional Information
For more information about atoms and atom tables, see the Microsoft Windows SDK documentation.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!bitcount
The !bitcount extension counts the number of 1 bits in a memory range.
Syntax
!bitcount StartAddress TotalBits
Parameters
StartAddress
Specifies the starting address of the memory range whose 1 bits will be counted.
TotalBits
Specifies the size of the memory range, in bits.
-?
Displays some Help text for this extension in the Debugger Command window.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
DLL
Windows 2000
Unavailable
Windows XP and later Exts.dll
!chksym
The !chksym extension tests the validity of a module against a symbol file.
Syntax
!chksym Module [Symbol]
Parameters
Module
Specifies the name of the module by its name or base address.
Symbol
Specifies the name of a symbol file.
DLL
Windows 2000
Unavailable
Windows XP
Unavailable
Windows Vista and later Dbghelp.dll
Comments
If you do not specify a symbol filed, the loaded symbol is tested. Otherwise, if you specify a .pdb or .dbg symbol file path, the loaded symbol is tested against the loaded
module.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!chkimg
The !chkimg extension detects corruption in the images of executable files by comparing them to the copy on a symbol store or other file repository.
Syntax
!chkimg [Options] [-mmw LogFile LogOptions] [Module]
Parameters
Options
Any combination of the following options:
-p SearchPath
Recursively searches SearchPath for the file before accessing the symbol server.
-f
Fixes errors in the image. Whenever the scan detects differences between the file on the symbol store and the image in memory, the contents of the file on the
symbol store are copied over the image. If you are performing live debugging, you can create a dump file before you execute the !chkimg -f extension.
-nar
Prevents the mapped image of the file on the symbol server from being moved. By default, when the copy of the file is located on the symbol server and mapped into
memory, !chkimg moves the image of the file on the symbol server. However, if you use the -nar option, the image of the file from the server is not moved.
The executable image that is already in memory (that is, the one that is being scanned) is moved, because the debugger always relocates images that it loads.
This switch is useful only if the operating system already moved the original image. If the image has not been moved, !chkimg and the debugger will move the
image. Use of this switch is rare.
-ss SectionName
Limits the scan to those sections whose names contain the string SectionName. The scan will include any non-discardable section whose name contains this string.
SectionName is case sensitive and cannot exceed 8 characters.
-as
Causes the scan to include all sections of the image except discardable sections. By default, (if you do not use -as or -ss), the scan skips sections that are writeable,
sections that are not executable, sections that have "PAGE" in their name, and discardable sections.
-r StartAddress EndAddress
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Limits the scan to the memory range that begins with StartAddress and ends with EndAddress. Within this range, any sections that would typically be scanned are
scanned. If a section partially overlaps with this range, only that part of the section that overlaps with this range is scanned. The scan is limited to this range even if
you also use the -as or -ss switch.
-nospec
Causes the scan to include the reserved sections of Hal.dll and Ntoskrnl.dll. By default, !chkimg does not check certain parts of these files.
-noplock
Displays areas that mismatch by having a byte value of 0x90 (a nop instruction) and a byte value of 0xF0 (a lock instruction). By default, these mismatches are not
displayed.
-np
Causes patched instructions to be recognized. .
-d
Displays a summary of all mismatched areas while the scan is occurring. For more information about this summary text, see the Comments section.
-db
Displays mismatched areas in a format that is similar to the db debugger command. Therefore, each display line shows the address of the first byte in the line,
followed by up to 16 hexadecimal byte values. The byte values are immediately followed by the corresponding ASCII values. All nonprintable characters, such as
carriage returns and line feeds, are displayed as periods (.). The mismatched bytes are marked by an asterisk (*).
-lo lines
Limits the number of output lines that -d or -db display to the lines number of lines.
-v
Displays verbose information.
-mmw
Creates a log file and records the activity of !chkimg in this file. Each line of the log file represents a single mismatch.
LogFile
Specifies the full path of the log file. If you specify a relative path, the path is relative to the current path.
LogOptions
Specifies the contents of the log file. LogOptions is a string that consists of a concatenation of various letters. Each line in the log file contains several columns that are
separated by commas. These columns include the items that the following option letters specify, in the order that the letters appear in the LogOptions string. You can
include the following options multiple times. You must include at least one option.
Log option
Information included in the log file
v
The virtual address of the mismatch
r
The offset (relative address) of the mismatch within the module
s
The symbol that corresponds to the address of the mismatch
S
The name of the section that contains the mismatch
e
The correct value that was expected at the mismatch location
w
The incorrect value that was at the mismatch location
LogOptions can also include some, or none, of the following additional options.
Log
Effect
option
o
If a file that has the name LogFile already exists, the existing file is overwritten. By default, the debugger appends new information to the end of any existing
file.
tString Adds an extra column to the log file. Each entry in this column contains String. The tString option is useful if you are appending new information to an
existing log file and you have to distinguish the new records from the old. You cannot add space between t and String. If you use the tIString option, it must be
the final option in LogOptions, because String is taken to include all of the characters that are present before the next space.
For example, if LogOptions is rSewo, each line of the log file contains the relative address and section name of the mismatch location and the expected and actual values
at that location. This option also causes any previous file to be overwritten. You can use the -mmw switch multiple times if you want to create several log files that have
different options. You can create up to 10 log files at the same time.
Module
Specifies the module to check. Module can be the name of the module, the starting address of the module, or any address that is contained in the module. If you omit
Module, the debugger uses the module that contains the current instruction pointer.
DLL
Windows 2000
Ext.dll
Windows XP and later Ext.dll
Comments
When you use !chkimg, it compares the image of an executable file in memory to the copy of the file that resides on a symbol store.
All sections of the file are compared, except for sections that are discardable, that are writeable, that are not executable, that have "PAGE" in their name, or that are from
INITKDBG. You can change this behavior can by using the -ss, -as, or -r switches.
!chkimg displays any mismatch between the image and the file as an image error, with the following exceptions:
Addresses that are occupied by the Import Address Table (IAT) are not checked.
Certain specific addresses in Hal.dll and Ntoskrnl.exe are not checked, because certain changes occur when these sections are loaded. To check these addresses, include
the -nospec option.
If the byte value 0x90 is present in the file, and if the value 0xF0 is present in the corresponding byte of the image (or vice versa), this situation is considered a match.
Typically, the symbol server holds one version of a binary that exists in both uniprocessor and multiprocessor versions. On an x86-based processor, the lock instruction
is 0xF0, and this instruction corresponds to a nop (0x90) instruction in the uniprocessor version. If you want !chkimg to display this pair as a mismatch, set the noplock option.
Note If you use the -f option to fix image mismatches, !chkimg fixes only those mismatches that it considers to be errors. For example, !chkimg does not change an 0x90
byte to an 0xF0 byte unless you include -noplock.
When you include the -d option, !chkimg displays a summary of all mismatched areas while the scan is occurring. Each mismatch is displayed on two lines. The first line
includes the start of the range, the end of the range, the size of the range, the symbol name and offset that corresponds to the start of the range, and the number of bytes since
the last error (in parentheses). The second line is enclosed in brackets and includes the hexadecimal byte values that were expected, a colon, and then the hexadecimal byte
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
values that were actually encountered in the image. If the range is longer than 8 bytes, only the first 8 bytes are shown before the colon and after the colon. The following
example shows this situation.
be000015-be000016 2 bytes - win32k!VeryUsefulFunction+15 (0x8)
[ 85 dd:95 23 ]
Occasionally, a driver alters part of the Microsoft Windows kernel by using hooks, redirection, or other methods. Even a driver that is no longer on the stack might have
altered part of the kernel. You can use the !chkimg extension as a file comparison tool to determine which parts of the Windows kernel (or any other image) are being altered
by drivers and exactly how the parts are being changed. This comparison is most effective on full dump files.
You can also use !chkimg together with the !for_each_module extension to check the image of each loaded module. The following example shows this situation.
!for_each_module !chkimg @#ModuleName
Suppose that you encounter a bug check, for example, and begin by using !analyze.
kd> !analyze
....
BugCheck 1000008E, {c0000005, bf920e48, baf75b38, 0}
Probably caused by : memory_corruption
CHKIMG_EXTENSION: !chkimg !win32k
....
In this example, the !analyze output suggests that memory corruption has occurred and includes a CHKIMG_EXTENSION line that suggests that Win32k.sys could be the
corrupted module. (Even if this line is not present, you might consider possible corruption in the module on top of the stack.) Start by using !chkimg without any switches, as
the following example shows.
kd> !chkimg win32k
Number of different bytes for win32k: 31
The following example shows that there are indeed memory corruptions. Use !chkimg -d to display all of the errors for the Win32k module.
kd> !chkimg win32k -d
bf920e40-bf920e46 7 bytes - win32k!HFDBASIS32::vSteadyState+1f
[ 78 08 d3 78 0c c2 04:00 00 00 00 00 01 00 ]
bf920e48-bf920e5f 24 bytes - win32k!HFDBASIS32::vHalveStepSize (+0x08)
[ 8b 51 0c 8b 41 08 56 8b:00 00 00 00 00 00 00 00 ]
Number of different bytes for win32k: 31
When you try to disassemble the corrupted image of the second section that is listed, the following output might occur.
kd> u win32k!HFDBASIS32::vHalveStepSize
win32k!HFDBASIS32::vHalveStepSize:
bf920e48 0000
add
[eax],al
bf920e4a 0000
add
[eax],al
bf920e4c 0000
add
[eax],al
bf920e4e 0000
add
[eax],al
bf920e50 7808
js win32k!HFDBASIS32::vHalveStepSize+0x12 (bf920e5a)
bf920e52 d3780c
sar
dword ptr [eax+0xc],cl
bf920e55 c20400
ret
0x4
bf920e58 8b510c
mov
edx,[ecx+0xc]
Then, use !chkimg -f to fix the memory corruption.
kd> !chkimg win32k -f
Warning: Any detected errors will be fixed to what we expect!
Number of different bytes for win32k: 31 (fixed)
Now you can disassemble the corrected view and see the changes that you have made.
kd> u win32k!HFDBASIS32::vHalveStepSize
win32k!HFDBASIS32::vHalveStepSize:
bf920e48 8b510c
mov
edx,[ecx+0xc]
bf920e4b 8b4108
mov
eax,[ecx+0x8]
bf920e4e 56
push
esi
bf920e4f 8b7104
mov
esi,[ecx+0x4]
bf920e52 03c2
add
eax,edx
bf920e54 c1f803
sar
eax,0x3
bf920e57 2bf0
sub
esi,eax
bf920e59 d1fe
sar
esi,1
!cppexr
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!cpuid
The !cpuid extension displays information about the processors on the system.
Syntax
!cpuid [Processor]
Parameters
Processor
Specifies the processor whose information will be displayed. If you omit this parameter, all processors are displayed.
DLL
Windows 2000
Ext.dll
Windows XP and later Ext.dll
Comments
The !cpuid extension works during live user-mode or kernel-mode debugging, local kernel debugging, and debugging of dump files. However, user-mode minidump files
contain only information about the active processor.
If you are debugging in user mode, the !cpuid extension describes the computer that the target application is running on. In kernel mode, it describes the target computer.
The following example shows this extension.
kd>
CP
0
1
!cpuid
F/M/S Manufacturer
6,5,1 GenuineIntel
8,1,5 AuthenticAMD
MHz
700
700
The CP column gives the processor number. (These numbers are always sequential, starting with zero). The Manufacturer column specifies the processor manufacturer. The
MHz column specifies the processor speed, if it is available.
For an x86-based processor or an x64-based processor, the F column displays the processor family number, the M column displays the processor model number, and the S
column displays the stepping size.
For an Itanium-based processor, the M column displays the processor model number, the R column displays the processor revision number, the F column displays the
processor family number, and the A column displays the architecture revision number.
Additional Information
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
For more information about how to debug multiprocessor computers, see Multiprocessor Syntax.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!cs
The !cs extension displays one or more critical sections or the whole critical section tree.
Syntax
!cs
!cs
!cs
!cs
!cs
!cs
[-s]
[-s]
[-s]
[-s]
[-s]
-?
[-l] [-o]
[-o] [Address]
[-l] [-o] StartAddress EndAddress
[-o] -d InfoAddress
-t [TreeAddress]
Parameters
-s
Displays each critical section's initialization stack trace, if this information is available.
-l
Display only the locked critical sections.
-o
Displays the owner's stack for any locked critical section that is being displayed.
Address
Specifies the address of the critical section to display. If you omit this parameter, the debugger displays all critical sections in the current process.
StartAddress
Specifies the beginning of the address range to search for critical sections.
EndAddress
Specifies the end of the address range to search for critical sections.
-d
Displays critical sections that are associated with DebugInfo.
InfoAddress
Specifies the address of the DebugInfo.
-t
Displays a critical section tree. Before you can use the -t option, you must activate Application Verifier for the target process and select the Check lock usage option.
TreeAddress
Specifies the address of the root of the critical section tree. If you omit this parameter or specify zero, the debugger displays the critical section tree for the current
process.
-?
Displays some Help text for this extension in the Debugger Command window.
DLL
Windows 2000
Unavailable
Windows XP and later Exts.dll
Comments
The !cs extension requires full symbols (including type information) for the process that is being debugged and for Ntdll.dll. If you do not have symbols for Ntdll.dll, see
Installing Windows Symbol Files.
The following examples shows you how to use !cs. The following command displays information about the critical section at address 0x7803B0F8 and shows its initialization
stack trace.
0:001> !cs -s 0x7803B0F8
Critical section
= 0x7803B0F8 (MSVCRT!__app_type+0x4)
DebugInfo
= 0x6A262080
NOT LOCKED
LockSemaphore
= 0x0
SpinCount
= 0x0
Stack trace for DebugInfo = 0x6A262080:
0x6A2137BD:
0x6A207A4C:
0x6A205569:
0x6A20DCE1:
ntdll!RtlInitializeCriticalSectionAndSpinCount+0x9B
ntdll!LdrpCallInitRoutine+0x14
ntdll!LdrpRunInitializeRoutines+0x1D9
ntdll!LdrpInitializeProcess+0xAE5
The following command displays information about the critical section whose DebugInfo is at address 0x7803B0F8.
0:001> !cs -d 0x6A262080
DebugInfo
= 0x6A262080
Critical section
= 0x7803B0F8 (MSVCRT!__app_type+0x4)
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
NOT LOCKED
LockSemaphore
SpinCount
= 0x0
= 0x0
The following command displays information about all of the active critical sections in the current process.
0:001> !cs
----------------------------------------DebugInfo
= 0x6A261D60
Critical section
= 0x6A262820 (ntdll!RtlCriticalSectionLock+0x0)
LOCKED
LockCount
= 0x0
OwningThread
= 0x460
RecursionCount
= 0x1
LockSemaphore
= 0x0
SpinCount
= 0x0
----------------------------------------DebugInfo
= 0x6A261D80
Critical section
= 0x6A262580 (ntdll!DeferedCriticalSection+0x0)
NOT LOCKED
LockSemaphore
= 0x7FC
SpinCount
= 0x0
----------------------------------------DebugInfo
= 0x6A262600
Critical section
= 0x6A26074C (ntdll!LoaderLock+0x0)
NOT LOCKED
LockSemaphore
= 0x0
SpinCount
= 0x0
----------------------------------------DebugInfo
= 0x77fbde20
Critical section
= 0x77c8ba60 (GDI32!semColorSpaceCache+0x0)
LOCKED
LockCount
= 0x0
OwningThread
= 0x00000dd8
RecursionCount
= 0x1
LockSemaphore
= 0x0
SpinCount
= 0x00000000
----------------------------------------...
The following command displays the critical section tree.
0:001> !cs -t
Tree root 00bb08c0
Level
Node
CS
Debug
InitThr EnterThr
WaitCnt
----------------------------------------------------------------------------------------------0
1
2
3
4
5
5
3
4
4
5
2
3
00bb08c0
00dd6fd0
00bb0aa0
00bb09e0
00bb0a40
00bb0a10
00bb0a70
00bb0b00
00bb0ad0
00bb0b30
00dd4fd0
00bb0e90
00bb0d70
77c7e020
0148cfe8
008e8b84
008e8704
008e8944
008e8824
008e8a64
008e8dc4
008e8ca4
008e8ee4
0148afe4
77c2da98
77c2da08
77fbcae0
01683fe0
77fbcc20
77fbcba0
77fbcbe0
77fbcbc0
77fbcc00
77fbcc60
77fbcc40
77fbcc80
0167ffe0
00908fe0
008fcfe0
4c8
4c8
4c8
4c8
4c8
4c8
4c8
4c8
4c8
4c8
4c8
4c8
4c8
4c8
4c8
0
0
0
0
0
0
0
0
0
4c8
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4c8
4c8
0
0
0
0
0
0
0
0
0
4c8
0
c
2
0
0
0
0
0
0
0
0
0
3a
0
0
0
0
0
0
0
0
0
0
0
0
0
0
InitThr is the thread ID for the thread that initialized the CS.
EnterThr is the ID of the thread that called EnterCriticalSection last time.
WaitThr is the ID of the thread that found the critical section that another thread owned and waited for it last time.
TryEnThr is the ID of the thread that called TryEnterCriticalSection last time.
LeaveThr is the ID of the thread that called LeaveCriticalSection last time
EnterCnt is the count of EnterCriticalSection.
WaitCnt is the contention count.
Additional Information
For other commands and extensions that can display critical section information, see Displaying a Critical Section. For more information about critical sections, see the
Microsoft Windows SDK documentation, the Windows Driver Kit (WDK) documentation, and Microsoft Windows Internals by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!cxr
The !cxr extension command is obsolete. Use the .cxr (Display Context Record) command instead.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!dh
The !dh extension displays the headers for the specified image.
Syntax
!dh [Options] Address
!dh -h
Parameters
Options
Any one of the following options:
-f
Displays file headers.
-s
Displays section headers.
-a
Displays all header information.
Address
Specifies the hexadecimal address of the image.
-h
Displays some Help text for this extension in the Debugger Command window.
DLL
Windows 2000
Dbghelp.dll
Kdextx86.dll
Ntsdexts.dll
Windows XP and later Dbghelp.dll
Comments
The !lmi extension extracts the most important information from the image header and displays it in a concise summary format. That extension is frequently more useful
than !dh.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!dlls
The !dlls extension displays the table entries of all loaded modules or all modules that a specified thread or process are using.
Syntax
!dlls [Options] [LoaderEntryAddress]
!dlls -h
Parameters
Options
Specifies the level of output. This parameter can be any combination of the following values:
-f
Displays file headers.
-s
Displays section headers.
-a
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Kdextx86.dll
Ntsdexts.dll
Windows XP and later Exts.dll
Comments
The module listing includes all entry points into each module.
The .dlls extension works only in live debugging (not with crash dump analysis).
In kernel mode, this extension displays the modules for the current process context. You cannot use !dlls together with a system process or the idle process.
The following examples shows you how to use the !dlls extension.
kd> !dlls -c 77f60000
Dump dll containing 0x77f60000:
0x00091f38: E:\WINDOWS\System32\ntdll.dll
Base
0x77f60000 EntryPoint 0x00000000
Flags 0x00004004 LoadCount
0x0000ffff
LDRP_IMAGE_DLL
LDRP_ENTRY_PROCESSED
Size
TlsIndex
0x00097000
0x00000000
Size
TlsIndex
0x00020000
0x00000000
OPTIONAL
10B
7.00
3A00
19E00
0
3E2E
1000
01000000
1000
200
2
5.01
5.01
4.00
20000
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
400
21970
00040000
00001000
00100000
00001000
01000100
0
40B4
6000
0
0
0
11B0
0
0
0
0
258
1000
0
0
0
size of headers
checksum
size of stack reserve
size of stack commit
size of heap reserve
size of heap commit
Opt Hdr
[
0] address [size]
[
B4] address [size]
[
19170] address [size]
[
0] address [size]
[
0] address [size]
[
0] address [size]
[
1C] address [size]
[
0] address [size]
[
0] address [size]
[
0] address [size]
[
0] address [size]
[
A8] address [size]
[
1B0] address [size]
[
0] address [size]
[
0] address [size]
[
0] address [size]
of
of
of
of
of
of
of
of
of
of
of
of
of
of
of
of
Export Directory
Import Directory
Resource Directory
Exception Directory
Security Directory
Base Relocation Directory
Debug Directory
Description Directory
Special Directory
Thread Storage Directory
Load Configuration Directory
Bound Import Directory
Import Address Table Directory
Reserved Directory
Reserved Directory
Reserved Directory
SECTION HEADER #1
.text name
3992 virtual size
1000 virtual address
3A00 size of raw data
400 file pointer to raw data
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
60000020 flags
Code
(no align specified)
Execute Read
Debug Directories(1)
Type
Size
cv
1c
Address
Pointer
13d0
7d0
ne.pdb
SECTION HEADER #2
.data name
BB8 virtual size
5000 virtual address
200 size of raw data
3E00 file pointer to raw data
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
C0000040 flags
Initialized Data
(no align specified)
Read Write
SECTION HEADER #3
.rsrc name
19170 virtual size
6000 virtual address
19200 size of raw data
4000 file pointer to raw data
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
40000040 flags
Initialized Data
(no align specified)
Read Only
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!dumpfa
The !dumpfa extension displays the contents of a failure analysis entry.
Syntax
!dumpfa Address
Parameters
Address
Specifies the address of the failure analysis entry that is displayed.
DLL
Windows 2000
Ext.dll
Windows XP and later Ext.dll
Comments
The .dumpfa extension is useful only to debug the !analyze extension, as the following example shows.
0:000> !dumpfa 0x00a34140
DataUsed 3b0
Type =
DEBUG_FLR_MARKER_BUCKET 00010016 - Size = 9
Type =
DEBUG_FLR_MARKER_FILE 0001000d - Size = 16
Type =
DEBUG_FLR_SYSXML_LOCALEID 00004200 - Size = 4
Type =
DEBUG_FLR_SYSXML_CHECKSUM 00004201 - Size = 4
Type =
DEBUG_FLR_READ_ADDRESS 0000000e - Size = 8
Type =
DEBUG_FLR_FAULTING_IP 80000000 - Size = 8
Type =
DEBUG_FLR_MM_INTERNAL_CODE 00001004 - Size = 8
Type = DEBUG_FLR_CPU_MICROCODE_VERSION 0000301f - Size = 28
Type = DEBUG_FLR_CUSTOMER_CRASH_COUNT 0000300b - Size = 8
Type =
DEBUG_FLR_DEFAULT_BUCKET_ID 00010008 - Size = 12
Type =
DEBUG_FLR_BUGCHECK_STR 00000600 - Size = 5
Type = DEBUG_FLR_LAST_CONTROL_TRANSFER 0000000a - Size = 18
Type =
DEBUG_FLR_TRAP_FRAME c0000002 - Size = 8
Type =
DEBUG_FLR_STACK_TEXT 00010005 - Size = 1fb
Type =
DEBUG_FLR_STACK_COMMAND 00010004 - Size = 17
Type =
DEBUG_FLR_OS_BUILD_NAME 0000301e - Size = 9
Type =
DEBUG_FLR_MODULE_NAME 00010006 - Size = 8
Type =
DEBUG_FLR_IMAGE_NAME 00010001 - Size = c
Type =
DEBUG_FLR_IMAGE_TIMESTAMP 80000002 - Size = 8
You can also use the !asd extension to debug the !analyze extension.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!elog_str
The !elog_str extension adds a string to the event log.
Syntax
!elog_str String
Parameters
String
Specifies the string to add to the event log.
DLL
Windows 2000
Ext.dll
Windows XP and later Ext.dll
Comments
Because a registered event source does not send String, the string appears in the event log with a warning that no event ID was determined.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!envvar
The !envvar extension displays the value of the specified environment variable.
Syntax
!envvar Variable
Parameters
Variable
Specifies the environment variable whose value is displayed. Variable is not case sensitive.
DLL
Windows 2000
Unavailable
Windows XP and later Exts.dll
Comments
The !envvar extension works both in user mode and in kernel mode. However, in kernel mode, when you set the idle thread as the current process, the pointer to the Process
Environment Block (PEB) is NULL, so it fails. In kernel mode, the !envvar extension displays the environment variables on the target computer, as the following example
shows.
0:000> !envvar _nt_symbol_path
_nt_symbol_path = srv*C:\mysyms*http://msdl.microsoft.com/download/symbols
Additional Information
For more information about environment variables, see Environment Variables and the Microsoft Windows SDK documentation.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!error
The !error extension decodes and displays information about an error value.
Syntax
!error Value [Flags]
Parameters
Value
Specifies one of the following error codes:
Win32
Winsock
NTSTATUS
NetAPI
Flags
If Flags is set to 1, the error code is read as an NTSTATUS code.
DLL
Windows 2000
Ext.dll
Windows XP and later Ext.dll
Comments
The following example shows you how to use !error.
0:000> !error 2
Error code: (Win32) 0x2 (2) - The system cannot find the file specified.
0:000> !error 2 1
Error code: (NTSTATUS) 0x2 - STATUS_WAIT_2
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!exchain
The !exchain extension displays the current exception handler chain.
Syntax
!exchain [Options]
Parameters
Options
One of the following values:
/c
Displays information that is relevant for debugging a C++ try/catch exception, if such an exception is detected.
/C
Displays information that is relevant for debugging a C++ try/catch exception, even when such an exception has not been detected.
/f
Displays information that is obtained by walking the CRT function tables, even if a CRT exception handler was not detected.
DLL
Windows 2000
Ext.dll
Windows XP and later Ext.dll
The !exchain extension is available only for an x86-based target computer.
Comments
The !exchain extension displays the list of exception handlers for the current thread.
The list begins with the first handler on the chain (the one that is given the first opportunity to handle an exception) and continues on to the end. The following example shows
this extension.
0:000> !exchain
0012fea8: Prymes!_except_handler3+0 (00407604)
CRT scope 0, filter: Prymes!dzExcepError+e6 (00401576)
func:
Prymes!dzExcepError+ec (0040157c)
0012ffb0: Prymes!_except_handler3+0 (00407604)
CRT scope 0, filter: Prymes!mainCRTStartup+f8 (004021b8)
func:
Prymes!mainCRTStartup+113 (004021d3)
0012ffe0: KERNEL32!GetThreadContext+1c (77ea1856)
!exr
The !exr extension command is obsolete. Use the .exr (Display Exception Record) command instead.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!findxmldata
The !findxmldata extension retrieves XML data from a CAB file that contains a kernel-mode Small Memory Dump file.
Syntax
!findxmldata [ -d DeviceName | -h HwId ]
!findxmldata -r Driver
!findxmldata -chksum [ -z CabFile ]
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!findxmldata -v
Parameters
-d DeviceName
Displays all devices whose device name contains the string that DeviceName specifies.
-h HwId
Displays all devices whose hardware IDs contain the string that HwId specifies. If you use both -d and -h, the debugger displays only those devices that satisfy both
matches.
-r Driver
Displays information about the driver that the Driver parameter specifies, including all devices that use this driver.
-chksum
Displays the XML file's checksum.
-z CabFile
Enables you to perform a checksum on the CAB file that the CabFile parameter specifies, instead of on the default Sysdata.xml file.
-v
Displays system version information.
DLL
Windows 2000
Ext.dll
Windows XP and later Ext.dll
The !findxmldata extension works only on a kernel-mode Small Memory Dump file that is stored in a CAB file.
Comments
The !findxmldata extension retrieves data from the Sysdata.xml file that is stored in a CAB file that contains a kernel-mode Small Memory Dump file.
When you do not use any options, the extension displays all devices.
The following examples show you how to use !findxmldata.
kd> !findxmldata -v
SYSTEM Info:
OSVER: 5.1.2600 2.0
OSLANGUAGE: 2052
OSNAME: Microsoft Windows XP Home Edition
kd> !findxmldata -d MIDI
Node DEVICE
DESCRIPTION
: MPU-401 Compatible MIDI Device
HARDWAREID
: ACPI\PNPB006
SERVICE
: ms_mpu401
DRIVER
: msmpu401.sys
kd> !findxmldata -r msmpu
Node DRIVER
FILENAME
: msmpu401.sys
FILESIZE
: 2944
CREATIONDATE
: 05-06-2005 09:18:34
VERSION
: 5.1.2600.0
MANUFACTURER
: Microsoft Corporation
PRODUCTNAME
: Microsoft Windows Operating System
Node DEVICE
DESCRIPTION
: MPU-401 Compatible MIDI Device
HARDWAREID
: ACPI\PNPB006
SERVICE
: ms_mpu401
DRIVER
: msmpu401.sys
kd> !findxmldata -h PCI\VEN_8086&DEV_24C3&SUBSYS_24C28086
Node DEVICE
DESCRIPTION
: Intel(R) 82801DB/DBM SMBus Controller - 24C3
HARDWAREID
: PCI\VEN_8086&DEV_24C3&SUBSYS_24C28086&REV_01
kd> !findxmldata -h USB\ROOT_HUB&VID8086&PID24C4&REV0001
Node DEVICE
DESCRIPTION
: USB Root Hub
HARDWAREID
: USB\ROOT_HUB&VID8086&PID24C4&REV0001
SERVICE
: usbhub
DRIVER
: usbhub.sys
kd> !findxmldata -h ACPI\PNPB006
Node DEVICE
DESCRIPTION
: MPU-401 Compatible MIDI Device
HARDWAREID
: ACPI\PNPB006
SERVICE
: ms_mpu401
DRIVER
: msmpu401.sys
Additional Information
For more information about how to put dump files into CAB files, see .dumpcab (Create Dump File CAB). For information more about how to debug a kernel-mode dump
file, including dump files that are stored inside CAB files, see Analyzing a Kernel-Mode Dump File.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!for_each_frame
The !for_each_frame extension executes a debugger command one time for each frame in the stack of the current thread.
Syntax
!for_each_frame ["CommandString"]
!for_each_frame -?
Parameters
CommandString
Specifies the debugger commands to execute one time for each frame. If CommandString includes multiple commands, you must separate them with semicolons and
enclose CommandString in quotation marks. If you include multiple commands, the individual commands within CommandString cannot contain quotation marks. If you
want to refer to the index of the current frame within Command, use the @$frame pseudoregister.
-?
Displays some Help text for this extension in the Debugger Command window.
DLL
Windows 2000
Ext.dll
Windows XP and later Ext.dll
Comments
If you do not specify any arguments, the !for_each_frame extension displays a list of all frames and their frame indexes. For a more detailed list of all frames, use the
k (Display Stack Backtrace) command.
The k command walks up to 256 frames. For each enumerated frame, that frame temporarily becomes the current local context (similar to the .frame (Set Local Context)
command). After the context has been set, CommandString is executed. After all frames have been used, the local context is reset to the value that it had before you used the !
for_each_frame extension.
If you include CommandString, the debugger displays the frame and its index before the command is executed for that frame.
The following command displays all local variables for the current stack.
!for_each_frame !for_each_local dt @#Local
Additional Information
For more information about the local context, see Changing Contexts.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!for_each_local
The !for_each_local extension executes a debugger command one time for each local variable in the current frame.
Syntax
!for_each_local ["CommandString"]
!for_each_local -?
Parameters
CommandString
Specifies the debugger commands to execute one time for each local variable in the current stack frame. If CommandString includes multiple commands, you must
separate them with semicolons and enclose CommandString in quotation marks. If you include multiple commands, the individual commands in CommandString cannot
contain quotation marks.
Within CommandString, or within any script that the commands in CommandString execute, you can use the @#Local alias. This alias is replaced by the name of the
local variable. This replacement occurs before CommandString is executed and before any other parsing occurs. This alias is case sensitive, and you must add a space
before it and add a space after it, even if you enclose the alias in parentheses. If you use C++ expression syntax, you must reference this alias as @@( @#Local ).
This alias is available only during the lifetime of the call to !for_each_local. Do not confuse this alias with pseudo-registers, fixed-name aliases, or user-named aliases.
-?
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Displays some Help text for this extension in the Debugger Command window.
DLL
Windows 2000
Ext.dll
Windows XP and later Ext.dll
Comments
If you do not specify any arguments, the !for_each_local extension lists local variables. For more information about the local variables, use the dv (Display Local Variables)
command.
If you enable verbose debugger output, the display includes the total number of local variables when the extension is called, and every time that CommandString is executed
for a local variable, that variable and the text of CommandString are echoed.
Additional Information
For more information about how to display and change local variables and a description of other memory-related commands, see Reading and Writing Memory.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!for_each_module
The !for_each_module extension executes a debugger command one time for each loaded module.
Syntax
!for_each_module ["CommandString"]
!for_each_module -?
Parameters
CommandString
Specifies the debugger commands to execute one time for each module in the debugger's module list. If CommandString includes multiple commands, you must separate
them with semicolons and enclose CommandString in quotation marks. If you include multiple commands, the individual commands within CommandString cannot
contain quotation marks.
You can use the following aliases in CommandString or in any script that the commands in CommandString executes.
Alias
@#FileVersion
@#ProductVersion
@#ModuleIndex
@#ModuleName
Data type
string
string
ULONG
string
Value
The file version of the module.
The product version of the module.
The module number. Modules are enumerated consecutively, starting with zero.
The module name. This name is typicalyl the file name without the file name extension. In some situations, the module name
differs significantly from the file name. For more information,see Executable Image Path.
@#ImageName
string
The name of the executable file, including the file name extension. Typically, the full path is included in user mode but not in
kernel mode.
@#LoadedImageName
string
Unless Microsoft CodeView symbols are present, this alias is the same as the image name.
@#MappedImageName
string
In most situations, this alias is NULL. If the debugger is mapping an image file (for example, during minidump debugging),
this alias is the name of the mapped image.
@#SymbolFileName
string
The path and name of the symbol file. If you have not loaded any symbols, this alias is the name of the executable file instead.
@#ModuleNameSize
ULONG The string length of the module name string, plus one.
@#ImageNameSize
ULONG The string length of the image name string, plus one.
@#LoadedImageNameSize ULONG The string length of the loaded image name string, plus one.
@#MappedImageNameSize ULONG The string length of the mapped image name string, plus one.
@#SymbolFileNameSize
ULONG The string length of the symbol file name string, plus one.
@#Base
ULONG64 The address of the start of the image.
@#Size
ULONG The size of the image, in bytes.
@#End
ULONG64 The address of the end of the image.
@#TimeDateStamp
ULONG The time and date stamp of the image. If you want to expand this time and date stamp into a readable date, use
the .formats (Show Number Formats) command.
@#Checksum
ULONG The checksum of the module.
@#Flags
ULONG The module flags. For a list of the DEBUG_MODULE_Xxx values, see Dbgeng.h.
@#SymbolType
USHORT The symbol type. For a list of the DEBUG_SYMTYPE_Xxx values, see Dbgeng.h.
These aliases are all replaced before CommandString is executed for each module and before any other parsing occurs. These aliases are case sensitive. You must add a
space before the alias and a space after it, even if the alias is enclosed in parentheses. If you use C++ expression syntax, you must reference these aliases as @@
( @#alias ).
These aliases are available only during the lifetime of the call to !for_each_module. Do not confuse them with pseudo-registers, fixed-name aliases, or user-named
aliases.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
-?
Displays some Help text for this extension in the Debugger Command window.
DLL
Windows 2000
Ext.dll
Windows XP and later Ext.dll
Comments
If you do not specify any arguments, the !for_each_module extension displays general information about the loaded modules. This information is similar to the information
that the following command shows.
!for_each_module .echo @#ModuleIndex : @#Base @#End @#ModuleName @#ImageName
@#LoadedImageName
For more information about loaded and unloaded modules, use the lm (List Loaded Modules) command.
If you enable verbose debugger output, the debugger displays the total number of loaded and unloaded modules when the extension is called, and the debugger displays
detailed information about each module (including the values of each available alias) before CommandString is executed for that module.
The following examples show how ot use the !for_each_module extension. The following commands display the global debug flags.
!for_each_module x ${@#ModuleName}!*Debug*Flag*
!for_each_module x ${@#ModuleName}!g*Debug*
The following command checks for binary corruption in every loaded module, by using the !chkimg extension:
!for_each_module !chkimg @#ModuleName
The following command searches for the pattern "MZ" in every loaded image.
!for_each_module s-a @#Base @#End "MZ"
The following example demonstrates the use of @#FileVersion and @#ProductVersion for each module name:
0:000> !for_each_module .echo @#ModuleName fver = @#FileVersion pver = @#ProductVersion
USER32 fver = 6.0.6000.16438 (vista_gdr.070214-1610) pver = 6.0.6000.16438
kernel32 fver = 6.0.6000.16386 (vista_rtm.061101-2205) pver = 6.0.6000.16386
ntdll fver = 6.0.6000.16386 (vista_rtm.061101-2205) pver = 6.0.6000.16386
notepad fver = 6.0.6000.16386 (vista_rtm.061101-2205) pver = 6.0.6000.16386
WINSPOOL fver = 6.0.6000.16386 (vista_rtm.061101-2205) pver = 6.0.6000.16386
COMCTL32 fver = 6.10 (vista_rtm.061101-2205) pver = 6.0.6000.16386
SHLWAPI fver = 6.0.6000.16386 (vista_rtm.061101-2205) pver = 6.0.6000.16386
msvcrt fver = 7.0.6000.16386 (vista_rtm.061101-2205) pver = 7.0.6000.16386
GDI32 fver = 6.0.6000.16386 (vista_rtm.061101-2205) pver = 6.0.6000.16386
RPCRT4 fver = 6.0.6000.16525 (vista_gdr.070716-1600) pver = 6.0.6000.16525
SHELL32 fver = 6.0.6000.16513 (vista_gdr.070626-1505) pver = 6.0.6000.16513
ole32 fver = 6.0.6000.16386 (vista_rtm.061101-2205) pver = 6.0.6000.16386
ADVAPI32 fver = 6.0.6000.16386 (vista_rtm.061101-2205) pver = 6.0.6000.16386
COMDLG32 fver = 6.0.6000.16386 (vista_rtm.061101-2205) pver = 6.0.6000.16386
Additional Information
For more information about how to define and use aliases as shortcuts for entering character strings (including use of the ${ } token), see Using Aliases.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!gflag
The !gflag extension sets or displays the global flags.
Syntax
!gflag [+|-] Value
!gflag {+|-} Abbreviation
!gflag -?
!gflag
Parameters
Value
Specifies a 32-bit hexadecimal number. If you do not use a plus sign (+) or minus sign (-), this number becomes the new value of the global flag bit field. If you add a
plus sign (+) before this number, the number specifies one or more global flag bits to set to 1. If you add a minus sign (-) before this number, the number specifies one or
more global flag bits to set to zero.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Abbreviation
Specifies a single global flag. Abbreviation is a three-letter abbreviation for a global flag that is set to 1 (+) or to zero (-).
-?
Displays some Help text for this extension, including a list of global flag abbreviations, in the Debugger Command window.
DLL
Windows 2000
Kdextx86.dll
Ntsdexts.dll
Windows XP and later Exts.dll
Comments
If you do not specify any arguments, the !gflag extension displays the current global flag settings.
The following table contains the abbreviations that you can use for the Abbreviation parameter.
Value
Name
Description
0x00000001 "soe" Stop on exception.
0x00000002 "sls" Show loader snaps.
0x00000004 "dic" Debug initial command.
0x00000008 "shg" Stop if the GUI stops responding (that is, hangs).
0x00000010 "htc" Enable heap tail checking.
0x00000020 "hfc" Enable heap free checking.
0x00000040 "hpc" Enable heap parameter checking.
0x00000080 "hvc" Enable heap validation on call.
0x00000100 "ptc" Enable pool tail checking.
0x00000200 "pfc" Enable pool free checking.
0x00000400 "ptg" Enable pool tagging.
0x00000800 "htg" Enable heap tagging.
0x00001000 "ust" Create a user-mode stack trace DB.
0x00002000 "kst" Create a kernel-mode stack trace DB.
0x00004000 "otl" Maintain a list of objects for each type.
0x00008000 "htd" Enable heap tagging by DLL.
0x00010000 "idp" Unused.
0x00020000 "d32" Enable debugging of the Microsoft Win32 subsystem.
0x00040000 "ksl" Enable loading of kernel debugger symbols.
0x00080000 "dps" Disable paging of kernel stacks.
0x00100000 "scb" Enable critical system breaks.
0x00200000 "dhc" Disable heap coalesce on free.
0x00400000 "ece" Enable close exception.
0x00800000 "eel" Enable exception logging.
0x01000000 "eot" Enable object handle type tagging.
0x02000000 "hpa" Put heap allocations at the end of pages.
0x04000000 "dwl" Debug WINLOGON.
0x08000000 "ddp" Disable kernel-mode DbgPrint and KdPrint output.
0x10000000 NULL Unused.
0x20000000 NULL Unused.
0x40000000 NULL Unused.
0x80000000 "dpd" Disable protected DLL verification.
Additional Information
You can also set these flags by using the Global Flags utility (Gflags.exe).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!gle
The !gle extension displays the last error value for the current thread.
Syntax
!gle [-all]
Parameters
-all
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Displays the last error for each user-mode thread on the target system. If you omit this parameter in user mode, the debugger displays the last error for the current thread.
If you omit this parameter in kernel mode, the debugger displays the last error for the thread that the current register context specifies.
DLL
Windows 2000
Ext.dll
Ntsdexts.dll
Windows XP and later Ext.dll
Comments
The !gle extension displays the value of GetLastError and tries to decode this value.
In kernel mode, the !gle extension work only if the debugger can read the thread environment block (TEB).
Additional Information
For more information about the GetLastError routine, see the Micorosft Windows SDK documentation.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!gs
The !gs extension analyzes a /GS stack overflow.
Syntax
!gs
DLL
Windows 2000
Ext.dll
Windows XP and later Ext.dll
Comments
The !gs extension helps debug buffer overruns. Run !gs when you encounter a STATUS_STACK_BUFFER_OVERRUN error, as the following example shows.
0:000> !gs
Corruption occurred in mshtml!CDoc::OnPaint or one of its callers
Real canary not found at 0x74866010
Canary at gsfailure frame 0x292ea4e7
Corrupted canary 0x0013e2c8: 0x00000000
Corrupted cookie value too generic, skipping init bit-flip check
a caller of mshtml!CDoc::OnPaint has corrupted the EBP from 0x0013e254 to 0x0013
e234
check callers (without canary) of mshtml!CDoc::OnPaint for 0x1 bytes of overflow
The canary doesn't look corrupted. Not sure how we got here
EBP/ESP check skipped: No saved EBP in exception context
Function mshtml!CDoc::OnPaint:
00000000 - 00000004 this
CDoc*
0013de40 - 0013e180 rd
CDoc::OnPaint::__l39::REGION_DAT
A
0013e180 - 0013e18c Lock
CDoc::CLock
0013e18c - 0013e224 DI
CFormDrawInfo
0013e23c - 0013e240 hwndInplace
HWND__*
0013e240 - 0013e244 prc
tagRECT*
0013e248 - 0013e250 ptBefore
tagPOINT
0013e250 - 0013e254 fViewIsReady
int
0013e250 - 0013e254 fHtPalette
int
0013e254 - 0013e258 fNoPaint
int
0013e258 - 0013e260 ptAfter
tagPOINT
0013e260 - 0013e264 c
int
0013e264 - 0013e268 hrgn
HRGN__*
0013e268 - 0013e2a8 ps
tagPAINTSTRUCT
Candidate buffer : ps 0013e268 to 0013e2a7
0013e268 ea 04 01 a7 00 00 00 00-10 01 00 00 f3 00 00 00 ................
0013e278 ed 03 00 00 44 02 00 00-84 e5 13 00 f4 e2 13 00 ....D...........
...
0013e2ac 38 20 01 03 10 e3 13 00-68 6b e6 01 d0 e6 03 00 8 ......hk......
0013e2bc 80 fa 03 00 0d 00 00 00-10 08 19 00 00 00 00 00 ................
0:000>
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!handle
The !handle extension displays information about a handle or handles that one or all processes in the target system own.
Syntax
User-Mode
!handle [Handle [UMFlags [TypeName]]]
!handle -?
Kernel-Mode
!handle [Handle [KMFlags [Process [TypeName]]]]
Parameters
Handle
Specifies the index of the handle to display. If Handle is -1 or if you omit this parameter, the debugger displays data for all handles that are associated with the current
process. If Handle is 0, the debugger displays data for all handles.
UMFlags
(User mode only) Specifies what the display should contain. This parameter can be a sum of any of the following bit values. (The default value is 0x1.)
Bit 0 (0x1)
Displays handle type information.
Bit 1 (0x2)
Displays basic handle information.
Bit 2 (0x4)
Displays handle name information.
Bit 3 (0x8)
Displays object-specific handle information, when available.
KMFlags
(Kernel mode only) Specifies what the display should contain. This parameter can be a sum of any of the following bit values. (The default value is 0x3.)
Bit 0 (0x1)
Displays basic handle information.
Bit 1 (0x2)
Displays information about objects.
Bit 2 (0x4)
Displays free handle entries. If you do not set this bit and you omit Handle or set it to zero, the list of handles that are displayed does not include free handles. If
Handle specifies a single free handle, it is displayed even if you do not set this bit.
Bit 4 (0x10)
(Windows XP and later) Displays the handle from the kernel handle table instead of the current process.
Bit 5 (0x20)
(Windows XP and later) Interprets the handle as a thread ID or process ID and displays information about the corresponding kernel object.
Process
(Kernel mode only) Specifies a process. You can use the process ID or the hexadecimal address of the process object. This parameter must refer to a currently running
process on the target system. If this parameter is -1 or if you omit it, the current process is used.
TypeName
Specifies the type of handle that you want to examine. Only handles that match this type are displayed. TypeName is case sensitive. Valid types include Event, Section,
File, Port, Directory, SymbolicLink, Mutant, WindowStation, Semaphore, Key, Token, Process, Thread, Desktop, IoCompletion, Timer, Job, and WaitablePort.
-?
(User mode only) Displays some Help text for this extension in the Debugger Command window.
DLL
Windows 2000
Kdextx86.dll
Uext.dll
Ntsdexts.dll
Windows XP and later Kdexts.dll
Uext.dll
Ntsdexts.dll
Comments
You can use the !handle extension during user-mode and kernel-mode live debugging. You can also use this extension on kernel-mode dump files. However, you cannot use
this extension on user-mode dump files, unless you specifically created them with handle information. (You can create create such dump files by using the .dump /mh
(Create Dump File) command.)
During live user-mode debugging, you can use the .closehandle (Close Handle) command to close one or more handles.
The following examples are user-mode examples of the !handle extension. The following command displays a list of all handles.
0:000> !handle
Handle 4
Type
Section
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Handle 8
Type
Handle c
Type
Handle 10
Type
Handle 14
Type
Handle 5c
Type
6 Handles
Type
Event
Section
File
Directory
Event
Event
Event
Directory
File
Count
3
1
1
1
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!heap
The !heap extension displays heap usage information, controls breakpoints in the heap manager, detects leaked heap blocks, searches for heap blocks, or displays page heap
information.
Syntax
Syntax in Windows 2000
!heap
!heap
!heap
!heap
!heap
Parameters
Heap
Specifies either a heap index number or a heap address. The default is 1; this specifies the process heap. Zero causes the command to display information about all heaps
in the process. Omitting Heap gives a concise list of all heaps in the process.
HeapOptions
Can be any combination of the following options. The HeapOptions values are case-sensitive.
Option
Effect
-v
Causes the debugger to validate the specified heap.
-a
Causes the display to include all information for the specified heap. Size, in this case, is rounded up to the heap granularity. (Running !heap with the a option
is equivalent to running it with the three options -h -f -m, which can take a long time.)
-h
Causes the display to include all entries for the specified heap.
-f
Causes the display to include all the free list entries for the specified heap.
-m
Causes the display to include all the segment entries for the specified heap.
-t
Causes the display to include the tag information for the specified heap.
-T
Causes the display to include the pseudo-tag entries for the specified heap.
-g
Causes the display to include the global tag information. Global tags are associated with each untagged allocation.
-s
Causes the display to include summary information for the specified heap.
-k
(x86-based targets only) Causes the display to include the stack backtrace associated with each entry.
ValidationOptions
Can be any single one of the following options. The ValidationOptions are case-sensitive.
Option
Effect
-D
Disables validate-on-call for the specified heap.
-E
Enables validate-on-call for the specified heap.
-d
Disables heap checking for the specified heap.
-e
Enables heap checking for the specified heap.
BreakAddress
Specifies the address of a block where a breakpoint is to be set or removed.
-b
Causes the debugger to create a conditional breakpoint in the heap manager. The -b option can be followed by alloc, realloc, or free; this specifies whether the
breakpoint will be activated by allocating, reallocating, or freeing memory. If BreakAddress is used to specify the address of the block, the breakpoint type can be
omitted. If Heap is used to specify the heap address or heap index, the type must be included, as well as the Tag parameter.
Tag
Specifies the tag name within the heap.
-B
Causes the debugger to remove a conditional breakpoint from the heap manager. The breakpoint type (alloc, realloc, or free) must be specified, and must be the same as
that used with the -b option.
-l
(Windows XP and later) Causes the debugger to detect leaked heap blocks.
-s
(Windows XP and later) Specifies that summary information is being requested. If SummaryOptions and StatHeapAddress are omitted, then summary information is
displayed for all heaps associated with the current process.
SummaryOptions
(Windows XP and later) Can be any combination of the following options. The SummaryOptions are not case-sensitive.
Option
Effect
-v
Verifies all data blocks.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
-b BucketSize
Specifies the bucket size. The default is 1024 bits.
-d DumpBlockSize Specifies the bucket size.
-a
Specifies that the contents of each block should be displayed.
-c
StatHeapAddress
(Windows XP and later) Specifies the address of the heap. If this is 0 or omitted, all heaps associated with the current process are displayed.
-i Heap
(Windows XP and later) Displays information about the specified Heap.
-x [-v]
(Windows XP and later) Causes the debugger to search for the heap block containing the specified address. If -v is added, the command will search the entire virtual
memory space of the current process for pointers to this heap block.
Address
(Windows XP and later) Specifies the address to search for.
-p
Specifies that page heap information is being requested. If this is used without any PageHeapOptions, all page heaps will be displayed.
PageHeapOptions
Can be any single one of the following options. The PageHeapOptions are case-sensitive. If no options are specified, then all possible page heap handles will be
displayed.
Option
Effect
-h Handle Causes the debugger to display detailed information about a page heap with handle Handle.
-a
Causes the debugger to find the page heap whose block contains Address. Full details of how this address relates to full-page heap blocks will be included,
Address such as whether this address is part of a page heap, its offset inside the block, and whether the block is allocated or was freed. Stack traces are included
whenever available. When using this option, size is displayed in multiples of the heap allocation granularity.
-t[c|s]
Causes the debugger to display the collected traces of the heavy heap users. Traces specifies the number of traces to display; the default is four. If there are
[Traces] more traces than the specified number, the earliest traces are displayed. If -t or -tc is used, the traces are sorted by count usage. If -ts is used, the traces are
sorted by size. (The -tc and -ts options are supported in Windows XP only; the -t option is supported only in Windows XP and earlier versions of Windows.)
-fi
(Windows XP and later) Causes the debugger to display the most recent fault injection traces. Traces specifies the quantity to be displayed; the default is 4.
[Traces]
-all
(Windows XP and later) Causes the debugger to display detailed information about all page heaps.
-?
Causes the debugger to display page heap help, including a diagram of heap blocks. (These diagrams can also be seen in the following Comments section.)
Before you can use any !heap -p extension command, the page heap must be enabled for your target process. See details in the following Comments section.
-srch
(Windows XP and later) Scans all heaps for the given pattern.
Pattern
(Windows XP and later) Specifies a pattern for which to look.
Size
(Windows XP and later) Can be any single one of the following options. This specifies the size of the pattern. The '-' is required.
Option
Effect
-b
The pattern is one BYTE in size.
-w
The pattern is one WORD in size.
-d
The pattern is one DWORD in size.
-q
The pattern is one QWORD in size.
If none of the above are specified, then the pattern is assumed to be of the same size as the machine pointer.
-flt
(Windows XP and later) Limits the display to include only heaps with the specified size or size range.
FilterOptions
(Windows XP and later) Can be any single one of the following options. The FilterOptions are case-sensitive.
Option
Effect
s Size
Limits the display to include only heaps of the specified size.
r SizeMin SizeMax Limits the display to include only heaps within the specified size range.
-stat
(Windows XP and later) Displays usage statistics for the specified heap.
-h Handle
(Windows XP and later) Causes usage statistics for only the heap at Handle to be displayed. If Handle is 0 or omitted, then usage statistics for all heaps are displayed.
-grp GroupBy
(Windows XP and later) Reorders the display as specified by GroupBy. The options for GroupBy can be found in the following table.
Option
Effect
A
Displays the usage statistics according to allocation size.
B
Displays the usage statistics according to block count.
S
Displays the usage statistics according to the total size of each allocation.
MaxDisplay
(Windows XP and later) Limits the output to only MaxDisplay number of lines.
-?
Displays some brief Help text for this extension in the Debugger Command window. Use !heap -? for generic help, and !heap -p -? for page heap help.
DLL
Windows 2000
Ext.dll
Kdextx86.dll
Ntsdexts.dll
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
First Entry:
00250bc8
Last Entry:
00350000
Total Pages:
00000080
Total UnCommit: 00000055
Largest UnCommit:000aa000
UnCommitted Ranges: (1)
002a6000: 000aa000
Heap entries for Segment00
0x01 0x02 0x04 0x08 0x10 0x20 0x40 Entry
Prev
Cur
0x80 Address
00250000:
00250b90:
00250bc8:
00250c08:
00250c68:
00250c90:
00250cf0:
00250d40:
00250d88:
00251998:
...
002525c0:
00252620:
00252670:
002526b0:
002526f0:
00252730:
00252758:
002527b0:
002527c0:
00252818:
00252ae8:
00252e18:
00253148:
002533f0:
00253420:
00253450:
002534e8:
00253548:
00253568:
00253590:
...
0025ccb8:
0025cd18:
0025cd70:
0025cda0:
0025cdc0:
0025d018:
0025e030:
...
002a4190:
002a42a8:
002a42d8:
002a4370:
002a6000:
in Heap 250000
HEAP_ENTRY_BUSY
HEAP_ENTRY_EXTRA_PRESENT
HEAP_ENTRY_FILL_PATTERN
HEAP_ENTRY_VIRTUAL_ALLOC
HEAP_ENTRY_LAST_ENTRY
HEAP_ENTRY_SETTABLE_FLAG1
HEAP_ENTRY_SETTABLE_FLAG2
HEAP_ENTRY_SETTABLE_FLAG3
Size
00000
00b90
00038
00040
00060
00028
00060
00050
00048
00c10
.
.
.
.
.
.
.
.
.
.
Size
00b90
00038
00040
00060
00028
00060
00050
00048
00c10
00030
flags
[01] [01] [07] [07] [07] [07] [07] [07] [07] [07] -
00030
00060
00050
00040
00040
00040
00028
00058
00010
00058
002d0
00330
00330
002a8
00030
00030
00098
00060
00020
00028
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
00060
00050
00040
00040
00040
00028
00058
00010
00058
002d0
00330
00330
002a8
00030
00030
00098
00060
00020
00028
00030
[07]
[07]
[07]
[07]
[07]
[07]
[07]
[04]
[07]
[07]
[07]
[07]
[07]
[07]
[07]
[07]
[07]
[07]
[07]
[07]
00038
00060
00058
00030
00020
00258
01018
.
.
.
.
.
.
.
00060
00058
00030
00020
00258
01018
00060
[07]
[07]
[07]
[06]
[07]
[07]
[07]
. 00118
. 00030
. 00098
. 01c90
000aa000
[07]
[07]
[07]
[14]
00028
00118
00030
00098
busy
busy
busy
busy
busy
busy
busy
busy
busy
busy
(Bytes used)
(Tag name)
(b90)
(38)
(24), tail fill (NTDLL!LDR Database)
(48), tail fill (NTDLL!LDR Database)
(10), tail fill (NTDLL!LDR Database)
(48), tail fill (NTDLL!LDR Database)
(38), tail fill (Objects= 80)
(2e), tail fill (NTDLL!LDR Database)
(bf4), tail fill (Objects>1024)
(12), tail fill (NTDLL!LDR Database)
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
001ba208 001ba210
001cbc90 001cbc98
001cbd70 001cbd78
001cbe90 001cbe98
001cbef8 001cbf00
001cc078 001cc080
001cc360 001cc368
001cc3e0 001cc3e8
001fe550 001fe558
001fe6e8 001fe6f0
002057a8 002057b0
00205800 00205808
002058b8 002058c0
00205910 00205918
00205958 00205960
00246970 00246978
00251168 00251170
00527730 00527738
00527920 00527928
21 leaks detected.
00170000
00170000
00170000
00170000
00170000
00170000
00170000
00170000
00170000
00170000
00170000
00170000
00170000
00170000
00170000
00170000
00170000
00520000
00520000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
80
e0
d8
68
58
f8
80
58
150
48
58
48
58
48
90
60
78
40
40
78
48
e0
48
68
128
50
80
278
48
58
58
70
58
48
88
d0
40
80
busy
busy
busy
busy
busy
busy
busy
busy
busy
busy
busy
busy
busy
busy
busy
busy
busy
busy
busy
extra
extra
extra
extra
extra
extra
extra
extra
extra
extra
extra
extra
extra
extra
extra
extra
extra user_flag
extra
extra
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
+-----+---------------+---+
^
^
^
|
|
8 suffix bytes (filled with 0xA0)
|
User allocation (filled with F0 bytes)
Block header (starts with 0xABCDAAA9 and ends with 0xDCBAAA9)
Full page heap block allocated:
+-----+---------+---+------|
|
|
| ... N/A page
+-----+---------+---+------^
^
^
|
|
0-7 suffix bytes (filled with 0xD0)
|
User allocation (if zeroing not requested, filled
with E0 in Windows 2000 and C0 in Windows XP)
Block header (starts with 0xABCDBBBB and ends with 0xDCBABBBB)
Full page heap block freed:
+-----+---------+---+------|
|
|
| ... N/A page
+-----+---------+---+------^
^
^
|
|
0-7 suffix bytes (filled with 0xD0)
|
User allocation (filled with F0 bytes)
Block header (starts with 0xABCDBBA and ends with 0xDCBABBBA)
To see the stack trace of the allocation or the freeing of a heap block or full page heap block in Windows 2000, use dds (Display Words and Symbols) with the header
address.
To see the stack trace of the allocation or the freeing of a heap block or full page heap block in Windows XP or a later version of Windows, use
dt DPH_BLOCK_INFORMATION with the header address, followed by dds with the block's StackTrace field.
Full page heap blocks in Windows 2000 reside at the beginning of the page containing the user allocation, or at the previous page.
Additional Information
For information about heaps, see the Microsoft Windows SDK documentation, the Windows Driver Kit (WDK) documentation, and Microsoft Windows Internals by Mark
Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!help
The !help extension displays help text that describes the extension commands exported from the extension DLL.
Do not confuse this extension command with the ? (Command Help) or .help (Meta-Command Help) commands.
Syntax
![ExtensionDLL.]help [-v] [CommandName]
Parameters
ExtensionDLL
Displays help for the specified extension DLL. Type the name of an extension DLL without the .dll file name extension. If the DLL file is not in the extension search
path (as displayed by using .chain (List Debugger Extensions)), include the path to the DLL file . For example, to display help for uext.dll, type !uext.help or !
Path\winext\uext.help.
If you omit the ExtensionDLL, the debugger will display the help text for the first extension DLL in the list of loaded DLLs.
-v
Displays the most detailed help text available. This feature is not supported in all DLLs.
CommandName
Displays only the help text for the specified command. This feature is not supported in all DLLs or for all commands.
DLL
This extension is supported by most extension DLLs.
Comments
Some individual commands will also display a help text if you use the /? or -? parameter with the command name.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!homedir
The !homedir extension sets the default directory used by the symbol server and the source server.
Syntax
!homedir Directory
!homedir
Parameters
Directory
Specifies the new directory to use as the home directory.
DLL
Windows 2000
Dbghelp.dll
Windows XP and later Dbghelp.dll
Comments
If the !homedir extension is used with no argument, the current home directory is displayed.
The cache for a source server is located in the src subdirectory of the home directory. The downstream store for a symbol server defaults to the sym subdirectory of the home
directory, unless a different location is specified.
When WinDbg is started, the home directory is the directory where Debugging Tools for Windows was installed. The !homedir extension can be used to change this value.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!htrace
The !htrace extension displays stack trace information for one or more handles.
Syntax
User-Mode Syntax
!htrace
!htrace
!htrace
!htrace
!htrace
!htrace
[Handle [Max_Traces]]
-enable [Max_Traces]
-snapshot
-diff
-disable
-?
Kernel-Mode Syntax
!htrace [Handle [Process [Max_Traces]]]
!htrace -?
Parameters
Handle
Specifies the handle whose stack trace will be displayed. If Handle is 0 or omitted, stack traces for all handles in the process will be displayed.
Process
(Kernel mode only) Specifies the process whose handles will be displayed. If Process is 0 or omitted, then the current process is used. In user mode, the current process is
always used.
Max_Traces
Specifies the maximum number of stack traces to display. In user mode, if this parameter is omitted, then all the stack traces for the target process will be displayed.
-enable
(User mode only) Enables handle tracing and takes the first snapshot of the handle information to use as the initial state by the -diff option.
-snapshot
(User mode only) Takes a snapshot of the current handle information to use as the initial state by the -diff option.
-diff
(User mode only) Compares current handle information with the last snapshot of handle information that was taken. Displays all handles that are still open.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
-disable
(User mode only; Windows Server 2003 and later only) Disables handle tracing. In Windows XP, handle tracing can be disabled only by terminating the target process.
-?
Displays some brief Help text for this extension in the Debugger Command window.
DLL
Windows 2000
Unavailable
Windows XP and later Kdexts.dll
Ntsdexts.dll
Comments
Before !htrace can be used, handle tracing must be enabled. One way to enable handle tracing is to enter the !htrace enable command. When handle tracing is enabled,
stack trace information is saved each time the process opens a handle, closes a handle, or references an invalid handle. It is this stack trace information that !htrace displays.
Note You can also enable handle tracing by activating Application Verifier for the target process and selecting the Handles option.
Some of the traces reported by !htrace may be from a different process context. In this case, the return addresses may not resolve properly in the current process context, or
may resolve to the wrong symbols.
The following example displays information about all handles in process 0x81400300:
kd> !htrace 0 81400300
Process 0x81400300
ObjectTable 0xE10CCF60
-------------------------------------Handle 0x7CC - CLOSE:
0x8018FCB9: ntoskrnl!ExDestroyHandle+0x103
0x801E1D12: ntoskrnl!ObpCloseHandleTableEntry+0xE4
0x801E1DD9: ntoskrnl!ObpCloseHandle+0x85
0x801E1EDD: ntoskrnl!NtClose+0x19
0x010012C1: badhandle!mainCRTStartup+0xE3
0x77DE0B2F: KERNEL32!BaseProcessStart+0x3D
-------------------------------------Handle 0x7CC - OPEN:
0x8018F44A: ntoskrnl!ExCreateHandle+0x94
0x801E3390: ntoskrnl!ObpCreateUnnamedHandle+0x10C
0x801E7317: ntoskrnl!ObInsertObject+0xC3
0x77DE23B2: KERNEL32!CreateSemaphoreA+0x66
0x010011C5: badhandle!main+0x45
0x010012C1: badhandle!mainCRTStartup+0xE3
0x77DE0B2F: KERNEL32!BaseProcessStart+0x3D
-------------------------------------Handle 0x7DC - BAD REFERENCE:
0x8018F709: ntoskrnl!ExMapHandleToPointerEx+0xEA
0x801E10F2: ntoskrnl!ObReferenceObjectByHandle+0x12C
0x801902BE: ntoskrnl!NtSetEvent+0x6C
0x80154965: ntoskrnl!_KiSystemService+0xC4
0x010012C1: badhandle!mainCRTStartup+0xE3
0x77DE0B2F: KERNEL32!BaseProcessStart+0x3D
-------------------------------------Handle 0x7DC - CLOSE:
0x8018FCB9: ntoskrnl!ExDestroyHandle+0x103
0x801E1D12: ntoskrnl!ObpCloseHandleTableEntry+0xE4
0x801E1DD9: ntoskrnl!ObpCloseHandle+0x85
0x801E1EDD: ntoskrnl!NtClose+0x19
0x010012C1: badhandle!mainCRTStartup+0xE3
0x77DE0B2F: KERNEL32!BaseProcessStart+0x3D
-------------------------------------Handle 0x7DC - OPEN:
0x8018F44A: ntoskrnl!ExCreateHandle+0x94
0x801E3390: ntoskrnl!ObpCreateUnnamedHandle+0x10C
0x801E7317: ntoskrnl!ObInsertObject+0xC3
0x77DE265C: KERNEL32!CreateEventA+0x66
0x010011A0: badhandle!main+0x20
0x010012C1: badhandle!mainCRTStartup+0xE3
0x77DE0B2F: KERNEL32!BaseProcessStart+0x3D
-------------------------------------Parsed 0x6 stack traces.
Dumped 0x5 stack traces.
Additional Information
For information about handles, see the Microsoft Windows SDK documentation and Microsoft Windows Internals by Mark Russinovich and David Solomon. To display
further information about a specific handle, use the !handle extension.
2009 Microsoft Corporation
Send feedback on this topic
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!imggp
The !imggp extension displays the global pointer (GP) directory entry value for a 64-bit image.
Syntax
!imggp Address
Parameters
Address
Specifies the base address of the image.
DLL
Windows 2000
Ext.dll
Windows XP and later Ext.dll
!imgreloc
The !imgreloc extension displays the addresses of each loaded module and indicates their former addresses before they were relocated.
Syntax
!imgreloc Address
Parameters
Address
Specifies the base address of the image.
DLL
Windows 2000
Ext.dll
Windows XP and later Ext.dll
Comments
Here is an example:
0:000> !imgreloc 00400000
00400000 Prymes - at preferred address
010e0000 appvcore - RELOCATED from 00400000
5b2f0000 verifier - at preferred address
5d160000 ShimEng - at preferred address
!kuser
The !kuser extension displays the shared user-mode page (KUSER_SHARED_DATA).
Syntax
!kuser
DLL
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Windows 2000
Kdextx86.dll
Ntsdexts.dll
Windows XP and later Exts.dll
Comments
The KUSER_SHARED_DATA page gives resource and other information about the user who is currently logged on.
Here is an example. Note that, in this example, the tick count is displayed in both its raw form and in a more user-friendly form, which is in parentheses. The user-friendly
display is available only in Windows XP and later.
kd> !kuser
_KUSER_SHARED_DATA at 7ffe0000
TickCount:
fa00000 * 00482006 (0:20:30:56.093)
TimeZone Id: 2
ImageNumber Range: [14c .. 14c]
Crypto Exponent: 0
SystemRoot: 'F:\WINDOWS'
!list
The !list extension executes the specified debugger commands repeatedly, once for every element in a linked list.
Syntax
!list -t [Module!]Type.Field -x "Commands" [-a "Arguments"] [Options] StartAddress
!list " -t [Module!]Type.Field -x \"Commands\" [-a \"Arguments\"] [Options] StartAddress "
!list -h
Parameters
Module
An optional parameter specifying the module that defines this structure. If there is a chance that Type may match a valid symbol in a different module, you should include
Module to eliminate the ambiguity.
Type
Specifies the name of a data structure.
Field
Specifies the field containing the list link. This can actually be a sequence of fields separated by periods (in other words, Type.Field.Subfield.Subsubfield, and so on).
-x "Commands"
Specifies the commands to execute. This can be any combination of debugger commands. It must be enclosed in quotation marks. If multiple commands are specified,
separate them with semicolons, enclose the entire collection of !list arguments in quotation marks, and use an escape character ( \ ) before each quotation mark inside
these outer quotation marks. If Commands is omitted, the default is dp (Display Memory).
-a "Arguments"
Specifies the arguments to pass to the Commands. This must be enclosed in quotation marks. Arguments can be any valid argument string that would normally be allowed
to follow this command, except that Arguments cannot contain quotation marks. If the pseudo-register $extret is included in Commands, the -a "Arguments" parameter
can be omitted.
Options
Can be any number of the following options:
-e
Echoes the command being executed for each element.
-m Max
Specifies the maximum number of elements to execute the command for.
StartAddress
Specifies the address of the first data structure. This is the address at the top of the structure, not necessarily the address of the link field.
-h
Displays some brief Help text for this extension in the Debugger Command window.
DLL
Windows 2000
Ext.dll
Windows XP and later Ext.dll
Comments
The !list extension will go through the linked list and issue the specified command once for each list element.
The pseudo-register $extret is set to the value of the list-entry address for each list element. For each element, the command string Commands is executed. This command
string can reference this pseudo-register using the @$extret syntax. If this does not appear in the command string, the value of the list-entry address is appended to the end of
the command string before execution. If you need to specify where this value should appear in your command, you must specify this pseudo-register explicitly.
This command sequence will run until the list terminates in a null pointer, or terminates by looping back onto the first element. If the list loops back onto a later element, this
command will not stop. However, you can stop this command at any time by using CTRL+C in KD and CDB, or Debug | Break or CTRL+BREAK in WinDbg.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Each time a command is executed, the address of the current structure will be used as the default address if the command being used has optional address parameters.
Following are two examples of how to use this command in user mode. Note that kernel mode usage is also possible but follows a different syntax.
As a simple example, assume that you have a structure whose type name is MYTYPE, and which has links within its .links.Flink and .links.Blink fields. You have a linked
list that begins with the structure at 0x6BC000. The following extension command will go through the list and for each element will execute a dd L2 command. Because no
address is being specified to the dd command, it will take the address of the list head as the desired address. This causes the first two DWORDs in each structure to be
displayed.
0:000> !list -t MYTYPE.links.Flink -x "dd" -a "L2" 0x6bc00
As a more complex example, consider the case of using $extret. It follows the list of type _LIST_ENTRY at RtlCriticalSectionList. For each element, it displays the first
four DWORDS, and then displays the _RTL_CRITICAL_SECTION_DEBUG structure located at an offset of eight bytes prior to the Flink element of the list entry.
0:000> !list "-t ntdll!_LIST_ENTRY.Flink -e -x \"dd @$extret l4; dt ntdll!_RTL_CRITICAL_SECTION_DEBUG @$extret-0x8\" ntdll!RtlCri
dd @$extret l4; dt ntdll!_RTL_CRITICAL_SECTION_DEBUG @$extret-0x8
7c97c0c8 7c97c428 7c97c868 01010000 00000080
+0x000 Type
: 1
+0x002 CreatorBackTraceIndex : 0
+0x004 CriticalSection : (null)
+0x008 ProcessLocksList : _LIST_ENTRY [ 0x7c97c428 - 0x7c97c868 ]
+0x010 EntryCount
: 0x1010000
+0x014 ContentionCount : 0x80
+0x018 Spare
: [2] 0x7c97c100
dd @$extret l4; dt ntdll!_RTL_CRITICAL_SECTION_DEBUG @$extret-0x8
7c97c428 7c97c448 7c97c0c8 00000000 00000000
+0x000 Type
: 0
+0x002 CreatorBackTraceIndex : 0
+0x004 CriticalSection : 0x7c97c0a0
+0x008 ProcessLocksList : _LIST_ENTRY [ 0x7c97c448 - 0x7c97c0c8 ]
+0x010 EntryCount
: 0
+0x014 ContentionCount : 0
+0x018 Spare
: [2] 0
!lmi
The !lmi extension displays detailed information about a module.
Syntax
!lmi Module
Parameters
Module
Specifies a loaded module, either by name or by base address.
DLL
Windows 2000
Dbghelp.dll
Windows XP and later Dbghelp.dll
Comments
Module addresses can be determined by using the lm (List Loaded Modules) command.
The !lmi extension analyzes the module headers and displays a formatted summary of the information therein. If the module headers are paged out, an error message is
displayed. To see a more extensive display of header information, use the !dh extension command.
This command shows a number of fields, each with a different title. Some of these titles have specific meanings:
The Image Name field shows the name of the executable file, including the extension. Typically, the full path is included in user mode but not in kernel mode.
The Module field shows the module name. This is usually just the file name without the extension. In a few cases, the module name differs significantly from the file
name. For details, see Executable Image Path.
The Symbol Type field shows information about the debugger's attempts to load this module's symbols. For an explanation of the various status values, see Symbol
Status Abbreviations. If symbols have been loaded, the symbol file name follows this.
The first address in the module is shown as Base Address. The size of the module is shown as Size. Thus, if Base Address is "faab4000" and Size is "2000", the
module extends from 0xFAAB4000 to 0xFAAB5FFF, inclusive.
Here is an example:
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
0:000> lm
start
end
00400000 0042d000
77e80000 77f35000
77f80000 77ffb000
module name
Prymes
C (pdb symbols)
KERNEL32
(export symbols)
ntdll
(export symbols)
Prymes.pdb
C:\WINNT\system32\KERNEL32.dll
ntdll.dll
!mui
The !mui extension displays the Multilingual User Interface (MUI) cache information. The implementation of MUI was vastly improved in Windows Vista. As a result, the
behavior of this extension on earlier implementations is undefined.
Syntax
User-Mode Syntax
!mui
!mui
!mui
!mui
!mui
!mui
c
f
-i
-r ModuleAddress
-t
-?
Kernel-Mode Syntax
!mui
!mui
!mui
!mui
!mui
!mui
!mui
-c
f
-i
-s
-r ModuleAddress
-t
-?
Parameters
-c
Causes the output to include the language identifier (ID), a pointer to the module, a pointer to the resource configuration data, and a pointer to the associated MUI DLL
for each module.
-f
Causes the output to include the loader merged language fallback list.
-i
Causes the output to include the installed and licensed MUI languages and their associated information.
-r ModuleAddress
Causes the resource configuration data for the module at ModuleAddress to be displayed. This includes the file type, the checksum value, and the resource types.
-s
(Kernel Mode Only) Causes the display to include the full file paths for the module and associated MUI DLL for each module.
-t
Causes the output to include the thread preference language.
-?
Displays some brief Help text for this extension in the Debugger Command window.
DLL
Windows 2000
Unavailable
Windows XP
Unavailable
Windows Vista and later Exts.dll
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Additional Information
For information about MUI and resource configuration data format, see the Microsoft Windows SDK documentation.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!net_send
The !net_send extension sends a message over a local network.
Syntax
!net_send SendingMachine TargetMachine Sender Message
Parameters
SendingMachine
Specifies the computer that will process the command. It is recommended that this be the name of the computer that the debugger is running on, since your network
configuration may refuse to send the message otherwise. SendingMachine should not include leading backslashes (\\).
TargetMachine
Specifies the computer to which the message will be sent. TargetMachine should not include leading backslashes (\\).
Sender
Specifies the sender of the message. It is recommended that Sender be identical to SendingMachine, since your network configuration may refuse to send the message
otherwise. When the message is displayed, this string will be identified as the sender of the message.
Message
Specifies the message itself. All text after the Sender parameter will be treated as part of Message, including spaces and quotation marks, although a semicolon will
terminate Message and begin a new command.
DLL
Windows 2000
Ext.dll
Windows XP and later Ext.dll
!obja
The !obja extension displays the attributes of an object in the object manager.
Syntax
!obja Address
Parameters
Address
Specifies the hexadecimal address of the object header you want to examine.
DLL
Windows 2000
Ext.dll
Kdextx86.dll
Windows XP and later Ext.dll
Comments
The attributes pertaining to the specified object are listed. Valid attributes are:
#define
#define
#define
#define
#define
#define
#define
OBJ_INHERIT
OBJ_PERMANENT
OBJ_EXCLUSIVE
OBJ_CASE_INSENSITIVE
OBJ_OPENIF
OBJ_OPENLINK
OBJ_VALID_ATTRIBUTES
0x00000002L
0x00000010L
0x00000020L
0x00000040L
0x00000080L
0x00000100L
0x000001F2L
Here is an example:
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!owner
The !owner extension displays the owner of a module or function.
Syntax
!owner [Module[!Symbol]]
Parameters
Module
Specifies the module whose owner is desired. An asterisk (*) at the end of Module represents any number of additional characters.
Symbol
Specifies the symbol within Module whose owner is desired. An asterisk (*) at the end of Symbol represents any number of additional characters. If Symbol is omitted,
the owner of the entire module is displayed.
DLL
Windows 2000
Ext.dll
Windows XP and later Ext.dll
Comments
If no parameters are used and a fault has occurred, !owner will display the name of the owner of the faulting module or function.
When you pass a module or function name to the !owner extension, the debugger displays the word Followup followed by the name of owner of the specified module or
function.
For this extension to display useful information, you must first create a triage.ini file containing the names of the module and function owners.
For details on the triage.ini file and an example of the !owner extension, see Specifying Module and Function Owners.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!peb
The !peb extension displays a formatted view of the information in the process environment block (PEB).
Syntax
!peb [PEB-Address]
Parameters
PEB-Address
The hexadecimal address of the process whose PEB you want to examine. (This is not the address of the PEB as derived from the kernel process block for the process.) If
PEB-Address is omitted in user mode, the PEB for the current process is used. If it is omitted in kernel mode, the PEB corresponding to the current process context is
displayed.
DLL
Windows 2000
Kdextx86.dll
Ntsdexts.dll
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!psr
The !psr extension displays an Itanium processor status word (PSR).
Syntax
!psr PSR [DisplayLevel]
!psr @ipsr [DisplayLevel]
Parameters
PSR
Specifies the hexadecimal address of the PSR to be displayed.
@ipsr
Causes the ipsr register to be displayed.
DisplayLevel
Can be any one of the following options:
0
This causes only the values of each PSR field to be displayed. This is the default.
1
This causes the display to include more in-depth information on each of the PSR fields that are not reserved or ignored.
2
This causes the display to include more in-depth information on all of the PSR fields, including those that are ignored or reserved.
DLL
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Windows 2000
Unavailable
Windows XP and later Exts.dll
This extension command can only be used with an Itanium target computer.
Comments
Here are a couple of examples:
0:000> !psr @ipsr
psr:ia bn ed ri ss dd da id it mc is cpl rt tb lp db
0 1 0 0 0 0 0 0 1 0 0 3
1 0 0 0
si di pp sp dfh dfl dt pk i ic | mfh mfl ac up be
0 0 1 0 0
0
1 0 1 1 | 0
1
0 0 0
kd> !psr @ipsr 1
be
up
ac
mfl
mfh
ic
i
pk
dt
dfl
dfh
sp
pp
di
si
db
lp
tb
rt
cpl
is
mc
it
id
da
dd
ss
ri
ed
bn
ia
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
0
0
1
1
0
1
0
0
1
0
1
0
1
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
1
0
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
Big-Endian
User Performance monitor enable
Alignment Check
Lower floating-point registers written
Upper floating-point registers written
Interruption Collection
Interrupt enable
Protection Key enable
Data Address Translation enable
Disabled Floating-point Low register set
Disabled Floating-point High register set
Secure Performance monitors
Privileged Performance monitor enable
Disable Instruction set transition
Secure Interval timer
Debug Breakpoint fault enable
Lower Privilege transfer trap enable
Taken Branch trap enable
Register stack translation enable
Current Privilege Level
Instruction Set
Machine Abort Mask delivery disable
Instruction address Translation enable
Instruction Debug fault disable
Disable Data Access and Dirty-bit faults
Data Debug fault disable
Single Step enable
Restart Instruction
Exception Deferral
register Bank
Disable Instruction Access-bit faults
Additional Information
For more information, see Itanium Architecture, or consult an Intel architecture manual.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!rebase
The !rebase extension searches in a rebase.log file for a specified address or symbol.
Syntax
!rebase
!rebase
!rebase
!rebase
Parameters
-r
Attempts to load any module found in rebase.log.
Address
Specifies an address in standard hexadecimal format. The extension will search for DLLs near this address.
Path
Specifies the file path to the rebase.log. If Path is not specified, then the extension tries to guess the path to the rebase.log or, failing that, tries to read a rebase.log file
from the current working directory.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Symbol
Specifies the symbol or image name. The extension will search for DLLs that contain this substring.
-stack
Displays all modules in the current stack.
-?
Displays a brief help text for this extension in the Debugger Command window.
DLL
Windows 2000
Unavailable
Windows XP and later Ext.dll
!rtlavl
The !rtlavl extension displays the entries of an RTL_AVL_TABLE structure.
Syntax
!rtlavl Address [Module!Type]
!rtlavl -?
Parameters
Address
Specifies the address of the RTL_AVL_TABLE to display.
Module
Specifies the module in which the data structure is defined.
Type
Specifies the name of a data structure.
-?
Displays some brief Help text for this extension in the Debugger Command window.
DLL
Windows 2000
Ext.dll
Windows XP and later Ext.dll
Comments
Including the Module!Type option causes each entry in the table to be interpreted as having the given type.
The display can be interrupted at any time by pressing CTRL+BREAK (in WinDbg) or CTRL+C (in KD or CDB).
Additional Information
Use the !gentable extension to display AVL tables.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!sd
The !sd extension displays the security descriptor at the specified address.
Syntax
Syntax in Windows 2000:
!sd Address
Syntax in Windows XP and later
!sd Address [Flags]
Parameters
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Address
Specifies the hexadecimal address of the SECURITY_DESCRIPTOR structure.
Flags
(Windows XP and later) If this is set to 1, the friendly name is displayed. This includes the security identifier (SID) type, as well as the domain and user name for the
SID.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Exts.dll
Comments
Here is an example:
kd> !sd e1a96a80 1
->Revision: 0x1
->Sbz1
: 0x0
->Control : 0x8004
SE_DACL_PRESENT
SE_SELF_RELATIVE
->Owner
: S-1-5-21-518066528-515770016-299552555-2981724 (User: MYDOMAIN\myuser)
->Group
: S-1-5-21-518066528-515770016-299552555-513 (Group: MYDOMAIN\Domain Users)
->Dacl
:
->Dacl
: ->AclRevision: 0x2
->Dacl
: ->Sbz1
: 0x0
->Dacl
: ->AclSize
: 0x40
->Dacl
: ->AceCount
: 0x2
->Dacl
: ->Sbz2
: 0x0
->Dacl
: ->Ace[0]: ->AceType: ACCESS_ALLOWED_ACE_TYPE
->Dacl
: ->Ace[0]: ->AceFlags: 0x0
->Dacl
: ->Ace[0]: ->AceSize: 0x24
->Dacl
: ->Ace[0]: ->Mask : 0x001f0003
->Dacl
: ->Ace[0]: ->SID: S-1-5-21-518066528-515770016-299552555-2981724 (User: MYDOMAIN\myuser)
->Dacl
->Dacl
->Dacl
->Dacl
->Dacl
:
:
:
:
:
->Ace[1]:
->Ace[1]:
->Ace[1]:
->Ace[1]:
->Ace[1]:
->Sacl
is NULL
->AceType: ACCESS_ALLOWED_ACE_TYPE
->AceFlags: 0x0
->AceSize: 0x14
->Mask : 0x001f0003
->SID: S-1-5-18 (Well Known Group: NT AUTHORITY\SYSTEM)
Additional Information
For an application and an example of this command, see Determining the ACL of an Object. For information about security descriptors, see the Microsoft Windows SDK
documentation, the Windows Driver Kit (WDK) documentation, and Microsoft Windows Internals by Mark Russinovich and David Solomon. Also see !sid and !acl.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!sid
The !sid extension displays the security identifier (SID) at the specified address.
Syntax
Syntax in Windows 2000:
!sid Address
Syntax in Windows XP and later
!sid Address [Flags]
Parameters
Address
Specifies the address of the SID structure.
Flags
(Windows XP and later) If this is set to 1, the SID type, domain, and user name for the SID is displayed.
(Windows XP and later) If this is set to 1, the friendly name is displayed. This includes the SID type, as well as the domain and user name for the SID.
DLL
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Windows 2000
Kdextx86.dll
Windows XP and later Exts.dll
Comments
Here are two examples, one without the friendly name shown, and one with:
kd> !sid 0xe1bf35b8
SID is: S-1-5-21-518066528-515770016-299552555-513
kd> !sid 0xe1bf35b8 1
SID is: S-1-5-21-518066528-515770016-299552555-513 (Group: MYGROUP\Domain Users)
Additional Information
For information about SIDs, see the Microsoft Windows SDK documentation, the Windows Driver Kit (WDK) documentation, or Microsoft Windows Internals by Mark
Russinovich and David Solomon. Also see !sd and !acl.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!slist
The !slist extension displays a singly-linked list (SList).
Syntax
!slist Address [ Symbol [Offset] ]
!slist -?
Parameters
Address
Specifies the address of the SLIST_HEADER.
Symbol
Specifies the data type to use for display. If Symbol is specified, the debugger will assume that each node of the SList is an instance of this data type when displaying it.
Offset
Specifies the byte offset of the SList pointer within the structure.
-?
Displays some brief Help text for this extension in the Debugger Command window.
DLL
Windows 2000
Unavailable
Windows XP and later Exts.dll
Comments
If you know the nature of the linked structures, the Symbol and Offset parameters are very useful. To see the difference, here are two examples; the first omits the Symbol and
Offset parameters, while the second includes them.
0:000> !slist ListHead
SLIST HEADER:
+0x000 Alignment
+0x000 Next
+0x004 Depth
+0x006 Sequence
SLIST CONTENTS:
002643e8 002642c0
002642c0 00264198
00264198 00264070
00264070 00263f48
00263f48 00261420
00261420 002612f8
002612f8 002611d0
002611d0 002610a8
002610a8 00260f80
00260f80 00000000
0000000a
00000009
00000008
00000007
00000006
00000005
00000004
00000003
00000002
00000001
:
:
:
:
a000a002643e8
2643e8
a
a
6e676953
6e676953
6e676953
6e676953
6e676953
6e676953
6e676953
6e676953
6e676953
6e676953
72757461
72757461
72757461
72757461
72757461
72757461
72757461
72757461
72757461
72757461
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
+0x006 Sequence
SLIST CONTENTS:
002643e8
+0x000 ItemEntry
+0x004 Signature
+0x008 Description
002642c0
+0x000 ItemEntry
+0x004 Signature
+0x008 Description
00264198
+0x000 ItemEntry
+0x004 Signature
+0x008 Description
00264070
+0x000 ItemEntry
+0x004 Signature
+0x008 Description
00263f48
+0x000 ItemEntry
+0x004 Signature
+0x008 Description
00261420
+0x000 ItemEntry
+0x004 Signature
+0x008 Description
002612f8
+0x000 ItemEntry
+0x004 Signature
+0x008 Description
002611d0
+0x000 ItemEntry
+0x004 Signature
+0x008 Description
002610a8
+0x000 ItemEntry
+0x004 Signature
+0x008 Description
00260f80
+0x000 ItemEntry
+0x004 Signature
+0x008 Description
: a
: _SINGLE_LIST_ENTRY
: 0xa
: [260] "Signature is: 10"
: _SINGLE_LIST_ENTRY
: 9
: [260] "Signature is: 9"
: _SINGLE_LIST_ENTRY
: 8
: [260] "Signature is: 8"
: _SINGLE_LIST_ENTRY
: 7
: [260] "Signature is: 7"
: _SINGLE_LIST_ENTRY
: 6
: [260] "Signature is: 6"
: _SINGLE_LIST_ENTRY
: 5
: [260] "Signature is: 5"
: _SINGLE_LIST_ENTRY
: 4
: [260] "Signature is: 4"
: _SINGLE_LIST_ENTRY
: 3
: [260] "Signature is: 3"
: _SINGLE_LIST_ENTRY
: 2
: [260] "Signature is: 2"
: _SINGLE_LIST_ENTRY
: 1
: [260] "Signature is: 1"
!std_map
The !std_map extension displays the entries of a std::map tree.
Syntax
!std_map Address [Module!Type [TypeSize]]
!std_map -?
Parameters
Address
Specifies the address of the std::map tree to display.
Module
Specifies the module in which the data structure is defined.
Type
Specifies the name of a data structure. This must be expressed in Module!std::pair<Type1,Type2> form. If the TypeSize parameter is used, this parameter must be
enclosed in quotation marks.
TypeSize
Specifies the size of the data structure to make the symbols unambiguous.
-?
Displays some brief Help text for this extension in the Debugger Command window.
DLL
Windows 2000
Ext.dll
Windows XP and later Ext.dll
Comments
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Including the Module!Type option causes each entry in the table to be interpreted as having the given type.
Use dt -ve (Module!std::pair<Type1,Type2>) to display possible sizes.
Additional Information
To display other Standard Template Library (STL) defined templates, see !stl.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!stl
The !stl extension displays some of the known Standard Template Library (STL) templates.
Syntax
!stl [Options] Template
!stl -?
Parameters
Options
May include any of the following possibilities:
-v
Causes detailed output to be displayed.
-V
Causes more detailed output to be displayed, such as information on the progress of the extension, including when certain functions are called and returned.
Template
Specifies the name of the template to be displayed.
-?
Displays some brief Help text for this extension in the Debugger Command window.
DLL
Windows 2000
Unavailable
Windows XP and later Exts.dll
Comments
The verbose options will only take effect if the debugger's verbose mode is enabled.
This extension currently supports STL templates of the following types: string, wstring, vector<string>, vector<wstring>, list<string>, list<wstring>, and pointers to any of
the preceding types.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!str
The !str extension displays an ANSI_STRING or OEM_STRING structure.
Syntax
!str Address
Parameters
Address
Specifies the hexadecimal address of the ANSI_STRING or OEM_STRING structure.
DLL
Windows 2000
Ext.dll
Windows XP and later Ext.dll
Comments
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
ANSI strings are counted 8-bit character strings, as defined in the following structure:
typedef struct _STRING {
USHORT Length;
USHORT MaximumLength;
PCHAR Buffer;
} STRING;
typedef STRING ANSI_STRING;
typedef STRING OEM_STRING;
If the string is NULL-terminated, Length does not include the trailing NULL.
Additional Information
For more information about ANSI_STRING structures, see the Microsoft Windows SDK documentation.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!sym
The !sym extension controls noisy symbol loading and symbol prompts.
Syntax
!sym
!sym
!sym
!sym
!sym
noisy
quiet
prompts
prompts off
Parameters
noisy
Activates noisy symbol loading.
quiet
Deactivates noisy symbol loading.
prompts
Allows authentication dialog boxes to appear when SymSrv receives an authentication request.
prompts off
Suppresses all authentication dialog boxes when SymSrv receives an authentication request. This may result in SymSrv being unable to access symbols over the internet.
DLL
Windows 2000
Dbghelp.dll
Windows XP and later Dbghelp.dll
Comments
If the !sym extension is used with no arguments, the current state of noisy symbol loading and symbol prompting is displayed.
The !sym noisy and !sym quiet extensions control noisy symbol loading. For details and for other methods of displaying and changing this option, see SYMOPT_DEBUG.
The !sym prompts and !sym prompts off extensions control whether authentication dialogs are displayed when SymSrv encounters an authentication request. These
commands must be followed by .reload (Reload Module) for them to take effect. Authentication requests may be sent by proxy servers, internet firewalls, smart card readers,
and secure websites. For details and for other methods of changing this option, see Firewalls and Proxy Servers.
Note Noisy symbol loading should not be confused with noisy source loading that is controlled by the .srcnoisy (Noisy Source Loading) command.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!symsrv
The !symsrv extension closes the symbol server client.
Syntax
!symsrv close
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
DLL
Windows 2000
Dbghelp.dll
Windows XP and later Dbghelp.dll
Comments
The !symsrv close extension will close any active symbol server client.
This can be useful if you need to re-synchronize your connection.
If you have previously refused an internet authentication request, you will need to use !symsrv close to reconnect to the symbol store. See Firewalls and Proxy Servers for
details.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!teb
The !teb extension displays a formatted view of the information in the thread environment block (TEB).
Syntax
!teb [TEB-Address]
Parameters
TEB-Address
The hexadecimal address of the thread whose TEB you want to examine. (This is not the address of the TEB as derived from the kernel thread block for the thread.) If
TEB-Address is omitted in user mode, the TEB for the current process is used. If it is omitted in kernel mode, the TEB corresponding to the current register context is
displayed.
DLL
Windows 2000
Kdextx86.dll
Ntsdexts.dll
Windows XP and later Exts.dll
Comments
The TEB is the user-mode portion of Microsoft Windows thread control structures.
If the !teb extension with no argument gives you an error in kernel mode, you should use the !process extension to determine the TEB address for the desired thread. Make
sure your register context is set to the desired thread, and then use the TEB address as the argument for !teb.
Here is an example of this command's output in user mode:
0:001> ~
0 id: 324.458
. 1 id: 324.48c
0:001> !teb
TEB at 7FFDD000
ExceptionList:
76ffdc
Stack Base:
770000
Stack Limit:
76f000
SubSystemTib:
0
FiberData:
1e00
ArbitraryUser:
0
Self:
7ffdd000
EnvironmentPtr:
0
ClientId:
324.48c
Real ClientId:
324.48c
RpcHandle:
0
Tls Storage:
0
PEB Address:
7ffdf000
LastErrorValue:
0
LastStatusValue: 0
Count Owned Locks:0
HardErrorsMode:
0
The similar !peb extension displays the process environment block.
Additional Information
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
For information about thread environment blocks, see Microsoft Windows Internals by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!tls
The !tls extension displays a thread local storage (TLS) slot.
Syntax
!tls Slot [TEB]
Parameters
Slot
Specifies the TLS slot. This can be any value between 0 and 1088 (decimal). If Slot is -1, all slots are displayed.
TEB
Specifies the thread environment block (TEB). If this is 0 or omitted, the current thread is used.
DLL
Windows 2000
Unavailable
Windows XP and later Exts.dll
Comments
Here is an example:
0:000> !tls -1
TLS slots on thread: c08.f54
0x0000 : 00000000
0x0001 : 003967b8
0:000> !tls 0
c08.f54: 00000000
!token
The !token extension displays a formatted view of a security token object.
Syntax
Syntax in Windows 2000 (kernel mode only)
!token [Address]
Kernel-Mode Syntax in Windows XP and later
!token [-n] [Address]
!token -?
User-Mode Syntax in Windows XP and later
!token [-n] [Handle]
!token -?
Parameters
Address
(Kernel mode only) Specifies the address of the token to be displayed. If this is 0 or omitted, the token for the active thread is displayed.
Handle
(User mode only) Specifies the handle of the token to be displayed. If this is 0 or omitted, the token associated with the target thread is displayed.
-n
(Windows XP and later; user mode only) Causes the display to include the friendly name. This includes the security identifier (SID) type, as well as the domain and user
name for the SID. This option cannot be used when you are debugging LSASS.
-?
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
(Windows XP and later) Displays some brief Help text for this extension in the Debugger Command window.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Exts.dll
In Windows 2000, !token is only available in kernel-mode debugging. In Windows XP and later operating systems, !token is available in kernel-mode and live user-mode
debugging. It cannot be used on user-mode dump files.
Comments
The TOKEN structure is a security object type that represents an authenticated user process. Every process has an assigned token, which becomes the default token for each
thread of that process. However, an individual thread can be assigned a token that overrides this default.
You can get the token address from the output of !process. To display a list of the individual fields of the TOKEN structure, use the !tokenfields extension in Windows 2000,
or use the dt nt!_TOKEN command in Windows XP or later.
Here is an example:
kd> !process 81464da8 1
PROCESS 81464da8 SessionId: 0 Cid: 03bc
Peb: 7ffdf000 ParentCid: 0124
DirBase: 0dec2000 ObjectTable: e1a31198 TableSize: 275.
Image: MSMSGS.EXE
VadRoot 81468cc0 Vads 170 Clone 0 Private 455. Modified 413. Locked 0.
DeviceMap e1958438
Token
e1bed030
ElapsedTime
0:44:15.0142
UserTime
0:00:00.0290
KernelTime
0:00:00.0300
QuotaPoolUsage[PagedPool]
49552
QuotaPoolUsage[NonPagedPool]
10872
Working Set Sizes (now,min,max) (781, 50, 345) (3124KB, 200KB, 1380KB)
PeakWorkingSetSize
1550
VirtualSize
57 Mb
PeakVirtualSize
57 Mb
PageFaultCount
2481
MemoryPriority
BACKGROUND
BasePriority
8
CommitCharge
2497
kd> !exts.token -n e1bed030
_TOKEN e1bed030
TS Session ID: 0
User: S-1-5-21-518066528-515770016-299552555-2981724 (User: MYDOMAIN\myuser)
Groups:
00 S-1-5-21-518066528-515770016-299552555-513 (Group: MYDOMAIN\Domain Users)
Attributes - Mandatory Default Enabled
01 S-1-1-0 (Well Known Group: localhost\Everyone)
Attributes - Mandatory Default Enabled
02 S-1-5-32-544 (Alias: BUILTIN\Administrators)
Attributes - Mandatory Default Enabled Owner
03 S-1-5-32-545 (Alias: BUILTIN\Users)
Attributes - Mandatory Default Enabled
04 S-1-5-21-518066528-515770016-299552555-2999049 (Group: MYDOMAIN\AllUsers)
Attributes - Mandatory Default Enabled
05 S-1-5-21-518066528-515770016-299552555-2931095 (Group: MYDOMAIN\SomeGroup1)
Attributes - Mandatory Default Enabled
06 S-1-5-21-518066528-515770016-299552555-2931096 (Group: MYDOMAIN\SomeGroup2)
Attributes - Mandatory Default Enabled
07 S-1-5-21-518066528-515770016-299552555-3014318 (Group: MYDOMAIN\SomeGroup3)
Attributes - Mandatory Default Enabled
08 S-1-5-21-518066528-515770016-299552555-3053352 (Group: MYDOMAIN\Another Group)
Attributes - Mandatory Default Enabled
09 S-1-5-21-518066528-515770016-299552555-2966661 (Group: MYDOMAIN\TestGroup)
Attributes - Mandatory Default Enabled
10 S-1-5-21-2117033040-537160606-1609722162-17637 (Group: MYOTHERDOMAIN\someusers)
Attributes - Mandatory Default Enabled
11 S-1-5-21-518066528-515770016-299552555-3018354 (Group: MYDOMAIN\TestGroup2)
Attributes - Mandatory Default Enabled
12 S-1-5-21-518066528-515770016-299552555-3026602 (Group: MYDOMAIN\SomeGroup4)
Attributes - Mandatory Default Enabled
13 S-1-5-21-518066528-515770016-299552555-2926570 (Group: MYDOMAIN\YetAnotherGroup)
Attributes - Mandatory Default Enabled
14 S-1-5-21-661411660-2927047998-133698966-513 (Group: MYDOMAIN\Domain Users)
Attributes - Mandatory Default Enabled
15 S-1-5-21-518066528-515770016-299552555-2986081 (Alias: MYDOMAIN\an_alias)
Attributes - Mandatory Default Enabled GroupResource
16 S-1-5-21-518066528-515770016-299552555-3037986 (Alias: MYDOMAIN\AReallyLongGroupName1)
Attributes - Mandatory Default Enabled GroupResource
17 S-1-5-21-518066528-515770016-299552555-3038991 (Alias: MYDOMAIN\AReallyLongGroupName2)
Attributes - Mandatory Default Enabled GroupResource
18 S-1-5-21-518066528-515770016-299552555-3037999 (Alias: MYDOMAIN\AReallyLongGroupName3)
Attributes - Mandatory Default Enabled GroupResource
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!tp
The !tp extension displays thread pool information.
Syntax
!tp
!tp
!tp
!tp
!tp
!tp
!tp
!tp
Parameters
pool Address
Causes the entire thread pool at Address to be displayed. If Address is 0, then all thread pools will be displayed.
tqueue Address
Causes the active timer queue at Address to be displayed.
ItemType Address
Causes the specified thread pool item to be displayed. Address specifies the address of the item. ItemType specifies the type of the item; this can include any of the
following possibilities:
obj
A generic pool item (such as an IO item) will be displayed.
timer
A timer item will be displayed.
wait
A wait item will be displayed.
work
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!triage
The !triage extension command is obsolete. Use !analyze instead.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!ustr
The !ustr extension displays a UNICODE_STRING structure.
Syntax
!ustr Address
Parameters
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Address
Specifies the hexadecimal address of the UNICODE_STRING structure.
DLL
Windows 2000
Ext.dll
Windows XP and later Ext.dll
Comments
Unicode strings are counted 16-bit character strings, as defined in the following structure:
typedef struct _UNICODE_STRING {
USHORT Length;
USHORT MaximumLength;
PWSTR Buffer;
} UNICODE_STRING;
If the string is NULL-terminated, Length does not include the trailing NULL.
Most Win32 character string arguments are converted to Unicode strings before any real work is done.
Additional Information
For more information about UNICODE_STRING structures, see the Microsoft Windows SDK documentation.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!version
The !version extension displays the version information for the extension DLL.
This extension command should not be confused with the version (Show Debugger Version) command.
Syntax
![ExtensionDLL.]version
Parameters
ExtensionDLL
Specifies the extension DLL whose version number is to be displayed.
DLL
This extension is available in most extension DLLs.
Comments
If the extension DLL version does not match the debugger version, error messages will be displayed.
This extension command will not work on Windows XP and later versions of Windows. To display version information, use the version (Show Debugger Version)
command.
The original purpose of this extension was to ensure that the DLL version matched the target version, since a mismatch would result in inaccurate results for many extensions.
Newer DLLs are no longer restricted to working with only one version of Windows, so this extension is obsolete.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Kernel-Mode Extensions
This section of the reference describes extension commands that are primarily used during kernel-mode debugging.
The debugger will automatically load the proper version of these extension commands. Unless you have manually loaded a different version, you do not have to keep track of
the DLL versions being used. See Using Debugger Extension Commands for a description of the default module search order. See Loading Debugger Extension DLLs for an
explanation of how to load extension modules.
Each extension command reference page lists the DLLs that expose that command. Use the following rules to determine the proper directory from which to load this extension
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
DLL:
If your target computer is running the free build of Windows 2000, use w2kfre\Kdextx86.dll.
If your target computer is running the checked build of Windows 2000, use w2kchk\Kdextx86.dll.
If your target computer is running Windows XP or a later version of Windows, use winxp\Kdexts.dll.
In addition, kernel-mode extensions that are not specific to any single operating system can be found in winext\kext.dll.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!ahcache
The !ahcache extension displays the application compatibility cache.
Syntax
!ahcache [Flags]
Parameters
Flags
Specifies the information to include in the display. This can be any combination of the following bits (the default is zero):
Bit 0 (0x1)
Displays the RTL_GENERIC_TABLE list instead of the LRU list.
Bit 4 (0x10)
Verbose display: includes all entry details, not just the names.
DLL
Unavailable
Windows 2000
Windows XP and later Kdexts.dll
!alignmentfaults
The !alignmentfaults extension displays all current type alignment faults by location and image, sorted by frequencies.
Syntax
!alignmentfaults
DLL
Windows 2000
Unavailable
Windows XP and later Kdexts.dll
Comments
This is only available on checked builds.
Additional Information
For information about alignment faults, see the Microsoft Windows SDK documentation.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!analyzebugcheck
The !analyzebugcheck extension command is obsolete. Use !analyze instead.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!apc
The !apc extension formats and displays the contents of one or more asynchronous procedure calls (APCs).
Syntax
!apc
!apc proc Process
!apc thre Thread
!apc KAPC
Parameters
Process
Specifies the address of the process whose APCs are to be displayed.
Thread
Specifies the address of the thread whose APCs are to be displayed.
KAPC
Specifies the address of the kernel APC to be displayed.
DLL
Unavailable
Windows 2000
Windows XP and later Kdexts.dll
Comments
Without any parameters, !apc displays all APCs.
Here is an example:
kd> !apc
*** Enumerating APCs in all processes
Process e0000000858ba8b0 System
Process e0000165fff86040 smss.exe
Process e0000165fff8c040 csrss.exe
Process e0000165fff4e1d0 winlogon.exe
Process e0000165fff101d0 services.exe
Process e0000165fffa81d0 lsass.exe
Process e0000165fff201d0 svchost.exe
Process e0000165fff8e040 svchost.exe
Process e0000165fff3e040 svchost.exe
Process e0000165fff6e040 svchost.exe
Process e0000165fff24040 spoolsv.exe
Process e000000085666640 wmiprvse.exe
Process e00000008501e520 wmiprvse.exe
Process e0000000856db480 explorer.exe
Process e0000165fff206a0 ctfmon.exe
Process e0000000850009d0 ctfmon.exe
Process e0000165fff51600 conime.exe
Process e000000085496340 taskmgr.exe
Process e000000085489c30 userinit.exe
Additional Information
For information about APCs, see the Windows Driver Kit (WDK) documentation and Microsoft Windows Internals by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!apicerr
The !apicerr extension displays the local Advanced Programmable Interrupt Controller (APIC) error log.
Syntax
!apicerr [Format]
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Parameters
Format
Specifies the order in which to display the error log contents. This can be any one of the following values:
0x0
Displays the error log according to order of occurrence.
0x1
Displays the error log according to processor.
DLL
Windows 2000
Unavailable
Windows XP and later Kdexts.dll
This extension command can only be used with an x86-based or an x64-based target computer.
Additional Information
For information about APICs, see Microsoft Windows Internals by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!arbinst
The !arbinst extension displays information about a specified arbiter.
Syntax
!arbinst Address [Flags]
Parameters
Address
Specifies the hexadecimal address of the arbiter to be displayed.
Flags
Specifies how much information to display for each arbiter. At present, the only flag is 0x100. If this flag is set, then the aliases are displayed.
DLL
Windows 2000
Unavailable
Windows XP and later Kdexts.dll
Comments
For the arbiter specified, !arbinst displays each allocated range of system resources, some optional flags, the PDO attached to that range (in other words, the range's owner),
and the service name of this owner (if known).
Here is an example:
kd> !arbinst e0000106002ee8e8
Port Arbiter "PCI I/O Port (b=02)" at e0000106002ee8e8
Allocated ranges:
0000000000000000 - 0000000000001fff
00000000 <Not on
0000000000002000 - 00000000000020ff
P e0000000858bea20
0000000000003000 - ffffffffffffffff
00000000 <Not on
Possible allocation:
< none >
kd> !arbinst e0000106002ec458
Memory Arbiter "PCI Memory (b=02)" at e0000106002ec458
Allocated ranges:
0000000000000000 - 00000000ebffffff
00000000 <Not on
00000000effdef00 - 00000000effdefff
B
e0000000858be560
00000000effdf000 - 00000000effdffff
e0000000858bea20
00000000f0000000 - ffffffffffffffff
00000000 <Not on
Possible allocation:
< none >
bus>
(ql1280)
bus>
bus>
(ql1280)
bus>
Additional Information
See also the !arbiter extension.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!arbiter
The !arbiter extension displays the current system resource arbiters and arbitrated ranges.
Syntax
!arbiter [Flags]
Parameters
Flags
Specifies which classes of arbiters are displayed. If omitted, all arbiters are displayed. These bits can be combined freely.
Bit 0 (0x1)
I/O arbiters.
Bit 1 (0x2)
Memory arbiters.
Bit 2 (0x4)
IRQ arbiters.
Bit 3 (0x8)
DMA arbiters.
Bit 4 (0x10)
Bus number arbiters.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
For each arbiter, !arbiter displays each allocated range of system resources, some optional flags, the PDO attached to that range (in other words, the range's owner), and the
service name of this owner (if known).
The flags have the following meanings:
Flag
Meaning
S
Range is shared
C Range in conflict
B Range is boot-allocated
D Range is driver-exclusive
A Range alias
P
Range positive decode
Here is an example:
kd> !arbiter 4
DEVNODE 80e203b8 (HTREE\ROOT\0)
Interrupt Arbiter "" at 80167140
Allocated ranges:
0000000000000000 - 0000000000000000
B
80e1d3d8
0000000000000001 - 0000000000000001
B
80e1d3d8
.....
00000000000001a2 - 00000000000001a2
00000000000001a2 - 00000000000001a2 CB
80e1d3d8
00000000000001a2 - 00000000000001a2 CB
80e52538 (Serial)
00000000000001a3 - 00000000000001a3
80e52778 (i8042prt)
00000000000001b3 - 00000000000001b3
80e1b618 (i8042prt)
Possible allocation:
< none >
In this example, the next-to-last line shows the resource range (which consists of 0x1A3 alone), the PDO of 0x80E52778, and the service of i8042prt.sys. No flags are listed
on this line.
You can now use !devobj with this PDO address to find the device extension and device node addresses:
kd> !devobj 80e52778
Device object (80e52778) is for:
00000034 \Driver\PnpManager DriverObject 80e20610
Current Irp 00000000 RefCount 1 Type 00000004 Flags 00001040
DevExt 80e52830 DevObjExt 80e52838 DevNode 80e52628
ExtensionFlags (0000000000)
AttachedDevice (Upper) 80d78b28 \Driver\i8042prt
Device queue is not busy.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Additional Information
See Plug and Play Debugging for applications of this extension command.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!ate
The !ate extension displays the alternate page table entry (ATE) for the specified address.
Syntax
!ate Address
Parameters
Address
Specifies the ATE to display.
DLL
Windows 2000
Unavailable
Windows XP and later Kdexts.dll
Comments
This extension is only available on Itanium-based computers.
The status flags for the ATE are shown in the following table. The !ate display indicates these bits with capital letters or dashes and adds additional information as well.
Display
when
set
V
G
E
W
L
Z
N
C
I
P
Display
when
clear
R
-
Meaning
Commit.
Not accessed.
Execute.
Writeable or read-only.
Locked. The ATE is locked, therefore, any faults on the page that contain the ATE will be retried until the current fault is satisfied. This can happen on
multi-processor systems.
Fill zero.
No access.
Copy on Write.
PTE indirect. This ATE indirectly references another physical page. The page that contains the ATE might have two conflicting ATE attributes.
Reserved.
Additional Information
For information about page tables and page directories, see Microsoft Windows Internals, by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!bcb
The !bcb extension displays the specified buffer control block.
Syntax
!bcb Address
Parameters
Address
Specifies the address of the buffer control block.
DLL
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Windows 2000
Kdextx86.dll
Windows XP and later Unavailable (see Comments section)
Comments
This extension is available for Windows 2000 only. In Windows XP or later, use the dt nt!_BCB Address command to display the buffer control block directly.
Additional Information
For information about cache management, see the Microsoft Windows SDK documentation and Microsoft Windows Internals by Mark Russinovich and David Solomon.
For information about other cache management extensions, use the !cchelp extension.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!blockeddrv
The !blockeddrv extension displays the list of blocked drivers on the target computer.
Syntax
!blockeddrv
DLL
Unavailable
Windows 2000
Windows XP and later Kdexts.dll
Comments
Here is an example:
kd> !blockeddrv
Driver:
Status
afd.sys
0:
agp440.sys
0:
atapi.sys
0:
audstub.sys 0:
Beep.SYS
0:
Cdfs.SYS
0:
.....
GUID
{00000008-0206-0001-0000-000030C964E1}
{0000005C-175A-E12D-5000-010020885580}
{0000005C-B04A-E12E-5600-000020885580}
{0000005C-B04A-E12E-5600-000020885580}
{0000005C-B04A-E12E-5600-000020885580}
{00000008-0206-0001-0000-000008F036E1}
!bpid
The !bpid extension requests that a process on the target computer break into the debugger or requests that a user-mode debugger be attached to a process on the target
computer.
Syntax
!bpid [Options] PID
Parameters
Option
Controls the additional activities of this command.
The valid values for Option appear in the following table.
-a Attaches a new user-mode debugger to the process specified by PID. The user-mode debugger runs on the target machine.
-s Adds a breakpoint that occurs in the WinLogon process immediately before the break in the user-mode process specified by PID. This allows the user to verify the
request before attempting the action.
-w Stores the request in the memory in the target computer. The target system can then repeat the request, but this is not usually necessary.
PID
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Specifies the process ID of the desired process on the target computer. If you are using this to control a user-mode debugger on the target computer, PID should be the
process ID of the target application, not of the user-mode debugger. (Because process IDs are usually listed in decimal format, you might need to prefix this with 0n or
convert it to hexadecimal format.)
DLL
Windows 2000
Unavailable
Windows XP and later Kdexts.dll
This extension command is supported on x86-based, x64-based, and Itanium-based target computers.
Comments
This command is especially useful when redirecting input and output from a user-mode debugger to the kernel debugger. It causes the user-mode target application to break
into the user-mode debugger, which in turn requests input from the kernel debugger. See Controlling the User-Mode Debugger from the Kernel Debugger for details.
If this command is used in another situation, the user-mode process calls DbgBreakPoint. This will usually break directly into the kernel debugger.
The -s option causes a break in WinLogon just before the break in the specified process occurs. This is useful if you want to perform debugging actions within WinLogon's
process context. The g (Go) command can then be used to move on to the second break.
Note that there are ways in which this extension can fail to execute:
Lack of resources. The !bpid extension injects a thread into the target process, so the system must have enough resources to create a thread. Using the -a option requires
even more system resources since !bpid -a must run a full instance of a debugger on the target computer.
The loader lock is already held. Both !bpid and !bpid -a require a thread to run in the target process in order to make it break into the debugger. If another thread is
holding the loader lock, then the !bpid thread will not be able to run and a break into the debugger may not occur. Thus, if !bpid fails when there is enough user-mode
memory available for the target process, it is possible that the loader lock is held.
Lack of permission. The operation of the !bpid extension requires permission sufficient for WinLogon to create a remote thread and attach a debugger to a given
process.
No access to ntsd.exe. If ntsd.exe is not found in a commonly known path, !bpid will fail to set an appropriate PID. Note that ntsd.exe is not included by default with
Windows Vista.
!btb
The !btb extension displays the Itanium-based processor, branch traces buffer (BTB) configuration and trace registers for the current processor.
Syntax
!btb
DLL
Windows 2000
Unavailable
Windows XP and later Kdexts.dll
This extension command can only be used with an Itanium-based target computer.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!bth
The !bth extension displays the Itanium-based branch traces history for the specified processor.
Syntax
!bth [Processor]
Parameters
Processor
Specifies a processor. If Processor is omitted, then the branch trace history for all of processors is displayed.
DLL
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Windows 2000
Unavailable
Windows XP and later Kdexts.dll
This extension command can only be used with an Itanium-based target computer.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!bugdump
The !bugdump extension formats and displays the information contained in the bug check callback buffers.
Syntax
!bugdump [Component]
Parameters
Component
Specifies the component whose callback data is to be examined. If omitted, all bug check callback data is displayed.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
This extension can only be used after a bug check has occurred, or when you are debugging a kernel-mode crash dump file.
The Component parameter corresponds to the final parameter used in KeRegisterBugCheckCallback.
The buffers that hold callback data are not available in a Small Memory Dump. These buffers are present in Kernel Memory Dumps and Full Memory Dumps. However, in
Windows XP SP1, Windows Server 2003, and later versions of Windows, the dump file is created before the drivers' BugCheckCallback routines are called, and therefore
these buffers will not contain the data written by these routines.
If you are performing live debugging of a crashed system, all callback data will be present.
Additional Information
For more information, see Reading Bug Check Callback Data.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!bushnd
The !bushnd extension displays a HAL BUS_HANDLER structure.
Syntax
!bushnd [Address]
Parameters
Address
Specifies the hexadecimal address of the HAL BUS_HANDLER structure. If omitted, !bushnd displays a list of buses and the base address of the handler.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!ca
The !ca extension displays the control area for the specified section.
Syntax
!ca Address
Parameters
Address
Specifies the hexadecimal address of the section.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
To get a list of the control areas of all mapped files, use the !memusage extension.
Here is an example:
kd> !memusage
loading PFN database
loading (99% complete)
Zeroed:
16 (
64
Free:
0 (
0
Standby:
2642 ( 10568
Modified:
720 ( 2880
ModifiedNoWrite:
0 (
0
Active/Valid: 13005 ( 52020
Transition:
0 (
0
Unknown:
0 (
0
TOTAL: 16383 ( 65532
Building kernel map
Finished building kernel map
kb)
kb)
kb)
kb)
kb)
kb)
kb)
kb)
kb)
)
)
)
)
Blink:
Mapped Views:
Flush Count:
System Views:
NonPaged Usage
0
1
0
0
e0
File: \WINNT\System32\browseui.dll
Segment @ e1b74548:
Base address
0
Image commit
1
Image Base
0
Based Addr
76e10000
Subsection 1. @ ff863720
ControlArea: ff8636e8
Base Pte
e1b74580
Flags
15
ReadOnly CopyOnWrite
Subsection 2. @ ff863740
ControlArea: ff8636e8
Base Pte
e1b74584
Flags
35
Total Ptes
c8
ControlArea ff8636e8
Committed
0
ProtoPtes
e1b74580
NonExtendPtes:
c8
SizeOfSegment: c8000
PTE Template:
31b8438
Image Info:
e1b748a4
0
1
0
3
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
ReadOnly CopyOnWrite
Subsection 3. @ ff863760
ControlArea: ff8636e8
Base Pte
e1b7476c
Flags
55
ReadOnly CopyOnWrite
0
5
Subsection 4. @ ff863780
ControlArea: ff8636e8
Base Pte
e1b74770
Flags
15
ReadOnly CopyOnWrite
0
1
Subsection 5. @ ff8637a0
ControlArea: ff8636e8
Base Pte
e1b74880
Flags
15
ReadOnly CopyOnWrite
0
1
Additional Information
For information about control areas, see Microsoft Windows Internals by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!callback
The !callback extension displays the callback data related to the trap for the specified thread.
Syntax
!callback Address [Number]
Parameters
Address
Specifies the hexadecimal address of the thread. If this is -1 or omitted, the current thread is used.
Number
Specifies the number of the desired callback frame. This frame is noted in the display.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
This extension command can only be used with an x86-based target computer.
Comments
If the system has not experienced a system trap, this extension will not produce useful data.
Additional Information
For information about system traps, see the Windows Driver Kit (WDK) documentation and Microsoft Windows Internals by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!calldata
The !calldata extension displays performance information in the form of procedure call statistics from the named table.
Syntax
!calldata Table
Parameters
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Table
Name of the table that collects the call data.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
!can_write_kdump
The !can_write_kdump extension verifies that there is enough disk space on the target computer to write a kernel dump file of the specified type.
Syntax
!can_write_kdump [-dn] [Options]
Parameters
-dn
Specifies that the file system on the target computer is an NTFS file system. If this parameter is omitted, then the amount of disk free space cannot be determined, and a
warning will be shown. However, the amount of space required will still be displayed.
Options
The following options are valid:
-t
Specifies that the extension should determine if there is enough space for a minidump.
-s
Specifies that the extension should determine if there is enough space for a summary kernel dump. This is the default value.
-f
Specifies that the extension should determine if there is enough space for a full kernel dump.
DLL
Windows 2000
Kext.dll
Windows XP and later Kext.dll
Comments
If no Option is specified, then the extension will determine if there is enough space for a summary kernel dump.
In the following example, the file system is not specified:
kd> !can_write_kdump
Checking kernel summary dump...
WARNING: Can't predict how many pages will be used, assuming worst-case.
Physical memory: 285560 KB
Page file size: 1572864 KB
NO: Page file too small
!cbreg
The !cbreg extension displays CardBus Socket registers and CardBus Exchangable Card Architecture (ExCA) registers.
Syntax
!cbreg [%%]Address
Parameters
%%
Indicates that Address is a physical address rather than a virtual address.
Address
Specifies the address of the register to be displayed.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
DLL
Windows 2000
Kext.dll
Kdextx86.dll
Windows XP and later Kext.dll
The !cbreg extension is only available for an x86-based target computer.
Additional Information
The !exca extension can be used to display PCIC ExCA registers by socket number.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!cchelp
The !cchelp extension displays some brief Help text in the Debugger command window for some of the cache management extensions.
Syntax
!cchelp
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Additional Information
For information about cache management, see the Microsoft Windows SDK documentation and Microsoft Windows Internals by Mark Russinovich and David Solomon.
The !cchelp extension displays help for the !bcb, !defwrites, !finddata, and !scm cache management extensions. Other cache management extensions include !openmaps
and !pcm.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!chklowmem
The !chklowmem extension determines whether physical memory pages below 4 GB are filled with the required fill pattern on a computer that was booted with the /pae
and /nolowmem options.
Syntax
!chklowmem
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
This extension is useful when you are verifying that kernel-mode drivers operate properly with physical memory above the 4 GB boundary. Typically, drivers fail by
truncating a physical address to 32 bits and then in writing below the 4 GB boundary. The !chklowmem extension will detect any writes below the 4 GB boundary.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!cmreslist
The !cmreslist extension displays the CM_RESOURCE_LIST structure for the specified device object.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Syntax
!cmreslist Address
Parameters
Address
Specifies the hexadecimal address of the CM_RESOURCE_LIST structure.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Additional Information
See Plug and Play Debugging for applications of this extension command. For information about the CM_RESOURCE_LIST structure, see the Windows Driver Kit (WDK)
documentation.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!cpuinfo
The !cpuinfo extension displays detailed information about the target computer's CPU.
Syntax
Syntax in Windows 2000
!cpuinfo
Syntax in Windows XP and later
!cpuinfo [Processor]
Parameters
Processor
(Windows XP and later) Specifies the processor to be displayed. If this is omitted, all processors are displayed.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
The !cpuinfo extension command can be used when performing local kernel debugging. When this extension is used on a Windows 2000 target computer, it displays
information about all processors.
Here is an example generated by an x86-based processor:
kd> !cpuinfo
CP F/M/S Manufacturer
0 6,1,9 GenuineIntel
SerialNumber
Features
Speed
0000000000000000 0000000000000001 1300 Mhz
0000000000000000 0000000000000001 1300 Mhz
The CP column indicates the processor number. The Manufacturer column specifies the processor manufacturer. The MHz or Speed column specifies the speed, in MHz, of
the processor, if it is available.
For an x86-based processor or an x64-based processor, the F column displays the processor family number, the M column displays the processor model number, and the S
column displays the stepping size.
For an Itanium-based processor, the M column displays the processor model number, the R column displays the processor revision number, the F column displays the
processor family number, and the A column displays the architecture revision number.
Other columns will also appear, depending on your machine's specific architecture.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
For details on how to interpret specific values for each entry, as well as any additional columns, consult the processor manual.
Additional Information
For more information about debugging multiprocessor computers, see Multiprocessor Syntax.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
[Caching]
[Caching]
[Caching]
[Caching]
[Caching]
[Caching]
[Caching]
[-m]
[-m]
[-m]
[-m]
[-m]
[-m]
[-m]
[PhysicalAddress]
[PhysicalAddress]
[PhysicalAddress]
[PhysicalAddress]
[PhysicalAddress]
[PhysicalAddress]
[PhysicalAddress]
[L
[L
[L
[L
[L
[L
[L
Size]
Size]
Size]
Size]
Size]
Size]
Size]
Parameters
Caching
Can be any one of the following values. The Caching value must be surrounded by square brackets:
[c]
Causes this extension to read from cached memory.
[uc]
Causes this extension to read from uncached memory.
[wc]
Causes this extension to read from write-combined memory.
-m
Causes memory to be read one unit at a time. For example, !db -m reads memory in 8-bit chunks and !dw -m reads memory in 16-bit chunks. If your hardware does not
support 32-bit physical memory reads, it may be necessary to use the -m option. This option does not affect the length or appearance of the display it only affects how
the memory is accessed.
PhysicalAddress
Specifies the first physical address to be displayed, in hexadecimal format. If this is omitted the first time this command is used, the address defaults to zero. If this is
omitted on a subsequent use, the display will begin where the last display ended.
L Size
Specifies the number of chunks of memory to display. The size of a chunk is determined by the precise extension used.
DLL
Windows 2000
Kext.dll
Kdextx86.dll
Windows XP and later Kext.dll
Comments
These extensions each display physical memory, but their display formats and default length differ:
The !db extension displays hexadecimal bytes and their ASCII character equivalents. The default length is 128 bytes.
The !dc extension displays DWORD values and their ASCII character equivalents. The default length is 32 DWORDs (128 total bytes).
The !dd extension displays DWORD values. The default length is 32 DWORDs (128 total bytes).
The !dp extension displays ULONG_PTR values. These are either 32-bit or 64-bit words, depending on the instruction size. The default length is 128 total bytes.
The !dq extension displays ULONG64_PTR values. These are 32-bit words. The default length is 128 total bytes.
The !du extension displays UNICODE characters. The default length is 16 characters (32 total bytes), or until a NULL character is encountered.
The !dw extension displays WORD values. The default length is 64 DWORDs (128 total bytes).
Consequently, using two of these extensions that are distinct with the same value of Size will most likely result in a difference in the total amount of memory displayed. For
example, using the command !db L 32 results in 32 bytes being displayed (as hexadecimal bytes), whereas the command !dd L 32 results in 128 bytes being displayed (as
DWORD values).
Here is an example in which the caching attribute flag is needed:
kd> !dc e9000
physical memory read at e9000 failed
If you know the caching attributes used for the memory,
try specifying [c], [uc] or [wc], as in !dd [c] <params>.
WARNING: Incorrect use of these flags will cause unpredictable
processor corruption. This may immediately (or at any time in
the future until reboot) result in a system hang, incorrect data
being displayed or other strange crashes and corruption.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!dbgprint
The !dbgprint extension displays a string that was previously sent to the DbgPrint buffer.
Syntax
!dbgprint
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
The kernel-mode routines DbgPrint, KdPrint, DbgPrintEx, and KdPrintEx send a formatted string to a buffer on the target computer. The string is automatically displayed
in the Debugger Command window on the host computer unless such printing has been disabled.
Generally, messages sent to this buffer are displayed automatically in the Debugger Command window. However, this display can be disabled through the Global Flags
(gflags.exe) utility. Moreover, this display does not automatically appear during local kernel debugging. For more information, see The DbgPrint Buffer.
The !dbgprint extension causes the contents of this buffer to be displayed (regardless of whether automatic printing has been disabled). It will not show messages that have
been filtered out based on their component and importance level. (For details on this filtering, see Reading and Filtering Debugging Messages.)
Additional Information
For information about DbgPrint, KdPrint, DbgPrintEx, and KdPrintEx, see Sending Output to the Debugger.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!dblink
The !dblink extension displays a linked list in the backward direction.
Syntax
!dblink Address [Count] [Bias]
Parameters
Address
Specifies the address of a LIST_ENTRY structure. The display will begin with this node.
Count
Specifies the maximum number of list entries to display. If this is omitted, the default is 32.
Bias
Specifies a mask of bits to ignore in each pointer. Each Blink address is ANDed with (NOT Bias) before following it to the next location. The default is zero (in other
words, do not ignore any bits).
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The !dblink extension traverses the Blink fields of the LIST_ENTRY structure and displays up to four ULONGs at each address. To go in the other direction, use !dflink.
The dl (Display Linked List) command is more versatile than !dblink and !dflink.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!dcr
The !dcr extension displays the default control register (DCR) at the specified address.
Syntax
!dcr Expression [DisplayLevel]
Parameters
Expression
Specifies the hexadecimal address of the DCR to display. The expression @dcr can also be used for this parameter. In that case, information about the current processor
DCR is displayed.
DisplayLevel
Can be any one of the following options:
0
Causes only the values of each DCR field to be displayed. This is the default value.
1
Causes the display to include more in-depth information about each of the DCR fields that is not reserved or ignored.
2
Causes the display to include more in-depth information about all of the DCR fields, including those that are ignored or reserved.
DLL
Windows 2000
Unavailable
Windows XP and later Kdexts.dll
This extension command can only be used with an Itanium-based target computer.
Comments
The DCR specifies default parameters for the processor status register values on interruption. The DCR also specifies some additional global controls, as well as whether or
not speculative load faults can be deferred.
Here are a couple of examples:
kd> !dcr @dcr
dcr:pp be lc dm dp dk dx dr da dd
1 0 1 1 1 1 1 1 1 1
kd> !dcr @dcr 2
pp
be
lc
rv
dm
dp
dk
dx
dr
da
dd
rv
:
:
:
:
:
:
:
:
:
:
:
:
1
0
1
0
1
1
1
1
1
1
0
0
:
:
:
:
:
:
:
:
:
:
:
:
!dcs
The !dcs extension is obsolete. To display the PCI configuration space, use !pci 100 Bus Device Function.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!deadlock
The !deadlock extension displays information about deadlocks collected by the Deadlock Detection option of Driver Verifier.
Syntax
!deadlock
!deadlock 1
DLL
Windows 2000
Unavailable
Windows XP and later Kdexts.dll
Comments
This extension will only provide useful information if Driver Verifier's Deadlock Detection option has detected a lock hierarchy violation and issued bug check 0xC4
(DRIVER_VERIFIER_DETECTED_VIOLATION).
Without any arguments, the !deadlock extension causes the basic lock hierarchy topology to be displayed. If the problem is not a simple cyclical deadlock, this command will
describe the situation that has occurred.
The !deadlock 1 extension causes stack traces to be displayed. The stacks displayed will be the ones active at the time the locks were acquired.
Here is an example:
0:kd> !deadlock
Deadlock detected (2 resources in 2 threads):
Thread 0: A B
Thread 1: B A
Where:
Thread
Thread
Lock A
Lock B
0 = 8d3ba030
1 = 8d15c030
=
bba2af30 Type 'Spinlock'
=
dummy!GlobalLock Type 'Spinlock'
This tells you which threads and which locks are involved. However, it is intended to be a summary and may not be enough information to adequately debug the situation.
Use !deadlock 1 to print out the contents of the call stacks at the time that each lock participating in the deadlock was acquired. Because these are run-time stack traces, they
will be more complete if a checked build is being used. On a free build, they may be truncated after as little as one line.
0:kd> !deadlock 1
Deadlock detected (2 resources in 2 threads):
Thread 0 (8D14F750) took locks in the following order:
Lock A -- b7906f30 (Spinlock)
Stack:
dummy!DummyActivateVcComplete+0x63
dummy!dummyOpenVcChannels+0x2E1
dummy!DummyAllocateRecvBufferComplete+0x436
dummy!DummyAllocateComplete+0x55
NDIS!ndisMQueuedAllocateSharedHandler+0xC9
NDIS!ndisWorkerThread+0xEE
Lock B -- dummy!GlobalLock (Spinlock)
Stack:
dummy!dummyQueueRecvBuffers+0x2D
dummy!DummyActivateVcComplete+0x90
dummy!dummyOpenVcChannels+0x2E1
dummy!DummyAllocateRecvBufferComplete+0x436
dummy!DummyAllocateComplete+0x55
Thread 1 (8D903030) took locks in the following order:
Lock B -- dummy!GlobalLock (Spinlock)
Stack:
dummy!dummyRxInterruptOnCompletion+0x25D
dummy!DummyHandleInterrupt+0x32F
NDIS!ndisMDpcX+0x3C
ntkrnlpa!KiRetireDpcList+0x5D
Lock A -- b7906f30 (Spinlock)
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Stack:
With this information, you have almost everything you need, except the current stack:
0: kd> k
ChildEBP
f78aae6c
f78aae74
f78aae9c
f78aaee8
f78aaf08
f78aafa4
f78aafc4
f78aafd8
f78aaff4
RetAddr
80664c58
8066523f
806665df
8065d944
bfd6df46
b1bf2d2d
bfde9d8c
804b393b
804b922b
ntkrnlpa!DbgBreakPoint
ntkrnlpa!ViDeadlockReportIssue+0x2f
ntkrnlpa!ViDeadlockAnalyze+0x253
ntkrnlpa!VfDeadlockAcquireResource+0x20b
ntkrnlpa!VerifierKeAcquireSpinLockAtDpcLevel+0x44
dummy!dummyRxInterruptOnCompletion+0x2b5
dummy!DummyHandleInterrupt+0x32f
NDIS!ndisMDpcX+0x3c
ntkrnlpa!KiRetireDpcList+0x5d
From this you can see which locks were involved and where they were acquired. This should be enough information for you to debug the deadlock. If the source code is
available, you can use the debugger to see exactly where the problem occurred:
0: kd> .lines
Line number information will be loaded
0: kd> u dummy!DummyActivateVcComplete+0x63 l1
dummy!DummyActivateVcComplete+63 [d:\nt\drivers\dummy\vc.c @ 2711]:
b1bfe6c9 837d0c00
cmp
dword ptr [ebp+0xc],0x0
0: kd> u dummy!dummyQueueRecvBuffers+0x2D l1
dummy!dummyQueueRecvBuffers+2d [d:\nt\drivers\dummy\receive.c @ 2894]:
b1bf4e39 807d0c01
cmp
byte ptr [ebp+0xc],0x1
0: kd> u dummy!dummyRxInterruptOnCompletion+0x25D l1
dummy!dummyRxInterruptOnCompletion+25d [d:\nt\drivers\dummy\receive.c @ 1424]:
b1bf5d05 85f6
test
esi,esi
0: kd> u dummy!dummyRxInterruptOnCompletion+0x2b5 l1
dummy!dummyRxInterruptOnCompletion+2b5 [d:\nt\drivers\dummy\receive.c @ 1441]:
b1bf5d5d 8b4648
mov
eax,[esi+0x48]
Now you know the name of the source file and the line number where the acquisition took place. In this case, the source files will show that the threads behaved as follows:
Thread 1: DummyActivateVcComplete took the dummy miniport lock. It then called dummyQueueRecvBuffers, which took the dummy global lock.
Thread 2: dummyRxInterruptOnCompletion took the global lock. Then, a few lines later, it took the miniport lock.
!defwrites
The !defwrites extension displays the values of the kernel variables used by the cache manager.
Syntax
!defwrites
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
When the number of deferred writes ("dirty pages") becomes too large, page writing will be throttled. This extension allows you to see whether your system has reached this
point.
Here is an example:
kd> !defwrites
*** Cache Write Throttle Analysis ***
CcTotalDirtyPages:
0 (
0 Kb)
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
CcDirtyPageThreshold:
MmAvailablePages:
MmThrottleTop:
MmThrottleBottom:
MmModifiedPageListHead.Total:
1538
2598
250
30
699
(
(
(
(
(
6152
10392
1000
120
2796
Kb)
Kb)
Kb)
Kb)
Kb)
!devext
The !devext extension displays bus-specific device extension information for devices on a variety of buses.
Syntax
!devext Address TypeCode
Parameters
Address
Specifies the hexadecimal address of the device extension to be displayed.
TypeCode
Specifies the type of object that owns the device extension to be displayed. Type codes are not case-sensitive. Valid type codes are:
TypeCode
Object
PCI
(Windows 2000 only) PCI device extension
ISAPNP ISA PnP device extension
PCMCIA PCMCIA device extension
HID
HID device extension
USBD
(Windows 2000 only) USB bus driver extension
UHCD
(Windows 2000 only) UHCD host controller extension
OpenHCI (Windows 2000 only) Open HCI host controller extension
USBHUB (Windows 2000 only) USB hub extension
MF
(Windows 2000 only) MF device extension
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
The !usbhub, !hidfdo, and !hidpdo extensions are obsolete; their functionality has been integrated into !devext.
For those object types that are no longer supported by !devext, use the dt (Display Type) debugger command.
Here is an example for an ISA PnP device extension:
kd> !devext e0000165fff32190 ISAPNP
ISA PnP FDO @ 0x00000000, DevExt @ 0xe0000165fff32190, Bus # 196639
Flags (0x854e2530) DF_ACTIVATED, DF_QUERY_STOPPED,
DF_STOPPED, DF_RESTARTED_NOMOVE,
DF_BUS
Unknown flags 0x054e2000
NumberCSNs
ReadDataPort
AddressPort
CommandPort
DeviceList
CardList
PhysicalBusDevice
AttachedDevice
SystemPowerState
-536870912
0x0000000d (mapped)
0x00000000 (not mapped)
0x00000000 (not mapped)
0xe000000085007b50
0x00000000
0x00000000
0x00000000
Unspecified
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
DevicePowerState
- Unspecified
!devhandles
The !devhandles extension displays the open handles for the specified device.
Syntax
!devhandles Address
Parameters
Address
Specifies the address of the device for which to display the open handles.
DLL
Windows 2000
Unavailable
Windows XP and later Kdexts.dll
Comments
To display complete handle information, this extension requires private symbols.
The address of a device object can be obtained using the !drvobj or !devnode extensions.
Here is a truncated example:
lkd> !devhandles 0x841153d8
Checking handle table for process 0x840d3940
Handle table at 95fea000 with 578 Entries in use
Checking handle table for process 0x86951d90
Handle table at 8a8ef000 with 28 Entries in use
...
Checking handle table for process 0x87e63650
Handle table at 947bc000 with 308 Entries in use
Checking handle table for process 0x87e6f4f0
00000000: Unable to read handle table
!devnode
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The !devnode extension displays information about a node in the device tree.
Syntax
!devnode Address [Flags] [Service]
!devnode 1
!devnode 2
Parameters
Address
Specifies the hexadecimal address of the device extension whose node is to be displayed. If this is zero, the root of the main device tree is displayed.
Flags
Specifies the level of output to be displayed. This can be any combination of the following bits:
Bit 0 (0x1)
Causes the display to include all children of the device node.
Bit 1 (0x2)
Causes the display to include resources used (CM_RESOURCE_LIST). These include the boot configuration reported by IRP_MN_QUERY_RESOURCES, as well
as the resources allocated to the device in the AllocatedResources parameter of IRP_MN_START_DEVICE.
Bit 2 (0x4)
Causes the display to include resources required (IO_RESOURCE_REQUIREMENTS_LIST) as reported by IRP_MN_FILTER_RESOURCE_REQUIREMENTS.
Bit 3 (0x8)
Causes the display to include a list of translated resources as allocated to the device in the AllocatedResourcesTranslated parameter of
IRP_MN_START_DEVICE.
Bit 4 (0x10)
Specifies that only device nodes that are not started should be displayed.
Bit 5 (0x20)
Specifies that only device nodes with problems should be displayed. (These are nodes that contain the flag bits DNF_HAS_PROBLEM or
DNF_HAS_PRIVATE_PROBLEM.)
Service
Specifies the name of a service. If this is included, only those device nodes driven by this service will be displayed. (If Flags includes bit 0x1, device nodes driven by this
service and all their children will be displayed.)
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
The !devnode 1 command lists all pending removals of device objects.
The !devnode 2 command lists all pending ejects of device objects.
You can use !devnode 0 1 to see the entire device tree.
Additional Information
See Plug and Play Debugging for applications of this extension command. For information about device trees, see the Windows Driver Kit (WDK) documentation and
Microsoft Windows Internals by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!devobj
The !devobj extension displays detailed information about a DEVICE_OBJECT structure.
Syntax
!devobj DeviceObject
Parameters
DeviceObject
Specifies the device object. This can be the hexadecimal address of this structure or the name of the device.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
If DeviceObject specifies the name of the device but supplies no prefix, the prefix \Device\ is assumed. Note that this command will check to see if DeviceObject is a valid
address or device name before using the expression evaluator.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The information displayed includes the device name of the object, information about the device's current IRP, and a list of addresses of any pending IRPs in the device's
queue. It also includes information about device objects layered on top of this object (listed as "AttachedDevice") and those layered under this object (listed as "AttachedTo").
The address of a device object can be obtained using the !drvobj or !devnode extensions.
Here is one example:
kd> !devnode
Dumping IopRootDeviceNode (= 0x80e203b8)
DevNode 0x80e203b8 for PDO 0x80e204f8
Parent 0000000000
Sibling 0000000000
Child 0x80e56dc8
InstancePath is "HTREE\ROOT\0"
State = DeviceNodeStarted (0x308)
Previous State = DeviceNodeEnumerateCompletion (0x30d)
StateHistory[04] = DeviceNodeEnumerateCompletion (0x30d)
StateHistory[03] = DeviceNodeStarted (0x308)
StateHistory[02] = DeviceNodeEnumerateCompletion (0x30d)
StateHistory[01] = DeviceNodeStarted (0x308)
StateHistory[00] = DeviceNodeUninitialized (0x301)
StateHistory[19] = Unknown State (0x0)
.....
StateHistory[05] = Unknown State (0x0)
Flags (0x00000131) DNF_MADEUP, DNF_ENUMERATED,
DNF_IDS_QUERIED, DNF_NO_RESOURCE_REQUIRED
DisableableDepends = 11 (from children)
kd> !devobj 80e204f8
Device object (80e204f8) is for:
\Driver\PnpManager DriverObject 80e20610
Current Irp 00000000 RefCount 0 Type 00000004 Flags 00001000
DevExt 80e205b0 DevObjExt 80e205b8 DevNode 80e203b8
ExtensionFlags (0000000000)
Device queue is not busy.
Additional Information
See Plug and Play Debugging for examples and applications of this extension command. For information about device objects, see the Windows Driver Kit (WDK)
documentation and Microsoft Windows Internals by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!devstack
The !devstack extension displays a formatted view of the device stack associated with a device object.
Syntax
!devstack DeviceObject
Parameters
DeviceObject
Specifies the device object. This can be the hexadecimal address of the DEVICE_OBJECT structure or the name of the device.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
If DeviceObject specifies the name of the device but supplies no prefix, the prefix \Device\ is assumed. Note that this command will check to see if DeviceObject is a valid
address or device name before using the expression evaluator.
Here is an example:
kd> !devstack e000000085007b50
!DevObj
!DrvObj
!DevExt
ObjectName
e0000165fff32040 \Driver\kmixer
e0000165fff32190
> e000000085007b50 \Driver\swenum
e000000085007ca0 KSENUM#00000005
!DevNode e0000165fff2e010 :
DeviceInst is "SW\{b7eafdc0-a680-11d0-96d8-00aa0051e51d}\{9B365890-165F-11D0-A195-0020AFD156E4}"
ServiceName is "kmixer"
Additional Information
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
For information about device stacks, see the Windows Driver Kit (WDK) documentation.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!dflink
The !dflink extension displays a linked list in the forward direction.
Syntax
!dflink Address [Count] [Bias]
Parameters
Address
Specifies the address of a LIST_ENTRY structure. The display will begin with this node.
Count
Specifies the maximum number of list entries to display. If this is omitted, the default is 32.
Bias
Specifies a mask of bits to ignore in each pointer. Each Flink address is ANDed with (NOT Bias) before following it to the next location. The default is zero (in other
words, do not ignore any bits).
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
The !dflink extension traverses the Flink fields of the LIST_ENTRY structure and displays up to four ULONGs at each address. To go in the other direction, use !dblink.
The dl (Display Linked List) command is more versatile than !dblink and !dflink.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!diskspace
The !diskspace extension displays the amount of free space on a hard disk of the target computer.
Syntax
!diskspace Drive[:]
Parameters
Drive
Specifies the drive letter of the disk. The colon (:) after Drive is optional.
DLL
Windows 2000
Kext.dll
Windows XP and later Kext.dll
Comments
Here is an example:
kd> !diskspace c:
Checking Free Space for c: ..........
Cluster Size 0 KB
Total Clusters 4192901 KB
Free Clusters 1350795 KB
Total Space 1 GB (2096450 KB)
Free Space 659.567871 MB (675397 KB)
kd> !diskspace f:
Checking Free Space for f:
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!dma
The !dma extension displays information about the Direct Memory Access (DMA) subsystem, and the DMA Verifier option of Driver Verifier.
Syntax
!dma
!dma Adapter [Flags]
Parameters
Adapter
Specifies the hexadecimal address of the DMA adapter to be displayed. If this is zero, all DMA adapters will be displayed.
Flags
Specifies the information to include in the display. This can be any combination of the following bits. The default is 0x1.
Bit 0 (0x1)
Causes the display to include generic adapter information.
Bit 1 (0x2)
Causes the display to include map register information. (Only when DMA Verification is active.)
Bit 2 (0x4)
Causes the display to include common buffer information. (Only when DMA Verification is active.)
Bit 3 (0x8)
Causes the display to include scatter/gather list information. (Only when DMA Verification is active.)
Bit 4 (0x10)
Causes the display to include the device description for the hardware device. (Only when DMA Verification is active.)
Bit 5 (0x20)
Causes the display to include Wait context block information.
DLL
Unavailable
Windows 2000
Windows XP and later Kdexts.dll
Comments
Invalid arguments (for example, !dma 1) generate a brief help text.
When the !dma extension is used with no parameters, it displays a concise list of all DMA adapters and their addresses. This can be used to obtain the address of an adapter
for use in the longer versions of this command.
Here is an example of how this extension can be used when the Driver Verifier's DMA Verification option is active:
0:kd> !dma
Dumping all DMA adapters...
Adapter: 82faebd0
Owner: SCSIPORT!ScsiPortGetUncachedExtension
Adapter: 82f88930
Owner: SCSIPORT!ScsiPortGetUncachedExtension
Adapter: 82f06cd0
Owner: NDIS!NdisMAllocateMapRegisters
Master adapter: 80076800
From this output, you can see that there are three DMA adapters in the system. SCSIPORT owns two and NDIS owns the third. To examine the NDIS adapter in detail, use
the !dma extension with its address:
0:kd> !dma 82f06cd0
Adapter: 82f06cd0
Owner: NDIS!NdisMAllocateMapRegisters (0x9fe24351)
MasterAdapter:
00000000
Adapter base Va
00000000
Map register base:
00000000
WCB:
82f2b604
Map registers: 00000000 mapped, 00000000 allocated, 00000002 max
Dma verifier additional information:
DeviceObject: 82f98690
Map registers:
00000840 allocated,
Scatter-gather lists: 00000000 allocated,
Common buffers:
00000004 allocated,
Adapter channels:
00000420 allocated,
Bytes mapped since last flush: 000000f2
00000000
00000000
00000000
00000420
freed
freed
freed
freed
The first block of data is specific information that a HAL developer can use to debug the problem. For your purposes, the data below "Dma verifier additional information" is
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
what is interesting. In this example, you see that NDIS has allocated 0x840 map registers. This is a huge number, especially because NDIS had indicated that it planned to use
a maximum of two map registers. This adapter apparently does not use scatter/gather lists and has put away all its adapter channels. Look at the map registers in more detail:
0:kd> !dma 82f06cd0 2
Adapter: 82f06cd0
Owner: NDIS!NdisMAllocateMapRegisters
...
Map register file 82f06c58 (0/2 mapped)
Double buffer mdl: 82f2c188
Map registers:
82f06c80: Not mapped
82f06c8c: Not mapped
Map register file 82f06228 (1/2 mapped)
Double buffer mdl: 82f1b678
Map registers:
82f06250: 00bc bytes mapped to f83c003c
82f0625c: Not mapped
Map register file 82fa5ad8 (1/2 mapped)
Double buffer mdl: 82f1b048
Map registers:
82fa5b00: 0036 bytes mapped to 82d17102
82fa5b0c: Not mapped
...
In this example, you see that certain map registers have been mapped. Each map register file is an allocation of map registers by the driver. In other words, it represents a
single call to AllocateAdapterChannel. NDIS collects a large number of these map register files, while some drivers create them one at a time and dispose of them when
they are finished.
The map register files are also the addresses that are returned to the device under the name "MapRegisterBase". Note that DMA verifier only hooks the first 64 map registers
for each driver. The rest are ignored for reasons of space (each map register represents three physical pages).
In this example, two map register files are in use. This means that the driver has mapped a buffer so it is visible to the hardware. In the first case, 0xBC bytes are mapped to
the system virtual address 0xF83C003C.
An examination of the common buffers reveals:
0:kd> !dma 82f06cd0 4
Adapter: 82f06cd0
Owner: NDIS!NdisMAllocateMapRegisters
...
Common buffer allocated by NDIS!NdisMAllocateSharedMemory:
Length:
1000
Virtual address: 82e77000
Physical address: 2a77000
Common buffer allocated by NDIS!NdisMAllocateSharedMemory:
Length:
12010
Virtual address: 82e817f8
Physical address: 2a817f8
Common buffer allocated by NDIS!NdisMAllocateSharedMemory:
Length:
4300
Virtual address: 82e95680
Physical address: 2a95680
Common buffer allocated by NDIS!NdisMAllocateSharedMemory:
Length:
4800
Virtual address: 82e9d400
Physical address: 2a9d400
This is fairly straightforward; there are four common buffers of varying lengths. The physical and virtual addresses are all given.
Additional Information
For information about Driver Verifier, see the Windows Driver Kit (WDK) documentation. For information about DMA, see the Windows Driver Kit (WDK) documentation
and Microsoft Windows Internals by Mark Russinovich David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!dpa
The !dpa extension displays pool allocation information.
Syntax
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!dpa Options
!dpa -?
Parameters
Options
Must be exactly one of the following options:
-c
Displays current pool allocation statistics.
-v
Displays all current pool allocations.
-vs
Causes the display to include stack traces.
-f
Displays failed pool allocations.
-r
Displays free pool allocations.
-p Ptr
Displays all pool allocations that contain the pointer Ptr.
-?
Displays some brief Help text for this extension in the Debugger Command window.
DLL
Windows 2000
Unavailable
Windows XP and later Kdexts.dll
Comments
Pool instrumentation must be enabled in Win32k.sys in order for this extension to work.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!dpcs
The !dpcs extension displays the deferred procedure call (DPC) queues for a specified processor.
Syntax
!dpcs [Processor]
Parameters
Processor
Specifies a processor. If Processor is omitted, then the DPC queues for all processors are displayed.
DLL
Windows 2000
Unavailable
Windows XP and later Kdexts.dll
Additional Information
For information about DPCs, see the Windows Driver Kit (WDK) documentation and Microsoft Windows Internals by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!driveinfo
The !driveinfo extension displays volume information for the specified drive.
Syntax
!driveinfo Drive[:]
!driveinfo
Parameters
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Drive
Specifies a drive. The colon at the end of the drive name is optional.
No parameters
Displays some brief Help text for this extension in the Debugger Command window.
DLL
Windows 2000
Unavailable
Windows XP and later Kdexts.dll
Comments
The drive information displayed by this extension is obtained by querying the underlying file system; for example:
kd> !driveinfo c:
Drive c:, DriveObject e136cd88
Directory Object: e1001408 Name: C:
Target String is '\Device\HarddiskVolume1'
Drive Letter Index is 3 (C:)
Volume DevObj: 82254a68
Vpb: 822549e0 DeviceObject: 82270718
FileSystem: \FileSystem\Ntfs
Volume has 0x229236 (free) / 0x2ee1a7 (total) clusters of size 0x1000
8850.21 of 12001.7 MB free
!drivers
In operating systems prior to Windows XP, the !drivers extension displays a list of all drivers loaded on the target computer, along with summary information about their
memory use.
In Windows XP and later versions of Windows, the !drivers extension is obsolete. To display information about loaded drivers and other modules, use the lm command. The
command lm t n displays information in a format very similar to the old !drivers extension. However, this command will not display the memory usage of the drivers as the !
drivers extension did. It will only display the drivers' start and end addresses, image names, and timestamps. The !vm and !memusage extensions can be used to display
memory usage statistics.
Syntax
!drivers [Flags]
Parameters
Flags
Can be any combination of the following values. (The default is 0x0.)
Bit 0 (0x1)
Causes the display to include information about resident and standby memory.
Bit 1 (0x2)
If this bit is set and bit 2 (0x4) is not set, the display will include information about resident, standby, and locked memory, as well as the loader entry address. If bit 2
is set, this causes the display to be a much longer and more detailed list of the driver image. Information about the headers is included, as is section information.
Bit 2 (0x4)
Causes the display to be a much longer and more detailed list of the driver image. Information about each section is included. If bit 1 (0x2) is set, this will also
include header information.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Unavailable
Comments
An explanation of this command's display is given in the following table:
Column
Meaning
Base
The starting address of the device driver code, in hexadecimal. When the memory address used by the code that causes a stop falls between the base address for a
driver and the base address for the next driver in the list, that driver is frequently the cause of the fault. For instance, the base for Ncrc810.sys is 0x80654000. Any
address between that and 0x8065a000 belongs to this driver.
Code Size The size, in kilobytes, of the driver code, in both hexadecimal and decimal.
Data Size The amount of space, in kilobytes, allocated to the driver for data, in both hexadecimal and decimal.
Locked
(Only when Flag 0x2 is used) The amount of memory locked by the driver.
Resident (Only when Flag 0x1 or 0x2 is used) The amount of the driver's memory that actually resides in physical memory.
Standby (Only when Flag 0x1 or 0x2 is used) The amount of the driver's memory that is on standby.
Loader
(Only when Flag 0x2 is used) The loader entry address.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Entry
Driver
Name
Creation
Time
kb)
kb)
kb)
kb)
Driver Name
ntoskrnl.exe
hal.dll
ncrc810.sys
SCSIPORT.SYS
Creation Time
Fri May 26 15:13:00
Tue May 16 16:50:34
Fri May 05 20:07:04
Fri May 05 20:08:05
Additional Information
See Plug and Play Debugging for applications of this extension command. For information about drivers and their memory use, see the Windows Driver Kit (WDK)
documentation and Microsoft Windows Internals by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!drvobj
The !drvobj extension displays detailed information about a DRIVER_OBJECT.
Syntax
!drvobj DriverObject [Flags]
Parameters
DriverObject
Specifies the driver object. This can be the hexadecimal address of the DRIVER_OBJECT structure or the name of the driver.
Flags
Can be any combination of the following bits. (The default is 0x01.)
Bit 0 (0x1)
Causes the display to include device objects owned by the driver.
Bit 1 (0x2)
Causes the display to include entry points for the driver's dispatch routines.
Bit 2 (0x4)
Lists with detailed information the device objects owned by the driver (requires bit 0 (0x1)).
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
If DriverObject specifies the name of the device but supplies no prefix, the prefix \Driver\ is assumed. Note that this command will check to see if DriverObject is a valid
address or device name before using the expression evaluator.
If DriverObject is an address, it must be the address of the DRIVER_OBJECT structure. This can be obtained by examining the arguments passed to the driver's DriverEntry
routine.
This extension command will display a list of all device objects created by a specified driver. It will also display all fast I/O routines registered with this driver object.
The following is an example for the Symbios Logic 810 SCSI miniport driver:
kd> bp DriverEntry
kd> g
symc810!DriverEntry+0x40:
80006a20: b07e0050 stl
kd> r a0
a0=809d5550
//
breakpoint at DriverEntry
t2,50(sp)
//
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
809d50d0
You can also use !devobj 809d50d0 to get information about the device object.
Additional Information
See Plug and Play Debugging for examples and applications of this extension command. For information about driver objects, see the Windows Driver Kit (WDK)
documentation and Microsoft Windows Internals by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!dskheap
The !dskheap extension displays desktop heap information for a specified session.
Syntax
!dskheap [-v] [-s SessionID]
Parameters
-v
Causes the display to include more detailed output.
-s SessionID
Specifies a session. If this parameter is omitted, then the desktop heap information for session 0 is displayed.
DLL
Windows 2000
Unavailable
Windows XP and later Kdexts.dll
Comments
The desktop heap information for the session is arranged by window station.
Here are a couple of examples:
kd> !dskheap -s 3
Winstation\Desktop
Heap Size(KB)
Used Rate(%)
-----------------------------------------------------------WinSta0\Screen-saver
3072
0%
WinSta0\Default
3072
0%
WinSta0\Disconnect
64
4%
WinSta0\Winlogon
128
5%
-----------------------------------------------------Total Desktop: (
6336 KB 4 desktops)
Session ID: 3
============================================================
kd> !dskheap
Winstation\Desktop
Heap Size(KB)
Used Rate(%)
-----------------------------------------------------------WinSta0\Default
3072
0%
WinSta0\Disconnect
64
4%
WinSta0\Winlogon
128
9%
Service-0x0-3e7$\Default
512
4%
Service-0x0-3e5$\Default
512
0%
Service-0x0-3e4$\Default
512
1%
SAWinSta\SADesktop
512
0%
-----------------------------------------------------Total Desktop: (
5312 KB 7 desktops)
Session ID: 0
============================================================
Additional Information
For information about desktops or desktop heaps, see the Microsoft Windows SDK documentation and Microsoft Windows Internals by Mark Russinovich and David
Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!eb, !ed
The !eb and !ed extensions write a sequence of values into a specified physical address.
These extension commands should not be confused with the e* (Enter Values) command.
Syntax
!eb [Flag] PhysicalAddress Data [ ... ]
!ed [Flag] PhysicalAddress Data [ ... ]
Parameters
Flag
Can be any one of the following values. The Flag value must be surrounded by square brackets:
[c]
Writes to cached memory.
[uc]
Writes to uncached memory.
[wc]
Writes to write-combined memory.
PhysicalAddress
Specifies the first physical address on the target computer to which the data will be written, in hexadecimal.
Data
Specifies one or more values to be written sequentially into physical memory. Enter these values in hexadecimal format. For the !eb extension, each value must be 1 byte
(two hexadecimal digits). For the !ed extension, each value must be one DWORD (eight hexadecimal digits). You can include any number of Data values on one line. To
separate multiple values, use commas or spaces.
DLL
Windows 2000
Kext.dll
Kdextx86.dll
Windows XP and later Kext.dll
Additional Information
To read physical memory, use the !d* extensions. For an overview of memory manipulation and a description of other memory-related commands, see Reading and Writing
Memory.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
To display the PCI configuration space, use !pci 100 Bus Device Function.
Additional Information
See Plug and Play Debugging for applications of this extension command, and some additional examples. For information about PCI buses, see the Windows Driver Kit
(WDK) documentation.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!ecs
The !ecs extension is obsolete. To edit the PCI configuration space, use !ecb, !ecd, or !ecw.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!errlog
The !errlog extension displays the contents of any pending entries in the I/O system's error log.
Syntax
!errlog
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
This command displays information about any pending events in the I/O system's error log. These are events queued by calls to the IoWriteErrorLogEntry function, to be
written to the system's event log for subsequent viewing by the Event Viewer.
Only entries that were queued by IoWriteErrorLogEntry but have not been committed to the error log will be displayed.
This command can be used as a diagnostic aid after a system crash because it reveals pending error information that was unable to be committed to the error log before the
system halted.
Additional Information
For information about IoWriteErrorLogEntry, see the Windows Driver Kit (WDK) documentation.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!errpkt
The !errpkt extension displays the contents of a Windows Hardware Error Architecture (WHEA) hardware error packet.
Syntax
!errpkt Address
Parameters
Address
Specifies the address of the hardware error packet.
DLL
Windows 2000
Unavailable
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Windows XP
Unavailable
Windows Server 2003
Unavailable
Windows Vista and later Kdexts.dll
This extension can be used only in Windows Vista and later versions of Windows.
Comments
The following example shows the output of the !errpkt extension:
3: kd> !errpkt fffffa8007cf44da
WHEA Error Packet Info Section (@ fffffa8007cf44da)
Flags
: 0x00000000
Size
: 0x218
RawDataLength
: 0x392
Context
: 0x0000000000000000
ErrorType
: 0x0 - Processor
ErrorSeverity
: 0x1 - Fatal
ErrorSourceId
: 0x0
ErrorSourceType : 0x0 - MCE
Version
: 00000002
Cpu
: 0000000000000002
RawDataFormat
: 0x2 - Intel64 MCA
Raw Data
: Located @ FFFFFA8007CF45F2
!errrec
The !errrec extension displays the contents of a Windows Hardware Error Architecture (WHEA) error record.
Syntax
!errrec Address
Parameters
Address
Specifies the address of the error record.
DLL
Windows 2000
Unavailable
Windows XP
Unavailable
Windows Server 2003
Unavailable
Windows Vista and later Kdexts.dll
This extension can be used only in Windows Vista and later versions of Windows.
Comments
The following example shows how the !whea extension can be used to obtain the address of an error record, and then the contents of this record can be displayed by the !
errrec extension:
3: kd> !whea
Error Source Table @ fffff800019ca250
13 Error Sources
Error Source 0 @ fffffa80064132c0
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Notify Type
Type
Error Count
Record Count
Record Length
Error Records
:
:
:
:
:
:
record @ fffffa8007cf4030
. . . .
3: kd> !errrec fffffa8007cf4030
===============================================================================
Common Platform Error Record @ fffffa8007cf4030
------------------------------------------------------------------------------Revision
: 2.1
Record Id
: 01c9c7ff04e0ff7d
Severity
: Fatal (1)
Length
: 1730
Creator
: Microsoft
Notify Type
: Machine Check Exception
Timestamp
: 4/28/2009 12:54:47
Flags
: 0x00000000
===============================================================================
Section 0
: Processor Generic
------------------------------------------------------------------------------Descriptor
@ fffffa8007cf40b0
Section
@ fffffa8007cf4188
Offset
: 344
Length
: 192
Flags
: 0x00000001 Primary
Severity
: Fatal
No valid data fields are present.
===============================================================================
Section 1
: {390f56d5-ca86-4649-95c4-73a408ae5834}
------------------------------------------------------------------------------Descriptor
@ fffffa8007cf40f8
Section
@ fffffa8007cf4248
Offset
: 536
Length
: 658
Flags
: 0x00000000
Severity
: Fatal
*** Unknown section format ***
===============================================================================
Section 2
: Error Packet
------------------------------------------------------------------------------Descriptor
@ fffffa8007cf4140
Section
@ fffffa8007cf44da
Offset
: 1194
Length
: 536
Flags
: 0x00000000
Severity
: Fatal
WHEA Error Packet Info Section (@ fffffa8007cf44da)
Flags
: 0x00000000
Size
: 0x218
RawDataLength
: 0x392
Context
: 0x0000000000000000
ErrorType
: 0x0 - Processor
ErrorSeverity
: 0x1 - Fatal
ErrorSourceId
: 0x0
ErrorSourceType : 0x0 - MCE
Version
: 00000002
Cpu
: 0000000000000002
RawDataFormat
: 0x2 - Intel64 MCA
Raw Data
: Located @ FFFFFA8007CF45F2
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The !whea and !errpkt extensions can be used to display additional WHEA information. For general information about WHEA, see
(WHEA) in the Windows Driver Kit (WDK) documentation.
!exca
The !exca extension displays PC-Card Interrupt Controller (PCIC) Exchangable Card Architecture (ExCA) registers.
Syntax
!exca BasePort.SocketNumber
Parameters
BasePort
Specifies the base port of the PCIC.
SocketNumber
Specifies the socket number of the ExCA register on the PCIC.
DLL
Windows 2000
Kext.dll
Kdextx86.dll
Windows XP and later Kext.dll
!exqueue
The !exqueue extension displays a list of items currently queued in the ExWorkerQueue work queues.
Syntax
!exqueue [Flags]
Parameters
Flags
Can be any combination of the following values. The default is 0x0, which will display only a limited amount of information.
Bit 0
Adds time and priority statistics to the display, unless 0x2 is also set.
(0x1)
Bit 1
Adds to the display a list of threads and events associated with the work queue and their wait states.
(0x2)
Bit 2
Adds to the display a list of threads associated with the work queue. If ussed without 0x2, each thread is displayed on a single line. If used with 0x2, each
(0x4)
thread is displayed with a stack trace.
Bit 3
(Windows XP and later) Adds the return address, the stack pointer, and (on Itanium systems) the bsp register value to the display of each thread in the queue.
(0x8)
The display of function arguments is suppressed.
Bit 4
Displays only the critical work queue.
(0x10)
Bit 5
Displays only the delayed work queue.
(0x20)
Bit 6
Displays only the hypercritical work queue.
(0x40)
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Comments
If Flags does not include bits 4, 5, or 6, the display includes the critical work queue, the delayed work queue, and the hypercritical work queue.
Here is an sample of the output from this extension:
kd> !exqueue
Dumping ExWorkerQueue: 8046A5C0
**** Critical WorkQueue( current = 0 maximum = 1 )
THREAD fe502940 Cid 8.c Teb: 00000000 Win32Thread: 00000000 WAIT
THREAD fe5026c0 Cid 8.10 Teb: 00000000 Win32Thread: 00000000 WAIT
THREAD fe502440 Cid 8.14 Teb: 00000000 Win32Thread: 00000000 WAIT
THREAD fe5021c0 Cid 8.18 Teb: 00000000 Win32Thread: 00000000 WAIT
THREAD fe501020 Cid 8.1c Teb: 00000000 Win32Thread: 00000000 WAIT
**** Delayed WorkQueue( current
THREAD fe501da0 Cid 8.20 Teb:
THREAD fe501b20 Cid 8.24 Teb:
THREAD fe5018a0 Cid 8.28 Teb:
= 0 maximum = 1 )
00000000 Win32Thread: 00000000 WAIT
00000000 Win32Thread: 00000000 WAIT
00000000 Win32Thread: 00000000 WAIT
!filecache
The !filecache extension displays information regarding the system file cache memory and PTE use.
Syntax
!filecache
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
Each line of this extension's output represents a virtual address control block (VACB). When named files are mapped into the VACB, the names of these files are displayed. If
"no name for file" is specified, this means that this VACB is being used to cache metadata.
Here is an example from a Windows 2000 system:
kd> !filecache
***** Dump file cache******
File Cache Information
Current size 7088 kb
Peak size
11376 kb
loading file cache database...
File cache has 129 valid pages
Usage Summary in KiloBytes (Kb):
Control Valid Standby Dirty Shared Locked PageTables name
80994c08
248
0
0
0
0
0
No Name for File
80995c88
528
0
0
0
0
0
No Name for File
80992a28
120
0
0
0
0
0
No Name for File
80993d28
32
0
0
0
0
0
No Name for File
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
8098c1e8
8091a908
8091d708
80992f08
8098ca48
80949ea8
80992828
8155c688
8
8
16
8
8
8
16
8
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
mapped_file( SysEvent.Evt )
No Name for File
No Name for File
No Name for File
No Name for File
No Name for File
No Name for File
mapped_file( cmd.exe )
Here is an example of the output from this extension from a Windows XP system:
kd> !filecache
***** Dump file cache******
Reading and sorting VACBs ...
Removed 1811 nonactive VACBs, processing 235 active VACBs ...
File Cache Information
Current size 28256 kb
Peak size
30624 kb
235 Control Areas
Skipping view @ c1040000 - no VACB, but PTE is valid!
Loading file cache database (100% of 131072 PTEs)
SkippedPageTableReads = 44
File cache has 4056 valid pages
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
81701120
816ff0a8
8159a358
8159da70
8159c158
815cb9b0
81779b20
8159ac20
815683f8
81566978
81568460
815675d8
81567640
...
81515878
81516870
8150df60
...
816e5300
8152afa0
8153bbd8
8172f950
8173e9c0
814f4538
81650790
814f55f8
...
814caef8
8171cd90
815f07f0
814a2298
81541538
81585288
8173f708
...
8158cf10
8
4
4
4
4
4
4
4
4
580
4
68
4
16
8
0
0
0
0
0
0
0
0
0
0
0
4
4
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
es.dll
stdole2.tlb
$Directory
$Directory
$Directory
00000001
$Directory
$Directory
$Directory
NTUSER.DAT
$Directory
UsrClass.dat
$Directory
4
8
4
0
0
0
0
0
0
0
0
0
$Directory
$Directory
$Directory
4
16
4
488
4
4
344
4
0
212
32
392
0
0
48
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
$Directory
msmsgs.exe
stdole32.tlb
OBJECTS.DATA
$Directory
$Directory
INDEX.BTR
$Directory
4
1392
4
4
4
28
4
0
36
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
$Directory
system
$Directory
$Directory
$Directory
$Directory
$Directory
$Directory
Additional Information
For information about file system drivers, see the Windows Driver Kit (WDK) documentation and Microsoft Windows Internals by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!filelock
The !filelock extension displays a file lock structure.
Syntax
Syntax in Windows 2000
!filelock FileLockAddress
Syntax in Windows XP and later
!filelock FileLockAddress
!filelock ObjectAddress
Parameters
FileLockAddress
Specifies the hexadecimal address of the file lock structure.
ObjectAddress
(Windows XP and later) Specifies the hexadecimal address of a file object that owns the file lock.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Additional Information
For information about file objects, see the Windows Driver Kit (WDK) documentation and Microsoft Windows Internals by Mark Russinovich and David Solomon.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!fileobj
The !fileobj extension displays detailed information about a FILE_OBJECT structure.
Syntax
!fileobj FileObject
Parameters
FileObject
Specifies the address of a FILE_OBJECT structure.
DLL
Windows 2000
Unavailable
Windows XP and later Kdexts.dll
Comments
If the FILE_OBJECT structure has an associated cache, !fileobj tries to parse and display cache information..
Additional Information
For information about file objects, see the Microsoft Windows SDK documentation, the Windows Driver Kit (WDK) documentation, and Microsoft Windows Internals by
Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!filetime
The !filetime extension converts a 64-bit FILETIME structure into a human-readable time.
Syntax
!filetime Time
Parameters
Time
Specifies a 64-bit FILETIME structure.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
Here is an example of the output from this extension:
kd> !filetime 1c4730984712348
7/26/2004 04:10:18.712 (Pacific Standard Time)
!finddata
The !finddata extension displays the cached data at a given offset within a specified file object.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Syntax
!finddata FileObject Offset
Parameters
FileObject
Specifies the address of the file object.
Offset
Specifies the offset.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Additional Information
For information about cache management, see the Microsoft Windows SDK documentation and Microsoft Windows Internals by Mark Russinovich and David Solomon.
For information about other cache management extensions, see the !cchelp extension.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!findfilelockowner
The !findfilelockowner extension attempts to find the owner of a file object lock by examining all threads for a thread that is blocked in an IopSynchronousServiceTail
assert and that has the file object as a parameter.
Syntax
!findfilelockowner [FileObject]
Parameters
FileObject
Specifies the address of a file object. If FileObject is omitted, the extension searches for any thread in the current process that is stuck in IopAcquireFileObjectLock and
retrieves the file object address from the stack trace.
DLL
Windows 2000
Unavailable
Windows XP and later Kdexts.dll
Comments
This extension is most useful after a critical section timeout in which the thread that times out was waiting for the file inside IopAcquireFileObjectLock. After the offending
thread is found, the extension attempts to recover the IRP that was used for the request and to display the driver that was processing the IRP.
The extension takes some time to complete because it walks the stack of all threads in the system until it finds the offending thread.You can stop ` at any point by pressing
CTRL+BREAK (in WinDbg) or CTRL+C (in KD).
Additional Information
For information about file objects, see the Microsoft Windows SDK documentation, the Windows Driver Kit (WDK) documentation, and Microsoft Windows Internals by
Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!for_each_process
The !for_each_process extension executes the specified debugger command once for each process in the target.
Syntax
!for_each_process ["CommandString"]
!for_each_process -?
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Parameters
CommandString
Specifies the debugger commands to be executed for each process.
If CommandString includes multiple commands, separate them with semicolons (;) and enclose CommandString in quotation marks ("). If CommandString is enclosed in
quotations marks, the individual commands within CommandString cannot contain quotation marks. Within CommandString, @#Process is replaced by the process
address.
-?
Displays help for this extension in the Debugger Command window.
DLL
This extension works only in kernel mode, even though it resides in Ext.dll.
Windows 2000
Ext.dll
Windows XP and later Ext.dll
Comments
If no arguments are supplied, the debugger displays a list of all processes, along with time and priority statistics. This is equivalent to entering !process @#Process 0 as the
CommandString value.
To terminate execution at any point, press CTRL+BREAK (in WinDbg) or CTRL+C (in KD).
Additional Information
For general information about processes, see Threads and Processes. For information about manipulating or obtaining information about processes, see Controlling Processes
and Threads.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!for_each_thread
The !for_each_thread extension executes the specified debugger command once for each thread in the target.
Syntax
!for_each_thread ["CommandString"]
!for_each_thread -?
Parameters
CommandString
Specifies the debugger commands to be executed for each thread. If CommandString includes multiple commands, separate them with semicolons (;) and enclose
CommandString in quotation marks ("). If CommandString is enclosed in quotations marks, the individual commands within CommandString cannot contain quotation
marks. Within CommandString, @#Thread is replaced by the thread address.
-?
Displays help for this extension in the Debugger Command window.
DLL
This extension works only in kernel mode, even though it resides in Ext.dll.
Windows 2000
Ext.dll
Windows XP and later Ext.dll
Comments
If no arguments are supplied, the debugger displays a list of all threads, along with thread wait states. This is equivalent to entering !thread @#Thread 2 as the
CommandString value.
You can terminate execution at any point by pressing CTRL+BREAK (in WinDbg) or CTRL+C (in KD).
Additional Information
For more general information about threads, see Threads and Processes. For more information about manipulating or obtaining information about threads, see Controlling
Processes and Threads.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!fpsearch
The !fpsearch extension searches the freed special pool for a specified address.
Syntax
!fpsearch [Address] [Flag]
Parameters
Address
Specifies a virtual address.
Flag
If set, the debugger displays the raw content of each page on the free list as it searches the freed special pool.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
The display for an address includes the virtual address, the page frame number (PFN), the pool tag, size, whether the data at the address is pageable, the thread ID, and the call
stack at the time of deallocation.
If Address is set to -1, the debugger displays the entire freed special pool.
If the debugger cannot find the specified address in the freed special pool, it does not display anything.Here is an example of the output from this extension:
kd> !fpsearch -1 1
Searching the free page list (8 entries) for all freed special pool
1EC4000
1EC4000
1EC4000
1EC4000
1EC4000
1EC4000
1EC4000
1EC4000
04000200
00000800
bad0b0b0
72657355
00028b94
00000000
8153b1b8
0000001b
e56b6f54
00000000
82100000
20203233
00000000
00000000
00028aff
00000000
000001f4
00000000
00000000
0000bac5
0000bac9
ffffffff
00000000
00000012
0000059c
00000000
00000000
00000000
00000000
7fffffff
00000000
00000514
....Tok.........
................
................
User32 ........
................
................
..S.............
................
26A2000
26A2000
26A2000
26A2000
26A2000
26A2000
26A2000
26A2000
000a0008
000a0008
000e000c
00120010
000e000c
000e000c
000a0008
00120010
00adecb0
00adecc8
00adece0
00adecfc
00aded1c
00aded38
00aded54
00aded6c
000e000c
000e000c
000e000c
000e000c
000e000c
000e000c
000e000c
000e000c
00adecba
00adecd2
00adecee
00aded0e
00aded2a
00aded46
00aded5e
00aded7e
................
................
................
................
............*...
....8.......F...
....T.......^...
....l.......~...
2161000
2161000
2161000
2161000
2161000
2161000
2161000
2161000
000a0008
000a0008
000e000c
00120010
000e000c
000e000c
000a0008
00120010
00adeccc
00adece4
00adecfc
00aded18
00aded38
00aded54
00aded70
00aded88
000e000c
000e000c
000e000c
000e000c
000e000c
000e000c
000e000c
000e000c
00adecd6
00adecee
00aded0a
00aded2a
00aded46
00aded62
00aded7a
00aded9a
................
................
................
............*...
....8.......F...
....T.......b...
....p.......z...
................
CEC8000
CEC8000
CEC8000
CEC8000
CEC8000
CEC8000
CEC8000
CEC8000
0311ffa4
00001e00
00000328
7ffdf000
e18ba8c0
00000000
00000000
00000000
03120000
00000000
00000704
00000000
00000000
00000000
00000000
00000000
0311c000
7ff88000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
................
................
(...............
................
................
................
................
................
CEAD000
CEAD000
CEAD000
CEAD000
CEAD000
CEAD000
CEAD000
CEAD000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
................
................
................
................
................
................
................
................
...
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
You can stop execution at any point by pressing CTRL+BREAK (in WinDbg) or CTRL+C (in KD).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!frag
The !frag extension displays fragmentation information about pool memory on the target system.
Syntax
!frag [Flags]
Parameters
Flags
Specifies the level of output. Can be any combination of the following bits. The default is zero.
Bit 0 (0x1)
Causes the display to include the number and size of the fragments for each index.
Bit 1 (0x2)
Causes the display to include allocation information.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
Extremely fragmented pools can decrease performance.
Here is an example of the output from this extension:
kd> !frag 1
NonPaged Pool Fragmentation
index: 0 number of fragments:
4 bytes:
128
index: 1 number of fragments:
0 bytes:
0
index: 2 number of fragments:
2 bytes:
192
index: 3 number of fragments:
0 bytes:
0
...
index: 20 number of fragments:
0 bytes:
0
index: 21 number of fragments:
0 bytes:
0
index: 22 number of fragments:
1 bytes:
7232
index: 23 number of fragments:
0 bytes:
0
index: 24 number of fragments:
0 bytes:
0
Number of fragments:
11 consuming
9344 bytes
NonPagedPool Usage: 1105920 bytes
kd> !frag 2
NonPaged Pool Fragmentation
818718a0 size:
20 previous size:
a0
81870720 size:
20 previous size:
60
80d1ae80 size:
20 previous size:
a0
818703c0 size:
20 previous size:
60
80962600 size:
60 previous size:
a0
8098c180 size:
60 previous size: 100
81937680 size: 160 previous size:
40
81870e00 size: 120 previous size:
20
81937d80 size: 260 previous size:
20
81936000 size: 220 previous size:
0
81610260 size: 1c40 previous size: 260
Number of fragments:
11 consuming
NonPagedPool Usage: 1105920 bytes
Cc
Cc
Cc
Cc
ScsD
ScsD
Lric
None
Thre
Proc
9344 bytes
Additional Information
For information about memory management, see Microsoft Windows Internals by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!frozen
The !frozen extension displays the state of each processor.
Syntax
!frozen
DLL
Windows 2000
Unavailable
Windows XP and later Kdexts.dll
Comments
Here is an example of the output from this extension:
0: kd> !frozen
Processor states:
0 : Current
1 : Frozen
!fwver
The !fwver extension displays the Itanium firmware version.
Syntax
!fwver
DLL
Unavailable
Windows 2000
Windows XP and later Kdexts.dll
This extension command can only be used with an Itanium target computer.
Comments
Here is an example of the output from this extension:
kd> !fwver
Firmware Version
Sal Revision:
SAL_A_VERSION:
SAL_B_VERSION:
PAL_A_VERSION:
PAL_B_VERSION:
smbiosString:
0
0
0
6623
6625
W460GXBS2.86E.0117A.P08.200107261041
Additional Information
For more information, consult an Intel architecture manual.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!gbl
The !gbl extension displays header information from the ACPI BIOS Root System Description (RSDT) table of the target computer.
Syntax
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!gbl [-v]
Parameters
-v
Verbose. Displays detailed information about the table.
DLL
Windows 2000
Unavailable
Windows XP and later Kdexts.dll
Additional Information
For information about the ACPI and ACPI tables, see Other ACPI Debugging Extensions and the ACPI Specification Web site. Also see the Microsoft Windows SDK
documentation, the Windows Driver Kit (WDK) documentation, and Microsoft Windows Internals by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!gentable
The !gentable extension displays an RTL_GENERIC_TABLE.
Syntax
Syntax in Windows 2000
!gentable Address
Syntax in Windows XP and later
!gentable Address [Flag]
Parameters
Address
Specifies the address of the RTL_GENERIC_TABLE.
Flag
(Windows XP and later) Specifies the table source. If Flag is 1, the AVL table is used. If Flag is 0 or omitted, the non-AVL table is used. In Windows 2000, the nonAVL table is always used.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
!hidppd
The !hidppd extension displays the contents of the HIDP_PREPARSED_DATA structure.
Syntax
!hidppd Address
Parameters
Address
Specifies the hexadecimal address of the HIDP_PREPARSED_DATA structure.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Additional Information
For information about human input devices (HID), see the Windows Driver Kit (WDK) documentation.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!icpleak
The !icpleak extension examines all I/O completion objects in the system for the object with the largest number of queued entries.
Syntax
!icpleak [HandleFlag]
Parameters
HandleFlag
If this flag is set, the display also includes all processes that have a handle to the object with the largest number of queued entries.
DLL
Windows 2000
Unavailable
Windows XP and later Kdexts.dll
Comments
This extension is useful when there is a leak in the I/O completion pool. I/O completion pool leaks can occur when a process is allocating I/O completion packets by calling
PostQueuedCompletionStatus, but is not calling GetQueuedCompletionStatus to free them, or when a process is queuing completion entries to a port, but there is no
thread retrieving the entries. To detect a leak run the !poolused extension and check the value of ICP pool tag. If pool use with the ICP tag is significant, a leak might have
occurred.
This extension works only if the system maintains type lists. If the HandleFlag is set and the system has many processes, this extension will take a long time to run.
You can stop at any point by pressing CTRL+BREAK (in WinDbg) or CTRL+C (in KD).
Additional Information
For information about I/O completion ports, see Microsoft Windows Internals by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!idt
The !idt extension displays the interrupt service routines (ISRs) for a specified interrupt dispatch table (IDT).
Syntax
!idt IDT
!idt [-a]
!idt -?
Parameters
IDT
Specifies the IDT to display.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
-a
When IDT is not specified, the debugger displays the IDTs of all processors on the target computer in an abbreviated format. If -a is specified, the ISRs for each IDT are
also displayed.
-?
Displays help for this extension in the Debugger Command window.
DLL
Windows 2000
Unavailable
Windows XP and later Kdexts.dll
This extension command can only be used with an x64-based or x86-based target computer.
Comments
Here is an example of the output from this extension:
0: kd> !idt
Dumping IDT:
37:806ba78c hal!PicSpuriousService37
3d:806bbc90 hal!HalpApcInterrupt
41:806bbb04 hal!HalpDispatchInterrupt
50:806ba864 hal!HalpApicRebootService
63:8641376c VIDEOPRT!pVideoPortInterrupt (KINTERRUPT 86413730)
73:862aa044 portcls!CInterruptSyncServiceRoutine (KINTERRUPT 862aa008)
82:86594314 atapi!IdePortInterrupt (KINTERRUPT 865942d8)
83:86591bec SCSIPORT!ScsiPortInterrupt (KINTERRUPT 86591bb0)
92:862b53dc serial!SerialCIsrSw (KINTERRUPT 862b53a0)
93:86435844 i8042prt!I8042KeyboardInterruptService (KINTERRUPT 86435808)
a3:863b366c i8042prt!I8042MouseInterruptService (KINTERRUPT 863b3630)
a4:8636bbec USBPORT!USBPORT_InterruptService (KINTERRUPT 8636bbb0)
b1:86585bec ACPI!ACPIInterruptServiceRoutine (KINTERRUPT 86585bb0)
b2:863c0524 serial!SerialCIsrSw (KINTERRUPT 863c04e8)
b4:86391a54 NDIS!ndisMIsr (KINTERRUPT 86391a18)
USBPORT!USBPORT_InterruptService (KINTERRUPT 863ae890)
c1:806ba9d0 hal!HalpBroadcastCallService
d1:806b9dd4 hal!HalpClockInterrupt
e1:806baf30 hal!HalpIpiHandler
e3:806baca8 hal!HalpLocalApicErrorService
fd:806bb460 hal!HalpProfileInterrupt
Additional Information
For information about ISRs and IDTs, see the Windows Driver Kit (WDK) documentation and Microsoft Windows Internals by Mark Russinovich and David Solomon.
For more information about how to display the interrupt vector tables on an Itanium target computer, see !ivt.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!ih
The !ih extension displays the interrupt history record for the specified processor.
Syntax
!ih Processor
Parameters
Processor
Specifies a processor. If Processor is omitted, the current processor is used.
DLL
Windows 2000
Unavailable
Windows XP and later Kdexts.dll
This extension command can only be used with an Itanium-based target computer.
Comments
This extension displays the interrupt history record without referencing the program counter symbols. To display the interrupt history record using the program counter
symbols, use the !ihs extension. To enable the interrupt history record, add /configflag=32 to the boot entry options.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
IPSR
1010092a6018
1010092a6018
1010092a6018
1010092a6018
1010092a6018
1010092a6018
1010092a6018
1010092a6018
e00000008588c040
1210092a6018
1210092a6018
e000000085896040
1010092a2018
1010092a6018
1010092a2018
1010092a2018
e0000000818bbe10
1010092a2018
1013082a6018
1213082a6018
1213082a6018
1013082a6018
1213082a6018
1013082a6018
10082a6018
1010092a6018
ExtraField
IFA=
6fc00a0200c
IFA= 1ffffe00001de2d0
IFA= 1ffffe01befff338
IFA=
6fc00a0200c
IFA= 1ffffe00001d9188
IFA= 1ffffe01befff250
IFA= e0000165f82dc1c0
IFA= e0000000fffe0018
OSP= e0000165f82dbd40
IFA= e0000165f7edaf30
IFA= e0000165fff968a9
OSP= e0000165f8281de0
IFA= e00000008189fe50
IVR=
d0
IFA= e0000165f88203f0
IFA= e0000000f00ff3fd
OSP= e00000008189fe20
IFA= e0000165f02433f0
IFA=
77cfbda0
IFA=
6fbfee0ff98
IFA=
77c16ab8
IFA=
6fbfffa6048
IFA=
77c229c0
IFA=
77c1c320
Num=
42
IFA= e000010600703784
!ihs
The !ihs extension displays the interrupt history record for the specified processor, using program counter symbols.
Syntax
!ihs Processor
Parameters
Processor
Specifies a processor. If Processor is omitted, the current processor is used.
DLL
Windows 2000
Unavailable
Windows XP and later Kdexts.dll
This extension command can only be used with an Itanium target computer.
Comments
To display the interrupt history record without using program counter symbols, use the !ih extension. To enable the interrupt history record, add /configflag=32 to the boot
entry options.
Here is an example of the output from this extension:
kd> !ihs
Total # of interruptions = 2093185
Vector
IIP
VHPT FAULT e0000000830d3190
VHPT FAULT e0000000830d33d0
VHPT FAULT e0000000830d33d0
VHPT FAULT e0000000830d3190
VHPT FAULT e0000000830d33d0
VHPT FAULT e0000000830d3880
VHPT FAULT e0000000830d3fb0
VHPT FAULT e000000083063390
THREAD SWITCH e000000085896040
VHPT FAULT e00000008329b130
IPSR
1010092a6018
1010092a6018
1010092a6018
1010092a6018
1010092a6018
1010092a6018
1010092a6018
1010092a6018
e00000008588c040
1210092a6018
ExtraField
IFA=
6fc00a0200c
IFA= 1ffffe00001de2d0
IFA= 1ffffe01befff338
IFA=
6fc00a0200c
IFA= 1ffffe00001d9188
IFA= 1ffffe01befff250
IFA= e0000165f82dc1c0
IFA= e0000000fffe0018
OSP= e0000165f82dbd40
IFA= e0000165f7edaf30
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
IIP Symbol
nt!MiAgeAndEstimateAvailableInWorkingSet+0x70
nt!MiAgeAndEstimateAvailableInWorkingSet+0x2b0
nt!MiAgeAndEstimateAvailableInWorkingSet+0x2b0
nt!MiAgeAndEstimateAvailableInWorkingSet+0x70
nt!MiAgeAndEstimateAvailableInWorkingSet+0x2b0
nt!MiAgeAndEstimateAvailableInWorkingSet+0x760
nt!MiCheckAndSetSystemTrimCriteria+0x190
nt!KeQuerySystemTime+0x30
nt!IopProcessWorkItem+0x30
9/18/2010
Introduction
VHPT FAULT
PROCESS SWITCH
VHPT FAULT
EXTERNAL INTERRUPT
VHPT FAULT
VHPT FAULT
PROCESS SWITCH
VHPT FAULT
VHPT FAULT
VHPT FAULT
DATA ACCESS BIT
VHPT FAULT
DATA ACCESS BIT
DATA ACCESS BIT
USER SYSCALL
VHPT FAULT
...
e0000165f7eda640
e0000000818bbe10
e00000008307cfc0
e0000000830623b0
e00000008314e310
e000000083580760
e00000008558c990
e00000008307cfc0
77cfbda0
77cfbdb0
77b8e150
77ed5d60
77ed5d60
77b8e1b0
77cafa40
e00000008344dc20
1210092a6018
e000000085896040
1010092a2018
1010092a6018
1010092a2018
1010092a2018
e0000000818bbe10
1010092a2018
1013082a6018
1213082a6018
1213082a6018
1013082a6018
1213082a6018
1013082a6018
10082a6018
1010092a6018
IFA=
OSP=
IFA=
IVR=
IFA=
IFA=
OSP=
IFA=
IFA=
IFA=
IFA=
IFA=
IFA=
IFA=
Num=
IFA=
e0000165fff968a9
e0000165f8281de0
e00000008189fe50
d0
e0000165f88203f0
e0000000f00ff3fd
e00000008189fe20
e0000165f02433f0
77cfbda0
6fbfee0ff98
77c16ab8
6fbfffa6048
77c229c0
77c1c320
42
e000010600703784
netbios!RunTimerForLana+0x60
nt!SwapFromIdle+0x1e0
nt!Kil_TopOfIdleLoop
nt!KdReceivePacket+0x10
hal!READ_PORT_UCHAR+0x80
nt!SwapFromIdle+0x1e0
0x0000000077cfbda0
0x0000000077cfbdb0
0x0000000077b8e150
0x0000000077ed5d60
0x0000000077ed5d60
0x0000000077b8e1b0
0x0000000077cafa40
nt!ExpLookupHandleTableEntry+0x20
!ioresdes
The !ioresdes extension displays the IO_RESOURCE_DESCRIPTOR structure at the specified address.
Syntax
!ioresdes Address
Parameters
Address
Specifies the hexadecimal address of the IO_RESOURCE_DESCRIPTOR structure.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Additional Information
See Plug and Play Debugging for applications of this extension command. For information about the IO_RESOURCE_DESCRIPTOR structure, see the Windows Driver Kit
(WDK) documentation.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!ioreslist
The !ioreslist extension displays an IO_RESOURCE_REQUIREMENTS_LIST structure.
Syntax
!ioreslist Address
Parameters
Address
Specifies the hexadecimal address of the IO_RESOURCE_REQUIREMENTS_LIST structure.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
Here is an example of the output from this extension:
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Resource types
There are four types of resources: I/O, Memory, IRQ, DMA.
Descriptors
Each preferred setting has a "Preferred" descriptor and a number of "Alternative" descriptors.
I/O Ranges
Prefers a range of 0x1000 to 0x10FF inclusive, but can use any 0x100 range between 0 and 0xFFFFFFFF, provided it is 0x100-aligned. (For example, 0x1100 to
0x11FF is acceptable.)
Memory
Prefers a range of 0x40080000 to 0x40080FFF, but can use any range that is of size 0x1000, is 0x1000-aligned, and is located between 0 and 0xFFFFFFFF.
IRQ
Must use IRQ 0xB.
Interrupts and DMA channels are represented as ranges with the same beginning and end.
Additional Information
See Plug and Play Debugging for applications of this extension command. For information about the IO_RESOURCE_REQUIREMENTS_LIST structure, see the Windows
Driver Kit (WDK) documentation.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!iovirp
The !iovirp extension displays detailed information for a specified I/O Verifier IRP.
Syntax
!iovirp [IRP]
Parameters
IRP
Specifies the address of an IRP tracked by the Driver Verifier. If IRP is 0 or is omitted, the summary information for each outstanding IRP is displayed.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
DLL
Windows 2000
Unavailable
Windows XP and later Kdexts.dll
Comments
Here is an example of the output from this extension:
kd> !iovirp 947cef68
IovPacket
84509af0
TrackedIrp
947cef68
HeaderLock
84509d61
LockIrql
0
ReferenceCount 1
PointerCount
1
HeaderFlags
00000000
ChainHead
84509af0
Flags
00200009
DepartureIrql
0
ArrivalIrql
0
StackCount
1
QuotaCharge
00000000
QuotaProcess
0
RealIrpCompletionRoutine
0
RealIrpControl
0
RealIrpContext
0
TopStackLocation
2
PriorityBoost
0
LastLocation
0
RefTrackingCount
0
SystemDestVA
0
VerifierSettings
84509d08
pIovSessionData
84509380
Allocation Stack:
nt!IovAllocateIrp+1a (817df356)
nt!IopXxxControlFile+40c (8162de20)
nt!NtDeviceIoControlFile+2a (81633090)
nt!KiFastCallEntry+164 (81513c64)
nt!EtwpFlushBuffer+10f (817606d7)
nt!EtwpFlushBuffersWithMarker+bd (817608cb)
nt!EtwpFlushActiveBuffers+2b4 (81760bc2)
nt!EtwpLogger+213 (8176036f)
You can stop execution at any point by pressing CTRL+BREAK (in WinDbg) or CTRL+C (in KD).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!ipi
The !ipi extension displays the interprocessor interrupt (IPI) state for a specified processor.
Syntax
!ipi [Processor]
Parameters
Processor
Specifies a processor. If Processor is omitted, the IPI state for every processor is displayed.
DLL
Windows 2000
Unavailable
Windows XP and later Kdexts.dll
This extension command can only be used with an x86-based target computer.
Comments
Here is an example of the output from this extension:
0: kd> !ipi
IPI State for Processor 0
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Worker Routine:
Parameter[0]:
Parameter[1]:
Parameter[2]:
Ipi Trap Frame:
Signal Done:
IPI Frozen:
Request Summary:
Target Set:
Packet Barrier:
nt!KiFlushTargetMultipleTb [Stale]
0
3
F7C98770
F7CCCCDC [.trap F7CCCCDC]
0
24 [FreezeActive] [Owner]
0
0
0
!irp
The !irp extension displays information about an I/O request packet (IRP).
Syntax
!irp Address [Detail]
Parameters
Address
Specifies the hexadecimal address of the IRP.
Detail
If this parameter is included with any value, such as 1, the output includes the status of the IRP, the address of its memory descriptor list (MDL), its owning thread, and
stack information for all of its I/O stacks, and information about each stack location for the IRP, including hexadecimal versions of the major function code and the minor
function code. If this parameter omitted, the output includes only a summary of the information.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
The following information is included to help you interpret the output from this extension command.
The IRP major function codes are as follows:
Major Function Code
Hexadecimal Code
IRP_MJ_CREATE
0x00
IRP_MJ_CREATE_NAMED_PIPE
0x01
IRP_MJ_CLOSE
0x02
IRP_MJ_READ
0x03
IRP_MJ_WRITE
0x04
IRP_MJ_QUERY_INFORMATION
0x05
IRP_MJ_SET_INFORMATION
0x06
IRP_MJ_QUERY_EA
0x07
IRP_MJ_SET_EA
0x08
IRP_MJ_FLUSH_BUFFERS
0x09
IRP_MJ_QUERY_VOLUME_INFORMATION 0x0A
IRP_MJ_SET_VOLUME_INFORMATION
0x0B
IRP_MJ_DIRECTORY_CONTROL
0x0C
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
IRP_MJ_FILE_SYSTEM_CONTROL
IRP_MJ_DEVICE_CONTROL
IRP_MJ_INTERNAL_DEVICE_CONTROL
IRP_MJ_SCSI
IRP_MJ_SHUTDOWN
IRP_MJ_LOCK_CONTROL
IRP_MJ_CLEANUP
IRP_MJ_CREATE_MAILSLOT
IRP_MJ_QUERY_SECURITY
IRP_MJ_SET_SECURITY
IRP_MJ_POWER
IRP_MJ_SYSTEM_CONTROL
IRP_MJ_DEVICE_CHANGE
IRP_MJ_QUERY_QUOTA
IRP_MJ_SET_QUOTA
IRP_MJ_PNP
IRP_MJ_MAXIMUM_FUNCTION
0x0D
0x0E
0x0F
0x10
0x11
0x12
0x13
0x14
0x15
0x16
0x17
0x18
0x19
0x1A
0x1B
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
IRP_MN_SCSI_CLASS 0x01
The output also indicates under what conditions the completion routine for each stack location will be called once the IRP has completed and the stack location is processed.
There are three possibilities:
Success
Indicates that the completion routine will be called when the IRP is completed with a success code.
Error
Indicates that the completion routine will be called when the IRP is completed with an error code.
Cancel
Indicates that the completion routine will be called if an attempt was made to cancel the IRP.
Any combination of these three may appear, and if any of the conditions shown are satisfied, the completion routine will be called. The appropriate values are listed at the end
of the first row of information about each stack location, immediately after the Completion-Context entry.
Here is an example of the output from this extension from Windows XP:
!irp 81183468
Irp is active with 2 stacks 2 is current (= 0x811834fc)
No Mdl Thread 00000000: Irp stack trace.
Cmd flg cl Device
File
Completion-Context
[ 0, 0]
0 0 8145f470 00000000 00000000-00000000
\Driver\E100B
Args: 00000000 00000000 00000000 00000000
[ 16, 2]
0 e1 8145f470 00000000 8047f744-814187a8 Success Error Cancel pending
\Driver\E100B
ntoskrnl!PopCompleteSystemPowerIrp
Args: 00000000 00000000 00000002 00000002
In the second stack location entry of the Windows XP example, the major function code is 16, indicating that this IRP has been sent to the power stack. The minor function
code is 2, so the power stack recognizes it as a set request. The IRP is pending, and when it completes, ntoskrnl!PopCompleteSystemPowerIrp will be called regardless of
the return code as both Success and Error are specified.
Here is an example of the output from this extension from Windows Vista.
0: kd> !irp 0x831f4a00
Irp is active with 8 stacks 5 is current (= 0x831f4b00)
Mdl = 82b020d8 Thread 8c622118: Irp stack trace.
cmd flg cl Device
File
Completion-Context
[ 0, 0]
0 0 00000000 00000000 00000000-00000000
0, 0]
0, 0]
0, 0]
>[
3,34]
3, 0]
3, 0]
3, 0]
Note that the completion routine next to the driver name is set on that stack location, and it was set by the driver in the line below. In the preceding example, Ntfs!
NtfsMasterIrpSyncCompletionRoutine was set by \FileSystem\Ntfs. The Completion-Context entry above Ntfs!NtfsMasterIrpSyncCompletionRoutine, 847eeed0829e2ba8, indicates the address of the completion routine, as well as the context that will be passed to Ntfs!NtfsMasterIrpSyncCompletionRoutine. From this we can see
that the address of Ntfs!NtfsMasterIrpSyncCompletionRoutine is 847eeed0, and the context that will be passed to this routine when it is called is 829e2ba8.
Additional Information
See Plug and Play Debugging and Debugging Interrupt Storms for applications of this extension command. For information about IRPs, see the Windows Driver Kit (WDK)
documentation and Microsoft Windows Internals by Mark Russinovich and David Solomon. For further information on the major and minor function codes, see the Windows
Driver Kit (WDK) documentation.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!irpfind
The !irpfind extension displays information about all I/O request packets (IRP) currently allocated in the target system, or about those IRPs matching the specified search
criteria.
Syntax
Syntax in Windows 2000
!irpfind [PoolType [RestartAddress [Criteria Data]]]
Syntax in Windows XP and later
!irpfind [-v] [PoolType [RestartAddress [Criteria Data]]]
Parameters
-v
(Windows XP and later) Displays verbose information.
PoolType
Specifies the type of pool to be searched. The following values are permitted:
0
Specifies nonpaged memory pool. This is the default.
1
Specifies paged memory pool.
2
Specifies the special pool.
4
(Windows XP and later) Specifies the session pool.
RestartAddress
Specifies the hexadecimal address at which to begin the search. This is useful if the previous search was terminated prematurely. The default is zero.
Criteria
Specifies the criteria for the search. Only those IRPs that satisfy the given match will be displayed.
Criteria
Match
arg
Finds all IRPs with a stack location where one of the arguments equals Data.
device
Finds all IRPs with a stack location where DeviceObject equals Data.
fileobject Finds all IRPs whose Irp.Tail.Overlay.OriginalFileObject equals Data.
mdlprocess Finds all IRPs whose Irp.MdlAddress.Process equals Data.
thread
Finds all IRPs whose Irp.Tail.Overlay.Thread equals Data.
userevent Finds all IRPs whose Irp.UserEvent equals Data.
Data
Specifies the data to be matched in the search.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
This example finds the IRP in the nonpaged pool that is going to set user event FF9E4F48 upon completion:
kd> !irpfind 0 0 userevent ff9e4f48
The following example produces a full listing of all IRPs in the nonpaged pool:
kd> !irpfind
Searching NonPaged pool (8090c000 : 8131e000) for Tag: Irp
8097c008 Thread 8094d900 current stack belongs to \Driver\symc810
8097dec8 Thread 8094dda0 current stack belongs to \FileSystem\Ntfs
809861a8 Thread 8094dda0 current stack belongs to \Driver\symc810
809864e8 Thread 80951ba0 current stack belongs to \Driver\Mouclass
80986608 Thread 80951ba0 current stack belongs to \Driver\Kbdclass
80986728 Thread 8094dda0 current stack belongs to \Driver\symc810
Additional Information
See Plug and Play Debugging for applications of this extension command. For information about IRPs, see the Windows Driver Kit (WDK) documentation and Microsoft
Windows Internals by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!irpzone
The !irpzone extension command is obsolete. Use !irpfind instead.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!irql
The !irql extension displays the interrupt request level (IRQL) of a processor on the target computer before the debugger break.
Syntax
!irql [Processor]
Parameters
Processor
Specifies the a processor. Enter the processor number. If this parameter is omitted, the debugger displays the IRQL of the current processor.
DLL
The !irql extension is only available in Windows Server 2003 and later versions of Windows.
Windows 2000
Unavailable
Windows XP
Unavailable
Windows Server 2003 and later Kdexts.dll
Comments
When the target computer breaks into the debugger, the IRQL changes, but the IRQL that was effective just before the debugger break is saved. The !irql extension displays
the saved IRQL.
Similarly, when a bug check occurs and a crash dump file is created, the IRQL saved in the crash dump file is the one immediately prior to the bug check, not the IRQL at
which the KeBugCheckEx routine was executed.
In both cases, the current IRQL is raised to DISPATCH_LEVEL, except on x86 architectures. Thus, if more than one such event occurs, the IRQL displayed will also be
DISPATCH_LEVEL, making it useless for debugging purposes.
The !pcr extension displays the current IRQL on all versions of Windows, but the current IRQL is usually not useful. The IRQL that existed just before the bug check or
debugger connection is more interesting, and this is displayed only with !irql.
If you supply an invalid processor number, or there has been kernel corruption, the debugger displays a message "Cannot get PRCB address".
Here is an example of the output from this extension from a dual-processor x86 computer:
kd> !irql 0
Debugger saved IRQL for processor 0x0 -- 28 (CLOCK2_LEVEL)
kd> !irql 1
Debugger saved IRQL for processor 0x1 -- 0 (LOW_LEVEL)
If the debugger is in verbose mode, a description of the IRQL itself is included. Here is an example from an Itanium processor:
kd> !irql
Debugger saved IRQL for processor 0x0 -- 12 (PC_LEVEL) [Performance counter level]
The meaning of the IRQL number often depends on the processor. Here is an example from an x64 processor. Note that the IRQL number is the same as in the previous
example, but the IRQL meaning is different:
kd> !irql
Debugger saved IRQL for processor 0x0 -- 12 (SYNCH_LEVEL) [Synchronization level]
Additional Information
For information about IRQLs, see the Windows Driver Kit (WDK) documentation and Microsoft Windows Internals by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!isainfo
The !isainfo extension displays information about PNPISA cards or devices present in the system..
Syntax
!isainfo [Card]
Parameters
Card
Specifies a PNPISA Card. If Card is 0 or omitted, all the devices and cards on the PNPISA (that is, the PC I/O) Bus are displayed.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
Here is an example of the output from this extension:
0: kd> !isainfo
ISA PnP FDO @ 0x867b9938, DevExt @ 0x867b99f0, Bus # 0
Flags (0x80000000) DF_BUS
ISA PnP PDO @ 0x867B9818, DevExt @ 0x86595388
Flags (0x40000818) DF_ENUMERATED, DF_ACTIVATED,
DF_REQ_TRIMMED, DF_READ_DATA_PORT
!isr
The !isr extension displays the Itanium Interruption Status Register (ISR) at the specified address.
Syntax
!isr Expression [DisplayLevel]
Parameters
Expression
Specifies the hexadecimal address of the ISR register to display. The expression @isr can also be used for this parameter. In that case, information about the current
processor ISR register is displayed.
DisplayLevel
Can be any one of the following options:
0
Displays only the values of each ISR field. This is the default.
1
Displays detailed information about ISR fields that are not reserved or ignored.
2
Displays details about all ISR fields, including those that are ignored or reserved.
DLL
Windows 2000
Unavailable
Windows XP and later Kdexts.dll
This extension command can only be used with an Itanium target computer.
Comments
Here are a couple of examples of output from this extension:
kd> !isr @isr
isr:ed ei so ni ir rs sp na r w x vector code
0 0 0 0 0 0 0 0 0 0 0
0
0
kd> !isr @isr 2
cod : 0 : interruption Code
vec : 0 : IA32 exception vector number
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
rv
x
w
r
na
sp
rs
ir
ni
so
ei
ed
rv
:
:
:
:
:
:
:
:
:
:
:
:
:
0
0
0
0
0
0
0
0
0
0
0
0
0
:
:
:
:
:
:
:
:
:
:
:
:
:
reserved0
eXecute exception
Write exception
Read exception
Non-Access exception
Speculative load exception
Register Stack
Invalid Register frame
Nested Interruption
IA32 Supervisor Override
Exception IA64 Instruction
Exception Deferral
reserved1
!ivt
The !ivt extension displays the Itanium interrupt vector table.
Syntax
!ivt [-v] [-a] [Vector]
!ivt -?
Parameters
Vector
Specifies an interrupt vector table entry for the current processor. If Vector is omitted, the entire interrupt vector table for the current processor on the target computer is
displayed. Interrupt vectors that have not been assigned are not displayed unless the a option is specified.
-a
Displays all interrupt vectors, including those that are unassigned.
-v
Displays detailed output.
-?
Displays help for this extension in the Debugger Command window.
DLL
Windows 2000
Unavailable
Windows XP and later Kdexts.dll
This extension command can only be used with an Itanium target computer.
Comments
Here is an example of the output from this extension:
kd> !ivt
Dumping IA64 IVT:
00:e000000083005f60
0f:e000000083576830
10:e0000000830067f0
20:e000000083006790
30:e000000083576b30
31:e000000083576b20
41:e000000085039680
51:e000000085039910
61:e0000000854484f0
71:e0000000856c9450
81:e0000000857fd000
91:e0000000857ff510
a1:e0000000857d84b0
a2:e0000165fff2cab0
b1:e0000000858c7460
b2:e0000000850382e0
d0:e0000000835768d0
e0:e000000083576850
f0:e0000000835769c0
f1:e000000083576830
fd:e000000083576b10
fe:e000000083576830
nt!KiPassiveRelease
hal!HalpPCIISALine2Pin
nt!KiApcInterrupt
nt!KiDispatchInterrupt
hal!HalpCMCIHandler
hal!HalpCPEIHandler
i8042prt!I8042KeyboardInterruptService (KINTERRUPT e000000085039620)
i8042prt!I8042MouseInterruptService (KINTERRUPT e0000000850398b0)
VIDEOPRT!pVideoPortInterrupt (KINTERRUPT e000000085448490)
NDIS!ndisMIsr (KINTERRUPT e0000000856c93f0)
SCSIPORT!ScsiPortInterrupt (KINTERRUPT e0000000857fcfa0)
atapi!IdePortInterrupt (KINTERRUPT e0000000857ff4b0)
atapi!IdePortInterrupt (KINTERRUPT e0000000857d8450)
portcls!CInterruptSyncServiceRoutine (KINTERRUPT e0000165fff2ca50)
ACPI!ACPIInterruptServiceRoutine (KINTERRUPT e0000000858c7400)
USBPORT!USBPORT_InterruptService (KINTERRUPT e000000085038280)
hal!HalpClockInterrupt
hal!HalpIpiInterruptHandler
hal!HalpProfileInterrupt
hal!HalpPCIISALine2Pin
hal!HalpMcRzHandler
hal!HalpPCIISALine2Pin
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Additional Information
For more information about how to display the interrupt dispatch tables on an x64 or x86 target computer, see !idt.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!job
The !job extension displays a job object.
Syntax
!job [Process [Flags]]
Parameters
Process
Specifies the hexadecimal address of a process or a thread whose associated job object is to be examined. If this is omitted, or equal to -1 (in Windows 2000), or equal to
zero (in Windows XP and later), the job associated with the current process is displayed.
Flags
Specifies what the display should contain. This can be a sum of any of the following bit values. The default is 0x1:
Bit 0 (0x1)
Causes the display to include job settings and statistics.
Bit 1 (0x2)
Causes the display to include a list of all processes in the job.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
Here is an example of the output from this extension:
kd> !process 52c
Searching for Process with Cid == 52c
PROCESS 8276c550 SessionId: 0 Cid: 052c
Peb: 7ffdf000 ParentCid: 0060
DirBase: 01289000 ObjectTable: 825f0368 TableSize: 24.
Image: cmd.exe
VadRoot 825609e8 Vads 30 Clone 0 Private 77. Modified 0. Locked 0.
DeviceMap e1733f38
Token
e1681610
ElapsedTime
0:00:12.0949
UserTime
0:00:00.0359
.....
CommitCharge
109
Job
8256e1f0
kd> !job 8256e1f0
Job at ffffffff8256e1f0
TotalPageFaultCount
TotalProcesses
ActiveProcesses
TotalTerminatedProcesses
LimitFlags
MinimumWorkingSetSize
MaximumWorkingSetSize
ActiveProcessLimit
PriorityClass
UIRestrictionsClass
SecurityLimitFlags
Token
0
1
1
0
0
0
0
0
0
0
0
00000000
Additional Information
For information about job objects, see Microsoft Windows Internals, by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!kb, !kv
The !kb and !kv extension commands are obsolete. Use the kb (Display Stack Backtrace) and kv (Display Stack Backtrace) commands instead.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!loadermemorylist
The !loadermemorylist extension displays the memory allocation list that the Windows boot loader passes to Windows.
Syntax
!loadermemorylist ListHeadAddress
Parameters
ListHeadAddress
Specifies the address of a list header.
DLL
Windows 2000
Kdexts.dll
Windows XP
Kdexts.dll
Windows Server 2003
Windows Vista and later Kdexts.dll
Comments
This extension is designed to be used at the beginning of the system boot process while Ntldr is running. It displays a memory allocation list that includes the start, end, and
type of each page range.
You can stop execution at any point by pressing CTRL+BREAK (in WinDbg) or CTRL+C (in KD).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!lockedpages
The !lockedpages extension displays driver-locked pages for the current process in Windows 2000 and for a specified process in Windows XP and later.
Syntax
Syntax in Windows 2000
!lockedpages
Syntax in Windows XP and later
!lockedpages [Process]
Parameters
Process
(Windows XP and later only) Specifies a process. If Process is omitted, the current process is used.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
You can stop execution at any point by pressing CTRL+BREAK (in WinDbg) or CTRL+C (in KD).
2009 Microsoft Corporation
Send feedback on this topic
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!locks (!kdext*.locks)
The !locks extension in Kdextx86.dll and Kdexts.dll displays information about kernel ERESOURCE locks.
This extension command should not be confused with the !ntsdexts.locks extension command.
Syntax
!locks [Options] [Address]
Parameters
Options
Specifies the amount of information to be displayed. Any combination of the following options can be used:
-v
Displays detailed information about each lock.
-p
Display all available information about the locks, including performance statistics.
-d
Display information about all locks. Otherwise, only locks with contention are displayed.)
Address
Specifies the hexadecimal address of the ERESOURCE lock to be displayed. If Address is 0 or omitted, information about all ERESOURCE locks in the system will be
displayed.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
The !locks extension displays all locks held on resources by threads. A lock can be shared or exclusive, which means no other threads can gain access to that resource. This
information is useful when a deadlock occurs on a system. A deadlock is caused by one non-executing thread holding an exclusive lock on a resource that the executing thread
needs.
You can usually pinpoint a deadlock in Microsoft Windows 2000 by finding one non-executing thread that holds an exclusive lock on a resource that is required by an
executing thread. Most of the locks are shared.
Here is an example of the basic !locks output:
kd> !locks
**** DUMP OF ALL RESOURCE OBJECTS ****
KD: Scanning for held locks......
Resource @ 0x80e97620
Shared 4 owning threads
Threads: ff688da0-01<*> ff687da0-01<*> ff686da0-01<*> ff685da0-01<*>
KD: Scanning for held locks.......................................................
Resource @ 0x80e23f38
Shared 1 owning threads
Threads: 80ed0023-01<*> *** Actual Thread 80ed0020
KD: Scanning for held locks.
Resource @ 0x80d8b0b0
Shared 1 owning threads
Threads: 80ed0023-01<*> *** Actual Thread 80ed0020
2263 total locks, 3 locks currently held
Note that the address for each thread displayed is followed by its thread count (for example, "-01"). If a thread is followed by "<*>", that thread is one of the owners of the
lock. In some instances, the initial thread address contains an offset. In that case, the actual thread address is displayed as well.
If you want to find more information about one of these resource objects, use the address that follows "Resource @" as an argument for future commands. To investigate the
second resource shown in the preceding example, you could use dt ERESOURCE 80d8b0b0 or !thread 80ed0020. Or you could use the !locks extension again with the -v
option:
kd> !locks -v 80d8b0b0
Resource @ 0x80d8b0b0
Shared 1 owning threads
Threads: 80ed0023-01<*> *** Actual Thread 80ed0020
THREAD 80ed0020 Cid 4.2c
8055e100 Unknown
Not impersonating
GetUlongFromAddress: unable to
Owning Process 80ed5238
WaitTime (ticks)
Context Switch Count
UserTime
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
KernelTime
0:00:02.0143
Start Address nt!ExpWorkerThread (0x80506aa2)
Stack Init fafa4000 Current fafa3d18 Base fafa4000 Limit fafa1000 Call 0
Priority 13 BasePriority 13 PriorityDecrement 0
ChildEBP RetAddr
fafa3d30 804fe997 nt!KiSwapContext+0x25 (FPO: [EBP 0xfafa3d48] [0,0,4]) [D:\NT\base\ntos\ke\i386\ctxswap.asm @ 139]
fafa3d48 80506a17 nt!KiSwapThread+0x85 (FPO: [Non-Fpo]) (CONV: fastcall) [d:\nt\base\ntos\ke\thredsup.c @ 1960]
fafa3d78 80506b36 nt!KeRemoveQueue+0x24c (FPO: [Non-Fpo]) (CONV: stdcall) [d:\nt\base\ntos\ke\queueobj.c @ 542]
fafa3dac 805ad8bb nt!ExpWorkerThread+0xc6 (FPO: [Non-Fpo]) (CONV: stdcall) [d:\nt\base\ntos\ex\worker.c @ 1130]
fafa3ddc 8050ec72 nt!PspSystemThreadStartup+0x2e (FPO: [Non-Fpo]) (CONV: stdcall) [d:\nt\base\ntos\ps\create.c @ 2164]
00000000 00000000 nt!KiThreadStartup+0x16 [D:\NT\base\ntos\ke\i386\threadbg.asm @ 81]
1 total locks, 1 locks currently held
!logonsession
The !logonsession extension displays information about a specified logon session.
Syntax
Free Build Syntax
!logonsession LUID
Checked Build Syntax
!logonsession LUID [InfoLevel]
Parameters
LUID
Specifies the locally unique identifier (LUID) of a logon session to display. If LUID is 0, information about all logon sessions is displayed.
To display information about the system session and all system tokens in a checked build, enter !logonsession 3e7 1.
InfoLevel
(Checked Build Only) Specifies how much token information is displayed. The InfoLevel parameter can take values from 0 to 4, with 0 representing the least information
and 4 representing the most information.
DLL
Windows 2000
Unavailable
Windows XP and later Kdexts.dll
Comments
Here is an example of the output from this extension on a free build:
kd> !logonsession 0
Dumping all logon sessions.
** Session
0
LogonId
References
** Session
1
LogonId
References
** Session
2
LogonId
References
** Session
3
LogonId
References
** Session
4
LogonId
References
** Session
5
LogonId
References
** Session
6
LogonId
References
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
0x0
{0x0 0x0}
0
0x8ebb50
{0xe9f1 0x0}
21
0x6e31e0
{0x94d1 0x0}
1
0x8ecd60
{0x6b31 0x0}
0
0xe0000106
{0x0 0x0}
0
0x0
{0x0 0x0}
0
0x8e9720
{0x3e4 0x0}
6
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
** Session
7
LogonId
References
** Session
8
LogonId
References
** Session
9
LogonId
References
** Session 10
LogonId
References
** Session 11
LogonId
References
** Session 12
LogonId
References
** Session 13
LogonId
References
14 sessions in
= 0xe0000106
= {0x0 0x0}
= 0
= 0xa2e160
= {0x3e5 0x0}
= 3
= 0xe0000106
= {0x0 0x0}
= 0
= 0x3ca0
= {0x3e6 0x0}
= 2
= 0xe0000106
= {0x0 0x0}
= 0
= 0x1cd0
= {0x3e7 0x0}
= 33
= 0xe0000106
= {0x0 0x0}
= 0
the system.
You can stop execution at any point by pressing CTRL+BREAK (in WinDbg) or CTRL+C (in KD).
Additional Information
For information about logon sessions, see the Microsoft Windows SDK documentation and Microsoft Windows Internals by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!lookaside
The !lookaside extension displays information about look-aside lists, resets the counters of look-aside lists, or modifies the depth of a look-aside list.
Syntax
!lookaside [Address [Options [Depth]]]
Parameters
Address
Specifies the hexadecimal address of a look-aside list to be displayed or modified. If Address is 0 or omitted, a set of well-known, standard system look-aside lists is
displayed or modified. The set of lists is not exhaustive; that is, it does not include all system look-aside lists. Also, the set does not include custom look-aside lists that
were created by calls to ExInitializePagedLookasideList or ExInitializeNPagedLookasideList.
Options
Controls what operation will be taken. The following possible Options are supported. The default is zero:
0
Displays information about the specified look-aside list or lists.
1
Resets the counters of the specified look-aside list.
2
Modifies the depth of the specified look-aside list. This option can only be used if Address is nonzero.
Depth
Specifies the new maximum depth of the specified look-aside list. This parameter is permitted only if Address is nonzero and Options is equal to 2.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
Look-aside lists are multiprocessor-safe mechanisms for managing pools of fixed-size entries from either paged or nonpaged memory.
Look-aside lists are efficient, because the routines do not use spin locks on most platforms.
Note that if the current depth of a look-aside list exceeds the maximum depth of that list, then freeing a structure associated with that list will result in freeing it into pool
memory, rather than list memory.
Here is an example of the output from this extension:
kd> !lookaside e0000165f7621800
Lookaside "" @ e0000165f7621800 "Ntfs"
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Type
=
Current Depth
Size
AllocateMisses
TotalAllocates
Hit Rate
Additional Information
For information about look-aside lists, see the Windows Driver Kit (WDK) documentation and Microsoft Windows Internals, by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!lpc
The !lpc extension displays information about all local procedure call (LPC) ports and messages in the target system.
Syntax
Syntax in Windows 2000
!lpc
!lpc
!lpc
!lpc
!lpc
message MessageID
port Port
scan Port
thread Thread
message MessageID
port Port
scan Port
thread Thread
PoolSearch
Parameters
message
(Windows Server 2003, Windows XP, and Windows 2000 only) Displays information about a message, such as the server port that contains the message in the queue, and
the thread waiting for this message, if any.
MessageID
(Windows Server 2003, Windows XP, and Windows 2000 only) Specifies the message ID of the message to be displayed. If the value of this parameter is 0 or this
parameter is omitted, the !lpc message command displays a summary list of messages. (In Windows 2000 with Service Pack 1 (SP1), the summary includes all messages
in the LPC zone. In Windows 2000 with Service Pack 2 (SP2), Windows XP, and later versions of Windows, the summary includes all messages in the kernel pool.
Paged-out messages are not included.)
port
(Windows Server 2003, Windows XP, and Windows 2000 only) Displays port information, such as the name of the port, its semaphore state, messages in its queues,
threads in its rundown queue, its handle count, its references, and related ports.
scan
(Windows Server 2003, Windows XP, and Windows 2000 only) Displays summary information about the specified port and about all ports that are connected to it.
Port
(Windows Server 2003, Windows XP, and Windows 2000 only) Specifies the hexadecimal address of the port to be displayed. If the !lpc port command is used, and Port
is 0 or is omitted, a summary list of all LPC ports is displayed. If the !lpc scan command is used, Port must specify the address of an actual port.
thread
(Windows Server 2003, Windows XP, and Windows 2000 only) Displays port information for all ports that contain the specified thread in their rundown port queues.
Thread
(Windows Server 2003, Windows XP, and Windows 2000 only) Specifies the hexadecimal address of the thread. If this is 0 or omitted, the !lpc thread command displays
a summary list of all threads that are performing any LPC operations.
PoolSearch
(Windows Server 2003 and Windows XP only) Determines whether the !lpc message command searches for messages in the kernel pool. Each time !lpc PoolSearch is
used, this setting toggles on or off (the initial setting is to not search the kernel pool). This only affects !lpc message commands that specify a nonzero value for
MessageID.
DLL
Windows 2000
Kdextx86.dll
Windows XP
Kdexts.dll
Windows Server 2003
Comments
This extension is not supported in Windows Vista and later versions of Windows.
In Windows Server 2003, Windows XP, and Windows 2000, using !lpc with no arguments displays help for this extension in the Debugger Command window.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
If you have a thread that is marked as waiting for a reply to a message, use the !lpc message command with the ID of the delayed message. This command displays the
specified message, the port that contains it, and all related threads.
If the message is not found and there were no read errors (such as "Unable to access zone segment"), the server received the message.
In this case, the server port can usually be found by using the !lpc thread command. Threads that are waiting for replies are linked into a server communication queue. This
command will display all ports that contain the specified thread. After you know the port address, use the !lpc port command. More specific information about each thread
can then be obtained by using the !lpc thread command with the address of each thread.
Here are several examples of the output from this extension from a Windows XP system:
In this example, all port LPC ports are displayed.
kd> !lpc port
Scanning 225 objects
1 Port: 0xe1405650
1 Port: 0xe141ef50
1 Port: 0xe13c5740
1 Port: 0xe13d9550
3 Port: 0xe13d8830
80000004 Port: 0xe13d8910
3 Port: 0xe13d8750
.....
Connection:
Connection:
Connection:
Connection:
Connection:
Connection:
Connection:
0xe1405650
0xe141ef50
0xe13c5740
0xe13d9550
0xe141ef50
0xe141ef50
0xe13d9550
Communication:
Communication:
Communication:
Communication:
Communication:
Communication:
Communication:
0x00000000
0x00000000
0x00000000
0x00000000
0xe13d8910
0xe13d8830
0xe13a4030
'SeRmCommandPort'
'SmApiPort'
'ApiPort'
'SbApiPort'
''
''
''
In the previous example, the port at address e14ae238 has no messages; that is, all messages have been picked up and no new messages have arrived.
kd> !lpc port e14ae238
Server connection port e14ae238 Name: ApiPort
Handles: 1
References: 107
Server process : 84aa0140 (csrss.exe)
Queue semaphore : 84a96da8
Semaphore state 0 (0x0)
The message queue is empty
The LpcDataInfoChainHead queue is empty
In the previous example, the port at 0xe14ae238 has messages which have been queued, but not yet picked up by the server.
kd> !lpc port 0xe14ae238
Server connection port e14ae238 Name: ApiPort
Handles: 1
References: 108
Server process : 84aa0140 (csrss.exe)
Queue semaphore : 84a96da8
Semaphore state 0 (0x0)
Messages in queue:
0000 e20d9b80 - Busy Id=0002249c From: 0584.0680 Context=00000021 [e14ae248 . e14ae248]
Length=0098007c Type=00000001 (LPC_REQUEST)
Data: 00000000 0002021e 00000584 00000680 002f0001 00000007
The message queue contains 1 messages
The LpcDataInfoChainHead queue is empty
The remaining Windows XP examples concern the other options that can be used with this extension.
kd> !lpc message 222be
Searching message 222be in threads ...
Client thread 842a4db0 waiting a reply from 222be
Searching thread 842a4db0 in port rundown queues ...
Server communication port 0xe114a3c0
Handles: 1
References: 1
The LpcDataInfoChainHead queue is empty
Connected port: 0xe1e7b948
Server connection port: 0xe14ae238
Client communication port 0xe1e7b948
Handles: 1
References: 3
The LpcDataInfoChainHead queue is empty
Server connection port e14ae238 Name: ApiPort
Handles: 1
References: 107
Server process : 84aa0140 (csrss.exe)
Queue semaphore : 84a96da8
Semaphore state 0 (0x0)
The message queue is empty
The LpcDataInfoChainHead queue is empty
Done.
kd> !lpc thread 842a4db0
Searching thread 842a4db0 in port rundown queues ...
Server communication port 0xe114a3c0
Handles: 1
References: 1
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Communication: 0xe13d8910
Communication: 0xe13d8830
''
''
Additional Information
For information about LPCs, see the Windows Driver Kit (WDK) documentation and Microsoft Windows Internals by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!mca
On an x86 target computer, the !mca extension displays the machine check architecture (MCA) registers. On an Itanium target computer, the !mca extension displays the
MCA error record.
Syntax
Syntax for x86 target computer
!mca
Syntax for Itanium target computer
!mca Address [Flags]
Parameters
Address
(Itanium target only) Specifies the address of the MCA error record.
Flags
(Itanium target only) Specifies the level of output. Flags can be any combination of the following bits. The default value is 0xFF, which displays all sections present in
the log.
Bit 0 (0x1)
Displays the processor section.
Bit 1 (0x2)
Displays the platform-specific section.
Bit 2 (0x4)
Displays the memory section.
Bit 3 (0x8)
Displays the PCI component section.
Bit 4 (0x10)
Displays the PCI bus section.
Bit 5 (0x20)
Displays the SystemEvent Log section.
Bit 6 (0x40)
Displays the platform host controller section.
Bit 7 (0x80)
Displays to include the platform bus section.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
This extension command can only be used with an x86-based or Itanium target computer.
Comments
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
On an Itanium target, !mca displays the MCA error record from the system abstraction layer (SAL). Here is an example of the output from this extension:
kd> !mca e0000165f3f58000
hal!HalpFeatureBits: 0xf [HAL_PERF_EVENTS|HAL_MCA_PRESENT|HAL_CMC_PRESENT|HAL_CPE_PRESENT]
MCA Error Record Header @ 0xe0000165f3f58000 0xe0000165f3f597a8
Id
: 8
Revision
:
Revision
: 2
Minor
: 0x2 ''
Major
: 0 ''
ErrorSeverity
: 0 ''
Valid
:
Valid
: 0 ''
OemPlatformID
: 0y0
Reserved
: 0y0000000 (0)
Length
: 0x17a8
TimeStamp
:
TimeStamp
: 0x20031106`00134944
Seconds
: 0x44 'D'
Minutes
: 0x49 'I'
Hours
: 0x13 ''
Reserved
: 0 ''
Day
: 0x6 ''
Month
: 0x11 ''
Year
: 0x3 ''
Century
: 0x20 ' '
OemPlatformId
: [16] ""
Severity
: ErrorRecoverable
@ 0xe0000165f3f58028 0xe0000165f3f59578
:
:
:
:
[Processor]
0xe429faf1
0x3cb7
0x11d4
[8] "???"
: 2
: 0x2 ''
: 0 ''
:
:
:
:
:
:
0 ''
0y0
0y0
0y0
0y0000
0y0
0 ''
0x1550
0x100101f
0y1
0y1
0y1
0y1
0y0001
0y0000
0y0001
0y0000
0y0000
0y1
0y000000000000000000000000000000000000000 (0)
0x1002000
0y0000
0y0000
0y0000
0y0010
0y0000
0y0000
0y0001
0y0000
0y0000000000000000 (0)
0y0000000000000000 (0)
0x28000000`fff21130
0y00
0y0
0y0
0y1
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
mn
sy
co
ci
us
hd
tl
mi
pi
pm
dy
in
rs
cm
ex
cr
pc
dr
tr
rr
ar
br
pr
fp
b1
b0
gr
dsize
reserved1
cc
tc
bc
rc
uc
CRLid
LocalId
reserved
eid
id
ignored
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
0y1
0y0
0y0
0y1
0y0
0y0
0y0
0y1
0y0
0y0
0y0
0y0
0y1
0y0
0y0
0y1
0y1
0y1
0y1
0y1
0y1
0y1
0y1
0y1
0y1
0y1
0y1
0y0000000000000000 (0)
0y00000000000 (0)
0y1
0y0
0y1
0y0
0y0
:
:
:
:
:
0
0y0000000000000000 (0)
0y00000000 (0)
0y00000000 (0)
0y00000000000000000000000000000000 (0)
CacheErrorInfo[0]:
Valid
: 1
CheckInfo
: 0y1
RequestorIdentifier : 0y0
ResponderIdentifier : 0y0
TargetIdentifier : 0y0
PreciseIP
: 0y0
Reserved
: 0y00000000000000000000000000000000000000000000000000000000000 (0)
CheckInfo
: 0x0
RequestorId
: 0x0
ResponderId
: 0x0
TargetIp
: 0x0
TargetId
: 0x0
PreciseIp
: 0x0
CheckInfo:
CacheCheck
: 0
Operation
: 0y0000
Level
: 0y00
Reserved1
: 0y00
DataLine
: 0y0
TagLine
: 0y0
DataCache
: 0y0
InstructionCache : 0y0
MESI
: 0y000
MESIValid
: 0y0
Way
: 0y00000 (0)
WayIndexValid
: 0y0
Reserved2
: 0y0000000000 (0)
Index
: 0y00000000000000000000 (0)
Reserved3
: 0y00
InstructionSet
: 0y0
InstructionSetValid : 0y0
PrivilegeLevel
: 0y00
PrivilegeLevelValid : 0y0
MachineCheckCorrected : 0y0
TargetAddressValid : 0y0
RequestIdValid
: 0y0
ResponderIdValid : 0y0
PreciseIPValid
: 0y0
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
BusErrorInfo[0]:
Valid
: 9
CheckInfo
: 0y1
RequestorIdentifier : 0y0
ResponderIdentifier : 0y0
TargetIdentifier : 0y1
PreciseIP
: 0y0
Reserved
: 0y00000000000000000000000000000000000000000000000000000000000 (0)
CheckInfo
: 0x1080000003000144
RequestorId
: 0x0
ResponderId
: 0x0
TargetIp
: 0x0
TargetId
: 0xd0022004
PreciseIp
: 0x0
CheckInfo:
BusCheck
: 0x10800000`03000144
Size
: 0y00100 (0x4)
Internal
: 0y0
External
: 0y1
CacheTransfer
: 0y0
Type
: 0y00000001 (0x1)
Severity
: 0y00000 (0)
Hierarchy
: 0y00
Reserved1
: 0y0
Status
: 0y00000011 (0x3)
Reserved2
: 0y0000000000000000000000 (0)
InstructionSet
: 0y0
InstructionSetValid : 0y1
PrivilegeLevel
: 0y00
PrivilegeLevelValid : 0y0
MachineCheckCorrected : 0y0
TargetAddressValid : 0y1
RequestIdValid
: 0y0
ResponderIdValid : 0y0
PreciseIPValid
: 0y0
StaticInfo @ 0xe0000165f3f580f0 0xe0000165f3f59578
Valid @ 0xe0000165f3f580f0
Valid
MinState
BR
CR
AR
RR
FR
Reserved
:
:
:
:
:
:
:
:
0x3f
0y1
0y1
0y1
0y1
0y1
0y1
0y0000000000000000000000000000000000000000000000000000000000 (0)
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
0
0xe0000165`f1a99b00
0
0xe0f0e0f0`e0f0e000
0
1
0xe0000000`83068300
0xe0000000`832f8780
0x4600
0x230
0x3ff
0xe0000165`f38c6000
0xe0000165`f0f97da0
0
0
0xfffff630
0x1010`082a6018
0
0xe0000000`830067c0
0x101
0x80000000`00000308
0
0xe0000000`84bedd20
0xe0000000`84bedd20
0xe0000165`f213df5a
0xfff80000`597c84f0
0x6081
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
B0R27
B0R28
B0R29
B0R30
B0R31
IntT7
IntT8
IntT9
IntT10
IntT11
IntT12
IntT13
IntT14
IntT15
IntT16
IntT17
IntT18
IntT19
IntT20
IntT21
IntT22
Preds
BrRp
RsRSC
StIIP
StIPSR
StIFS
XIP
XPSR
XFS
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
0xfffffe00`00165f20
0x8000465
0x8000465
0x60
0xa04`00000000
0x44
0x200
0xe0000165`f38c6000
0xe0000165`f3cb81bc
0xe0000165`f3cb81b8
0xe0000000`8363f7b0
0xe0000165`f1899d08
0x9804c`8a70433f
0xe0000000`832821f8
0xe0000000`836536e0
0xe0000000`8363f7b8
0xffffffff`fffffbc3
0xe0000165`f1ff6000
0x2400580
0xe0000165`f1ff6004
0xe0000165`f3cb8dc0
0x2277
0xe0000165`ea212df0
3
0xe0000165`f1895370
0x1010`082a6018
0x80000000`00000285
0xe0000165`ea212c50
0x1010`082a6018
0x80000000`00000b1c
BR @ 0xe0000165f3f584f8 0xe0000165f3f58530
e0000165`f3f584f8
e0000165`f3f58500
e0000165`f3f58508
e0000165`f3f58510
e0000165`f3f58518
e0000165`f3f58520
e0000165`f3f58528
e0000165`f3f58530
e0000165`ea212df0 USBPORT!USBPORT_StopDevice+0x850
00000000`00000000
00000000`00000000
00000000`00000000
00000000`00000000
00000000`00000000
e0000000`832cb061 nt!NtClose+0x1
e0000165`f1895320 usbohci!OHCI_StopController
CR @ 0xe0000165f3f58538 0xe0000165f3f58930
e0000165`f3f58538
e0000165`f3f58540
e0000165`f3f58548
e0000165`f3f58550
...
e0000165`f3f585c8
e0000165`f3f585d0
e0000165`f3f585d8
e0000165`f3f585e0
e0000165`f3f585e8
e0000165`f3f585f0
...
e0000165`f3f58930
00000000`00007e05
00000154`a7047201
e0000000`83230000 nt!KiVhptTransVector
00000000`00000000
00000000`00000000
e0000165`f1895370 usbohci!OHCI_StopController+0x50
e0000165`f213df5a
00000000`00000060
e0000165`f1895360 usbohci!OHCI_StopController+0x40
80000000`00000285
00000000`00000000
AR @ 0xe0000165f3f58938 0xe0000165f3f58d30
e0000165`f3f58938
e0000165`f3f58940
e0000165`f3f58948
e0000165`f3f58950
e0000165`f3f58958
e0000165`f3f58960
e0000165`f3f58968
e0000165`f3f58970
e0000165`f3f58978
e0000165`f3f58980
e0000165`f3f58988
e0000165`f3f58990
e0000165`f3f58998
e0000165`f3f589a0
e0000165`f3f589a8
e0000165`f3f589b0
e0000165`f3f589b8
e0000165`f3f589c0
...
e0000165`f3f58d30
00000000`00000000
00000000`00000000
00000000`00000000
00000000`00000000
00000000`00000000
00000000`00000006
e0000000`8301add0 nt!KiMemoryFault
00000000`00000000
00000000`00000000
00000000`00000000
00000000`00000000
00000000`00000000
00000000`00000000
00000000`00000000
00000000`00000000
00000000`00000000
e0000165`f1895370 usbohci!OHCI_StopController+0x50
e0000165`f0f988e0
00000000`00000000
RR @ 0xe0000165f3f58d38 0xe0000165f3f58d70
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
e0000165`f3f58d38
e0000165`f3f58d40
e0000165`f3f58d48
e0000165`f3f58d50
e0000165`f3f58d58
e0000165`f3f58d60
e0000165`f3f58d68
e0000165`f3f58d70
00000000`00000535
00000000`00000535
00000000`00000535
00000000`00000535
00000000`00000535
00000000`00000535
00000000`00000535
00000000`00000535
FR @ 0xe0000165f3f58d78 0xe0000165f3f59570
e0000165`f3f58d78
e0000165`f3f58d80
e0000165`f3f58d88
e0000165`f3f58d90
e0000165`f3f58d98
e0000165`f3f58da0
e0000165`f3f58da8
e0000165`f3f58db0
...
e0000165`f3f59570
00000000`00000000
00000000`00000000
80000000`00000000
00000000`0000ffff
00000000`00000000
00000000`00000000
00000000`00000000
00000000`00000000
00000000`00000000
0xe0000165f3f596a0
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
e0000165`f3f595ba
e0000165`f3f595ca
e0000165`f3f595da
e0000165`f3f595ea
e0000165`f3f595fa
e0000165`f3f5960a
e0000165`f3f5961a
e0000165`f3f5962a
e0000165`f3f5963a
e0000165`f3f5964a
e0000165`f3f5965a
e0000165`f3f5966a
e0000165`f3f5967a
e0000165`f3f5968a
e0000165`f3f5969a
00
2b
00
0e
00
00
00
00
00
00
00
1e
00
00
00
00
f6
00
10
02
d0
00
00
00
00
00
00
00
00
00
00
f7
00
47
20
00
00
00
3c
dc
2a
00
00
00
00
00
a6
00
01
80
00
00
00
10
00
01
00
00
00
00
00
cc
00
30
00
00
00
00
74
00
ff
40
00
00
00
00
ca
00
22
00
00
00
00
12
00
00
04
00
00
00
91
00
00
08
10
18
20
28
30
38
e4
00
00
00
d3-86
ff-ff
00-00
00-00
00-00
00-00
00-00
00-00
00-00
00-00
00-00
00-00
00-00
00-00
d3
ff
00
00
00
00
00
00
00
00
00
00
00
00
7a
ff
08
08
08
08
08
08
08
08
08
00
00
00
5e
ff
00
00
00
00
00
00
00
00
00
00
00
00
7e
ff
00
00
00
00
00
00
00
00
00
00
00
00
48
ff
00
00
00
00
00
00
00
00
00
00
00
00
a4
09
86
02
00
81
00
00
00
00
07
00
00
00
0a
00
80
00
00
a0
00
00
00
00
f0
00
00
00
..........z^~H..
+...............
................
..G.0"..........
.. .............
................
...... .........
......(.........
..<.t.0.........
......8.........
..*.............
....@...........
................
................
......
CP M/R/F/A Manufacturer
SerialNumber
Features
Speed
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
0 1,5,31,0 GenuineIntel
On an x86 target, !mca displays the machine check registers supported by the active processor. It also displays basic CPU information (identical to that displayed by !
cpuinfo). Here is an example of the output from this extension:
0: kd> !mca
MCE: Enabled, Cycle Address: 0x00000001699f7a00, Type: 0x0000000000000000
MCA: Enabled, Banks 5, Control Reg: Supported, Machine Check: None.
Bank Error Control Register
Status Register
0. None
0x000000000000007f
0x0000000000000000
1. None
0x00000000ffffffff
0x0000000000000000
2. None
0x00000000000fffff
0x0000000000000000
3. None
0x0000000000000007
0x0000000000000000
4. None
0x0000000000003fff
0x0000000000000000
!memlist
The !memlist extension scans physical memory lists from the page frame number (PFN) database in order to check them for consistency.
Syntax
!memlist Flags
Parameters
Flags
Specifies which memory lists to verify. At present, only one value has been implemented:
Bit 0 (0x1)
Causes the zeroed pages list to be verified.
DLL
Windows 2000
Kdexts.dll
Windows XP and later Kdexts.dll
Comments
At present, this extension will only check the zeroed pages list to make sure that all pages in that list are zeroed. The appropriate syntax is:
kd> !memlist 1
!memusage
The !memusage extension displays summary statistics about physical memory use.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Syntax
Syntax in Windows 2000
!memusage
Syntax in Windows XP and later
!memusage [Flags]
Flags
(Windows XP and later only) Can be any one of the following values. The default is 0x0.
0x0
Displays general summary information, along with a more detailed description of the pages in the PFN database. See the Comments section for an example of this
type of output.
0x1
Displays only summary information about the modified no-write pages in the PFN database..
0x2
Displays only detailed information about the modified no-write pages in the PFN database.
0x8
Displays only general summary information about memory use.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
Physical memory statistics are collected from the Memory Manager's page frame number (PFN) database table.
This command takes a long time to run, especially if the target computer is running in 64-bit mode, due to the greater amount of data to obtain. While it is loading the PFN
database, a counter shows its progress. To speed up this loading, increase the COM port speed with the CTRL+A (Toggle Baud Rate) key, or use the .cache (Set Cache Size)
command to increase the cache size (perhaps to around 10 MB).
The !memusage command can also be used while performing local kernel debugging.
Here is an example of the output from this extension:
kd> !memusage
loading PFN database
loading (98% complete)
Compiling memory usage data
Zeroed:
49
Free:
5
Standby:
5489
Modified:
714
ModifiedNoWrite:
1
Active/Valid: 10119
Transition:
6
Unknown:
0
TOTAL: 16383
(100% Complete).
(
196 kb)
(
20 kb)
( 21956 kb)
( 2856 kb)
(
4 kb)
( 40476 kb)
(
24 kb)
(
0 kb)
( 65532 kb)
name
8251a258
827ab1b8
8263c408
8252dda8
8272f638
......
82755958
8250b518
8254d8d8
82537be8
12
8
908
0
128
108
1708
48
324
112
0
0
0
0
0
0
0
0
0
116
0
0
0
0
0
0
0
0
0
0
mapped_file(
mapped_file(
mapped_file(
mapped_file(
mapped_file(
0
0
0
0
4
4
4
4
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
mapped_file( $Directory )
No Name for File
mapped_file( $Directory )
mapped_file( Windows Explorer.lnk )
---------------------------------------------------------
1348
492
3364
972
496
1144
944
412
0
0
1384
0
1456
0
0
0
0
0
1396
0
384
0
0
0
---------------------------------
---------------------------------
904
72
188
88
164
120
156
64
process
process
process
process
process
process
process
process
(
(
(
(
(
(
(
(
cscui.dll )
$Mft )
win32k.sys )
ShellIconCache )
advapi32.dll )
System )
winmine.exe )
explorer.exe )
services.exe )
winmgmt.exe )
svchost.exe )
winlogon.exe )
csrss.exe )
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
......
--------
12
0 ----- -----
process ( wmiadap.exe )
---------------
316
4096
0
0
0
0
----------------------------......
-------------------------------------------
884
88
8
12
280
8
0
0
36
0
0
0
-----------------
0
0
0
0
-----------------
driver
driver
driver
driver
(
(
(
(
ntoskrnl.exe )
hal.dll )
kdcom.dll )
BOOTVID.dll )
8
16
56
2756
1936
0
0
0
0
1060
128
0
0
0
0
876
148
0
-------------------------
0
0
0
0
0
0
-------------------------
driver
driver
driver
driver
driver
driver
(
(
(
(
(
(
ndisuio.sys )
dump_scsiport.sys )
dump_aic78xx.sys )
Paged Pool )
Kernel Stacks )
NonPaged Pool )
The first column displays the address of the control area structure that describes each mapped structure. Use the !ca extension command to display these control areas.
Comments
You can use the !vm extension command to analyze virtual memory use. This extension is typically more useful than !memusage. For more information about memory
management, see Microsoft Windows Internals, by Mark Russinovich and David Solomon.
The !pfn extension command can be used to display a particular page frame entry in the PFN database.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!mps
The !mps extension displays BIOS information for the Intel Multiprocessor Specification (MPS) of the target computer.
Syntax
!mps [Address]
Parameters
Address
Specifies the hexadecimal address of the MPS table in the BIOS. If this is omitted, the information is obtained from the HAL. This will require HAL symbols.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
This extension command can only be used with an x86-based target computer.
Additional Information
For more information about BIOS debugging, see Debugging BIOS Code. For more information about the MPS, refer to the appropriate version of the Intel MultiProcessor
Specification.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!mtrr
The !mtrr extension displays the contents of the MTRR register.
Syntax
!mtrr
DLL
Windows 2000
Kdextx86.dll
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!npx
The !npx extension displays the contents of the floating-point register save area.
Syntax
!npx Address
Parameters
Address
Specifies the hexadecimal address of the FLOATING_SAVE_AREA structure.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
This extension command can only be used with an x86-based target computer.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!object
The !object extension displays information about a system object.
Syntax
!object
!object
!object
!object
Address
0 Name
Path
-r
Parameters
Address
If the first argument is a nonzero hexadecimal number, it specifies the hexadecimal address of the system object for which to display information.
Name
If the first argument is zero, the second argument is interpreted as the name of a class of system objects for which to display all instances.
Path
If the first argument begins with a backslash (\), !object interprets it as an object path name. When this option is used, the display will be arranged according to the
directory structure used by the Object Manager.
-r
Causes cached values of global variables to be refreshed.
DLL
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
The !object extension caches certain global variables whose values can change. If the set of kernel symbols you are using has become stale, use !object -r to refresh the
cached values.
The following example obtains an object pointer by executing the !handle extension:
kd> !handle
processor number 0
PROCESS 80a02920 Cid: 0002
Peb: 00000000 ParentCid: 0000
DirBase: 0006c805 ObjectTable: 80a03788 TableSize: 54.
Image: System
006c: Object: 80967768 GrantedAccess: 00100003
Object: 80967768 Type: (809d5c20) File
ObjectHeader: 80967750
HandleCount: 1 PointerCount: 1
Directory Object: 00000000 Name: \WINNT\system32\config\software {Partition1}
kd> !object 80967768
Object: 80967768 Type: (809d5c20) File
ObjectHeader: 80967750
HandleCount: 1 PointerCount: 1
Directory Object: 00000000 Name: \WINNT\system32\config\software {Partition1}
Additional Information
For information about objects and the object manager, see the Microsoft Windows SDK documentation, the Windows Driver Kit (WDK) documentation, and Microsoft
Windows Internals, by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!obtrace
The !obtrace extension displays object reference tracing data for the specified object.
Syntax
!obtrace Object
Parameters
Object
A pointer to the object or a path.
DLL
Windows 2000
Unavailable
Windows XP and later Kdexts.dll
Comments
The object reference tracing feature of Windows records sequential stack traces whenever an object reference counter is incremented or decremented.
Before using this extension to display object reference tracing data, you must use GFlags to enable object reference tracing for the specified object. You can enable object
reference tracing as a kernel flag (run-time) setting, in which the change is effective immediately, but disappears if you shut down or restart; or as a registry setting, which
requires a restart, but remains effective until you change it.
Here is an example of the output from the !obtrace extension:
kd> !obtrace 0xfa96f700
Object: fa96f700
Image: cmd.exe
Sequence (+/-) Stack
-------- ----- --------------------------------------------------2421d
+1 nt!ObCreateObject+180
nt!NtCreateEvent+92
nt!KiFastCallEntry+104
nt!ZwCreateEvent+11
win32k!UserThreadCallout+6f
win32k!W32pThreadCallout+38
nt!PsConvertToGuiThread+174
nt!KiBBTUnexpectedRange+c
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
2421e
-1
nt!ObfDereferenceObject+19
nt!NtCreateEvent+d4
nt!KiFastCallEntry+104
nt!ZwCreateEvent+11
win32k!UserThreadCallout+6f
win32k!W32pThreadCallout+38
nt!PsConvertToGuiThread+174
nt!KiBBTUnexpectedRange+c
2421f
+1
nt!ObReferenceObjectByHandle+1c3
win32k!xxxCreateThreadInfo+37d
win32k!UserThreadCallout+6f
win32k!W32pThreadCallout+38
nt!PsConvertToGuiThread+174
nt!KiBBTUnexpectedRange+c
24220
+1
nt!ObReferenceObjectByHandle+1c3
win32k!ProtectHandle+22
win32k!xxxCreateThreadInfo+3a0
win32k!UserThreadCallout+6f
win32k!W32pThreadCallout+38
nt!PsConvertToGuiThread+174
nt!KiBBTUnexpectedRange+c
24221
-1
nt!ObfDereferenceObject+19
win32k!xxxCreateThreadInfo+3a0
win32k!UserThreadCallout+6f
win32k!W32pThreadCallout+38
nt!PsConvertToGuiThread+174
nt!KiBBTUnexpectedRange+c
The object reference traces on x64-based target computers might be incomplete because it is not always possible to acquire stack traces at IRQL levels higher than
PASSIVE_LEVEL.
You can stop execution at any time by pressing CTRL+BREAK (in WinDbg) or CTRL+C (in KD).
Additional Information
For more information about the Global Flags utility (GFlags), see the Windows Driver Kit (WDK) documentation and Microsoft Windows Internals by Mark Russinovich and
David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!openmaps
The !openmaps extension displays the referenced buffer control blocks (BCBs) and virtual address control blocks (VACBs) for the specified shared cache map.
Syntax
!openmaps Address [Flag]
Parameters
Address
Specifies the address of the shared cache map.
Flag
Determines which control blocks are displayed. If Flag is 1, the debugger displays all control blocks. If Flag is 0, the debugger displays only referenced control blocks.
The default is 0.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Additional Information
For information about cache management, see the Microsoft Windows SDK documentation and Microsoft Windows Internals by Mark Russinovich and David Solomon.
For information about other cache management extensions, see the !cchelp extension.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!pars
The !pars extension displays a specified processor application registers file.
Syntax
!pars Address
Parameters
Address
Specifies the address of a processor application registers file.
DLL
Windows 2000
Unavailable
Windows XP and later Kdexts.dll
This extension command can only be used with an Itanium-based target computer.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!pat
The !pat extension displays the Page Attribute Table (PAT) registers for the target processor.
Syntax
!pat Flag
!pat
Parameters
Flag
If Flag is set, the debugger verifies that the PAT feature is present before the PAT is displayed.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
This extension command can only be used with an x86-based target computer.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!pci
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The !pci extension displays the current status of the peripheral component interconnect (PCI) buses, as well as any devices attached to those buses.
Syntax
!pci [Flags [Segment] [Bus [Device [Function [MinAddress MaxAddress]]]]]
Parameters
Flags
Specifies the level of output. Can be any combination of the following bits:
Bit 0 (0x1)
Causes a verbose display.
Bit 1 (0x2)
Causes the display to include all buses in the range from bus 0 (zero) to the specified Bus.
Bit 2 (0x4)
Causes the display to include information in raw byte format. If MinAddress, MaxAddress, or flag bit 0x8 is set, this bit is automatically set as well.
Bit 3 (0x8)
Causes the display to include information in raw DWORD format.
Bit 4 (0x10)
Causes the display to include invalid device numbers. If Device is specified, this flag is ignored.
Bit 5 (0x20)
Causes the display to include invalid function numbers.
Bit 6 (0x40)
Causes the display to include capabilities.
Bit 7 (0x80)
Causes the display to include Intel 8086 device-specific information.
Bit 8 (0x100)
Causes the display to include the PCI configuration space.
Bit 9 (0x200)
Causes the display to include segment information. When this bit is included, the Segment parameter must be included.
Bit 10 (0x400)
Causes the display to include all valid segments in the range from segment 0 to the specified segment. When this bit is included, the Segment parameter must be
included.
Segment
Specifies the number of the segment to be displayed. Segment numbers range from 0 to 0xFFFF. If Segment is omitted, information about the primary segment (segment
0) is displayed. If Flags includes bit 10 (0x400), Segment specifies the highest valid segment to be displayed.
Bus
Specifies the bus to be displayed. Bus can range from 0 to 0xFF. If it is omitted, information about the primary bus (bus 0) is displayed. If Flags includes bit 1 (0x2), Bus
specifies the highest bus number to be displayed.
Device
Specifies the slot device number for the device. If this is omitted, information about all devices is printed.
Function
Specifies the slot function number for the device. If this is omitted, all information about all device functions is printed.
MinAddress
Specifies the first address from which raw bytes or DWORDs are to be displayed. This must be between 0 and 0xFF.
MaxAddress
Specifies the last address from which raw bytes or DWORDs are to be displayed. This must be between 0 and 0xFF, and not less than MinAddress.
DLL
Windows 2000
Kext.dll
Kdextx86.dll
Windows XP and later Kext.dll
This extension command can only be used with an x86-based target computer.
Comments
To edit the PCI configuration space, use !ecb, !ecd, or !ecw.
The following example displays a list of all buses and their devices. This command will take a long time to execute. You will see a moving counter at the bottom of the
display while the debugger scans the target system for PCI buses:
kd> !pci 2 ff
PCI Bus 0
00:0 8086:1237.02
0d:0 8086:7000.01
0d:1 8086:7010.00
0e:0 1011:0021.02
10:0 102b:0519.01
PCI Bus 1
08:0 10b7:9050.00
09:0 9004:8178.00
Cmd[0106:.mb..s]
Cmd[0007:imb...]
Cmd[0005:i.b...]
Cmd[0107:imb..s]
Cmd[0083:im....]
Sts[2280:.....]
Sts[0280:.....]
Sts[0280:.....]
Sts[0280:.....]
Sts[0280:.....]
Cmd[0107:imb..s]
Cmd[0117:imb..s]
Sts[0200:.....]
Sts[0280:.....]
Device
Device
Ethernet
SCSI controller
This example displays verbose information about the devices on the primary bus. The two-digit number at the beginning of each line is the device number; the one-digit
number following it is the function number:
kd> !pci 1 0
PCI Bus 0
00:0 8086:1237.02
cf8:80000000
Cmd[0106:.mb..s] Sts[2280:.....]
IntPin:0 IntLine:0 Rom:0 cis:0
Device
cap:0
Host bridge
0d:0
Cmd[0007:imb...]
Device
ISA bridge
8086:7000.01
Sts[0280:.....]
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
cf8:80006800
IntPin:0
IntLine:0
Rom:0
cis:0
cap:0
0d:1
8086:7010.00
cf8:80006900
IO[4]:fff1
Cmd[0005:i.b...] Sts[0280:.....]
IntPin:0 IntLine:0 Rom:0 cis:0
0e:0
1011:0021.02
cf8:80007000
IO:f000-ffff
10:0
Device
cap:0
IDE controller
This example shows even more detailed information about bus 0 (zero), device 0x0D, and function 0x1, including the raw DWORDS from addresses between 0x00 and 0x3F:
kd> !pci f 0 d 1 0 3f
PCI Bus 0
0d:1 8086:7010.00 Cmd[0005:i.b...] Sts[0280:.....]
cf8:80006900 IntPin:0 IntLine:0 Rom:0 cis:0
IO[4]:fff1
00000000: 70108086 02800005 01018000 00002000
00000010: 00000000 00000000 00000000 00000000
00000020: 0000fff1 00000000 00000000 00000000
00000030: 00000000 00000000 00000000 00000000
Device
cap:0
IDE controller
This example displays the configuration space for segment 1, bus 0, device 1:
0: kd> !pci 301 1 0 1
PCI Configuration Space (Segment:0001 Bus:00 Device:01 Function:00)
Common Header:
00: VendorID
14e4 Broadcom Corporation
02: DeviceID
16c7
04: Command
0146 MemSpaceEn BusInitiate PERREn SERREn
06: Status
02b0 CapList 66MHzCapable FB2BCapable DEVSELTiming:1
.
.
.
5a: MsgCtrl
64BitCapable MultipleMsgEnable:0 (0x1) MultipleMsgCapable:3 (0x8)
5c: MsgAddr
2d4bff00
60: MsgAddrHi
1ae09097
64: MsData
9891
To display all devices and buses on valid segments, issue the command !pci 602 ffff ff:
0: kd> !pci 602 ffff ff
Scanning the following PCI segments: 0 0x1
PCI Segment 0 Bus 0
01:0 14e4:16c7.10 Cmd[0146:.mb.ps] Sts[02b0:c6...]
02:0 1000:0030.08 Cmd[0147:imb.ps] Sts[0230:c6...]
02:1 1000:0030.08 Cmd[0147:imb.ps] Sts[0230:c6...]
03:0 1000:0030.08 Cmd[0147:imb.ps] Sts[0230:c6...]
03:1 1000:0030.08 Cmd[0147:imb.ps] Sts[0230:c6...]
PCI Segment 0 Bus 0x38
01:0 14e4:1644.12 Cmd[0146:.mb.ps] Sts[02b0:c6...]
PCI Segment 0 Bus 0x54
00:0 103c:403b.00 Cmd[0547:imb.ps] Sts[0010:c....]
PCI Segment 0 Bus 0x70
00:0 103c:403b.00 Cmd[0547:imb.ps] Sts[0010:c....]
PCI Segment 0 Bus 0xa9
01:0 8086:b154.00 Cmd[0147:imb.ps] Sts[0ab0:c6.A.]
PCI Segment 0 Bus 0xaa
04:0 1033:0035.41 Cmd[0146:.mb.ps] Sts[0210:c....]
04:1 1033:0035.41 Cmd[0146:.mb.ps] Sts[0210:c....]
04:2 1033:00e0.02 Cmd[0146:.mb.ps] Sts[0210:c....]
05:0 1002:5159.00 Cmd[0187:imb..s] Sts[0290:c....]
PCI Segment 0 Bus 0xc6
00:0 103c:403b.00 Cmd[0547:imb.ps] Sts[0010:c....]
PCI Segment 0 Bus 0xe3
00:0 103c:403b.00 Cmd[0547:imb.ps] Sts[0010:c....]
PCI Segment 0x1 Bus 0
01:0 14e4:16c7.10 Cmd[0146:.mb.ps] Sts[02b0:c6...]
02:0 1000:0030.08 Cmd[0147:imb.ps] Sts[0230:c6...]
02:1 1000:0030.08 Cmd[0147:imb.ps] Sts[0230:c6...]
03:0 1000:0030.08 Cmd[0147:imb.ps] Sts[0230:c6...]
03:1 1000:0030.08 Cmd[0147:imb.ps] Sts[0230:c6...]
PCI Segment 0x1 Bus 0x54
00:0 103c:403b.00 Cmd[0547:imb.ps] Sts[0010:c....]
PCI Segment 0x1 Bus 0x55
00:0 8086:10b9.06 Cmd[0147:imb.ps] Sts[0010:c....]
Ethernet
LSI SCSI
LSI SCSI
LSI SCSI
LSI SCSI
Controller
Controller
Controller
Controller
Controller
SubID:103c:1321
SubID:103c:1323
SubID:103c:1323
SubID:103c:1323
SubID:103c:1323
Ethernet Controller
SubID:10b7:1000
Controller
Controller
Controller
Controller
Controller
SubID:103c:1321
SubID:103c:1323
SubID:103c:1323
SubID:103c:1323
SubID:103c:1323
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
SubID:8086:1083
9/18/2010
Introduction
0x70
Cmd[0547:imb.ps]
0xc6
Cmd[0547:imb.ps]
0xe3
Cmd[0547:imb.ps]
Sts[0010:c....]
Sts[0010:c....]
Sts[0010:c....]
Additional Information
See Plug and Play Debugging for applications of this extension command and additional examples. For information about PCI buses, see the Windows Driver Kit (WDK)
documentation.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!pciir
The !pciir extension displays the contents of the hardware routing of peripheral component interconnect (PCI) devices to interrupt controller inputs.
Syntax
!pciir
DLL
Windows 2000
Kdextx86.dll
Windows XP
Kdexts.dll
Windows Server 2003
Windows Vista and later Unavailable
This extension command can only be used with an x86-based target computer that does not have the Advanced Configuration and Power Interface (ACPI) enabled.
Additional Information
For similar information on any ACPI-enabled computer, use the !acpiirqarb extension.
For information about PCI buses, see the Windows Driver Kit (WDK) documentation.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!pcitree
The !pcitree extension displays information about PCI device objects, including child PCI buses and CardBus buses, and the devices attached to them.
Syntax
!pcitree
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
Here is an example:
kd> !pcitree
Bus 0x0 (FDO Ext fe517338)
0600 12378086 (d=0, f=0)
0601 70008086 (d=d, f=0)
0101 70108086 (d=d, f=1)
0604 00211011 (d=e, f=0)
devext
devext
devext
devext
fe4f4ee8
fe4f4ce8
fe4f4ae8
fe4f4788
Bridge/HOST to PCI
Bridge/PCI to ISA
Mass Storage Controller/IDE
Bridge/PCI to PCI
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!pcm
The !pcm extension displays the specified private cache map. This extension is only available in Windows 2000.
Syntax
!pcm Address
Parameters
Address
Specifies the address of the private cache map.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Unavailable (see Comments section)
Comments
This extension is supported only in Windows 2000. In Windows XP and later versions of Windows, use the dt nt!_PRIVATE_CACHE_MAP Address command.
Additional Information
For information about cache management, see the Microsoft Windows SDK documentation and Microsoft Windows Internals by Mark Russinovich and David Solomon.
For information about other cache management extensions, see the !cchelp extension reference.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!pcr
The !pcr extension displays the current status of the Processor Control Region (PCR) on a specific processor.
Syntax
!pcr [Processor]
Parameters
Processor
Specifies the processor to retrieve the PCR information from. If Processor is omitted, the current processor is used.
DLL
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
The processor control block (PRCB) is an extension of the PCR. It can be displayed with the !prcb extension.
Here is an example of the !pcr extension on an x86 target computer:
kd> !pcr 0
KPCR for Processor 0 at ffdff000:
Major 1 Minor 1
NtTib.ExceptionList: 801626e0
NtTib.StackBase: 801628f0
NtTib.StackLimit: 8015fb00
NtTib.SubSystemTib: 00000000
NtTib.Version: 00000000
NtTib.UserPointer: 00000000
NtTib.SelfTib: 00000000
SelfPcr:
Prcb:
Irql:
IRR:
IDR:
InterruptMode:
IDT:
GDT:
TSS:
ffdff000
ffdff120
00000000
00000000
ffffffff
00000000
80043400
80043000
803cc000
CurrentThread: 8015e8a0
NextThread: 00000000
IdleThread: 8015e8a0
DpcQueue:
One of the entries in this display shows the interrupt request level (IRQL). The !pcr extension shows the current IRQL, but the current IRQL is usually not of much interest.
The IRQL that existed just before the bug check or debugger connection is more interesting. This is displayed by !irql, which is only available on computers running
Windows Server 2003 or later versions of Windows.
Additional Information
For information about the PCR and the PRCB, see Microsoft Windows Internals, by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!pcrs
The !pcrs extension displays the Intel Itanium-specific processor control registers.
Syntax
!pcrs Address
Parameters
Address
Specifies the address of a processor control registers file.
DLL
Windows 2000
Unavailable
Windows XP and later Kdexts.dll
This extension command can only be used with an Itanium-based target computer.
Comments
Do not confuse the !pcrs extension with the !pcr extension, which displays the current status of the processor control region.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!pfn
The !pfn extension displays information about a specific page frame or the entire page frame database.
Syntax
!pfn PageFrame
Parameters
PageFrame
Specifies the hexadecimal number of the page frame to be displayed.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
The page frame number for a virtual address can be obtained by using the !pte extension.
Here is an example of the output from this extension:
kd> !pte 801544f4
801544F4 - PDE at C0300800
PTE at C0200550
contains 0003B163
contains 00154121
pfn 3b G-DA--KWV
pfn 154 G--A--KRV
kd> !pfn 3b
PFN 0000003B at address 82350588
flink
00000000 blink / share count 00000221 pteaddress C0300800
reference count 0001
color 0
restore pte 00000000 containing page
000039 Active
!pmc
The !pmc extension displays the Performance Monitor Counter (PMC) register at the specified address.
This extension is supported only on an Itanium-based target computer.
Syntax
!pmc [- Option] Expression [DisplayLevel]
Parameters
Option
Can be any one of the following values:
gen
Displays the register as a generic PMC register.
btb
Displays the register as a branch trace buffer (BTB) PMC register.
Expression
Specifies the hexadecimal address of a PMC. The expressions @kpfcgen and @kpfcbtb can be used as values for this parameter.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
If Expression is @kpfcgen, the debugger displays the current processor PMC register as a generic PMC register. You can also display the current processor PMC register
as a generic PMC register by setting Option to gen and using @kpfc4, @kpfc5, @kpfc6, or @kpfc7 for the Expression value.
If Expression is @kpfcbtb, the debugger displays the current processor PMC register as a BTB PMC register. You can also display the current processor PMC register as
a BTB PMC register by setting Option to btb and using @kpfc12 for the Expression value.
DisplayLevel
Can be any one of the following values:
0
Displays only the values of each PMC register field. This is the default.
1
Displays detailed information about the PMC register fields that are not reserved or ignored.
2
Displays detailed information about all PMC register fields, including those that are ignored or reserved.
DLL
Windows 2000
Unavailable
Windows XP and later Kdexts.dll
!pmssa
The !pmssa extension displays a specified processor Minimal State Save Area (also known as Min-StateSave Area).
This extension can only be used with an Itanium-based target computer.
Syntax
!pmssa Address
Parameters
Address
Specifies the address of a processor Min-StateSave Area.
DLL
Windows 2000
Unavailable
Windows XP and later Kdexts.dll
!pnpevent
The !pnpevent extension displays the Plug and Play device event queue.
Syntax
!pnpevent [DeviceEvent]
Parameters
DeviceEvent
Specifies the address of a device event to display. If this is zero or omitted, the tree of all device events in the queue is displayed.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Additional Information
See Plug and Play Debugging for applications of this extension command. For information about Plug and Play drivers, see the Windows Driver Kit (WDK) documentation.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!pocaps
The !pocaps extension displays the power capabilities of the target computer.
Syntax
!pocaps
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
Here is an example of this command's output:
kd> !pocaps
PopCapabilities @ 0x8016b100
Misc Supported Features: S4 FullWake
Processor Features:
Disk Features:
SpinDown
Battery Features:
Wake Caps
Ac OnLine Wake:
Sx
Soft Lid Wake:
Sx
RTC Wake:
Sx
Min Device Wake:
Sx
Default Wake:
Sx
Additional Information
To view the system's power policy, use the !popolicy extension command. For information about power capabilities and power policy, see the Windows Driver Kit (WDK)
documentation and Microsoft Windows Internals, by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!pool
The !pool extension displays information about a specific pool allocation or about the entire system-wide pool.
Syntax
!pool [Address [Flags]]
Parameters
Address
Specifies the pool entry to be displayed. If Address is -1, this command displays information about all heaps in the process. If Address is 0 or omitted, this command
displays information about the process heap.
Flags
Specifies the level of detail to be used. This can be any combination of the following bit values; the default is zero:
Bit 0 (0x1)
Causes the display to include the pool contents, not just the pool headers.
Bit 1 (0x2)
Causes the display to suppress pool header information for all pools, except the one that actually contains the specified Address.
Bit 31 (0x80000000)
(Windows XP and later) Suppresses the description of the pool type and pool tag in the display.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
In Windows XP and later versions of Windows, the !pool extension displays the pool tag associated with each allocation. The owner of that pool tag is also displayed. This
display is based on the contents of the pooltag.txt file. This file is located in the triage subdirectory of your Debugging Tools for Windows installation. If you want , you can
edit this file to add additional pool tags relevant to your project.
Warning If you install an updated version of Debugging Tools for Windows in the same directory as the current version, it overwrites all of the files in that directory,
including pooltag.txt. If you modify or replace the sample pooltag.txt file, be sure to save a copy of it to a different directory. After reinstalling the debuggers, you can copy
the saved pooltag.txt over the default version.
If the !pool extension reports pool corruption, you should use !poolval to investigate.
Here is an example. If Address specifies 0xE1001050, the headers of all pools in this block are displayed, and 0xE1001050 itself is marked with an asterisk (*).
kd> !pool
e1001000
e1001040
*e1001050
e1001060
e1001070
e1001080
e10010c0
.....
e1001050
size:
40
size:
10
size:
10
size:
10
size:
10
size:
40
size:
10
previous
previous
previous
previous
previous
previous
previous
size:
size:
size:
size:
size:
size:
size:
0
40
10
10
10
10
40
(Allocated) MmDT
(Free)
Mm
(Allocated) *ObDi
(Allocated) ObDi
(Allocated) Symt
(Allocated) ObDm
(Allocated) ObDi
In this example, the right-most column shows the pool tag. The column to the left of this shows whether the pool is free or allocated.
The following command shows the pool headers and pool contents:
kd> !pool e1001050 1
e1001000 size:
40 previous size:
0 (Allocated)
e1001008 ffffffff 0057005c 004e0049 004f0044
e1001018 ffffffff 0053005c 00730079 00650074
e1001040 size:
10 previous size:
40 (Free)
e1001048 ffffffff e1007ba8 e1501a58 01028101
e1001058 ffffffff 00000000 e1000240 01028101
MmDT
Mm
*e1001050 size:
10 previous size:
10 (Allocated) *ObDi
e1001058 ffffffff 00000000 e1000240 01028101
e1001068 ffffffff 00000000 e10009c0 01028101
e1001060 size:
10 previous size:
10 (Allocated)
e1001068 ffffffff 00000000 e10009c0 01028101
e1001078 ffffffff 00000000 00000000 04028101
ObDi
......
Additional Information
For information about memory pools, see the Windows Driver Kit (WDK) documentation and Microsoft Windows Internals, by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!poolfind
The !poolfind extension finds all instances of a specific pool tag in either nonpaged or paged memory pools.
Syntax
!poolfind TagString [PoolType]
!poolfind TagValue [PoolType]
Parameters
TagString
Specifies the pool tag. TagString is a case-sensitive ASCII string. The asterisk (*) can be used to represent any number of characters; the question mark (?) can be used to
represent exactly one character. Unless an asterisk is used, TagString must be exactly four characters in length.
TagValue
Specifies the pool tag. TagValue must begin with "0x", even if the default radix is 16. If this parameter begins with any other value (including "0X") it will be interpreted
as an ASCII tag string.
PoolType
Specifies the type of pool to be searched. The following values are permitted:
0
Specifies nonpaged memory pool. This is the default.
1
Specifies paged memory pool.
2
Specifies the special pool.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
4
(Windows XP and later) Specifies the session pool.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
This command can take a significant amount of time to execute, depending on the size of pool memory that must be searched. To speed up this execution, increase the COM
port speed with the CTRL+A (Toggle Baud Rate) key, or use the .cache (Set Cache Size) command to increase the cache size (to approximately 10 MB).
The pool tag is the same tag passed to the ExAllocateXxx family of routines.
Here is an example. The entire nonpaged pool is searched and then the paged pool is searched, but the command is terminated before completion (after an hour of operation):
kd> !poolfind SeSd 0
Scanning large pool allocation table for Tag: SeSd (827d1000 : 827e9000)
Searching NonPaged pool (823b1000 : 82800000) for Tag: SeSd
826fa130
82712000
82715940
8271da30
82721c00
8272b3f0
8272d770
8272d7d0
8272d960
82736f30
82763840
8278b730
8278b830
82790130
82799180
827c00e0
827c8320
827ca180
827ec140
size:
size:
size:
size:
size:
size:
size:
size:
size:
size:
size:
size:
size:
size:
size:
size:
size:
size:
size:
c0
c0
a0
c0
10
60
60
a0
a0
a0
a0
100
10
a0
a0
a0
a0
a0
a0
previous
previous
previous
previous
previous
previous
previous
previous
previous
previous
previous
previous
previous
previous
previous
previous
previous
previous
previous
size:
size:
size:
size:
size:
size:
size:
size:
size:
size:
size:
size:
size:
size:
size:
size:
size:
size:
size:
40
0
60
10
30
30
40
60
70
10
10
290
100
20
10
30
60
50
10
(Allocated)
(Allocated)
(Allocated)
(Allocated)
(Free)
(Allocated)
(Allocated)
(Allocated)
(Allocated)
(Allocated)
(Allocated)
(Allocated)
(Free)
(Allocated)
(Allocated)
(Allocated)
(Allocated)
(Allocated)
(Allocated)
SeSd
SeSd
SeSd
SeSd
SeSd
SeSd
SeSd
SeSd
SeSd
SeSd
SeSd
SeSd
SeSd
SeSd
SeSd
SeSd
SeSd
SeSd
SeSd
size:
size:
d0 previous size:
d0 previous size:
20
60
(Allocated) SeSd
(Allocated) SeSd
size:
size:
a0 previous size:
a0 previous size:
60
30
(Allocated) SeSd
(Allocated) SeSd
!poolused
The !poolused extension displays memory use summaries, based on the tag used for each pool allocation.
Syntax
!poolused [Flags [TagString]]
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Parameters
Flags
Specifies the amount of output to be displayed and the method of sorting the output. This can be any combination of the following bit values, except that bits 1 (0x2) and
2 (0x4) cannot be used together. The default is 0x0, which produces summary information, sorted by pool tag.
Bit 0 (0x1)
Displays more detailed (verbose) information.
Bit 1 (0x2)
Sorts the display by the amount of nonpaged memory use.
Bit 2 (0x4)
Sorts the display by the amount of paged memory use.
Bit 3 (0x8)
(Windows Server 2003 and later) Displays the session pool instead of the standard pool.
TagString
Specifies the pool tag. TagString is a case-sensitive ASCII string. The asterisk (*) can be used to represent any number of characters; the question mark (?) can be used to
represent exactly one character. Unless an asterisk is used, TagString must be exactly four characters in length.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
The !poolused extension gathers data from the pool tagging feature of Windows. Pool tagging is permanently enabled on Windows Server 2003 and later versions of
Windows. On Windows XP and earlier versions of Windows, you must enable pool tagging by using Gflags.
If you stop executing the extension before it completes, the debugger displays partial results.
The display for this command shows the memory use for each tag in paged pool and nonpaged pool. In both cases, the display includes the number of currently outstanding
allocations for the given tag and the number of bytes being consumed by those allocations.
Here is a partial example of the output from this extension:
0: kd> !poolused
Sorting by Tag
Pool Used:
Tag
1394
1MEM
2MEM
3MEM
8042
AGP
AcdN
AcpA
AcpB
AcpD
AcpF
AcpM
AcpO
NonPaged
Allocs
Used
1
520
1
3368
1
3944
3
248
4
3944
1
344
2
1072
3
192
0
0
40
13280
6
240
0
0
4
208
Paged
Allocs
Used
0
0UNKNOWN pooltag '1394', please update pooltag.txt
0
0UNKNOWN pooltag '1MEM', please update pooltag.txt
0
0UNKNOWN pooltag '2MEM', please update pooltag.txt
0
0UNKNOWN pooltag '3MEM', please update pooltag.txt
0
0PS/2 kb and mouse , Binary: i8042prt.sys
2
384UNKNOWN pooltag 'AGP ', please update pooltag.txt
0
0TDI AcdObjectInfoG
1
504ACPI Pooltags , Binary: acpi.sys
4
576ACPI Pooltags , Binary: acpi.sys
0
0ACPI Pooltags , Binary: acpi.sys
0
0ACPI Pooltags , Binary: acpi.sys
1
128ACPI Pooltags , Binary: acpi.sys
0
0ACPI Pooltags , Binary: acpi.sys
...
WmiG
WmiR
Wmip
Wmit
Wrpa
Wrpc
Wrpi
Wrps
aEoP
fEoP
hSVD
hibr
iEoP
idle
jEoP
mEoP
ohci
rx..
sidg
thdd
usbp
vPrt
TOTAL
30
6960
63
4032
146
3504
1
4096
2
720
1
72
1
120
2
128
1
672
1
16
0
0
0
0
1
24
2
208
1
24
1
88
1
136
3
1248
2
48
0
0
18
77056
0
0
3570214 209120008
0
0
182
7
0
0
0
0
0
0
1
1
0
0
0
0
0
0
0
1
2
18
0Allocation of WMIGUID
0Wmi Registration info blocks
18600Wmi General purpose allocation
49480Wmi Trace
0WAN_ADAPTER_TAG
0WAN_CONN_TAG
0WAN_INTERFACE_TAG
0WAN_STRING_TAG
0UNKNOWN pooltag 'aEoP', please update pooltag.txt
0UNKNOWN pooltag 'fEoP', please update pooltag.txt
40Shared Heap Tag , Binary: mrxdav.sys
24576UNKNOWN pooltag 'hibr', please update pooltag.txt
0UNKNOWN pooltag 'iEoP', please update pooltag.txt
0Power Manager idle handler
0UNKNOWN pooltag 'jEoP', please update pooltag.txt
0UNKNOWN pooltag 'mEoP', please update pooltag.txt
01394 OHCI host controller driver
0UNKNOWN pooltag ' rx', please update pooltag.txt
0GDI spooler events
20480DirectDraw/3D handle manager table
96UNKNOWN pooltag 'usbp', please update pooltag.txt
68160UNKNOWN pooltag 'vPrt', please update pooltag.txt
38769 13066104
Additional Information
For information about memory pools and pool tags, see the Windows Driver Kit (WDK) documentation and Microsoft Windows Internals, by Mark Russinovich and David
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!poolval
The !poolval extension analyzes the headers for a pool page and diagnoses any possible corruption. This extension is only available in Windows XP and later versions.
Syntax
!poolval Address [DisplayLevel]
Parameters
Address
Specifies the address of the pool whose header is to be analyzed.
DisplayLevel
Specifies the information to include in the display. This can be any of the following values (the default is zero):
0
Causes basic information to be displayed.
1
Causes basic information and linked header lists to be displayed.
2
Causes basic information, linked header lists, and basic header information to be displayed.
3
Causes basic information, linked header lists, and full header information to be displayed.
DLL
Windows 2000
Unavailable
Windows XP and later Kdexts.dll
Additional Information
For information about memory pools, see the Windows Driver Kit (WDK) documentation and Microsoft Windows Internals, by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!popolicy
The !popolicy extension displays the power policy of the target computer.
Syntax
!popolicy [Address]
Parameters
Address
Specifies the address of the power policy structure to display. If this is omitted, then nt!PopPolicy is displayed.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
Here is an example of this command's output:
kd> !popolicy
SYSTEM_POWER_POLICY (R.1) @ 0x80164d58
PowerButton:
Shutdown Flags: 00000003
SleepButton:
None Flags: 00000003
LidClose:
None Flags: 00000001
Idle:
None Flags: 00000001
OverThrottled:
None Flags: c0000004
IdleTimeout:
0 IdleSensitivity:
Event:
Event:
Event:
Event:
Event:
00000000
00000000
00000000
00000000
00000000
50%
Query UI
Query UI
Query
Query
Override NoWakes Critical
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
MinSleep:
LidOpenWake:
WinLogonFlags:
VideoTimeout:
SpinTimeout:
FanTolerance:
MinThrottle:
S0
S0
1
0
0
0%
0%
MaxSleep:
FastSleep:
S4Timeout:
VideoDim:
OptForPower:
ForcedThrottle:
S0
S0
0
209
1
0%
Additional Information
To view the system's power capabilities, use the !pocaps extension command. For information about power capabilities and power policy, see the Windows Driver Kit
(WDK) documentation and Microsoft Windows Internals, by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!prcb
The !prcb extension displays the processor control block (PRCB).
Syntax
!prcb [Processor]
Parameters
Processor
Specifies the processor to retrieve the PRCB information from. If Processor is omitted, processor zero will be used.
DLL
Unavailable
Windows 2000
Windows XP and later Kdexts.dll
Comments
The PRCB is an extension of the processor control region (PCR). To display the PCR, use the !pcr extension.
Here is an example:
kd> !prcb
PRCB for Processor 0 at e0000000818ba000:
Threads-- Current e0000000818bbe10 Next 0000000000000000 Idle e0000000818bbe10
Number 0 SetMember 00000001
Interrupt Count -- 0000b81f
Times -- Dpc
00000028 Interrupt 000003ff
Kernel 00005ef4 User
00000385
Additional Information
For information about the PCR and the PRCB, see Microsoft Windows Internals, by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!process
The !process extension displays information about the specified process, or about all processes, including the EPROCESS block.
This extension can be used only during kernel-mode debugging.
Syntax
Syntax in Windows 2000:
!process [/s Session] [Process [Flags]]
!process [/s Session] 0 Flags ImageName
Syntax in Windows XP and later:
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
00000000
80a03788
ParentCid: 0000
TableSize: 150.
7ffde000
8098fce8
ParentCid: 0002
TableSize: 38.
7ffde000
809782a8
ParentCid: 0012
TableSize: 150.
7ffde000
80955ce8
ParentCid: 0012
TableSize: 54.
7ffde000
80950cc8
ParentCid: 0020
TableSize: 222.
7ffde000
80990fe8
ParentCid: 0020
TableSize: 110.
7ffde000
80925c68
ParentCid: 0026
TableSize: 70.
The following table describes some of the elements of the !process 0 0 output.
Element
Process address
Meaning
The eight-character hexadecimal number after the word PROCESS is the address of the EPROCESS block. In the final entry in the preceding
example, the process address is 0x809258E0.
Process ID (PID)
The hexadecimal number after the word Cid. In the final entry in the preceding example, the PID is 0x44, or decimal 68.
Process Environment Block The hexadecimal number after the word Peb is the address of the process environment block. In the final entry in the preceding example, the
(PEB)
PEB is located at address 0x7FFDE000.
Parent process PID
The hexadecimal number after the word ParentCid is the PID of the parent process. In the final entry in the preceding example, the parent
process PID is 0x26, or decimal 38.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Image
Process object address
The name of the module that owns the process. In the final entry in the preceding example, the owner is spoolss.exe. In the first entry, the
owner is the operating system itself.
The hexadecimal number after the word ObjectTable. In the final entry in the preceding example, the address of the process object is
0x80925c68.
To display full details on one process, set Flags to 7. The process itself can be specified by setting Process equal to the process address, setting Process equal to the process
ID, or setting ImageName equal to the executable image name. Here is an example:
kd> !process fb667a00 7
PROCESS fb667a00 Cid: 0002 Peb: 00000000 ParentCid: 0000
DirBase: 00030000 ObjectTable: e1000f88 TableSize: 112.
Image: System
VadRoot fb666388 Clone 0 Private 4. Modified 9850. Locked 0.
FB667BBC MutantState Signalled OwningThread 0
Token
e10008f0
ElapsedTime
15:06:36.0338
UserTime
0:00:00.0000
KernelTime
0:00:54.0818
QuotaPoolUsage[PagedPool]
1480
Working Set Sizes (now,min,max) (3, 50, 345)
PeakWorkingSetSize
118
VirtualSize
1 Mb
PeakVirtualSize
1 Mb
PageFaultCount
992
MemoryPriority
BACKGROUND
BasePriority
8
CommitCharge
8
THREAD fb667780 Cid 2.1 Teb: 00000000 Win32Thread: 80144900 WAIT: (WrFreePage) KernelMode Non-Alertable
80144fc0 SynchronizationEvent
Not impersonating
Owning Process fb667a00
WaitTime (seconds)
32278
Context Switch Count 787
UserTime
0:00:00.0000
KernelTime
0:00:21.0821
Start Address Phase1Initialization (0x801aab44)
Initial Sp fb26f000 Current Sp fb26ed00
Priority 0 BasePriority 0 PriorityDecrement 0 DecrementCount 0
ChildEBP RetAddr Args to Child
fb26ed18 80118efc c0502000 804044b0 00000000 KiSwapThread+0xb5
fb26ed3c 801289d9 80144fc0 00000008 00000000 KeWaitForSingleObject+0x1c2
Note that the address of the process object can be used as input to other extensions, such as !handle, to obtain further information.
The following table describes some of the elements in the previous example.
Element
WAIT
ElapsedTime
UserTime
KernelTime
Working Set sizes
QuotaPoolUsage
entries
Clone
Private
Meaning
The parenthetical comment after this heading gives the reason for the wait. The command dt nt!_KWAIT_REASON will display a list of all
wait reasons.
Lists the amount of time that has elapsed since the process was created. This is displayed in units of Hours : Minutes : Seconds . Milliseconds.
Lists the amount of time the process has been running in user mode. If the value for UserTime is exceptionally high, it might identify a process that is
depleting system resources. Units are the same as those of ElapsedTime.
Lists the amount of time the process has been running in kernel mode. If the value for KernelTime is exceptionally high, it might identify a process
that is depleting system resources. Units are the same as those of ElapsedTime.
Lists the current, minimum and maximum working set size for the process, in pages. An exceptionally large working set size can be a sign of a
process that is leaking memory or depleting system resources.
Lists the paged and nonpaged pool used by the process. On a system with a memory leak, looking for excessive nonpaged pool usage on all the
processes can tell you which process has the memory leak.
Indicates whether or not the process was created by the POSIX or Interix subsystems.
Indicates the number of private (non-sharable) pages currently being used by the process. This includes both paged in and paged out memory.
In addition to the process list information, the thread information contains a list of the resources on which the thread has locks. This information is listed in the third line of
output after the thread header. In this example, the thread has a lock on one resource, a SynchronizationEvent with an address of 80144fc0. By comparing this address to the
list of locks shown by the !kdext*.locks extension, you can determine which threads have exclusive locks on resources.
The !stacks extension gives a brief summary of the state of every thread. This can be used instead of the !process extension to get a quick overview of the system, especially
when debugging multithread issues, such as resource conflicts or deadlocks.
Additional Information
For information about processes in kernel mode, see Changing Contexts. For more information about analyzing processes and threads, see Microsoft Windows Internals, by
Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!processfields
The !processfields extension displays the names and offsets of the fields within the executive process (EPROCESS) block.
Syntax
!processfields
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Unavailable (see the Comments section)
Comments
This extension command is not available in Windows XP or later versions of Windows. Instead, use the dt (Display Type) command to show the EPROCESS structure
directly:
kd> dt nt!_EPROCESS
Here is an example of !processfields from a Windows 2000 system:
kd> !processfields
EPROCESS structure offsets:
Pcb:
ExitStatus:
LockEvent:
LockCount:
CreateTime:
ExitTime:
LockOwner:
UniqueProcessId:
ActiveProcessLinks:
QuotaPeakPoolUsage[0]:
QuotaPoolUsage[0]:
PagefileUsage:
CommitCharge:
PeakPagefileUsage:
PeakVirtualSize:
VirtualSize:
Vm:
DebugPort:
ExceptionPort:
ObjectTable:
Token:
WorkingSetLock:
WorkingSetPage:
ProcessOutswapEnabled:
ProcessOutswapped:
AddressSpaceInitialized:
AddressSpaceDeleted:
AddressCreationLock:
ForkInProgress:
VmOperation:
VmOperationEvent:
PageDirectoryPte:
LastFaultCount:
VadRoot:
VadHint:
CloneRoot:
NumberOfPrivatePages:
NumberOfLockedPages:
ForkWasSuccessful:
ExitProcessCalled:
CreateProcessReported:
SectionHandle:
Peb:
SectionBaseAddress:
QuotaBlock:
LastThreadExitStatus:
WorkingSetWatch:
InheritedFromUniqueProcessId:
GrantedAccess:
DefaultHardErrorProcessing
LdtInformation:
VadFreeHint:
VdmObjects:
DeviceMap:
0x0
0x6c
0x70
0x80
0x88
0x90
0x98
0x9c
0xa0
0xa8
0xb0
0xb8
0xbc
0xc0
0xc4
0xc8
0xd0
0x120
0x124
0x128
0x12c
0x130
0x150
0x154
0x155
0x156
0x157
0x158
0x17c
0x180
0x184
0x1f0
0x18c
0x194
0x198
0x19c
0x1a0
0x1a4
0x182
0x1aa
0x1ab
0x1ac
0x1b0
0x1b4
0x1b8
0x1bc
0x1c0
0x1c8
0x1cc
0x1d0
0x1d4
0x1d8
0x1dc
0x1e0
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
ImageFileName[0]:
VmTrimFaultValue:
Win32Process:
Win32WindowStation:
0x1fc
0x20c
0x214
0x1c4
Additional Information
For information about the EPROCESS block, see Microsoft Windows Internals, by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!psp
The !psp extension displays the processor state parameter (PSP) register at the specified address.
This extension is supported only on Itanium-based target computers.
Syntax
!psp Address [DisplayLevel]
Parameters
Address
Specifies the hexadecimal address of the PSP register to display.
DisplayLevel
Can be any one of the following options:
0
Displays only the values of each PSP field. This is the default.
1
Displays more in-depth information on each of the PSP fields that is not reserved or ignored.
2
Displays more in-depth information on all of the PSP fields, including those that are ignored or reserved.
DLL
Windows 2000
Unavailable
Windows XP and later Kdexts.dll
!pte
The !pte extension displays the page table entry (PTE) and page directory entry (PDE) for the specified address.
Syntax
Syntax in Windows 2000
!pte
!pte
!pte
!pte
VirtualAddress
PTE
LiteralAddress 1
StartAddress EndAddress
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
StartAddress
(x86 or x64 target computer only; Windows 2000 only) Specifies the first virtual address in a range. All page tables in this range will be displayed.
EndAddress
(x86 or x64 target computer only; Windows 2000 only) Specifies the last virtual address in a range. All page tables in this range will be displayed.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
If one parameter is supplied and this parameter is an address in the region of memory where the page tables are stored, the debugger treats this as the PTE parameter. This
parameter is taken as the actual address of the desired PTE, and the debugger will display this PTE and the corresponding PDE.
If one parameter is supplied and this parameter is not an address in this region, the debugger treats this as the VirtualAddress parameter. The PTE and PDE that hold the
mapping for this address are displayed.
If two parameters are supplied and the second parameter is 1 (or any other small number), the debugger treats the first parameter as LiteralAddress. This address is interpreted
as the actual address of a PTE and also as the actual address of a PDE, and the corresponding (and possibly invalid) data will be shown.
(x86 or x64 target computer only) If two parameters are supplied and the second parameter is greater than the first, the debugger treats the two parameters as StartAddress and
EndAddress. The command then displays the PTEs for each page in the specified memory range.
For a list of all system PTEs, use the !sysptes extension.
Here is an example from an x86 target computer:
kd> !pte 801544f4
801544F4 - PDE at C0300800
PTE at C0200550
contains 0003B163
contains 00154121
pfn 3b G-DA--KWV
pfn 154 G--A--KRV
The first line of this example restates the virtual address being investigated. It then gives the virtual address of the PDE and the PTE, which contain information about the
virtual-physical mapping of this address.
The second line gives the actual contents of the PDE and the PTE.
The third line takes these contents and analyzes them, breaking them into the page frame number (PFN) and the status bits.
See the !pfn extension or the Converting Virtual Addresses to Physical Addresses section for information about how to interpret and use the PFN.
On an x86 or x64 target computer, the status bits for the PDE and the PTE are shown in the following table. The !pte display indicates these bits with capital letters or dashes,
and adds additional information as well.
Meaning
Display Display
when set when clear
0x200 C
Copy on write.
0x100 G
Global.
0x80 L
Large page. This only occurs in PDEs, never in PTEs.
0x40 D
Dirty.
0x20 A
Accessed.
0x10 N
Cache disabled.
0x8 T
Write-through.
0x4 U
K
Owner (user mode or kernel mode).
0x2 W
R
Writeable or read-only. Only on multiprocessor computers and any computer running Windows Vista or later.
0x1 V
Valid.
E
Executable page. For platforms that do not support a hardware execute/noexecute bit, including many x86 systems, the E is always displayed.
Bit
On an Itanium target computer, the status bits for the PDE and the PTE are slightly different from those of the PPE. The Itanium PPE bits are as follows:
Display Display
Meaning
when set when clear
V
Valid.
U
K
Owner (user mode or kernel mode).
D
Dirty.
A
Accessed.
W
R
Writeable or read-only. Only on multiprocessor computers and any computer running Windows Vista or later.
E
Execute.
C
Copy on write.
Additional Information
For information about page tables, page directories, and an explanation of the status bits, see Microsoft Windows Internals, by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!pte2va
The !pte2va extension displays the virtual address that corresponds to the specified page table entry (PTE).
Syntax
!pte2va Address
Address
Specifies the PTE.
DLL
Windows 2000
Unavailable
Windows XP and later Kdexts.dll
Comments
To examine the contents of a specific PTE, use the !pte extension.
Here is an example of the output from the !pte2va extension:
kd> !pte2va 9230
000800000248c000
Additional Information
For information about page tables and PTEs, see Microsoft Windows Internals, by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!ptov
The !ptov extension displays the entire physical-to-virtual map for a given process.
Syntax
!ptov PFN
Parameters
PFN
Specifies the page frame number (PFN) of the directory base for the process. This is the same as the directory base without the final three hexadecimal digits (in other
words, right-shifted 12 bits).
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
Here is an example. First, use the !process extension to determine the directory base of the desired process:
kd> !process 0 0
**** NT ACTIVE PROCESS DUMP ****
....
PROCESS ff779190 SessionId: 0 Cid: 04fc
Peb: 7ffdf000 ParentCid: 0394
DirBase: 098fd000 ObjectTable: e1646b30 TableSize:
8.
Image: MyApp.exe
In this case, the directory base is 0x098FD000. Discard the three trailing zeros. The result is 0x098FD. This is the page frame number (PFN) of the directory base.
Pass this number to !ptov:
kd> !ptov 98fd
7119000 10000
a21a000 20000
6133000 12e000
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
9de9000 12f000
2b0c000 130000
87cd000 131000
aaf6000 140000
...
...
The numbers in the left column are the physical addresses of each memory page that has a mapping for this process. The numbers in the right column are the virtual addresses
to which they are mapped.
The total display is very long.
Additional Information
For related topics, see !vtop and Converting Virtual Addresses to Physical Addresses. For information about page tables and page directories, see Microsoft Windows
Internals, by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!qlocks
The !qlocks extension displays the state of all queued spin locks.
Syntax
!qlocks
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
This command is useful only on a multiprocessor system.
Here is an example:
0: kd> !qlocks
Key: O = Owner, 1-n = Wait order, blank = not owned/waiting, C = Corrupt
Lock Name
KE
KE
MM
MM
CC
CC
EX
IO
EX
IO
IO
IO
NTFS
AFD
CC
MM
Processor Number
1 2 3
Dispatcher
Unused Spare
PFN
System Space
Vacb
Master
NonPagedPool
Cancel
WorkQueue
Vpb
Database
Completion
Struct
WorkQueue
Bcb
MM NonPagedPool
Additional Information
For information about spin locks, see the Windows Driver Kit (WDK) documentation and Microsoft Windows Internals, by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!ready
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The !ready extension displays summary information about each thread in the system in a READY state.
Syntax
!ready [Flags]
Parameters
Flags
Specifies the level of detail to display. Flags can be any combination of the following bits. If Flags is 0, only a minimal amount of information is displayed. The default
is 0x6.
Bit 1 (0x2)
Causes the display to include the thread's wait states.
Bit 2 (0x4)
If this is included without Bit 1 (0x2), this has no effect. If this is included along with Bit 1, the thread is displayed with a stack trace.
Bit 3 (0x8)
(Windows XP and later) Causes the display of each function to include the return address, the stack pointer, and (on Itanium systems) the bsp register value. The
display of function arguments is suppressed.
Bit 4 (0x10)
(Windows XP and later) Causes the display of each function to include only the return address; arguments and stack pointers are suppressed.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
The output from this extension is similar to that of !thread, except that only ready threads are displayed, and they are sorted in order of decreasing priority.
Additional Information
For information about thread scheduling and the READY state, see Microsoft Windows Internals, by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!reg
The !reg extension displays and searches through registry data.
Syntax
!reg
!reg
!reg
!reg
!reg
!reg
!reg
!reg
!reg
!reg
!reg
!reg
!reg
!reg
!reg
!reg
!reg
!reg
!reg
kcb Address
knode Address
kbody Address
kvalue Address
valuelist HiveAddress KeyNodeAddress
subkeylist HiveAddress KeyNodeAddress
cellindex HiveAddress Index
baseblock HiveAddress
seccache HiveAddress
hashindex HashKey
openkeys {HiveAddress|0}
findkcb Path
hivelist
viewlist HiveAddress
freebins HiveAddress
freecells BinAddress
dirtyvector HiveAddress
freehints HiveAddress
dumppool [s|r]
Parameters
kcb Address
Displays a registry key control block. Address specifies the address of the key control block.
knode Address
Displays a registry key node structure. Address specifies the address of the key node.
kbody Address
Displays a registry key body (KBODY) structure. Address specifies the address of the key body. (Registry key bodies are the actual objects associated with handles.)
kvalue Address
Displays a registry key value structure. Address specifies the address of the value.
valuelist HiveAddress KeyNodeAddress
Displays a list of the values in the specified key node. HiveAddress specifies the address of the hive. KeyNodeAddress specifies the address of the key node.
subkeylist HiveAddress KeyNodeAddress
Displays a list of the subkeys of the specified key node. HiveAddress specifies the address of the hive. KeyNodeAddress specifies the address of the key node.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
FileName
\Microsoft\Windows\
ttings\Administrato
emRoot\System32\Con
temRoot\System32\Co
emRoot\System32\Con
<UNKNOWN>
<NONAME>
SYSTEM
<NONAME>
!regkcb
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!rellist
The !rellist extension displays a Plug and Play relation list.
Syntax
!rellist Address [Flags]
Parameters
Address
Specifies the address of the relation list.
Flags
Specifies additional information to include in the display. This can be any combination of the following bits (the default is zero):
Bit 1 (0x2)
Causes the display to include the CM_RESOURCE_LIST. The display also includes the boot resources list, if it is available.
Bit 2 (0x4)
Causes the display to include the resource requirements list (IO_RESOURCE_LIST).
Bit 3 (0x8)
Causes the display to include the translated CM_RESOURCE_LIST.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Additional Information
See Plug and Play Debugging for applications of this extension command. For information about these list structures, see the Windows Driver Kit (WDK) documentation.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!running
The !running extension displays a list of running threads on all processors of the target computer.
Syntax
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
0
1
Prcb
Current
Next
e0000000818f8000 e0000000818f9e50 e0000000866f12f0 ................
e000000086f16010 e00000008620ebe0 e000000086eddbc0 .O..............
The 16 characters at the end of each line indicate the built-in queued spin locks (the LockQueue entries in the PRCB). A period ( . ) indicates that the lock is not in use, O
means the lock is owned by this processor, and W means the processor is queued for the lock. To see more information about the spin lock queue, use !qlocks.
Here is an example that shows active and idle processors, along with their stack traces:
0: kd> !running -it
System Processors f (affinity mask)
Idle Processors f
All processors idle.
Prcb
ffdff120
ChildEBP
8053e3f0
8053e3f0
ffdff980
1
Current
805495a0
Next
................
RetAddr
805329c2 nt!RtlpBreakWithStatusInstruction
80533464 nt!_KeUpdateSystemTime+0x126
ffdff980 nt!KiIdleLoop+0x14
f87e0120
f87e2e60
................
ChildEBP RetAddr
f87e0980 f87e0980 nt!KiIdleLoop+0x14
2
f87f0120
f87f2e60
................
ChildEBP RetAddr
f87f0980 f87f0980 nt!KiIdleLoop+0x14
3
f8800120
f8802e60
................
ChildEBP RetAddr
f8800980 f8800980 nt!KiIdleLoop+0x14
Additional Information
For more information about debugging multiprocessor computers, see Multiprocessor Syntax.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!scm
The !scm extension displays the specified shared cache map.
Syntax
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!scm Address
Parameters
Address
Specifies the address of the shared cache map.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Unavailable
Comments
In Windows XP and later versions of Windows, use the dt nt!_SHARED_CACHE_MAP Address command instead of !scm.
Additional Information
For information about cache management, see the Microsoft Windows SDK documentation and Microsoft Windows Internals by Mark Russinovich and David Solomon.
For information about other cache management extensions, see the !cchelp extension.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!search
The !search extension searches pages in physical memory for pointer-sized data that matches the specified criteria.
Syntax
Syntax in Windows 2000
!search Data [ Delta [ StartPFN [ EndPFN ]]]
!search -?
Syntax in Windows XP and later
!search [-s] [-p] Data [ Delta [ StartPFN [ EndPFN ]]]
!search -?
Parameters
-s
(Windows XP and later) Causes symbol check errors to be ignored during the search. This is useful if you are getting too many "incorrect symbols for kernel" errors.
-p
(Windows XP and later) Causes the value of Data to be interpreted as a 32-bit value, preventing any sign extension.
Data
Specifies the data to search for. Data must be the size of a pointer on the target system (32 bits or 64 bits). An exact match for the value of Data is always displayed.
Other matches are displayed as well, depending on the value of Delta; see the Comments section below for details.
Delta
Specifies the allowable difference between a value in memory and the value of Data. See the Comments section below for details.
StartPFN
Specifies the page frame number (PFN) of the beginning of the range to be searched. If this is omitted, the search begins at the lowest physical page.
EndPFN
Specifies the page frame number (PFN) of the end of the range to be searched. If this is omitted, the search ends at the highest physical page.
-?
Displays help for this extension in the Debugger Command window.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
If StartPFN and EndPFN are specified, these are taken as the page frame numbers of the beginning and end of the range in physical memory to be searched. For an
explanation of page frame numbers, see Converting Virtual Addresses to Physical Addresses. If StartPFN and EndPFN are omitted, all physical memory is searched.
In Windows 2000, only the first hit on each page is displayed, unless StartPFN and EndPFN are equal to each other. In Windows XP and later, all hits are displayed.
The !search extension will search through all memory for in the specified page range and examine each ULONG_PTR-aligned value. Values that satisfy at least one of the
following criteria are displayed:
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
If Delta is nonzero: The value differs from Data by at most Delta. In other words, the value lies in the range [Data - Delta, Data + Delta].
If Delta is nonzero: The value differs from the lowest number in the range (Data - Delta) by a single bit.
In most cases, Data will specify an address you are interested in, but any ULONG_PTR sized data can be specified.
Because the debugger's search engine structures reside in memory on the target computer, if you search all of memory (or any range containing these structures) you will see
matches in the area where the structures themselves are located. If you need to eliminate these matches, do a search for a random value; this will indicate where the debugger's
search structures are located.
Here are some examples. The following will search the memory page with PFN 0x237D for values between 0x80001230 and 0x80001238, inclusive:
kd> !search 80001234 4 237d 237d
The following will search the memory pages ranging from PFN 0x2370 to 0x237F for values that are within one bit of 0x0F100F0F. The exact matches are indicated in bold;
the others are off by one bit:
kd> !search 0f100f0f 0 2370 237f
Searching PFNs in range 00002370 - 0000237F for [0F100F0F - 0F100F0F]
Pfn
Offset
- - - - - - - - 0000237B 00000368
0000237C 00000100
0000237D 000003A8
0000237D 000003C8
0000237D 000003E8
0000237D 00000408
0000237D 00000428
Search done.
Hit
Va
- - - - - - - - 0F000F0F 01003368
0F100F0F 01004100
0F100F0F 010053A8
0F100F8F 010053C8
0F100F0F 010053E8
0F100F0F 01005408
0F100F8F 01005428
Pte
- - - - - - - - C0004014
C0004014
C0004014
C0004014
C0004014
C0004014
C0004014
The columns in the display are as follows: Pfn is the page frame number (PFN) of the page; Offset is the offset on that page; Hit is the value at that address; Va is the virtual
address mapped to this physical address (if this exists and can be determined); Pte is the page table entry (PTE).
To calculate the physical address, shift the PFN left three hexadecimal digits (12 bits) and add the offset. For example, the last line in the table is virtual address 0x0237D000
+ 0x428 = 0x02347D428.
Additional Information
For more ways to display and search physical memory, see Reading and Writing Memory.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!searchpte
The !searchpte extension searches physical memory for the specified page frame number (PFN).
Syntax
!searchpte PFN
!searchpte -?
Parameters
PFN
Specifies the PFN in hexadecimal format.
-?
Displays help for this extension in the Debugger Command window.
DLL
Windows 2000
Unavailable
Windows XP and later Kdexts.dll
Comments
To stop execution at any time, press CTRL+BREAK (in WinDbg) or CTRL+C (in KD).
Additional Information
For information about page tables and page directories, see Microsoft Windows Internals, by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!sel
The !sel extension command is obsolete. Use the dg (Display Selector) command instead.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!session
In Windows 2000, the !session extension displays one or more user sessions, or displays a specified process running in multiple user sessions.
In Windows XP and later versions of Windows, the !session extension controls the session context. It can also display a list of all user sessions.
Syntax
Syntax in Windows 2000
!session [SessionID [2 Image]]
Syntax in Windows XP and later
!session
!session -s DefaultSession
!session -?
Parameters
SessionID
(Windows 2000 only) Specifies the session ID for the session to be displayed. If this is -1 or omitted, all sessions are displayed.
2 Image
(Windows 2000 only) Specifies the image name of a process. All processes with this name that belong to the session specified by SessionID are displayed. If Image is
omitted, the csrss.exe process is displayed. Omitting this parameter is an easy way of listing all current user sessions, because every user session contains exactly one
csrss.exe process.
-s DefaultSession
(Windows XP and later) Sets the session context to the specified value. If DefaultSession is -1, the session context is set to the current session.
-?
(Windows XP and later) Displays help for this extension in the Debugger Command window.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
This is really two different extensions. The !session extension in Windows 2000 is used to display information about a user session.
The !session extension in Windows XP and later versions of Windows is used to control the session context. Using !session with no parameters will display a list of active
sessions on the target computer. Using !session /s DefaultSession will change the session context to the new default value.
When you set the session context, the process context is automatically changed to the active process for that session. You should always use .cache forcedecodeptes when
this occurs.
For more details and a list of all the session-related extensions that are affected by the session context, see Changing Contexts.
Additional Information
For information about user sessions and the Session Manager (smss.exe), see Microsoft Windows Internals, by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!smt
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The !smt extension displays a summary of the simultaneous multithreaded processor information.
Syntax
!smt
DLL
Windows 2000
Unavailable
Windows XP and later Kdexts.dll
Comments
Here is an example:
lkd> !smt
SMT Summary:
-----------KeActiveProcessors: **------------------------------ (00000003)
KiIdleSummary: -------------------------------- (00000000)
No PRCB
Set Master SMT Set
IAID
0 820f4820 Master
**------------------------------ (00000003) 00
1 87a4d120 820f4820
**------------------------------ (00000003) 01
Maximum cores per physical processor:
Maximum logical processors per core:
2
1
!spoolsum
The !spoolsum extension summarizes pool information for the current session.
Syntax
!spoolsum [-Option]
!spoolsum -?
Parameters
Option
Can include any combination of the following options:
-n
Specifies that nonpaged pool should be searched.
-p
Specifies that paged pool should be searched.
-f
Specifies that the read failure ranges should be searched.
-?
Displays help for this extension in the Debugger Command window.
DLL
Unavailable
Windows 2000
Windows XP and later Kdexts.dll
Comments
To display pool summary information for a session other than the current session, use the !session extension to set the current session.
If neither -n nor -p is specified in the options, both paged and nonpaged pool are searched.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Additional Information
For information about sessions, see Changing Contexts. For information about memory pools and pool tags, see the Windows Driver Kit (WDK) documentation and
Microsoft Windows Internals, by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!spoolused
The !spoolused extension displays memory use summaries for the paged pool owned by the specified session.
Syntax
!spoolused -p [-s Session] [TagString]]
!spoolused -?
Parameters
-p
This option is always required.
-s Session
Specifies the session that owns the pool to be displayed. Session is always interpreted as a decimal number. If Session equals -1, the current session is used. If Session
equals -2, the session context is used.
TagString
Specifies the pool tag. TagString is a case-sensitive ASCII string. The asterisk (*) can be used to represent any number of characters; the question mark (?) can be used to
represent exactly one character. Unless an asterisk is used, TagString must be exactly four characters in length.
-?
Displays help for this extension in the Debugger Command window.
DLL
Windows 2000
Unavailable
Windows XP and later Kdexts.dll
Additional Information
For information about sessions, see Changing Contexts. For information about memory pools and pool tags, see the Windows Driver Kit or Microsoft Windows Internals, by
Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!sprocess
The !sprocess extension displays information about the specified session process, or about all processes in the specified session.
Syntax
!sprocess Session [Flags [ImageName]]
!sprocess -?
Parameters
Session
Specifies the session that owns the desired process. Session is always interpreted as a decimal number.
Session can have the following values:
-1 Use current session. This is the default.
-2 Use session context.
-4 Display all processes by session.
Flags
Specifies the level of detail in the display. Flags can be any combination of the following bits. The default is 0.
0x0
Display minimal information.
Bit 0
Display time and priority statistics.
(0x1)
Bit 1
Adds to the display a list of threads and events associated with the process and the wait states of the threads.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
(0x2)
Bit 2
(0x4)
Bit 3
(0x8)
Bit 4
(0x10)
Adds to the display a list of threads associated with the process. If this bit is used without Bit 1 (0x2), each thread is displayed on a single line. If this is
included with Bit 1, each thread is displayed with a stack trace.
Adds to the display of each function the return address, the stack pointer and, on Itanium-based systems, the bsp register value. It suppresses the display of
function arguments.
Display only the return address of each function. Suppress the arguments and stack pointers.
ImageName
Specifies the name of the process to be displayed. All processes whose executable image names match ImageName are displayed. The image name must match that in the
EPROCESS block. In general, this is the executable name that was invoked to start the process, including the file extension (usually .exe), and truncated after the
fifteenth character. There is no way to specify an image name that contains a space.
-?
Displays help for this extension in the Debugger Command window. This help text has some omissions.
DLL
Windows 2000
Unavailable
Windows XP and later Kdexts.dll
Comments
The output of this extension is similar to that of !process, except that the addresses of _MM_SESSION_SPACE and _MMSESSION are displayed as well.
Additional Information
For information about sessions and processes in kernel mode, see Changing Contexts. For more information about analyzing processes and threads, see Microsoft Windows
Internals, by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!srb
The !srb extension displays information about a SCSI Request Block (SRB).
Syntax
!srb Address
Parameters
Address
Specifies the hexadecimal address of the SRB on the target computer.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
An SRB is a system-defined structure used to communicate I/O requests from a SCSI class driver to a SCSI port driver.
Additional Information
For information about SRBs, see the Windows Driver Kit (WDK) documentation.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!stacks
The !stacks extension displays information about the kernel stacks.
Syntax
Syntax in Windows 2000:
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!stacks [Detail]
Syntax in Windows XP and later:
!stacks [Detail [FilterString]]
Parameters
Detail
Specifies the level of detail to use in the display. The following table lists the valid values for Detail.
0 Displays a summary of the current kernel stacks. This is the default value.
1 Displays stacks that are currently paged out, as well as the current kernel stacks.
2 Displays the full parameters for all stacks, as well as stacks that are currently paged out and the current kernel stacks.
FilterString
(Windows XP and later only) Displays only threads that contain the specified substring in a symbol.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
The !stacks extension gives a brief summary of the state of every thread. You can use this extension instead of the !process extension to get a quick overview of the system,
especially when debugging multithread issues such as resource conflicts or deadlocks.
The !findstack user-mode extension also displays information about particular stacks.
Here is an example of the simplest !stacks display:
kd> !stacks 0
Proc.Thread .Thread
4.000050
827eea10
ThreadState
Blocked
Blocker
[System]
+0xfe0343a5
[smss.exe]
b0.0000a8
b0.0000c8
b0.0000d0
.....
82723b70
82719620
827d5d50
Blocked
Blocked
Blocked
[csrss.exe]
ntoskrnl!_KiSystemService+0xc4
ntoskrnl!_KiSystemService+0xc4
ntoskrnl!_KiSystemService+0xc4
The first column shows the process ID and the thread ID (separated by a period).
The second column is the current address of the thread's ETHREAD block.
The third column shows the state of the thread (initialized, ready, running, standby, terminated, transition, or blocked).
The fourth column shows the top address on the thread's stack.
Here are examples of more detailed !stacks output:
kd> !stacks 1
Proc.Thread .Thread
4.000008
4.000010
4.000014
4.000018
4.00001c
.....
827d0030
827d0430
827cf030
827cfda0
827cfb10
Blocked
Blocked
Blocked
Blocked
Blocked
Blocker
[System]
ntoskrnl!MmZeroPageThread+0x66
ntoskrnl!ExpWorkerThread+0x189
Stack paged out
Stack paged out
ntoskrnl!ExpWorkerThread+0x189
9c.000098
9c.0000a0
9c.0000a4
82738310
826a5190
82739d30
Blocked
Blocked
Blocked
[smss.exe]
Stack paged out
Stack paged out
Stack paged out
b0.0000bc
b0.0000b4
b0.0000a8
.....
826d0030
826c9030
82723b70
Blocked
Blocked
Blocked
[csrss.exe]
Stack paged out
Stack paged out
ntoskrnl!_KiSystemService+0xc4
kd> !stacks 2
Proc.Thread .Thread
4.000008
827d0030
ThreadState
ThreadState
Blocked
Blocker
[System]
ntoskrnl!KiSwapThread+0xc5
ntoskrnl!KeWaitForMultipleObjects+0x2b4
ntoskrnl!MmZeroPageThread+0x66
ntoskrnl!Phase1Initialization+0xd82
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
4.000010
827d0430
Blocked
ntoskrnl!PspSystemThreadStartup+0x4d
ntoskrnl!CreateSystemRootLink+0x3d8
+0x3f3f3f3f
ntoskrnl!KiSwapThread+0xc5
ntoskrnl!KeRemoveQueue+0x191
.....
Additional Information
For information about kernel stacks, see Microsoft Windows Internals, by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!swd
The !swd extension displays the software watchdog timer states for the specified processor, including the deferred procedure call (DPC) and the watchdog timer states for
threads.
Syntax
!swd [Processor]
Parameters
Processor
Specifies the processor. If Processor is omitted, information is displayed for all processors on the target computer.
DLL
Windows 2000
Unavailable
Windows XP and later Kdexts.dll
Comments
The watchdog timer shuts down or restarts Windows if Windows stops responding. The times are displayed in seconds.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!sysinfo
The !sysinfo extension reads and displays specified SMBIOS, Advanced Configuration and Power Interface (ACPI), and CPU information from a dump file or live system.
Syntax
!sysinfo
!sysinfo
!sysinfo
!sysinfo
!sysinfo
!sysinfo
!sysinfo
!sysinfo
Parameters
cpuinfo
Displays information about the processor.
cpumicrocode
(GenuineIntel processors only) Displays the initial and cached microcode processor versions.
cpuspeed
Displays the maximum and current processor speeds.
gbl
Displays the BIOS list of ACPI tables.
machineid
Displays machine ID information for the SMBIOS, BIOS, firmware, system, and baseboard.
registers
Displays machine-specific registers (MSRs).
smbios
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The gbl parameter works only when the target computer supports ACPI.
The smbios parameter works only when the target computer supports SMBIOS.
The registers parameter does not work on Itanium-based target computers, because they do not collect MSRs.
Microsoft makes every effort to remove personally identifiable information (PII) from these records. All PII is removed from dump files. However, on a live system, some PII
may not yet be removed. As a result, PII fields will be reported as 0 or blank, even if they actually contain information.
To stop execution of commands that include the cpuinfo, gbl, registers, or smbios parameters at any time, press CTRL+BREAK (in WinDbg) or CTRL+C (in KD).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!sysptes
The !sysptes extension displays a formatted view of the system page table entries (PTEs).
Syntax
!sysptes [Flags]
Parameters
Flags
Specifies the level of detail to display. Flags can be any combination of the following bits. The default is zero:
Bit 0 (0x1)
Displays information about free PTEs.
Bit 1 (0x2)
(Windows 2000 only) Displays unused pages in the page usage statistics.
(Windows XP and later) Displays information about free PTEs in the the global special pool.
Bit 2 (0x4)
Displays detailed information about any system PTEs that are allocated to mapping locked pages.)
Bit 3 (0x8)
(Windows 2000 and Windows XP only) Displays nonpaged pool expansion free PTE information. If this bit is set, the other lists are not displayed. If both 0x1 and
0x8 are set, all nonpaged pool expansion free PTEs are displayed. If only 0x8 is set, only the total is displayed.
Bit 4 (0x10)
(Windows Vista and later) Displays special pool free PTE information for the session.
DLL
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
To examine a specific PTE, use the !pte extension.
Here is an example from a Windows 2000 system:
kd> !sysptes 1
System PTE Information
Total System Ptes 50962
SysPtes list of size
SysPtes list of size
SysPtes list of size
SysPtes list of size
SysPtes list of size
1
2
4
8
16
Count
2.
2.
2.
2.
In Windows XP and later versions of Windows, the display is similar, except that the page count statistics at the end are not included. Here is an example from a Windows XP
system:
kd> !sysptes 1
System PTE Information
Total System Ptes 571224
SysPtes list of size 1 has 361 free
SysPtes list of size 2 has 91 free
SysPtes list of size 4 has 48 free
SysPtes list of size 8 has 36 free
SysPtes list of size 9 has 29 free
SysPtes list of size 23 has 29 free
starting PTE: fffffe0059388000
ending PTE:
fffffe00597e3ab8
free ptes: fffffe0059388000
free ptes: fffffe00597be558
free ptes: fffffe00597d2828
free blocks: 3
Additional Information
For information about page tables and PTEs, see Microsoft Windows Internals, by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!thread
The !thread extension displays summary information about a thread on the target system, including the ETHREAD block. This command can be used only during kernelmode debugging.
This extension command is not the same as the .thread (Set Register Context) command.
Syntax
Syntax in Windows 2000:
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
RetAddr
8012d61c
801672a2
80161691
a01772a8
00000000
Args to Child
00000000 e1bc1a08
00000001 00000001
0006ff08 00000000
0006ff08 00000000
00000000 00000000
00000001
000021bf
00000000
00000000
00000000
ntoskrnl!KiSwapThread+0xc5
ntoskrnl!KeWaitForSingleObject+0x1a1
ntoskrnl!ExFreePool+0xb
ntoskrnl!KiSystemService+0xc4
+0xa01772a8
The important information in the !thread display is explained in the following table.
Parameter
Thread address
Thread ID
Thread Environment
Block (TEB)
System Service Dispatch
Table
Thread State
Owning Process
Start Address
User Thread Function
Priority
Stack trace
Meaning
The hexadecimal number after the word THREAD is the address of the ETHREAD block. In the preceding example, the thread address is
0xFF8632C0.
The two hexadecimal numbers after the word Cid are the process ID and the thread ID: process ID.thread ID. In the preceding example, the
process ID is 0x38C, or decimal 908, and the thread ID is 0x380, or decimal 896.
The hexadecimal number after the word Teb is the address of the thread environment block (TEB). In the preceding example, the TEB is located
at address 0x7FFDE000.
The hexadecimal number after the word Win32Thread is the address of the system service dispatch table. In the preceding example, the system
dispatch table is located at address 0xE1BC1A08.
The thread state is displayed at the end of the line that begins with the word WAIT. In the preceding example, the thread is in a non-alertable
state.
The hexadecimal number after the words Owning Process is the address of the EPROCESS for the process that owns this thread.
The hexadecimal number after the words Start Address is the thread start address. This might appear in symbolic form.
The hexadecimal number after the words Win32 Start Address is the address of the user thread function.
The priority information for the thread follows the word Priority.
A stack trace for the thread appears at the end of this display.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Additional Information
For information about threads in kernel mode, see Changing Contexts. For more information about analyzing processes and threads, see Microsoft Windows Internals, by
Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!threadfields
The !threadfields extension displays the names and offsets of the fields within the executive thread (ETHREAD) block.
Syntax
!threadfields
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Unavailable (see the Comments section)
Comments
This extension command is not available in Windows XP or later versions of Windows. Instead, use the dt (Display Type) command to show the ETHREAD structure
directly:
kd> dt nt!_ETHREAD
Here is an example of !threadfields from a Windows 2000 system:
kd> !threadfields
ETHREAD structure offsets:
Tcb:
CreateTime:
ExitTime:
ExitStatus:
PostBlockList:
TerminationPortList:
ActiveTimerListLock:
ActiveTimerListHead:
Cid:
LpcReplySemaphore:
LpcReplyMessage:
LpcReplyMessageId:
ImpersonationInfo:
IrpList:
TopLevelIrp:
ReadClusterSize:
ForwardClusterOnly:
DisablePageFaultClustering:
DeadThread:
HasTerminated:
GrantedAccess:
ThreadsProcess:
StartAddress:
Win32StartAddress:
LpcExitThreadCalled:
HardErrorsAreDisabled:
0x0
0x1b0
0x1b8
0x1c0
0x1c4
0x1cc
0x1d4
0x1d8
0x1e0
0x1e8
0x1fc
0x200
0x208
0x20c
0x214
0x21c
0x220
0x221
0x222
0x224
0x228
0x22c
0x230
0x234
0x238
0x239
Additional Information
For information about the ETHREAD block, see Microsoft Windows Internals, by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!time
The !time extension command is obsolete. Use the .time (Display System Time) command instead.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!timer
The !timer extension displays a detailed listing of all system timer use.
Syntax
!timer
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
The !timer extension displays the timer tree, which stores all timer objects in the system.
Here is an example:
kd> !timer
Dump system timers
Interrupt time: 9f760774 00000000 [12/ 8/2000 10:59:22.685 (Pacific Standard Time)]
List Timer
Interrupt Low/High
Fire Time
0 8016aea0 P 9fbd8e00 00000000 [12/ 8/2000 10:59:23.154]
1 8257f118
e4e4225a 00000000 [12/ 8/2000 11:01:19.170]
3 80165fc0
286be1c9 0000594a [ 4/ 1/2001 01:59:59.215]
80165f40
2a7bf8d9 006f105e [12/31/2099 23:59:59.216]
5 825a0bf8
a952e1c2 00000000 [12/ 8/2000 10:59:39.232]
10 8251c7a8
41f54d84 00000001 [12/ 8/2000 11:03:55.310]
8249fe88
41f54d84 00000001 [12/ 8/2000 11:03:55.310]
11 8250e7e8
bc73ffde 00000000 [12/ 8/2000 11:00:11.326]
DPC/thread
ntoskrnl!PopScanIdleList
thread 8257f030
ntoskrnl!ExpTimeZoneDpcRoutine
ntoskrnl!ExpCenturyDpcRoutine
thread 825a0b10
thread 8251c6c0
thread 8249fda0
thread 8250e700
.....
237 82757070
82676348
82728b78
238 fe4b5d78
801658f0
239 8259ad40
250 826d42f0
9f904152
9f904152
9f904152
9f92a3ac
9f92a3ac
765a6f19
1486bed8
00000000
00000000
00000000
00000000
00000000
00000bba
80000000
+f7a56f2e
+fe516352
+fe516352
thread 827ceb10
ntoskrnl!CcScanDpc
thread 825d3670
thread 825fa030
!tokenfields
The !tokenfields extension displays the names and offsets of the fields within the access token object (the TOKEN structure).
Syntax
!tokenfields
DLL
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Windows 2000
Kdextx86.dll
Windows XP and later Unavailable (see the Comments section)
Comments
This extension command is not available in Windows XP or later versions of Windows. Instead, use the dt (Display Type) command to show the TOKEN structure directly:
kd> dt nt!_TOKEN
To see a specific instance of the TOKEN structure, use the !token extension.
Here is an example of !tokenfields from a Windows 2000 system:
kd> !tokenfields
TOKEN structure offsets:
TokenSource:
AuthenticationId:
ExpirationTime:
ModifiedId:
UserAndGroupCount:
PrivilegeCount:
VariableLength:
DynamicCharged:
DynamicAvailable:
DefaultOwnerIndex:
DefaultDacl:
TokenType:
ImpersonationLevel:
TokenFlags:
TokenInUse:
ProxyData:
AuditData:
VariablePart:
0x0
0x18
0x28
0x30
0x3c
0x44
0x48
0x4c
0x50
0x54
0x6c
0x70
0x74
0x78
0x79
0x7c
0x80
0x84
Additional Information
For information about the TOKEN structure, see Microsoft Windows Internals, by Mark Russinovich and David Solomon. (The user-mode token structures described in the
Microsoft Windows SDK documentation are slightly different.)
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!trap
The !trap extension command is obsolete. Use the .trap (Display Trap Frame) command instead.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!tss
The !tss extension command is obsolete. Use the .tss (Display Task State Segment) command instead.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!tz
The !tz extension displays the specified power thermal zone structure.
Syntax
!tz [Address]
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Parameters
Address
The address of a power thermal zone that you want to display. If this parameter is omitted, the display includes all thermal zones on the target computer.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
To stop execution at any time, press CTRL+BREAK (in WinDbg) or CTRL+C (in KD).
Additional Information
To view the system's power capabilities, use the !pocaps extension command. To view the system's power policy, use the !popolicy extension command. For information
about power capabilities and power policy, see the Windows Driver Kit (WDK) documentation and Microsoft Windows Internals, by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!tzinfo
The !tzinfo extension displays the contents of the specified thermal zone information structure.
Syntax
!tzinfo Address
Parameters
Address
The address of a thermal zone information structure that you want to display.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Additional Information
To view the system's power capabilities, use the !pocaps extension command. To view the system's power policy, use the !popolicy extension command. For information
about power capabilities and power policy, see the Windows Driver Kit (WDK) documentation and Microsoft Windows Internals, by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!ubc
The !ubc extension clears a user-space breakpoint.
Syntax
!ubc BreakpointNumber
Parameters
BreakpointNumber
Specifies the number of the breakpoint to be cleared. An asterisk (*) indicates all breakpoints.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
This will permanently delete a breakpoint set with !ubp.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
See Also
!ubd, !ube, !ubl, !ubp, User Space and System Space
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!ubd
The !ubd extension temporarily disables a user-space breakpoint.
Syntax
!ubd BreakpointNumber
Parameters
BreakpointNumber
Specifies the number of the breakpoint to be disabled. An asterisk (*) indicates all breakpoints.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
Disabled breakpoints will be ignored. Use !ube to re-enable the breakpoint.
See Also
!ubc, !ube, !ubl, !ubp, User Space and System Space
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!ube
The !ube extension re-enables a user-space breakpoint.
Syntax
!ube BreakpointNumber
Parameters
BreakpointNumber
Specifies the number of the breakpoint to be enabled. An asterisk (*) indicates all breakpoints.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
This is used to re-enable a breakpoint that was disabled by !ubd.
See Also
!ubc, !ubd, !ubl, !ubp, User Space and System Space
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!ubl
The !ubl extension lists all user-space breakpoints and their current status.
Syntax
!ubl
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
Here is an example of the use and display of user-space breakpoints:
kd> !ubp 8014a131
This command is VERY DANGEROUS, and may crash your system!
If you don't know what you are doing, enter "!ubc *" now!
kd> !ubp 801544f4
kd> !ubd 1
kd> !ubl
0: e ffffffff`8014a131 (ffffffff`82deb000) 1 ffffffff
1: d ffffffff`801544f4 (ffffffff`82dff000) 0 ffffffff
Each line in this listing contains the breakpoint number, the status (e for enabled or d for disabled), the virtual address used to set the breakpoint, the physical address of the
actual breakpoint, the byte position, and the contents of this memory location at the time the breakpoint was set.
See Also
!ubc, !ubd, !ube, !ubp, User Space and System Space
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!ubp
The !ubp extension sets a breakpoint in user space.
Syntax
!ubp Address
Parameters
Address
Specifies the hexadecimal virtual address of the location in user space where the breakpoint is to be set.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
The !ubp extension sets a breakpoint in user space. The breakpoint is set on the actual physical page, not just the virtual page.
Setting a physical breakpoint will simultaneously modify every virtual copy of a page, with unpredictable results. One possible consequence is corruption of the system state,
possibly followed by a bug check or other system crash. Therefore, these breakpoints should be used cautiously, if at all.
This extension cannot be used to set breakpoints on pages that have been swapped out of memory. If a page is swapped out of memory after a breakpoint is set, the breakpoint
ceases to exist.
It is not possible to set a breakpoint inside a page table or a page directory.
Each breakpoint is assigned a breakpoint number. To find out the breakpoint number assigned, use !ubl. Breakpoints are enabled upon creation. To step over a breakpoint,
you must first disable it by using !ubd. To clear a breakpoint, use !ubc.
See Also
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!urb
The !urb extension command is obsolete. Use the dt URB command instead.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!vad
The !vad extension displays details of the virtual address descriptor (VAD) for one or more virtual addresses.
Syntax
!vad VAD-Root [Flags]
Parameters
VAD-Root
Specifies the hexadecimal address of the root of the VAD tree to be displayed.
Flags
Specifies the form the display will take. Possible values include:
0
The entire VAD tree based at VAD-Root is displayed. (This is the default.)
1
Only the VAD specified by VAD-Root is displayed. The display will include a more detailed analysis.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
The address of the root of the VAD for any process can be found by using the !process command.
The !vad command can be very useful when determining what needs to be reloaded when symbols cannot be determined due to paged out memory. For details, see Mapping
Symbols When the PEB is Paged Out.
Here is an example of the !vad extension:
kd> !vad 824bc2f8
VAD
level
82741bf8 ( 1)
824ef368 ( 2)
824bc2f8 ( 0)
8273e508 ( 2)
82643fc8 ( 1)
start
78000
7f6f0
7ffb0
7ffde
7ffdf
Total VADs:
average level:
end
78045
7f7ef
7ffd3
7ffde
7ffdf
commit
8
0
0
1
1
2
Mapped Exe
Mapped
Mapped
Private
Private
EXECUTE_WRITECOPY
EXECUTE_READ
READONLY
EXECUTE_READWRITE
EXECUTE_READWRITE
maximum depth: 2
SecNoChange
Additional Information
For information about virtual address descriptors, see Microsoft Windows Internals, by Mark Russinovich and David Solomon.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!validatelist
The !validatelist extension verifies that the backward and forward links in a doubly-linked list are valid.
Syntax
!validatelist Address
Parameters
Address
The address of the doubly-linked list.
DLL
Windows 2000
Unavailable
Windows XP and later Kdexts.dll
Comments
To stop execution, press Ctrl+Break (in WinDbg) or Ctrl+C (in KD).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!verifier
The !verifier extension displays the status of Driver Verifier and its actions.
Driver Verifier is included in Windows. It works on both checked and free builds. For information about Driver Verifier, see the
Driver Kit (WDK) documentation.
Syntax
Syntax in Windows 2000
!verifier [Flags [Image]]
Syntax in Windows XP and later
!verifier
!verifier
!verifier
!verifier
!verifier
!verifier
!verifier
!verifier
!verifier
!verifier
[Flags [Image]]
4 [Quantity]
8 [Quantity]
0x20 [CompletionTime CancelTime ForceCancellation]
0x40 [Quantity]
0x80 [Quantity]
0x80 Address
0x100 [Quantity]
0x100 Address
?
Parameters
Flags
Specifies what information is displayed in the output from this command. If Flags is equal to the value 4, 8, 0x20, 0x40, 0x80, or 0x100, then the remaining arguments
to !verifier are interpreted based on the the specific arguments associated with those values. If Flags is equal to any other value, even if one or more of these bits are set,
only the Flags and Image arguments are permitted. Flags can be any sum of the following bits; the default is 0:
Bit 0 (0x1)
Displays the names of all drivers being verified. The number of bytes currently allocated to each driver from the nonpaged pool and the paged pool is also displayed.
Bit 1 (0x2)
Displays information about pools (pool size, headers, and pool tags) and outstanding memory allocations left by unloaded drivers. This flag has no effect unless bit 0
(0x1) is also set.
Bit 2 (0x4)
(Windows XP and later) Displays fault injection information. The return address, symbol name, and displacement of the code requesting each allocation are
displayed. If Flags is exactly 0x4 and the Quantity parameter is included, the number of these records displayed can be chosen. Otherwise, four records are
displayed.
Bit 3 (0x8)
(Windows XP and later) Displays the most recent IRQL changes made by the drivers being verified. The old IRQL, new IRQL, processor, and time stamp are
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
displayed. If Flags is exactly 0x8 and the Quantity parameter is included, the number of these records displayed can be chosen. Otherwise, four records are
displayed.
Bit 5 (0x20)
(Windows Vista and later) Displays information related to the Driver Hang Verification option of Driver Verifier. If the CompletionTime, CancelTime, and
ForceCancellation arguments are specified, these replace the previous the Driver Hang Verification settings.
Bit 6 (0x40)
(Windows Vista and later) Displays information from the Force Pending I/O Requests option of Driver Verifier, including traces from the log of forced pending
IRPs.
The Quantity parameter specifies the number of traces to be displayed. By default, the entire log is displayed.
Bit 7 (0x80)
(Windows Vista and later) Displays information from the kernel pool Allocate/Free log.
The Quantity parameter specifies the number of traces to be displayed. By default, the entire log is displayed.
If Address is specified, only traces associated with the specified address within the kernel pool Allocate/Free log are displayed.
Bit 8 (0x100)
(Windows Vista and later) Displays information from the log of IoAllocateIrp, IoCompleteRequest and IoCancelIrp calls.
The Quantity parameter specifies the number of traces to be displayed. By default, the entire log is displayed.
If Address is specified, only traces associated with the specified IRP address are displayed.
Image
If Flags is used and is not equal to 4, 8, or 0x10, Image specifies the name of a driver. Image is used to filter the information displayed by Flags values of 0x1 and 0x2:
only the specified driver is considered. This driver must be currently verified.
Quantity
(Windows XP and later) If Flags is exactly equal to 0x4, Quantity specifies the number of fault injection records to display. If Flags is exactly equal to 0x8, Quantity
specifies the number of IRQL log entries to display. If Flags is exactly equal to 0x40, Quantity specifies the number of traces displayed from the log of forced pending
IRPs. If Flags is exactly equal to 0x80, Quantity specifies the number of traces displayed from the kernel pool Allocate/Free log. If Flags is exactly equal to 0x100,
Quantity specifies the number of traces displayed from the log of IoAllocateIrp, IoCompleteRequest and IoCancelIrp calls.
CompletionTime
(Windows Vista and later) Specifies the time limit for completing an IRP, in milliseconds. The default value is 0x2710 (10 seconds). If the driver exceeds this limit, the
completion routine is reported in the Driver Hang Verification log. When CompletionTime is 0, Driver Verifier does not monitor IRP completion. This Driver Hang
Verification parameter is supported only when Flags is exactly equal to 0x20.
CancelTime
(Windows Vista and later) Specifies the time limit for canceling an IRP, in milliseconds. The default value is 0x1388 (5 seconds). If the driver exceeds this limit, the
cancellation routine is reported in the Driver Hang Verification log. When CancelTime is 0, Driver Verifier does not monitor IRP cancellation. This Driver Hang
Verification parameter is available only when Flags is exactly equal to 0x20.
ForceCancellation
(Windows Vista and later) Enables or disables the cancellation of IRPs that do not complete within the time specified by CompletionTime. To enable forced cancellation,
set ForceCancellation to 1. To disable forced cancellation, set ForceCancellation to 0. The default is 0. This Driver Hang Verification parameter is available only when
Flags is exactly equal to 0x20.
?
(Windows XP and later) Displays some brief Help text for this extension in the Debugger Command window.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
When using Driver Verifier to test graphics drivers, use the !gdikdx.verifier extension instead of !verifier.
The values of 4, 8, and 0x20, 0x40, 0x80, and 0x100 are special values for Flags. If these values are used, the special arguments listed in the Parameters section can be used,
and the display will include only the information associated with that flag value.
If any other value for Flags is used, even if one or more of these bits are set, only the Flags and Image arguments are permitted. In this situation, in addition to all the other
information displayed, !verifier will display the Driver Verifier options that are active, along with statistics on pool allocations, IRQL raises, spin locks, and trims.
If Flags equals 0x20, the values specified for CompletionTime, CancelTime, and ForceCancellation are used by the Driver Hang Verification option of Driver Verifier. These
new values take effect immediately and last until the next boot. When you reboot, they revert to their default values.
Also, if Flags equals 0x20 (with or without additional parameters), the Driver Hang Verification log is printed. For information on interpreting the log, see the Driver Hang
Verification section of the Driver Verifier documentation in the Windows Driver Kit (WDK) documentation.
Here is an example of the !verifier extension on a Windows XP computer. Notice that the display is sorted by driver name:
kd> !verifier 0xf
Verify Level 1f ... enabled options are:
special pool
special irql
inject random pool failures
all pool allocations checked on unload
Io subsystem checking enabled
Summary of All Verifier Statistics
RaiseIrqls
0x0
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
AcquireSpinLocks
Synch Executions
Trims
Pool
Pool
Pool
Pool
Pool
Pool
Allocations
Allocations
Allocations
Allocations
Allocations
Allocations
0x22a
0xbcd7
0x20e
Attempted
Succeeded
Succeeded SpecialPool
With NO TAG
Failed
Failed Deliberately
0x48
0x48
0x48
0x0
0x0
0x0
0x8
0xa
0xb
0xb
for
for
for
for
000002D8
00000494
00003038
00003038
bytes
bytes
bytes
bytes
State
NonPagedPool
PagedPool
Module
fe527df8 Loaded
00002094
000002b8
ftdisk.sys
00000007
000002b8
00000009
00000338
PoolAddress
f7b1bff0
f7b1df88
f7bfbfd0
fe4e4000
f7c19ff8
f7c2bfb0
f7c2df60
f7c47fe0
f7c73f60
f7c8dfe0
f7cb9f60
f7cd3fe0
Tag
ScFt
ScFt
ScFt
ScFt
ScFt
ScFt
ScFt
ScFt
ScFt
ScFt
ScFt
ScFt
CallersAddress
fdbac7af
fdbb6e9f
fdbac7af
fdba01e6
fdba2677
fdbac2c1
fdba672e
fdba6968
fdba672e
fdba6968
fdba672e
fdba6968
fe527d68 Loaded
00000f84
00000000
00000000
00000000
00000002
000001bc
PoolAddress
f8a6ff40
f8a71f88
f8cf1b50
f93bb6a0
f93b9fc0
SizeInBytes
0x00000010
0x00000078
0x00000030
0x00002000
0x00000004
0x00000050
0x000000a0
0x00000020
0x000000a0
0x00000020
0x000000a0
0x00000020
00000005
00002094
00000005
00002094
00000005
00000f84
00000005
00000f84
Tag
8042
8042
8042
8042
8042
CallersAddress
fdde2eec
fdde2f3e
fdddf64c
fdde0990
fdddfd0e
fe527cd8 Loaded
00000020
00000020
00000001
00000020
00000001
00000020
PoolAddress
f93abfe0
f93affe0
SizeInBytes
0x000000c0
0x00000074
0x000004b0
0x00000960
0x00000040
SizeInBytes
0x00000020
0x00000020
Tag
Flop
Flop
i8042prt.sys
flpydisk.sys
00000001
00000020
00000001
00000020
CallersAddress
fdf5dcb5
fdf5b75d
FFFFFFFFFE4FA880
0
2
0
5B97C
FFFFFFFF80535D9E ntoskrnl!VerifierKfAcquireSpinLock+0x28
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
FFFFFFFFFDB9ED56
FFFFFFFFFDB9F2CA
FFFFFFFF804175BD
FFFFFFFFFDBEA69B
Thread:
Old irql:
New irql:
Processor:
Time stamp:
+0xfffffffffdb9ed56
+0xfffffffffdb9f2ca
ntoskrnl!IopfCallDriver+0x31
+0xfffffffffdbea69b
FFFFFFFFFE4FA880
2
0
0
5B979
FFFFFFFF80535E57
FFFFFFFFFDB9EEED
FFFFFFFFFDB9F2CA
FFFFFFFF804175BD
FFFFFFFFFDBEA69B
Thread:
Old irql:
New irql:
Processor:
Time stamp:
ntoskrnl!VerifierKfReleaseSpinLock+0x67
+0xfffffffffdb9eeed
+0xfffffffffdb9f2ca
ntoskrnl!IopfCallDriver+0x31
+0xfffffffffdbea69b
FFFFFFFFFE4FA880
0
2
0
5B979
FFFFFFFF80535D9E
FFFFFFFFFDB9ED56
FFFFFFFFFDB9F2CA
FFFFFFFF804175BD
FFFFFFFFFDBEA69B
Thread:
Old irql:
New irql:
Processor:
Time stamp:
ntoskrnl!VerifierKfAcquireSpinLock+0x28
+0xfffffffffdb9ed56
+0xfffffffffdb9f2ca
ntoskrnl!IopfCallDriver+0x31
+0xfffffffffdbea69b
FFFFFFFFFE4FA880
2
0
0
5B974
FFFFFFFF80535E57
FFFFFFFFFDB9EEED
FFFFFFFFFDB9F2CA
FFFFFFFF804175BD
FFFFFFFFFDBEA69B
ntoskrnl!VerifierKfReleaseSpinLock+0x67
+0xfffffffffdb9eeed
+0xfffffffffdb9f2ca
ntoskrnl!IopfCallDriver+0x31
+0xfffffffffdbea69b
Here is an example of the !verifier extension on a Windows Vista computer with bit 7 turned on and Address specified.
0: kd> !verifier 80 a2b1cf20
Parsing 00004000 array entries, searching for address a2b1cf20.
=======================================
Pool block a2b1ce98, Size 00000168, Thread a2b1ce98
808f1be6 ndis!ndisFreeToNPagedPool+0x39
808f11c1 ndis!ndisPplFree+0x47
808f100f ndis!NdisFreeNetBufferList+0x3b
8088db41 NETIO!NetioFreeNetBufferAndNetBufferList+0xe
8c588d68 tcpip!UdpEndSendMessages+0xdf
8c588cb5 tcpip!UdpSendMessagesDatagramsComplete+0x22
8088d622 NETIO!NetioDereferenceNetBufferListChain+0xcf
8c5954ea tcpip!FlSendNetBufferListChainComplete+0x1c
809b2370 ndis!ndisMSendCompleteNetBufferListsInternal+0x67
808f1781 ndis!NdisFSendNetBufferListsComplete+0x1a
8c04c68e pacer!PcFilterSendNetBufferListsComplete+0xb2
809b230c ndis!NdisMSendNetBufferListsComplete+0x70
8ac4a8ba test1!HandleCompletedTxPacket+0xea
=======================================
Pool block a2b1ce98, Size 00000164, Thread a2b1ce98
822af87f nt!VerifierExAllocatePoolWithTagPriority+0x5d
808f1c88 ndis!ndisAllocateFromNPagedPool+0x1d
808f11f3 ndis!ndisPplAllocate+0x60
808f1257 ndis!NdisAllocateNetBufferList+0x26
80890933 NETIO!NetioAllocateAndReferenceNetBufferListNetBufferMdlAndData+0x14
8c5889c2 tcpip!UdpSendMessages+0x503
8c05c565 afd!AfdTLSendMessages+0x27
8c07a087 afd!AfdTLFastDgramSend+0x7d
8c079f82 afd!AfdFastDatagramSend+0x5ae
8c06f3ea afd!AfdFastIoDeviceControl+0x3c1
8217474f nt!IopXxxControlFile+0x268
821797a1 nt!NtDeviceIoControlFile+0x2a
8204d16a nt!KiFastCallEntry+0x127
Additional Information
For information about
Driver Verifier page on the Windows Hardware Developer Central (WHDC) Web site.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!vm
The !vm extension displays summary information about virtual memory use statistics on the target system.
Syntax
!vm [Flags]
Parameters
Flags
Specifies what information will be displayed in the output from this command. This can be any sum of the following bits. The default is 0, which causes the display to
include system-wide virtual memory statistics as well as memory statistics for each process.
Bit 0 (0x1)
Causes the display to omit process-specific statistics.
Bit 1 (0x2)
Causes the display to include memory management thread stacks.
Bit 2 (0x4)
(Windows XP and later) Causes the display to include terminal server memory usage.
Bit 3 (0x8)
(Windows XP and later) Causes the display to include the page file write log.
Bit 4 (0x10)
(Windows XP and later) Causes the display to include working set owner thread stacks.
Bit 5 (0x20)
(Windows XP and later) Causes the display to include kernel virtual address usage.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
Here is an example of the short output produced when Flags is 1:
kd> !vm 1
*** Virtual Memory Usage ***
Physical Memory:
16270
(
65080
Page File: \??\E:\pagefile.sys
Current:
98304Kb Free Space:
Minimum:
98304Kb Maximum:
Available Pages:
5543
(
22172
ResAvail Pages:
6759
(
27036
Locked IO Pages:
112
(
448
Free System PTEs:
45089
( 180356
Free NP PTEs:
5145
(
20580
Free Special NP:
336
(
1344
Modified Pages:
714
(
2856
NonPagedPool Usage:
877
(
3508
NonPagedPool Max:
6252
(
25008
PagedPool 0 Usage:
729
(
2916
PagedPool 1 Usage:
432
(
1728
PagedPool 2 Usage:
436
(
1744
PagedPool Usage:
1597
(
6388
PagedPool Maximum:
13312
(
53248
Shared Commit:
1097
(
4388
Special Pool:
229
(
916
Shared Process:
1956
(
7824
PagedPool Commit:
1597
(
6388
Driver Commit:
828
(
3312
Committed pages:
21949
(
87796
Commit limit:
36256
( 145024
Kb)
61044Kb
196608Kb
Kb)
Kb)
Kb)
Kb)
Kb)
Kb)
Kb)
Kb)
Kb)
Kb)
Kb)
Kb)
Kb)
Kb)
Kb)
Kb)
Kb)
Kb)
Kb)
Kb)
Kb)
All memory use is listed in pages and in kilobytes. The most useful information in this display is the following:
Parameter
physical
memory
available pages
nonpaged pool
usage
Meaning
Total physical memory in the system.
Number of pages of memory available on the system, both virtual and physical.
The amount of pages allocated to the nonpaged pool. The nonpaged pool is memory that cannot be swapped out to the paging file, so it must always occupy
physical memory. If this number is too large, this is usually an indication that there is a memory leak somewhere in the system.
Additional Information
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The !memusage extension command can be used to analyze physical memory usage. For more information about memory management, see Microsoft Windows Internals, by
Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!vpb
The !vpb extension displays a volume parameter block (VPB).
Syntax
!vpb Address
Parameters
Address
Specifies the hexadecimal address of the VPB.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
Here is an example. First, the device tree is displayed with the !devnode extension:
kd> !devnode 0 1
Dumping IopRootDeviceNode (= 0x80e203b8)
DevNode 0x80e203b8 for PDO 0x80e204f8
InstancePath is "HTREE\ROOT\0"
State = DeviceNodeStarted (0x308)
Previous State = DeviceNodeEnumerateCompletion (0x30d)
DevNode 0x80e56dc8 for PDO 0x80e56f18
InstancePath is "Root\dmio\0000"
ServiceName is "dmio"
State = DeviceNodeStarted (0x308)
Previous State = DeviceNodeEnumerateCompletion (0x30d)
DevNode 0x80e56ae8 for PDO 0x80e56c38
InstancePath is "Root\ftdisk\0000"
ServiceName is "ftdisk"
State = DeviceNodeStarted (0x308)
Previous State = DeviceNodeEnumerateCompletion (0x30d)
DevNode 0x80e152a0 for PDO 0x80e15cb8
InstancePath is "STORAGE\Volume\1&30a96598&0&Signature5C34D70COffset7E00Length60170A00"
ServiceName is "VolSnap"
TargetDeviceNotify List - f 0xe1250938 b 0xe14b9198
State = DeviceNodeStarted (0x308)
Previous State = DeviceNodeEnumerateCompletion (0x30d)
.....
The last device node listed is a volume. Examine its physical device object (PDO) with the !devobj extension:
kd> !devobj 80e15cb8
Device object (80e15cb8) is for:
HarddiskVolume1 \Driver\Ftdisk DriverObject 80e4e248
Current Irp 00000000 RefCount 14 Type 00000007 Flags 00001050
Vpb 80e15c30 DevExt 80e15d70 DevObjExt 80e15e40 Dope 80e15bd8 DevNode 80e152a0
ExtensionFlags (0000000000)
AttachedDevice (Upper) 80e14c60 \Driver\VolSnap
Device queue is not busy.
The address of this device's VPB is included in this listing. Use this address with the !vpb extension:
kd> !vpb 80e15c30
Vpb at 0x80e15c30
Flags: 0x1 mounted
DeviceObject: 0x80de5020
RealDevice:
0x80e15cb8
RefCount: 14
Volume Label:
MY-DISK-C
Additional Information
For information about VPBs, see the Windows Driver Kit (WDK) documentation and Microsoft Windows Internals, by Mark Russinovich and David Solomon.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!vpdd
The !vpdd extension is obsolete. Use !vtop or !ptov instead.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!vtop
The !vtop extension converts a virtual address to the corresponding physical address, and displays other page table and page directory information.
Syntax
Syntax in Windows 2000
!vtop PFN VirtualAddress
Syntax in Windows XP and later
!vtop PFN VirtualAddress
!vtop 0 VirtualAddress
Parameters
DirBase
Specifies the directory base for the process. Each process has its own virtual address space. Use the !process extension to determine the directory base for a process.
PFN
Specifies the page frame number (PFN) of the directory base for the process.
0
(Windows XP and later) Causes !vtop to use the current process context for address translation.
VirtualAddress
Specifies the virtual address whose page is desired.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
To use this command, first use the !process extension to determine the directory base of the process. The page frame number (PFN) of this directory base can be found by
removing the three trailing hexadecimal zeros (in other words, by right-shifting the number 12 bits).
Here is an example:
kd> !process 0 0
**** NT ACTIVE PROCESS DUMP ****
....
PROCESS ff779190 SessionId: 0 Cid: 04fc
Peb: 7ffdf000 ParentCid: 0394
DirBase: 098fd000 ObjectTable: e1646b30 TableSize:
8.
Image: MyApp.exe
Since the directory base is 0x098FD000, its PFN is 0x098FD.
kd> !vtop 98fd 12f980
Pdi 0 Pti 12f
0012f980 09de9000 pfn(09de9)
Notice how the trailing three zeros are optional. The !vtop extension displays the page directory index (PDI), the page table index (PTI), the virtual address that you had
originally input, the physical address of the beginning of the physical page, and the page frame number (PFN) of the page table entry (PTE).
If you want to convert the virtual address 0x0012F980 to a physical address, you simply have to take the last three hexadecimal digits (0x980) and add them to the physical
address of the beginning of the page (0x09DE9000). This gives the physical address 0x09DE9980.
If you forget to remove the three zeros, and pass the full directory base to !vtop instead of the PFN, the results will usually be correct. This is because when !vtop receives a
number too large to be a PFN, it right-shifts it twelve bits and uses that number instead:
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!walklist
The !walklist extension searches for an address in a session list for the current session.
Syntax
!walklist [-a] [-o Offset] StartAddress SearchAddress
!walklist -?
Parameters
-a
Searches all session lists.
-o Offset
Specifies the offset to the next field in the list.
StartAddress
Specifies the starting address of a session list.
SearchAddress
Specifies the address to search for in the list.
-?
Displays help for this extension in the Debugger Command window.
DLL
Windows 2000
Unavailable
Windows XP and later Kdexts.dll
Additional Information
For information about sessions, see Changing Contexts. For information about memory pools and pool tags, see the Windows Driver Kit (WDK) documentation and
Microsoft Windows Internals, by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wdmaud
Displays a variety of WDM Audio (WDMAud) structures.
Syntax
!wdmaud Address Flags
Parameters
Address
Specifies the address of the structure to be displayed.
Flags
Specifies the information to display. This must include exactly one of the bits 0x1, 0x2, 0x4, and 0x8. The 0x100 bit can be added to any of these.
Bit 0 (0x1)
Displays a list of all IOCTLs that have been sent to wdmaud.sys. When this is used, Address should specify the address of the WdmaIoctlHistoryListHead. If the
0x100 bit is set, the display also includes the pContext that each IOCTL was sent with.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Bit 1 (0x2)
Displays a list of all IRPs that WDMAud has marked as pending. When this is used, Address should specify the address of the WdmaPendingIrpListHead. If the
0x100 bit is set, the display also includes the context on which each IRP was allocated.
Bit 2 (0x4)
Displays a list of all MDLs that WDMAud has allocated. When this is used, Address should specify the address of the WdmaAllocatedMdlListHead. If the 0x100
bit is set, the display also includes the context on which each MDL was allocated.
Bit 3 (0x8)
Displays a list of all active contexts attached to wdmaud.sys. When this is used, Address should specify the address of the WdmaContextListHead. If the 0x100 bit
is set, the display also includes the data members of each context structure.
Bit 8 (0x100)
Causes the display to include verbose information.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Unavailable
Comments
The contexts attached to wdmaud.sys (pContext) contain most of the state data for each device. Whenever wdmaud.drv is loaded into a new process, wdmaud.sys is notified
of its arrival. Whenever wdmaud.drv is unloaded, wdmaud.sys cleans up any allocations made in that context.
Additional Information
For information about WDM audio architecture and audio drivers, see the Windows Driver Kit (WDK) documentation.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!whattime
The !whattime extension converts a tick count into a standard time value.
Syntax
!whattime Ticks
Parameters
Ticks
The number of ticks.
DLL
Windows 2000
Unavailable
Windows XP and later Kdexts.dll
Comments
The output is displayed as HH:MM:SS.mmm. Here is an example:
kd> !whattime 29857ae4
696613604 Ticks in Standard Time:
15:02:16.040s
!whatperftime
The !whatperftime extension converts a high-resolution performance counter value into a standard time value.
Syntax
!whatperftime Count
Parameters
Count
The performance counter clock value.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
DLL
Windows 2000
Unavailable
Windows XP and later Kdexts.dll
Comments
You can use !whatperftime to convert values retrieved by calling QueryPerformanceCounter. Performance counter time values are also found in software traces.
The output is displayed as HH:MM:SS.mmm. Here is an example:
kd> !whatperftime 304589
3163529 Performance Counter in Standard Time: .004.313s
!whea
The !whea extension displays top-level Windows Hardware Error Architecture (WHEA) information.
Syntax
!whea
DLL
Windows 2000
Unavailable
Windows XP
Unavailable
Windows Server 2003
Unavailable
Windows Vista and later Kdexts.dll
This extension can be used only in Windows Vista and later versions of Windows.
Comments
The following example shows the (truncated) output of the !whea extension:
3: kd> !whea
Error Source Table @ fffff800019ca250
13 Error Sources
Error Source 0 @ fffffa80064132c0
Notify Type
: Machine Check Exception
Type
: 0x0 (MCE)
Error Count
: 8
Record Count
: 10
Record Length
: c3e
Error Records
: wrapper @ fffffa8007cf4000
: wrapper @ fffffa8007cf4c3e
: wrapper @ fffffa8007cf587c
: wrapper @ fffffa8007cf64ba
: wrapper @ fffffa8007cf70f8
: wrapper @ fffffa8007cf7d36
: wrapper @ fffffa8007cf8974
: wrapper @ fffffa8007cf95b2
: wrapper @ fffffa8007cfa1f0
: wrapper @ fffffa8007cfae2e
: wrapper @ fffffa8007cfba6c
: wrapper @ fffffa8007cfc6aa
: wrapper @ fffffa8007cfd2e8
: wrapper @ fffffa8007cfdf26
: wrapper @ fffffa8007cfeb64
: wrapper @ fffffa8007cff7a2
Descriptor
: @ fffffa8006413328
Length
: 3cc
Max Raw Data Length
: 392
Num Records To Preallocate : 10
Max Sections Per Record
: 3
Error Source ID
: 0
Flags
: 00000000
Error Source 1 @ fffffa8007d00bc0
Notify Type
: Corrected Machine Check
Type
: 0x1 (CMC)
Error Count
: 0
Record Count
: 10
record
record
record
record
record
record
record
record
record
record
record
record
record
record
record
record
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
fffffa8007cf4030
fffffa8007cf4c6e
fffffa8007cf58ac
fffffa8007cf64ea
fffffa8007cf7128
fffffa8007cf7d66
fffffa8007cf89a4
fffffa8007cf95e2
fffffa8007cfa220
fffffa8007cfae5e
fffffa8007cfba9c
fffffa8007cfc6da
fffffa8007cfd318
fffffa8007cfdf56
fffffa8007cfeb94
fffffa8007cff7d2
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Record Length
Error Records
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
c3e
wrapper @ fffffa8007d01000
wrapper @ fffffa8007d01c3e
wrapper @ fffffa8007d0287c
wrapper @ fffffa8007d034ba
wrapper @ fffffa8007d040f8
wrapper @ fffffa8007d04d36
wrapper @ fffffa8007d05974
wrapper @ fffffa8007d065b2
wrapper @ fffffa8007d071f0
wrapper @ fffffa8007d07e2e
wrapper @ fffffa8007d08a6c
wrapper @ fffffa8007d096aa
wrapper @ fffffa8007d0a2e8
wrapper @ fffffa8007d0af26
wrapper @ fffffa8007d0bb64
wrapper @ fffffa8007d0c7a2
Descriptor
@ fffffa8007d00c28
Length
: 3cc
Max Raw Data Length
: 392
Num Records To Preallocate : 10
Max Sections Per Record
: 3
Error Source ID
: 1
Flags
: 00000000
Error Source 2 @ fffffa8007d00770
Notify Type
: Non-Maskable Interrupt
Type
: 0x3 (NMI)
Error Count
: 1
Record Count
: 1
Record Length
: 1f8
Error Records
: wrapper @ fffffa800631b2c0
Descriptor
: @ fffffa8007d007d8
Length
: 3cc
Max Raw Data Length
: 100
Num Records To Preallocate : 1
Max Sections Per Record
: 1
Error Source ID
: 2
Flags
: 00000000
Error Source 3 @ fffffa8007d0dbc0
Notify Type
: BOOT Error Record
Type
: 0x7 (BOOT)
Error Count
: 0
Record Count
: 1
Record Length
: 4f8
Error Records
: wrapper @ 0000000000000000
Descriptor
: @ fffffa8007d0dc28
Length
: 3cc
Max Raw Data Length
: 400
Num Records To Preallocate : 1
Max Sections Per Record
: 1
Error Source ID
: 3
Flags
: 00000000
record
record
record
record
record
record
record
record
record
record
record
record
record
record
record
record
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
fffffa8007d01030
fffffa8007d01c6e
fffffa8007d028ac
fffffa8007d034ea
fffffa8007d04128
fffffa8007d04d66
fffffa8007d059a4
fffffa8007d065e2
fffffa8007d07220
fffffa8007d07e5e
fffffa8007d08a9c
fffffa8007d096da
fffffa8007d0a318
fffffa8007d0af56
fffffa8007d0bb94
fffffa8007d0c7d2
record @ fffffa800631b2f0
record @ 0000000000000030
. . . .
Additional Information
The !errrec and !errpkt extensions can be used to display additional WHEA information. For general information about WHEA, see
Architecture (WHEA) in the Windows Driver Kit (WDK) documentation.
!wsle
The !wsle extension displays all working set list entries (WSLEs).
Syntax
Syntax in Windows 2000
!wsle [DisplayMode [Address]]
Syntax in Windows XP and later
!wsle [Flags [Address]]
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Parameters
DisplayMode
(Windows 2000 only) Specifies the information to include in the display. This can be one of the following values (the default is zero):
0
Displays only basic information about the working set list.
7
Displays basic information about the working set list, plus information about each WSLE's address, age, lock status, and reference count. If a WSLE has an invalid
page table entry (PTE) or page directory entry (PDE) associated with it, this is displayed as well.
8
Displays basic information about the working set list, plus the index and value of each WSLE.
Flags
(Windows XP and later) Specifies the information to include in the display. This can be any combination of the following bits. The default is zero. If this is used, only
basic information about the working set is displayed.
Bit 0 (0x1)
Causes the display to include information about each WSLE's address, age, lock status, and reference count. If a WSLE has an invalid page table entry (PTE) or page
directory entry (PDE) associated with it, this is also displayed.
Bit 1 (0x2)
Causes the display to include the total number of valid WSLEs, the index of the last WSLE, and the index of the first free WSLE.
Bit 2 (0x4)
Causes the display to include the total number of free WSLEs, as well as the index of each free WSLE. If bit 1 is also set, then a check is done to make sure that the
number of free WSLEs plus the number of valid WSLEs is actually equal to the total number of WSLEs.
Address
Specifies the address of the working set list. If this is omitted, the default working set list is used. (In Windows 2000, specifying -1 for Address is the same as omitting it.
In Windows XP and later versions of Windows, specifying zero for Address is the same as omitting it.)
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Kdexts.dll
Comments
This extension can take a significant amount of time to execute.
Here is an example from an x86 target computer running Windows Server 2003:
kd> !wsle 3
Working Set @ c0503000
FirstFree:
a7 FirstDynamic:
LastEntry
23d NextSlot:
NonDirect
65 HashTable:
4
0
4
LastInitialized
HashTableSize:
259
0
Age
0
0
0
0
0
3
2
0
Locked
1
1
1
1
0
0
0
0
ReferenceCount
1
1
1
1
1
1
1
1
.....
Reading the WSLE data...
Valid WSLE entries = 0xa7
found end @ wsle index 0x259
.....
Additional Information
For information about working sets, see the Windows Driver Kit (WDK) documentation and Microsoft Windows Internals, by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!xpoolmap
(Windows XP only.) The !xpoolmap extension displays a map of pool use.
Syntax
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!xpoolmap [Pool]
!xpoolmap -?
Parameters
Pool
Specifies the paged or nonpaged pool. Use 0 or 1. 0 represents the non-paged pool. 1 represents the paged pool. 0 is the default.
-?
Displays help for this extension in the Debugger Command window.
DLL
Windows 2000
Unavailable
Windows XP and later Kdexts.dll
This extension command can only be used with an x86-based target computer.
Comments
The !xpoolmap extension is supported only on Windows XP. On Windows 2000, use !kdex2x86.xpool -map. This extension is part of the OEM Support Extensions package.
For information about installing this package, see OEM Support Extensions (kdex2x86.dll).
Here is a partial example:
0: kd> !xpoolmap
unable to get nt!MmSubsectionTopPage
unable to get nt!MmNonPagedMustSucceed
.....................................................
Status Map of Pool Area Pages
==============================
'O': one page in use
('P':
'<': start page of contiguous pages in use
('{':
'>': last page of contiguous pages in use
('}':
'=': intermediate page of contiguous pages in use ('-':
'.': one page not used
paged
paged
paged
paged
out)
out)
out)
out)
+30000 +38000
OOOOOOOOOOOOOOOO
OOOOOOOOOOOOOOOO
OOOOOOOOOOOOOOOO
...
86753000:
86793000:
867d3000:
f7fba000:
f7ffa000:
f803a000:
f807a000:
OOOOOOOOOOOOOOOO
OOOOOOOOOOOOOOOO
OOOOOOOOOOOOOOOO
.>OOOOOOOOO<====
OOOO<=><><=><===
>O<===><==>OOOOO
><>OOOOO<=>O<=>O
OOOOOOOOOOOOOOOO
OOOOOOOOOOOOOOOO
OOOOOOOOOOOOOOOO
>O<=><>OOOO<><>O
>OOOO<>OO<=><>OO
OOOOOOOOOOOOO<=>
<>OOOOOOOO<==>OO
OOOOOOOOOOOOOOOO
OOOOOOOOOOOOOOOO
OOOOOOOOOOOO<
O<=======>OOOO<=
OOO<><=>O<=====>
OOOOO<=>O<==><>O
<>OOOOOOO<====>O
OOOOOOOOOOOOOOOO
OOOOOOOOOOOOOOOO
>OOO<>OOOOOOOOOO
O<>OO<>OOOOOOOOO
<==>OO<>OOOOO<=>
=>OOO<=====>O<==
OOO<==>OOO<>O<>O
O<==>OOOOO<>OO<>
OOOO<=>O<==><===
>OOO<=><=>OOOO<=
OO<=======>OOOOO O<===>OOOOOOOOOO
OO<=>O<=><>OOOO< >OOOOOOOOOOO<><>
====>OOOO<>OOOOO OOO<>O<>OOO<==><
>OO<=.
>OO<>OOOOOOOOOOO
<=>OOOOO<>O<==><
OOO<>OO<=====><=
<>OO<><>OOOOO<>O
...
ffafa000:
ffb3a000:
ffb7a000:
ffbba000:
!zombies
The !zombies extension displays all dead ("zombie") processes or threads.
Syntax
!zombies [Flags [RestartAddress]]
Parameters
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Flags
Specifies what will be displayed. Possible values include:
1
Displays all zombie processes. (This is the default.)
2
Displays all zombie threads.
RestartAddress
Specifies the hexadecimal address at which to begin the search. This is useful if the previous search was terminated prematurely. The default is zero.
DLL
Windows 2000
Kdextx86.dll
Windows XP and later Unavailable
Comments
Zombie processes are dead processes that have not yet been removed from the process list. Zombie threads are analogous.
This extension is available only for Windows 2000.
Additional Information
To see a list of all processes and threads, use the !process extension.
For general information about processes and threads in kernel mode, see Changing Contexts. For more information about analyzing processes and threads, see Microsoft
Windows Internals, by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
User-Mode Extensions
This section of the reference describes extension commands that are primarily used during user-mode debugging.
The debugger will automatically load the proper version of these extension commands. Unless you have manually loaded a different version, you do not have to keep track of
the DLL versions being used. See Using Debugger Extension Commands for a description of the default module search order. See Loading Debugger Extension DLLs for an
explanation of how to load extension modules.
Each extension command reference page lists the DLLs that expose that command. Use the following rules to determine the proper directory from which to load this extension
DLL:
If your target application is running on the free build of Windows 2000, use w2kfre\Ntsdexts.dll.
If your target application is running on the checked build of Windows 2000, use w2kchk\Ntsdexts.dll.
If your target application is running on Windows XP or a later version of Windows, use winxp\Ntsdexts.dll.
In addition, user-mode extensions that are not specific to any single operating system can be found in winext\Uext.dll.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!avrf
The !avrf extension controls the settings of Application Verifier and displays a variety of output produced by Application Verifier.
Syntax
!avrf
!avrf
!avrf
!avrf
!avrf
!avrf
!avrf
!avrf
!avrf
!avrf
!avrf
!avrf
!avrf
!avrf
!avrf
-a Address
-cs { Length | -a Address }
-hp { Length | -a Address }
-vs { Length | -a Address }
-dlls [ Length ]
-ex [ Length ]
-cnt
-trm
-threads [ThreadID]
-trace TraceIndex
-brk [BreakEventType]
-flt
-flt EventType Probability
-flt break EventType
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Additional Information
For information on how to download and install Application Verifier and its documentation, see Application Verifier.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!critsec
The !critsec extension displays a critical section.
Syntax
!critsec Address
Parameters
Address
Specifies the hexadecimal address of the critical section.
DLL
Windows 2000
Ntsdexts.dll
Windows XP and later Ntsdexts.dll
Comments
If you do not know the address of the critical section, you should use the !ntsdexts.locks extension. This displays all critical sections that have been initialized by calling
RtlInitializeCriticalSection.
Here is an example:
0:000> !critsec 3a8c0e9c
CritSec +3a8c0e9c at 3A8C0E9C
LockCount
1
RecursionCount
1
OwningThread
99
EntryCount
472
ContentionCount
1
*** Locked
Additional Information
For other commands and extensions that can display critical section information, see Displaying a Critical Section. For information about critical sections, see the Microsoft
Windows SDK documentation, the Windows Driver Kit (WDK) documentation, and Microsoft Windows Internals by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!dp (!ntsdexts.dp)
The !dp extension in Ntsdexts.dll displays a CSR process.
This extension command should not be confused with the dp (Display Memory) command, or with the !kdext*.dp extension command.
Syntax
!dp [v] [ PID | CSR-Process ]
Parameters
v
Verbose mode. Causes the display to include structure and thread list.
PID
Specifies the process ID of the CSR process.
CSR-Process
Specifies the hexadecimal address of the CSR process.
DLL
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Windows 2000
Ntsdexts.dll
Windows XP and later Ntsdexts.dll
Comments
This extension displays the process address, process ID, sequence number, flags, and reference count. If verbose mode is selected, additional details are displayed, and thread
information is shown for each process.
If no process is specified, all processes are displayed.
See Also
!dt
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!dreg
The !dreg extension displays registry information.
Syntax
!dreg [-d|-w] KeyPath[!Value]
!dreg
Parameters
-d
Causes binary values to be displayed as DWORDs.
-w
Causes binary values to be displayed as WORDs.
KeyPath
Specifies the registry key path. It can begin with any of the following abbreviations:
hklm
HKEY_LOCAL_MACHINE
hkcu
HKEY_CURRENT_USER
hkcr
HKEY_CLASSES_ROOT
hku
HKEY_USERS
If no abbreviation is used, HKEY_LOCAL_MACHINE is assumed.
Value
Specifies the name of the registry value to be displayed. If an asterisk (*) is used, all values are displayed. If Value is omitted, all subkeys are displayed.
DLL
Windows 2000
Ntsdexts.dll
Windows XP and later Ntsdexts.dll
Comments
The !dreg extension can be used to display the registry during user-mode debugging.
It is most useful during remote debugging, as it allows you to browse the registry of the remote machine. It is also useful when controlling the user-mode debugger from the
kernel debugger, because you cannot run a standard registry editor on the target machine when it is frozen. (You can use the .sleep command for this purpose as well. See
Controlling the User-Mode Debugger from the Kernel Debugger for details.)
It is also useful when debugging locally, as the information is presented in an easily readable format.
If !dreg is used during kernel-mode debugging, the results shown will be for the host computer, and not the target computer. To display raw registry information for the target
computer, use the !reg extension instead.
Here are some examples. The following will display all subkeys of the specified registry key:
!dreg hkcu\Software\Microsoft
The following will display all values in the specified registry key:
!dreg System\CurrentControlSet\Services\Tcpip!*
The following will display the value Start in the specified registry key:
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!dreg System\CurrentControlSet\Services\Tcpip!Start
Typing !dreg without any arguments will display some brief Help text for this extension in the Debugger Command window..
Additional Information
For information about the registry, see the Windows Driver Kit (WDK) documentation and Microsoft Windows Internals by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!dt
The !dt extension displays information about a CSR thread.
This extension command should not be confused with the dt (Display Type) command.
Syntax
!dt [v] CSR-Thread
Parameters
v
Verbose mode.
CSR-Thread
Specifies the hexadecimal address of the CSR thread.
DLL
Windows 2000
Ntsdexts.dll
Windows XP and later Ntsdexts.dll
Comments
This extension displays the thread, process, client ID, flags, and reference count associated with the CSR thread. If verbose mode is selected, the display will also include list
pointers, thread handle, and the wait block.
See Also
!dp (!ntsdexts.dp)
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!evlog
The !evlog extension displays, changes, or backs up the event log.
Syntax
!evlog
!evlog
!evlog
!evlog
!evlog
!evlog
!evlog
!evlog
Parameters
addsource
Adds an event source to the registry. By default, this only adds events from the DebuggerExtensions source (to support !evlog report).
backup
Makes a backup of the specified event log and writes it to a file.
clear
Erases the specified event log, and optionally creates a file recording its old contents.
info
Displays summary information about the event log.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
option
Sets the default search options. These options will be used in future !evlog read commands.
read
Displays a list of events logged to the specified event log. Details of this display such as the number of records displayed and the chronological order of the display
can be controlled by the !evlog read parameters or by a previous use of !evlog option.
report
Writes an event record to the application event log.
-d
Specifies that all default values should be used. The -d option is only required if you are omitting all other parameters. However, with the !evlog option command this
option displays the existing default settings.
-!
With !evlog option, this resets all defaults. With !evlog clear, this prevents a backup file from being written.
Source
Specifies the event source. The default value is DebuggerExtensions.
Type
Specifies the success type. Possible Type values are 1 (Error), 2 (Warning), 4 (Information), 8 (Audit_Success), or 16 (Audit_Failure). A value of 0 represents Success.
For !evlog read and !evlog report, the default is Success (0). For !evlog addsource, these bits can be combined, and the default is all bits (31).
MsgFile
Specifies the path and file name of the message file. If the path is omitted, the directory of the current Uext.dll is used.
EventLog
For !evlog read, !evlog backup, and !evlog clear, EventLog specifies the event log from which to read. The possible values are Application, System, and Security. The
default is Application.
For !evlog option, EventLog specifies the event log whose maximum count is to be set. The possible values are All, Application, System, and Security. The default is
All.
BackupFile
Specifies the path and file name of the backup file. The default location is the current directory. The default file name is EventLog_backup.evt, where EventLog is the
event log used in this command. If this file already exists, the command will be terminated.
Count
Specifies the maximum number of records to retrieve. The default is 20.
-+
Specifies that the current maximum record number should be the highest record number retrieved in future !evlog read commands. (In other words, no records will be
shown as long as the search is performed forward.)
RecordBound
Specifies the highest record number to retrieve in future !evlog read commands. If zero is specified, no bound is set this is the default.
Record
If -n Count is not included, -r Record specifies the record number to retrieve. If -n Count is included, Record specifies the record number at which the display should
begin.
Order
Specifies the search order, either Forwards or Backwards. The default is Forwards. A backward search order causes searches to start from the most recent record
logged to the event log, and continue in reverse-chronological order as matching records are found.
Width
Specifies the data display width, in characters. This is the width displayed in the Data section. The default is 8 characters.
ID
Specifies the prefix to display before the event. Possible values are 0 (no prefix), 1000 (Information), 2000 (Success), 3000 (Warning), and 4000 (Error). The default is 0.
Category
Specifies the event category. Possible values are 0 (no category), 1 (Devices), 2 (Disk), 3 (Printers), 4 (Services), 5 (Shell), 6 (System_Event), and 7 (Network). The
default is 0.
Message
Specifies a text message to add to the event description.
Option
Specifies the !evlog option whose help text is to be displayed.
-?
Displays some brief Help text for this extension or one of its options in the Debugger Command window.
DLL
Windows 2000
Uext.dll
Windows XP and later Uext.dll
The !evlog extension can only be used during live debugging.
Comments
After you have added an event source to the registry with !evlog addsource, you can view the values with !dreg. For example:
0:000> !dreg hklm\system\currentcontrolset\services\eventlog\Application\<source>!*
The !evlog option command is used to set new defaults for the !evlog read command. This lets you avoid retyping all the parameters every time you use !evlog read. Setting
a maximum record bound with the -+ parameter or the -r Records parameter allows you to terminate all searches after a known record number is encountered. This can be
useful if you are only interested in all records logged after a certain event.
Before using !evlog report, you should use !evlog addsource to configure an event source in the registry. After this has been configured, the event viewer will recognize the
various event IDs.
Here is an example of the !evlog info extension:
0:000> !evlog info -?
-------------------------------Application Event Log:
# Records
: 4362
Oldest Record # : 1
Newest Record # : 4362
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Error (1)
Userenv
None (0)
1000 (0xC00003E8)
06/06/2002
18:03:17
(1 strings)
client-side extension Security was passed flags (17) and returned a failure status code of (87).
Error (1)
Userenv
None (0)
1000 (0xC00003E8)
06/06/2002
16:04:08
(1 strings)
client-side extension Security was passed flags (17) and returned a failure status code of (87).
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!findstack
The !findstack extension locates all of the stacks that contain a specified symbol or module.
Syntax
!findstack Symbol [DisplayLevel]
!findstack -?
Parameters
Symbol
Specifies a symbol or module.
DisplayLevel
Specifies what the display should contain. This can be any one of the following values. The default value is 1.
0
Displays only the thread ID for each thread that contains Symbol.
1
Displays both the thread ID and the frame for each thread that contains Symbol.
2
Displays the entire thread stack for each thread that contains Symbol.
-?
Displays some brief Help text for this extension in the Debugger Command window.
DLL
Windows 2000
Uext.dll
Windows XP and later Uext.dll
Comments
The !stacks kernel-mode extension also display information about stacks, including a brief summary of the state of every thread.
The following are some examples of the output from this extension:
0:023> !uext.findstack wininet
Thread 009, 2 frame(s) match
* 06 03eaffac 771d9263 wininet!ICAsyncThread::SelectThread+0x22a
* 07 03eaffb4 7c80b50b wininet!ICAsyncThread::SelectThreadWrapper+0xd
Thread 011, 2 frame(s) match
* 04 03f6ffb0 771cda1d wininet!AUTO_PROXY_DLLS::DoThreadProcessing+0xa1
* 05 03f6ffb4 7c80b50b wininet!AutoProxyThreadFunc+0xb
Thread 020, 6 frame(s) match
* 18 090dfde8 771db73a
* 19 090dfe18 771c5e4d
* 20 090dfe8c 771c5d6a
* 21 090dfe98 771bcb2c
* 22 090dfeb0 771d734a
* 23 090dfee0 77f6ad84
wininet!CheckForNoNetOverride+0x9c
wininet!InternetAutodialIfNotLocalHost+0x220
wininet!ParseUrlForHttp_Fsm+0x135
wininet!CFsm_ParseUrlForHttp::RunSM+0x2b
wininet!CFsm::Run+0x39
wininet!CFsm::RunWorkItem+0x79
wininet!ICSocket::Connect_Start+0x17e
wininet!CFsm_SocketConnect::RunSM+0x42
wininet!CFsm::Run+0x39
wininet!DoFsm+0x25
wininet!ICSocket::Connect+0x32
wininet!HTTP_REQUEST_HANDLE_OBJECT::OpenConnection_Fsm+0x391
wininet!CFsm_OpenConnection::RunSM+0x33
wininet!CFsm::Run+0x39
wininet!CFsm::RunWorkItem+0x79
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!gatom
The !gatom extension displays the global atom table.
Syntax
!gatom
DLL
Windows 2000
Ntsdexts.dll
Windows XP and later Ntsdexts.dll
Additional Information
For information about the global atom table, see the Microsoft Windows SDK documentation.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!igrep
The !igrep extension searches for a pattern in disassembly.
Syntax
!igrep [Pattern [StartAddress]]
Parameters
Pattern
Specifies the pattern to search for. If omitted, the last Pattern is used.
StartAddress
Specifies the hexadecimal address at which to begin searching. If omitted, the current program counter is used.
DLL
Windows 2000
Ntsdexts.dll
Windows XP and later Unavailable
!locks (!ntsdexts.locks)
The !locks extension in Ntsdexts.dll displays a list of critical sections associated with the current process.
This extension command should not be confused with the !kdext*.locks extension command.
Syntax
!locks [Options]
Parameters
Options
Specifies the amount of information to be displayed. Any combination of the following options can be used:
-v
Causes the display to include all critical sections, even those that are not currently owned.
-o
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
(Windows XP and later) Causes the display to only include orphaned information (pointers that do not actually point to valid critical sections).
DLL
Windows 2000
Ntsdexts.dll
Windows XP and later Ntsdexts.dll
Comments
This extension command shows all critical sections that have been initialized by calling RtlInitializeCriticalSection. If there are no critical sections, then no output will
result.
Here is an example:
0:000> !locks
CritSec w3svc!g_pWamDictator+a0 at 68C2C298
LockCount
0
RecursionCount
1
OwningThread
d1
EntryCount
1
ContentionCount
0
*** Locked
CritSec SMTPSVC+66a30 at 67906A30
LockCount
0
RecursionCount
1
OwningThread
d0
EntryCount
1
ContentionCount
0
*** Locked
Additional Information
For other commands and extensions that can display critical section information, see Displaying a Critical Section. For information about critical sections, see the Microsoft
Windows SDK documentation, the Windows Driver Kit (WDK) documentation, and Microsoft Windows Internals by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!mapped_file
The !mapped_file extension displays the name of the file that backs the file mapping that contains a specified address.
Syntax
!mapped_file Address
Parameters
Address
Specifies the address of the file mapping. If Address is not in a mapping, the command fails.
DLL
Windows 2000
Uext.dll
Windows XP and later Uext.dll
The !mapped_file extension can only be used during live, nonremote debugging.
Comments
Here are three examples. The first two addresses used are mapped from a file, and the third is not.
0:000> !mapped_file 4121ec
Mapped file name for 004121ec: '\Device\HarddiskVolume2\CODE\TimeTest\Debug\TimeTest.exe'
0:000> !mapped_file 77150000
Mapped file name for 77150000: '\Device\HarddiskVolume2\Windows\System32\kernel32.dll'
0:000> !mapped_file 80310000
No information found for 80310000: error 87
Additional Information
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!runaway
The !runaway extension displays information about the time consumed by each thread.
Syntax
!runaway [Flags]
Parameters
Flags
Specifies the kind of information to be displayed. Flags can be any combination of the following bits. The default value is 0x1.
Bit 0 (0x1)
Causes the debugger to show the amount of user time consumed by each thread.
Bit 1 (0x2)
Causes the debugger to show the amount of kernel time consumed by each thread.
Bit 2 (0x4)
Causes the debugger to show the amount of time that has elapsed since each thread was created.
DLL
Windows 2000
Uext.dll
Ntsdexts.dll
Windows XP and later Uext.dll
Ntsdexts.dll
The !runaway extension can only be used during live debugging or when debugging crash dump files created by .dump /mt or .dump /ma.
Comments
This extension is a quick way to find out which threads are spinning out of control or consuming too much CPU time.
The display identifies each thread by the debugger's internal thread numbering and by the thread ID in hexadecimal. The debugger IDs are also shown.
Here is an example:
0:001> !runaway 7
User Mode Time
Thread
Time
0:55c
0:00:00.0093
1:1a4
0:00:00.0000
Kernel Mode Time
Thread
Time
0:55c
0:00:00.0140
1:1a4
0:00:00.0000
Elapsed Time
Thread
Time
0:55c
0:00:43.0533
1:1a4
0:00:25.0876
Additional Information
For information about threads in user mode, see Controlling Processes and Threads. For more information about analyzing processes and threads, see Microsoft Windows
Internals by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!threadtoken
The !threadtoken extension displays the impersonation state of the current thread.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Syntax
!threadtoken
DLL
Windows 2000
Ntsdexts.dll
Windows XP and later Unavailable
Comments
The !threadtoken extension is obsolete in Windows XP and later versions of Windows. Use !token instead.
If the current thread is impersonating, the token that this thread is using will be displayed.
Otherwise, a message reading "Thread is not impersonating" will appear. The process token will then be displayed.
Tokens will be displayed in the same format that !handle uses when displaying token handles.
Here is an example:
0:000> ~
. 0 id: 1d0.55c
# 1 id: 1d0.1a4
0:000> !threadtoken
***Thread is not impersonating, using process token***
Auth Id
0 : 0x1c93d
Type
Primary
Imp Level Anonymous
Token Id 0 : 0x5e8c19
Mod Id
0 : 0x5e8c12
Dyn Chg
0x1f4
Dyn Avail 0x1a4
Groups
26
Privs
17
User
S-1-5-21-2127521184-1604012920-1887927527-74790
Groups
26
S-1-5-21-2127521184-1604012920-1887927527-513
S-1-1-0
S-1-5-32-544
S-1-5-32-545
S-1-5-21-2127521184-1604012920-1887927527-277551
S-1-5-21-2127521184-1604012920-1887927527-211604
S-1-5-21-2127521184-1604012920-1887927527-10546
S-1-5-21-2127521184-1604012920-1887927527-246657
S-1-5-21-2127521184-1604012920-1887927527-277552
S-1-5-21-2127521184-1604012920-1887927527-416040
S-1-5-21-2127521184-1604012920-1887927527-96548
S-1-5-21-2127521184-1604012920-1887927527-262644
S-1-5-21-2127521184-1604012920-1887927527-155802
S-1-5-21-2127521184-1604012920-1887927527-158763
S-1-5-21-2127521184-1604012920-1887927527-279132
S-1-5-21-2127521184-1604012920-1887927527-443952
S-1-5-21-2127521184-1604012920-1887927527-175772
S-1-5-21-2127521184-1604012920-1887927527-388472
S-1-5-21-2127521184-1604012920-1887927527-443950
S-1-5-21-2127521184-1604012920-1887927527-266975
S-1-5-21-2127521184-1604012920-1887927527-158181
S-1-5-21-2127521184-1604012920-1887927527-279435
S-1-5-5-0-116804
S-1-2-0
S-1-5-4
S-1-5-11
Privileges
17
SeUndockPrivilege ( Enabled Default )
SeTakeOwnershipPrivilege ( )
SeShutdownPrivilege ( )
SeDebugPrivilege ( )
SeIncreaseBasePriorityPrivilege ( )
SeAuditPrivilege ( )
SeSyncAgentPrivilege ( )
SeLoadDriverPrivilege ( )
SeSystemEnvironmentPrivilege ( Enabled )
SeRemoteShutdownPrivilege ( )
SeProfileSingleProcessPrivilege ( )
SeCreatePagefilePrivilege ( )
SeCreatePermanentPrivilege ( )
SeSystemProfilePrivilege ( Enabled )
SeBackupPrivilege ( )
SeMachineAccountPrivilege ( )
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
SeEnableDelegationPrivilege ( Enabled )
Additional Information
For information about threads and impersonation, see the Microsoft Windows SDK documentation and Microsoft Windows Internals by Mark Russinovich and David
Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!uniqstack
The !uniqstack extension displays all of the stacks for all of the threads in the current process, excluding stacks that appear to have duplicates.
Syntax
!uniqstack [ -b | -v | -p ] [ -n ]
Parameters
-b
Causes the display to include the first three parameters passed to each function.
-v
Causes the display to include frame pointer omission (FPO) information. On x86-based processors, the calling convention information is also displayed.
-p
Causes the display to include the full parameters for each function that is called in the stack trace. This listing will include each parameter's data type, name, and value.
This requires full symbol information.
-n
Causes frame numbers to be displayed.
DLL
Windows 2000
Uext.dll
Windows XP and later Uext.dll
Comments
This extension is similar to the k, kb, kc, kd, kp, kP, kv (Display Stack Backtrace) command, except that it does not display duplicate stacks.
For example:
0:000> !uniqstack
Processing 14 threads, please wait
.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!vadump
The !vadump extension displays all virtual memory ranges and their corresponding protection information.
Syntax
!vadump [-v]
Parameters
-v
Causes the display to include information about each original allocation region as well. Because individual addresses within a region can have their protection altered
after memory is allocated (by VirtualProtect, for example), the original protection status for this larger region may not be the same as that of each range within the
region.
DLL
Windows 2000
Uext.dll
Windows XP and later Uext.dll
Comments
Here is an example:
0:000> !vadump
BaseAddress:
RegionSize:
State:
Protect:
BaseAddress:
RegionSize:
State:
Protect:
Type:
.........
00000000
00010000
00010000
00000001
MEM_FREE
PAGE_NOACCESS
00010000
00001000
00001000
00000004
00020000
MEM_COMMIT
PAGE_READWRITE
MEM_PRIVATE
In this display, the State line shows the state of the memory range beginning at the specified BaseAddress. The possible state values are MEM_COMMIT, MEM_FREE, and
MEM_RESERVE.
The Protect line shows the protection status of this memory range. The possible protection values are PAGE_NOACCESS, PAGE_READONLY, PAGE_READWRITE,
PAGE_EXECUTE, PAGE_EXECUTE_READ, PAGE_EXECUTE_READWRITE, PAGE_WRITECOPY, PAGE_EXECUTE_WRITECOPY, and PAGE_GUARD.
The Type line shows the memory type. The possible values are MEM_IMAGE, MEM_MAPPED, and MEM_PRIVATE.
Here is an example using the -v parameter:
0:000> !vadump -v
BaseAddress:
AllocationBase:
RegionSize:
State:
Protect:
BaseAddress:
AllocationBase:
AllocationProtect:
RegionSize:
State:
Protect:
Type:
.........
00000000
00000000
00010000
00010000
00000001
00010000
00010000
00000004
00001000
00001000
00000004
00020000
MEM_FREE
PAGE_NOACCESS
PAGE_READWRITE
MEM_COMMIT
PAGE_READWRITE
MEM_PRIVATE
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
When -v is used, the AllocationProtect line shows the default protection that the entire region was created with. The Protect line shows the actual protection for this specific
address.
Additional Information
To view memory protection information for a single virtual address, use !vprot. For information about memory protection, see Microsoft Windows Internals by Mark
Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!vprot
The !vprot extension displays virtual memory protection information.
Syntax
!vprot [Address]
Parameters
Address
Specifies the hexadecimal address whose memory protection status is to be displayed.
DLL
Windows 2000
Uext.dll
Ntsdexts.dll
Windows XP and later Uext.dll
Comments
The !vprot extension command can be used for both live debugging and dump file debugging.
Here is an example:
0:000> !vprot 30c191c
BaseAddress: 030c1000
AllocationBase: 030c0000
AllocationProtect: 00000080 PAGE_EXECUTE_WRITECOPY
RegionSize: 00011000
State: 00001000 MEM_COMMIT
Protect: 00000010 PAGE_EXECUTE
Type: 01000000 MEM_IMAGE
In this display, the AllocationProtect line shows the default protection that the entire region was created with. Note that individual addresses within this region can have their
protection altered after memory is allocated (for example, if VirtualProtect is called). The Protect line shows the actual protection for this specific address. The possible
protection values are PAGE_NOACCESS, PAGE_READONLY, PAGE_READWRITE, PAGE_EXECUTE, PAGE_EXECUTE_READ, PAGE_EXECUTE_READWRITE,
PAGE_WRITECOPY, PAGE_EXECUTE_WRITECOPY, and PAGE_GUARD.
The State line also applies to the specific virtual address passed to !vprot. The possible state values are MEM_COMMIT, MEM_FREE, and MEM_RESERVE.
The Type line shows the memory type. The possible values are MEM_IMAGE, MEM_MAPPED, and MEM_PRIVATE.
Additional Information
To view memory protection information for all memory ranges owned by the target process, use !vadump. For information about memory protection, see Microsoft Windows
Internals by Mark Russinovich and David Solomon.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Specialized Extensions
This section of the reference discusses extension commands in the extension DLLs that are used less often.
These include:
Logger Extensions (Logexts.dll)
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!logexts.help
The !logexts.help extension displays a Help text in the Command Prompt window showing all Logexts.dll extension commands.
Syntax
!logexts.help
DLL
Windows 2000
Logexts.dll
Windows XP and later Logexts.dll
Additional Information
For more information, see Logger and LogViewer.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!logexts.logb
The !logexts.logb extension displays or flushes the output buffer.
Syntax
!logexts.logb p
!logexts.logb f
Parameters
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
p
Causes the contents of the output buffer to be displayed in the debugger.
f
Flushes the output buffer to the disk.
DLL
Windows 2000
Logexts.dll
Windows XP and later Logexts.dll
Comments
As a performance consideration, log output is flushed to disk only when the output buffer is full. By default, the buffer is 2144 bytes.
The !logexts.logb p extension displays the contents of the buffer in the debugger.
The !logexts.logb f extension flushes the buffer to the log files. Because the buffer memory is managed by the target application, the automatic writing of the buffer to disk
will not occur if there is an access violation or some other nonrecoverable error in the target application. In such cases, you should use this command to manually flush the
buffer to the disk. Otherwise, the most recently-logged APIs might not appear in the log files.
Additional Information
For more information, see Logger and LogViewer.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!logexts.logc
The !logexts.logc extension displays all API categories, displays all APIs in a specific category, or enables and disables the logging of APIs in one or more categories.
Syntax
!logexts.logc e Categories
!logexts.logc d Categories
!logexts.logc p Category
!logexts.logc
Parameters
e
Enables logging of the specified categories.
d
Disables logging of the specified categories.
Categories
Specifies the categories to be enabled or disabled. If multiple categories are listed, separate them with spaces. An asterisk (*) can be used to indicate all categories.
p
Displays all APIs that belong to the specified category.
Category
Specifies the category whose APIs will be displayed. Only one category can be specified with the p option.
DLL
Windows 2000
Logexts.dll
Windows XP and later Logexts.dll
Comments
Without any options, !logexts.logc will display the current list of available categories and will indicate which ones are enabled and disabled.
If a category is disabled, the hooks for all APIs in that category will be removed so there is no longer any performance overhead. COM hooks are not removed, because they
cannot be re-enabled at will.
Enabling only certain categories can be useful when you are only interested in a particular type of interaction that the program is having with Windows (for example, file
operations). This reduces the log file size and also reduces the effect that Logger has on the execution speed of the process.
The following command will enable the logging of all categories:
0:000> !logexts.logc e *
The following command will disable the logging of category 7:
0:000> !logexts.logc d 7
The following command will enable the logging of categories 13 and 15:
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
0:000> !logexts.logc e 13 15
The following command will display all APIs belonging to category 3:
0:000> !logexts.logc p 3
Additional Information
For more information, see Logger and LogViewer.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!logexts.logd
The !logexts.logd extension disables logging.
Syntax
!logexts.logd
DLL
Windows 2000
Logexts.dll
Windows XP and later Logexts.dll
Comments
This will cause all API hooks to be removed in an effort to allow the program to run freely. COM hooks are not removed, because they cannot be re-enabled at will.
Additional Information
For more information, see Logger and LogViewer.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!logexts.loge
The !logexts.loge extension enables logging. If logging has not been initialized, it will be initialized and enabled.
Syntax
!logexts.loge [OutputDirectory]
Parameters
OutputDirectory
Specifies the directory to use for output. If OutputDirectory is specified, it must exist the debugger will not create it. If a relative path is specified, it will be relative to
the directory from which the debugger was started. If OutputDirectory is omitted, the path to the Desktop will be used. The debugger will create a LogExts subdirectory
of OutputDirectory, and all Logger output will be placed in this subdirectory.
DLL
Windows 2000
Logexts.dll
Windows XP and later Logexts.dll
Comments
If Logger has not yet been injected into the target application by the !logexts.logi extension, the !logexts.loge extension will inject Logger into the target and then enable
logging.
If !logexts.logi has already been run, you cannot include OutputDirectory, because the output directory will have already been set.
Additional Information
For more information, see Logger and LogViewer.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!logexts.logi
The !logexts.logi extension initializes logging by injecting Logger into the target application.
Syntax
!logexts.logi [OutputDirectory]
Parameters
OutputDirectory
Specifies the directory to use for output. If OutputDirectory is specified, it must exist the debugger will not create it. If a relative path is specified, it will be relative to
the directory from which the debugger was started. If OutputDirectory is omitted, the path to the Desktop will be used. The debugger will create a LogExts subdirectory
of OutputDirectory, and all Logger output will be placed in this subdirectory.
DLL
Windows 2000
Logexts.dll
Windows XP and later Logexts.dll
Comments
This command initializes logging, but does not actually enable it. Logging can be enabled with the !logexts.loge command.
Additional Information
For more information, see Logger and LogViewer.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!logexts.logm
The !logexts.logm extension creates or displays a module inclusion list or a module exclusion list.
Syntax
!logexts.logm i Modules
!logexts.logm x Modules
!logexts.logm
Parameters
i
Causes Logger to use a module inclusion list. It will consist of the specified Modules.
x
Causes Logger to use a module exclusion list. It will consist of Logexts.dll, kernel32.dll, and the specified Modules.
Modules
Specifies the modules to be included or excluded. This list is not cumulative; each use of this command creates an entirely new list. If multiple modules are listed,
separate them with spaces. An asterisk (*) can be used to indicate all modules.
DLL
Windows 2000
Logexts.dll
Windows XP and later Logexts.dll
Comments
With no parameters, the !logexts.logm extension displays the current inclusion list or exclusion list.
The extensions !logexts.logm x * and !logexts.logm i are equivalent: they result in a completely empty inclusion list.
The extensions !logexts.logm i * and !logexts.logm x are equivalent: they result in an exclusion list that contains only Logexts.dll and kernel32.dll. These two modules are
always excluded, because Logger is not permitted to log itself.
Here are some examples:
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
0:001> !logm
Excluded modules:
LOGEXTS.DLL
KERNEL32.DLL
USER32.DLL
GDI32.DLL
ADVAPI32.DLL
[mandatory]
[mandatory]
!logexts.logo
The !logexts.logo extension sets or displays the Logger output options.
Syntax
!logexts.logo {e|d} {d|t|v}
!logexts.logo
Parameters
e|d
Specifies whether to enable (e) or disable (d) the indicated output type.
d|t|v
Specifies the output type. Three types of Logger output are possible: messages sent directly to the debugger (d), a text file (t), or a verbose .lgv file (v).
DLL
Windows 2000
Logexts.dll
Windows XP and later Logexts.dll
Comments
If !logexts.logo is used without any parameters, then the current logging status, the output directory, and the current settings for the debugger, text file, and verbose log are
displayed:
0:000> !logo
Logging currently enabled.
Output directory: MyLogs\LogExts\
Output settings:
Debugger
Text file
Verbose log
Disabled
Enabled
Enabled
In the previous example, the output directory is a relative path, so it is located relative to the directory in which the debuggers were started.
To disable verbose logging, you would use the following command:
0:000> !logo d v
Debugger
Text file
Disabled
Enabled
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Verbose log
Disabled
Text file and .lgv files will be placed in the current output directory. To read an .lgv file, use LogViewer.
Additional Information
For more information, see Logger and LogViewer.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!ndiskd.dbglevel
The !ndiskd.dbglevel extension sets the NDIS debug level.
Syntax
!ndiskd.dbglevel [Level]
Parameters
Level
Specifies the amount of debug tracing in NDIS components that are selected within the !ndiskd.dbgsystems extension. If Level is omitted, the current level of debug
tracing is displayed.
Only one level can be selected. The following levels are possible:
Value Meaning
INFO All available debug information is traced. This is the highest level of tracing possible.
LOG Log information is traced.
WARN Warnings and errors are traced.
ERR
Errors are traced.
FATAL Only fatal errors, which can cause the operating system to crash, are traced. This is the lowest level of tracing possible.
DLL
Windows 2000
Ndiskd.dll
Windows XP
Ndiskd.dll
Windows Vista and later Ndiskd.dll
Additional Information
For information about NDIS drivers, see the Windows Driver Kit (WDK) documentation.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!ndiskd.dbgsystems
The !ndiskd.dbgsystems extension controls which NDIS components will transmit debug information.
Syntax
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!ndiskd.dbgsystems [Values]
Parameters
Values
Selects various NDIS components to trace and watch for debug information. If no Values are specified, the current NDIS components selected are displayed.
If multiple components are selected, separate them with spaces. If a previously-selected component is repeated, its debug monitoring will be toggled off. The following
values are possible:
Value
Meaning
INIT
Traces adapter initialization.
CONFIG
Traces adapter configuration.
SEND
Traces sending data over the network.
RECV
Traces receiving data from the network.
PROTOCOL Traces protocol operations.
BIND
Traces binding operations.
BUS_QUERY Traces bus queries.
REGISTRY Traces registry operations.
MEMORY
Traces memory management.
FILTER
Traces filter operations.
REQUEST
Traces requests.
WORK_ITEM Traces work-item operations.
PNP
Traces Plug and Play operations.
PM
Traces Power Management operations.
OPEN
Traces operations that open reference objects.
LOCKS
Traces locking operations.
RESET
Traces resetting operations.
WMI
Traces Windows Management Instrumentation operations.
NDIS_CO
Traces Connection-Oriented NDIS.
REFERENCE Traces reference operations.
DLL
Windows 2000
Ndiskd.dll
Windows XP
Ndiskd.dll
Windows Vista and later Ndiskd.dll
Additional Information
For information about NDIS drivers, see the Windows Driver Kit (WDK) documentation.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!ndiskd.filter
The !ndiskd.mopen extension displays a filter block.
Syntax
!ndiskd.filter FilterBlock
Parameters
FilterBlock
Specifies the address of the filter block to be displayed.
DLL
Windows 2000
Unavailable
Windows XP
Unavailable
Windows Vista and later Ndiskd.dll
Comments
Here is an example:
kd> !filter 0
Filter 00000000:
Miniport 0000000
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
InstanceContext
: 0000000c
NextFilter
: 00000004
FilterDriver
: 00000008
Miniport
: 00000010
FilterFriendlyName : 00000018
State
: Illegal Value
Reference
: 564
FakeStatus
: 572
PendingRequests
: 576
NextGlobalFilter
: 00000244
LowerFilter
: 00000248
HigherFilter
: 0000024c
SendNetBurfferListsHandler
ReceiveNetBufferListsHandler
RequestHandler
PnPEventHandler
CancelSendHandler
00000000,
00000000,
00000000,
00000000,
00000000
SendNetBufferListsCompleteHandler
ReturnNetBufferListsHandler
RequestCompleteHandler
StatusHandler
00000000
00000000
00000000
00000000
Additional Information
For information about NDIS drivers, see the Windows Driver Kit (WDK) documentation.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!ndiskd.filters
The !ndiskd.filters extension displays a list of all filter blocks.
Syntax
!ndiskd.filters
DLL
Windows 2000
Unavailable
Windows XP
Unavailable
Windows Vista and later Ndiskd.dll
Additional Information
For information about NDIS drivers, see the Windows Driver Kit (WDK) documentation.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!ndiskd.findpacket
The !ndiskd.findpacket extension finds the specified packets.
Syntax
!ndiskd.findpacket v VirtualAddress
!ndiskd.findpacket p PoolAddress
Parameters
VirtualAddress
Specifies a virtual address that is contained in the desired packet.
PoolAddress
Specifies a pool address. All unreturned packets in this pool will be displayed.
DLL
Windows 2000
Unavailable
Windows XP
Ndiskd.dll
Windows Vista and later Ndiskd.dll
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Additional Information
For information about NDIS drivers, see the Windows Driver Kit (WDK) documentation.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!ndiskd.gminiports
The !ndiskd.gminiports extension displays a list of all miniports, including those that have not yet started.
Syntax
!ndiskd.gminiports
DLL
Windows 2000
Ndiskd.dll
Windows XP
Ndiskd.dll
Windows Vista and later Ndiskd.dll
Additional Information
For information about NDIS drivers, see the Windows Driver Kit (WDK) documentation.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!ndiskd.help
The !ndiskd.help extension displays a Help text in the Command Prompt window showing all Ndiskd.dll extension commands.
Syntax
!ndiskd.help
DLL
Windows 2000
Ndiskd.dll
Windows XP
Ndiskd.dll
Windows Vista and later Ndiskd.dll
Additional Information
For information about NDIS drivers, see the Windows Driver Kit (WDK) documentation.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!ndiskd.int_ctxt
The !ndiskd.int_ctxt extension displays the second argument of ndisMIsr.
Syntax
!ndiskd.int_ctxt
NDIS_MINIPORT_INTERRUPT
Parameters
NDIS_MINIPORT_INTERRUPT
Specifies the value of the miniport interrupt.
DLL
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Windows 2000
Ndiskd.dll
Windows XP
Unavailable
Windows Vista and later Unavailable
Additional Information
For information about NDIS drivers, see the Windows Driver Kit (WDK) documentation.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!ndiskd.mem
The !ndiskd.mem extension displays a log of all allocated memory, if enabled.
Syntax
!ndiskd.mem
DLL
Windows 2000
Unavailable
Windows XP
Ndiskd.dll
Windows Vista and later Ndiskd.dll
Additional Information
For information about NDIS drivers, see the Windows Driver Kit (WDK) documentation.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!ndiskd.miniport
The !ndiskd.miniport extension displays a miniport block.
Syntax
!ndiskd.miniport MiniportBlock
Parameters
MiniportBlock
Specifies the address of the miniport block to be displayed.
DLL
Windows 2000
Ndiskd.dll
Windows XP
Ndiskd.dll
Windows Vista and later Ndiskd.dll
Comments
Here is an example:
kd> !miniports 81716740
Miniport 81716740 : Microsoft Virtual Ethernet Adapter
AdapterContext : 83f70d60
Flags
: 28442400
PROCESSING_REQUEST, RESOURCES_AVAILABLE,
NOT_BUS_MASTER
<snip>
PnPFlags
: 04410002
RECEIVED_START, NDIS_WDM_DRIVER
Additional Information
For information about NDIS drivers, see the Windows Driver Kit (WDK) documentation.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!ndiskd.miniports
The !ndiskd.miniports extension displays a list of all miniports, except for those that have not yet started.
Syntax
!ndiskd.miniports
DLL
Windows 2000
Ndiskd.dll
Windows XP
Ndiskd.dll
Windows Vista and later Ndiskd.dll
Comments
Here is an example:
kd> !miniports
NDIS Driver verifier level: bb
NDIS Failed allocations
: 0
Miniport Driver Block: 8178c830, Version 1.0
Miniport: 81716740 Microsoft Virtual Ethernet Adapter
Additional Information
For information about NDIS drivers, see the Windows Driver Kit (WDK) documentation.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!ndiskd.mopen
The !ndiskd.mopen extension displays a miniport open block.
Syntax
!ndiskd.mopen MiniportOpenBlock
Parameters
MiniportOpenBlock
Specifies the address of the miniport open block to be displayed.
DLL
Windows 2000
Ndiskd.dll
Windows XP
Ndiskd.dll
Windows Vista and later Ndiskd.dll
Comments
Here is an example:
kd> !mopen 832babd0
Miniport Open block 832babd0
Protocol 8296ced0 = PSCHED, ProtocolContext 8170a008, v5.0
Miniport 81716740 = Microsoft Virtual Ethernet Adapter, v5.0
MiniportAdapterContext: 83f70d60
Flags
: 00000000
References
: 2
Additional Information
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
For information about NDIS drivers, see the Windows Driver Kit (WDK) documentation.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!ndiskd.nb
The !ndiskd.nb extension displays information about a net buffer.
Syntax
!ndiskd.nb NetBuffer Verbosity
Parameters
NetBuffer
Specifies the address of the net buffer.
Verbosity
Specifies the amount of detail to be displayed. This can be any one of the following values:
Value Meaning
1
Displays net buffer fields
2
Displays net buffer MDL chain
3
Displays data
DLL
Windows 2000
Unavailable
Windows XP
Unavailable
Windows Vista and later Ndiskd.dll
Additional Information
For information about NDIS drivers, see the Windows Driver Kit (WDK) documentation.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!ndiskd.nbl
The !ndiskd.nbl extension displays information about a net buffer list.
Syntax
!ndiskd.nbl NetBufferList Verbosity
Parameters
NetBufferList
Specifies the address of the net buffer list.
Verbosity
Specifies the amount of detail to be displayed. This can be any one of the following values:
Value Meaning
1
Displays net buffer list fields
2
Displays net buffer list net buffer chain
3
Displays net buffer list information
4
Displays net buffer list control requests
5
Displays data in all net buffer lists
DLL
Windows 2000
Unavailable
Windows XP
Unavailable
Windows Vista and later Ndiskd.dll
Additional Information
For information about NDIS drivers, see the Windows Driver Kit (WDK) documentation.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!ndiskd.nbpools
The !ndiskd.nbpools extension displays a list of all allocated net buffer list pools.
Syntax
!ndiskd.nbpools
DLL
Windows 2000
Unavailable
Windows XP
Unavailable
Windows Vista and later Ndiskd.dll
Additional Information
For information about NDIS drivers, see the Windows Driver Kit (WDK) documentation.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!ndiskd.ndis
The !ndiskd.ndis extension displays some useful NDIS information.
Syntax
!ndiskd.ndis
DLL
Windows 2000
Unavailable
Windows XP
Ndiskd.dll
Windows Vista and later Ndiskd.dll
Additional Information
For information about NDIS drivers, see the Windows Driver Kit (WDK) documentation.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!ndiskd.pkt
The !ndiskd.pkt extension displays information about a packet.
Syntax
!ndiskd.pkt Packet Verbosity
Parameters
Packet
Specifies the address of the packet.
Verbosity
Specifies the amount of detail to be displayed.
DLL
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Windows 2000
Ndiskd.dll
Windows XP
Ndiskd.dll
Windows Vista and later Ndiskd.dll
Additional Information
For information about NDIS drivers, see the Windows Driver Kit (WDK) documentation.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!ndiskd.pktpool
The !ndiskd.pktpool extension displays the contents of an NDIS packet pool.
Syntax
!ndiskd.pktpool PktPool Number
Parameters
PktPool
Specifies a pointer to the NDIS packet pool.
DLL
Windows 2000
Ndiskd.dll
Windows XP
Unavailable
Windows Vista and later Unavailable
Additional Information
For information about NDIS drivers, see the Windows Driver Kit (WDK) documentation.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!ndiskd.pktpools
The !ndiskd.pktpools extension displays a list of all allocated packet pools.
Syntax
!ndiskd.pktpools
DLL
Windows 2000
Unavailable
Windows XP
Ndiskd.dll
Windows Vista and later Ndiskd.dll
Additional Information
For information about NDIS drivers, see the Windows Driver Kit (WDK) documentation.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!ndiskd.protocol
The !ndiskd.protocol extension displays the contents of a protocol block.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Syntax
!ndiskd.protocol ProtocolBlock
Parameters
ProtocolBlock
Specifies the address of the protocol block.
DLL
Windows 2000
Ndiskd.dll
Windows XP
Ndiskd.dll
Windows Vista and later Ndiskd.dll
Additional Information
For information about NDIS drivers, see the Windows Driver Kit (WDK) documentation.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!ndiskd.protocols
The !ndiskd.protocols extension displays a list of all protocols and their open objects.
Syntax
!ndiskd.protocols
DLL
Windows 2000
Ndiskd.dll
Windows XP
Ndiskd.dll
Windows Vista and later Ndiskd.dll
Additional Information
For information about NDIS drivers, see the Windows Driver Kit (WDK) documentation.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!rpcexts.checkrpcsym
The !rpcexts.checkrpcsym extension command is obsolete; the output from the debugger should be sufficient to diagnose any RPC symbol problems.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!rpcexts.eeinfo
The !rpcexts.eeinfo extension displays the extended error information chain.
Syntax
!rpcexts.eeinfo EEInfoAddress
Parameters
EEInfoAddress
Specifies the address of the extended error information.
DLL
Windows 2000
Unavailable
Windows XP and later Rpcexts.dll
Comments
This extension displays the contents of all records in the extended error information chain.
The records are displayed in order, with the most recent records first. The records are separated by a line of dashes.
Here is an example (in which there is only one record):
0:001> !rpcexts.eeinfo 0xb015f0
Computer Name: (null)
ProcessID: 708 (0x2C4)
System Time is: 3/21/2000 4:3:0:264
Generating component: 8
Status: 14
Detection Location: 311
Flags:
Parameter 0:(Long value) : -30976 (0xFFFF8700)
Parameter 1:(Long value) : 16777343 (0x100007F)
If the chain is very long and you wish to see only one record, use !rpcexts.eerecord instead.
Additional Information
For more information about debugging Microsoft Remote Procedure Call (RPC), see RPC Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!rpcexts.eerecord
The !rpcexts.eerecord extension displays the contents of an extended error information record.
Syntax
!rpcexts.eerecord EERecordAddress
Parameters
EERecordAddress
Specifies the address of the extended error record.
DLL
Windows 2000
Unavailable
Windows XP and later Rpcexts.dll
Comments
This extension displays the contents of one extended error information record in the debugger. In most cases, it is easier to use !rpcexts.eeinfo, which displays the whole
chain. If the chain is very long and you wish to see only one record, use !eerecord instead.
Here is an example:
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!rpcexts.getcallinfo
The !rpcexts.getcallinfo extension searches the system's RPC state information for server-side call (SCALL) information.
Syntax
!rpcexts.getcallinfo [ CallID | 0 [ IfStart | 0 [ ProcNum | 0xFFFF [ProcessID|0] ] ] ]
!rpcexts.getcallinfo -?
Parameters
CallID
Specifies the call ID. This parameter is optional; include it if you only want to display calls matching a specific CallID value.
IfStart
Specifies the first DWORD of the interface UUID on which the call was made. This parameter is optional; include it if you only want to display calls matching a specific
IfStart value.
ProcNum
Specifies the procedure number of this call. (The RPC Run-Time identifies individual routines from an interface by numbering them by position in the IDL file the
first routine in the interface is 0, the second 1, and so on.)
ProcessID
Specifies the process ID (PID) of the server process that owns the calls you want to display. This parameter is optional; omit it if you want to display calls owned by
multiple processes.
-?
Displays some brief Help text for this extension in the Command Prompt window.
DLL
Unavailable
Windows 2000
Windows XP and later Rpcexts.dll
Comments
This extension can only be used with CDB or with user-mode WinDbg.
The parameters are parsed from left to right. To skip a parameter, supply the value 0. There is one exception to this rule: the ProcNum parameter is skipped by supplying the
value 0xFFFF.
Here is an example:
0:002> !rpcexts.getcallinfo
Searching for call info ...
PID CELL ID
ST PNO IFSTART TIDNUMBER CALLFLAG CALLID
LASTTIME CONN/CLN
---------------------------------------------------------------------------00c4 0000.0006 00 009 367abb81 0000.0007 00000001 0000004a 00018b41 0000.0005
00c4 0000.000a 00 007 367abb81 0000.002d 00000001 0000009f 000134ff 0000.0009
00c4 0000.000d 00 00f 82273fdc 0000.002d 00000001 00000002 00036cd8 0000.0042
00c4 0000.0010 00 00f 367abb81 0000.002d 00000001 00000078 00011636 0000.000f
00c4 0000.0012 00 00d 8d9f4e40 0000.0007 00000001 0000004f 000097bd 0000.0011
00c4 0000.0015 00 000 367abb81 0000.0004 00000001 0000004c 0002cccf 0000.0014
00c4 0000.0017 00 007 367abb81 0000.0004 00000001 00000006 0000cf5e 0000.0016
00c4 0000.0018 00 000 367abb81 0000.002d 00000001 0000000b 0001236f 0000.002a
00c4 0000.0019 01 00b 82273fdc 0000.0002 00000009 00000000 00018b19 00d0.0104
00c4 0000.001b 00 009 65a93890 0000.0007 00000001 000000ea 0003cd14 0000.001a
00c4 0000.0021 00 03b 8d9f4e40 0000.0013 00000001 0000000b 0001162c 0000.0020
00c4 0000.0022 01 008 82273fdc 0000.001f 00000009 00000000 00013405 00c4.02e8
00c4 0000.0024 00 007 367abb81 0000.0004 00000001 00000006 0000f198 0000.0023
00c4 0000.0026 00 000 367abb81 0000.0036 00000001 000000ab 00038049 0000.0025
00c4 0000.0027 01 00b 82273fdc 0000.001f 00000009 00000000 00020b7c 00a8.0228
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
00c4
00c4
00c4
00c4
00c4
00c4
00c4
00c4
00c4
00c4
00c4
0170
0170
0170
0170
0170
0170
0170
0170
0170
0170
020c
020c
020c
020c
020c
020c
020c
0294
0378
026c
0000.0028
0000.0029
0000.0030
0000.0032
0000.0035
0000.0038
0000.003a
0000.003b
0000.003f
0000.0043
0000.0049
0000.0009
0000.000a
0000.000c
0000.000d
0000.000e
0000.000f
0000.0010
0000.0014
0000.0015
0000.0018
0000.0004
0000.000e
0000.0010
0000.0011
0000.0012
0000.0017
0000.001d
0000.0004
0000.0004
0000.0004
01
00
00
01
00
00
00
00
01
01
00
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
02
008
00d
03b
008
007
007
007
004
008
008
008
002
002
002
003
000
002
002
004
003
004
003
001
000
004
001
005
001
004
003
000
82273fdc
8d9f4e40
8d9f4e40
82273fdc
367abb81
367abb81
367abb81
3ba0ffc0
82273fdc
82273fdc
8d9f4e40
e60c73e6
0b0a6584
0b0a6584
00000136
412f241e
0b0a6584
e60c73e6
e60c73e6
00000136
00000136
00000132
2f5f6520
629b9f66
faedcf59
629b9f66
00000134
2f5f6520
00000132
00000134
19bb5061
0000.003e
0000.002d
0000.0013
0000.001f
0000.0033
0000.002d
0000.0036
0000.002d
0000.0002
0000.0002
0000.0007
0000.0002
0000.0008
0000.0008
0000.0011
0000.0002
0000.0011
0000.0013
0000.0011
0000.0013
0000.0002
0000.000b
0000.001e
0000.000f
0000.0003
0000.000f
0000.0002
0000.0014
0000.0002
0000.0003
0000.0002
00000009
00000001
00000001
00000009
00000001
00000001
00000001
00000001
00000009
00000009
00000001
00000009
00000009
00000009
00000009
00000009
00000009
00000009
00000001
00000009
00000001
00000009
00000009
00000009
00000009
00000009
00000001
00000001
00000009
0000000b
00000001
00000000
0000033f
00000002
00000000
00000074
0000000a
00000063
00000005
00000000
00000000
000002b1
baadf00d
baadf00d
baadf00d
baadf00d
baadf00d
baadf00d
baadf00d
baadf00d
00000003
baadf00d
00000000
00120006
00000000
00000012
00000000
00000016
0020007d
00000000
00300038
00000001
0003a949
0003831a
00024e43
000118f3
0001042d
0002a3e4
0003b7b8
0002dd79
000245c6
00037d50
0004e900
0004ad30
0001187b
00011cdc
00034845
00012491
000492e7
0004ab78
0002bc25
00031d8d
00032e05
00034953
00035bac
000279ff
0003836b
0003657e
0003836b
000351b2
0003b786
0002d896
0004caa5
0294.02f0
0000.0031
0000.002f
022c.019c
0000.0034
0000.0037
0000.0039
0000.002e
01c0.037c
020c.0394
0000.0048
020c.03a4
00c4.012c
022c.019c
020c.02b4
0294.02b8
026c.0118
0378.038c
0378.024c
0378.00b8
020c.026c
0170.0240
020c.03b4
00a8.0194
0378.024c
020c.02ec
0378.024c
020c.0258
0170.01ac
020c.021c
0000.0003
For a similar example using the DbgRpc tool, see Get RPC Call Information.
Additional Information
For more information about debugging Microsoft Remote Procedure Call (RPC), see RPC Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!rpcexts.getclientcallinfo
The !rpcexts.getclientcallinfo extension searches the system's RPC state information for client call (CCALL) information.
Syntax
!rpcexts.getclientcallinfo [ CallID | 0 [ IfStart | 0 [ ProcNum | 0xFFFF [ProcessID|0] ] ] ]
!rpcexts.getclientcallinfo -?
Parameters
CallID
Specifies the call ID. This parameter is optional; include it if you only want to display calls matching a specific CallID value.
IfStart
Specifies the first DWORD of the interface UUID on which the call was made. This parameter is optional; include it if you only want to display calls matching a specific
IfStart value.
ProcNum
Specifies the procedure number of this call. (The RPC Run-Time identifies individual routines from an interface by numbering them by position in the IDL file the
first routine in the interface is 0, the second 1, and so on.) This parameter is optional; include it if you only want to display calls matching a specific ProcNum value.
ProcessID
Specifies the process ID (PID) of the client process that owns the calls you want to display. This parameter is optional; omit it if you want to display calls owned by
multiple processes.
-?
Displays some brief Help text for this extension in the Command Prompt window.
DLL
Windows 2000
Unavailable
Windows XP and later Rpcexts.dll
Comments
This extension can only be used with CDB or with user-mode WinDbg. It is only available if full RPC state information is being gathered.
Here is an example:
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
0:002> !rpcexts.getclientcallinfo
Searching for call info ...
PID CELL ID
PNO IFSTART TIDNUMBER CALLID
LASTTIME PS CLTNUMBER ENDPOINT
-----------------------------------------------------------------------------03d4 0000.0001 0000 19bb5061 0000.0000 00000001 0004ca9b 07 0000.0002 1118
For a similar example using the DbgRpc tool, see Get RPC Client Call Information.
Additional Information
For more information about debugging Microsoft Remote Procedure Call (RPC), see RPC Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!rpcexts.getdbgcell
The !rpcexts.getdbgcell extension displays RPC state information for the specified cell.
Syntax
!rpcexts.getdbgcell ProcessID CellID1.CellID2
!rpcexts.getdbgcell -?
Parameters
ProcessID
Specifies the process ID (PID) of the process whose server contains the desired cell.
CellID1.CellID2
Specifies the number of the cell to be displayed.
-?
Displays some brief Help text for this extension in the Command Prompt window.
DLL
Unavailable
Windows 2000
Windows XP and later Rpcexts.dll
Comments
This extension can only be used with CDB or with user-mode WinDbg.
Here is an example:
0:002> !rpcexts.getdbgcell c4 0.19
Getting cell info ...
Call
Status: Active
Procedure Number: 11
Interface UUID start (first DWORD only): 82273FDC
Call ID: 0x0 (0)
Servicing thread identifier: 0x0.3E
Call Flags: cached, LRPC
Last update time (in seconds since boot):1453.459 (0x5AD.1CB)
Caller (PID/TID) is: d0.1ac (208.428)
For a similar example using the DbgRpc tool, see Get RPC Cell Information.
Additional Information
For more information about debugging Microsoft Remote Procedure Call (RPC), see RPC Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!rpcexts.getendpointinfo
The !rpcexts.getendpointinfo extension searches the system's RPC state information for endpoint information.
Syntax
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!rpcexts.getendpointinfo [EndpointName]
!rpcexts.getendpointinfo -?
Parameters
EndpointName
Specifies the number of the endpoint to be displayed. If omitted, the endpoints for all processes on the system are displayed.
-?
Displays some brief Help text for this extension in the Command Prompt window.
DLL
Windows 2000
Unavailable
Windows XP and later Rpcexts.dll
Comments
This extension can only be used with CDB or with user-mode WinDbg.
Here is an example:
0:002> !rpcexts.getendpointinfo
Searching for endpoint info ...
PID CELL ID
ST PROTSEQ
ENDPOINT
------------------------------------------------------------00a8 0000.0001 01
NMP \PIPE\InitShutdown
00a8 0000.0003 01
NMP \PIPE\SfcApi
00a8 0000.0004 01
NMP \PIPE\ProfMapApi
00a8 0000.0005 01
LRPC OLE5
00a8 0000.0007 01
NMP \pipe\winlogonrpc
00c4 0000.0001 01
LRPC ntsvcs
00c4 0000.0003 01
NMP \PIPE\ntsvcs
00c4 0000.0008 01
NMP \PIPE\scerpc
00d0 0000.0001 01
NMP \PIPE\lsass
00d0 0000.0003 01
NMP \pipe\WMIEP_d0
00d0 0000.0006 01
LRPC policyagent
00d0 0000.0007 01
NMP \PIPE\POLICYAGENT
0170 0000.0001 01
LRPC epmapper
0170 0000.0003 01
TCP 135
0170 0000.0005 01
SPX 34280
0170 0000.0006 01
NB 135
0170 0000.0007 01
NB 135
0170 0000.000b 01
NMP \pipe\epmapper
01c0 0000.0001 01
NMP \pipe\spoolss
01c0 0000.0003 01
LRPC spoolss
01c0 0000.0007 01
LRPC OLE7
020c 0000.0001 01
LRPC OLE2
020c 0000.0005 01
LRPC senssvc
020c 0000.0007 01
NMP \pipe\tapsrv
020c 0000.0009 01
LRPC tapsrvlpc
020c 0000.000c 01
NMP \PIPE\ROUTER
020c 0000.0016 01
NMP \pipe\WMIEP_20c
0218 0000.0001 01
NMP \PIPE\winreg
022c 0000.0001 01
LRPC LRPC0000022c.00000001
022c 0000.0003 01
TCP 1041
022c 0000.0005 01
SPX 24576
022c 0000.0006 01
NMP \PIPE\atsvc
0294 0000.0001 01
LRPC OLE3
0378 0000.0001 01
LRPC OLE9
026c 0000.0001 01
TCP 1118
0344 0000.0001 01
LRPC OLE12
For a similar example using the DbgRpc tool, see Get RPC Endpoint Information.
Additional Information
For more information about debugging Microsoft Remote Procedure Call (RPC), see RPC Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!rpcexts.getthreadinfo
The !rpcexts.getthreadinfo extension searches the system's RPC state information for thread information.
Syntax
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!rpcexts.help
The !rpcexts.help extension displays a Help text in the Command Prompt window showing all Rpcexts.dll extension commands.
Syntax
!rpcexts.help
DLL
Windows 2000
Rpcexts.dll
Windows XP and later Rpcexts.dll
!rpcexts.rpcreadstack
The !rpcexts.rpcreadstack extension reads an RPC client-side stack and retrieves the call information.
Syntax
!rpcexts.rpcreadstack ThreadStackPointer
Parameters
ThreadStackPointer
Specifies the pointer to the thread stack.
DLL
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Unavailable
Windows 2000
Windows XP and later Rpcexts.dll
Comments
For a common use of this extension, see Analyzing a Stuck Call Problem.
Here is an example:
0:001> !rpcexts.rpcreadstack 68fba4
CallID: 1
IfStart: 19bb5061
ProcNum: 0
Protocol Sequence:
"ncacn_ip_tcp" (Address: 00692ED8)
NetworkAddress: ""
(Address: 00692F38)
Endpoint:
"1120" (Address: 00693988)
Additional Information
For more information about debugging Microsoft Remote Procedure Call (RPC), see RPC Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!rpcexts.rpctime
The !rpcexts.rpctime extension displays the current system time.
Syntax
!rpcexts.rpctime
DLL
Windows 2000
Rpcexts.dll
Windows XP and later Rpcexts.dll
Comments
This extension can only be used with CDB or with user-mode WinDbg.
Here is an example:
0:001> !rpcexts.rpctime
Current time is: 059931.126
(0x00ea1b.07e)
!rpcexts.thread
The !rpcexts.thread extension displays the per-thread RPC information.
This extension command should not be confused with the .thread (Set Register Context) command or the !thread (!kdextx86.thread and !kdexts.thread) extension.
Syntax
!rpcexts.thread TEB
Parameters
TEB
Specifies the address of the thread environment block (TEB).
DLL
Windows 2000
Rpcexts.dll
Windows XP and later Rpcexts.dll
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Comments
This extension displays the per-thread RPC information. A field in the per-thread RPC information is the extended error information for this thread.
Here is an example:
0:001> !rpcexts.thread 7ffdd000
RPC TLS at 692e70
HandleToThread - 0x6c
SavedProcedure - 0x0
SavedParameter - 0x0
ActiveCall - 0x0
Context - 0x0
CancelTimeout - 0xffffffff
SecurityContext - 0x0
ExtendedStatus - 0x0
ThreadEEInfo - 0xb015f0
ThreadEvent at - 0x00692E78
fCallCancelled - 0x0
buffer cache array at - 0x00692E84
fAsync - 0x0
Additional Information
For more information about debugging Microsoft Remote Procedure Call (RPC), see RPC Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!acpicache
The !acpicache extension displays all of the Advanced Configuration and Power Interface (ACPI) tables cached by the HAL.
Syntax
!acpicache [DisplayLevel]
Parameters
DisplayLevel
Specifies the detail level of the display. This value is either 0 for an abbreviated display or 1 for a more detailed display. The default value is 0.
DLL
Windows 2000
Unavailable
Windows XP and later Kdexts.dll
Additional Information
For information about the ACPI, see the Microsoft Windows Driver Kit (WDK) documentation, the Windows SDK documentation, and Microsoft Windows Internals by
Mark Russinovich and David Solomon. Also see ACPI Debugging for information about other extensions that are associated with the ACPI.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!acpiinf
The !acpiinf extension displays information on the configuration of the Advanced Configuration and Power Interface (ACPI), including the location of system tables and the
contents of the ACPI fixed feature hardware.
Syntax
!acpiinf
DLL
Windows 2000
Unavailable
Windows XP and later Kdexts.dll
Additional Information
For information about the ACPI, see the Microsoft Windows Driver Kit (WDK) documentation, the Windows SDK documentation, and Microsoft Windows Internals by
Mark Russinovich and David Solomon. Also see ACPI Debugging for information about other extensions that are associated with the ACPI.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!acpiirqarb
The !acpiirqarb extension displays the contents of the Advanced Configuration and Power Interface (ACPI) IRQ arbiter structure, which contains the configuration of I/O
devices to system interrupt controller inputs and processor interrupt dispatch table (IDT) entries.
Syntax
!acpiirqarb
DLL
Windows 2000
Unavailable
Windows XP and later Kdexts.dll
Additional Information
For information about the ACPI, see the Microsoft Windows Driver Kit (WDK) documentation, the Windows SDK documentation, and Microsoft Windows Internals by
Mark Russinovich and David Solomon. Also see ACPI Debugging for information about other extensions that are associated with the ACPI.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!acpikd.help
The !acpikd.help extension displays a Help text in the Debugger Command window showing all Acpikd.dll extension commands.
Syntax
!acpikd.help
DLL
Windows 2000
Acpikd.dll
Windows XP and later Acpikd.dll
Additional Information
For more information, see ACPI Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!amli ?
The !amli ? extension displays some Help text in the Debugger Command window for the !amli extension commands.
Syntax
Syntax in Windows 2000
!acpikd.amli ? [Command]
Syntax in Windows XP and later
!amli ? [Command]
Parameters
Command
Specifies the !amli command whose help is to be displayed. For example, !amli ? set displays help for the !amli set command. If Command is omitted, a list of all
commands is displayed.
DLL
Windows 2000
Acpikd.dll
Windows XP and later Kdexts.dll
Additional Information
For information about related commands and their uses, see The AMLI Debugger.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!amli bc
The !amli bc extension permanently clears an AML breakpoint.
Syntax
Syntax in Windows 2000
!acpikd.amli bc Breakpoint
!acpikd.amli bc *
Syntax in Windows XP and later
!amli bc Breakpoint
!amli bc *
Parameters
Breakpoint
Specifies the number of the breakpoint to be cleared.
*
Specifies that all breakpoints should be cleared.
DLL
Windows 2000
Acpikd.dll
Windows XP and later Kdexts.dll
Comments
To determine the breakpoint number of a breakpoint, use the !amli bl extension.
Additional Information
For information about related commands and their uses, see The AMLI Debugger.
2009 Microsoft Corporation
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!amli bd
The !amli bd extension temporarily disables an AML breakpoint.
Syntax
Syntax in Windows 2000
!acpikd.amli bd Breakpoint
!acpikd.amli bd *
Syntax in Windows XP and later
!amli bd Breakpoint
!amli bd *
Parameters
Breakpoint
Specifies the number of the breakpoint to be disabled.
*
Specifies that all breakpoints should be disabled.
DLL
Windows 2000
Acpikd.dll
Windows XP and later Kdexts.dll
Comments
A disabled breakpoint can be re-enabled by using the !amli be extension.
To determine the breakpoint number of a breakpoint, use the !amli bl extension.
Here is an example of this command:
kd> !amli bl
0: c29accf5 [\_WAK]
1: c29c20a5 [\_SB.PCI0.ISA.BAT1._BST]
kd> !amli bd 1
Additional Information
For information about related commands and their uses, see The AMLI Debugger.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!amli be
The !amli be extension enables an AML breakpoint.
Syntax
Syntax in Windows 2000
!acpikd.amli be Breakpoint
!acpikd.amli be *
Syntax in Windows XP and later
!amli be Breakpoint
!amli be *
Parameters
Breakpoint
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!amli bl
The !amli bl extension displays a list of all AML breakpoints.
Syntax
Syntax in Windows 2000
!acpikd.amli bl
Syntax in Windows XP and later
!amli bl
DLL
Windows 2000
Acpikd.dll
Windows XP and later Kdexts.dll
Comments
The AMLI Debugger supports a maximum of ten breakpoints.
Here is an example of the !amli bl extension:
kd>
0:
1:
2:
3:
!amli bl
<e> ffffffff80e5e2f1:[\_SB.LNKD._SRS]
<e> ffffffff80e5d969:[\_SB.LNKB._STA]
<d> ffffffff80e630c9:[\_WAK]
<e> ffffffff80e612c9:[\_SB.MBRD._CRS]
The first column gives the breakpoint number. The <e> and <d> marks indicate whether the breakpoint is enabled or disabled. The address of the breakpoint is in the next
column. Finally, the method containing the breakpoint is listed, with the offset of the breakpoint if it is not set at the start of the method.
Additional Information
For information about related commands and their uses, see The AMLI Debugger.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!amli bp
The !amli bp extension places a breakpoint in AML code.
Syntax
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!amli cl
The !amli cl extension clears the AML interpreter's event log.
Syntax
Syntax in Windows 2000
!acpikd.amli cl
Syntax in Windows XP and later
!amli cl
DLL
Windows 2000
Acpikd.dll
Windows XP and later Kdexts.dll
Additional Information
For information about related commands and their uses, see The AMLI Debugger.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!amli debugger
The !amli debugger extension breaks into the AMLI Debugger.
Syntax
Syntax in Windows 2000
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!acpikd.amli debugger
Syntax in Windows XP and later
!amli debugger
DLL
Windows 2000
Acpikd.dll
Windows XP and later Kdexts.dll
Comments
When this command is issued, notification is sent to the AML interpreter. The next time the interpreter is active, it will immediately break into the AMLI Debugger.
The !amli debugger extension only causes one break. If you want it to break again, you need to use this extension again, or set a breakpoint.
Additional Information
For information about related commands and their uses, see The AMLI Debugger.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!amli dh
The !amli dh extension displays the AML interpreter's internal heap block.
Syntax
Syntax in Windows 2000
!acpikd.amli dh [HeapAddress]
Syntax in Windows XP and later
!amli dh [HeapAddress]
Parameters
HeapAddress
Specifies the address of the heap block. If this is omitted, the global heap is displayed.
DLL
Windows 2000
Acpikd.dll
Windows XP and later Kdexts.dll
In Windows 2000, this command is available only if you are using the checked build of this extension (W2kchk\Acpikd.dll).
Additional Information
For information about related commands and their uses, see The AMLI Debugger.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!amli dl
The !amli dl extension displays a portion of the AML interpreter's event log.
Syntax
Syntax in Windows 2000
!acpikd.amli dl
Syntax in Windows XP and later
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!amli dl
DLL
Windows 2000
Acpikd.dll
Windows XP and later Kdexts.dll
Comments
The event log chronicles the most recent 150 events that occurred in the interpreter.
Here is an example of the log display:
kd> !amli dl
RUN!: [c15a6618]QTh=00000000,QCt=00000000,QFg=00000000: Ctx=c18b4000,rc=0
KICK: [c15a6618]QTh=00000000,QCt=00000000,QFg=00000000: rc=0
SYNC: [c15a6618]QTh=00000000,QCt=00000000,QFg=00000002,LockPhase=0,Locked=0,IRQL=00: Obj=\_WAK
ASYN: [c15a6618]QTh=00000000,QCt=00000000,QFg=00000002,LockPhase=0,Locked=0,IRQL=00: Obj=\_WAK
REST: [c15a6618]QTh=00000000,QCt=00000000,QFg=00000002: Ctx=c18b4000,Obj=\_WAK
INSQ: [c15a6618]QTh=00000000,QCt=00000000,QFg=00000002: Ctx=c18b4000,Obj=\_WAK
EVAL: [c15a6618]QTh=00000000,QCt=00000000,QFg=00000002: Ctx=c18b4000,Obj=\_WAK
RUNC: [c15a6618]QTh=c15a6618,QCt=c18b4000,QFg=00000002: Ctx=c18b4000,Obj=\_WAK
Additional Information
For information about related commands and their uses, see The AMLI Debugger.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!amli dns
The !amli dns extension displays an ACPI namespace object.
Syntax
Syntax in Windows 2000
!acpikd.amli dns [/s] [Name | Address]
Syntax in Windows XP and later
!amli dns [/s] [Name | Address]
Parameters
/s
Causes the entire namespace subtree under the specified object to be displayed recursively.
Name
Specifies the namespace path.
Address
Specifies the address of the namespace node.
DLL
Windows 2000
Acpikd.dll
Windows XP and later Kdexts.dll
Comments
If neither Name nor Address is specified, the entire ACPI namespace tree is displayed recursively. The /s parameter is always assumed in this case, even if it is not specified.
This command is useful for determining what a particular namespace object is whether it is a method, a field unit, a device, or another type of object.
Without the /s parameter, this extension is equivalent to the !nsobj extension. With the /s parameter, it is equivalent to the !nstree extension.
Here are some examples. The following command displays the namespace for the object bios:
AMLI(? for help)-> dns \bios
ACPI Name Space: \BIOS (80E5F378)
OpRegion(BIOS:RegionSpace=SystemMemory,Offset=0xfcb07500,Len=2816)
The following command displays the namespace for the object _BST, and the tree subordinate to it:
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!amli do
The !amli do extension displays an AML data object.
Syntax
Syntax in Windows 2000
!acpikd.amli do Address
Syntax in Windows XP and later
!amli do Address
Parameters
Address
Specifies the address of the data object.
DLL
Windows 2000
Acpikd.dll
Windows XP and later Kdexts.dll
Additional Information
For information about related commands and their uses, see The AMLI Debugger.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!amli ds
The !amli ds extension displays an AML stack.
Syntax
Syntax in Windows 2000
!acpikd.amli ds [/v] [Address]
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!amli find
The !amli find extension finds an ACPI namespace object.
Syntax
Syntax in Windows 2000
!acpikd.amli find Name
Syntax in Windows XP and later
!amli find Name
Parameters
Name
Specifies the name of the namespace object (without the path).
DLL
Windows 2000
Acpikd.dll
Windows XP and later Kdexts.dll
Comments
The !amli find command takes the name of the object and returns the full path and name. The Name parameter must be the final segment of the full path and name.
Here are some examples. The following command will find all declarations of the object _SRS:
kd> !amli find _srs
\_SB.LNKA._SRS
\_SB.LNKB._SRS
\_SB.LNKC._SRS
\_SB.LNKD._SRS
This is not simply a text search. The command !amli find srs does not display any hits, because the final segment of each of these declarations is "_SRS", not "SRS". The
command !amli find LNK similarly does not return hits. The command !amli find LNKB would display the single node that terminates in "LNKB", not the four children of
this node shown in the previous display:
kd> !amli find lnkb
\_SB.LNKB.
If you need to see the children of a node, use the !amli dns command with the /s parameter.
Here is another example, issued from the AMLI Debugger prompt. This shows all declarations of the object _BST in the namespace:
AMLI(? for help)-> find _bst
\_SB.PCI0.ISA.BAT1._BST
\_SB.PCI0.ISA.BAT2._BST
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Additional Information
For information about related commands and their uses, see The AMLI Debugger.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!amli lc
The !amli lc extension lists all active ACPI contexts.
Syntax
Syntax in Windows 2000
!acpikd.amli lc
Syntax in Windows XP and later
!amli lc
DLL
Windows 2000
Acpikd.dll
Windows XP and later Kdexts.dll
Comments
Each context corresponds to a method currently running in the AML interpreter.
Here is an example:
AMLI(? for help)-> lc
Ctxt=80e3f000, ThID=00000000,
Ctxt=80e41000, ThID=00000000,
Ctxt=80e9a000, ThID=00000000,
Ctxt=80ea8000, ThID=00000000,
*Ctxt=80e12000, ThID=80e6eda8,
Flgs=A--C-----,
Flgs=A--C-----,
Flgs=A--C-----,
Flgs=A--C-----,
Flgs=---CR----,
pbOp=00000000,
pbOp=00000000,
pbOp=00000000,
pbOp=00000000,
pbOp=80e5d5ac,
Obj=\_SB.LNKA._STA
Obj=\_SB.LNKB._STA
Obj=\_SB.LNKC._STA
Obj=\_SB.LNKD._STA
Obj=\_SB.LNKA._STA
The Obj field gives the full path and name of the method as it appears in the ACPI tables.
The Ctxt field gives the address of the context block. The asterisk (*) indicates the current context. This is the context that was being executed by the interpreter when the
break occurred.
The abbreviation pbOp indicates the instruction pointer (pointer to binary op codes).
There are nine flags that can be displayed in the Flgs section. If a flag is not set, a hyphen is displayed instead. The full list of flags is as follows:
Flag
Meaning
A Asynchronous evaluation
N Nested evaluation
Q In the ready queue
C Needs a callback
R Running
W Ready
T Time-out
D Timer dispatch
P
Timer pending
Additional Information
For information about related commands and their uses, see The AMLI Debugger.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!amli ln
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The !amli ln extension displays the specified method or the method containing a given address.
Syntax
Syntax in Windows 2000
!acpikd.amli ln [ MethodName | CodeAddress ]
Syntax in Windows XP and later
!amli ln [ MethodName | CodeAddress ]
Parameters
MethodName
Specifies the full path of the method name. If MethodName specifies an object that is not actually a method, an error results.
CodeAddress
Specifies the address of the AML code that is contained in the desired method. If CodeAddress is prefixed with two percent signs (%%), it is interpreted as a physical
address. Otherwise, it is interpreted as a virtual address.
DLL
Windows 2000
Acpikd.dll
Windows XP and later Kdexts.dll
Comments
If neither MethodName nor CodeAddress is specified, the method associated with the current context is displayed.
The following command shows the method being currently run:
kd> !amli ln
c29accf5: \_WAK
The method _WAK is shown, with address 0xC29ACCF5.
Additional Information
For information about related commands and their uses, see The AMLI Debugger.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!amli r
The !amli r extension displays information about the current context or the specified context.
Syntax
Syntax in Windows 2000
!acpikd.amli r [ContextAddress]
Syntax in Windows XP and later
!amli r [ContextAddress]
Parameters
Address
Specifies the address of the context block to be displayed. The address of a context block can be determined from the Ctxt field in the !amli lc display. If ContextAddress
is prefixed with two percent signs (%%), it is interpreted as a physical address. Otherwise, it is interpreted as a virtual address. If this parameter is omitted, the current
context is displayed.
DLL
Windows 2000
Acpikd.dll
Windows XP and later Kdexts.dll
Comments
If the AMLI Debugger prompt appears suddenly, this is a useful command to use.
For example, the following command will display the current context of the interpreter:
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
:
:
:
:
If(S4BW
{
| Store(Zero, S4BW)
}
Additional Information
For information about related commands and their uses, see The AMLI Debugger.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!amli set
The !amli set extension sets or displays the AMLI Debugger options.
Syntax
Syntax in Windows 2000
!acpikd.amli set Options
Syntax in Windows XP and later
!amli set Options
Parameters
Options
Specifies one or more options to be set. Separate multiple options with spaces. Possible values include:
spewon
(Windows XP and later) Causes full debug output to be sent from the target computer. This option should be left on at all times for effective AML debugging. See
the Comments section for details.
spewoff
(Windows XP and later) Suppresses debug output.
verboseon
Turns on verbose mode. This causes the AMLI Debugger to display the names of AML methods as they are evaluated.
verboseoff
Turns off verbose mode.
traceon
Activates ACPI tracing. This produces much more output than the verboseon option. This option is very useful for tracking SMI-related hard hangs.
traceoff
Deactivates ACPI tracing.
nesttraceon
Activates nest tracing. This option is only effective if the traceon option is also selected.
nesttraceoff
Deactivates nest tracing.
lbrkon
Breaks into the AMLI Debugger when DDB loading is completed.
lbrkoff
Deactivates the lbrkon option.
errbrkon
Breaks into the AMLI Debugger whenever the interpreter has a problem evaluating AML code.
errbrkoff
Deactivates the errbrkon option.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
logon
Enables event logging.
logoff
Disables event logging.
logmuton
Enables mutex event logging.
logmutoff
Disables mutex event logging.
DLL
Windows 2000
Acpikd.dll
Windows XP and later Kdexts.dll
Comments
If no options are specified, the current status of all options is displayed.
In Windows 2000, full debug output is always sent to the debugger. However, Windows XP and later versions of Windows usually filter out most of these messages. If you
are running the AMLI Debugger on these systems, you need to turn this output on with !amli set spewon. Otherwise, numerous important AMLI Debugger messages will be
lost.
If the AML interpreter breaks into the AMLI Debugger, this output will be automatically turned on.
For more details on this output filtering, see DbgPrintEx and KdPrintEx in the Windows Driver Kit (WDK) documentation.
Additional Information
For information about related commands and their uses, see The AMLI Debugger.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!amli u
The !amli u extension unassembles AML code.
Syntax
Syntax in Windows 2000
!acpikd.amli u [ MethodName | CodeAddress ]
Syntax in Windows XP and later
!amli u [ MethodName | CodeAddress ]
Parameters
MethodName
Specifies the full path of the method name to be disassembled.
CodeAddress
Specifies the address of the AML code where disassembly will begin. If CodeAddress is prefixed with two percent signs (%%), it is interpreted as a physical address.
Otherwise, it is interpreted as a virtual address.
DLL
Windows 2000
Acpikd.dll
Windows XP and later Kdexts.dll
Comments
If neither MethodName nor CodeAddress is specified and you are issuing this command from an AMLI Debugger prompt, the disassembly starts at the beginning of the
current method.
The disassembly display will continue until the end of the method is reached.
Note The standard u (Unassemble) command will not give proper results with AML code.
Here are some examples. To disassemble the object at address 0x80E5D701, use the following command:
kd> !amli u 80e5d701
ffffffff80e5d701 : CreateWordField(CRES, 0x1, IRQW)
ffffffff80e5d70c : And(\_SB_.PCI0.LPC_.PIRA, 0xf, Local0)
ffffffff80e5d723 : Store(One, Local1)
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!facs
The !facs extension displays a Firmware ACPI Control Structure (FACS).
Syntax
Syntax in Windows 2000
!acpikd.facs Address
Syntax in Windows XP and later
!facs Address
Parameters
Address
Specifies the address of the FACS.
DLL
Windows 2000
Acpikd.dll
Windows XP and later Kdexts.dll
Additional Information
For more information, see ACPI Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!fadt
The !fadt extension displays a Fixed ACPI Description Table (FADT).
Syntax
Syntax in Windows 2000
!acpikd.fadt Address
Syntax in Windows XP and later
!fadt Address
Parameters
Address
Specifies the address of the FADT.
DLL
Windows 2000
Acpikd.dll
Windows XP and later Kdexts.dll
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Additional Information
For more information, see ACPI Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!mapic
The !mapic extension displays an ACPI Multiple APIC table.
Syntax
Syntax in Windows 2000
!acpikd.mapic Address
Syntax in Windows XP and later
!mapic Address
Parameters
Address
Specifies the address of the Multiple APIC Table.
DLL
Windows 2000
Acpikd.dll
Windows XP and later Kdexts.dll
Additional Information
For more information, see ACPI Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!nsobj
The !nsobj extension displays an ACPI namespace object.
Syntax
Syntax in Windows 2000
!acpikd.nsobj [Address]
Syntax in Windows XP and later
!nsobj [Address]
Parameters
Address
Specifies the address of the namespace object. If this is omitted, the root of the namespace tree is used.
DLL
Windows 2000
Acpikd.dll
Windows XP and later Kdexts.dll
Comments
This extension is equivalent to !amli dns.
Additional Information
For more information, see ACPI Debugging.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!nstree
The !nstree extension displays an ACPI namespace object and its children in the namespace tree.
Syntax
Syntax in Windows 2000
!acpikd.nstree [Address]
Syntax in Windows XP and later
!nstree [Address]
Parameters
Address
Specifies the address of the namespace object. This object and the entire namespace tree subordinate to it will be displayed. If Address is omitted, the entire namespace
tree is displayed.
DLL
Windows 2000
Acpikd.dll
Windows XP and later Kdexts.dll
Comments
This extension is equivalent to !amli dns /s.
Additional Information
For more information, see ACPI Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!rsdt
The !rsdt extension displays the ACPI Root System Description Table.
Syntax
Syntax in Windows 2000
!acpikd.rsdt
Syntax in Windows XP and later
!rsdt
DLL
Windows 2000
Acpikd.dll
Windows XP and later Kdexts.dll
Additional Information
For more information, see ACPI Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!gdikdx.verifier
The !gdikdx.verifier extension displays the status of Driver Verifier during the verification of a graphics driver.
Syntax
!gdikdx.verifier [-Flags]
Parameters
Flags
Specifies what information will be displayed in the output from this command. Any combination of the following (preceded by a hyphen) is allowed:
d
Causes the display to include statistics on Memory Pool Tracking. This includes the address, size, and tag of each pool.
h (or ?)
Displays some brief Help text for this command in the Debugger Command window.
DLL
Windows 2000
Gdikdx.dll
Windows XP and later Unavailable
Comments
When verifying drivers that are not graphics drivers, the standard kernel-mode extension !verifier should be used instead of !gdikdx.verifier.
Regardless of which flags are selected, this extension will display the Driver Verifier options that are active. It will also display statistics on the frequency of random failure.
Additional Information
For information about Driver Verifier, see the Windows Driver Kit (WDK) documentation.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
You can get additional information for many of the extension commands in this section simply by entering the command into the debugger with no arguments.
For more information, see Kernel Streaming Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!ks.help
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The !ks.help extension displays a help text showing all AVStream-specific Ks.dll extension commands.
Syntax
!ks.help
DLL
Windows 2000
winxp\Ks.dll
Windows XP and later Ks.dll
Additional Information
For more information, see Kernel Streaming Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!ks.kshelp
The !ks.kshelp extension displays a help text showing original KS 1.0-specific Ks.dll extension commands.
Syntax
!ks.kshelp
DLL
Windows 2000
winxp\Ks.dll
Windows XP and later Ks.dll
Additional Information
For more information, see Kernel Streaming Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!ks.pchelp
The !ks.pchelp extension displays a help text showing PortCls-specific Ks.dll extension commands.
Syntax
!ks.pchelp
DLL
Windows 2000
winxp\Ks.dll
Windows XP and later Ks.dll
Additional Information
For more information, see Kernel Streaming Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!ks.allstreams
The !ks.allstreams extension walks the entire device tree and finds every kernel streaming device in the system.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Syntax
!ks.allstreams [Flags] [Level]
Parameters
Flags
Optional. Specifies the kind of information to be displayed. Flags can be any combination of the following bits. The default value is 0x1:
Bit 0 (0x1)
Causes the display to include streams.
Bit 2 (0x4)
Causes the display to include proxy instances.
Bit 3 (0x8)
Causes the display to include queued IRPs.
Bit 4 (0x10)
Causes the display to include an unformatted display of all streams.
Bit 5 (0x20)
Causes the display to include an unformatted display of all stream formats.
Level
Optional. Specifies the level of detail to display on a 0-7 scale with progressively more information displayed for higher values. To display all available details, supply a
value of 7.
DLL
Windows 2000
winxp\Ks.dll
Windows XP and later Ks.dll
Comments
This command can take some time to execute (a minute is not unusual).
Here is an example of the !ks.allstreams display:
kd> !allstreams
6 Kernel Streaming FDOs found:
Functional Device 82a17690
Functional Device 8296eb08
Functional Device 82490388
Functional Device 82970cb8
Functional Device 824661b8
Functional Device 8241c020
[\Driver\smwdm]
[\Driver\wdmaud]
[\Driver\sysaudio]
[\Driver\MSPQM]
[\Driver\MSPCLOCK]
[\Driver\avssamp]
Additional Information
For more information, see Kernel Streaming Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!ks.automation
The !ks.automation extension displays any automation items associated with the given object.
Syntax
!ks.automation Object
Parameters
Object
Specifies a pointer to the object for which to display automation items. (Automation items are properties, methods, and events.) Object must be one of the following
types: PKSPIN, PKSFILTER, CKsPin*, CKsFilter*, PIRP. If Object is a pointer to an automation IRP, the command returns property information and handlers.
DLL
Windows 2000
winxp\Ks.dll
Windows XP and later Ks.dll
Comments
You can use this command with a filter address obtained from !ks.enumdevobj.
Here is an example of the !ks.automation display. The argument is the address of a filter:
kd> !automation 829493c4
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
MinProperty = 00000018
MinData = 00000048
Set [ks!KSPROPSETID_Frame] a60d8368-5324-4893-b020-c431a50bcbe3
Item ID = 0
Get Handler = ks!CKsFilter::Property_Frame_Holding
Set Handler = ks!CKsFilter::Property_Frame_Holding
MinProperty = 00000018
MinData = 00000004
Method Items:
NO SETS FOUND!
Event Items:
NO SETS FOUND!
Additional Information
For more information, see Kernel Streaming Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!ks.devhdr
The !ks.devhdr extension displays the kernel streaming device header associated with the given WDM object.
Syntax
!ks.devhdr DeviceObject
Parameters
DeviceObject
This parameter specifies a pointer to a WDM device object. If DeviceObject is not valid, the command returns an error.
DLL
Windows 2000
winxp\Ks.dll
Windows XP and later Ks.dll
Comments
The output from !ks.allstreams can be used as the input for !ks.devhdr.
Here is an example of the !ks.devhdr display:
kd> !devhdr 827aedf0 7
Device Header 824ca1e0
Child Create Handler List:
Create Item eb3a7284
CreateFunction = sysaudio!CFilterInstance::FilterDispatchCreate+0x00
ObjectClass = NULL
Flags = 0
Additional Information
For more information, see Kernel Streaming Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!ks.dhdr
The !ks.dhdr extension command is obsolete; use !ks.dump instead.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!ks.dump
The !ks.dump extension displays the specified object.
Syntax
!ks.dump Object [Level] [Flags]
Parameters
Object
Specifies a pointer to an AVStream structure, an AVStream class object, or a PortCls object. Can also specify a pointer to an an IRP or a file object.
Level
Optional. Specifies the level of detail to display on a 0-7 scale with progressively more information displayed for higher values. To display all available details, supply a
value of 7. You can see more information about levels by issuing a !ks.dump command with no arguments.
Flags
Optional. Specifies the kind of information to be displayed. Flags can be any combination of the following bits.
Bit 0 (0x1)
Display all queued IRPs.
Bit 1 (0x2)
Display all pending IRPs.
Bit 2 (0x4)
Analyze a stalled graph for suspects.
Bit 3 (0x8)
Show all pin states.
DLL
Windows 2000
winxp\Ks.dll
Windows XP and later Ks.dll
Comments
The !ks.dump command recognizes most AVStream objects, including pins, filters, factories, devices, pipes, and stream pointers. This command also recognizes some stream
class structures, including stream objects, filter instances, device extensions, and SRBs.
Following is an example of the !ks.dump display for a filter:
kd> !dump 829493c4
Filter object 829493c4 [CKsFilter = 82949350]
Descriptor
f7a233c8:
Context
829dce28
Following is an example of the !ks.dump display for a pin:
kd> !dump 8160DDE0 7
Pin object 8160DDE0 [CKsPin = 8160DD50]
DeviceState
KSSTATE_RUN
ClientState
KSSTATE_RUN
ResetState
KSRESET_END
CKsPin object 8160DD50 [KSPIN = 8160DDE0]
State
KSSTATE_RUN
Processing Mutex
8160DFD0 is not held
And Gate &
8160DF88
And Gate Count
1
Some important parts of this display are included in the following table.
Parameter Meaning
DeviceState The state that the pin was requested to enter. If different from ClientState, this is the state that the minidriver will transition to next.
ClientState The state that the minidriver is actually in. This reflects the state of the pipe.
ResetState Indicates whether or not the object is in the middle of a flush.
KSRESET_BEGIN indicates a flush.
KSRESET_END indicates no flush.
State
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
MINIDRIVER Data:
Device Extension
81a0a44c
Interrupt Routine
00000000
Synchronize Routine
STREAM!StreamClassSynchronizeExecution
Receive Device SRB
testcap!AdapterReceivePacket
Cancel Packet
testcap!AdapterCancelPacket
Timeout Packet
testcap!AdapterTimeoutPacket
Size (d / r / s / f)
1a0(416), 14(20), 978(2424), 0(0)
Sync Mode
Driver Synchronizes
Filter Type 0:
Symbolic Links:
Information Paged Out
Instances:
816b7bd8
Note that the sizes are listed both in hexadecimal numbers, and then, parenthetically in the decimal equivalent. The Size abbreviations in this display are listed in the
following table.
Size Explanation
d Device
r
Request
s
Stream
f
Filter. If the filter size is 0, the filter is single instance. If it is greater than 0, it is multi-instance.
Additional Information
For more information, see Kernel Streaming Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!ks.dumpbag
The !ks.dumpbag extension displays the contents of the object bag for the specified object.
Syntax
!ks.dumpbag Object [Level]
Parameters
Object
Specifies a pointer to a valid client viewable object structure, or to the private class object.
Level
Optional. Specifies the level of detail to display on a 0-7 scale with progressively more information displayed for higher values. To display all available details, supply a
value of 7.
DLL
Windows 2000
winxp\Ks.dll
Windows XP and later Ks.dll
Comments
Here is an example of the !ks.dumpbag display for a filter:
kd> !dumpbag 829493c4
Filter 829493c4 [CKsFilter = 82949350]:
Object Bag 829493d0:
Object Bag Item 829dce28:
Reference Count
: 1
Item Cleanup Handler
: f7a21730
Additional Information
For more information, see Kernel Streaming Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!ks.dumpcircuit
The !ks.dumpcircuit extension lists details of the transport circuit associated with the given object.
Syntax
!ks.dumpcircuitextension Object [Level]
Parameters
Object
Specifies a pointer to the object for which to display the transport circuit. For AVStream, Object must be one of the following types: CKsPin*, CKsQueue*,
CKsRequestor*, CKsSplitter*, CKsSplitterBranch*.
For PortCls, object must be one of the following types: CPortPin*, CKsShellRequestor*, or CIrpStream*.
Level
Optional. Specifies the level of detail to display on a 0-7 scale with progressively more information displayed for higher values. To display all available details, supply a
value of 7.
DLL
Windows 2000
winxp\Ks.dll
Windows XP and later Ks.dll
Comments
Note that !ks.dumpcircuit starts walking the circuit at the specified object, which does not always correspond to the data source.
You can first use !ks.graph with a filter address to list pin addresses, and then use these addresses with !ks.dumpcircuit.
Here is an example of the !ks.dumpcircuit display:
kd> !dumpcircuit 8293f4f0
Pin8293f4f0 0 (snk, out)
Queue82990e20 r/w/c=2489/2/0
Additional Information
For more information, see Kernel Streaming Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!ks.dumplog
The !ks.dumplog extension displays the internal kernel streaming debug log.
Syntax
!ks.dumplog [Entries]
Parameters
Entries
Optional. Specifies the number of log entries to display. If Entries is zero or omitted, the entire log is displayed.
DLL
Windows 2000
winxp\Ks.dll
Windows XP and later Ks.dll
Comments
You can stop the log display by pressing CTRL+C.
This extension requires that the target computer be running a checked (debug) version of Ks.sys.
Additional Information
For more information, see Kernel Streaming Debugging.
2009 Microsoft Corporation
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!ks.dumpqueue
The !ks.dumpqueue extension displays information about the queues associated with a given AVStream object, or the stream associated with a port class object.
Syntax
!ks.dumpqueue Object [Level]
Parameters
Object
Specifies a pointer to the object for which to display the queue. Object must be of type PKSPIN, PKSFILTER, CKsPin*, CKsFilter*, CKsQueue*, CPortPin*, or
CPortFilter*.
Level
Optional. Specifies the level of detail to display on a 0-7 scale with progressively more information displayed for higher values. To display all available details, supply a
value of 7.
DLL
Windows 2000
winxp\Ks.dll
Windows XP and later Ks.dll
Comments
Object must be a filter or a pin. For a pin, a single queue is displayed. For a filter, multiple queues are displayed.
This command can take some time to execute.
Here is an example of the !ks.dumpqueue display:
kd> !dumpqueue 829493c4
Filter 829493c4: Output Queue 82990e20:
Queue 82990e20:
Frames Received : 1889
Frames Waiting
: 3
Frames Cancelled : 0
And Gate 82949464 : count = 1, next = 00000000
Frame Gate NULL
Frame Header 82aaef78:
NextFrameHeaderInIrp = 00000000
OriginalIrp = 82169e48
Mdl = 8292e358
Irp = 82169e48
StreamHeader = 8298dea0
FrameBuffer = edba3000
StreamHeaderSize = 00000000
FrameBufferSize = 00025800
Context = 00000000
Refcount = 1
Additional Information
For more information, see Kernel Streaming Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!ks.enumdevobj
The !ks.enumdevobj extension displays the KSDEVICE associated with a given WDM device object, and lists the filter types and filters currently instantiated on this device.
Syntax
!ks.enumdevobj DeviceObject
Parameters
DeviceObject
Specifies a pointer to a WDM device object.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
DLL
Windows 2000
winxp\Ks.dll
Windows XP and later Ks.dll
Comments
The output from !ks.allstreams can be used as the input for !ks.enumdevobj.
Here is an example of the !ks.enumdevobj display:
kd> !enumdevobj 8241c020
WDM device object 8241c020:
Corresponding KSDEVICE
823b8430
Factory 829782dc [Descriptor f7a233c8] instances:
829493c4
Additional Information
For more information, see Kernel Streaming Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!ks.enumdrvobj
The !ks.enumdrvobj extension displays all KSDEVICE structures associated with a given WDM driver object, and lists the filter types and filters currently instantiated on
these devices.
Syntax
!ks.enumdrvobj DriverObject
Parameters
DriverObject
Specifies a pointer to a WDM driver object.
DLL
Windows 2000
winxp\Ks.dll
Windows XP and later Ks.dll
Comments
Since !ks.enumdrvobj enumerates every device chained off a WDM driver object, it is equivalent to invoking !ks.enumdevobj on every device chained off a given driver.
Additional Information
For more information, see Kernel Streaming Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!ks.eval
The !ks.eval extension evaluates an expression using an extension-specific expression evaluator.
Syntax
!ks.eval Expression
Parameters
Expression
Specifies the expression to evaluate. Expression can include any MASM operators, symbols, or numerical syntax, as well as the extension-specific operators described
below. For more information about MASM expressions, see MASM Numbers and Operators.
DLL
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Windows 2000
winxp\Ks.dll
Windows XP and later Ks.dll
Comments
The extension module includes two extension-specific operators which can be used in address parameters to extension commands:
fdo(x)
Returns the functional device object associated with the object at address x.
driver(x)
Returns the driver object associated with fdo(x).
You can use the !ks.eval command to parse expressions that contain these extension-specific operators as well as MASM Numbers and Operators.
Note that all operators supported by !ks.eval are also supported by all other extension commands in the Ks.dll extension module.
Here is an example of the !ks.eval extension being used with the address of a filter. Note the presence of the 0x8241C020 address in the !ks.allstreams output:
kd> !eval fdo(829493c4)
Resulting Evaluation: 8241c020
kd> !allstreams
6 Kernel Streaming FDOs found:
Functional Device 82a17690
Functional Device 8296eb08
Functional Device 82490388
Functional Device 82970cb8
Functional Device 824661b8
Functional Device 8241c020
[\Driver\smwdm]
[\Driver\wdmaud]
[\Driver\sysaudio]
[\Driver\MSPQM]
[\Driver\MSPCLOCK]
[\Driver\avssamp]
Additional Information
For more information, see Kernel Streaming Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!ks.findlive
The !ks.findlive extension searches the internal Ks.sys debug log to attempt to find live objects of a specified type.
Syntax
!ks.findlive Type [Entries] [Level]
Parameters
Type
Specifies the type of object for which to search. Enter one of the following as a literal value: Queue, Requestor, Pin, Filter, or Irp.
Entries
If this parameter is zero or omitted, the entire log is searched.
Level
Optional. Specifies the level of detail to display on a 0-7 scale with progressively more information displayed for higher values. To display all available details, supply a
value of 7.
DLL
Windows 2000
winxp\Ks.dll
Windows XP and later Ks.dll
Comments
The !ks.findlive command may not find all possible specified live objects.
This extension requires that the target computer be running a checked (debug) version of Ks.sys.
Additional Information
For more information, see Kernel Streaming Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!ks.forcedump
The !ks.forcedump command displays information about memory contents at a caller-supplied address.
Syntax
!ks.forcedump Object Type [Level]
Parameters
Object
Specifies a pointer to the object for which to display information.
Type
Specifies the type of object.
For AVStream/KS objects, Type must be one of the following values: CKsQueue, CKsDevice, CKsFilterFactory, CKsFilter, CKsPin, CKsRequestor, CKsSplitter,
CKsSplitterBranch, CKsPipeSection, KSPIN, KSFILTER, KSFILTERFACTORY, KSDEVICE, KSSTREAM_POINTER, KSPFRAME_HEADER,
KSIOBJECT_HEADER, KSPDO_EXTENSION, KSIDEVICE_HEADER, KSSTREAM_HEADER, KSPIN_DESCRIPTOR_EX, CKsProxy, CKsInputPin,
CKsOutputPin, CasyncItemHandler.
For Port Class objects, Type must be one of the following values: DEVICE_CONTEXT, CPortWaveCyclic, CPortPinWaveCyclic, CPortTopology, CPortDMus,
CIrpStream, CKsShellRequestor, CPortFilterWaveCyclic, CDmaChannel, CPortWavePci, CportPinWavePci.
Level
Optional. Specifies the level of detail to display on a 0-7 scale with progressively more information displayed for higher values. To display all available details, supply a
value of 7.
DLL
Windows 2000
winxp\Ks.dll
Windows XP and later Ks.dll
Comments
Normally, you can use !ks.dump to display data structures.
However, if symbols are loaded incorrectly or too much information is paged out, the type identification logic in the !ks.dump command may fail to identify the type of
structure at a given address.
If this happens, try using the !ks.forcedump command. This command works just like !ks.dump except that the user specifies the type of the object.
Note The !ks.forcedump command does not verify that Type is the correct type of structure found at the address provided in Object. The command assumes that this is the
type of structure found at Object and displays data accordingly.
A listing of all supported objects can be retrieved by issuing a !ks.forcedump command with no arguments.
Here are two examples of the output from !ks.forcedump, using the address of a filter for the Object argument but with different levels of detail:
kd> !forcedump 829493c4 KSFILTER
WARNING: I am dumping 829493c4 as a KSFILTER.
No checking has been performed to ensure that it is this type!!!
Filter object 829493c4 [CKsFilter = 82949350]
Descriptor
f7a233c8:
Context
829dce28
kd> !forcedump 829493c4 KSFILTER 7
WARNING: I am dumping 829493c4 as a KSFILTER.
No checking has been performed to ensure that it is this type!!!
Filter object 829493c4 [CKsFilter = 82949350]
Descriptor
f7a233c8:
Filter Category GUIDs:
Video
Capture
Context
829dce28
INTERNAL INFORMATION:
Public Parent Factory
829782dc
Aggregated Unknown
00000000
Device Interface
823b83c8
Control Mutex
829493f8 is not held
Object Event List:
None
CKsFilter object 82949350 [KSFILTER = 829493c4]
Processing Mutex
82949484 is not held
Gate &
82949464
Gate.Count
1
Pin Factories:
Pin ID 0 [Video/General Capture Out]:
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Child Count
1
Bound Child Count 1
Necessary Count
0
Specific Instances:
8293f580
Additional Information
For more information, see Kernel Streaming Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!ks.graph
The !ks.graph extension command displays a textual description of the kernel mode graph in topologically sorted order.
Syntax
!ks.graph Object [Level] [Flags]
Parameters
Object
Specifies a pointer to the object to use as a starting point for the graph. Must be a pointer to one of the following: file object, IRP, pin, or filter.
Level
Optional. Specifies the level of detail to display on a 0-7 scale with progressively more information displayed for higher values. To display all available details, supply a
value of 7. The levels for !ks.graph are the same as those for !ks.dump.
Flags
Optional. Specifies the kind of information to be displayed. Flags can be any combination of the following bits.
Bit 0 (0x1)
Display a list of IRPs queued to each pin instance in the graph.
Bit 1 (0x2)
Display a list of IRPs that are pending from each pin instance in the graph. Only IRPs that the pin knows it is waiting for are displayed.
Bit 4 (0x10)
Analyze a stalled graph for suspect filters.
DLL
Windows 2000
winxp\Ks.dll
Windows XP and later Ks.dll
Comments
This command may take a bit of time to process.
Issue a !ks.graph command with no arguments for help.
Here is an example of the !ks.graph display, with the address of a filter object:
kd> !graph 829493c4
Attempting a graph build on 829493c4...
Please be patient...
!ks.libexts
The !ks.libexts extension provides access to Microsoft-supplied library extensions that are statically linked to the extension module.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Syntax
!ks.libexts [Command] [Libext]
Parameters
Command
Optional. Specifies one of the following values. If this argument is omitted, !libexts returns help information.
disableall
Disable all library extensions. When this is used, omit the Libext parameter.
disable
Disable a specific library extension by name. When this is used, specify the name in the Libext parameter.
enableall
Enable all library extensions. Only loaded components with correct symbols are enabled. When this is used, omit the Libext parameter.
enable
Enable a specific library extension by name. When this is used, specify the name in the Libext parameter. Only loaded components with correct symbols can be
enabled.
details
Show details about all currently linked library extensions. When this is used, omit the Libext parameter.
Libext
Specifies the name of a library extension. Required only for Command values of enable or disable.
DLL
Windows 2000
winxp\Ks.dll
Windows XP and later Ks.dll
Comments
The extension module contains an extensibility framework that allows separate components to be built and linked into Ks.dll. These extra components are called library
extensions.
The !libexts command allows viewing of statistics about those library extensions as well as control over them. For details, issue !libexts with no arguments.
Additional Information
For more information, see Kernel Streaming Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!ks.objhdr
The !ks.objhdr extension displays the kernel streaming object header associated with the specified file object.
Syntax
!ks.objhdr FileObject [Level] [Flags]
Parameters
FileObject
This parameter specifies a pointer to a WDM file object. If FileObject is not valid, the command returns an error.
Level
Optional. Values are the same as those for !ks.dump.
Flags
Optional. Values are the same as those for !ks.dump.
DLL
Windows 2000
winxp\Ks.dll
Windows XP and later Ks.dll
Comments
Levels and flags for !ks.objhdr are identical to those described in !ks.dump.
The output from !ks.allstreams and !ks.enumdevobj can be used as the input for !ks.objhdr. To do this with the avssamp sample, for instance, issue the following
commands:
kd> !ks.allstreams
6 Kernel Streaming FDOs found:
Functional Device 8299be18 [\Driver\smwdm]
Functional Device 827c86d8 [\Driver\wdmaud]
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!ks.ohdr
The !ks.ohdr extension displays details of a kernel streaming object header.
Syntax
!ks.ohdr Object [Level] [Flags]
Parameters
Object
This parameter specifies a pointer to a KS object header. If Object is not valid, the command returns an error.
Level
Optional. Values are the same as those for !ks.dump.
Flags
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!ks.pciaudio
The !ks.pciaudio extension displays a list of FDOs currently attached to PortCls.
Syntax
!ks.pciaudio [Options] [Level]
Parameters
Options
Optional. Specifies the kind of information to be displayed. Options can be any combination of the following bits.
Bit 0 (0x1)
Display a list of running streams.
Bit 1 (0x2)
Display a list all streams.
Bit 3 (0x4)
Output displayed streams. Level has meaning only when this bit is set.
Level
Optional, and applicable only if Bit 3 is set in Options. Levels are the same as those for !ks.dump.
DLL
Windows 2000
winxp\Ks.dll
Windows XP and later Ks.dll
Comments
Here is an example of the output from !ks.pciaudio:
kd> !ks.pciaudio
1 Audio FDOs found:
Functional Device 8299be18 [\Driver\smwdm]
Additional Information
For more information, see Kernel Streaming Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!ks.pciks
The !ks.pciks extension lists functional devices for kernel streaming devices that are attached to the PCI bus. Optionally, it can display information about active streams on
those functional devices.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Syntax
!ks.pciks [Flags] [Level]
Parameters
Flags
Optional. Specifies the kind of information to be displayed. Flags can be any combination of the following bits.
Bit 0 (0x1)
List all currently running streams.
Bit 1 (0x2)
Recurse graphs to find non-PCI devices.
Bit 2 (0x4)
Display a list of proxy instances.
Bit 3 (0x8)
Display currently queued Irps.
Bit 4 (0x10)
Display information about all streams.
Bit 5 (0x20)
Display active stream formats.
Level
Optional, and applicable only to flag combinations that cause data to be displayed. Levels are the same as those for !ks.dump.
DLL
Windows 2000
winxp\Ks.dll
Windows XP and later Ks.dll
Comments
This command may take time to execute, especially if the ACPI filter driver is loaded, or if Driver Verifier is enabled and driver names are paged out.
Here is an example of the !ks.pciks display:
kd> !pciks
1 Kernel Streaming FDOs found:
Functional Device 82a17690 [\Driver\smwdm]
Additional Information
For more information, see Kernel Streaming Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!ks.shdr
The !ks.shdr extension command is obsolete; use !ks.dump instead.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!ks.topology
The !ks.topology extension displays a sorted graph of the internal topology of the filter closest to Object.
Syntax
!ks.topology Object [Level] [Flags]
Parameters
Object
Specifies a pointer to the object to use as a base for the graph. Can be a pointer to a file object, IRP, pin, filter, or other KS object.
Level
Optional. Specifies the level of detail to display on a 0-7 scale with progressively more information displayed for higher values. To display all available details, supply a
value of 7.
Flags
Not currently available.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
DLL
Windows 2000
winxp\Ks.dll
Windows XP and later Ks.dll
Comments
For help, issue a !ks.topology command with no arguments.
Note that this command may take a few moments to execute.
Additional Information
For more information, see Kernel Streaming Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!scsikd.help
The !scsikd.help extension displays help text for Scsikd.dll extension commands.
Syntax
!scsikd.help
DLL
Windows 2000
Scsikd.dll
Windows XP and later Scsikd.dll
Additional Information
For more information, see SCSI Miniport Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!scsikd.classext
The !scsikd.classext extension displays the specified class Plug and Play (PnP) device.
Syntax
!scsikd.classext [Device [Level]]
Parameters
Device
Specifies the device object or device extension of a class PnP device. If Device is omitted, a list of all class PnP extensions is displayed.
Level
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Specifies the amount of detail to display. This parameter can take 0, 1, or 2 as values, with 2 giving the most detail. The default is 0.
DLL
Windows 2000
Scsikd.dll
Windows XP and later Scsikd.dll
Comments
Here is an example of the !scsikd.classext display:
0: kd> !scsikd.classext
' !scsikd.classext 8633e3f0
' !scsikd.classext 86347b48
' !scsikd.classext 86347360
' !scsikd.classext 861d1898
'
'
'
'
(
) "IBM
" / "DDYS-T09170M
(paging device) "IBM
" / "DDYS-T09170M
(
) "UNISYS " / "003451ST34573WC
(
) "" / "MATSHITA CD-ROM CR-177"
"
"
"
/
/ "S93E"
/ "S80D"
/ "5786"
"7T03" /
/ "
XBY45906"
/ "
VDA60491"
/ "HN0220750000181300L6"
""
!scsikd.scsiext
The !scsikd.scsiext extension displays detailed information about the specified SCSI port extension.
Syntax
!scsikd.scsiext Device
Parameters
Device
Specifies the device object or device extension of a SCSI port extension.
DLL
Windows 2000
Scsikd.dll
Windows XP and later Scsikd.dll
Comments
Here is an example of the !scsikd.scsiext display, where the SCSI port extension has been specified by a functional device object (FDO); this can be obtained from the DO
field or DevExt field in the !minipkd.adapters display:
kd> !scsikd.scsiext 816f9a40
Scsiport functional device extension at address 816f9af8
Common Extension:
Initialized
DO 0x816f9a40 LowerObject 0x816e8030 SRB Flags 00000000
Current Power (D0,S0) Desired Power D-1 Idle 00000000
Current PnP state 0x0
Previous state 0xff
DispatchTable f9aee200
UsePathCounts (P0, H0, C0)
Adapter Extension:
Port 2
IsPnp VirtualSlot HasInterrupt
LowerPdo 0x816e8030
HwDevExt 0x8170a004
Active Requests 0xffffffff
MaxBus 0x01
MaxTarget 0x10
MaxLun 0x08
Port Flags (0x00001000): PD_DISCONNECT_RUNNING
NonCacheExt 0x81702000 IoBase 0x00002000
Int 0x1a
RealBus# 0x0 RealSlot# 0x2
Timeout 0xffffffff
DpcFlags 0x00000000
Sequence 0x00000003
Srb Ext Header 0x817061a0
No. Requests 0x00000012
QueueTag BitMap 0x00000000
Hint 0x00000000
MaxQueueTag 0xfe (@0x816f9c58)
LuExt Size 0x00000038
SrbExt Size 0x00000188
SG List Size - Small 17
Large 0
Emergency - SrbData 0x816f9830 Blocked List @0x816f9e94
CommonBuff - Size: 0x00006000
PA: 0x0000000001702000 VA: 0x81702000
Ke Objects - Int1: 0x8175ba50
Int2: 0x00000000
Dma: 0x816f9340
Lookaside - SrbData @ 0x816f9e40 SgList @0x00000000 Remove: @0x00000000
Resources - Raw: 0x817ba190
Translated: 0x81709678
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!scsikd.srbdata
The !scsikd.srbdata extension displays the specified SRB_DATA tracking block.
Syntax
!scsikd.srbdata Address
Parameters
Address
Specifies the address of an SRB_DATA tracking block.
DLL
Windows 2000
Scsikd.dll
Windows XP and later Scsikd.dll
Additional Information
For more information, see SCSI Miniport Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!minipkd.help
The !minipkd.help extension displays help text for the Minipkd.dll extension commands.
Syntax
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!minipkd.help
DLL
Windows 2000
Unavailable
Windows XP and later Minipkd.dll
Comments
If an error message similar to the following appears, it indicates that the symbol path is incorrect and does not point to the correct version of the Scsiport.sys symbols.
minipkd error (0) <path> ... \minipkd\minipkd.c @ line 435
Use the .sympath (Set Symbol Path) command to display the current path and change the path. Use the .reload (Reload Module) command to reload symbols from the
current path.
Additional Information
For more information, see SCSI Miniport Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!minipkd.adapter
The !minipkd.adapter extension displays information about the specified adapter.
Syntax
!minipkd.adapter Address
Parameters
Address
Specifies the address of an adapter.
DLL
Windows 2000
Unavailable
Windows XP and later Minipkd.dll
Comments
The address of of an adapter can be found in the DevExt field of the !minipkd.adapters display.
Additional Information
For more information, see SCSI Miniport Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!minipkd.adapters
The !minipkd.adapters extension displays all of the adapters that work with the SCSI Port driver that have been identified in the system, and the individual devices
associated with each adapter.
Syntax
!minipkd.adapters
DLL
Windows 2000
Unavailable
Windows XP and later Minipkd.dll
Comments
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The display includes the driver name, the device object address, and the device extension address for each adapter. The display for each adapter also includes a list of each
device on the adapter. The display for each device includes the device extension address, the SCSI address, the device object address, and some flags for the device.
Information about the Plug and Play state and the power state is also included.
The flags in the display are explained in the following table:
Flag
Meaning
c
Claimed. Indicates that the device has a driver on it.
m Missing. Indicates that the device was present on the bus in a prior scan but was not present during the latest scan.
e
Enumerated. Indicates that the device has been reported to the Plug and Play manager.
v
Visible. Indicates that the device has been enumerated by the system. This flag is more significant when it is not present for a device.
p
Paging. Indicates that the device is in the paging path.
d
Dump. Indicates that the device is in the crash dump path and will be used for a crash dump.
h
Hibernate. Indicates that the device is hibernating.
Here is an example of the !minipkd.adapters display:
0: kd> !minipkd.adapters
Adapter \Driver\lp6nds35
Adapter \Driver\adpu160m
LUN 862e60f8 @(0,0,0) c
LUN 863530f8 @(0,1,0) c
LUN 862e50f8 @(0,2,0) c
LUN 863520f8 @(0,6,0)
Adapter \Driver\adpu160m
ev
ev
ev
ev
DO 86334a70
DO 8633da70
pnp(00/ff)
p d pnp(00/ff)
pnp(00/ff)
pnp(00/ff)
DO 86376040
DevExt 86334b28
DevExt 8633db28
pow(0,0) DevObj 862e6040
pow(0,0) DevObj 86353040
pow(0,0) DevObj 862e5040
pow(0,0) DevObj 86352040
DevExt 863760f8
An error message similar to the following indicates that either the symbol path is incorrect and does not point to the correct version of the Scsiport.sys symbols, or that
Windows has not identified any adapters that work with the SCSI Port driver.
minipkd error (0) <path> ... \minipkd\minipkd.c @ line 435
If the !minipkd.help extension command returns help information successfully, the SCSI Port symbols are correct.
Additional Information
For more information, see SCSI Miniport Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!minipkd.exports
The !minipkd.exports extension displays the addresses of the miniport exports for the specified adapter.
Syntax
!minipkd.exports Adapter
Parameters
Adapter
Specifies the address of an adapter.
DLL
Windows 2000
Unavailable
Windows XP and later Minipkd.dll
Additional Information
For more information, see SCSI Miniport Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!minipkd.lun
The !minipkd.lun extension displays detailed information about the specified Logical Unit Extension (LUN).
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Syntax
!minipkd.lun LUN
!minipkd.lun Device
Parameters
LUN
Specifies the address of the LUN.
Device
Specifies the physical device object (PDO) for the LUN.
DLL
Windows 2000
Unavailable
Windows XP and later Minipkd.dll
Comments
A LUN is typically referred to as a device. Thus, this extension displays information about a device on an adapter.
The LUN can be specified either by its address (which can be found in the LUN field of the !minipkd.adapters display), or by its physical device object (which can be found
in the DevObj field of the !minipkd.adapters display).
Additional Information
For more information, see SCSI Miniport Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!minipkd.portconfig
The !minipkd.portconfig extension displays information about the specified PORT_CONFIGURATION_INFORMATION data structure.
Syntax
!minipkd.portconfig PortConfig
Parameters
PortConfig
Specifies the address of a PORT_CONFIGURATION_INFORMATION data structure.
DLL
Windows 2000
Unavailable
Windows XP and later Minipkd.dll
Comments
The PortConfig address can be found in the Port Config Info field of the !minipkd.adapter display.
Additional Information
For more information, see SCSI Miniport Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!minipkd.req
The !minipkd.req extension displays information about all of the currently active requests on the specified adapter or device.
Syntax
!minipkd.req Adapter
!minipkd.req Device
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Parameters
Adapter
Specifies the address of the adapter.
Device
Specifies the physical device object (PDO) for the Logical Unit Extension (LUN) device.
DLL
Windows 2000
Unavailable
Windows XP and later Minipkd.dll
Comments
The PDO for a LUN can be found in the DevObj field of the !minipkd.adapters display.
Additional Information
For more information, see SCSI Miniport Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!minipkd.srb
The !minipkd.srb extension displays the specified SCSI request block (SRB) data structure.
Syntax
!minipkd.srb SRB
Parameters
SRB
Specifies the address of an SRB.
DLL
Windows 2000
Unavailable
Windows XP and later Minipkd.dll
Comments
The addresses of all currently active requests can be found in the SRB fields of the output from the !minipkd.req command.
This extension displays the status of the SRB, the driver it is addressed to, the SCSI that issued the SRB and its address, and a hexadecimal flag value. If 0x10000 is set in the
flag value, this request is currently in the miniport.
Additional Information
For more information, see SCSI Miniport Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!wdfkd.help
The !wdfkd.help extension displays help information about all Wdfkd.dll extension commands.
Syntax
!wdfkd.help
DLL
Wdfkd.dll
Additional Information
The !wdfkd.help extension is equivalent to the !wdfkd.wdfhelp extension.
For more information about debugging framework-based drivers, see Kernel-Mode Driver Framework Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wdfkd.wdfchildlist
The !wdfkd.wdfchildlist extension displays a child list's state and information about all of the device identification descriptions that are in the child list.
Syntax
!wdfkd.wdfchildlist Handle
Parameters
Handle
A WDFCHILDLIST-typed handle to the child list.
DLL
Wdfkd.dll
Comments
The following example shows a !wdfkd.wdfchildlist display.
kd> !wdfchildlist 0x7cc090c8
Dumping WDFCHILDLIST 0x7cc090c8
--------------------------------------owning !WDFDEVICE 0x7ca7b1c0
ID description size 0x8
State:
----List is unlocked, changes will be applied immediately
No scans or enumerations are active on the list
Descriptions:
-----------PDO !WDFDEVICE 0x7cad31c8, ID description 0x83ac4ff4
+Device WDM !devobj 0x81fb00e8, WDF pnp state WdfDevStatePnpStarted (0x119)
+Device found in last scan
No pending insertions are in the list.
Callbacks:
--------EvtChildListCreateDevice:
wdfrawbusenumtest!RawBus_RawPdo_Create (f22263b0)
Additional Information
For more information, see Kernel-Mode Driver Framework Debugging.
2009 Microsoft Corporation
Send feedback on this topic
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!wdfkd.wdfcollection
The !wdfkd.wdfcollection extension displays all of the objects that are stored in a WDFCOLLECTION structure.
Syntax
!wdfkd.wdfcollection Handle
Parameters
Handle
A WDFCOLLECTION-typed handle to the structure.
DLL
Wdfkd.dll
Additional Information
For more information, see Kernel-Mode Driver Framework Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wdfkd.wdfcommonbuffer
The !wdfkd.wdfcommonbuffer extension displays information about a WDF common buffer object.
Syntax
!wdfkd.wdfcommonbuffer Handle
Parameters
Handle
A handle to a framework common buffer object (WDFCOMMONBUFFER).
DLL
Wdfkd.dll
Additional Information
For more information, see Kernel-Mode Driver Framework Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wdfkd.wdfcrashdump
The !wdfkd.wdfcrashdump extension displays the Kernel-Mode Driver Framework (KMDF) error log information and other crash dump information from a small memory
dump, if available.
Syntax
!wdfkd.wdfcrashdump [InfoType]
Parameters
InfoType
Specifies the kind of information to display. InfoType can be any one of the following values:
log
Displays error log information, if available in the crash dump file. This is the default value.
loader
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!wdfkd.wdfdevext
The !wdfkd.wdfdevext extension displays information that is associated with the DeviceExtension member of a Microsoft Windows Driver Model (WDM)
DEVICE_OBJECT structure. This information includes a handle to a WDFDEVICE-typed object and a handle to the object's driver-defined context space.
Syntax
!wdfkd.wdfdevext DeviceExtension
Parameters
DeviceExtension
A pointer to a device extension.
DLL
Wdfkd.dll
Comments
The !wdfkd.wdfdevext extension takes a device extension pointer, which is obtained from !devobj or !devstack, and returns handles to the WDFDEVICE-typed object and
the object's driver-defined context. The following example uses the !devstack and !wdfkd.wdfdevext extensions and the dt command.
Here is an example:
kd> !devstack 0x81fb00e8
!DevObj
!DrvObj
!DevExt
ObjectName
> 81fb00e8 \Driver\WdfRawBusEnumTest 8352cff0 0000005c
!DevNode 820bf170 :
DeviceInst is "WdfRawBusEnumTest\RawEnumerator\1&2d12bed1&0&Instance0"
kd> !wdfdevext 8352cff0
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!wdfkd.wdfdevice
The !wdfkd.wdfdevice extension displays information that is associated with a WDFDEVICE-typed object handle.
Syntax
!wdfkd.wdfdevice Handle [Flags]
Parameters
Handle
A handle to a WDFDEVICE-typed object.
Flags
Optional. The kind of information to display. Flags can be any combination of the following bits:
Bit 0 (0x1)
The display will include verbose information about the device, such as the associated WDFCHILDLIST-typed handles, synchronization scope, and execution level.
Bit 1 (0x2)
The display will include detailed power state information.
Bit 2 (0x4)
The display will include detailed power policy state information.
Bit 3 (0x8)
The display will include detailed Plug and Play (PnP) state information.
Bit 4 (0x10)
The display will include the device object's callback functions.
DLL
Wdfkd.dll
Comments
The following example uses the !wdfkd.wdfdevice extension on a WDFDEVICE handle that represents a physical device object (PDO), without specifying any flags.
kd> !wdfdevice 0x7cad31c8
Dumping WDFDEVICE 0x7cad31c8
=================================
WDM PDEVICE_OBJECTs:
self 81fb00e8
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
self 81fb00e8
state history:
WdfDevStatePnpObjectCreated (0x100)
WdfDevStatePnpInit (0x105)
WdfDevStatePnpInitStarting (0x106)
WdfDevStatePnpHardwareAvailable (0x108)
WdfDevStatePnpEnableInterfaces (0x109)
WdfDevStatePnpStarted (0x119)
!wdfkd.wdfdevicequeues
The !wdfkd.wdfdevicequeues extension displays information about all of the framework queue objects that belong to a specified device.
Syntax
!wdfkd.wdfdevicequeues Handle
Parameters
Handle
A handle to a WDFDEVICE-typed object.
DLL
Wdfkd.dll
Comments
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The following example shows the display from the !wdfdevicequeues extension.
kd> !wdfdevicequeues 0x7cad31c8
Dumping queues of WDFDEVICE 0x7cad31c8
=====================================
Number of queues: 3
---------------------------------Queue: 1 (!wdfqueue 0x7d67d1e8)
Manual, Not power-managed, PowerOn, Can accept, Can dispatch, ExecutionLevelDispatch, SynchronizationScopeNone
Number of driver owned requests: 0
Number of waiting requests: 0
!wdfkd.wdfdmaenabler
The !wdfkd.wdfdmaenabler extension displays information about a WDF direct memory access (DMA) object, and its transaction and common buffer objects.
Syntax
!wdfkd.wdfdmaenabler Handle
Parameters
Handle
A handle to a framework DMA enabler object (WDFDMAENABLER).
DLL
Wdfkd.dll
Additional Information
For more information, see Kernel-Mode Driver Framework Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wdfkd.wdfdmaenablers
The !wdfkd.wdfdmaenablers extension displays all WDF direct memory access (DMA) objects associated with a specified device object. It also displays their associated
transaction and common buffer objects.
Syntax
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!wdfkd.wdfdmaenablers Handle
Parameters
Handle
A handle to a framework device object (WDFDEVICE).
DLL
Wdfkd.dll
Additional Information
For more information, see Kernel-Mode Driver Framework Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wdfkd.wdfdmatransaction
The !wdfkd.wdfdmatransaction extension displays information about a WDF direct memory access (DMA) transaction object.
Syntax
!wdfkd.wdfdmatransaction Handle
Parameters
Handle
A handle to a framework DMA transaction object (WDFDMATRANSACTION).
DLL
Wdfkd.dll
Additional Information
For more information, see Kernel-Mode Driver Framework Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wdfkd.wdfdriverinfo
The !wdfkd.wdfdriverinfo extension displays information about the specified driver, including its device tree, the version of the Kernel-Mode Driver Framework (KMDF)
library that the driver was compiled with, and a list of the framework device objects that the driver created.
Syntax
!wdfkd.wdfdriverinfo [DriverName [Flags] ]
Parameters
DriverName
Optional. The name of the driver. DriverName must not include the .sys file name extension.
Flags
Optional. Flags that specify the kind of information to display. Flags can be any combination of the following bits:
Bit 0 (0x1)
The display will include verifier settings for the driver, and will also include a count of WDF objects. This flag can be combined with bit 6 (0x40) to display internal
objects.
Bit 4 (0x10)
The display will include the KMDF handle hierarchy for the driver.
Bit 5 (0x20)
The display will include context and callback function information for each handle. This flag is valid only when bit 4 (0x10) is set.
Bit 6 (0x40)
The display will include additional information for each handle. This flag is valid only when bit 4 (0x10) is set. This flag can be combined with bit 0 (0x1) to display
internal objects.
Bit 7 (0x80)
The handle information will be displayed in a more compact format.
Bit 8 (0x100)
The display will left align internal type information. This flag is valid only when bit 4 (0x10) is set.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Bit 9 (0x200)
The display will include handles that the driver potentially leaked. KMDF version 1.1 and later support this flag. This flag is valid only when bit 4 (0x10) is set.
Bit 10 (0x400)
The display will include the device tree in verbose form.
DLL
Wdfkd.dll
Comments
If you omit the DriverName parameter, the default driver is used. You can display the default driver by using the !wdfkd.wdfgetdriver extension; you can set the default
driver by using the !wdfkd.wdfsetdriver extension.
The following example shows the display from the !wdfkd.wdfdriverinfo extension.
kd> !wdfdriverinfo wdfrawbusenumtest
---------------------------------Default driver image name:
wdfrawbusenumtest
WDF library image name:
Wdf01000
FxDriverGlobals 0x83b7af18
WdfBindInfo
0xf22250ec
Version
v1.5 build(1234)
---------------------------------WDFDRIVER: 0x7cbc90d0
!WDFDEVICE 0x7ca7b1c0
context: dt 0x83584ff8 ROOT_CONTEXT (size is 0x1 bytes)
<no associated attribute callbacks>
!WDFDEVICE 0x7cad31c8
context: dt 0x8352cff0 RAW_PDO_CONTEXT (size is 0xc bytes)
<no associated attribute callbacks>
Additional Information
For more information, see Kernel-Mode Driver Framework Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wdfkd.wdfextendwatchdog
The !wdfkd.wdfextendwatchdog extension extends the time-out period (from 10 minutes to 24 hours) of the framework's watchdog timer during power transitions.
Syntax
!wdfkd.wdfextendwatchdog Handle [Extend]
Parameters
Handle
A handle to a WDFDEVICE-typed object.
Extend
Optional. A value that indicates whether to enable or disable extension of the time-out period. If Extend is 0, extension is disabled, and the time-out period is 10 minutes.
If Extend is 1, extension is enabled and the time-out period is 24 hours. The default value is 1.
DLL
Wdfkd.dll
Comments
The framework starts an internal watchdog timer every time it calls a power policy or power event callback function for a driver that is not power pageable (that is, the
DO_POWER_PAGABLE bit is clear). If the callback function causes paging I/O and therefore blocks, the operating system hangs because no paging device is available to
service the request.
If the time-out period elapses, the framework issues bug check 0x10D (WDF_VIOLATION). For details, see Bug Check 0x10D.
Additional Information
For more information, see Kernel-Mode Driver Framework Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!wdfkd.wdffindobjects
The !wdfkd.wdffindobjects extension searches memory for WDF objects.
Syntax
!wdfkd.wdffindobjects [ StartAddress [Flags] ]
Parameters
StartAddress
Optional. Specifies the address at which the search must begin. If this is omitted, the search will begin from where the most recent !wdfkd.wdffindobjects search ended.
Flags
Optional. Specifies the kind of information to display. Flags can be any combination of the following bits. The default value is 0x0. Flags cannot be used unless
StartAddress is specified.
Bit 0 (0x1)
Displays verbose output.
Bit 1 (0x2)
Displays internal type information for each handle.
DLL
Wdfkd.dll
Comments
The following examples show the output of the !wdffindobjects extension. The 0x1 flag is set in the second example.
1: kd> !wdffindobjects 0xfffffa600211b668
Address
Value
------------------ -----------------0xfffffa600211b668 0x0000000000000008
0xfffffa600211b670 0xfffffa8002e7b1f0
0xfffffa600211b678 0x0000000000000004
0xfffffa600211b680 0x0000000000000001
0xfffffa600211b688 0xfffffa8006aa3640
0xfffffa600211b690 0x0000000000000000
0xfffffa600211b698 0xfffff80001e61f78
0xfffffa600211b6a0 0x0000000000000010
0xfffffa600211b6a8 0x0000000000010286
0xfffffa600211b6b0 0xfffffa600211b6c0
0xfffffa600211b6b8 0x0000000000000000
0xfffffa600211b6c0 0xfffffa8006aa3640
0xfffffa600211b6c8 0x0000057ffd184e08
0xfffffa600211b6d0 0x0000000000000000
0xfffffa600211b6d8 0x0000057ffc51ea18
0xfffffa600211b6e0 0x0000000000000000
1: kd> !wdffindobjects 0xfffffa600211b668
Address
Value
------------------ -----------------0xfffffa600211b668 0x0000000000000008
0xfffffa600211b670 0xfffffa8002e7b1f0
0xfffffa600211b678 0x0000000000000004
0xfffffa600211b680 0x0000000000000001
0xfffffa600211b688 0xfffffa8006aa3640
0xfffffa600211b690 0x0000000000000000
0xfffffa600211b698 0xfffff80001e61f78
0xfffffa600211b6a0 0x0000000000000010
0xfffffa600211b6a8 0x0000000000010286
0xfffffa600211b6b0 0xfffffa600211b6c0
0xfffffa600211b6b8 0x0000000000000000
0xfffffa600211b6c0 0xfffffa8006aa3640
0xfffffa600211b6c8 0x0000057ffd184e08
0xfffffa600211b6d0 0x0000000000000000
0xfffffa600211b6d8 0x0000057ffc51ea18
0xfffffa600211b6e0 0x0000000000000000
Object
-----------------!WDFREQUEST 0x0000057ffd184e08
!WDFUSBPIPE 0x0000057ff955c9b8
!WDFUSBPIPE 0x0000057ff955c9b8
!WDFREQUEST 0x0000057ffd184e08
!WDFMEMORY 0x0000057ffc51ea18
1
Type
------
Object
------------------
Object
!WDFREQUEST 0x0000057ffd184e08
Object
!WDFUSBPIPE 0x0000057ff955c9b8
Object
Handle
!WDFUSBPIPE 0x0000057ff955c9b8
!WDFREQUEST 0x0000057ffd184e08
Handle
!WDFMEMORY 0x0000057ffc51ea18
Additional Information
For more information, see Kernel-Mode Driver Framework Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!wdfkd.wdfforwardprogress
The !wdfkd.wdfforwardprogress extension displays information about the forward progress of a specified framework queue object.
Syntax
!wdfkd.wdfforwardprogress Handle
Parameters
Handle
A handle to a framework queue object.
DLL
Wdfkd.dll
Comments
This extension will succeed only if the specified framework queue object is configured to support forward progress. If this extension is used with other objects, an error
message will be displayed.
The following example shows the display from a !wdfkd.wdfforwardprogress extension.
kd> !wdfkd.wdfforwardprogress 0x79af3250
Dumping forward progress fields for WDFQUEUE 0x79af3250
=================================================
ForwardProgressReservedPolicy: UseExamine (0x2)
Total reserved requests: 44
Number of available
!WDFREQUEST
!WDFREQUEST
!WDFREQUEST
!WDFREQUEST
!WDFREQUEST
!WDFREQUEST
!WDFREQUEST
!WDFREQUEST
!WDFREQUEST
!WDFREQUEST
!WDFREQUEST
!WDFREQUEST
!WDFREQUEST
!WDFREQUEST
!WDFREQUEST
!WDFREQUEST
!WDFREQUEST
!WDFREQUEST
!WDFREQUEST
!WDFREQUEST
!WDFREQUEST
!WDFREQUEST
!WDFREQUEST
!WDFREQUEST
!WDFREQUEST
!WDFREQUEST
!WDFREQUEST
!WDFREQUEST
!WDFREQUEST
!WDFREQUEST
!WDFREQUEST
!WDFREQUEST
!WDFREQUEST
!WDFREQUEST
!WDFREQUEST
!WDFREQUEST
!WDFREQUEST
!WDFREQUEST
!WDFREQUEST
!WDFREQUEST
!WDFREQUEST
41
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
use: 3
(Reserved) !IRP 0x8438f008
(Reserved) !IRP 0x875f59f0
(Reserved) !IRP 0x85c25348
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!wdfkd.wdfgetdriver
The !wdfkd.wdfgetdriver extension displays the name of the current default driver.
Syntax
!wdfkd.wdfgetdriver
DLL
Wdfkd.dll
Additional Information
For more information, see Kernel-Mode Driver Framework Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wdfkd.wdfhandle
The !wdfkd.wdfhandle extension displays information about a specified framework object handle, such as the handle type, object context pointers, and the underlying
framework object pointer.
Syntax
!wdfkd.wdfhandle Handle [Flags]
Parameters
Handle
A handle to a framework object.
Flags
Optional. Flags that specify the kind of information to display. Flags can be any combination of the following bits. The default value is 0x0.
Bit 4 (0x10)
The display will include the subtree of child objects for the specified handle.
Bit 5 (0x20)
The display will include context and callback function information for the specified handle. This flag is valid only when bit 4 (0x10) is set.
Bit 6 (0x40)
The display will include additional information for the specified handle. This flag is valid only when bit 4 (0x10) is set.
Bit 7 (0x80)
The handle information will be displayed in a more compact format.
Bit 8 (0x100)
The display will left align internal type information. This flag is valid only when bit 4 (0x10) is set.
DLL
Wdfkd.dll
Comments
The following example shows the output of the !wdfhandle extension with bit 4 set in the Flags parameter (so the output displays information about the child objects).
kd> !wdfhandle 0x7ca7b1c0 10
handle 0x7ca7b1c0, type is WDFDEVICE
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Contexts:
context: dt 0x83584ff8 ROOT_CONTEXT (size is 0x1 bytes)
<no associated attribute callbacks>
Child WDFHANDLEs of 0x7ca7b1c0:
WDFDEVICE 0x7ca7b1c0
WDFCMRESLIST 0x7ccfb058
WDFCMRESLIST 0x7cadb058
WDFCHILDLIST 0x7c72f0c8
WDFCHILDLIST 0x7cc090c8
WDFIOTARGET 0x7c9630b8
!wdfobject 0x83584e38
In the preceding example, the input handle refers to a WDFDEVICE object. This particular device object has five child objectstwo WDFCMRESLIST objects, two
WDFCHILDLIST objects, and one WDFIOTARGET object.
Additional Information
For more information, see Kernel-Mode Driver Framework Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wdfkd.wdfhelp
The !wdfkd.wdfhelp extension displays help information about all Wdfkd.dll extension commands.
Syntax
!wdfkd.wdfhelp
DLL
Wdfkd.dll
Comments
The !wdfkd.wdfhelp extension is equivalent to the !wdfkd.help extension.
Additional Information
For more information, see Kernel-Mode Driver Framework Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wdfkd.wdfinterrupt
The !wdfkd.wdfinterrupt extension displays information about a WDFINTERRUPT object.
Syntax
!wdfkd.wdfinterrupt Handle [Flags]
Parameters
Handle
A handle to a WDFINTERRUPT object.
Flags
Optional. Specifies the kind of information to display. Flags can be any combination of the following bits. The default value is 0x0.
Bit 0 (0x1)
Displays the interrupt service routines (ISRs) for the interrupt dispatch table (IDT) associated with this WDFINTERRUPT object. Setting this flag is equivalent to
following the !wdfinterrupt extension with the !idt extension.
DLL
Wdfkd.dll
Comments
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The following example shows the output of the !wdfinterrupt extension with bit 0 set in the Flags parameter (so the output displays information about the IDT).
kd> !wdfkd.wdfinterrupt 0x7a988698
!wdfkd.wdfiotarget
The !wdfkd.wdfiotarget extension displays information about a specified I/O target object.
Syntax
!wdfkd.wdfiotarget Handle [Flags]
Parameters
Handle
A handle to an I/O target object.
Flags
Optional. Flags that specify the kind of information to display. Flags can be any combination of the following bits. The default value is 0x0.
Bit 0 (0x1)
The display will include details for each of the I/O target's pending request objects.
DLL
Wdfkd.dll
Comments
The following example shows a display from the !wdfkd.wdfiotarget extension.
kd> !wdfiotarget 0x7c9630b8
WDFIOTARGET 8369cf40
=========================
WDFDEVICE: 0x7ca7b1c0
Target Device: !devobj 0x81ede5d8
Target PDO: !devobj 0x822b8a90
Type: Instack target
State: WdfIoTargetStarted
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Requests waiting: 0
Requests sent: 0
Requests sent with ignore-target-state: 0
The output in the preceding example includes the address of the I/O target's parent framework device object, along with the addresses of the WDM DEVICE_OBJECT
structures that represent the target driver's device object and the target device's physical device object (PDO).
Additional Information
For more information, see Kernel-Mode Driver Framework Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wdfkd.wdfldr
The !wdfkd.wdfldr extension displays information about the drivers that are currently dynamically bound to the Kernel-Mode Driver Framework (KMDF) library.
Syntax
!wdfkd.wdfldr
DLL
Wdfkd.dll
Additional Information
For more information, see Kernel-Mode Driver Framework Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wdfkd.wdflogdump
The !wdfkd.wdflogdump extension displays the Kernel-Mode Driver Framework (KMDF) error log records, if available, from a complete memory dump, a kernel memory
dump, or a live kernel-mode target.
Syntax
!wdfkd.wdflogdump [DriverName [WdfDriverGlobals] ]
Parameters
DriverName
Optional. The name of a driver. DriverName must not include the .sys file name extension.
WdfDriverGlobals
Optional. The address of the WdfDriverGlobals structure. You can determine this address by running !wdfkd.wdfldr and looking for the field labelled "WdfGlobals".
Or, you can supply @@(Driver!WdfDriverGlobals) as the address value, where Driver is the name of the driver. If any WdfDriverGlobals address is supplied,
DriverName is ignored (although it must nevertheless be supplied).
DLL
Wdfkd.dll
Comments
If you omit the DriverName parameter, the default driver name is used. Use the !wdfkd.wdfgetdriver extension to display the default driver name, and use the !
wdfkd.wdfsetdriver extension to set the default driver name.
To determine the address of
To display the framework's error log records from a small memory dump, use the !wdfkd.wdfcrashdump extension.
For information about setting information that the debugger needs to format WPP tracing messages, see !wdfkd.wdftmffile and !wdfkd.wdfsettraceprefix.
Additional Information
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!wdfkd.wdflogsave
The !wdfkd.wdflogsave extension saves the Kernel-Mode Driver Framework (KMDF) error log records for a specified driver to an event trace log (.etl) file that you can view
by using TraceView.
Syntax
!wdfkd.wdflogsave [DriverName [FileName] ]
Parameters
DriverName
Optional. The name of a driver. DriverName must not include the .sys file name extension.
FileName
Optional. The name of the file to which the KMDF error log records should be saved. FileName should not include the .etl file name extension. If you omit FileName, the
KMDF error log records are saved to the DriverName.etl file.
DLL
Wdfkd.dll
Comments
If you omit the DriverName parameter, the default driver name is used. Use the !wdfkd.wdfgetdriver extension to display the default driver name, and use the !
wdfkd.wdfsetdriver extension to set the default driver name.
Additional Information
For more information, see Kernel-Mode Driver Framework Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wdfkd.wdfmemory
The !wdfkd.wdfmemory extension displays the address and size of the buffer that is associated with a framework memory object.
Syntax
!wdfkd.wdfmemory Handle
Parameters
Handle
A handle to a framework memory object.
DLL
Wdfkd.dll
Additional Information
For more information, see Kernel-Mode Driver Framework Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wdfkd.wdfobject
The !wdfkd.wdfobject extension displays information about a specified framework object.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Syntax
!wdfkd.wdfobject FrameworkObject
Parameters
FrameworkObject
A pointer to a framework object.
DLL
Wdfkd.dll
Comments
If the Kernel-Mode Driver Framework (KMDF) verifier is enabled for a driver and the public handle type was marked for tracking, the display from the !wdfkd.wdfobject
extension includes the tag tracker (that is, the tracking object), as in the following example.
kd> !wdfobject 0x83584e38
The type for object 0x83584e38 is FxDevice
State: FxObjectStateCreated (0x1)
!wdfhandle 0x7ca7b1c0
dt FxDevice 0x83584e38
context: dt 0x83584ff8 ROOT_CONTEXT (size is 0x1 bytes)
<no associated attribute callbacks>
Object debug extension 83584e20
!wdftagtracker 0x83722d80
Verifier lock 0x831cefa8
State history:
[0] FxObjectStateCreated (0x1)
Additional Information
For more information, see Kernel-Mode Driver Framework Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wdfkd.wdfopenhandles
The !wdfkd.wdfopenhandles extension displays information about all the handles that are open on the specified WDF device.
Syntax
!wdfkd.wdfopenhandles Handle [Flags]
Parameters
Handle
A handle to a framework device object (WDFDEVICE).
Flags
Optional. Specifies the kind of information to display. Flags can be any combination of the following bits. The default value is 0x0.
Bit 0 (0x1)
Displays file object context information.
DLL
Wdfkd.dll
Additional Information
For more information, see Kernel-Mode Driver Framework Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!wdfkd.wdfpool
The !wdfkd.wdfpool extension is obsolete.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wdfkd.wdfpooltracker
The !wdfkd.wdfpooltracker extension is obsolete.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wdfkd.wdfpoolusage
The !wdfkd.wdfpoolusage extension displays pool usage information for a specified driver, if the Kernel-Mode Driver Framework (KMDF) verifier is enabled for the driver.
Syntax
!wdfkd.wdfpoolusage [DriverName [SearchAddress] [Flags] ]]
Parameters
DriverName
Optional. The name of a driver. DriverName must not include the .sys file name extension.
SearchAddress
Optional. A string that represents a memory address. The pool entry that contains SearchAddress is displayed. If SearchAddress is 0 or omitted, all of the driver's pool
entries are displayed.
Flags
Optional. The kind of information to display. This parameter is valid only if SearchAddress is nonzero. Flags can be any combination of the following bits. The default
value is 0x0.
Bit 0 (0x1)
Displays verbose output. Multiple lines are displayed for each. If this flag is not set, the information about an allocation is displayed on one line.
Bit 1 (0x2)
Displays internal type information for each handle.
Bit 2 (0x4)
Displays the caller of each pool entry.
DLL
Wdfkd.dll
Comments
If you omit the DriverName parameter, the default driver is used. You can display the default driver by using the !wdfkd.wdfgetdriver extension; you can set the default
driver by using the !wdfkd.wdfsetdriver extension.
The following example shows the output from the !wdfpoolusage extension when no pool allocation is marked and the Flags value is set to 0.
kd> !wdfpoolusage wdfrawbusenumtest 0 0
----------------------------------FxDriverGlobals 83b7af18 pool stats
----------------------------------Driver Tag: 'RawB'
15126 NonPaged Bytes, 548 Paged Bytes
94 NonPaged Allocations, 10 Paged Allocations
15610 PeakNonPaged Bytes, 752 PeakPaged Bytes
100 PeakNonPaged Allocations, 14 PeakPaged Allocations
pool 82dbae00, Size
Wdf01000!FxVerifierLock::AllocateThreadTable+5d
The following example shows the output from !wdfpoolusage that appears when the value of Flags is 1. (Note that the ellipsis () on the second line indicates the omission
of some output that is the same as that shown in the preceding example.)
kd> !wdfpoolusage wdfrawbusenumtest 0 1
. . .
100 PeakNonPaged Allocations, 14 PeakPaged Allocations
Client alloc starts at 82dbae00
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!wdfkd.wdfqueue
The !wdfkd.wdfqueue extension displays information about a specified framework queue object and the framework request objects that are in the queue.
Syntax
!wdfkd.wdfqueue Handle
Parameters
Handle
A handle to a framework queue object.
DLL
Wdfkd.dll
Comments
The following example shows the display from a !wdfkd.wdfqueue extension.
kd> !wdfqueue 0x7ce7d1e8
Dumping WDFQUEUE 0x7ce7d1e8
=========================
Parallel, Power-managed, PowerOff, Can accept, Can dispatch, ExecutionLevelDispatch, SynchronizationScopeNone
Number of driver owned requests: 0
Number of waiting requests: 0
!wdfkd.wdfrequest
The !wdfkd.wdfrequest extension displays information about a specified framework request object and the WDM I/O request packet (IRP) that is associated with the request
object.
Syntax
!wdfkd.wdfrequest Handle
Parameters
Handle
A handle to a framework request object.
DLL
Wdfkd.dll
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Additional Information
For more information, see Kernel-Mode Driver Framework Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wdfkd.wdfsearchpath
The !wdfkd.wdfsearchpath extension sets the search path to the format files for Kernel-Mode Driver Framework (KMDF) error log records.
Syntax
!wdfkd.wdfsearchpath Path
Parameters
Path
A search path.
DLL
Wdfkd.dll
Comments
The TRACE_FORMAT_SEARCH_PATH environment variable also controls the search path, but the !wdfkd.wdfsearchpath extension takes precedence over the search
path that TRACE_FORMAT_SEARCH_PATH specifies.
Additional Information
For more information, see Kernel-Mode Driver Framework Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wdfkd.wdfsettraceprefix
The !wdfkd.wdfsettraceprefix extension sets the trace prefix format string.
Syntax
!wdfkd.wdfsettraceprefix String
Parameters
String
A trace prefix string.
DLL
Wdfkd.dll
Comments
The trace prefix string is prepended to each trace message in the Kernel-Mode Driver Framework (KMDF) error log. The TRACE_FORMAT_PREFIX environment variable
also controls the trace prefix string.
The format of the trace prefix string is defined by the Microsoft Windows tracing tools. For more information about the format of this string and how to customize it, see the
"Trace Message Prefix" topic in the Driver Development Tools section of the Windows Driver Kit (WDK).
Additional Information
For more information, see Kernel-Mode Driver Framework Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!wdfkd.wdfsetdriver
The !wdfkd.wdfsetdriver extension sets the name of the default Kernel-Mode Driver Framework (KMDF) driver to which debugger extension commands apply.
Syntax
!wdfkd.wdfsetdriver DriverName
Parameters
DriverName
The name of a driver. DriverName must not include the .sys file name extension.
DLL
Wdfkd.dll
Comments
The !wdfkd.wdfsetdriver extension sets the default driver name. You can use this name with other wdfkd extensions that would otherwise require you to specify a driver
name.
To obtain the name of the current default KMDF driver, use the !wdfkd.wdfgetdriver extension.
Additional Information
For more information, see Kernel-Mode Driver Framework Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wdfkd.wdfspinlock
The !wdfkd.wdfspinlock extension displays information about a framework spin-lock object. This information includes the spin lock's acquisition history and the length of
time that the lock was held.
!wdfkd.wdfspinlock Handle
Parameters
Handle
A handle to a WDFSPINLOCK-typed object.
DLL
Wdfkd.dll
Additional Information
For more information, see Kernel-Mode Driver Framework Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wdfkd.wdftagtracker
The !wdfkd.wdftagtracker extension displays all available tag information (including tag value, line, file, and time) for a specified tag tracker.
Syntax
!wdfkd.wdftagtracker TagObjectPointer [Flags]
Parameters
TagObjectPointer
A pointer to a tag tracker.
Flags
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Optional. The kind of information to display. Flags can be any combination of the following bits. The default value is 0x0.
Bit 0 (0x1)
Displays the history of acquire operations and release operations on the object.
Bit 1 (0x2)
Displays the line number of the object in hexadecimal instead of decimal.
DLL
Wdfkd.dll
Comments
To retrieve a pointer to a tag tracker, use the !wdfkd.wdfobject extension on an internal framework object pointer.
To use tag tracking, you must enable both the Kernel-Mode Driver Framework (KMDF) verifier and handle tracking in the registry. Both of these settings are stored in the
drivers Parameters\Wdf subkey of the HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services key.
To enable the KMDF verifier, set a nonzero value for VerifierOn.
To enable handle tracking, set the value of TrackHandles to the name of one or more object types, or specify an asterisk (*) to track all object types. For example, the
following example specifies the tracking of references to all WDFDEVICE and WDFQUEUE objects.
TrackHandles: MULTI_SZ: WDFDEVICE WDFQUEUE
When you enable handle tracking for an object type, the framework tracks the references that are taken on any object of that type. This setting is useful in finding driver
memory leaks that unreleased references cause. TrackHandles works only if the KMDF verifier is enabled.
Additional Information
For more information, see Kernel-Mode Driver Framework Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wdfkd.wdftmffile
The !wdfkd.wdftmffile extension sets the trace message format (.tmf) file to use when the debugger is formatting Kernel-Mode Driver Framework (KMDF) error log records
for the !wdfkd.wdflogdump or !wdfkd.wdfcrashdump extensions.
!wdfkd.wdftmffile TMFpath
Parameters
TMFpath
A path that contains the .tmf file.
DLL
Wdfkd.dll
Comments
You must use the !wdfkd.wdftmffile extension before you can use the !wdfkd.wdflogdump or !wdfkd.wdfcrashdump extensions.
The following example shows how to use the !wdfkd.wdftmffile extension from the root WDK directory, for KMDF version 1.5.
kd> !wdftmffile tools\tracing\<platform>\wdf1005.tmf
Note that the path might be different for the version of the Windows Driver Kit (WDK) that you are using. Also note that the .tmf file's name represents the version of KMDF
that you are using. For example, Wdf1005.tmf is the .tmf file for KMDF version 1.5.
Additional Information
For more information, see Kernel-Mode Driver Framework Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wdfkd.wdftraceprtdebug
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The !wdfkd.wdftraceprtdebug extension enables and disables the Traceprt.dll diagnostic mode, which generates verbose debugging information.
Syntax
!wdfkd.wdftraceprtdebug {on | off}
Parameters
on
Enables the Traceprt.dll diagnostic mode.
off
Disables the Traceprt.dll diagnostic mode.
DLL
Wdfkd.dll
Comments
You should use the !wdfkd.wdftraceprtdebug extension only at the direction of technical support.
Additional Information
For more information, see Kernel-Mode Driver Framework Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wdfkd.wdfusbdevice
The !wdfkd.wdfusbdevice extension displays information about a specified Kernel-Mode Driver Framework (KMDF) USB device object. This information includes all USB
interfaces and the pipes that are configured for each interface.
Syntax
!wdfkd.wdfusbdevice Handle [Flags]
Parameters
Handle
A handle to a WDFUSBDEVICE-typed USB device object.
Flags
Optional. A hexadecimal value that modifies the kind of information to return. The default value is 0x0. Flags can be any combination of the following bits:
Bit 0 (0x1)
The display will include the properties of the I/O target.
Bit 1 (0x2)
The display will include the properties of the I/O target for each USB pipe object.
DLL
Wdfkd.dll
Additional Information
For more information, see Kernel-Mode Driver Framework Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wdfkd.wdfusbinterface
The !wdfkd.wdfusbinterface extension displays information about a specified Kernel-Mode Driver Framework (KMDF) USB interface object, including its possible and
current settings.
Syntax
!wdfkd.wdfusbinterface Handle [Flags]
Parameters
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Handle
A handle to a WDFUSBINTERFACE-typed USB interface object.
Flags
Optional. A hexadecimal value that modifies the kind of information to return. The default value is 0x0. Flags can be any combination of the following bits:
Bit 0 (0x1)
The display will include the properties of the I/O target for each KMDF USB pipe object.
DLL
Wdfkd.dll
Additional Information
For more information, see Kernel-Mode Driver Framework Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wdfkd.wdfusbpipe
The !wdfkd.wdfusbpipe extension displays information about a Kernel-Mode Driver Framework (KMDF) USB pipe object's I/O target.
Syntax
!wdfkd.wdfusbpipe Handle [Flags]
Parameters
Handle
A handle to a WDFUSBPIPE-typed USB pipe object.
Flags
Optional. A hexadecimal value that modifies the kind of information to return. The default value is 0x0. Flags can be any combination of the following bits:
Bit 0 (0x1)
The display will include the properties of the I/O target.
DLL
Wdfkd.dll
Additional Information
For more information, see Kernel-Mode Driver Framework Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wdfkd.wdfwmi
The !wdfkd.wdfwmi extension displays the Microsoft Windows Management Instrumentation (WMI) information for a specified framework device object. This information
includes all WMI provider objects and their associated WMI instance objects.
Syntax
!wdfkd.wdfwmi Handle
Parameters
Handle
A handle to a framework device object.
DLL
Wdfkd.dll
Comments
The output of the !wdfkd.wdfwmi extension includes information about the WMI registration, provider, and instances.
Additional Information
For more information, see Kernel-Mode Driver Framework Debugging.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!wudfext.help
The !wudfext.help extension displays all Wudfext.dll extension commands.
Syntax
!wudfext.help
DLL
Unavailable
Windows 2000
Windows XP and later Wudfext.dll
Additional Information
For more information, see User-Mode Driver Framework Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wudfext.umdevstack
The !wudfext.umdevstack extension displays detailed information about a device stack in the host process.
Syntax
!wudfext.umdevstack DevstackAddress [Flags]
Parameters
DevstackAddress
Specifies the address of the device stack to display information about.
Flags
Optional. Specifies the type of information to be displayed. Flags can be any combination of the following bits. The default value is 0x01.
Bit 0 (0x01)
Displays detailed information about the device stack.
Bit 8 (0x80)
Displays information about the internal framework.
DLL
Windows 2000
Unavailable
Windows XP and later Wudfext.dll
Comments
The following is an example of the !wudfext.umdevstack display:
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!wudfext.umdevstacks
The !wudfext.umdevstacks extension displays information about all device stacks in the current host process.
Syntax
!wudfext.umdevstacks [Flags]
Parameters
Flags
Optional. Specifies the type of information to be displayed. Flags can be any combination of the following bits. The default value is 0x01.
Bit 0 (0x01)
Displays detailed information about each device stack.
Bit 8 (0x80)
Displays information about the internal framework.
DLL
Unavailable
Windows 2000
Windows XP and later Wudfext.dll
Comments
The !wudfext.umdevstacks extension displays the framework interface objects that are associated with each device stack. For more information about using the output from !
wudfext.umdevstacks, see !wudfext.umdevstack.
The !wudfext.umdevstacks output includes two fields entitled "Object Tracking" and "Refcount Tracking". These indicate whether the object tracking option
(TrackObjects) and the reference count tracking option (TrackRefCounts) have been enabled in WDF Verifier, respectively. If the object tracking option has been enabled,
the display includes the object tracker address; this address can be passed to !wudfext.wudfdumpobjects to display tracking information.
Here is an example of the !wudfext.umdevstacks display:
0: kd> !umdevstacks
Number of device stacks: 1
Device Stack: 0x038c6f08
Pdo Name: \Device\USBPDO-11
Number of UM devices: 1
Device 0
Driver Config Registry Path: WUDFOsrUsbFx2
UMDriver Image Path: D:\Windows\system32\DRIVERS\UMDF\WUDFOsrUsbFx2.dll
Fx Driver: IWDFDriver 0x3076ff0
Fx Device: IWDFDevice 0x3082e70
IDriverEntry: WUDFOsrUsbFx2!CMyDriver 0x0306eff8
Open UM files (use !umfile <addr> for details):
0x04a8ef84
Device XFerMode: CopyImmediately RW: Buffered CTL: Buffered
Object Tracker Address: 0x03074fd8
Object
Tracking ON
Refcount Tracking OFF
DevStack XFerMode: CopyImmediately RW: Buffered CTL: Buffered
Additional Information
For more information, see User-Mode Driver Framework Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!wudfext.umfile
The !wudfext.umfile extension displays information about a UMDF intra-stack file.
Syntax
!wudfext.umfile Address
Parameters
Address
Specifies the address of the UMDF intra-stack file to display information about.
DLL
Windows 2000
Unavailable
Windows XP with UMDF version 1.7 and later Wudfext.dll
Additional Information
For more information, see User-Mode Driver Framework Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wudfext.umirp
The !wudfext.umirp extension displays information about a host user-mode I/O request packet (UM IRP).
Syntax
!wudfext.umirp Address
Parameters
Address
Specifies the address of the UM IRP to display information about.
DLL
Windows 2000
Unavailable
Windows XP and later Wudfext.dll
Comments
You can use the !wudfext.umirps extension command to display a list of all outstanding UM IRPs in the host process.
Each UM IRP has one or more stack locations. Each stack location corresponds to the parameters that a single driver in the device stack will receive when it is called to
handle a request.
!wudfext.umirp dumps all of the stack locations and marks the current location with a right angle bracket (>). The current location corresponds to the driver that currently
owns the request. The current location changes when a driver forwards a request to the next lower driver in the stack, or when the driver completes a request that the driver
owns.
The following is an example of the !wudfext.umirp display:
kd> !umirp 3dd480
UM IRP: 0x003dd480 UniqueId: 0xde Kernel Irp: 0x0x85377850
Type: WudfMsg_READ
ClientProcessId: 0x338
Device Stack: 0x0034e4e0
IoStatus
hrStatus: 0x0
Information: 0x0
Driver/Framework created IRP: No
Data Buffer: 0x00000000 / 0
IsFrom32BitProcess: Yes
CancelFlagSet: No
Cancel callback: 0x01102224
Total number of stack locations: 2
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
CurrentStackLocation: 2 (StackLocation[ 1 ])
StackLocation[ 0 ]
UNINITIALIZED
> StackLocation[ 1 ]
IWDFRequest: ????
IWDFDevice:
0x000f2f80
IWDFFile:
0x003a7648
Completion:
Callback:
0x00000000
Context:
0x00000000
Parameters: (RequestType: WdfRequestRead)
Buffer length:
0x400
Key:
0x00000000
Offset:
0x0
Additional Information
For more information, see User-Mode Driver Framework Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wudfext.umirps
The !wudfext.umirps extension displays the list of pending user-mode I/O request packets (UM IRPs) in the host process.
Syntax
!wudfext.umirps [NumberOfIrps [Flags] ]
Parameters
NumberOfIrps
Optional. Specifies the number of pending UM IRPs to display information about. If NumberOfIrps is an asterisk (*) or is omitted, all UM all UM IRPs will be displayed.
Flags
Optional. Specifies the type of information to be displayed. Flags can be any combination of the following bits. The default value is 0x01.
Bit 0 (0x01)
Displays details about the pending IRPs.
DLL
Unavailable
Windows 2000
Windows XP and later Wudfext.dll
Comments
The list of pending UM IRPs that are displayed have either been presented to the driver or are waiting to be presented to the driver.
By default, !wudfext.umirps shows all UM IRPs. However, you can use the NumberOfIrps parameter to limit this display.
The following is an example of the !wudfext.umirps display:
kd> !umirps 0xa
Number of pending IRPS: 0xc8
#### CWudfIrp
Type
---- ---------------- ---------0000
3dd280
READ
0001
3dd380
WRITE
0002
3dd480
READ
0003
3dd580
READ
0004
3dd680
WRITE
0005
3dd780
READ
0006
3dd880
WRITE
0007
3dd980
READ
0008
3dda80
READ
0009
3ddb80
WRITE
UniqueId
---------------dc
dd
de
df
e0
e1
e2
e3
e4
e5
KernelIrp
--------856f02f0
85b869e0
85377850
93bba4e8
84cb9d70
85bec150
86651db0
85c22818
9961d150
85c15148
To determine the corresponding kernel-mode IRP, use the !wudfext.wudfdownkmirp extension. Alternatively, you can use the values in the UniqueId and KernelIrp
columns to match a UMDF IRP (or UM IRP) to a corresponding kernel IRP. You can pass the values in the CWudfIrp column to the !wudfext.umirp extension to determine
the framework IWDFRequest objects that each layer in the device stack can access.
Additional Information
For more information, see User-Mode Driver Framework Debugging.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!wudfext.wudfdevice
The !wudfext.wudfdevice extension displays the Plug and Play (PnP) and power-management state systems for a device.
Syntax
!wudfext.wudfdevice pWDFDevice
Parameters
pWDFDevice
Specifies the address of the IWDFDevice interface to display PnP or power-management state about.
DLL
Unavailable
Windows 2000
Windows XP and later Wudfext.dll
Comments
You can use the !wudfext.wudfdevice extension to determine the current PnP or power-management state of the device that the pWDFDevice parameter specifies.
The following is an example of the !wudfext.wudfdevice display:
kd> !wudfdevice 0xf2f80
Pnp Driver Callbacks:
IPnpCallback: 0x0
IPnpCallbackHardware: 0x0
IPnpSelfManagedIo: 0x0
Pnp State Machine:
CurrentState: WdfDevStatePnpStarted
Pending UMIrp: 0x00000000
Could not read event queue depth, assuming 8
Event queue:
Processed/in-process events:
PnpEventAddDevice
PnpEventStartDevice
PnpEventPwrPolStarted
Pending events:
State History:
WdfDevStatePnpInit
WdfDevStatePnpInitStarting
WdfDevStatePnpHardwareAvailable
WdfDevStatePnpEnableInterfaces
WdfDevStatePnpStarted
Power State Machine:
CurrentState:
WdfDevStatePowerD0
Pending UMIrp:
0x00000000
IoCallbackFailure: false
Could not read event queue depth, assuming 8
Event queue:
Processed/in-process events:
PowerImplicitD0
Pending events:
State History:
WdfDevStatePowerStartingCheckDeviceType
WdfDevStatePowerD0Starting
WdfDevStatePowerD0StartingConnectInterrupt
WdfDevStatePowerD0StartingDmaEnable
WdfDevStatePowerD0StartingStartSelfManagedIo
WdfDevStatePowerDecideD0State
WdfDevStatePowerD0
Power Policy State Machine:
CurrentState
: WdfDevStatePwrPolStartingSucceeded
PowerPolicyOwner
: false
PendingSystemPower UMIrp : 0x00000000
PowerFailed
: false
Could not read event queue depth, assuming 8
Event queue:
Processed/in-process events:
PwrPolStart
PwrPolPowerUp
Pending events:
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
State History:
WdfDevStatePwrPolStarting
WdfDevStatePwrPolStarted
WdfDevStatePwrPolStartingSucceeded
Additional Information
For more information, see User-Mode Driver Framework Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wudfext.wudfdevicequeues
The !wudfext.wudfdevicequeues extension displays information about all the I/O queues for a device.
Syntax
!wudfext.wudfdevicequeues pWDFDevice
Parameters
pWDFDevice
Specifies the address of the IWDFDevice interface for which to display information about all of its associated I/O queues. The !wudfext.wudfdriverinfo extension
command determines the address of IWDFDevice.
DLL
Unavailable
Windows 2000
Windows XP and later Wudfext.dll
Comments
The following is an example of the !wudfext.wudfdevicequeues display:
kd> !wudfdevicequeues 0xf2f80
-------------------------------------------------Queue: 1 (!wudfqueue 0x000f3500)
WdfIoQueueDispatchSequential, POWER MANAGED, WdfIoQueuePowerOn, CAN ACCEPT, CAN DISPATCH
Number of driver owned requests: 1
IWDFIoRequest 0x000fa7c0
CWdfIoRequest 0x000fa748
Number of waiting requests: 199
IWDFIoRequest 0x000fa908
CWdfIoRequest 0x000fa890
IWDFIoRequest 0x000faa50
CWdfIoRequest 0x000fa9d8
IWDFIoRequest 0x000fa678
CWdfIoRequest 0x000fa600
Driver's callback interfaces.
IQueueCallbackRead 0x000f343c
IQueueCallbackDeviceIoControl 0x000f3438
IQueueCallbackWrite 0x000f3440
Additional Information
For more information, see User-Mode Driver Framework Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wudfext.wudfdownkmirp
The !wudfext.downkmmirp extension displays the kernel-mode I/O request packet (IRP) that corresponds to the specified user-mode I/O request packet (UM IRP).
Syntax
!wudfext.wudfdownkmirp Address
Parameters
Address
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Specifies the address of the UM IRP whose corresponding kernel-mode IRP is to be displayed.
DLL
Windows 2000
Unavailable
Windows XP and later Wudfext.dll
Comments
You can use the !wudfext.umirps extension command to display a list of all outstanding UM IRPs in the host process.
Additional Information
For more information, see User-Mode Driver Framework Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wudfext.wudfdriverinfo
The !wudfext.wudfdriverinfo extension displays information about a UMDF driver within the current host process.
Syntax
!wudfext.wudfdriverinfo Name
Parameters
Name
Specifies the name of the UMDF driver to display information about.
DLL
Unavailable
Windows 2000
Windows XP and later Wudfext.dll
Comments
The !wudfext.wudfdriverinfo extension iterates through each level in each device stack and displays the driver and device information for each entry that matches the driver
whose name is specified in the Name parameter.
You can use !wudfext.wudfdriverinfo to quickly find the device object for your driver.
The following is an example of the !wudfext.wudfdriverinfo display:
kd> !wudfdriverinfo wudfechodriver
IWDFDriver: 0xf2db8
!WDFDEVICE 0xf2f80
!devstack 0x34e4e0 @ level 0
Additional Information
For more information, see User-Mode Driver Framework Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wudfext.wudfdumpobjects
The !wudfext.wudfdumpobjects extension displays outstanding UMDF objects.
Syntax
!wudfext.wudfdumpobjects ObjTrackerAddress
Parameters
ObjTrackerAddress
Specifies the address to track leaked objects. This address is displayed in the driver-stop message in the debugger when a leak occurs.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
DLL
Unavailable
Windows 2000
Windows XP with UMDF version 1.7 and later Wudfext.dll
Comments
If the UMDF object tracking option (TrackObjects) has been enabled in WDF Verifier, you can use !wudfext.wudfdumpobjects to see any leaked objects that remain after
the driver unloads.
If the TrackObjects option has been enabled, the address of the object tracker is automatically displayed when a leak is detected. Use this address as ObjTrackerAddress
when executing !wudfext.wudfdumpobjects.
This extension can be used at any time, even if UMDF has not broken in to the debugger.
If UMDF is version 1.9 or above, you can use either !wudfext.umdevstack or !wudfext.umdevstacks to determine the address of the object tracker. This address can then be
passed to !wudfext.wudfdumpobjects. Here is an example:
0: kd> !umdevstacks
Number of device stacks: 1
Device Stack: 0x038c6f08
Pdo Name: \Device\USBPDO-11
Number of UM devices: 1
Device 0
Driver Config Registry Path: WUDFOsrUsbFx2
UMDriver Image Path: D:\Windows\system32\DRIVERS\UMDF\WUDFOsrUsbFx2.dll
Fx Driver: IWDFDriver 0x3076ff0
Fx Device: IWDFDevice 0x3082e70
IDriverEntry: WUDFOsrUsbFx2!CMyDriver 0x0306eff8
Open UM files (use !umfile <addr> for details):
0x04a8ef84
Device XFerMode: CopyImmediately RW: Buffered CTL: Buffered
Object Tracker Address: 0x03074fd8
Object
Tracking ON
Refcount Tracking OFF
DevStack XFerMode: CopyImmediately RW: Buffered CTL: Buffered
0: kd> !wudfdumpobjects 0x03074fd8
WdfTypeDriver
Object: 0x03076fb0, Interface: 0x03076ff0
WdfTypeDevice
Object: 0x03082e30, Interface: 0x03082e70
WdfTypeIoTarget Object: 0x03088f50, Interface: 0x03088f90
WdfTypeIoQueue
Object: 0x0308ce58, Interface: 0x0308ce98
WdfTypeIoQueue
Object: 0x03090e58, Interface: 0x03090e98
WdfTypeIoQueue
Object: 0x03092e58, Interface: 0x03092e98
WdfTypeIoTarget Object: 0x03098f40, Interface: 0x03098f80
WdfTypeFile
Object: 0x0309cfa0, Interface: 0x0309cfe0
WdfTypeUsbInterface
Object: 0x030a0f98, Interface: 0x030a0fd8
WdfTypeRequest Object: 0x030a2ef8, Interface: 0x030a2f38
WdfTypeIoTarget Object: 0x030a6f30, Interface: 0x030a6f70
WdfTypeIoTarget Object: 0x030aaf30, Interface: 0x030aaf70
WdfTypeIoTarget Object: 0x030aef30, Interface: 0x030aef70
WdfTypeRequest Object: 0x030c6ef8, Interface: 0x030c6f38
WdfTypeRequest Object: 0x030ceef8, Interface: 0x030cef38
WdfTypeMemoryObject
Object: 0x030d6fb0, Interface: 0x030d6ff0
WdfTypeMemoryObject
Object: 0x030dcfb0, Interface: 0x030dcff0
WdfTypeFile
Object: 0x030e4fa8, Interface: 0x030e4fe8
WdfTypeFile
Object: 0x030e6fa8, Interface: 0x030e6fe8
WdfTypeFile
Object: 0x030e8fa8, Interface: 0x030e8fe8
WdfTypeRequest Object: 0x030eaef8, Interface: 0x030eaf38
WdfTypeMemoryObject
Object: 0x030ecfb0, Interface: 0x030ecff0
WdfTypeMemoryObject
Object: 0x030eefb0, Interface: 0x030eeff0
Additional Information
For more information, see User-Mode Driver Framework Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wudfext.wudffile
The !wudfext.wudffile extension displays information about a framework file.
Syntax
!wudfext.wudffile pWDFFile [TypeName]
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Parameters
pWDFFile
Specifies the address of the IWDFFile interface to display information about.
TypeName
Optional. Specifies the type of the interface (for example, IWDFDevice). If a value for TypeName is supplied, the extension uses the value as the type of the interface. If
an asterisk (*) is supplied as TypeName, or if TypeName is omitted, the extension attempts to automatically determine the type of the supplied interface.
DLL
Windows 2000
Unavailable
Windows XP with UMDF version 1.7 and later Wudfext.dll
Additional Information
For more information, see User-Mode Driver Framework Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wudfext.wudffilehandletarget
The !wudfext.wudffilehandletarget extension displays information about a file-handle-based I/O target.
Syntax
!wudfext.wudffilehandletarget pWDFFileHandleTarget [TypeName]
Parameters
pWDFFileHandleTarget
Specifies the address of the IWDFIoTarget interface to display information about. The !wudfext.wudfobject extension command determines the address of
IWDFIoTarget.
TypeName
Optional. Specifies the type of the interface (for example, IWDFDevice). If a value for TypeName is supplied, the extension uses the value as the type of the interface. If
an asterisk (*) is supplied as TypeName, or if TypeName is omitted, the extension attempts to automatically determine the type of the supplied interface.
DLL
Unavailable
Windows 2000
Windows XP with UMDF version 1.7 and later Wudfext.dll
Additional Information
For more information, see User-Mode Driver Framework Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wudfext.wudfiotarget
The !wudfext.wudfiotarget extension displays information about an I/O target including the taget's state and list of sent requests.
Syntax
!wudfext.wudfiotarget pWDFTarget [TypeName]
Parameters
pWDFTarget
Specifies the address of the IWDFIoTarget interface to display information about. The !wudfext.wudfobject extension command determines the address of
IWDFIoTarget.
TypeName
Optional. Specifies the type of the interface (for example, IWDFDevice). If a value for TypeName is supplied, the extension uses the value as the type of the interface. If
an asterisk (*) is supplied as TypeName, or if TypeName is omitted, the extension attempts to automatically determine the type of the supplied interface.
DLL
Windows 2000
Unavailable
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!wudfext.wudfobject
The !wudfext.wudfobject extension displays information about a WDF object, as well as its parent and child relationships.
Syntax
!wudfext.wudfobject pWDFObject [Flags [TypeName] ]
Parameters
pWDFObject
Specifies the address of the WDF interface to display information about.
Flags
Optional. Specifies the type of information to be displayed. Flags can be any combination of the following bits. The default value is 0x01.
Bit 0 (0x01)
Steps recursively through the object hierarchy to obtain the parent and child relationships, which are displayed.
Bit 1 (0x02)
Displays only summary information about the object.
Bit 8 (0x80)
Steps recursively through the object hierarchy, and displays details about the internal framework.
TypeName
Optional. Specifies the type of the interface (for example, IWDFDevice). If a value for TypeName is supplied, the extension uses the value as the type of the interface. If
an asterisk (*) is supplied as TypeName, or if TypeName is omitted, the extension attempts to automatically determine the type of the supplied interface.
DLL
Windows 2000
Unavailable
Windows XP and later Wudfext.dll
Comments
You can use !wudfext.wudfobject to list, for example, the child objects of an IWDFDevice object, which generally include the devices queues.
You can also use !wudfext.wudfobject to find WDF objects that are associated with a particular device, to check the state of a WDF object (for example, whether the WDF
object is in the process of deletion), or to determine the WDF objects current reference count.
The !wudfext.wudfobject extension also displays the callback functions and context objects that the driver associated with each framework object and attempts to determine
the framework object's type. This last feature might not work with certain compilers.
The following are some examples. In the first example, !wudfext.umdevstacks gives 0x03050E70 as the address of a device object, and this address is then passed to !
wudfext.wudfobject. The 0x1 flag is included to display all the children of this object.
0: kd> !umdevstacks
Number of device stacks: 1
Device Stack: 0x038f6f08
Pdo Name: \Device\USBPDO-11
Number of UM devices: 1
Device 0
Driver Config Registry Path: WUDFOsrUsbFx2
UMDriver Image Path: D:\Windows\system32\DRIVERS\UMDF\WUDFOsrUsbFx2.dll
Fx Driver: IWDFDriver 0x3044ff0
Fx Device: IWDFDevice 0x3050e70
IDriverEntry: WUDFOsrUsbFx2!CMyDriver 0x0303eff8
Open UM files (use !umfile <addr> for details):
0x049baf84
Device XFerMode: CopyImmediately RW: Buffered CTL: Buffered
Object Tracker Address: 0x00000000
Object
Tracking OFF
Refcount Tracking OFF
DevStack XFerMode: CopyImmediately RW: Buffered CTL: Buffered
0: kd> !wudfobject 0x3050e70 1
IWDFDevice 0x3050e70 Fx: 0x3050e30 [Ref 2]
15 Children
00: IWDFIoTarget 0x3056f90 Fx: 0x3056f50 [Ref 3]
No Children
01: <Internal>
02: <Internal>
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
03: <Internal>
04: IWDFIoQueue 0x305ae98 Fx: 0x305ae58 [Ref 8]
No Children
05: IWDFIoQueue 0x305ee98 Fx: 0x305ee58 [Ref 2]
No Children
06: IWDFIoQueue 0x3060e98 Fx: 0x3060e58 [Ref 2]
No Children
07: IWDFIoTarget 0x3066f80 Fx: 0x3066f40 [Ref 2]
1 Children
00: IWDFUsbInterface 0x306efd8 Fx: 0x306ef98 [Ref 1]
3 Children
00: IWDFIoTarget 0x3074f70 Fx: 0x3074f30 [Ref 2]
2 Children
00: IWDFMemory 0x30a4ff0 Fx: 0x30a4fb0 [Ref 2]
No Children
01: IWDFMemory 0x30aaff0 Fx: 0x30aafb0 [Ref 2]
No Children
01: IWDFIoTarget 0x3078f70 Fx: 0x3078f30 [Ref 1]
No Children
Here is an example of !wudfext.wudfobject displaying a file object:
kd> !wudfobject 0xf5060
IWDFFile 0xf5060 Fx: 0xf4fe8 [Ref 1]
State: Created
Parent: 0xf2f80
No Children
Here is an example of !wudfext.wudfobject displaying a driver object:
kd> !wudfobject 0xf2db8 0x01
IWDFDriver 0xf2db8 Fx: 0xf2d40 [Ref 2]
Callback: (WUDFEchoDriver!CMyDriver, 0xf2c68)
State: Created
Parent: 0
1 Children:
00: IWDFDevice 0xf2f80 Fx: 0xf2f08 [Ref 2]
State: Created
Parent: 0xf2db8
5 Children:
00: IWDFIoTarget 0xf33c0 Fx: 0xf3348 [Ref 3]
State: Created
Parent: 0xf2f80
No Children
01: IWDFIoQueue 0xf3500 Fx: 0xf3488 [Ref 3]
State: Created
Parent: 0xf2f80
No Children
02: IWDFFile 0xf5060 Fx: 0xf4fe8 [Ref 1]
State: Created
Parent: 0xf2f80
No Children
03: IWDFFile 0xf5100 Fx: 0xf5088 [Ref 101]
State: Created
Parent: 0xf2f80
No Children
04: IWDFFile 0xf51a0 Fx: 0xf5128 [Ref 101]
State: Created
Parent: 0xf2f80
No Children
Additional Information
For more information, see User-Mode Driver Framework Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wudfext.wudfqueue
The !wudfext.wudfqueue extension displays information about an I/O queue.
Syntax
!wudfext.wudfqueue pWDFQueue
Parameters
pWDFQueue
Specifies the address of the IWDFIoQueue interface to display information about. The !wudfext.wudfdevicequeues extension command determines the address of
IWDFIoQueue.
DLL
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Windows 2000
Unavailable
Windows XP and later Wudfext.dll
Comments
The following is an example of the !wudfext.wudfqueue display:
kd> !wudfqueue 0x000f3500
WdfIoQueueDispatchSequential, POWER MANAGED,
Number of driver owned requests: 1
IWDFIoRequest 0x000fa7c0
CWdfIoRequest
Number of waiting requests: 199
IWDFIoRequest 0x000fa908
CWdfIoRequest
IWDFIoRequest 0x000faa50
CWdfIoRequest
IWDFIoRequest 0x000fab98
CWdfIoRequest
...
IWDFIoRequest 0x000fa530
CWdfIoRequest
IWDFIoRequest 0x000fa678
CWdfIoRequest
Driver's callback interfaces.
IQueueCallbackRead 0x000f343c
IQueueCallbackDeviceIoControl 0x000f3438
IQueueCallbackWrite 0x000f3440
Additional Information
For more information, see User-Mode Driver Framework Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wudfext.wudfrefhist
The !wudfext.wudfrefhist extension displays the reference count stack history for a UMDF object.
Syntax
!wudfext.wudfrefhist ObjectAddress
Parameters
ObjectAddress
Specifies the address of the UMDF object whose reference count stack history is to be displayed. Note that this is the address of the object itself, not of the interface.
DLL
Windows 2000
Unavailable
Windows XP and later Wudfext.dll
Comments
The ObjectAddress parameter must be the address of the UMDF object, not the address of the interface (which is used by many other UMDF extensions). To determine the
address of the UMDF object, the !wudfext.wudfdumpobjects extension can be used; this extension displays both the UMDF object address and the interface address.
Alternatively, if you know the address of the interface, you can use it as the argument of the !wudfext.wudfobject extension; the resulting display will include the object
address (displayed after the symbol "Fx:").
If the reference count tracking option (TrackRefCounts) has been enabled in WDF Verifier, you can use !wudfext.wudfrefhist to display each call stack that increments or
decrements an object's reference count. You can determine whether a call stack is causing a memory leak by examining its AddRef and Release calls for references that are
being added and not released.
This extension can be used at any time, even if UMDF has not broken in to the debugger.
If this extension does not display the desired information, make sure that the relevant data is paged in and then try again.
Here is an example of the !wudfext.wudfrefhist display:
kd> !wudfrefhist 0x4e1fc78
----------------------------------------------------------------------2 (++)
----------------------------------------------------------------------WUDFx!CWdfObject::TrackRefCounts+0xf7
WUDFx!CWdfObject::AddRef+0x41
WUDFx!CWdfIoQueue::AddRef+0x1a
WUDFx!CWdfDevice::CreateIoQueue+0x432
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
0x044e8719
<Symbol name not found, hr=0x80004005>
WUDFx!CWdfDevice::CreateIoQueue+0x0
0x044e73e3
<Symbol name not found, hr=0x80004005>
WUDFx!CWdfDevice::CreateIoQueue+0x0
0x044e714e
<Symbol name not found, hr=0x80004005>
WUDFx!CWdfDevice::CreateIoQueue+0x0
WUDFx!CWdfDriver::OnAddDevice+0x7b4
WUDFx!CWUDF::AddDevice+0x28
wudfhost!CWudfDeviceStack::OnAddDevice+0x158
wudfhost!CLpcNotification::OnAddDevice+0x150
wudfhost!CLpcNotification::Message+0x115
wudfhost!WdfLpcPort::ProcessMessage+0x1d9
wudfhost!WdfLpcCommPort::ProcessMessage+0x1ff
wudfhost!WdfLpcConnPort::ProcessMessage+0xf8
wudfhost!WdfLpc::WorkerThread+0x2b8
----------------------------------------------------------------------3 (++)
----------------------------------------------------------------------WUDFx!CWdfObject::TrackRefCounts+0xf7
WUDFx!CWdfObject::AddRef+0x41
WUDFx!CWdfIoQueue::AddRef+0x1a
WUDFx!CWdfIoQueue::QueryInterface+0xe8
WUDFx!CWdfDevice::CreateIoQueue+0x516
0x044e8719
<Symbol name not found, hr=0x80004005>
WUDFx!CWdfDevice::CreateIoQueue+0x0
0x044e73e3
<Symbol name not found, hr=0x80004005>
WUDFx!CWdfDevice::CreateIoQueue+0x0
0x044e714e
<Symbol name not found, hr=0x80004005>
WUDFx!CWdfDevice::CreateIoQueue+0x0
WUDFx!CWdfDriver::OnAddDevice+0x7b4
WUDFx!CWUDF::AddDevice+0x28
wudfhost!CWudfDeviceStack::OnAddDevice+0x158
wudfhost!CLpcNotification::OnAddDevice+0x150
wudfhost!CLpcNotification::Message+0x115
wudfhost!WdfLpcPort::ProcessMessage+0x1d9
wudfhost!WdfLpcCommPort::ProcessMessage+0x1ff
wudfhost!WdfLpcConnPort::ProcessMessage+0xf8
----------------------------------------------------------------------2 (--)
----------------------------------------------------------------------WUDFx!CWdfObject::TrackRefCounts+0xf7
WUDFx!CWdfObject::Release+0x41
WUDFx!CWdfIoQueue::Release+0x1a
. . . .
Additional Information
For more information, see User-Mode Driver Framework Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wudfext.wudfrequest
The !wudfext.wudfrequest extension displays information about an I/O request.
Syntax
!wudfext.wudfrequest pWDFRequest
Parameters
pWDFRequest
Specifies the address of the WDFIoRequest interface to display information about. The !wudfext.wudfqueue extension command determines the address of
WDFIoRequest.
DLL
Windows 2000
Unavailable
Windows XP and later Wudfext.dll
Comments
The following is an example of the !wudfext.wudfrequest display:
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Additional Information
For more information, see User-Mode Driver Framework Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wudfext.wudfusbinterface
The !wudfext.wudfusbinterface extension displays information about a USB interface object.
Syntax
!wudfext.wudfusbinterface pWDFUSBInterface [TypeName]
Parameters
pWDFUSBInterface
Specifies the address of the IWDFUsbInterface interface to display information about. The !wudfext.wudfobject extension command determines the address of
IWDFUsbInterface.
TypeName
Optional. Specifies the type of the interface (for example, IWDFDevice). If a value for TypeName is supplied, the extension uses the value as the type of the interface. If
an asterisk (*) is supplied as TypeName, or if TypeName is omitted, the extension attempts to automatically determine the type of the supplied interface.
DLL
Windows 2000
Unavailable
Windows XP with UMDF version 1.7 and later Wudfext.dll
Additional Information
For more information, see User-Mode Driver Framework Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!wudfext.wudfusbpipe
The !wudfext.wudfusbpipe extension displays information about a USB pipe object.
Syntax
!wudfext.wudfusbpipe pWDFUSBPipe [TypeName]
Parameters
pWDFUSBPipe
Specifies the address of the IWDFUsbTargetPipe interface to display information about. The !wudfext.wudfobject extension command determines the address of
IWDFUsbTargetPipe.
TypeName
Optional. Specifies the type of the interface (for example, IWDFDevice). If a value for TypeName is supplied, the extension uses the value as the type of the interface. If
an asterisk (*) is supplied as TypeName, or if TypeName is omitted, the extension attempts to automatically determine the type of the supplied interface.
DLL
Windows 2000
Unavailable
Windows XP with UMDF version 1.7 and later Wudfext.dll
Additional Information
For more information, see User-Mode Driver Framework Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wudfext.wudfusbtarget
The !wudfext.wudfusbtarget extension displays information about a USB I/O target.
Syntax
!wudfext.wudfusbtarget pWDFUSBTarget [TypeName]
Parameters
pWDFUSBTarget
Specifies the address of the IWDFUsbTargetDevice interface to display information about. The !wudfext.wudfobject extension command determines the address of
IWDFUsbTargetDevice.
TypeName
Optional. Specifies the type of the interface (for example, IWDFDevice). If a value for TypeName is supplied, the extension uses the value as the type of the interface. If
an asterisk (*) is supplied as TypeName, or if TypeName is omitted, the extension attempts to automatically determine the type of the supplied interface.
DLL
Unavailable
Windows 2000
Windows XP with UMDF version 1.7 and later Wudfext.dll
Additional Information
For more information, see User-Mode Driver Framework Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!wmitrace.disable
The !wmitrace.disable extension disables a provider for the specified Event Tracing for Windows (ETW) trace session.
Syntax
!wmitrace.disable { LoggerID | LoggerName } GUID
Parameters
LoggerID
Specifies the trace session. LoggerID is an ordinal number that the system assigns to each trace session on the computer.
LoggerName
Specifies the trace session. LoggerName is the text name that was specified when the trace session was started.
GUID
Specifies the GUID of the provider to be disabled.
DLL
This extension is exported by Wmitrace.dll.
This extension is available in Windows 7 and later versions of Windows.
Comments
After using this extension, you must resume program execution (for example, by using the g (Go) command) in order for it to take effect. After a brief time, the target
computer automatically breaks into the debugger again.
To enable a provider, use !wmitrace.enable.
Additional Information
For a conceptual overview of event tracing, see the Microsoft Windows SDK. For information about tracing tools, see the Windows Driver Kit (WDK).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wmitrace.dumpmini
The !wmitrace.dumpmini extension displays the system trace fragment, which is stored in a dump file.
Syntax
!wmitrace.dumpmini
DLL
This extension is exported by Wmitrace.dll.
This extension is available in Windows Vista and later versions of Windows.
This extension is useful only when debugging a minidump file or a full dump file.
Comments
The system trace fragment is a copy of the contents of the last buffer of the System Context Log. Under normal conditions, this is the trace session whose logger ID is 2.
Additional Information
For a conceptual overview of event tracing, see the Microsoft Windows SDK. For information about tracing tools, see the Windows Driver Kit (WDK).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wmitrace.dumpminievent
The !wmitrace.dumpminievent extension displays the system event log trace fragment, which is stored in a dump file.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Syntax
!wmitrace.dumpminievent
DLL
This extension is exported by Wmitrace.dll.
This extension is available in Windows Vista Service Pack 1 (SP1) and later versions of Windows.
This extension is useful only when debugging a minidump file or a full dump file.
Comments
The system event log trace fragment is a copy of the contents of the last buffer of the System Event Log. The !wmitrace.dumpminievent extension displays its contents in
event log format.
Additional Information
For a conceptual overview of event tracing, see the Microsoft Windows SDK. For information about tracing tools, see the Windows Driver Kit (WDK).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wmitrace.dynamicprint
The !wmitrace.dynamicprint extension controls whether the debugger displays the trace messages generated by a session running in KF_FILTER_MODE.
Syntax
!wmitrace.dynamicprint {0 | 1}
Parameters
0
Turns the trace message display off.
1
Turns the trace message display on.
DLL
This extension is exported by Wmitrace.dll.
This extension is available in Windows 2000 and later versions of Windows. If you want to use this extension with Windows 2000, you must first copy the Wmitrace.dll file
from the winxp subdirectory of the Debugging Tools for Windows installation directory to the w2kfre subdirectory.
Comments
Before you use this extension, start a trace session and send the trace messages to the debugger. For example, when you use Tracelog to start the trace session, use its -kd
parameter. Tracelog (tracelog.exe) is a trace controller included in the Windows Driver Kit.
Also, before using this extension, use !wmitrace.searchpath or !wmitrace.tmffile to specify the trace message format files. The system uses the trace message format files to
format the binary trace messages so that they can be displayed as human-readable text.
Additional Information
For a conceptual overview of event tracing, see the Microsoft Windows SDK. For help in starting a trace session, see "Tracelog" in the Windows Driver Kit (WDK).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wmitrace.enable
The !wmitrace.enable extension enables a provider for the specified Event Tracing for Windows (ETW) trace session.
Syntax
!wmitrace.enable { LoggerID | LoggerName } GUID [-level Num] [-matchallkw Num] [-matchanykw Num] [-enableproperty Num
Parameters
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
LoggerID
Specifies the trace session. LoggerID is an ordinal number that the system assigns to each trace session on the computer.
LoggerName
Specifies the trace session. LoggerName is the text name that was specified when the trace session was started.
GUID
Specifies the GUID of the provider to be enabled.
-level Num
Specifies the level. Num can be any integer.
-matchallkw Num
Specifies one or more keywords. If multiple keywords are specified, the provider will be enabled only if all keywords are matched. Num can be any integer.
-matchanykw Num
Specifies one or more keywords. If multiple keywords are specified, the provider will be enabled if at least one keyword is matched. Num can be any integer. The effects
of this parameter overlap with the effects of the -flag parameter.
-enableproperty Num
Specifies the enable property. Num can be any integer.
-flag Num
Specifies one or more flags. Num can be any integer. The effects of this parameter overlap with the effects of the -matchanykw parameter.
DLL
This extension is exported by Wmitrace.dll.
This extension is available in Windows 7 and later versions of Windows.
Comments
After using this extension, you must resume program execution (for example, by using the g (Go) command) in order for it to take effect. After a brief time, the target
computer automatically breaks into the debugger again.
To disable a provider, use !wmitrace.disable.
Additional Information
For a conceptual overview of event tracing, see the Microsoft Windows SDK. For information about tracing tools, see the Windows Driver Kit (WDK).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wmitrace.eventlogdump
The !wmitrace.eventlogdump extension displays the contents of the specified logger. The display is formatted like an event log.
Syntax
!wmitrace.eventlogdump { LoggerID | LoggerName }
Parameters
LoggerID
Specifies the trace session. LoggerID is an ordinal number that the system assigns to each trace session on the computer.
LoggerName
Specifies the trace session. LoggerName is the text name that was specified when the trace session was started.
DLL
This extension is exported by Wmitrace.dll.
This extension is available in Windows 2000 and later versions of Windows. If you want to use this extension with Windows 2000, you must first copy the Wmitrace.dll file
from the winxp subdirectory of the Debugging Tools for Windows installation directory to the w2kfre subdirectory.
Comments
This extension is similar to the !wmitrace.logdump extension, except that the output of !wmitrace.eventlogdump is formatted in event log style, and the output of !
wmitrace.logdump is formatted in Windows software trace preprocessor (WPP) style. You should choose the extension whose format is appropriate for the data you wish to
display.
To find the logger ID of a trace session, use the !wmitrace.strdump extension. Alternatively, you can use the Tracelog command tracelog -l to list the trace sessions and
their basic properties, including the logger ID.
Additional Information
For a conceptual overview of event tracing, see the Microsoft Windows SDK. For information about tracing tools, see the Windows Driver Kit (WDK).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!wmitrace.help
The !wmitrace.help extension displays the extension commands in Wmitrace.dll.
Syntax
!wmitrace.help
DLL
This extension is exported by Wmitrace.dll.
This extension is available in Windows 2000 and later versions of Windows. If you want to use this extension with Windows 2000, you must first copy the Wmitrace.dll file
from the winxp subdirectory of the Debugging Tools for Windows installation directory to the w2kfre subdirectory.
Additional Information
For a conceptual overview of event tracing, see the Microsoft Windows SDK. For information about tracing tools, see the Windows Driver Kit (WDK).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wmitrace.logdump
The !wmitrace.logdump extension displays the contents of the trace buffers for a trace session. You can limit the display to trace messages from specified providers.
Syntax
!wmitrace.logdump [-t Count] [ {LoggerID|LoggerName} [GUIDFile]]
Parameters
-t Count
Limits the output to the most recent messages. Count specifies the number of messages to display.
LoggerID
Specifies the trace session. LoggerID is an ordinal number that the system assigns to each trace session on the computer. If no parameter is specified, the trace session
with ID equal to 1 is used.
LoggerName
Specifies the trace session. LoggerName is the text name that was specified when the trace session was started.
GUIDFile
Displays only trace messages from providers specified in the GUIDFile file. GUIDFile represents the path (optional) and file name of a text file that contains the control
GUIDs of one or more trace providers, such as a .guid or .ctl file.
DLL
This extension is exported by Wmitrace.dll.
This extension is available in Windows 2000 and later versions of Windows. If you want to use this extension with Windows 2000, you must first copy the Wmitrace.dll file
from the winxp subdirectory of the Debugging Tools for Windows installation directory to the w2kfre subdirectory.
Comments
During Windows software trace preprocessor (WPP) software tracing, trace session buffers are used to store trace messages until they are flushed to a log file or to a trace
consumer for a real-time display. The !wmitrace.logdump extension displays the contents of the buffers that are in physical memory. The display appears in the Debugger
Command window.
This extension is especially useful to recover the most recent traces when a crash occurs, and to display the traces stored in a crash dump file.
Before you use this extension, use !wmitrace.searchpath or !wmitrace.tmffile to specify the trace message format files. The system uses the trace message format files to
format the binary trace messages in the buffers so that they can be displayed as human-readable text.
When you use Tracelog to start a trace session with circular buffering (-buffering), use this extension to display the buffer contents.
To find the logger ID of a trace session, use the !wmitrace.strdump extension. Alternatively, you can use the Tracelog command tracelog -l to list the trace sessions and
their basic properties, including the logger ID.
This extension is only useful during WPP software tracing, and earlier (legacy) methods of Event Tracing for Windows. Trace events that are produced by other manifested
providers do not use trace message format (TMF) files, and therefore this extension does not display their contents.
This extension is similar to the !wmitrace.eventlogdump extension, except that the output of !wmitrace.logdump is formatted in WPP style, and the output of !
wmitrace.eventlogdump is formatted in event log style. You should choose the extension whose format is appropriate for the data you want to display.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Additional Information
For a conceptual overview of event tracing, see the Microsoft Windows SDK. For information about Tracelog, see "Tracelog" in the Windows Driver Kit (WDK).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wmitrace.logger
The !wmitrace.logger extension displays data about the trace session, including the session configuration data. This extension does not display trace messages generated
during the session.
Syntax
!wmitrace.logger [ LoggerID | LoggerName ]
Parameters
LoggerID
Specifies the trace session. LoggerID is an ordinal number that the system assigns to each trace session on the computer. If no parameter is specified, the trace session
with ID equal to 1 is used.
LoggerName
Specifies the trace session. LoggerName is the text name that was specified when the trace session was started.
DLL
This extension is exported by Wmitrace.dll.
This extension is available in Windows 2000 and later versions of Windows. If you want to use this extension with Windows 2000, you must first copy the Wmitrace.dll file
from the winxp subdirectory of the Debugging Tools for Windows installation directory to the w2kfre subdirectory.
Comments
This extension is designed for performance logs and events, which cannot be formatted for human-readable display. To display the trace messages in a trace session buffer,
along with header data, use !wmitrace.logdump.
To find the logger ID of a trace session, use the !wmitrace.strdump extension. Alternatively, you can use the Tracelog command tracelog -l to list the trace sessions and
their basic properties, including the logger ID.
Additional Information
For a conceptual overview of event tracing, see the Microsoft Windows SDK.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wmitrace.logsave
The !wmitrace.logsave extension writes the current contents of the trace buffers for a trace session to a file.
Syntax
!wmitrace.logsave {LoggerID|LoggerName} Filename
Parameters
LoggerID
Specifies the trace session. Logger ID is an ordinal number that the system assigns to each trace session on the computer.
LoggerName
Specifies the trace session. LoggerName is the text name that was specified when the trace session was started.
Filename
Specifies a path (optional) and file name for the output file.
DLL
This extension is exported by Wmitrace.dll.
This extension is available in Windows 2000 and later versions of Windows. If you want to use this extension with Windows 2000, you must first copy the Wmitrace.dll file
from the winxp subdirectory of the Debugging Tools for Windows installation directory to the w2kfre subdirectory.
Comments
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
This extension displays only the traces that are in memory at the time. It does not display trace messages that have been flushed from the buffers and delivered to an event
trace log file or to a trace consumer.
Trace session buffers store trace messages until they are flushed to a log file or to a trace consumer for a real-time display. This extension saves the contents of the buffers that
are in physical memory to the specified file.
The output is written in binary format. Typically, these files use the .etl (event trace log) filename extension.
When you use Tracelog to start a trace session with circular buffering (-buffering), you can use this extension to save the current buffer contents.
To find the logger ID of a trace session, use the !wmitrace.strdump extension. Alternatively, you can use the Tracelog command tracelog -l to list the trace sessions and
their basic properties, including the logger ID.
Additional Information
For a conceptual overview of event tracing, see the Microsoft Windows SDK. For information about Tracelog, see "Tracelog" in the Windows Driver Kit (WDK).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wmitrace.searchpath
The !wmitrace.searchpath extension specifies the location of the trace message format files for messages in the trace buffers.
Syntax
!wmitrace.searchpath [+] TMFPath
!wmitrace.searchpath
Parameters
+
Causes TMFPath to be appended to the existing search path. If the plus ( + ) token is not used, TMFPath replaces the existing search path.
TMFPath
The path to the directory where the debugger should look for the trace message format files. Paths that contain spaces are not supported. If multiple paths are included,
they should be separated by semicolons, and the entire string should be enclosed in quotation marks. When the + token is used, TMFPath will be appended to the existing
path, with a semicolon automatically inserted between the existing path and the new path; however, if the + token is used, quotation marks cannot be used.
DLL
This extension is exported by Wmitrace.dll.
This extension is available in Windows 2000 and later versions of Windows. If you want to use this extension with Windows 2000, you must first copy the Wmitrace.dll file
from the winxp subdirectory of the Debugging Tools for Windows installation directory to the w2kfre subdirectory.
Comments
When used with no parameters, !wmitrace.searchpath displays the current search path.
The trace message format files (*.tmf) contain instructions for formatting the binary trace messages that a trace provider generates.
The TMFPath parameter must contain only a path to a directory; it cannot include a file name. The name of a TMF file is a message GUID followed by the .tmf extension.
When the system formats a message, it reads the message GUID on the message and searches recursively for a TMF file whose name matches the message GUID, beginning
in the specified directory.
Windows needs a TMF file in order to format the binary trace messages in a buffer. Use !wmitrace.searchpath or !wmitrace.tmffile to specify the TMF file before using !
wmitrace.dynamicprint or !wmitrace.logdump to display trace buffer contents.
If you do not use either !wmitrace.searchpath or !wmitrace.tmffile, the system uses the value of the TRACE_FORMAT_SEARCH_PATH environment variable. If that
variable is not present, it uses the default.tmf file, which is included in Windows. If the system cannot find any formatting information for a trace message, it writes a "No
format information found" error message in place of the trace message content.
Additional Information
For a conceptual overview of event tracing, see the Microsoft Windows SDK. For information about trace message format files, see the "Trace Message Format Files" topic in
the Windows Driver Kit (WDK).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wmitrace.setprefix
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The !wmitrace.setprefix extension specifies the trace message prefix that is prepended to the trace messages from this session. This extension allows you to change the prefix
during the debugging session.
Syntax
!wmitrace.setprefix [+] PrefixVariables
!wmitrace.setprefix
Parameters
+
Causes PrefixVariables to be apended to the trace message prefix. If the + token is not used, PrefixVariables replaces the existing trace message prefix.
PrefixVariables
A set of variables that specifies the format and data in the trace message prefix.
The variables have the format %n!x!, where %n represents a data field and !x! represents the data type. You can also include separation characters, such as colons (:),
semicolons (;), parentheses ( ( ) ), braces ( { } ), and brackets ( [ ] ) to separate the fields.
Each %n variable represents a parameter that is described in the following table.
Prefix variable
identifier
%1
%2
Variable
Description
type
string
The friendly name of the message GUID of the trace message. By default, the friendly name of a message GUID is the name of the
directory in which the trace provider was built.
string
Source file and line number.
This variable represents the friendly name of the trace message. By default, the friendly name of a trace message is the name of the
source file and the line number of the code that generated the trace message.
%3
ULONG
Thread ID.
Identifies the thread that generated the trace message.
%4
%5
string
string
Time stamp of the time that the trace message was generated.
Kernel time.
Displays the elapsed execution time for kernel-mode instruction, in CPU ticks, at the time that the trace message was generated.
%6
string
User time.
Displays the elapsed execution time for user-mode instruction, in CPU ticks, at the time that the trace message was generated.
%7
LONG
Sequence number.
Displays the local or global sequence number of the trace message. Local sequence numbers, which are unique only to this trace
session, are the default.
%8
ULONG
Process ID.
Identifies the process that generated the trace message.
%9
ULONG
CPU number.
Identifies the CPU on which the trace message was generated.
%!FUNC!
string
Function name.
Displays the name of the function that generated the trace message.
%!FLAGS%
%!LEVEL!
%!COMPNAME!
string
string
string
Displays the name of the trace flags that enable the trace message.
Displays the value of the trace level that enables the trace message.
Component name.
Displays the name of the component of the provider that generated the trace message. The component name appears only if it is
specified in the tracing code.
%!SUBCOMP!
string
Subcomponent name.
Displays the name of the subcomponent of the provider that generated the trace message. The subcomponent name appears only if it
is specified in the tracing code.
The symbol within exclamation marks is a conversion character that specifies the format and precision of the variable. For example, %8!04X! specifies the process ID
formatted as a four-digit, unsigned, hexadecimal number.
DLL
This extension is exported by Wmitrace.dll.
This extension is available in Windows 2000 and later versions of Windows. If you want to use this extension with Windows 2000, you must first copy the Wmitrace.dll file
from the winxp subdirectory of the Debugging Tools for Windows installation directory to the w2kfre subdirectory.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Comments
When used with no parameters, !wmitrace.setprefix displays the current value of the trace message prefix.
The trace message prefix consists of data about the trace message that is prepended to each trace message during Windows software trace preprocessor (WPP) software
tracing. This data originates in the trace log (.etl) file and the trace message format (.tmf) file. You can customize the format and data in trace message prefix.
The default trace message prefix is as follows:
[%9!d!]%8!04X!.%3!04X!::%4!s! [%1!s!]
and produces the following prefix:
[CPUNumber]ProcessID.ThreadID::SystemTime [ProviderDirectory]
You can change the format and data in the trace message prefix outside of the debugger by setting the %TRACE_FORMAT_PREFIX% environment variable. For an example
that illustrates how to set the trace message prefix outside of the debugger, see "Example 7: Customizing the Trace Message Prefix" in the Windows Driver Kit (WDK)
documentation. If the trace message prefix of your messages varies from the default, this environment variable might be set on your computer.
The prefix that you set by using this extension command affects only the debugger output. The trace message prefix that appears in the trace log is determined by the default
value and the value of the %TRACE_FORMAT_PREFIX% environment variable.
This extension is only useful during WPP software tracing, and earlier (legacy) methods of Event Tracing for Windows. Trace events that are produced by other manifested
providers do not use trace message format (TMF) files, and therefore this extension does not affect them.
Example
The following command changes the trace message prefix in the debugger output to the following format:
!wmitrace.setprefix %2!s!: %!FUNC!: %8!04x!.%3!04x!: %4!s!:
This extension command sets the trace message prefix to the following format:
SourceFile_LineNumber: FunctionName: ProcessID.ThreadID: SystemTime:
As a result, the trace messages are prepended with the specified information in the specified format. The following code example is taken from a trace of the Tracedrv sample
driver in the WDK.
tracedrv_c258: TracedrvDispatchDeviceControl: 0af4.0c64: 07/25/2003-13:55:39.998:
IOCTL = 1
Additional Information
For a conceptual overview of event tracing, see the Microsoft Windows SDK documentation. For information about trace message format files, see the "Trace Message
Prefix" topic in the WDK documentation.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wmitrace.start
The !wmitrace.start extension starts the Event Tracing for Windows (ETW) logger on the target computer.
Syntax
!wmitrace.start LoggerName [-cir Size | -seq Size] [-f File] [-b Size] [-max Num] [-min Num] [-kd] [-ft Time]
Parameters
LoggerName
Supplies a name to be used for the trace session. LoggerName cannot contain spaces or quotation marks.
-cir Size
Causes the log file to be written in a circular manner. Size specifies the maximum file size, in bytes. When the file reaches this length, new data will be written to the file
in a circular manner, overwriting the file from beginning to end. This cannot be combined with the -seq parameter. If neither -cir nor -seq is specified, the file is written
in buffered mode.
-seq Num
Causes the log file to be written in a sequential manner. Size specifies the maximum file size, in bytes. When the file reaches this length, the oldest data will be deleted
from the beginning of the file whenever new data is appended to the end. This cannot be combined with the -cir parameter. If neither -cir nor -seq is specified, the file is
written in buffered mode.
-f File
Specifies the name of the log file to be created on the target computer. File must include an absolute directory path, and cannot contain spaces or quotation marks.
-b Size
Specifies the size of each buffer, in kilobytes. The permissible range of Size is between 1 and 2048, inclusive.
-max Num
Specifies the maximum number of buffers to use. Num can be any positive integer.
-min Num
Specifies the minimum number of buffers to use. Num can be any positive integer.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
-kd
Enables KD filter mode. Messages will be sent to the kernel debugger and displayed on the screen.
-ft Time
Specifies the duration of the flush timer, in seconds.
DLL
This extension is exported by Wmitrace.dll.
This extension is available in Windows 7 and later versions of Windows.
Comments
After using this extension, you must resume program execution (for example, by using the g (Go) command) in order for it to take effect. After a brief time, the target
computer automatically breaks into the debugger again.
When the trace session is started, the system assigns it an ordinal number (the logger ID). The session can then be referred to either by the logger name or the logger ID.
To stop the ETW logger, use !wmitrace.stop.
Additional Information
For more details on the parameters of this extension, see StartTrace Function and EVENT_TRACE_PROPERTIES on MSDN. For a conceptual overview of event
tracing, see the Microsoft Windows SDK. For information about tracing tools, see the Windows Driver Kit (WDK).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wmitrace.stop
The !wmitrace.stop extension stops the Event Tracing for Windows (ETW) logger on the target computer.
Syntax
!wmitrace.stop { LoggerID | LoggerName }
Parameters
LoggerID
Specifies the trace session. LoggerID is an ordinal number that the system assigns to each trace session on the computer.
LoggerName
Specifies the trace session. LoggerName is the text name that was specified when the trace session was started.
DLL
This extension is exported by Wmitrace.dll.
This extension is available in Windows 7 and later versions of Windows.
Comments
After using this extension, you must resume program execution (for example, by using the g (Go) command) in order for it to take effect. After a brief time, the target
computer automatically breaks into the debugger again.
To start the ETW logger, use !wmitrace.start.
Additional Information
For a conceptual overview of event tracing, see the Microsoft Windows SDK. For information about tracing tools, see the Windows Driver Kit (WDK).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wmitrace.strdump
The !wmitrace.strdump extension displays the WMI event trace structures. You can limit the display to the structures for a particular trace session.
Syntax
!wmitrace.strdump [ LoggerID | LoggerName ]
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Parameters
LoggerID
Limits the display to the event trace structures for the specified trace session. LoggerID specifies the trace session. It is an ordinal number that the system assigns to each
trace session on the computer. If no parameter is specified, all trace sessions are displayed.
LoggerName
Limits the display to the event trace structures for the specified trace session. LoggerName is the text name that was specified when the trace session was started. If no
parameter is specified, all trace sessions are displayed.
DLL
This extension is exported by Wmitrace.dll.
This extension is available in Windows 2000 and later versions of Windows. If you want to use this extension with Windows 2000, you must first copy the Wmitrace.dll file
from the winxp subdirectory of the Debugging Tools for Windows installation directory to the w2kfre subdirectory.
Comments
To find the logger ID of a trace session, use the !wmitrace.strdump extension. Alternatively, you can use the Tracelog command tracelog -l to list the trace sessions and
their basic properties, including the logger ID.
Additional Information
For a conceptual overview of event tracing, see the Microsoft Windows SDK. For information about Tracelog, see the "Tracelog" topic in the Windows Driver Kit (WDK).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wmitrace.tfp
The !wmitrace.tfp extension command is obsolete. Use !wmitrace.setprefix instead.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wmitrace.tmffile
The !wmitrace.tmffile extension specifies a trace message format (TMF) file. The file specified by this extension is used to format trace messages displayed or written by
other WMI tracing extensions.
Syntax
!wmitrace.tmffile TMFFile
Parameters
TMFFile
Specifies a trace message format file.
DLL
This extension is exported by Wmitrace.dll.
This extension is available in Windows 2000 and later versions of Windows. If you want to use this extension with Windows 2000, you must first copy the Wmitrace.dll file
from the winxp subdirectory of the Debugging Tools for Windows installation directory to the w2kfre subdirectory.
Comments
Trace message format files (.tmf) are structured text files that are created during Windows software trace preprocessor (WPP) software tracing. These files contain instructions
for formatting trace binary trace messages so that they can be displayed in human-readable form.
In order to display the trace message in a trace buffer (!wmitrace.logdump) or write them to a file (!wmitrace.logsave), you must first identify the TMF files for the trace
messages.
You can use !wmitrace.searchpath to specify a directory in which TMF files are stored. The system then searches the directory for a TMF file that contains instructions for
the messages that it is formatting. (It uses the message GUID to associate the message with the correct TMF file.)
However, you can use !wmitrace.tmffile to specify a particular TMF file. You must use !wmitrace.tmffile if the TMF file name is not a message GUID followed by the .tmf
extension. Otherwise, the system will not find it.
If you do not use either !wmitrace.searchpath or !wmitrace.tmffile, the system uses the value of the TRACE_FORMAT_SEARCH_PATH environment variable. If that
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
variable is not present, it uses the default.tmf file. If the system cannot find formatting information for a trace message, it writes a "No format information found" error
message, instead of the trace message content.
This extension is only useful during WPP software tracing, and earlier (legacy) methods of Event Tracing for Windows. Trace events that are produced by other manifested
providers do not use trace message format (TMF) files, and therefore this extension cannot be used with them.
Additional Information
For a conceptual overview of event tracing, see the Microsoft Windows SDK. For information about trace message format files, see the "Trace Message Format File" topic in
the Windows Driver Kit (WDK).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
!wmitrace.traceoperation
The !wmitrace.traceoperation extension displays the progress messages from the tracing components in Windows.
Syntax
!wmitrace.traceoperation {0 | 1 | 2}
Parameters
0
Disables the display of tracing progress messages.
1
Enables the display of tracing progress messages. All messages generated by the WMI tracing debugger extensions are displayed.
2
Enables the display of tracing progress messages. All messages generated by the WMI tracing debugger extensions or by Tracefmt are displayed.
DLL
This extension is exported by Wmitrace.dll.
This extension is available in Windows 2000 and later versions of Windows. If you want to use this extension with Windows 2000, you must first copy the Wmitrace.dll file
from the winxp subdirectory of the Debugging Tools for Windows installation directory to the w2kfre subdirectory.
Comments
This extension causes the tracing components to display verbose output. This feature is useful to troubleshoot software tracing.
Additional Information
For a conceptual overview of event tracing, see the Microsoft Windows SDK.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SieExtPub.dll
The SieExtPub.dll extension module is not part of Microsoft Debugging Tools for Windows. To get extensions from SieExtPub.dll (for example, !critlist), download the
Debug Diagnostic Tool from the Microsoft Download Center. At the download center, search for "Debug Diagnostic Tool".
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Debugger-Related APIs
This reference section includes:
Symbol Server API
The dbgeng.h Header File
The wdbgexts.h Header File
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The path is a UNC path, and the computer containing this server is not available.
The path indicates a directory or file that has been deleted.
If your symbol store was created by using SymStore, you can find the full path to this file by examining file.ptr. For details, see Using SymStore.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
File Menu
Edit Menu
View Menu
Debug Menu
Window Menu
Help Menu
Toolbar Buttons
Shortcut Keys
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
In WinDbg, the Debugger Command window is split into two panes. You type commands in the smaller pane (the command entry pane) at the bottom of the window and
view the output in the larger pane at the top of the window.
Using the Debugger Command Window
In the command entry pane, use the UP ARROW and DOWN ARROW keys to scroll through the command history. When a command appears, you can edit it or press
ENTER to run the command. The cursor does not have to be at the end of the line for this feature to work correctly.
Note To paste the contents of the clipboard into the command entry pane, right-click anywhere in the command entry pane, and then click Paste.
The Debugger Command window contains a shortcut menu with additional commands. To access this menu, right-click the title bar of the window or click the icon near the
upper-right corner of the window (
Add to command output adds a comment to the command output, similar to the Edit | Add to Command Output command.
Clear command output deletes all of the text in the window.
Choose text color and recolor selection... opens a dialog box that allows you to choose the text color in which to display the text selected in the Debugger Command
Window.
Word wrap turns on and off the word wrap status. This command affects the whole window, not only commands that you use after this state is selected. Because many
commands and extensions produce formatted displays, we do not recommend that you use word wrap.
Mark current location sets a marker at the current cursor location in the command window. The name of the mark is the contents of the line to the right of the cursor.
Go to mark causes the window to scroll so that the line containing the chosen mark is positioned at the top of the window.
Dock or Undock causes the window to enter or leave the docked state.
(Menu only) Move to new dock closes the Debugger Command window and opens it in a new dock.
(Menu only) Set as tab-dock target for window type is unavailable for the Debugger Command window. This option is only available for Source or Memory
windows.
Always floating causes the window to remain undocked, even if it is dragged to a docking location.
Move with frame causes the window to move when the WinDbg frame is moved, even if the window is undocked. For more information about docked, tabbed, and
floating windows, see Positioning the Windows.
Help opens this topic in the Debugging Tools for Windows documentation.
Close closes the window.
Additional Information
For more information about how to use the Debugger Command window, see The Debugger Command Window. For more information about docked, tabbed, and floating
windows, see Positioning the Windows. For more information about all techniques that you can use to control debugging information windows, see Using Debugging
Information Windows.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Watch Window
The Watch window displays information about global variables, local variables, and registers. You can customize this window to show the items that you are tracking.
Opening the Watch Window
To open or switch to the Watch window, in the WinDbg window, on the View menu, click Watch. (You can also press ALT+2 or click the Watch (ALT+2) button (
the toolbar. ALT+SHIFT+2 will close the Watch window.)
) on
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The Watch window can contain four columns. The Name and Value columns are always displayed, and the Type and Location columns are optional. To display the Type
and Location columns, click the Typecast and Locations buttons, respectively, on the toolbar.
Using the Watch Window
In the Watch window, you can do the following:
To add a variable to the Watch window, select the first empty cell in the Name column, type the variable name, and then press ENTER. Separate the module name from
the variable with an exclamation point (!). If you do not specify a module, the current module is used. To enter an address in the Name field, the address must begin
with a decimal digit (if necessary, use the prefix 0x).
If the variable name that you have entered is defined in the current function's scope, its value appears in the Value column. If it is not defined, the Value column
displays "Error: Cannot get value".
Even if a variable is not defined, it can be useful to add it to the Watch window. If the program counter enters a function in which a variable of this name is defined, its
value appears in the window at that time.
To remove a variable from the Watch window, double-click its name, press DELETE, and then press ENTER. You can also replace an old name with a new name by
double-clicking the old name, typing the new name, and then pressing ENTER.
If a variable is a data structure, a check box appears next to its name. To expand and collapse the display of structure members, select or clear the check box.
Integers of type int are displayed as decimal values; integers of type UINT are displayed in the current radix. To change the current radix, use the n (Set Number Base)
command in the Debugger Command window.
To change the value of a local variable, double-click its Value cell. Enter the new value, or edit the old value. (The cut, copy, and paste commands are available to use
for editing.) The value that you enter can include any C++ expression. After you enter a new value or edit the old value, you can press ENTER to store the new value or
press ESC to discard it. If you submit an invalid value, the old value will reappear after you press ENTER.
Integers of type int are displayed as decimal values; integers of type UINT are displayed in the current radix. To change the current radix, use the n (Set Number Base)
command in the Debugger Command window.
The Type column (if it is displayed in the Watch window) shows the current data type of each variable. Each variable is displayed in the format that is proper for its
own data type. Data structures have their type names in the Type column. Other variable types display "Enter new type" in this column.
If you double-click "Enter new type", you can cast the type by entering a new data type. This cast alters the current display of this variable only in the Watch window; it
does not change anything in the debugger or on the target computer. Moreover, if you enter a new value in the Value column, the text you enter will be parsed based on
the actual type of the symbol, rather than any new type you may have entered in the Type column. If you close and reopen the Watch window, you will lose the data
type changes.
You can also enter an extension command in the Type column. The debugger will pass the address of the symbol to this extension, and will display the resulting output
in a series of collapsible rows beneath the current row. For example, if the symbol in this row is a valid address for a thread environment block, you can enter !teb in the
Type column to run the !teb extension on this symbol's address.
The Location column (if it is displayed in the Watch window) shows the offset of each member of a data structure.
In addition to variables, you can also monitor the following items in the Watch window:
Registers. When you add a register to the Watch window, prefix its name with an at sign (@). Unlike variables, you cannot change register values through the
Watch window.
Vtables that contain function pointers. When a Vtable appears in the Watch window, you can browse the function entries in the table. If a Vtable is contained in a
base class that points to a derived implementation, the notation _vtcast_Class is displayed to indicate the members that are being added because of the derived
class. These members expand like the derived class type.
The return values of extension functions, such as _EFN_GetPoolData.
Unlike the Locals window, the Watch window is not affected by changes to the register context. In the Watch window, you can see and modify only those variables that are
defined in the scope of the current program counter.
If you open a new workspace, the Watch window contents are discarded and replaced with those in the new workspace.
Toolbar and Shortcut Menu
The Watch window has a toolbar that contains two buttons (Typecast and Locations) and a shortcut menu with additional commands. To access the menu, right-click the title
bar of the window or click the icon near the upper-right corner of the window ( ). The toolbar and menu contain the following buttons and commands:
(Toolbar and menu) Typecast turns the display of the Type column on and off.
(Toolbar and menu) Locations turns the display of the Location column on and off.
(Menu only) Display 16-bit values as Unicode displays Unicode strings in this window. This command turns on and off a global setting that affects the Locals window,
the Watch window, and debugger command output. This command is equivalent to using the .enable_unicode (Enable Unicode Display) command.
(Menu only) Always display numbers in default radix causes integers to be displayed in the default radix instead of always displaying them in decimal format. This
command turns on and off a global setting that affects the Locals window, the Watch window, and debugger command output. This command is equivalent to using
the .force_radix_output (Use Radix for Integers) command.
Note The Always display numbers in default radix command does not affect long integers. Long integers are displayed in decimal format unless
the .enable_long_status (Enable Long Integer Display) command is used. The .enable_long_status command affects the display in the Locals window, the Watch
window, and debugger command output. There is no equivalent for this command in the menu in the Watch window.
(Menu only) Open memory window for selected value opens a new docked Memory window that displays memory starting at the address of the selected expression.
(Menu only) Invoke dt for selected memory value runs the dt (Display Type) command with the selected symbol as its parameter. The result appears in the Debugger
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Command window. The -n option is automatically used to differentiate the symbol from a hexadecimal address. No other options are used. Note that the content
produced using this menu selection is identical to the content produced when running the dt command from the command line, but the format is slightly different.
Additional Information
For more information about controlling variables and a description of other memory-related commands, see Reading and Writing Memory. For more information about
registers and their manipulation, see Reading and Writing Registers and Flags. For more information about docked, tabbed, and floating windows, see Positioning the
Windows. For more information about all techniques that you can use to control debugging information windows, see Using Debugging Information Windows.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Locals Window
The Locals window displays information about all of the local variables in the current scope.
Opening the Locals Window
To open or switch to the Locals window, in the WinDbg window, on the View menu, click Locals. (You can also press ALT+3 or click the Locals (ALT+3) button (
the toolbar. ALT+SHIFT+3 will close the Locals window.)
) on
The Locals window can contain four columns. The Name and Value columns are always displayed, and the Type and Location columns are optional. To display the Type
and Location columns, click the Typecast and Locations buttons, respectively, on the toolbar.
Using the Locals Window
In the Locals window, you can do the following:
The Name column displays the name of each local variable. If a variable is a data structure, a check box appears next to its name. To expand or collapse the display of
structure members, select or clear the check box.
The Value column displays the current value of each variable.
To enter a new value for the variable, double-click the current value and type the new value, or edit the old value. (The cut, copy, and paste commands are
available to use for editing.) You can type any C++ expression.
To save the new value, press ENTER.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Integers of type int are displayed as decimal values; integers of type UINT are displayed in the current radix. To change the current radix, use the n (Set Number Base)
command in the Debugger Command window.
The Type column (if it is displayed in the Locals window) shows the current data type of each variable. Each variable is displayed in the format that is proper for its
own data type. Data structures have their type names in the Type column. Other variable types display "Enter new type" in this column.
If you double-click "Enter new type", you can cast the type by entering a new data type. This cast alters the current display of this variable only in the Locals window; it
does not change anything in the debugger or on the target computer. Moreover, if you enter a new value in the Value column, the text you enter will be parsed based on
the actual type of the symbol, rather than any new type you may have entered in the Type column. If you close and reopen the Locals window, you will lose the data
type changes.
You can also enter an extension command in the Type column. The debugger will pass the address of the symbol to this extension, and will display the resulting output
in a series of collapsible rows beneath the current row. For example, if the symbol in this row is a valid address for a thread environment block, you can enter !teb in the
Type column to run the !teb extension on this symbol's address.
The Location column (if it is displayed in the Locals window) shows the offset of each member of a data structure.
If a local variable is an instance of a class that contains Vtables, the Name column displays the Vtables and you can expand them to show the function pointers. If a
Vtable is contained in a base class that points to a derived implementation, the notation _vtcast_Class is displayed to indicate the members that are being added because
of the derived class. These members expand like the derived class type.
The local context determines which set of local variables will be displayed in the Locals window. When the local context changes for any reason, the Locals window is
automatically updated. By default, the local context matches the current position of the program counter. For more information about how to change the local context,
see Local Context.
(Toolbar and menu) Typecast turns the display of the Type column on and off.
(Toolbar and menu) Locations turns the display of the Location column on and off.
(Menu only) Display 16-bit values as Unicode displays Unicode strings in this window. This command turns on and off a global setting that affects the Locals window,
the Watch window, and debugger command output. This command is equivalent to using the .enable_unicode (Enable Unicode Display) command.
(Menu only) Always display numbers in default radix causes integers to be displayed in the default radix instead of displaying them in decimal format. This
command turns on and off a global setting that affects the Locals window, the Watch window, and debugger command output. This command is equivalent to using
the .force_radix_output (Use Radix for Integers) command.
Note The Always display numbers in default radix command does not affect long integers. Long integers are displayed in decimal format unless
the .enable_long_status (Enable Long Integer Display) command is set. The .enable_long_status command affects the display in the Locals window, the Watch
window, and in debugger command output; there is no equivalent for this command in the menu in the Locals window.
(Menu only) Open memory window for selected value opens a new docked Memory window that displays memory starting at the address of the selected expression.
(Menu only) Invoke dt for selected memory value runs the dt (Display Type) command with the selected symbol as its parameter. The result appears in the Debugger
Command window. The -n option is automatically used to differentiate the symbol from a hexadecimal address. No other options are used. Note that the content
produced using this menu selection is identical to the content produced when running the dt command from the command line, but the format is slightly different.
(Menu only) Toolbar turns the toolbar on and off.
(Menu only) Dock or Undock causes the window to enter or leave the docked state.
(Menu only) Move to new dock closes the Locals window and opens it in a new dock.
(Menu only) Set as tab-dock target for window type is unavailable for the Locals window. This option is only available for Source or Memory windows.
(Menu only) Always floating causes the window to remain undocked even if it is dragged to a docking location.
(Menu only) Move with frame causes the window to move when the WinDbg frame is moved, even if the window is undocked. For more information about docked,
tabbed, and floating windows, see Positioning the Windows.
(Menu only) Help opens this topic in the Debugging Tools for Windows documentation.
(Menu only) Close closes this window.
Additional Information
For more information about controlling local variables, an overview of using variables and changing the scope, and a description of other memory-related commands, see
Reading and Writing Memory. For more information about docked, tabbed, and floating windows, see Positioning the Windows. For more information about all techniques
that you can use to control debugging information windows, see Using Debugging Information Windows.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Registers Window
The Registers window displays the registers and flags from the current target processor.
Opening the Registers Window
To open or switch to the Registers window, in the WinDbg window, on the View menu, click Registers. (You can also press ALT+4 or click the Registers (Alt+4) button (
) on the toolbar. ALT+SHIFT+4 will close the Registers window.)
The following figure shows an example of a Registers window.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The Registers window contains two columns. The Reg column lists all of the registers for the target processor. The Value column displays the current value of each register.
This window also contains a Customize button on the toolbar that opens the Customize Register List dialog box.
Using the Registers Window
In the Registers window, you can do the following:
The Value column displays the current value of each register. The value of the most recently changed register is displayed in red text.
To enter a new value, double-click a Value cell, and then type a new value or edit the old value. (The cut, copy, and paste commands are available to use for
editing.)
To save the new value, press ENTER.
To discard the new value, press ESC.
If you type an invalid value, the old value will reappear when you press ENTER.
Register values are displayed in the current radix and you must type new values in the same radix. To change the current radix, use the n (Set Number Base) command
in the Debugger Command window.
In user mode, the Registers window displays the registers that are associated with the current thread. For more information about the current thread, see Controlling
Processes and Threads.
In kernel mode, the Registers window displays the registers that are associated with the current register context. You can set the register context to match a specific
thread, context record, or trap frame. Only the most important registers for the specified register context are actually displayed; you cannot change their values.
). The toolbar and menu contain the following button and commands:
(Toolbar and menu) Customize opens the Customize Register List dialog box, which is described in the following section within this topic.
(Menu only) Toolbar turns the toolbar on and off.
(Menu only) Dock or Undock causes the window to enter or leave the docked state.
(Menu only) Move to new dock closes the Registers window and opens it in a new dock.
(Menu only) Set as tab-dock target for window type is unavailable for the Registers window. This option is only available for Source or Memory windows.
(Menu only) Always floating causes the window to remain undocked even if it is dragged to a docking location.
(Menu only) Move with frame causes the window to move when the WinDbg frame is moved, even if the window is undocked. For more information about docked,
tabbed, and floating windows, see Positioning the Windows.
(Menu only) Help opens this topic in the Debugging Tools for Windows documentation.
(Menu only) Close closes this window.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Memory Window
The Memory window displays a formatted range of memory. You can open more than one Memory window at the same time. (This behavior differs from the other debugging
information windows.)
Opening the Memory Window
To open a Memory window, in the WinDbg window, on the View menu, click Memory. (You can also press ALT+5 or click the Memory (Alt+5) button (
toolbar. ALT+SHIFT+5 will close the active Memory window.)
) on the
The Memory window displays data in several columns. The column on the left side of the window shows the beginning address of each line. The remaining columns display
the requested information, from left to right. If you select Bytes in the Display format menu, the ASCII characters that correspond to these bytes are displayed in the right
side of the window.
Note By default, the Memory window displays virtual memory. This type of memory is the only type of memory that is available in user mode. In kernel mode, you can use
the Memory Options dialog box to display physical memory and other data spaces. The Memory Options dialog box is described later in this topic.
Using the Memory Window
In the Memory window, you can do the following:
To write to memory, click inside the Memory window and type new data. You can edit only hexadecimal datayou cannot directly edit ASCII and Unicode characters.
Changes take effect as soon as you type new information.
To see other sections of memory, use the Previous and Next buttons on the Memory window toolbar, or press the PAGE UP or PAGE DOWN keys. These buttons and
keys display the immediately preceding or following sections of memory. If you request an invalid page, an error message appears.
To navigate within the window, use the RIGHT ARROW, LEFT ARROW, UP ARROW, and DOWN ARROW keys. If you use these keys to move off of the page, a
new page is displayed. Before you use these keys, you should resize the Memory window so that it does not have scroll bars. This sizing enables you to distinguish
between the actual page edge and the window cutoff.
To change the memory location that is being viewed, enter a new address into the address box at the top of the Memory window. Note that the Memory window
refreshes its display while you enter an address, so you could get error messages before you have completed typing the address.
Note The address that you enter into the box is interpreted in the current radix. If the current radix is not 16, you should prefix a hexadecimal address with 0x. To
change the default radix, use the n (Set Number Base) command in the Debugger Command window. The display within the Memory window itself is not affected by
the current radix.
To change the data type that the window uses to display memory, use the Display format menu in the Memory window toolbar. Supported data types include short
words, double words, and quad-words; short, long, and quad integers and unsigned integers; 10-byte, 16-byte, 32-byte, and 64-byte real numbers; ASCII characters;
Unicode characters; and hexadecimal bytes. The display of hexadecimal bytes includes ASCII characters as well.
(Toolbar only) The address box enables you to specify a new address or offset. The exact meaning of this box depends on the memory type you are viewing. For
example, if you are viewing virtual memory, the box enables you to specify a new virtual address or offset.
(Toolbar only) Display format enables you to select a new display format.
(Toolbar and menu) Previous (on the toolbar) and Previous page (on the shortcut menu) causes the previous section of memory to be displayed.
(Toolbar and menu) Next (on the toolbar) and Next page (on the shortcut menu) causes the next section of memory to be displayed.
(Menu only) Toolbar turns the toolbar on and off.
(Menu only) Auto-fit columns ensures that the number of columns displayed in the Memory window fits the width of the Memory window..
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
(Menu only) Dock or Undock causes the window to enter or leave the docked state.
(Menu only) Move to new dock closes the Memory window and opens it in a new dock.
(Menu only) Set as tab-dock target for window type sets the selected Memory window as the tab-dock target for other Memory windows. All Memory windows
opened after one is chosen as the tab-dock target will automatically be grouped with that window in a tabbed collection.
(Menu only) Always floating causes the window to remain undocked even if it is dragged to a docking location.
(Menu only) Move with frame causes the window to move when the WinDbg frame is moved, even if the window is undocked. For more information about docked,
tabbed, and floating windows, see Positioning the Windows.
(Menu only) Properties opens the Memory Properties dialog box, which is described in the following section within this topic.
(Menu only) Help opens this topic in the Debugging Tools for Windows documentation.
(Menu only) Close closes this window.
In the Virtual Memory tab, in the Offset box, specify the address or offset of the beginning of the memory range that you want to view.
In the Physical Memory tab, in the Offset box, specify the physical address of the beginning of the memory range that you want to view. The Memory window can
display only described, cacheable physical memory. If you want to display physical memory that has other attributes, use the d* (Display Memory) command or the !
d* extension.
In the Bus Data tab, in the Bus Data Type menu, specify the bus data type. Then, use the Bus number, Slot number, and Offset boxes to specify the bus data that you
want to view.
In the Control Data tab, use the Processor and Offset text boxes to specify the control data that you want to view.
In the I/O tab, in the Interface Type menu, specify the I/O interface type. Use the Bus number, Address space, and Offset boxes to specify the data that you want to
view.
In the MSR tab, in the MSR box, specify the model-specific register that you want to view.
Each tab also includes a Display format menu. This menu has the same effect as the Display format menu in the Memory window.
Click OK in the Memory Options dialog box to cause your changes to take effect.
Additional Information
For more information about memory manipulation and a description of other memory-related commands, see Reading and Writing Memory. For more information about
docked, tabbed, and floating windows, see Positioning the Windows. For more information about all techniques that you can use to control debugging information windows,
see Using Debugging Information Windows.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Calls Window
The Calls window displays the current call stack information.
Opening the Calls Window
To open or switch to the Calls window, in the WinDbg window, on the View menu, click Call Stack. (You can also press ALT+6 or click the Calls (Alt+6) button (
the toolbar. ALT+SHIFT+6 will close the Calls Window.)
) on
The Calls window displays the call stack information in several columns, most of which can be visible or hidden. If none of the optional columns are visible, only the name or
offset of each function is displayed.
Using the Calls Window
To move to the corresponding call location in the Source window or Disassembly window, double-click a line of the call stack, or select a line and press ENTER. This action
also changes the local context to the selected stack frame. For more information about running to or from this point, see Controlling the Target.
In user mode, the stack trace is based on the stack of the current thread. For more information about the stack of the current thread, see Controlling Processes and Threads.
In kernel mode, the stack trace is based on the current register context. You can set the register context to match a specific thread, context record, or trap frame. For more
information about setting the register context, see Register Context.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
). The toolbar and menu contain the following buttons and commands:
(Toolbar and menu) Raw args displays the first three parameters that are passed to the function. On an x86-based processor, this display includes the first three
parameters that are passed to the function ("Args to Child"). On an Itanium-based processor, this display includes the parameters that are passed to the function
("Arguments to Callee"), if the Nonvolatile regs button is also turned on.
Func info displays Frame Pointer Omission (FPO) data and other internal information about the function. This command is available only on an x86-based processor.
Source displays source module names and line numbers after the function names (if the debugger has this information).
Addrs displays various frame-related addresses. On an x86-based processor, this display includes the base pointer for the stack frame ("ChildEBP") and the return
address ("RetAddr"). On an Itanium-based processor, this display includes a pointer to the function that is being called ("Callee-BSP") and the return address ("ReturnRA"), unless both the Args and Nonvolatile regs buttons are turned on as well.
Headings displays column headings at the top of each column.
Nonvolatile regs displays the nonvolatile portion of the register context. This command is available only on an Itanium-based processor.
Frame nums displays frame numbers. Frames are always numbered consecutively, beginning with zero.
Arg types displays detailed information about the arguments that are expected and received by the functions in the stack.
More changes the length of the stack trace. Each time you click More, the stack display increases by ten frames, if a stack trace of this length is available.
Less changes the length of the stack trace. Each time you click Less, the stack display decreases by ten frames, unless this change would cause the stack display to be
shorter than ten frames total.
(Menu only) Copy stack to clipboard copies the current contents of the Calls window to the clipboard.
(Menu only) Toolbar turns the toolbar on and off.
(Menu only) Dock or Undock causes the window to enter or leave the docked state.
(Menu only) Move to new dock closes the Calls window and opens it in a new dock.
(Menu only) Set as tab-dock target for window type is unavailable for the Calls window. This option is only available for Source or Memory windows.
(Menu only) Always floating causes the window to remain undocked even if it is dragged to a docking location.
(Menu only) Move with frame causes the window to move when the WinDbg frame is moved, even if the window is undocked. For more information about docked,
tabbed, and floating windows, see Positioning the Windows.
(Menu only) Help opens this topic in the Debugging Tools for Windows documentation.
(Menu only) Close closes this window.
Additional Information
For more information about stack traces and for other ways to display stack traces, see Viewing the Call Stack. For more information about the register context and the local
context, see Changing Contexts. For more information about docked, tabbed, and floating windows, see Positioning the Windows. For more information about all techniques
that you can use to control debugging information windows, see Using Debugging Information Windows.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Disassembly Window
The Disassembly window displays executable code in assembly language.
Opening the Disassembly Window
To open or switch to the Disassembly window, in the WinDbg window, on the View menu, click Disassembly. (You can also press ALT+7 or click the Disassembly (Alt+7)
button (
The debugger takes a section of memory, interprets it as binary machine instructions, and then disassembles it to produce an assembly-language version of the machine
instructions. The resulting code is displayed in the Disassembly window.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
To disassemble a different section of memory, in the Offset box, type the address of the memory you want to disassemble. (You can press ENTER after typing the
address, but you do not have to.) The Disassembly window displays code before you have completed the address; you can disregard this code.
To see other sections of memory, click the Previous or Next button or press the PAGE UP or PAGE DOWN keys. These commands display disassembled code from
the preceding or following sections of memory, respectively. By pressing the RIGHT ARROW, LEFT ARROR, UP ARROW, and DOWN ARROW keys, you can
navigate within the window. If you use these keys to move off of the page, a new page will appear.
If you want to disassemble a section of memory that does not contain machine instructions, the debugger displays error messages.
The line that represents the current program counter is highlighted in green, unless you select a line with the mouse or by using one of the Edit | Go to Xxx commands.
If you select a line with the mouse or a Edit | Go to Xxx command, the selected line is green and the line that represents the current program counter is not highlighted.
Lines at which breakpoints are set are highlighted. An enabled breakpoint is highlighted in in red, a disabled breakpoint is highlighted in yellow, and a breakpoint that
coincides with the current program counter is highlighted in purple.
(Toolbar only) The Offset box enables you to specify a new address for disassembly.
(Toolbar and menu) Previous (on the toolbar) and Previous page (on the shortcut menu) causes the debugger to disassemble and display the instructions immediately
prior to the current display.
(Toolbar and menu) Next (on the toolbar) or Next page (on the shortcut menu) causes the debugger to disassemble and display the instructions immediately after the
current display.
(Menu only) Go to current address opens the Source window with the source file that corresponds to the selected line in the Disassembly window and highlights this
line.
(Menu only) Disassemble before current instruction causes the current line to be placed in the middle of the Disassembly window. This command is the default
option. If this command is cleared the current line will appear at the top of the Disassembly window, which saves time because reverse-direction disassembly can be
time-consuming.
(Menu only) Highlight instructions from the current source line causes all of the instructions that correspond to the current source line to be highlighted. Often, a
single source line will correspond to multiple assembly instructions. If code has been optimized, these assembly instructions might not be consecutive. This command
enables you to find all of the instructions that were assembled from the current source line.
(Menu only) Show source line for each instruction displays the source line number that corresponds to each assembly instruction.
(Menu only) Show source file for each instruction displays the source file name that corresponds to each assembly instruction.
(Menu only) Toolbar turns the toolbar on and off.
(Menu only) Dock or Undock causes the window to enter or leave the docked state.
(Menu only) Move to new dock closes the Disassembly window and opens it in a new dock.
(Menu only) Set as tab-dock target for window type is unavailable for the Disassembly window. This option is only available for Source or Memory windows.
(Menu only) Always floating causes the window to remain undocked even if it is dragged to a docking location.
(Menu only) Move with frame causes the window to move when the WinDbg frame is moved, even if the window is undocked. For more information about docked,
tabbed, and floating windows, see Positioning the Windows.
(Menu only) Help opens this topic in the Debugging Tools for Windows documentation.
(Menu only) Close closes this window.
Additional Information
For more information about assembly debugging and related commands and a full explanation of the assembly display, see Debugging in Assembly Mode. For more
information about docked, tabbed, and floating windows, see Positioning the Windows. For more information about all techniques that you can use to control debugging
information windows, see Using Debugging Information Windows.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Scratch Pad
The Scratch Pad window is a clipboard on which you can type and save text.
Opening the Scratch Pad Window
To open or switch to the Scratch Pad window, in the WinDbg window, on the View menu, click Scratch Pad. (You can also press ALT+8 or click the Scratch Pad (Alt+8)
button (
) on the toolbar.)
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
To type in the Scratch Pad window, click in the window where you want to add text and begin typing. You can also use standard copy-and-paste features. The contents
of the Scratch Pad window do not affect the operation of the debugger. This window exists solely to help with text editing.
If you close the Scratch Pad window, your text is preserved and is available when you reopen the window. You can also save text from the Scratch Pad window by
associating it with a file.
The Scratch Pad window has a shortcut menu with additional commands. To access the menu, right-click the title bar or click the icon near the upper-right corner of the
window (
(Menu only) Associate with file opens a dialog box through which you can select a text file. After the file is selected, the current text in the Scratch Pad is cleared and
replaced with the text in the selected file. While Scratch Pad is associated with this file, all new text typed into Scratch Pad is saved to the file. Association with the file
can be ended either by selecting the End file association short-cut menu option or by closing and reopening Scratch Pad.
(Menu only) End file association ends Scratch Pad's association with a specified text file. All text in Scratch Pad prior to selecting this option is saved in the file. All
text typed in Scratch Pad after the association is ended is no longer saved in the text file.
Dock or Undock causes the window to enter or leave the docked state.
(Menu only) Move to new dock closes Scratch Pad and opens it in a new dock.
(Menu only) Set as tab-dock target for window type is unavailable for Scratch Pad. This option is only available for Source or Memory windows.
Always floating causes the window to remain undocked even if it is dragged to a docking location.
Move with frame causes the window to move when the WinDbg frame is moved, even if the window is undocked. For more information about docked, tabbed, and
floating windows, see Positioning the Windows.
Help opens this topic in the Debugging Tools for Windows documentation.
Close closes this window.
Additional Information
For more information about docked, tabbed, and floating windows, see Positioning the Windows. For more information about all techniques that you can use to control
debugging information windows, see Using Debugging Information Windows.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The Processes and Threads window displays a list of all processes that are currently being debugged. The threads in the process appear under each process. If the debugger is
attached to multiple systems, the systems are shown at the top level of the tree, with the processes subordinate to them, and the threads subordinate to the processes.
Each system listing includes the server name and the protocol details. The system that the debugger is running on is identified as <Local>.
Each process listing includes the internal decimal process ordinal that the debugger uses, the hexadecimal process ID, and the name of the application that is associated with
the process.
Each thread listing includes the internal decimal thread ordinal that the debugger uses and the hexadecimal thread ID.
Using the Processes and Threads Window
In the Processes and Threads window, you can do the following:
To expand or collapse each part of the tree, click the plus sign (+) or minus sign ().
The current or active system, process, and thread appear in bold type. To make a new system, process, or thread active, click its line in the window.
The Processes and Threads window has a shortcut menu with additional commands. To access the menu, right-click the title bar or click the icon near the upper-right corner
of the window ( ). The menu contains the following commands:
Dock or Undock causes the window to enter or leave the docked state.
(Menu only) Move to new dock closes the Processes and Threads window and opens it in a new dock.
(Menu only) Set as tab-dock target for window type is unavailable for the Processes and Threads window. This option is only available for Source or Memory
windows.
Always floating causes the window to remain undocked even if it is dragged to a docking location.
Move with frame causes the window to move when the WinDbg frame is moved, even if the window is undocked. For more information about docked, tabbed, and
floating windows, see Positioning the Windows.
Help opens this topic in the Debugging Tools for Windows documentation.
Close closes this window.
Additional Information
For other methods of displaying or controlling systems, see Debugging Multiple Targets. For other methods of displaying or controlling processes and threads, see Controlling
Processes and Threads. For more information about docked, tabbed, and floating windows, see Positioning the Windows. For more information about all techniques that you
can use to control debugging information windows, see Using Debugging Information Windows.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
The Command Browser window has a menu in which you can enter or select commands, several navigation buttons, and a pane that shows the results of the current
command.
Using the Command Browser Window
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The Command Browser window has a shortcut menu with additional commands. To access the menu, right-click the title bar or click the icon near the upper-right corner of
the window ( ). The context menu contains the following commands:
Start, Prev, and Next move the cursor to the start of the command history or to the previous or next command, respectively.
Add to Recent Commands puts the current command into the Recent Commands menu of the View menu in the WinDbg window. Recent commands are saved in the
workspace.
Toolbar turns the toolbar on and off.
Dock or Undock causes the window to enter or leave the docked state.
(Menu only) Move to new dock closes the Command Browser window and opens it in a new dock.
(Menu only) Set as tab-dock target for window type is unavailable for the Command Browser window. This option is only available for Source or Memory windows.
Always floating causes the window to remain undocked even if it is dragged to a docking location.
Move with frame causes the window to move when the WinDbg frame is moved, even if the window is undocked. For more information about docked, tabbed, and
floating windows, see Positioning the Windows.
Close closes this window.
Additional Information
For more information about docked, tabbed, and floating windows, see Positioning the Windows. For more information about all techniques that you can use to control
debugging information windows, see Using Debugging Information Windows.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Source Window
The Source window displays source files that have been loaded into the debugger.
Opening the Source Window
The debugger opens a source window when it loads a new source file. To restore or switch to an open Source window, in the WinDbg window, on the Window menu, select
the window from the list of windows at the bottom of the menu.
The following figure shows an example of a Source window.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Each source file resides in its own Source window. The title of each Source window is the full path of the source file.
Using the Source Window
Each Source window displays the text of one source file. You cannot edit a source file in the debugger. For more information about changing the font and tab settings, see
Changing Text Properties.
To select an entire word or token in a Source window, double-click the word or C++ token.
Shortcut Menu
Each Source window has a shortcut menu with additional commands. To access the menu, right-click the title bar or click the icon that appears near the upper-right corner of
the window (
Set instruction pointer to current line changes the value of the instruction pointer to the instruction that corresponds to the current line. This command is equivalent to
using the Edit | Set Current Instruction command or pressing CTRL+SHIFT+I.
Edit this file opens the source file in a text editor. The editor is determined by the WinDiff editor registry information or by the value of the
WINDBG_INVOKE_EDITOR environment variable. For example, consider if the value of WINDBG_INVOKE_EDITOR is the following.
c:\my\path\myeditor.exe -file %f -line %l
In this case, Myeditor.exe will open to the one-based line number of the current source file. The %l option indicates that line numbers should be read as one-based,
while %f indicates that the current source file should be used. Other substitution possibilities include %L, which indicates that line numbers are zero-based, and %p,
which can also indicate that the current source file should be used.
Copy copies the current selection to the clipboard. If there is no current selection, this command has no effect.
Copy file path to clipboard copies the file path of the Source window to the clipboard.
Evaluate selection evaluates the currently-selected text by using the C++ expression evaluator. The result appears in the Debugger Command window. If the selected
text includes more than one line, a syntax error results. This command is equivalent to using the Edit | Evaluate Selection command, pressing CTRL+SHIFT+V, or
using the ?? (Evaluate C++ Expression) command with the selected text as its argument.
Display selected type displays the data type of the selected object. This display appears in the Debugger Command window. If the selected text includes more than a
single object, a syntax error or other irregular results might be displayed. This command is equivalent to using the Edit | Display Selected Type command or pressing
CTRL+SHIFT+Y.
(Menu only) Open memory window for selected value opens a new docked Memory window that displays memory starting at the address of the selected expression.
(Menu only) Add selection to Watch window appends the selected source token to Watch window.
Disassemble at current line causes the instruction that corresponds to the current line to appear in the Disassembly window. The selected line is highlighted in the
Source window and in the Disassembly window, but this command affects only the displaythe instruction pointer is not changed. If the Disassembly window is
closed when this command is clicked, it is opened.
Select source language displays a list of programming languages. Select the programming language that you used to generate the source file, and then click OK to
enable basic syntax highlighting for the current Source window. Select <None> to disable syntax highlighting for the current Source window.
Dock or Undock causes the window to enter or leave the docked state.
(Menu only) Move to new dock closes the Source window and opens it in a new dock.
(Menu only) Set as tab-dock target for window type sets the selected Source window as the tab-dock target for other Source windows. All Source windows opened
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
after one is chosen as the tab-dock target are automatically grouped with that window in a tabbed collection. The Source Window marked as the tab-dock target will not
close when Window | Close All Source Windows is selected. This allows you to set a placeholder window that will not be closed unless you want it to be.
Always floating causes the window to remain undocked even if it is dragged to a docking location.
Move with frame causes the window to move when the WinDbg frame is moved, even if the window is undocked. For more information about docked, tabbed, and
floating windows, see Positioning the Windows.
Help opens this topic in the Debugging Tools for Windows documentation.
Close closes this window.
To turn the syntax colors off in a single window, open the Source window's shortcut menu, click Select source language, and then click <None>.
To turn the syntax colors off for all Source windows, select Options from the View menu. Then clear the Parse Source Languages check box.
To change the syntax colors, select Options from the View menu. Then, in the Colors area, select a syntax element and click the Change button to change the color.
The parsing method that is used for the highlighting is determined by the programming language that is associated with the file extension for the source file. To change
the programming language that is associated with a specific file extension, use the File Extensions for Source Languages dialog box. To open this dialog box, in the
WinDbg window, on the View menu, click Source language file extensions.
The line that represents the current program counter is highlighted in green. However, if you select a line with the mouse or by using one of the Edit | Go to Xxx commands,
the selected line is green and the line that represents the current program counter is not highlighted. Lines at which breakpoints are set are highlighted as well. Enabled
breakpoints are highlighted in red and disabled breakpoints are highlighted in yellow. If a breakpoint coincides with the current program counter, it is highlighted in purple.
If you select a Source window and then use the mouse to hover over a symbol in that window, the symbol will be evaluated. The evaluation is the same as that produced by
the dt (Display Type) command. To deactivate this evaluation, select Options from the View menu. Then clear the Evaluate on hover check box.
Additional Information
For more information about source debugging and related commands, see Debugging in Source Mode. For more information about docked, tabbed, and floating windows, see
Positioning the Windows. For more information about all techniques that you can use to control debugging information windows, see Using Debugging Information
Windows.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
File Menu
This section describes the following commands on the File menu of WinDbg:
File | Open Source File
File | Close Current Window
File | Open Executable
File | Attach to a Process
File | Open Crash Dump
File | Connect to Remote Session
File | Connect to Remote Stub
File | Kernel Debug
File | Symbol File Path
File | Source File Path
File | Image File Path
File | Open Workspace
File | Save Workspace
File | Save Workspace As
File | Clear Workspace
File | Delete Workspaces
File | Open Workspace in File
File | Save Workspace to File
File | Map Network Drive
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
).
Dialog Box
When you click Open Source File, the Open Source File dialog box appears. To open a file, do the following:
1. In the Look in list, select the directory where the file is located. The directory last opened is selected by default.
2. In the Files of type list, select the type of file that you want to open. Only files with the chosen extensions are displayed in the Open Source File dialog box.
Note You can also use wildcard patterns in the File name box to display only files with a certain extension. The new wildcard pattern is retained in a session until you
change it. You can use any combination of wildcard patterns, separated by semicolons. For example, entering *.INC; *.H; *.CPP displays all files with these
extensions. The maximum number of characters in a line is 251.
3. If you find the file you want, double-click the file name, or click the file name and click Open.
-ORTo discard changes and close the dialog box, click Cancel.
The names of the four files that you opened most recently in WinDbg are displayed when you point to Recent files on the File menu. To open one of these files, click its
name.
Additional Information
For more information about source files and source paths and for other ways to load source files, see Source Path.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Enter the full path of the executable file in the File name box. Alternatively, you can use the dialog box to locate and select the proper file. You must specify the exact
path to the executable file. Unlike the Microsoft Windows Run dialog box and a Command Prompt window, the Open Executable dialog box does not search the
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Select the line that contains the proper process ID and name (or enter the process ID in the Process ID box).
Note Each listed process has an associated plus sign (+). You can click the plus sign to display information about that process' command line, services, and child
processes.
Note If WinDbg is connected to a process server, the Attach to Process dialog box will display processes that are running on the remote computer. For more
information about process servers, see Activating a Smart Client.
If you want to attach noninvasively to a process, select the Noninvasive check box.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The list of servers in the Browse Remote Servers dialog box can also include servers that no longer exist but were shut down improperly. If you connect to one of these
nonexistent servers, you will receive an error message.
The list of servers does not include debugging servers. To view those servers, use the File | Connect to Remote Session command.
Additional Information
For more information and for other methods of joining a remote stub session, see Activating a Smart Client and Activating a Smart Client (Kernel Mode).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
The COM tab indicates that the connection will use a COM port. In the Baud Rate box, enter the baud rate. In the Port box, enter the name of the COM port.
The 1394 tab indicates that the connection will use 1394. In the Channel box, enter the 1394 channel number. 1394 debugging is supported only if both the host
computer and target computer are running Windows XP or later versions of the Windows operating system.
The USB 2.0 tab indicates that the connection will use USB 2.0. In the Target Name box, enter the connection string. This must match the string specified with the
targetname boot option. For information on this boot option prior to Windows Vista, see /debug. For information on this boot option in Windows Vista and later
versions of Windows, see BCDEdit / dbgsettings. USB 2.0 debugging is supported only if the host computer is running Windows 2000 or a later version of Windows,
and the target computer is running Windows Vista or a later version.
The Local tab indicates that WinDbg will perform local kernel debugging. Local kernel debugging is supported only on Windows XP and later.
Additional Information
For more information about settings for kernel debugging, see Choosing Kernel Debugging Settings.
For more information and for other methods of beginning a kernel debugging session, see Attaching to a Target Computer (Kernel Mode).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
When you click Clear Workspace, the Clear Workspace dialog box appears. This dialog box contains a list of all of the items that are contained in the current workspace in
the Items in Workspace area.
Use the Clear and Clear All buttons to remove items from the Items in Workspace area. If you make an error, use the Save and Save All buttons to return items to this list.
Click OK to make these changes, or click Cancel to discard these changes.
Additional Information
For more information about the different levels of workspaces and how to use them, see Using Workspaces.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
File | Exit
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Click Exit on the File menu to end the debugging session and exit WinDbg.
This command is equivalent to pressing ALT+F4.
Additional Information
For more information about exiting WinDbg or ending the debugging session, see Ending the Debugging Session.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Edit Menu
This section describes the following commands on the Edit menu of WinDbg:
Edit | Cut
Edit | Copy
Edit | Copy Formatted
Edit | Paste
Edit | Select All
Edit | Write Window Text to File
Edit | Copy Window Text to Clipboard
Edit | Add to Command Output
Edit | Clear Command Output
Edit | Evaluate Selection
Edit | Display Selected Type
Edit | Find
Edit | Find Next
Edit | Go to Address
Edit | Go to Line
Edit | Go to Current Instruction
Edit | Set Current Instruction
Edit | Breakpoints
Edit | Open/Close Log File
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Edit | Cut
Click Cut on the Edit menu to delete any text that you have selected and to move it to the clipboard.
This command is equivalent to pressing CTRL+X or SHIFT+DELETE or clicking the Cut (Ctrl+X) button (
) on the toolbar.
You can use the Cut command on the Edit menu only with docked or tabbed windows, but you can use the shortcut keys and the toolbar button with any window that
supports this feature.
Additional Information
For more information about how to select, copy, cut, and paste text and about how these operations vary from window to window, see Cutting and Pasting Text.
2009 Microsoft Corporation
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Edit | Copy
Click Copy on the Edit menu to copy to the clipboard any text that you have selected.
This command is equivalent to pressing CTRL+C or CTRL+INSERT or clicking the Copy (Ctrl+C) button (
) on the toolbar.
You can use the Copy command only with docked or tabbed windows. You can use the shortcut keys and the toolbar button with any window that supports this feature.
Additional Information
For more information about how to select, copy, cut, and paste text and about how these operations vary from window to window, see Cutting and Pasting Text.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Edit | Paste
Click Paste on the Edit menu to paste text from the clipboard to the current cursor location.
This command is equivalent to pressing CTRL+V or SHIFT+INSERT or clicking the Paste (Ctrl+V) button (
) on the toolbar.
You can use the Paste command only with docked or tabbed windows. But you can use the shortcut keys and the toolbar button with any window that supports this feature.
Additional Information
For more information about how to select, copy, cut, and paste text and about how these operations vary from window to window, see Cutting and Pasting Text.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
For more information about how to select, copy, cut, and paste text and about how these operations vary from window to window, see Cutting and Pasting Text.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
For more information about other features of Source windows, see Source Window.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Edit | Find
Click Find on the Edit menu to find text in the active debugging information window.
Note The active window must be the Debugger Command window or a Source window.
This command is equivalent to pressing CTRL+F.
Dialog Box
When you click Find, the Find dialog box appears. In this dialog box, in the Find what box, enter the text that you want to find. If there is already text selected, this text
automatically appears in the Find what box.
In the Direction area, click Up or Down to specify the direction of your search. The search begins wherever the cursor is in the window. You can put the cursor at any
location by using the mouse pointer.
Select Match whole word only if you want to search for a single whole word. (If you select this option when you search for multiple words, you always receive a failed
search.))
Select Match case to perform a case-sensitive search.
The Find command only changes the WinDbg display. This command does not affect the execution of the target or any other debugger operations.
After you close the Find dialog box, you can repeat the search in a forward direction by using the Edit | Find Next command or pressing F3. You can repeat the search in a
backward direction by pressing SHIFT+F3.
Additional Information
For more information about other ways to find text in debugging information windows, see Moving Through a Window.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Edit | Go to Address
Click Go to Address on the Edit menu to go to an address in the target's virtual address space.
This command is equivalent to pressing CTRL+G.
Dialog Box
When you click Go to Address, the View Code Offset dialog box appears. In this dialog box, enter the address that you want to move to. This address can be an expression
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
(such as a function, symbol, or integer memory address) or any valid address expression. If the address is ambiguous, the dialog box displays a list that contains all of the
ambiguous items.
Note If you put the cursor on a line within the Disassembly window or a Source window and then use the Go to Address command, the address of the line that you have
selected will appear in the View Code Offset dialog box. You can use this address or replace it with any address of your choice.
After you click OK, the debugger moves the caret (^) to the beginning of the function or address in the Disassembly window or a Source window.
You can use the Go to Address command in any window that is currently active. If the debugger is in disassembly mode, WinDbg finds the address in the Disassembly
window. If the debugger is in source mode, WinDbg finds the address in a Source window. If the address cannot be found in a Source window, WinDbg finds it in the
Disassembly window. If the appropriate window is not open, WinDbg opens it.
The Go to Address command only changes the WinDbg display. This command does not affect the execution of the target or any other debugger operations.
Additional Information
For more information about other ways of finding text in debugging information windows, see Moving Through a Window.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Edit | Go to Line
Click Go to Line on the Edit menu to search for a specific line in the currently-active Source window. If the active window is not a Source window, this command has no
effect.
This command is equivalent to pressing CTRL+L.
Dialog Box
When you click Go to Line, the Go to Line dialog box appears. In this dialog box, enter the line number that you want to find and then click OK. The debugger will move
the caret (^) to that line. If the line number is bigger than the last line in the file, the cursor will move to the end of the file.
The Go to Line command only changes the WinDbg display. This command does not affect the execution of the target or any other debugger operations.
Additional Information
For more information about other ways of finding text in debugging information windows, see Moving Through a Window.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Edit | Breakpoints
Click Breakpoints on the Edit menu to display or control breakpoints.
This command is equivalent to pressing ALT+F9. If a Source window or the Disassembly window is not active, you can also press F9 or click the Insert or remove
breakpoint (F9) button (
) on the toolbar.
However, if a Source window or the Disassembly window is open, the Insert or remove breakpoint (F9) button and the F9 key set a breakpoint on the current line. (If there
is already a breakpoint set at the current line, this button or key will remove the breakpoint.)
If a statement or call spans multiple lines, WinDbg sets the breakpoint on the last line of the statement or call. You should insert the caret (^) on or before the statement to set
a breakpoint for the whole statement. If the debugger cannot set a breakpoint at the current caret position, it will search in a downward direction for the next allowed position
and insert the breakpoint there.
Dialog Box
When you click Breakpoints, the Breakpoints dialog box appears. This dialog box displays all current breakpoint information and is presented in the following columns:
The breakpoint number. This number is a decimal number that you can use to refer to the breakpoint in future commands.
The breakpoint status. This status can be e (enabled) or d (disabled).
(Unresolved breakpoints only) The letter u. This letter appears if the breakpoint is unresolved (that is, it does not match any currently-loaded module address). For
details, see Unresolved Breakpoints (bu Breakpoints).
The virtual address of the breakpoint. If you have enabled the loading of source line numbers, the display includes file and line number information instead of address
offsets. If the breakpoint is unresolved, the address appears at the end of the listing instead of here.
(Processor breakpoints only) Type and size information. This information can be e (execute), r (read/write), w (write), or i (input/output). These types are followed with
the size of the block, in bytes. For details, see Processor Breakpoints (ba Breakpoints).
The number of passes that are remaining until the breakpoint becomes active, followed by the initial number of passes in parentheses. The number of times that the
program counter passes through the breakpoint without breaking is one less than the value of this number. Therefore, this number is never lower than 1. Note also that
this number counts only the times the application executes through this point. In other words, stepping over this point does not count. After the full count has been
reached, you can reset the count only by clearing and resetting the breakpoint.
The associated process and thread. If thread is given with three asterisks (***), this breakpoint is not a thread-specific breakpoint.
The module and function, with offset, that correspond to the breakpoint address. If the breakpoint is unresolved, the breakpoint address appears here, in parentheses. If
the breakpoint is set on a valid address but symbol information is missing, this column will be blank.
The command string that is automatically executed when this breakpoint is hit. This command string is displayed in quotation marks. If the breakpoint is hit, the
commands in this command string are executed until application execution resumes. Any command that resumes program execution (such as g or t) will stop the
execution of the command list.
If you select any breakpoint, you can then click the Remove, Disable, or Enable button. The Remove button permanently removes the breakpoint. The Disable button
temporarily deactivates the breakpoint. The Enable button re-enables a disabled breakpoint.
The Remove All button permanently removes all breakpoints.
You can also enter commands in the Command box in the following ways:
If you enter a bp (Set Breakpoint), bu (Set Unresolved Breakpoint), bm (Set Symbol Breakpoint), ba (Break on Access), bc (Breakpoint Clear), bd (Breakpoint
Disable), or be (Breakpoint Enable) command, the Command box works as if you were entering the command in the Debugger Command window. However, the
command itself must be in lowercase letters. The command cannot begin with a thread specifier. If you want to use a thread specifier, enter it in the Thread box without
the initial tilde (~).
If you enter any other text, the text will be treated as the argument string for a bu (Set Unresolved Breakpoint) command. That is, the debugger prefixes your entry
with bu and a space and then executes it as a command.
When you are entering a new breakpoint, you can also do the following:
Create a thread-specific breakpoint by entering a thread specifier in the Thread box. Do not include the tilde (~) character that is typically prefixed to a thread specifier.
Create a conditional breakpoint by entering a condition in the Condition box. The condition can be any evaluable expression, and it will be evaluated according to the
current expression syntax (see Evaluating Expressions). For more information about these types of breakpoints, see Setting a Conditional Breakpoint.
Additional Information
For more information about how to use breakpoints, other breakpoint commands and methods of controlling breakpoints, and setting breakpoints in user space from a kernel
debugger, see Using Breakpoints. For more information about conditional breakpoints, see Setting a Conditional Breakpoint.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Dialog Box
When you click Open/Close Log File, the Open/Close Log File dialog box appears. This dialog box displays the current log file, if one is already open.
If the Log file name box is blank, you can enter a log file name. If this file already exists, WinDbg overwrites the existing file, unless you select the Append check box. If
you specify a file name but no path, WinDbg puts the file in the default directory that you started WinDbg from.
If the Log file name box already displays a file name, you can click Close Open Log File to close the file. If you clear the Log file name box and enter a new log file name,
the previous log file will be closed.
Click OK to save changes, or click Cancel to discard changes.
If you click OK when no log file name appears in the Log file name box, it has no effect. That is, WinDbg does not close a log file or open a log file.
However, if a log file is already active and you click OK without clearing its name or selecting Append, WinDbg deletes the log file and uses a new file that has the same
name.
Additional Information
For more information and for other ways to write to log files, see Keeping a Log File.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
View Menu
This section describes the following commands on the View menu of WinDbg:
View | Command
View | Watch
View | Locals
View | Registers
View | Memory
View | Call Stack
View | Disassembly
View | Scratch Pad
View | Processes and Threads
View | Command Browser
View | Recent Commands
View | Set Browser Start Command
View | Verbose Output
View | Event Timestamps
View | Show Version
View | Toolbar
View | Status Bar
View | Font
View | Options
View | Source language file extensions
View | WinDbg Command Line
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
View | Command
Click Command on the View menu to open the Debugger Command window. If this window is already open, it becomes active.
This command is equivalent to pressing ALT+1 or clicking the Command (Alt+1) button (
) on the toolbar.
For more information about this window and its uses, see Debugger Command Window.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
View | Watch
Click Watch on the View menu to open the Watch window. If this window is already open, it becomes active.
This command is equivalent to pressing ALT+2 or clicking the Watch (Alt+2) button (
) on the toolbar.
For more information about this window and its uses, see Watch Window.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
View | Locals
Click Locals on the View menu to open the Locals window. If this window is already open, it becomes active.
This command is equivalent to pressing ALT+3 or clicking the Locals (Alt+3) button (
) on the toolbar.
For more information about this window and its uses, see Locals Window.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
View | Registers
Click Registers on the View menu to open the Registers window. If this window is already open, it becomes active.
This command is equivalent to pressing ALT+4 or clicking the Registers (Alt+4) button (
) on the toolbar.
For more information about this window and its uses, see Registers Window.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
View | Memory
Click Memory on the View menu to open a new Memory window.
Note You can have multiple Memory windows open at the same time. Each window can display a different region of memory. Only the Memory window and the Source
window have this ability. All other debugging information windows are limited to a single instance.
The View command is equivalent to pressing ALT+5 or clicking the Memory window (Alt+5) button (
) on the toolbar.
For more information about this window and its uses, see Memory Window.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
) on the toolbar.
For more information about this window and its uses, see Calls Window.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
View | Disassembly
Click Disassembly on the View menu to open the Disassembly window. If this window is already open, it becomes active.
This command is equivalent to pressing ALT+7 or clicking the Disassembly (Alt+7) button (
) on the toolbar.
For more information about this window and its uses, see Disassembly Window.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
) on the toolbar.
For more information about this window and its uses, see Scratch Pad.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
) on the toolbar.
For more information about this window and its uses, see Processes and Threads Window.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
) on the toolbar..
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
For more information about this window and its uses, see Command Browser Window.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
View | Toolbar
Select or clear Toolbar on the View menu to cause the toolbar to appear or disappear.
For more information about how to use the toolbar, see Using the Toolbar and Status Bar. For more information about each toolbar button, see Toolbar Buttons.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
View | Font
Click Font on the View menu to change the font that appears in the debugging information windows.
This command is equivalent to clicking the Font button (
) on the toolbar.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Dialog Box
When you click Font, the Font dialog box appears. In this dialog box, you can select the font, style, and size from the appropriate lists,. You can also select the script from a
drop-down menu to get the appropriate alphabet. To accept your changes, click OK.
Click Cancel to cancel changes to the font.
Additional Information
For more information about how to change the character display of the debugging information windows, see Changing Text Properties.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
View | Options
Click Options on the View menu to open the Options dialog box. This command is equivalent to clicking the button (
) on the toolbar.
Dialog Box
In the Options dialog box, you can select or deselect the following options:
Tab width
The Tab width box controls how tab characters are displayed in any Source window. In the Tab width box, enter the number of spaces that you want to have between
each tab setting. (The default setting is 8. For more information about text properties, see Changing Text Properties.)
Reuse after opening this many
The Reuse after opening this many box controls the number of document, or source, windows that can be open at the same time. If the specified number of source
windows has been reached, opening a new window causes an existing window to close. Windows that are marked as tab-dock targets do not close. The last windows to
close are the ones you used most recently.
Parse source languages
If the Parse source languages check box is selected, the text of source code in all Source windows is colored according to a simple parse of the source syntax. To change
the colors, in the Colors area of the dialog box, select a syntax element and then click Change. (To turn the syntax colors off in a single Source window, open that
window's shortcut menu, click Select source language, and then click <None>.)
Evaluate on hover
If the Evaluate on hover check box is selected (and the Parse source languages check box is selected as well), symbols in a Source window will be evaluated when you
select that window and then hover over a symbol with the mouse. The evaluation is the same as that produced by the dt (Display Type) command.
Enter repeats last command
If the Enter repeats last command check box is selected, you can press the ENTER key at an empty prompt in the Debugger Command window to repeat the previous
command. If you clear this check box, the ENTER key generates a new prompt.
Automatically scroll
The Automatically scroll check box controls the automatic scrolling that occurs when new text is sent to the Debugger Command window. If you want to turn off this
feature, clear the Automatically scroll check box. For more information about this scrolling, see Using Debugger Commands.
Workspace Prompts
In the Workspace Prompts area, you can click one of three options to determine when and how frequently the workspace is saved in WinDbg.
If you click Always ask, when a workspace changes (such as when a debugging session ends), the debugger displays the Workspace save dialog box where you
can save the workspace.
In the Workspace save dialog box, if you click Don't ask again, WinDbg resets the Workspace Prompts option to Never save or Always save.
If you click Always save, the workspace is saved automatically whenever it changes.
If you click Never save, the workspace is not saved when it changes, and you are not prompted to save it.
QuickEdit Mode
If the QuickEdit Mode check box is selected, you can right-click an item to copy or paste, depending on the window selection state. When you clear this check,
QuickEdit is disabled and you can right-click an item to open a shortcut menu for the window. You cannot give individual windows different settings; the QuickEdit
setting applies globally to all windows. By default, this box is selected. The QuickEdit setting is saved in the current workspace.
Colors
To change the color of the source text that is displayed, select an item from the Colors area and then click Change. Select a color, or select a custom color, and then click
OK.
In the Colors menu, you can change the colors of the following items:
The first ten items represent text in the Disassembly window and the Source window.
The Changed data text item represents data entries that have been changed (for example, in the Registers window).
The ten Source Xxx items control the colors that are used for syntax elements in the Source window.
The remaining items refer to different kinds of text in the Debugger Command window.
These color changes take effect when you click OK. To discard these changes, click Cancel.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Debug Menu
This section describes the following commands on the Debug menu of WinDbg:
Debug | Go
Debug | Go Unhandled Exception
Debug | Go Handled Exception
Debug | Restart
Debug | Stop Debugging
Debug | Detach Debuggee
Debug | Break
Debug | Step Into
Debug | Step Over
Debug | Step Out
Debug | Run to Cursor
Debug | Source Mode
Debug | Resolve Unqualified Symbols
Debug | Event Filters
Debug | Modules
Debug | Kernel Connection | Cycle Baud Rate
Debug | Kernel Connection | Cycle Initial Break
Debug | Kernel Connection | Resynchronize
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Debug | Go
Click Go on the Debug menu to resume (or begin) execution on the target. This execution will continue until a breakpoint is reached, an exception or event occurs, the
process ends, or the debugger breaks into the target.
This command is equivalent to pressing F5 or clicking the Go (F5) button (
) on the toolbar.
Additional Information
For more information about the effects of this action, other methods of issuing this command, and other ways to control program execution, see Controlling the Target.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Debug | Restart
Click Restart on the Debug menu to stop the target's execution and end the target process and all its threads. This command then restarts the target execution at the beginning
of the process.
This command is equivalent to pressing CTRL+SHIFT+F5 or clicking the Restart (Ctrl+Shift+F5) button (
) on the toolbar.
Additional Information
For more information about the effects of this action, other methods of issuing this command, and other ways to control program execution, see Controlling the Target. For
more information about how to exit WinDbg or end the debugging session, see Ending the Debugging Session.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Click Stop Debugging on the Debug menu to stop the target's execution and end the target process and all its threads. This action enables you to start to debug a different
target application.
This command is equivalent to pressing SHIFT+F5 or clicking the Stop debugging (Shift+F5) button (
) on the toolbar.
Additional Information
For more information about the effects of this action, other methods of issuing this command, and other ways to control program execution, see Controlling the Target.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
(Microsoft Windows XP and later versions of Windows) You are debugging a running user-mode target.
You are noninvasively debugging a user-mode target.
If you are debugging a live target on Windows 2000, the Detach Debuggee command is not available, because this version of Windows does not support detaching from a
target process.
Additional Information
For more information about how to exit the debugger or detach from the target, see Ending the Debugging Session.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Debug | Break
Click Break on the Debug menu to stop the target's execution and return control to the debugger.
In user mode, this command stops the process and its threads, enabling you to regain control of the debugger. In kernel mode, this command breaks into the target computer.
You can also use this command while the debugger is active. In this situation, the command will truncate long Debugger Command window displays.
The Break command is equivalent to pressing CTRL+BREAK or clicking the Break (Ctrl+Break) button (
) on the toolbar.
User-Mode Effects
In user mode, the Break command causes the target application to break into the debugger. The target application stops, the debugger becomes active, and you can enter
debugger commands.
If the debugger is already active, Break does not affect the target application. However, you can use this command to terminate a debugger command. For example, if you
have requested a long display and do not want to see any more of it, Break will end the display and return you to the debugger command prompt.
When you are performing remote debugging with WinDbg, you can press the Break key on the host computer's keyboard. If you want to issue a break from the target
computer's keyboard, use CTRL+C on an x86-based computer.
You can press the F12 key to open a command prompt when the application that is being debugged is busy. Click one of the target application's windows and press F12 on the
target computer.
Kernel-Mode Effects
In kernel mode, the Break command causes the target computer to break into the debugger. This command locks the target computer and wakes up the debugger.
When you are debugging a system that is still running, you must press the Break key on the host keyboard to open an initial command prompt.
If the debugger is already active, Break does not affect the target computer. However, you can use this command to terminate a debugger command. For example, if you have
requested a long display and do not want to see any more of it, Break will end the display and return you to the debugger command prompt.
You can also use Break to open a command prompt when a debugger command is generating a long display or when the target computer is busy. When you are debugging an
x86-based computer, you can also press CTRL+C on the target keyboard to have the same effect.
The SYSRQ key (or pressing ALT+SYSRQ on an enhanced keyboard) is similar. This key works from the host or target keyboard on any processor. However, this key works
only if you have opened the prompt by pressing CTRL+C at least one time before.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
You can disable the SYSRQ key by editing the registry. In the HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\i8042prt\Parameters registry key, create a
value named BreakOnSysRq and set it equal to DWORD 0x0. Then, restart the computer. After you have restarted the computer, you can press the SYSRQ key on the target
computer's keyboard and it will not break into the kernel debugger.
Additional Information
The corresponding key in KD and CDB is CTRL+C. For more information about other ways to control program execution, see Controlling the Target.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
) on the toolbar.
Additional Information
For more information about the effects of this action, other methods of issuing this command, and other ways to control program execution, see Controlling the Target.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
) on the toolbar.
Additional Information
For more information about the effects of this action, other methods of issuing this command, and other ways to control program execution, see Controlling the Target.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
) on the toolbar.
Additional Information
For more information about the effects of this action, other methods of issuing this command, and other ways to control program execution, see Controlling the Target.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
) on the toolbar.
9/18/2010
Introduction
Additional Information
For more information about the effects of this action, other methods of issuing this command, and other ways to control program execution, see Controlling the Target.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
When source mode is active, ASM is unavailable on the status bar. When assembly mode is active, ASM is displayed on the status bar.
Additional Information
For more information about source-mode debugging, see Debugging in Source Mode. For more information about assembly-mode debugging, see Debugging in Assembly
Mode.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
When you set the status for the Debuggee output event, you can limit this status to a specific output pattern. Click Argument, enter the output pattern in the Filter
Argument dialog box, and then click OK. If you do not specify an output pattern, the break occurs for any output.
If you want to set automatic commands that are executed if the event breaks into the debugger, select the event and then click Commands. The Filter Command dialog box
will appear. Enter any commands that you want into the Command or Second-chance Command box. Separate multiple commands by using semicolons and do not enclose
these commands in quotation marks.
Additional Information
For more information about break status and handling status, all event codes, the default status for all events, and other methods of controlling this status, see Controlling
Exceptions and Events.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Debug | Modules
Click Modules on the Debug menu to display the current list of loaded modules.
Dialog Box
When you click Modules, the Module List dialog box appears. This dialog box lists all modules that are currently loaded into memory.
Module List is divided into the following columns:
If you click the title bar of a column, the display is sorted by the data in that column. If you click the title bar again, the sort order reverses.
If you select a line and then click Reload, that module's symbol information is reloaded.
If you select a line and press CTRL+C, the whole line is copied to the clipboard.
Click Close to close this dialog box.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Point to Kernel Conection and then click Cycle Initial Break on the Debug menu to change the conditions on which the debugger automatically breaks into the target
computer.
This command is equivalent to pressing CTRL+ALT+K. (You can also press CTRL+K in KD.)
This command causes the kernel debugger to cycle through the following three states:
No break
The debugger does not break into the target computer unless you press CTRL+BREAK or Debug | Break.
Break on reboot
The debugger breaks into a restarted target computer after the kernel initializes. This command is equivalent to starting WinDbg with the -b command-line option.
Break on first module load
The debugger breaks into a restarted target computer after the first kernel module is loaded. (This action causes the break to occur earlier than in the Break on reboot
state.) This command is equivalent to starting WinDbg with the -d command-line option.
When you use the Cycle Initial Break command, the new break state is displayed.
Additional Information
For more information about related commands and an explanation of how the restart process affects the debugger, see Crashing and Rebooting the Target Computer.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Window Menu
This section describes the following commands on the Window menu of WinDbg:
Window | Close All Source Windows
Window | Close All Error Windows
Window | Open Dock
Window | Dock All
Window | Undock All
Window | Cascade Floating Windows
Window | Horizontally Tile Floating Windows
Window | Vertically Tile Floating Windows
Window | MDI Emulation
Window | Automatically Open Disassembly
List of Open Windows
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
) on the toolbar.
Help Menu
This section describes the following commands on the Help menu of WinDbg:
Help | Contents
Help | Window
Help | Selection
Help | Index
Help | Search
Help | About
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Help | Contents
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Click Contents on the Help menu to open the Contents tab in this Help documentation.
This command is equivalent to pressing F1.
Additional Information
For more information about how to use this Help file, see Using the Help File.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Help | Index
Click Index on the Help menu to open the Index tab in this Help documentation.
Additional Information
For more information about how to use this Help file, see Using the Help File.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Help | Search
Click Search on the Help menu to open the Search tab in this Help documentation.
Additional Information
For more information about how to use this Help file, see Using the Help File.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Help | About
Click About on the Help menu to open a message box that shows the version information for the WinDbg binaries that you are using.
Click OK to close this message box.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Toolbar Buttons
Except for the breakpoint button, each button on the toolbar is equivalent to a menu command. For a full description of each button's effects, see the page for the
corresponding menu command.
The buttons on the toolbar have the following effects.
Button
Description
Opens a source file as a read-only file. Equivalent to File | Open Source File.
Removes the selected text from the active window and puts it on the clipboard. Equivalent to Edit | Cut.
Copies the selected text from the active window to the clipboard. Equivalent to Edit | Copy.
Pastes the text on the clipboard to where the cursor is located. Equivalent to Edit | Paste.
Starts or resumes execution. Execution continues until a breakpoint is reached, an exception or event occurs, the process ends, or the debugger breaks into the target.
Equivalent to Debug | Go.
Restarts execution at the beginning of the process. Equivalent to Debug | Restart.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Stops execution and terminates the target process permanently. Equivalent to Debug | Stop Debugging.
In user mode, this button stops the process and its threads. In kernel mode, this button breaks into the target computer. Control is returned to the debugger. This
button is also useful for cutting off long Debugger Command window displays. Equivalent to Debug | Break.
Executes a single instruction. If the instruction is a function call, the debugger steps into the function. Equivalent to Debug | Step Into.
Executes a single instruction. If the instruction is a function call, the debugger executes the whole function in one step. Equivalent to Debug | Step Over.
Executes the rest of the current function, and breaks when the function return is completed. Equivalent to Debug | Step Out.
Executes all instructions from the current instruction up to the instruction marked in the active Disassembly window or Source window. Equivalent to Debug | Run
to Cursor.
If the active window is a Source or Disassembly window: Inserts a breakpoint at the current line. (If there already is a breakpoint set at the current line, this button
removes the breakpoint.)
Otherwise: Opens the Breakpoints dialog box like Edit | Breakpoints.
Opens or activates the Debugger Command window. Equivalent to View | Command.
Opens or activates the Watch window. Equivalent to View | Watch.
Opens or activates the Locals window. Equivalent to View | Locals.
Opens or activates the Registers window. Equivalent to View | Registers.
Opens a new Memory window. Equivalent to View | Memory.
Opens or activates the Calls window. Equivalent to View | Call Stack.
Opens or activates the Disassembly window. Equivalent to View | Disassembly.
Opens or activates the Scratch Pad. Equivalent to View | Scratch Pad.
Switches between source-mode and assembly-mode debugging. Equivalent to selecting or clearing Debug | Source Mode.
Enables you to change the font that is used in the debugging information windows. Equivalent to View | Font.
Displays the Options dialog box. Equivalent to View | Options.
Keyboard Shortcuts
You can use the following keyboard shortcuts to switch between windows. For more information about how to move between the windows, see Positioning the Windows.
Keys
Effect
CTRL+TAB Switches between debugging information windows. By using this key repeatedly, you can scan through all of the windows, regardless of whether they are
floating, docked by themselves, or part of a tabbed collection of docked windows.
ALT+TAB Switches between the windows that are currently on your desktop. You can also use this keyboard shortcut to switch between the WinDbg frame and any
additional docks you have created.
You can use the following keyboard shortcuts instead of the mouse to select menu commands. For more information about each command, see the individual command
topics.
Keys
Menu equivalent
F1
Help | Contents
F3
Edit | Find Next
SHIFT+F3
Same as Edit | Find Next, except the search is performed in the reverse direction.
ALT+F4
File | Exit
CTRL+F4
File | Close Current Window
F5
Debug | Go
SHIFT+F5
Debug | Stop Debugging
CTRL+SHIFT+F5 Debug | Restart
File | Attach to a Process
F6
F7
Debug | Run to Cursor
F8
Debug | Step Into
F9
If the active window is a Source or Disassembly window: Inserts a breakpoint at the current line. (If there already is a breakpoint set at the current line,
this button removes the breakpoint.)
Otherwise: Opens the Breakpoints dialog box like Edit | Breakpoints.
ALT+F9
F10
CTRL+F10
F11
SHIFT+F11
ALT+1
Edit | Breakpoints
Debug | Step Over
Debug | Run to Cursor
Debug | Step Into
Debug | Step Out
Opens the Debugger Command window (same as View | Command).
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
ALT+SHIFT+1
ALT+2
ALT+SHIFT+2
ALT+3
ALT+SHIFT+3
ALT+4
ALT+SHIFT+4
ALT+5
ALT+SHIFT+5
ALT+6
ALT+SHIFT+6
ALT+7
ALT+SHIFT+7
ALT+8
ALT+SHIFT+8
ALT+9
ALT+SHIFT+9
CTRL+A
CTRL+C
CTRL+D
CTRL+E
CTRL+F
CTRL+G
CTRL+I
CTRL+SHIFT+I
CTRL+K
CTRL+L
CTRL+O
CTRL+P
CTRL+R
CTRL+S
CTRL+V
CTRL+SHIFT+V
CTRL+W
CTRL+X
CTRL+SHIFT+Y
ALT+*
(number keypad)
SHIFT+DELETE
SHIFT+INSERT
CTRL+INSERT
CTRL+BREAK
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Debugging Techniques
This section includes:
Elementary Debugging Techniques
Messages from the Target
Bug Checks (Blue Screens)
Processor Architecture
RPC Debugging
ACPI Debugging
NDIS Debugging
Kernel Streaming Debugging
SCSI Miniport Debugging
Kernel-Mode Driver Framework Debugging
User-Mode Driver Framework Debugging
Plug and Play Debugging
Advanced Debugging Techniques
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The FAULTING_IP field shows the instruction pointer at the time of the fault.
EXCEPTION_RECORD: ffffffff -- (.exr ffffffffffffffff)
ExceptionAddress: 77f97704 (ntdll!PropertyLengthAsVariant+0x00000073)
ExceptionCode: 80000003 (Break instruction exception)
ExceptionFlags: 00000000
NumberParameters: 3
Parameter[0]: 00000000
Parameter[1]: 00010101
Parameter[2]: ffffffff
The EXCEPTION_RECORD field shows the exception record for this crash. This information can also be viewed by using the .exr (Display Exception Record) command.
BUGCHECK_STR:
80000003
The BUGCHECK_STR field shows the exception code. The name is a misnomer the term bug check actually signifies a kernel-mode crash. In user-mode debugging, the
exception code will be displayed in this case, 0x80000003.
DEFAULT_BUCKET_ID:
APPLICATION_FAULT
The DEFAULT_BUCKET_ID field shows the general category of failures that this failure belongs to.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
PROCESS_NAME:
MyApp.exe
The PROCESS_NAME field specifies the name of the process that raised the exception.
LAST_CONTROL_TRANSFER:
The LAST_CONTROL_TRANSFER field shows the last call on the stack. In this case, the code at address 0x01050963 called a function at 0x77F97704. You can use these
addresses with the ln (List Nearest Symbols) command to determine what modules and functions these addresses reside in.
STACK_TEXT:
0006b9dc 01050963
0006b9f0 010509af
0006da04 01029f4e
0006db6c 010590c3
0006fe04 77e11d0a
0006fe24 77e11bc8
0006feb0 77e172b4
0006febc 010518bf
0006fec8 01057c5d
0006ff70 01062cbf
0006ffc0 77e9ca90
0006fff0 00000000
00000000
00000002
01069850
000e01ea
000e01ea
01057da1
0006fee4
0006fee4
0006fee4
00000001
77f82b95
01062bc0
0006ba04
0006ba04
0000034f
0006fee4
00000111
000e01ea
00000001
00000000
77f82b95
00683ed8
77f83920
00000000
000603fd
77e1a449
01069828
0006feec
0000413c
00000111
010518bf
01057c5d
77f83920
00682b88
7ffdf000
000000c8
ntdll!PropertyLengthAsVariant+0x73
MyApp!FatalErrorBox+0x55 [D:\source_files\MyApp\util.c @ 541]
MyApp!ShowAssert+0x47 [D:\source_files\MyApp\util.c @ 579]
MyApp!SelectColor+0x103 [D:\source_files\MyApp\colors.c @ 849]
MyApp!MainWndProc+0x1322 [D:\source_files\MyApp\MyApp.c @ 1031]
USER32!UserCallWinProc+0x18
USER32!DispatchMessageWorker+0x2d0
USER32!DispatchMessageA+0xb
MyApp!ProcessQCQPMessage+0x3b [D:\source_files\MyApp\util.c @ 2212]
MyApp!main+0x1e6 [D:\source_files\MyApp\MyApp.c @ 263]
MyApp!mainCRTStartup+0xff [D:\source_files\MyApp\crtexe.c @ 338]
KERNEL32!BaseProcessStart+0x3d
pop
esi
dbg
SYMBOL_NAME:
MyApp!FatalErrorBox+55
MODULE_NAME:
MyApp
IMAGE_NAME:
MyApp.exe
DEBUG_FLR_IMAGE_TIMESTAMP:
383490a9
When !analyze determines the instruction that has probably caused the error, it displays it in the FOLLOWUP_IP field. The SYMBOL_NAME, MODULE_NAME,
IMAGE_NAME, and DBG_FLR_IMAGE_TIMESTAMP fields show the symbol, module, image name, and image timestamp corresponding to this instruction.
STACK_COMMAND:
.ecxr ; kb
The STACK_COMMAND field shows the command that was used to obtain the STACK_TEXT. You can use this command to repeat this stack trace display, or alter it to
obtain related stack information.
BUCKET_ID:
80000003_MyApp!FatalErrorBox+55
The BUCKET_ID field shows the specific category of failures that the current failure belongs to. This category helps the debugger determine what other information to
display in the analysis output.
Followup: dbg
--------For information about the FOLLOWUP_NAME and the Followup fields, see The Followup Field and the triage.ini File.
There are a variety of other fields that may appear:
If control was transferred to an invalid address, then the FAULTING_IP field will contain this invalid address. Instead of the FOLLOWUP_IP field, the
FAILED_INSTRUCTION_ADDRESS field will show the disassembled code from this address, although this disassembly will probably be meaningless. In this
situation, the SYMBOL_NAME, MODULE_NAME, IMAGE_NAME, and DBG_FLR_IMAGE_TIMESTAMP fields will refer to the caller of this instruction.
If the processor misfires, you may see the SINGLE_BIT_ERROR, TWO_BIT_ERROR, or POSSIBLE_INVALID_CONTROL_TRANSFER fields.
If memory corruption seems to have occurred, the CHKIMG_EXTENSION field will specify the !chkimg extension command that should be used to investigate.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The first element of the display shows the bug check code and information about this type of bug check. Some of the text displayed may not apply to this specific instance.
For more details on each bug check, see the Bug Check Code Reference section.
Arguments:
Arg1: 00000004,
Arg2: 00000002,
Arg3: 00000001,
Arg4: f832035c,
memory referenced
IRQL
value 0 = read operation, 1 = write operation
address which referenced memory
The bug check parameters are displayed next. They are each followed by a description. For example, the third parameter is 1, and the comment following it explains that this
indicates that a write operation failed.
Debugging Details:
-----------------WRITE_ADDRESS:
CURRENT_IRQL:
The next few fields vary depending on the nature of the crash. In this case, we see WRITE_ADDRESS and CURRENT_IRQL fields. These are simply restating the
information shown in the bug check parameters. By comparing the statement "Nonpaged pool" to the bug check text that reads "an attempt was made to access a pagable (or
completely invalid) address," we can see that the address was invalid. The invalid address in this case was 0x00000004.
FAULTING_IP:
USBPORT!USBPORT_BadRequestFlush+7c
f832035c 894204
mov
[edx+0x4],eax
The FAULTING_IP field shows the instruction pointer at the time of the fault.
DEFAULT_BUCKET_ID:
DRIVER_FAULT
The DEFAULT_BUCKET_ID field shows the general category of failures that this failure belongs to.
BUGCHECK_STR:
0xD1
The BUGCHECK_STR field shows the bug check code, which we have already seen. In some cases additional triage information is appended.
TRAP_FRAME: f8950dfc -- (.trap fffffffff8950dfc)
.trap fffffffff8950dfc
ErrCode = 00000002
eax=81cc86dc ebx=81cc80e0 ecx=81e55688 edx=00000000 esi=81cc8028 edi=8052cf3c
eip=f832035c esp=f8950e70 ebp=f8950e90 iopl=0
nv up ei pl nz ac po nc
cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000
efl=00010216
USBPORT!USBPORT_BadRequestFlush+7c:
f832035c 894204
mov
[edx+0x4],eax
ds:0023:00000004=????????
.trap
Resetting default context
The TRAP_FRAME field shows the trap frame for this crash. This information can also be viewed by using the .trap (Display Trap Frame) command.
LAST_CONTROL_TRANSFER:
The LAST_CONTROL_TRANSFER field shows the last call on the stack. In this case, the code at address 0xF83206E0 called a function at 0xF832035C. You can use the
ln (List Nearest Symbols) command to determine what module and function these addresses reside in.
STACK_TEXT:
f8950e90 f83206e0
f8950eb0 804f5561
f8950fb4 804f5644
f8950fe0 8052c47c
f8950ff4 8052c16a
024c7262
81cc8644
6e4be98e
8053cf20
efdefd44
00000000
81cc8028
00000000
00000000
00000000
f8950edc
6d9a2f30
ffdff000
00002e42
00000000
USBPORT!USBPORT_BadRequestFlush+0x7c
USBPORT!USBPORT_DM_TimerDpc+0x10c
nt!KiTimerListExpire+0xf3
nt!KiTimerExpiration+0xb0
nt!KiRetireDpcList+0x31
usbtri
SYMBOL_NAME:
USBPORT!USBPORT_BadRequestFlush+7c
MODULE_NAME:
USBPORT
IMAGE_NAME:
USBPORT.SYS
DEBUG_FLR_IMAGE_TIMESTAMP:
3b7d868b
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The SYMBOL_NAME, MODULE_NAME, IMAGE_NAME, and DBG_FLR_IMAGE_TIMESTAMP fields show the symbol, module, image, and image timestamp
corresponding to this instruction (if it is valid), or to the caller of this instruction (if it is not).
STACK_COMMAND:
.trap fffffffff8950dfc ; kb
The STACK_COMMAND field shows the command that was used to obtain the STACK_TEXT. You can use this command to repeat this stack trace display, or alter it to
obtain related stack information.
BUCKET_ID:
0xD1_W_USBPORT!USBPORT_BadRequestFlush+7c
The BUCKET_ID field shows the specific category of failures that the current failure belongs to. This category helps the debugger determine what other information to
display in the analysis output.
INTERNAL_SOLUTION_TEXT:
http://oca.microsoft.com/resredir.asp?sid=62&State=1
If you are connected to the internet, the debugger attempts to access a database of crash solutions maintained by Microsoft. This database contains links to a tremendous
number of Web pages that have information about known bugs. If a match is found for your problem, the INTERNAL_SOLUTION_TEXT field will show a URL that you
can access for more information.
Followup: usbtri
--------This problem has a known fix.
Please connect to the following URL for details:
-----------------------------------------------http://oca.microsoft.com/resredir.asp?sid=62&State=1
For information about the FOLLOWUP_NAME and the Followup fields, see The Followup Field and the triage.ini File:
There are a variety of other fields that may appear:
If control was transferred to an invalid address, then the FAULTING_IP field will contain this invalid address. Instead of the FOLLOWUP_IP field, the
FAILED_INSTRUCTION_ADDRESS field will show the disassembled code from this address, although this disassembly will probably be meaningless. In this
situation, the SYMBOL_NAME, MODULE_NAME, IMAGE_NAME, and DBG_FLR_IMAGE_TIMESTAMP fields will refer to the caller of this instruction.
If the processor misfires, you may see the SINGLE_BIT_ERROR, TWO_BIT_ERROR, or POSSIBLE_INVALID_CONTROL_TRANSFER fields.
If memory corruption seems to have occurred, the CHKIMG_EXTENSION field will specify the !chkimg extension command that should be used to investigate.
If a bug check occurred within the code of a device driver, its name may be displayed in the BUGCHECKING_DRIVER field.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The bp (Set Breakpoint) command sets breakpoints. Although the preceding example uses the bp command, you could also use the bu (Set Unresolved Breakpoint)
command. For more information about the differences between bp and bu, and for a basic introduction to breakpoints, see Using Breakpoints.
Source line numbers are specified by using grave accents ( ` ). For details, see Source Line Syntax.
When the breakpoint is hit, the command in straight quotation marks ( " ) is executed. In this example, this command is a j (Execute If - Else) command or an .if token,
which tests the expression in parentheses.
In the source program, MyVar is an integer. If you are using C++ expression syntax, MyVar is interpreted as an integer. However, in this example (and in the default
debugger configuration), MASM expression syntax is used. In a MASM expression, MyVar is treated as an address. Thus, you need to use the poi operator to
dereference it. (If your variable actually is a C pointer, you will need to dereference it twicefor example, poi(poi(MyPtr)).) The 0n prefix specifies that this number
is decimal. For syntax details, see MASM Numbers and Operators.
The expression in parentheses is followed by two commands, surrounded by single quotation marks ( ' ) for the j command and curly brackets ( {} ) for the .if token. If
the expression is true, the first of these commands is executed. In this example, there is no first command, so command execution will end and control will remain with
the debugger. If the expression in parentheses is false, the second command will execute. The second command should almost always be a gc (Go from Conditional
Breakpoint) command, because this command causes execution to resume in the same manner that was occurring before the breakpoint was hit (stepping, tracing, or
free execution).
If you want to see a message each time the breakpoint is passed or when it is finally hit, you can use additional commands in the single quotation marks or curly brackets. For
example:
0:000> bp `:143` "j (poi(MyVar)>5) '.echo MyVar Too Big'; '.echo MyVar Acceptable; gc' "
0:000> bp `:143` ".if (poi(MyVar)>5) {.echo MyVar Too Big} .else {.echo MyVar Acceptable; gc} "
These comments are especially useful if you have several such breakpoints running at the same time, because the debugger does not display its standard "Breakpoint n Hit"
messages when you are using a command string in the bp command.
Conditional Breakpoints and Register Sign Extension
You can set a breakpoint that is conditional on a register value.
The following command will break at the beginning of the myFunction function if the eax register is equal to 0xA3:
0:000> bp mydriver!myFunction "j @eax = 0xa3 '';'gc'"
0:000> bp mydriver!myFunction ".if @eax = 0xa3 {} .else {gc}"
However, the following similar command will not necessarily break when eax equals 0xC0004321:
0:000> bp mydriver!myFunction "j @eax = 0xc0004321 '';'gc'"
0:000> bp mydriver!myFunction ".if @eax = 0xc0004321 {} .else {gc}"
The reason the preceding command will fail is that the MASM expression evaluator sign-extends registers whose high bit equals one. When eax has the value 0xC0004321, it
will be treated as 0xFFFFFFFF`C0004321 in computationseven though eax will still be displayed as 0xC0004321. However, the numeral 0xc0004321 is sign-extended in
kernel mode, but not in user mode. Therefore, the preceding command will not work properly in user mode. If you mask the high bits of eax, the command will work properly
in kernel modebut now it will fail in user mode.
You should formulate your commands defensively against sign extension in both modes. In the preceding command, you can make the command defensive by masking the
high bits of a 32-bit register by using an AND operation to combine it with 0x00000000`FFFFFFFF and by masking the high bits of a numeric constant by including a grave
accent ( ` ) in its syntax.
The following command will work properly in user mode and kernel mode:
0:000> bp mydriver!myFunction "j (@eax & 0x0`ffffffff) = 0x0`c0004321 '';'gc'"
0:000> bp mydriver!myFunction ".if (@eax & 0x0`ffffffff) = 0x0`c0004321 {} .else {gc}"
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
For more information about which numbers are sign-extended by the debugger, see Sign Extension.
Conditional Breakpoints in WinDbg
In WinDbg, you can create a conditional breakpoint by clicking Breakpoints from the Edit menu, entering a new breakpoint address into the Command box, and entering a
condition into the Condition box.
For example, typing mymod!myFunc+0x3A into the Command box and myVar < 7 into the Condition box is equivalent to issuing the following command:
0:000> bu mymod!myFunc+0x3A "j(myVar<7) '.echo "Breakpoint hit, condition myVar<7"'; 'gc'"
0:000> bu mymod!myFunc+0x3A ".if(myVar<7) {.echo "Breakpoint hit, condition myVar<7"} .else {gc}"
Restrictions on Conditional Breakpoints
If you are controlling the user-mode debugger from the kernel debugger, you cannot use conditional breakpoints or any other breakpoint command string that contains the
gc (Go from Conditional Breakpoint) or g (Go) commands. If you use these commands, the serial interface might not be able to keep up with the number of breakpoint
passes, and you will be unable to break back into CDB.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
For details on how to set and control breakpoints, see Using Breakpoints.
A more complicated way to execute until a specified state is reached is to use a conditional breakpoint. This kind of breakpoint is set at a certain address, but is only triggered
if a specified condition holds. For details, see Setting a Conditional Breakpoint.
Breakpoints and Pseudo-Registers
In specifying the desired state, it is often helpful to use automatic pseudo-registers. These are variables controlled by the debugger which allow you to reference a variety of
values related to the target state.
For example, the following breakpoint uses the $thread pseudo-register, which is always equal to the value of the current thread. It resolves to the value of the current thread
when it is used in a command. By using $thread as the argument of the /t parameter of the bp (Set Breakpoint) command, you can create a breakpoint that will be triggered
every time that NtOpenFile is called by the thread which was active at the time you issued the bp command:
kd> bp /t @$thread nt!ntopenfile
This breakpoint will not be triggered when any other thread calls NtOpenFile.
For a list of automatic psuedo-registers, see Pseudo-Register Syntax.
Using a Script File to Control Execution
Another way to execute until a specified state is reached is to create a script file that calls itself recursively, testing the desired state in each iteration.
Typically, this script file will contain the .if and .else tokens. You can use a command such as t (Trace) to execute a single step, and then test the condition in question.
For example, if you wish to execute until the eax register contains the value 0x1234, you can create a script file called eaxstep.txt that contains the following line:
.if (@eax == 1234) { .echo Value of eax is 1234. } .else { t ; $<eaxstep.txt }
Then issue the following command from the Debugger Command window:
t "$<eaxstep.txt"
This t command will execute a single step, and then execute the quoted command. This command happens to be $< (Run Script File), which runs the eaxstep.txt file. The
script file tests the value of eax, runs the t command, and then calls itself recursively. This continues until the eax register equals 0x1234, at which point the .echo (Echo
Comment) command prints a message to the Debugger Command window, and execution stops.
For details on script files, see Using Script Files and Using Debugger Command Programs.
2009 Microsoft Corporation
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
In memory.......
.....q.w...w....
.'.w>..w.G.w....
Because the results are the same, this indicates that the physical address 0x09DE9980 does indeed correspond to the virtual address 0x0012F980.
Address Conversion Using !pte
Again, assume you are investigating the virtual address 0x0012F980 belonging to the MyApp.exe process. Here is the procedure you would use with the !pte extension to
determine the corresponding physical address:
Converting a virtual address to a physical address using !pte
1. Make sure that you are working in hexadecimal. If necessary, set the current base with the N 16 command.
2. Determine the byte index of the address. This number is equal to the lowest 12 bits of the virtual address. Thus, the virtual address 0x0012F980 has a byte index of
0x980.
3. Set the process context to the desired process:
kd> !process 0 0
**** NT ACTIVE PROCESS DUMP ****
....
PROCESS ff779190 SessionId: 0 Cid: 04fc
Peb: 7ffdf000 ParentCid: 0394
DirBase: 098fd000 ObjectTable: e1646b30 TableSize:
8.
Image: MyApp.exe
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
0y
00000000 00
010010 1111
1001 10000000
You then need three additional pieces of information for your system.
Using this data, you can compute the address of the PTE itself:
PTE address
PTE_BASE
+ (page directory index) * PAGE_SIZE
+ (page table index) * sizeof(MMPTE)
=
0xc0000000
+ 0x0
* 0x1000
+ 0x12F * 4
=
0xC00004BC
This is the address of the PTE. The PTE is a 32-bit DWORD. Examine its contents:
kd> dd 0xc00004bc L1
c00004bc 09de9067
This PTE has value 0x09DE9067. It is made of two fields:
The low 12 bits of the PTE are the status flags. In this case, these flags equal 0x067 or in binary, 0y000001100111. For an explanation of the status flags, see the !
pte reference page.
The high 20 bits of the PTE are equal to the page frame number (PFN) of the PTE. In this case, the PFN is 0x09DE9.
The first physical address on the physical page is the PFN multiplied by 0x1000 (shifted left 12 bits). The byte index is the offset on this page. Thus,the physical address you
are looking for is 0x09DE9000 + 0x980 = 0x09DE9980. This is the same result obtained by the earlier methods.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
RetAddr
77f6c600
01836060
01843eba
01855924
77e112e6
77e11215
77e1a3b1
77e181e4
77e1a5df
77e1ac1c
Param1
Param2
000000c8.00000000
0184f440 00000001
02b5b920 00000102
0b4ffef0 00145970
01843e16 0b4ffef0
0b4ffef0 00000000
0b4ffef0 00000000
02b1e0b0 00000074
02b1e0b0 00000074
77e15eaf 00149210
Param3
77fa5ad0
0b4ffe20
02b1e0e0
0b4ffef0
0b4fff34
0b4fff34
0b4fff34
0b4fff90
00149210
0b4fffec
Function Name
BuggyProgram!CreateMsgFile+0x1b
BuggyProgram!OpenDestFileStream+0xb3
BuggyProgram!SaveMsgToDestFolder+0xb3
BuggyProgram!DispatchToConn+0xa4
RPCRT4!DispatchToStubInC+0x34
RPCRT4!?DispatchToStubWorker@RPC_INTERFACE@@AAEJPAU_RPC_MESSAGE@@IPAJ@Z+0xb0
RPCRT4!?DispatchToStub@RPC_INTERFACE@@QAEJPAU_RPC_MESSAGE@Z+0x41
RPCRT4!?ReceiveOriginalCall@OSF_SCONNECTION@Z+0x14b
RPCRT4!?DispatchPacket@OSF_SCONNECTION@+0x91
RPCRT4!?ReceiveLotsaCalls@OSF_ADDRESS@@QAEXXZ+0x76
6. Set a breakpoint on the return address of the currently-running function. In this case, the return address is shown on the first line as 0x77F6C600. The return address is
equivalent to the function offset shown on the second line (BuggyProgram!OpenDestFileStream+0xB3). If no symbols are available for the application, the function
name may not appear. Use the g (Go) command to execute until this return address is reached, using either the symbolic or hexadecimal address:
0:002> g BuggyProgram!OpenDestFileStream+0xb3
7. If this breakpoint is hit, repeat the process. For example, suppose this breakpoint is hit. The following steps should be taken:
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
0:002> kb
FramePtr
0b4ffce4
0b4ffd20
0b4ffe20
0b4ffe5c
0b4ffeb0
0b4ffed0
0b4fff40
0b4fff60
0b4fff90
RetAddr
01836060
01843eba
01855924
77e112e6
77e11215
77e1a3b1
77e181e4
77e1a5df
77e1ac1c
Param1
0184f440
02b5b920
0b4ffef0
01843e16
0b4ffef0
0b4ffef0
02b1e0b0
02b1e0b0
77e15eaf
Param2
00000001
00000102
00145970
0b4ffef0
00000000
00000000
00000074
00000074
00149210
Param3
0b4ffe20
02b1e0e0
0b4ffef0
0b4fff34
0b4fff34
0b4fff34
0b4fff90
00149210
0b4fffec
Function Name
BuggyProgram!OpenDestFileStream+0xb3
BuggyProgram!SaveMsgToDestFolder+0xb3
BuggyProgram!DispatchToConn+0xa4
RPCRT4!DispatchToStubInC+0x34
RPCRT4!?DispatchToStubWorker@RPC_INTERFACE@@AAEJPAU_RPC_MESSAGE@@IPAJ@Z+0xb0
RPCRT4!?DispatchToStub@RPC_INTERFACE@@QAEJPAU_RPC_MESSAGE@Z+0x41
RPCRT4!?ReceiveOriginalCall@OSF_SCONNECTION@Z+0x14b
RPCRT4!?DispatchPacket@OSF_SCONNECTION@+0x91
RPCRT4!?ReceiveLotsaCalls@OSF_ADDRESS@@QAEXXZ+0x76
0:002> g BuggyProgram!SaveMsgToDestFolder+0xb3
If this is hit, continue with:
0:002> kb
FramePtr
0b4ffd20
0b4ffe20
0b4ffe5c
0b4ffeb0
0b4ffed0
0b4fff40
0b4fff60
0b4fff90
RetAddr
01843eba
01855924
77e112e6
77e11215
77e1a3b1
77e181e4
77e1a5df
77e1ac1c
Param1
02b5b920
0b4ffef0
01843e16
0b4ffef0
0b4ffef0
02b1e0b0
02b1e0b0
77e15eaf
Param2
00000102
00145970
0b4ffef0
00000000
00000000
00000074
00000074
00149210
Param3
02b1e0e0
0b4ffef0
0b4fff34
0b4fff34
0b4fff34
0b4fff90
00149210
0b4fffec
Function Name
BuggyProgram!SaveMsgToDestFolder+0xb3
BuggyProgram!DispatchToConn+0xa4
RPCRT4!DispatchToStubInC+0x34
RPCRT4!?DispatchToStubWorker@RPC_INTERFACE@@AAEJPAU_RPC_MESSAGE@@IPAJ@Z+0xb0
RPCRT4!?DispatchToStub@RPC_INTERFACE@@QAEJPAU_RPC_MESSAGE@Z+0x41
RPCRT4!?ReceiveOriginalCall@OSF_SCONNECTION@Z+0x14b
RPCRT4!?DispatchPacket@OSF_SCONNECTION@+0x91
RPCRT4!?ReceiveLotsaCalls@OSF_ADDRESS@@QAEXXZ+0x76
0:002> g BuggyProgram!DispatchToConn+0xa4
8. Finally you will find a breakpoint that is not hit. In this case, you should assume that the last g command set the target running and it did not break. This means that the
SaveMsgToDestFolder() function will never return.
9. Break into the thread again and set a breakpoint on BuggyProgram!SaveMsgToDestFolder+0xB3 with the bp (Set Breakpoint) command. Then use the g command
repeatedly. If this breakpoint hits immediately, regardless of how many times you have executed the target, it is very likely that you have identified the offending
function:
0:002> bp BuggyProgram!SaveMsgToDestFolder+0xb3
0:002> g
0:002> g
10. Use the p (Step) command to proceed through the function until you identify the place where the looping sequence of instructions are. You can then analyze the
application's source code to identify the cause of the spinning thread. The cause will usually turn out to be a problem in the logic of a while, do-while, goto, or for loop.
See Also
Process Hangs or Consumes 100 Percent of CPU
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
= _UNICODE_STRING "AIGM-MYCOMP-PUB01"
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
:
:
:
:
:
->Ace[1]:
->Ace[1]:
->Ace[1]:
->Ace[1]:
->Ace[1]:
->Sacl
is NULL
->AceType: ACCESS_ALLOWED_ACE_TYPE
->AceFlags: 0x0
->AceSize: 0x18
->Mask : 0x00120001
->SID: S-1-5-32-544
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
RTL_CRITICAL_SECTION 77fc49e0
DebugInfo
: 0x77fc3e00
LockCount
: 0
RecursionCount
: 1
OwningThread
: 0x00000c78
LockSemaphore
: (null)
SpinCount
: 0
In Microsoft Windows 2000, and Windows XP, the LockCount field indicates the number of times that any thread has called the EnterCriticalSection routine for this
critical section, minus one. This field starts at -1 for an unlocked critical section. Each call of EnterCriticalSection increments this value; each call of
LeaveCriticalSection decrements it. For example, if LockCount is 5, this critical section is locked, one thread has acquired it, and five additional threads are waiting
for this lock.
The RecursionCount field indicates the number of times that the owning thread has called EnterCriticalSection for this critical section.
The EntryCount field indicates the number of times that a thread other than the owning thread has called EnterCriticalSection for this critical section.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
RecursionCount
OwningThread
EntryCount
ContentionCount
0
0
0
0
The debugger displays "NOT LOCKED" as the value for LockCount. The actual value of this field for an unlocked critical section is -1. You can verify this with the
dt (Display Type) command:
0:000> dt
+0x000
+0x004
+0x008
+0x00c
+0x010
+0x014
RTL_CRITICAL_SECTION 433e60
DebugInfo
: 0x77fcec80
LockCount
: -1
RecursionCount
: 0
OwningThread
: (null)
LockSemaphore
: (null)
SpinCount
: 0
When the first thread calls the EnterCriticalSection routine, the critical section's LockCount, RecursionCount, EntryCount and ContentionCount fields are all
incremented by one, and OwningThread becomes the thread ID of the caller. EntryCount and ContentionCount are not incremented. For example:
0:000> !critsec 433e60
CritSec mymodule!cs+0 at 00433E60
LockCount
0
RecursionCount
1
OwningThread
4d0
EntryCount
0
ContentionCount
0
At this point, four different things can happen.
1. The owning thread calls EnterCriticalSection again. This will increment LockCount and RecursionCount. EntryCount is not incremented.
0:000> !critsec 433e60
CritSec mymodule!cs+0 at 00433E60
LockCount
1
RecursionCount
2
OwningThread
4d0
EntryCount
0
ContentionCount
0
2. A different thread calls EnterCriticalSection. This will increment LockCount and EntryCount. RecursionCount is not incremented.
0:000> !critsec 433e60
CritSec mymodule!cs+0 at 00433E60
LockCount
1
RecursionCount
1
OwningThread
4d0
EntryCount
1
ContentionCount
1
3. The owning thread calls LeaveCriticalSection. This will decrement LockCount (to -1) and RecursionCount (to 0), and will reset OwningThread to 0.
0:000> !critsec 433e60
CritSec mymodule!cs+0 at 00433E60
LockCount
NOT LOCKED
RecursionCount
0
OwningThread
0
EntryCount
0
ContentionCount
0
4. Another thread calls LeaveCriticalSection. This produces the same results as the owning thread calling LeaveCriticalSection it will decrement LockCount (to -1)
and RecursionCount (to 0), and will reset OwningThread to 0.
When any thread calls LeaveCriticalSection, Windows decrements LockCount and RecursionCount. This feature has both good and bad aspects. It allows a device driver
to enter a critical section on one thread and leave the critical section on another thread. However, it also makes it possible to accidentally call LeaveCriticalSection on the
wrong thread, or to call LeaveCriticalSection too many times and cause LockCount to reach values lower than -1. This corrupts the critical section and causes all threads to
wait indefinitely on the critical section.
Interpreting Critical Section Fields in Windows Server 2003 SP1 and Later
In Microsoft Windows Server 2003 Service Pack 1 and later versions of Windows, the LockCount field is parsed as follows:
The lowest bit shows the lock status. If this bit is 0, the critical section is locked; if it is 1, the critical section is not locked.
The next bit shows whether a thread has been woken for this lock. If this bit is 0, then a thread has been woken for this lock; if it is 1, no thread has been woken.
The remaining bits are the ones-complement of the number of threads waiting for the lock.
As an example, suppose the LockCount is -22. The lowest bit can be determined in this way:
0:009> ? 0x1 & (-0n22)
Evaluate expression: 0 = 00000000
The next-lowest bit can be determined in this way:
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
To break into a debugger from a user-mode program, use the DebugBreak routine. For complete documentation of this routine, see the Microsoft Windows SDK.
When a user-mode program calls DebugBreak, the following possible actions will occur:
1. If a user-mode debugger is attached, the program will break into the debugger. This means that the program will pause and the debugger will become active.
2. If no user-mode debugger is attached, but kernel-mode debugging was enabled at boot time, the entire computer will break into the kernel debugger. If no kernel
debugger is attached, the computer will freeze and await a kernel debugger.
3. If no user-mode debugger is attached, and kernel-mode debugging is not enabled, the program will terminate with an unhandled exception, and the post-mortem (justin-time) debugger will be activated. By default, the postmortem debugger is Dr. Watson, which will create a crash dump file and then ask you if you want to send this
crash dump file to Microsoft.
Kernel-Mode Break Routines
When a kernel-mode program breaks into the debugger, the entire operating system freezes until the kernel debugger allows execution to resume. If no kernel debugger is
present, this is treated as a bug check.
The DbgBreakPoint routine works in kernel-mode code, but is otherwise similar to the DebugBreak user-mode routine.
DbgBreakPointWithStatus also causes a break, but it additionally sends a 32-bit status code to the debugger.
KdBreakPoint and KdBreakPointWithStatus are identical to DbgBreakPoint and DbgBreakPointWithStatus, respectively, when compiled in the checked build
environment. When compiled in the free build environment, they have no effect.
For complete documentation of these routines, as well as the build environment, see the Windows Driver Kit.
Kernel-Mode Conditional Break Routines
Two conditional break routines are available for kernel-mode code. These routines test a logical expression. If the expression is false, execution halts and the debugger
becomes active.
The ASSERT macro causes the debugger to display the failed expression and its location in the program. The ASSERTMSG macro is similar, but allows an additional
message to be sent to the debugger.
ASSERT and ASSERTMSG are only active when compiled in the checked build environment. When compiled in the free build environment, they have no effect.
For complete documentation of these routines, as well as the build environment, see the Windows Driver Kit.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
you to filter out messages that you are not interested in.
Note In Windows Server 2003 and earlier versions of Windows, DbgPrint and KdPrint send messages to the kernel debugger unconditionally. In Windows Vista and later
versions of Windows, these routines send messages conditionally, like DbgPrintEx and KdPrintEx. Whichever version of Windows you are using, it is recommended that
you use DbgPrintEx and KdPrintEx, since these allow you to control the conditions under which the message will be sent.
For complete documentation of these routines, see the Windows Driver Kit.
The basic procedure is as follows:
To filter debugging messages
1. For each message you wish to send to the debugger, use the function DbgPrintEx or KdPrintEx in your driver's code. Pass the appropriate component name to the
ComponentId parameter, and pass a value to the Level parameter that reflects the severity or nature of this message. The message itself is passed to the Format and
arguments parameters as with printf.
2. Set the value of the appropriate component filter mask. Each component has a different mask; the mask value indicates which of that component's messages will be
displayed. The component filter mask may be set in the registry using a registry editor, or in memory using a kernel debugger.
3. Attach a kernel debugger to the computer. Each time your driver passes a message to DbgPrintEx or KdPrintEx, the values passed to ComponentId and Level will be
compared with the value of the corresponding component filter mask. If these values satisfy certain criteria, the message will be sent to the kernel debugger and
displayed. Otherwise, no message will be sent.
Full details follow. All references on this page to DbgPrintEx apply equally to KdPrintEx.
Identifying the Component Name
Each component has a separate filter mask. This allows the debugger to configure the filter for each component separately.
Each component is referred to in different ways, depending on the context. In the ComponentId parameter of DbgPrintEx, the component name is prefixed with "DPFLTR_"
and suffixed with "_ID". In the registry, the component filter mask has the same name as the component itself. In the debugger, the component filter mask is prefixed with
"Kd_" and suffixed with "_Mask".
There is a complete list of all component names (in DPFLTR_XXXX_ID format) in the Microsoft Windows Driver Kit (WDK) header ntddk.h and the Windows SDK header
ntrtl.h. Most of these component names are reserved for Windows and for drivers written by Microsoft.
There are six component names reserved for independent hardware vendors. To avoid mixing your driver's output with the output of Windows components, you should use
one of the following component names:
Component name
Driver type
IHVVIDEO
Video driver
IHVAUDIO
Audio driver
IHVNETWORK Network driver
IHVSTREAMING Kernel streaming driver
IHVBUS
Bus driver
IHVDRIVER
Any other type of driver
For example, if you are writing a video driver, you would use DPFLTR_IHVVIDEO_ID as the ComponentId parameter of DbgPrintEx, use the value name IHVVIDEO in
the registry, and refer to Kd_IHVVIDEO_Mask in the debugger.
In Windows Vista and later versions of Windows, all messages sent by DbgPrint and KdPrint are associated with the DEFAULT component.
Choosing the Correct Level
The Level parameter of the DbgPrintEx routine is of type DWORD. It is used to determine the importance bit field. The connection between the Level parameter and this bit
field depends on the size of Level:
If Level is equal to a number between 0 and 31, inclusive, it is interpreted as a bit shift. The importance bit field is set to the value 1 << Level. Thus choosing a value
between 0 and 31 for Level results in a bit field with exactly one bit set. If Level is 0, the bit field is equivalent to 0x00000001;if Level is 31, the bit field is equivalent to
0x80000000.
If Level is a number between 32 and 0xFFFFFFFF inclusive, the importance bit field is set to the value of Level itself.
Thus, if you wish to set the bit field to 0x00004000, you can specify Level as 0x00004000 or simply as 14. Note that certain bit field values are not possible by this system
including a bit field which is entirely zero.
The following constants can be useful for setting the value of Level. They are defined in the Microsoft Windows Driver Kit (WDK) header ntddk.h and the Windows SDK
header ntrtl.h:
#define
#define
#define
#define
#define
DPFLTR_ERROR_LEVEL
0
DPFLTR_WARNING_LEVEL
1
DPFLTR_TRACE_LEVEL
2
DPFLTR_INFO_LEVEL
3
DPFLTR_MASK
0x8000000
One easy way to use the Level parameter is to always use values between 0 and 31 using the bits 0, 1, 2, 3 with the meaning given by DPFLTR_XXXX_LEVEL, and using
the other bits to mean whatever you choose.
Another easy way to use the Level parameter is to always use explicit bit fields. If you choose this method, you may wish to OR the value DPFLTR_MASK with your bit
field; this assures that you will not accidentally use a value less than 32.
To make your driver compatible with the way Windows uses message levels, you should only set the lowest bit (0x1) of the importance bit field if a serious error occurs. If
you are using Level values less than 32, this corresponds to DPFLTR_ERROR_LEVEL. If this bit is set, your message is going to be viewed any time someone attaches a
kernel debugger to a computer on which your driver is running.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The warning, trace, and information levels should be used in the appropriate situations. Other bits can be freely used for any purposes that you find useful. This allows you to
have a wide variety of message types that can be selectively seen or hidden.
In Windows Vista and later versions of Windows, all messages sent by DbgPrint and KdPrint behave like DbgPrintEx and KdPrintEx messages with Level equal to
DPFLTR_INFO_LEVEL. In other words, these messages have the third bit of their importance bit field set.
Setting the Component Filter Mask
There are two ways to set a component filter mask:
Filter masks stored in the registry take effect during boot. Filter masks created by the debugger take effect immediately, and persist until Windows is rebooted. A value set in
the registry can be overridden by the debugger, but the component filter mask will return to the value specified in the registry if the system is rebooted.
There is also a system-wide mask called WIN2000. This is equal to 0x1 by default, though it can be changed through the registry or the debugger like all other components.
When filtering is performed, each component filter mask is first ORed with the WIN2000 mask. In particular, this means that components whose masks have never been
specified default to 0x1.
Criteria for Displaying the Message
When DbgPrintEx is called in kernel-mode code, Windows compares the message importance bit field specified by Level with the filter mask of the component specified by
ComponentId.
Note Recall that when the Level parameter is between 0 and 31, the importance bit field is equal to 1 << Level, but when the Level parameter is 32 or higher, the importance
bit field is simply equal to Level.
Windows performs an AND operation on the importance bit field and the component filter mask. If the result is nonzero, the message is sent to the debugger.
Example
Here is an example.
Suppose that before the last boot, you created the following values in the Debug Print Filter key:
DPFLTR_INFO_LEVEL,
7,
DPFLTR_MASK | 0x10,
"First message.\n");
"Second message.\n");
"Third message.\n");
The first message has its Level parameter equal to DPFLTR_INFO_LEVEL, which is 3. Since this is less than 32, it is treated as a bit shift, resulting in an importance bit field
of 0x8. This value is then ANDed with the effective IHVVIDEO component filter mask of 0x9, giving a nonzero result. So the first message is transmitted to the debugger.
The second message has its Level parameter equal to 7. Again, this is treated as a bit shift, resulting in an importance bit field of 0x80. This is then ANDed with the
IHVAUDIO component filter mask of 0x7, giving a result of zero. So the second message is not transmitted.
The third message has its Level parameter equal to DPFLTR_MASK | 0x10. This is greater than 31, and therefore the importance bit field is set equal to the value of Level
in other words, to 0x80000010. This is then ANDed with the IHVBUS component filter mask of 0x7FF, giving a nonzero result. So the third message is transmitted to the
debugger.
The fourth message was passed to DbgPrint instead of DbgPrintEx. In Windows Server 2003 and earlier versions of Windows, messages passed to this routine are always
transmitted. In Windows Vista and later versions of Windows, messages passed to this routine are always given a default filter. The importance bit field is equal to
1 << DPFLTR_INFO_LEVEL, which is 0x00000008. The component for this routine is DEFAULT. Since you have not set the DEFAULT component filter mask, it has a
value of 0x1. When this is ANDed with the importance bit field, the result is zero. So the fourth message is not transmitted.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
command.
Any single call to DbgPrint, DbgPrintEx, KdPrint, or KdPrintEx will only transmit 512 bytes of information. Any output longer than this will be lost. The DbgPrint buffer
itself can hold up to 4 KB of data on a free build of Windows, and up to 32 KB of data on a checked build of Windows. On Windows Server 2003 and later versions of
Windows, you can use the KDbgCtrl tool to alter the size of the DbgPrint buffer. See Using KDbgCtrl for details.
If a message is filtered out because of its ComponentId and Level values, it is not transmitted across the debugging connection. Therefore there is no way to display this
message in the debugger.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
(Windows XP and later) The KD_DEBUGGER_ENABLED global kernel variable indicates whether kernel debugging is enabled.
(Windows XP and later) The KD_DEBUGGER_NOT_PRESENT global kernel variable indicates whether a kernel debugger is currently attached.
(Windows Server 2003 and later) The KdRefreshDebuggerNotPresent routine refreshes the value of KD_DEBUGGER_NOT_PRESENT.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
If you recently added hardware to the system, try removing or replacing it. Or check with the manufacturer to see if any patches are available.
You can try running the hardware diagnostics supplied by the system manufacturer.
Check with the manufacturer to see if an updated system BIOS or firmware is available.
Make sure that any expansion board is properly seated and all cables are completely connected.
Confirm that any new hardware is listed in the Microsoft Windows Marketplace Tested Products List.
If new device drivers or system services have been added recently, try removing or updating them.
Important Use Safe Mode when removing or disabling components. Using Safe Mode loads only the minimum required drivers and system services during the
Windows startup. To enter Safe Mode, restart your computer, and press F8 at the character-mode menu that displays the operating system choices. At the resulting
Windows Advanced Options menu, choose Safe Mode.
Run a virus detection program. Viruses can infect all types of hard disks formatted for Windows, and resulting disk corruption can generate system bug check codes.
Make sure the virus detection program checks the Master Boot Record for infections.
Verify that the system has the latest Service Pack installed. To detect which Service Pack, if any, is installed on your system, click Start, click Run, type winver, and
then press ENTER. The About Windows dialog box displays the Windows version number and the version number of the Service Pack, if one has been installed.
Disable BIOS memory options such as caching or shadowing.
Check the System Log and Application Log in Event Viewer to see if any additional error messages have been logged recently. These might pinpoint the cause of the
error.
Kernel debugging is especially useful when other troubleshooting techniques fail, or for a recurring problem. Remember to capture the exact text in the bug check information
section of the error message. To isolate a complex problem and develop a viable workaround or a program replacement, you must record the exact actions that lead to the
failure.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
This section contains descriptions of the common bug checks, including the parameters passed to the blue screen.
It also describes how you can diagnose the fault which led to the bug check, and possible ways to deal with the error.
If a specific bug check code does not appear in this reference, use the !analyze extension command (in kernel mode) with the following syntax:
kd> !analyze -show Code
This will display information about the specified bug check code. If your default radix is not 16, you should prefix Code with "0x".
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
3
4
Cause
The most common cause of this bug check is when a file system has a mismatched sequence of KeEnterCriticalRegion calls and KeLeaveCriticalRegion calls.
Comments
This is a kernel internal error which can occur only on a checked build. This error occurs on exit from a system call.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Cause
This bug check is issued if paged memory (or invalid memory) is accessed when the IRQL is too high.
The error that generates this bug check usually occurs after the installation of a faulty device driver, system service, or BIOS.
If you encounter bug check 0xA while upgrading to a later version of Windows, this error might be caused by a device driver, a system service, a virus scanner, or a backup
tool that is incompatible with the new version.
Resolving the Problem
If a kernel debugger is available, obtain a stack trace.
To resolve an error caused by a faulty device driver, system service, or BIOS
1. Restart your computer.
2. Press F8 at the character-based menu that displays the operating system choices.
3. Select the Last Known Good Configuration option from the Windows Advanced Options menu. This option is most effective when only one driver or service is
added at a time.
To resolve an error caused by an incompatible device driver, system service, virus scanner, or backup tool
1. Check the System Log in Event Viewer for error messages that might identify the device or driver that caused the error.
2. Try disabling memory caching of the BIOS.
3. Run the hardware diagnostics supplied by the system manufacturer, especially the memory scanner. For details on these procedures, see the owner's manual for your
computer.
4. Make sure the latest Service Pack is installed.
5. If your system has small computer system interface (SCSI) adapters, contact the adapter manufacturer to obtain updated Windows drivers. Try disabling sync
negotiation in the SCSI BIOS, checking the cabling and the SCSI IDs of each device, and confirming proper termination.
6. For integrated device electronics (IDE) devices, define the onboard IDE port as Primary only. Also, check each IDE device for the proper master/subordinate/standalone setting. Try removing all IDE devices except for hard disks.
If the message appears during an installation of Windows, make sure that the computer and all installed peripherals are listed in the Microsoft Windows Marketplace Tested
Products List.
Here is a debugging example:
kd> .bugcheck
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
NT!_DbgBreakPoint
NT!_KeBugCheckEx+0x194
NT!_KiTrap0E+0x256
kd> kv
ChildEBP
8013ed5c
8013eecc
8013eecc
8013ed5c
8013ef64
NT!_KeBugCheckEx+0x194
NT!_KeBugCheckEx+0x194
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The BAD_POOL_HEADER bug check has a value of 0x00000019. This indicates that a pool header is corrupt.
Parameters
The following parameters are displayed on the blue screen. Parameter 1 indicates the type of violation. The meaning of the other parameters depends on the value of
Parameter 1.
Parameter
Parameter 2
1
0x2
The pool entry being
checked
Parameter 3
The size of the pool
block
Parameter 4
0
Cause of Error
The special pool pattern check failed.
(The owner has likely corrupted the pool block.)
0x3
0x5
Reserved
0x6
One incorrectly-calculated
entry
0
0
One incorrectly-calculated
entry
The pool entry that should
have been found
The pool entry that should
have been found
Reserved
Reserved
Reserved
Reserved
Reserved
0x7
0x8
0x9
0xA
0x20
Cause
The pool is already corrupted at the time of the current request.
This may or may not be due to the caller.
Resolving the Problem
The internal pool links must be walked to figure out a possible cause of the problem.
Then you can use special pool for the suspect pool tags, or use Driver Verifier on the suspect driver. The !analyze extension may be of help in pinpointing the suspect driver,
but this is frequently not the case with pool corrupters.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
0x1010
0x1234
0x1235
0x3451
0x8888
0x8889
0x41283
0x41284
Cause of Error
The fork clone block reference count is corrupt. (This only occurs on checked builds of Windows.)
The caller is unlocking a system cache address that is not currently locked. (This address was either never mapped or is being unlocked twice.)
The system is using the very last system cache view address, instead of preserving it.
The PTEs mapping the argument system cache view have been corrupted.
A caller of MmGetSystemAddressForMdl* tried to map a fully-cached physical page as non-cached. This action would cause a conflicting hardware
translation buffer entry, and so it was refused by the operating system. Since the caller specified "bug check on failure" in the requesting MDL, the system had
no choice but to issue a bug check in this instance.
The caller is unlocking a pageable section that is not currently locked. (This section was either never locked or is being unlocked twice.)
The caller is trying lock a nonexistent pageable section.
The caller is trying to protect an MDL with an invalid mapping.
The PTEs of a kernel thread stack that has been swapped out are corrupted.
Internal memory management structures are corrupted.
The working set index encoded in the PTE is corrupted.
A PTE or the working set list is corrupted.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
0x41286
0x41785
0x41287
0x61940
0x03030303
Other
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
0x80000002: STATUS_DATATYPE_MISALIGNMENT
An unaligned data reference was encountered.
0x80000003: STATUS_BREAKPOINT
A breakpoint or ASSERT was encountered when no kernel debugger was attached to the system.
0xC0000005: STATUS_ACCESS_VIOLATION
A memory access violation occurred. (Parameter 4 of the bug check is the address that the driver attempted to access.)
For a complete list of exception codes, see the ntstatus.h file located in the inc directory of the Windows Driver Kit.
Resolving the Problem
If you are not equipped to debug this problem, you should use some basic troubleshooting techniques. If a driver is identified in the bug check message, disable the driver or
check with the manufacturer for driver updates. Try changing video adapters. Check with your hardware vendor for any BIOS updates. Disable BIOS memory options such as
caching or shadowing.
If you plan to debug this problem, you may find it difficult to obtain a stack trace. Parameter 2 (the exception address) should pinpoint the driver or function that caused this
problem.
If exception code 0x80000003 occurs, this indicates that a hard-coded breakpoint or assertion was hit, but the system was started with the /NODEBUG switch. This problem
should rarely occur. If it occurs repeatedly, make sure a kernel debugger is connected and the system is started with the /DEBUG switch.
If exception code 0x80000002 occurs, the trap frame will supply additional information.
If the specific cause of the exception is unknown, the following should be considered:
Hardware incompatibility. First, make sure that any new hardware installed is listed in the Microsoft Windows Marketplace Tested Products List.
Faulty device driver or system service. In addition, a faulty device driver or system service might be responsible for this error. Hardware issues, such as BIOS
incompatibilities, memory conflicts, and IRQ conflicts can also generate this error.
If a driver is listed by name within the bug check message, disable or remove that driver. Disable or remove any drivers or services that were recently added. If the error
occurs during the startup sequence and the system partition is formatted with NTFS file system, you might be able to use Safe Mode to rename or delete the faulty driver. If
the driver is used as part of the system startup process in Safe Mode, you need to start the computer by using the Recovery Console to access the file.
If the problem is associated with Win32k.sys, the source of the error might be a third-party remote control program. If such software is installed, the service can be removed by
starting the system using the Recovery Console and deleting the offending system service file.
Check the System Log in Event Viewer for additional error messages that might help pinpoint the device or driver that is causing bug check 0x1E. Disabling memory caching
of the BIOS might also resolve the error. You should also run hardware diagnostics, especially the memory scanner, supplied by the system manufacturer. For details on these
procedures, see the owner's manual for your computer.
The error that generates this message can occur after the first restart during Windows Setup, or after Setup is finished. A possible cause of the error is a system BIOS
incompatibility. BIOS problems can be resolved by upgrading the system BIOS version.
To get a stack trace if the normal stack tracing procedures fail
1. Use the kb (Display Stack Backtrace) command to display parameters in the stack trace. Look for the call to NT!PspUnhandledExceptionInSystemThread. (If this
function is not listed, see the note below.)
2. The first parameter to NT!PspUnhandledExceptionInSystemThread is a pointer to a structure, which contains pointers to an except statement:
typedef struct _EXCEPTION_POINTERS {
PEXCEPTION_RECORD ExceptionRecord;
PCONTEXT ContextRecord;
} EXCEPTION_POINTERS, *PEXCEPTION_POINTERS;
ULONG PspUnhandledExceptionInSystemThread(
IN PEXCEPTION_POINTERS ExceptionPointers
)
Use the dd (Display Memory) command on that address to display the necessary data.
3. The first retrieved value is an exception record and the second is a context record. Use the .exr (Display Exception Record) command and the .cxr (Display Context
Record) command with these two values as their arguments, respectively.
4. After the .cxr command executes, use the kb command to display a stack trace that is based on the context record information. This stack trace indicates the calling
stack where the unhandled exception occurred.
Note This procedure assumes that you can locate NT!PspUnhandledExceptionInSystemThread. However, in some cases (such as an access violation crash) you will not
be able to do this. In that case, look for ntoskrnl!KiDispatchException. The third parameter passed to this function is a trap frame address. Use the .trap (Display Trap
Frame) command with this address to set the Register Context to the proper value. You can then perform stack traces and issue other commands.
Here is an example of bug check 0x1E on an x86 processor:
kd> .bugcheck
get the bug check data
Bugcheck code 0000001e
Arguments c0000005 8013cd0a 00000000 0362cffff
kd> kb
FramePtr
RetAddr
Param1
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
8013ed5c
8013eecc
fe40cad0
fe40cad8
fe40cf7c
00000000
801263ba
8013313c
8013318e
801359ff
8013cb8e
00000000
00000000
0000001e
fe40caf8
fe40cb00
fe43a44c
00000000
00000000
c0000005
801359ff
00000000
ff6ce388
00000000
fe40cb00
8013cd0a
fe40cb00
fe40cb00
00000000
00000000
NT!_DbgBreakPoint
NT!_KeBugCheckEx+0x194
NT!PspUnhandledExceptionInSystemThread+0x18
NT!PspSystemThreadStartup+0x4a
NT!_except_handler3+0x47
NT!KiThreadStartup+0xe
kd> dd fe40caf8 L2
dump EXCEPTION_POINTERS structure
0xFE40CAF8 fe40cd88 fe40cbc4
..@...@.
kd> .exr fe40cd88
Exception Record @ FE40CD88:
ExceptionCode: c0000005
ExceptionFlags: 00000000
Chained Record: 00000000
ExceptionAddress: 8013cd0a
NumberParameters: 00000002
Parameter[0]: 00000000
Parameter[1]: 0362cfff
RetAddr
80402e09
80403c18
fe43b1e4
fe4385b4
fe439894
fe437d92
fe43a4f5
80133184
8013cb8e
kb gives stack
Args to Child
ff6c4000 ff63d000 03ff0000
ffbc0c28 ff6ce008 ff6c4000
ff6cef90 ffbc0c28 ff6ce009
ff6ce388 6cd00800 ffbc0c28
ff6cd008 ffb6c820 fe40cf4c
ff6cd008 ffb6c820 ff6e4e50
ff6cd008 ffb6c820 00000000
ff6ce388 00000000 00000000
fe43a44c ff6ce388 00000000
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The APC disable count is decremented each time a driver calls KeEnterCriticalRegion, FsRtlEnterFileSystem, or acquires a mutex.
The APC disable count is incremented each time a driver calls KeLeaveCriticalRegion, KeReleaseMutex, or FsRtlExitFileSystem.
Because these calls should always be in pairs, the APC disable count should be zero when a thread exits. A negative value indicates that a driver has disabled APC calls
without re-enabling them. A positive value indicates that the reverse is true.
If you ever see this error, be very suspicious of all drivers installed on the machine especially unusual or non-standard drivers.
This current IRQL (Parameter 3) should be zero. If it is not, the driver's cancellation routine may have caused this bug check by returning at an elevated IRQL. In this case,
carefully note what was running (and what was closing) at the time of the crash, and note all of the installed drivers at the time of the crash. The cause in this case is usually a
severe bug in a driver.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Another possible cause is depletion of nonpaged pool memory. If the nonpaged pool memory is completely depleted, this error can stop the system. However, during the
indexing process, if the amount of available nonpaged pool memory is very low, another kernel-mode driver requiring nonpaged pool memory can also trigger this error.
Resolving the Problem
To debug this problem: Use the .cxr (Display Context Record) command with Parameter 3, and then use kb (Display Stack Backtrace).
To resolve a disk corruption problem: Check Event Viewer for error messages from SCSI and FASTFAT (System Log) or Autochk (Application Log) that might help
pinpoint the device or driver that is causing the error. Try disabling any virus scanners, backup programs, or disk defragmenter tools that continually monitor the system. You
should also run hardware diagnostics supplied by the system manufacturer. For details on these procedures, see the owner's manual for your computer. Run Chkdsk /f /r to
detect and resolve any file system structural corruption. You must restart the system before the disk scan begins on a system partition.
To resolve a nonpaged pool memory depletion problem: Add new physical memory to the computer. This will increase the quantity of nonpaged pool memory available to the
kernel.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
3
4
Reserved
Reserved
Cause
One possible cause of this bug check is depletion of nonpaged pool memory. If the nonpaged pool memory is completely depleted, this error can stop the system. However,
during the indexing process, if the amount of available nonpaged pool memory is very low, another kernel-mode driver requiring nonpaged pool memory can also trigger this
error.
Resolving the Problem
To resolve a nonpaged pool memory depletion problem: Add new physical memory to the computer. This will increase the quantity of nonpaged pool memory available to the
kernel.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
0xC10E0000 RDBSS_BUG_CHECK_CLOSE
0xBAAD0000 RDBSS_BUG_CHECK_NTEXCEPT
2
3
4
If RxExceptionFilter is on the stack, this parameter specifies the address of the exception record.
If RxExceptionFilter is on the stack, this parameter specifies the address of the context record.
Reserved
Cause
One possible cause of this bug check is depletion of nonpaged pool memory. If the nonpaged pool memory is completely depleted, this error can stop the system. However,
during the indexing process, if the amount of available nonpaged pool memory is very low, another kernel-mode driver requiring nonpaged pool memory can also trigger this
error.
Resolving the Problem
To debug this problem: Use the .cxr (Display Context Record) command with Parameter 3, and then use kb (Display Stack Backtrace).
To resolve a nonpaged pool memory depletion problem: Add new physical memory to the computer. This will increase the quantity of nonpaged pool memory available to the
kernel.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Comments
This bug check code is not currently being used in the system, but exists for debugging purposes.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
3
4
Cause
This error is almost always caused by a hardware problem a configuration issue, defective hardware, or incompatible hardware.
The most common hardware problems that can cause this error are defective RAM, Level 2 (L2) RAM cache errors, or video RAM errors. Hard disk corruption can also cause
this error.
This bug check can also be caused when a device driver attempts to access an address in the 0x8xxxxxxx range that does not exist (in other words, that does not have a physical
address mapping).
Resolving the Problem
Resolving a hardware problem: If hardware has recently been added to the system, remove it to see if the error recurs.
If existing hardware has failed, remove or replace the faulty component. You should run hardware diagnostics supplied by the system manufacturer to determine which
hardware component has failed. For details on these procedures, see the owner's manual for your computer. Check that all adapter cards in the computer are properly seated.
Use an ink eraser or an electrical contact treatment, available at electronics supply stores, to ensure that adapter card contacts are clean.
If the problem occurs on a newly installed system, check the availability of updates for the BIOS, the SCSI controller or network cards. Updates of this kind are typically
available on the Web site or the bulletin board system (BBS) of the hardware manufacturer.
If the error occurs after installing a new or updated device driver, the driver should be removed or replaced. If, under this circumstance, the error occurs during startup and the
system partition is formatted with NTFS, you might be able to use Safe Mode to rename or delete the faulty driver.
If the driver is used as part of the system startup process in Safe Mode, you need to start the computer using the Recovery Console in order to access the file.
For additional error messages that might help pinpoint the device or driver that is causing the error, check the System Log in Event Viewer. Disabling memory caching or
shadowing in the BIOS might also resolve this error. In addition, check the system for viruses, using any up-to-date commercial virus scanning software that examines the
Master Boot Record of the hard disk. All Windows file systems can be infected by viruses.
Resolving a hard disk corruption problem: Run Chkdsk /f /r on the system partition. You must restart the system before the disk scan begins. If you cannot start the system
due to the error, use the Recovery Console and run Chkdsk /r.
Warning If your system partition is formatted with the file allocation table (FAT) file system, the long filenames used by Windows can be damaged if Scandisk or another
Microsoft MS-DOS-based hard disk tool is used to verify the integrity of your hard disk from MS-DOS. Always use the version of Chkdsk that matches your Windows
version.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
If this error were not caught, it would cause the kernel to run with a stack pointer pointing to stack which is no longer valid.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Parameter
Description
1
Specifies source file and line number information. The high 16 bits (the first four hexadecimal digits after the "0x") identify the source file by its identifier
number. The low 16 bits identify the source line in the file where the bug check occurred.
2
Reserved
3
Reserved
4
Reserved
Cause
One possible cause of this bug check is depletion of nonpaged pool memory. If the nonpaged pool memory is completely depleted, this error can stop the system. However,
during the indexing process, if the amount of available nonpaged pool memory is very low, another kernel-mode driver requiring nonpaged pool memory can also trigger this
error.
Resolving the Problem
To resolve a nonpaged pool memory depletion problem: Add new physical memory to the computer. This will increase the quantity of nonpaged pool memory available to the
kernel.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
In order to be symmetric, all processors must be of the same type and level. This system contains processors of different types (for example, a Pentium processor and an
80486 processor).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Cause
In almost all cases, the system is not actually out of PTEs. Rather, a driver has requested a large block of memory, but there is no contiguous block of sufficient size to satisfy
this request.
Often video drivers will allocate large amounts of kernel memory that must succeed. Some backup programs do the same.
Resolving the Problem
A possible work-around: Modify the registry to increase the total number of system PTEs. If this does not help, remove any recently-installed software, especially backup
utilities or disk-intensive applications.
Debugging the problem: The following method can be used to debug bug check 0x3F.
First, get a stack trace, and use the !sysptes 3 extension command.
Then set HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\TrackPtes equal to DWORD 1, and reboot. This
will cause the system to save stack traces.
This allows you to display more detailed information about the PTE owners. For example:
0: kd> !sysptes 4
0x2c47 System PTEs allocated to mapping locked pages
VA
f0e5db48
f0c3fe48
f0db38e8
f8312568
f8363908
f0c54248
f0ddf448
f150bc08
f1392308
eb1bee64
f139b5a8
eb41f400
eb41f198
eb41f1e4
......
MDL
PageCount
eb6ceef0
1
eb634bf0
1
eb65b880
1
eb6df880
1
eb685880
1
eb640880
1
eb5f3160
1
eb6367b0
1
eb6fba70
1
edac5000
200
edd4b000
12
ede92000
20
edf2a000
20
eb110000
10
Caller/CallersCaller
ntkrpamp!MmMapLockedPages+0x15/ntkrpamp!IopfCallDriver+0x35
netbt!NbtTdiAssociateConnection+0x1f/netbt!DelayedNbtProcessConnect+0x17c
mrxsmb!SmbMmAllocateSessionEntry+0x89/mrxsmb!SmbCepInitializeExchange+0xda
rdbss!RxCreateFromNetRoot+0x3d7/rdbss!RxCreateFromNetRoot+0x93
mrxsmb!SmbMmAllocateSessionEntry+0x89/mrxsmb!SmbCepInitializeExchange+0xda
rdbss!RxCreateFromNetRoot+0x3d7/rdbss!RxCreateFromNetRoot+0x93
mrxsmb!MrxSmbUnalignedDirEntryCopyTail+0x387/mrxsmb!MRxSmbCoreInformation+0x36
mrxsmb!MrxSmbUnalignedDirEntryCopyTail+0x387/mrxsmb!MRxSmbCoreInformation+0x36
netbt!NbtTdiOpenAddress+0x1fb/netbt!DelayedNbtProcessConnect+0x17c
VIDEOPRT!pVideoPortGetDeviceBase+0x118/VIDEOPRT!VideoPortMapMemory+0x45
rdbss!FsRtlCopyWrite2+0x34/rdbss!RxDriverEntry+0x149
VIDEOPRT!pVideoPortGetDeviceBase+0x139/VIDEOPRT!VideoPortGetDeviceBase+0x1b
NDIS!NdisReadNetworkAddress+0x3a/NDIS!NdisFreeSharedMemory+0x58
VIDEOPRT!pVideoPortGetDeviceBase+0x139/VIDEOPRT!VideoPortGetDeviceBase+0x1b
If the system runs out of PTEs again after the TrackPtes registry value has been set, bug check 0xD8 (DRIVER_USED_EXCESSIVE_PTES) will be issued instead of 0x3F.
The name of the driver causing this error will be displayed as well.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Windows XP and later: The most recent modified write error status.
Cause
To see general memory statistics, use the !vm 3 extension.
This bug check can occur for any of the following reasons:
A driver has blocked, deadlocking the modified or mapped page writers. Examples of this include mutex deadlocks or accesses to paged out memory in file system
drivers or filter drivers. This indicates a driver bug.
If Parameter 1 or Parameter 2 is large, then this is a possibility. Use !vm 3.
A storage driver is not processing requests. Examples of this are stranded queues and non-responding drives. This indicates a driver bug.
If Parameter 1 or Parameter 2 is large, then this is a possibility. Use !vm 8, followed by !process 0 7.
A high-priority realtime thread has starved the balance set manager from trimming pages from the working set, or starved the modified page writer from writing them
out. This indicates a bug in the component that created this thread.
This situation is difficult to analyze. Try using !ready. Try also !process 0 7 to list all threads and see if any have accumulated excessive kernel time as well as what
their current priorities are. Such processes may have blocked out the memory management threads from making pages available.
Windows XP and Windows 2000: Not enough pool is available for the storage stack to write out modified pages. This indicates a driver bug.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Windows 2000: All the processes have been trimmed to their minimums and all modified pages written, but still no memory is available. The freed memory must be
stuck in transition pages with non-zero reference counts thus they cannot be put on the freelist.
A driver is neglecting to unlock the pages preventing the reference counts from going to zero which would free the pages. This may be due to transfers that never finish,
causing the driver routines to run endlessly, or to other driver bugs.
If Parameter 4 is large, then this is a possibility. But it is very hard to find the driver. Try the !process 0 1 extension and look for any drivers that have a lot of locked
pages.
If the problem cannot be found, then try booting with a kernel debugger attached from the beginning, and monitor the situation.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
0x8F
0x99
0x9A
Parameter 3
Parameter 4
Cause of Error
0
0
The reference count of the entry that is
being removed
Cause
This error is typically caused by a driver passing a bad memory descriptor list. For example, the driver might have called MmUnlockPages twice with the same list.
If a kernel debugger is available, examine the stack trace.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Parameter
Description
1
Memory address referenced
2
0: Read operation
1: Write operation
3
4
If the driver responsible for the error can be identified, its name is printed on the blue screen and stored in memory at the location (PUNICODE_STRING)
KiBugCheckDriver.
Cause
Bug check 0x50 usually occurs after the installation of faulty hardware or in the event of failure of installed hardware (usually related to defective RAM, be it main memory,
L2 RAM cache, or video RAM).
Another common cause is the installation of a faulty system service.
Antivirus software can also trigger this error, as can a corrupted NTFS volume.
Resolving the Problem
Resolving a faulty hardware problem: If hardware has been added to the system recently, remove it to see if the error recurs. If existing hardware has failed, remove or replace
the faulty component. You should run hardware diagnostics supplied by the system manufacturer. For details on these procedures, see the owner's manual for your computer.
Resolving a faulty system service problem: Disable the service and confirm that this resolves the error. If so, contact the manufacturer of the system service about a possible
update. If the error occurs during system startup, restart your computer, and press F8 at the character-mode menu that displays the operating system choices. At the resulting
Windows Advanced Options menu, choose the Last Known Good Configuration option. This option is most effective when only one driver or service is added at a time.
Resolving an antivirus software problem: Disable the program and confirm that this resolves the error. If it does, contact the manufacturer of the program about a possible
update.
Resolving a corrupted NTFS volume problem: Run Chkdsk /f /r to detect and repair disk errors. You must restart the system before the disk scan begins on a system partition.
If the hard disk is SCSI, check for problems between the SCSI controller and the disk.
Finally, check the System Log in Event Viewer for additional error messages that might help pinpoint the device or driver that is causing the error. Disabling memory caching
of the BIOS might also resolve it.
Comments
Typically, this address is in freed memory or is simply invalid.
This cannot be protected by a try - except handler it can only be protected by a probe.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
2
3
4
0
0
0
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Parameters
The following parameters appear on the blue screen.
Parameter
Description
1
Reserved
2
Reserved
3
Reserved
4
The NT status code (if it is available)
Cause
The BAD_SYSTEM_CONFIG_INFO bug check occurs if the SYSTEM hive is corrupt. However, this corruption is unlikely, because the boot loader, known as NT Loader
(NTLDR) in versions of Windows prior to Vista, checks a hive for corruption when it loads the hive.
This bug check can also occur if some critical registry keys and values are missing. Thee keys and values might be missing if a user manually edited the registry.
Resolving the Problem
Try restarting the computer by selecting "last known good configuration" in the boot options.
If the restart does not fix the problem, the registry damage is too extensive. You must reinstall the OS or use the Emergency Repair Disk (ERD) that you previously created by
using the Windows Backup tool.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Parameter 4
Cause of error
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
0x01
Cause
The driver either failed to unlock pages that it locked (parameter 1 value is 0x0), or the driver is attempting to unlock pages that have not been locked or that have already
been unlocked (parameter 1 value is 0x1).
Resolving the Problem
If the parameter 1 value is 0x0
First use the !search extension on the current process pointer throughout all of physical memory. This extension might find at least one memory descriptor list (MDL) that
points to the current process. Next, use !search on each MDL that you find to obtain the I/O request packet (IRP) that points to the current process. From this IRP, you can
identify which driver is leaking the pages.
Otherwise, you can detect which driver caused the error by editing the registry:
1. In the \\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management registry key, create or edit the
TrackLockedPages value, and then set it equal to DWORD 1.
2. Restart the computer.
The system then saves stack traces, so you can easily identify the driver that caused the problem. If the driver causes the same error again, bug check 0xCB
(DRIVER_LEFT_LOCKED_PAGES_IN_PROCESS) is issued, and the name of the driver that causes this error is displayed on the blue screen and stored in memory at the
location (PUNICODE_STRING) KiBugCheckDriver.
If the parameter 1 value is 0x1
Examine the driver source code that locks and unlocks memory, and try to locate an instance where memory is unlocked without first being locked.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
The value that appears in the stack where the signature should be.
0
The address of the signature on the kernel stack
If the first parameter is any value other than 0, 1, or 2, the parameters have the following meaning.
Parameter
Description
1
The status code
2
The I/O status code
3
The page file number
4
The offset into page file
Cause
If the first parameter is 0 or 1, the stack signature in the kernel stack was not found. This error is probably caused by defective hardware, such as a RAM error.
If the first parameter is 2, the driver stack returned an inconsistent status for the read of the page. For example, the driver stack returned a success status even though it did not
read the whole page.
If the first parameter is any value other than 0, 1, or 2, the value of the first parameter is an NTSTATUS error code that the driver stack returns after it tries to retrieve the page
of kernel data. You can determine the exact cause of this error from the I/O status code (the second parameter). Some common status codes include the following:
0xC000009A, or STATUS_INSUFFICIENT_RESOURCES, indicates a lack of nonpaged pool resources. This status code indicates a driver error in the storage stack.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
(The storage stack should always be able to retrieve this data, regardless of software resource availability.)
0xC000009C, or STATUS_DEVICE_DATA_ERROR, indicates bad blocks (sectors) on the hard disk.
0xC000009D, or STATUS_DEVICE_NOT_CONNECTED, indicates defective or loose cabling, termination, or that the controller does not see the hard disk drive.
0xC000016A, or STATUS_DISK_OPERATION_FAILED, indicates bad blocks (sectors) on the hard disk.
0xC0000185, or STATUS_IO_DEVICE_ERROR, indicates improper termination or defective cabling on SCSI devices or that two devices are trying to use the same
IRQ.
These status codes are the most common ones that have specific causes. For more information about other possible status codes that might be returned, see the Ntstatus.h file
in the Microsoft Windows Driver Kit (WDK).
A virus infection can also cause this bug check.
Resolving the Problem
Resolving a bad block problem: If you can restart the computer after the error, Autochk runs automatically and attempts to map the bad sector to prevent it from being used
anymore.
If Autochk does not scan the hard disk for errors, you can manually start the disk scanner. Run Chkdsk /f /r on the system partition. You must restart the computer before the
disk scan begins. If you cannot start the system because the error, use the Recovery Console and run Chkdsk /r.
Warning If your system partition is formatted with the FAT file system, the long file names that the Windows operating system uses might be damaged if you use Scandisk
or another MS-DOS-based hard disk tool to verify the integrity of your hard disk drive from MS-DOS. Always use the version of Chkdsk that matches your version of the
Windows operating system.
Resolving a defective hardware problem: If the I/O status is 0xC0000185 and the paging file is on an SCSI disk, check the disk cabling and SCSI termination for problems.
Resolving a failing RAM problem: Run the hardware diagnostics that the system manufacturer supplies, especially the memory scanner. For more information about these
procedures, see the owner's manual for your computer.
Check that all the adapter cards in the computer are properly seated. Use an ink eraser or an electrical contact treatment, available at electronics supply stores, to ensure
adapter card contacts are clean.
Check the System Log in Event Viewer for additional error messages that might help identify the device that is causing the error. You can also disable memory caching of the
BIOS to try to resolve this error.
Make sure that the latest Windows Service Pack is installed.
If the preceding steps fail to resolve the error, take the system motherboard to a repair facility for diagnostic testing. A crack, a scratched trace, or a defective component on
the motherboard can cause this error.
Resolving a virus infection: Check your computer for viruses by using any up-to-date, commercial virus scanning software that examines the Master Boot Record of the hard
disk. All Windows file systems can be infected by viruses.
See Also
Bug Check 0x7A (KERNEL_DATA_INPAGE_ERROR)
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Parameter 2
Parameter 3
Parameter 4
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
Cause.
9/18/2010
Introduction
0x1
0x2
0x3
Reserved
The minor version of the loader
parameter extension.
When Parameter 1 equals 0x2, the following build type codes are used:
Cause
The MISMATCHED_HAL bug check often occurs when a user manually updates Ntoskrnl.exe or Hal.dll.
The error can also indicate that one of those two files is out of date. For example, the HAL might be designed for Microsoft Windows 2000 and the kernel is designed for
Windows XP. Or the computer might erroneously have a multiprocessor HAL and a single-processor kernel installed, or vice versa.
The Ntoskrnl.exe kernel file is for single-processor systems and Ntkrnlmp.exe is for multiprocessor systems. However, these file names correspond to the files on the
installation media.After you have installed the Windows operating system, the file is renamed to Ntoskrnl.exe, regardless of the source file that is used. The HAL file also uses
the name Hal.dll after installation, but there are several possible HAL files on the installation media. For more information, see "Installing the Checked Build" in the
Windows Driver Kit (WDK).
Resolving the Problem
Restart the computer by using the product CD or the Windows Setup disks. At the Welcome screen, press F10 to start the Recovery Console. Use the Copy command to copy
the correct HAL or kernel file from the original CD into the appropriate folder on the hard disk. The Copy command detects whether the file that you are copying is in the
Microsoft compressed file format. If so, it automatically expands the file that is copied on the target drive.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
If the first parameter is 3 (and the third parameter is nonzero) or 4, the parameters have the following definitions.
Parameter
Description
1
The lock type that was held (3 or 4)
2
The error status (typically an I/O status code)
3
The address of the InPageSupport structure
4
The faulting address
Otherwise, the parameters have the following definitions.
Parameter
Description
1
The address of the page table entry (PTE)
2
The error status (usually an I/O status code)
3
The PTE contents
4
The faulting address
Cause
Frequently, you can determine the cause of the KERNEL_DATA_INPAGE_ERROR bug check from the error status (Parameter 2). Some common status codes include the
following:
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
These status codes are the most common ones that have specific causes. For more information about other possible status codes that can be returned, see the Ntstatus.h file in
the Microsoft Windows Driver Kit (WDK).
Another common cause of this error message is defective hardware or failing RAM.
A virus infection can also cause this bug check.
Resolving the Problem
Resolving a bad block problem: An I/O status code of 0xC000009C or 0xC000016A typically indicates that the data could not be read from the disk because of a bad block
(sector). If you can restart the computer after the error, Autochk runs automatically and attempts to map the bad sector to prevent it from being used anymore.
If Autochk does not scan the hard disk for errors, you can manually start the disk scanner. Run Chkdsk /f /r on the system partition. You must restart the computer before the
disk scan begins. If you cannot start the computer because of the error, use the Recovery Console and run Chkdsk /r.
Warning If your system partition is formatted with the FAT file system, the long file names that the Windows operating system uses might be damaged if you use Scandisk
or another MS-DOS-based hard disk tool to verify the integrity of your hard disk from MS-DOS. Always use the version of Chkdsk that matches your version of Windows.
Resolving a defective hardware problem: If the I/O status is C0000185 and the paging file is on an SCSI disk, check the disk cabling and SCSI termination for problems.
Resolving a failing RAM problem: Run the hardware diagnostics that the system manufacturer supplies, especially the memory scanner. For more information about these
procedures, see the owner's manual for your computer.
Check that all the adapter cards in the computer are properly seated. Use an ink eraser or an electrical contact treatment, available at electronics supply stores, to ensure
adapter card contacts are clean.
Check the System Log in Event Viewer for additional error messages that might help identify the device that is causing the error. You can also disable memory caching of the
BIOS to try to resolve this error.
Make sure that the latest Windows Service Pack is installed.
If the preceding steps do not resolve the error, take the system motherboard to a repair facility for diagnostic testing. A crack, a scratched trace, or a defective component on
the motherboard can cause this error.
Resolving a virus infection: Check your computer for viruses by using any up-to-date, commercial virus scanning software that examines the Master Boot Record of the hard
disk. All Windows file systems can be infected by viruses.
See Also
Bug Check 0x77 (KERNEL_STACK_INPAGE_ERROR)
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
If this parameter points to a device object, the file system that was supposed to read the boot device failed to initialize or simply did not recognize the data on the boot
device as a file system structure. In this situation, the specified device object is the object that could not be mounted.
If this parameter points to a Unicode string, you must read the first 8 bytes at this address. These bytes form the UNICODE_STRING structure, which is defined as
follows:
USHORT Length;
USHORT MaximumLength;
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
PWSTR Buffer;
The Length field gives the actual length of the string. The Buffer field points to the beginning of the string (Buffer is always be at least 0x80000000.)
The actual string contains the Advanced RISC Computing (ARC) specification name of the device that the boot was being attempted from. ARC names are a generic
way to identify devices in the ARC environment.
Cause
The INACCESSIBLE_BOOT_DEVICE bug check frequently occurs because of a boot device failure. During I/O system initialization, the boot device driver might have
failed to initialize the boot device (typically a hard disk). File system initialization might have failed because it did not recognize the data on the boot device. Also,
repartitioning the system partition or installing a new SCSI adapter or disk controller might induce this error.
This error can also occur because of incompatible disk hardware. If the error occurred at the initial setup of the system, the system might have been installed on an
unsupported disk or SCSI controller. Some controllers are supported only by drivers that are in the Windows Driver Library (WDL). (These drivers require the user to do a
custom installation.)
Resolving the Problem
This error always occurs while the system is starting. This error frequently occurs before the debugger connection is established, so debugging can be difficult or impossible.
Resolving a failed boot device problem: If a boot device is at fault, you must edit the boot options.For more information about changing these options, see Configuring
Software on the Target Computer .
Resolving an incompatible disk hardware problem: If Setup autodetects the controller, you might have to skip detection and use a specific manufacturer's disk to load the
driver. Also, check the availability of updates for the system BIOS and SCSI controller firmware. Updates of this kind are typically available on the Web site or BBS of the
hardware manufacturer.
Remove any recently added hardware, especially hard disk drives or controllers, to see if the error is resolved. If the problematic hardware is a hard disk drive, the disk
firmware version might be incompatible with your version of the Windows operating system. Contact the manufacturer for updates. If you removed another piece of hardware
and the error is resolved, IRQ or I/O port conflicts likely exist. Reconfigure the new device according to the manufacturer's instructions.
Confirm that all hard disk drivers, hard disk controllers, and SCSI adapters are listed in the Microsoft Windows Marketplace Tested Products List.
If you recently added a driver, restart your computer, and press F8 at the character-based menu that displays the operating system choices. In the Advanced Options menu,
select the Last Known Good Configuration option. This option is most effective when you add only one driver or service at a time.
In addition, check your computer for viruses by using any up-to-date, commercial virus scanning software that examines the Master Boot Record of the hard disk. All
Windows file systems can be infected by viruses.
This error can also occur because of hard disk corruption. Run Chkdsk /f /r on the system partition. You must restart the computer before the disk scan begins. If you cannot
start the computer because of the error, use the Recovery Console and run Chkdsk /r.
If you cannot start the system in the last known good configuration, you should try to start off the Windows CD. Then, you can run Chkdsk from the Repair Console.
Warning If your system partition is formatted with the FAT file system, the long file names that the Windows operating system uses might be damaged if you use Scandisk
or another MS-DOS-based hard disk tool to verify the integrity of your hard disk drive from MS-DOS. Always use the version of Chkdsk that matches your version of
Windows.
If your system has SCSI adapters, contact the adapter manufacturer to obtain updated Windows drivers. Try disabling sync negotiation in the SCSI BIOS, checking the
cabling and the SCSI IDs of each device, and confirming proper termination. For IDE devices, define the onboard IDE port as Primary only. Also check each IDE device for
the proper master/subordinate/stand alone setting. Try removing all IDE devices except for hard disks. Finally, check the System Log in Event Viewer for additional error
messages that might help identify the device or driver that is causing the error.
To analyze this error: Run an lm (List Loaded Modules) command in the debugger. Verify that the following drivers were loaded: disk, classpnp, ftdisk, partmgr, and FAT
or NTFS.
kd> lm
start
80001000
80016000
80019000
8001e000
80086000
802c1000
802cc000
802d4000
802ed000
802f4000
802fb000
802fe000
8039b000
803b8000
803cb000
803d2000
803d9000
80400000
80540000
80547000
80555000
end
80016000
80018c40
8001dfc0
8001ff60
80086980
802cc000
802d39a0
802ed000
802f3820
802fad40
802fdc20
802fef00
803b8000
803cb000
803d1560
803d8e80
803fa000
80540000
80546f20
80554620
80579000
module name
hal
bootvid
pciidex
dmload
pciide
pci
isapnp
ftdisk
mountmgr
fdc
partmgr
wmilib
dmio
atapi
disk
classpnp
fastfat
nt
ksecdd
cnss
ndis
(deferred)
(deferred)
(deferred)
(deferred)
(deferred)
(deferred)
(deferred)
(deferred)
(deferred)
(deferred)
(deferred)
(deferred)
(deferred)
(deferred)
(deferred)
(deferred)
(deferred)
(pdb symbols)
(deferred)
(deferred)
(deferred)
\\localsymbols\symbols\exe\ntoskrnl.dbg
You probably have pci or isapnp loaded. Also make sure your controller drivers are loaded. That is, make sure Atapi.sys is loaded with the channel drivers (pciide and pciidex
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Find out what type of controller the boot device is connected to (SCSI, IDE, 1394, etc). Find the manufacturer of non-IDE controllers (Adaptec, Symbios, and so on).
Note the SCSI ID of the boot device if you are using SCSI.
Indicate if other devices are attached to the same controller that the boot device is on (CD-ROM drives, zip drives, and so on).
Note the file system that is used on the drive.
The !devnode extension gives you more information, if you know what your boot devices are.
Typically Plug and Play cannot assign resources to the boot device. You can verify this restriction by finding an entry for the service. If the status flags include
DNF_INSUFFICIENT_RESOURCES or do not include DNF_STARTED or DNF_ENUMERATED, you have found the problem. Try !devnode 0 1 scsi or !
devnode 0 1 atapi to save some time instead of dumping the whole device tree.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Parameter 3
The number of bytes that are
requested
The shared memory page that was
corrupted
0x03
0x04
The address of
The address of DRIVER_OBJECT
NDIS_M_DRIVER_BLOCK
Parameter 4
Cause of Error
0x08
0x09
0x0A
0x0B
0x0C
0x0D
0x0E
0x0F
0x10
0x11
The address of the packet descriptor The address of the packet array that An Ethernet driver indicated that it received a packet by
that the driver uses
contained this packet descriptor
using a packet descriptor that the protocol stack is
currently using.
The address of the miniport The address of the packet descriptor The address of the packet array that An FDDI driver indicated that it received a packet by
block
that the driver uses
contained this packet descriptor
using a packet descriptor that the protocol stack is
currently using.
The address of the miniport The address of
0
A miniport driver did not deregister its interrupt during
block
NDIS_MINIPORT_INTERRUPT
the halt process.
The address of the miniport The address of the miniport driver's 0
A miniport driver stopped without successfully
block
timer queue
canceling all its timers.
(NDIS_MINIPORT_TIMER)
The address of
The address of DRIVER_OBJECT The reference count for the miniport A miniport driver is getting unloaded prematurely.
driver
NDIS_M_DRIVER_BLOCK
The address of the miniport The address of
0
A miniport driver failed its initialization without
block
NDIS_MINIPORT_INTERRUPT
deregistering its interrupt.
The address of the miniport The address of the miniport driver's 0
A miniport driver failed its initialization without
block
timer queue
successfully canceling all its timers.
(NDIS_MINIPORT_TIMER)
The address of the miniport The address of
0
A miniport driver did not deregister its interrupt during
block
NDIS_MINIPORT_INTERRUPT
the halt process. (The halt was called from the initialize
routine after the miniport driver returned success from
its initialize handler.)
The address of the miniport The address of the miniport driver's 0
A miniport driver stopped without successfully
block
timer queue
canceling all its timers. (The halt was called from the
(NDIS_MINIPORT_TIMER)
initialize routine after the miniport driver returned
success from its initialize handler.)
The address of the miniport The reset status
AddressingReset (BOOLEAN)
A miniport driver called NdisMResetComplete
block
without any pending reset request.
The address of the miniport The address of
0
After resuming from a low-power state, a miniport
block
NDIS_MINIPORT_INTERRUPT
driver failed its initialization without deregistering its
interrupt.
The address of the miniport The address of the miniport driver's 0
After resuming from a low-power state, a miniport
block
timer queue
driver failed its initialization without successfully
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
0x12
0x13
0x14
0x15
0x16
(NDIS_MINIPORT_TIMER)
canceling all its timers.
The address of the packet descriptor The address of the packet array that A miniport driver indicated that it received a packet by
that the driver uses
contained this packet descriptor
using a packet descriptor that the protocol stack is
currently using.
The address of the packet descriptor The address of the packet array that A Token-Ring miniport driver indicated that it received
that the driver uses
contained this packet descriptor
a packet by using a packet descriptor that the protocol
stack currently uses.
0
0
An NDIS driver called NdisWaitEvent at IRQL >
PASSIVE_LEVEL. The function must be called at
IRQL = PASSIVE_LEVEL.
0
0
An NDIS 6 miniport driver was calling an NDIS 5 API.
An NDIS 6 miniport driver cannot call
NdisMQueryInformationComplete or
NdisMSetInformationComplete.
The address of the context area that The address of the open block
NDIS encountered an invalid handle in a binding
is allocated by the protocol driver
operation.
A protocol drivers ProtocolBindAdapterEx function
returned NDIS_STATUS_SUCCESS, either directly or
asynchronously through
NdisCompleteBindAdapterEx. However, the binding
context information contains an invalid handle to a
block that indicates the open state of the miniport
adapter. In this case, the open handle is not NULL, but
it cannot be referenced.
0x17
Cause
Parameter 1 indicates the specific cause of the BUGCODE_NDIS_DRIVER bug check.
If one of the bug check parameters specifies the address of the miniport block, you can obtain more information by using !ndiskd.miniport together with this address.
If one of the bug check parameters specifies the address of the packet descriptor that the driver uses, you can obtain more information by using !ndiskd.pkt together with this
address.
Comments
This bug check code occurs only on Microsoft Windows Server 2003 and later versions of Windows. In Windows 2000 and Windows XP, the corresponding code is bug
check 0xD2 (BUGCODE_ID_DRIVER).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
For a complete list of exception codes, see the Ntstatus.h file that is located in the inc directory of the Microsoft Windows Driver Kit (WDK).
Resolving the Problem
If you are not equipped to debug this problem, you should use some basic troubleshooting techniques.
If you plan to debug this problem, you might find it difficult to obtain a stack trace. Parameter 2 (the exception address) should identify the driver or function that caused this
problem.
If exception code 0x80000003 occurs, a hard-coded breakpoint or assertion was hit, but the system was started with the /NODEBUG switch. This problem should rarely
occur. If it occurs repeatedly, make sure that a kernel debugger is connected and the system is started with the /DEBUG switch.
If exception code 0x80000002 occurs, the trap frame supplies additional information.
If you do not know the specific cause of the exception, consider the following issues:
Hardware incompatibility. Make sure that any new hardware that is installed is listed in the Microsoft Windows Marketplace Tested Products List.
Faulty device driver or system service. A faulty device driver or system service might be responsible for this error. Hardware issues, such as BIOS incompatibilities,
memory conflicts, and IRQ conflicts can also generate this error.
If a driver is listed by name within the bug check message, disable or remove that driver. Disable or remove any drivers or services that were recently added. If the error
occurs during the startup sequence and the system partition is formatted with NTFS file system, you might be able to use Safe Mode to rename or delete the faulty driver. If
the driver is used as part of the system startup process in Safe Mode, you must start the computer by using the Recovery Console to access the file.
If the problem is associated with Win32k.sys, the source of the error might be a third-party remote control program. If such software is installed, you can remove the service
by starting the computer by using the Recovery Console and then deleting the offending system service file.
Check the System Log in Event Viewer for additional error messages that might help identify the device or driver that is causing bug check 0x7E.
You can also disable memory caching of the BIOS might to try to resolve the error. You should also run hardware diagnostics, especially the memory scanner, that the system
manufacturer supplies. For more information about these procedures, see the owner's manual for your computer.
The error that generates this message can occur after the first restart during Windows Setup, or after Setup is finished. A possible cause of the error is lack of disk space for
installation and system BIOS incompatibilities. For problems during Windows installation that are associated with lack of disk space, reduce the number of files on the target
hard disk drive. Check for and delete any temporary files that you do not have to have, Internet cache files, application backup files, and .chk files that contain saved file
fragments from disk scans. You can also use another hard disk drive with more free space for the installation. You can resolve BIOS problems by upgrading the system BIOS
version.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
0x00000000, or Divide by Zero Error, indicates that a DIV instruction is executed and the divisor is zero. Memory corruption, other hardware problems, or software
failures can cause this error.
0x00000004, or Overflow, occurs when the processor executes a call to an interrupt handler when the overflow (OF) flag is set.
0x00000005, or Bounds Check Fault, indicates that the processor, while executing a BOUND instruction, finds that the operand exceeds the specified limits. A BOUND
instruction ensures that a signed array index is within a certain range.
0x00000006, or Invalid Opcode, indicates that the processor tries to execute an invalid instruction. This error typically occurs when the instruction pointer has become
corrupted and is pointing to the wrong location. The most common cause of this error is hardware memory corruption.
0x00000008, or Double Fault, indicates that an exception occurs during a call to the handler for a prior exception. Typically, the two exceptions are handled serially.
However, there are several exceptions that cannot be handled serially, and in this situation the processor signals a double fault. There are two common causes of a
double fault:
A kernel stack overflow. This overflow occurs when a guard page is hit, and the kernel tries to push a trap frame. Because there is no stack left, a stack overflow
results, causing the double fault. If you think this overview has occurred, use !thread to determine the stack limits, and then use kb (Display Stack Backtrace)
with a large parameter (for example, kb 100) to display the full stack.
A hardware problem.
If kv shows a taskGate, use the .tss (Display Task State Segment) command on the part before the colon.
If kv shows a trap frame, use the .trap (Display Trap Frame) command to format the frame.
Otherwise, use the .trap (Display Trap Frame) command on the appropriate frame. (On x86-based platforms, this frame is associated with the procedure NT!KiTrap.)
After using one of these commands, use kv again to display the new stack.
Troubleshooting: If you recently added hardware to the computer, remove it to see if the error recurs. If existing hardware has failed, remove or replace the faulty component.
Run hardware diagnostics that the system manufacturer supplies to determine which hardware component failed.
The memory scanner is especially important. Faulty or mismatched memory can cause this bug check. For more informaiton about these procedures, see the owner's manual
for your computer. Check that all adapter cards in the computer are properly seated. Use an ink eraser or an electrical contact treatment, available at electronics supply stores,
to ensure adapter card contacts are clean.
If the error appears on a newly installed system, check the availability of updates for the BIOS, the SCSI controller, or network cards. These kind of updates are typically
available on the Web site or BBS of the hardware manufacturer.
Confirm that all hard disk drives, hard disk controllers, and SCSI adapters are listed in the Microsoft Windows Marketplace Tested Products List.
If the error occurred after the installation of a new or updated device driver, you should remove or replace the driver. If, under this circumstance, the error occurs during the
startup sequence and the system partition is formatted with NTFS, you might be able to use Safe Mode to rename or delete the faulty driver. If the driver is used as part of the
system startup process in Safe Mode, you have to start the computer by using the Recovery Console in order to access the file.
Also restart your computer, and then press F8 at the character-based menu that displays the operating system choices. At the Advanced Options menu, select the Last
Known Good Configuration option. This option is most effective when you add only one driver or service at a time.
Overclocking (setting the CPU to run at speeds above the rated specification) can cause this error. If you have overclocked the computer that is experiencing the error, return
the CPU to the default clock speed setting.
Check the System Log in Event Viewer for additional error messages that might help identify the device or driver that is causing the error. You can also disable memory
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Parameter 2
Parameter 3
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
Cause
9/18/2010
Introduction
1
0x0
0x1
3: The desired video mode is not supported. This value indicates an internal setup
error.
4: IOCTL_VIDEO_SET_CURRENT_MODE (unable to set video mode)
5: IOCTL_VIDEO_MAP_VIDEO_MEMORY
6: IOCTL_VIDEO_LOAD_AND_SET_FONT
0x2
Out of memory.
0x3
This failure might indicate that the disk that contains the
keyboard driver (I8042prt.sys or Kbdclass.sys) is damaged
or that the computer has keyboard hardware that Windows
cannot communicate with. This failure might also mean
that the keyboard layout DLL could not be loaded.
1: Unable to load keyboard layout DLL. (Setup could not load the keyboard layout
file. This failure indicates that the CD or floppy disk is missing a file, such as
Kbdus.dll for the U.S. release or another layout DLL for localized releases.)
0x4
Setup could not resolve the ARC device path name of the
device that setup was started from.
This error is an internal setup error.
0x5
Reserved
Reserved
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
There are many forms of viruses and not all can be detected. Typically, the newer viruses usually can be detected only by a virus scanner that has recently been upgraded. You
should boot with a write-protected disk that contains a virus scanner and try to clean out the infection.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
For a complete list of exception codes, see the Ntstatus.h file that is located in the inc directory of the Microsoft Windows Driver Kit (WDK).
Resolving the Problem
If you are not equipped to debug this problem, you should use some basic troubleshooting techniques:
If you plan to debug this problem, you might find it difficult to obtain a stack trace. Parameter 2 (the exception address) should identify the driver or function that caused this
problem.
If exception code 0x80000003 occurs, a hard-coded breakpoint or assertion was hit, but the computer was started with the /NODEBUG switch. This problem should rarely
occur. If it occurs repeatedly, make sure that a kernel debugger is connected and that the computer is started with the /DEBUG switch.
If exception code 0x80000002 occurs, the trap frame supplies additional information.
If you do not know the specific cause of the exception, consider the following items:
Hardware incompatibility. Make sure that any new hardware installed is listed in the Microsoft Windows Marketplace Tested Products List.
Faulty device driver or system service. A faulty device driver or system service might be responsible for this error. Hardware issues, such as BIOS incompatibilities,
memory conflicts, and IRQ conflicts can also generate this error.
If the bug check message lists a driver by name , disable or remove that driver. Also, disable or remove any drivers or services that were recently added. If the error occurs
during the startup sequence and the system partition is formatted with NTFS file system, you might be able to use Safe Mode to rename or delete the faulty driver. If the driver
is used as part of the system startup process in Safe Mode, you have to start the computer by using the Recovery Console to access the file.
If the problem is associated with Win32k.sys, the source of the error might be a third-party remote control program. If such software is installed, you can remove the service
by starting the system by using the Recovery Console and then deleting the offending system service file.
Check the System Log in Event Viewer for additional error messages that might help identify the device or driver that is causing bug check 0x1E. You can disable memory
caching of the BIOS to try to resolve the error. You should also run hardware diagnostics, especially the memory scanner, that the system manufacturer supplies. For more
information about these procedures, see the owner's manual for your computer.
The error that generates this message can occur after the first restart during Windows Setup, or after Setup is finished. A possible cause of the error is lack of disk space for
installation and system BIOS incompatibilities. For problems during Windows installation that are associated with lack of disk space, reduce the number of files on the target
hard disk drive. Check for and delete any temporary files that you do not have to have, Internet cache files, application backup files, and .chk files that contain saved file
fragments from disk scans. You can also use another hard disk drive with more free space for the installation.
You can resolve BIOS problems by upgrading the system BIOS version.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Reserved
Reserved
Cause
The INVALID_KERNEL_HANDLE bug check indicates that some kernel code (for example, a server, redirector, or another driver) tried to close an invalid handle or a
protected handle.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Parameter 4
The first two characters of the
product type from the product
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
Cause
Offline product type changes have been attempted.
9/18/2010
Introduction
options
The registered evaluation time from Offline changes to the Microsoft Windows evaluation unit
an alternate source
time period have been attempted.
0
The setup key could not be opened.
0x11
0x12
0
Reserved
0
0
Reserved
0
0
0
0
0x06
0x07
0x08
0x09
0x0A
0x0B
0x0C
0x0D
0x0F
0x10
0x13
0x14
0x15
0x16
0x17
0x18
0x19
0x1A
0x1B
Cause
The Microsoft Windows operating system detects a violation of the software license agreement.
A user might have tried to change the product type of an offline system or change the trial period of an evaluation unit of Windows. For more information about the specific
violation, see the parameter list.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Parameter 3
The size of the
log
The size of the
log
The size of the
log
The size of the
log
The size of the
Parameter 4
Cause
0
The error
code
The error
code
0
The system abstraction layer (SAL) returned an error for SAL_GET_STATEINFO while processing
MCA.
SAL returned an error for SAL_CLEAR_STATEINFO while it processed MCA.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
log
log
0xB
0xC
0xD
0xE
SAL reported a recoverable MCA, but this recovery is not currently supported.
SAL generated an MCA but could not produce an error record.
0
The error
code
The error
code
0
Comments
For more information about Machine Check Architecture (MCA), see the Intel or AMD Web sites.
Note Starting with Windows Vista, this bug check is no longer supported, and has been replaced with bug Check 0x124: WHEA_UNCORRECTABLE_ERROR.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Parameter 2
The device object
Parameter 3
Reserved
The device object
Parameter 4
Reserved
Cause
The device object that is being freed still has an outstanding power
request that it has not completed.
The driver object, if The device object completed the I/O request packet (IRP) for the
it is available
system power state request, but it failed to call
PoStartNextPowerIrp.
The IRP
The device driver did not properly set the IRP as "pending" or
complete the IRP.
The blocked IRP
A device object has been blocking an IRP for too long a time.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
A pointer to the
device object to
notify
The parent device
object
Device object
Cause
For a description of the possible causes, see the description of each code in the Parameters section.
The errors that cause Parameter 1 to be 0x3, 0x100, or 0x101 only exist in Microsoft Windows 2000. In Windows XP and later versions of Windows, these errors are
superseded by Driver Verifier tests. For more information about Driver Verifier, see the Driver Verifier section of the Windows Driver Kit.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Parameter 3
Parameter 4
Reserved
Cause
An error occurred during the handling of
the power I/O request packet (IRP).
Reserved
Reserved
Reserved
0x3
0x4
0x5
Reserved
Reserved
0x7
0x8
Reserved
Reserved
When Parameter 1 is0x8, a fatal error occurred while processing a system power event. In this situation, Parameter 2 indicates the cause of the error. The meaning of the other
parameters depends on the value of Parameter 2.
Parameter
2
0x100
The device object
Parameter 3
0x101
Exception pointer
0x102
0x103
Parameter 4
Cause
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
0x104
Reserved
0x105
Reserved
0x106
The MDL
Reserved
0x107
0x108
Reserved
0x109
0x10A
0x200
0x300
0x301
The IRP
0x400
0x401,
0x402,
or
0x403
0x404
0x500
The IRP
Cause
For more information about the exact cause for the INTERNAL_POWER_ERROR bug check, see the tables in the Parameters section above.
Resolving the Problem
The following procedures will help you debug certain instances of this bug check.
Debugging bug check 0xA0 when Parameter 1 equals 0x2
1. Examine the stack. Look for the ntoskrnl!PopExceptionFilter function. This function contains the following code as its first argument.
(error_code << 16) | _LINE_
If the caller is PopExceptionFilter, the first argument to this function is of type PEXCEPTION_POINTERS. Note the value of this argument.
2. Use the dt (Display Type) command and specify the value that you found in the previous step as argument.
dt nt!_EXCEPTION_POINTERS argument
. This command displays the structure. Note the address of the context record.
3. Use the .cxr (Display Context Record) command and specify the context record that you found in the previous step as record.
.cxr record
. This command sets the register context to the proper value.
4. Use a variety of commands to analyze the source of the error. Start with kb (Display Stack Backtrace) .
Debugging bug check 0xA0 when Parameter 1 equals 0x7
1. Examine the stack. Look for the ntoskrnl!PopExceptionFilter function. The first argument to this function is of type PEXCEPTION_POINTERS. Note the value of
this argument.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
2. Use the dt (Display Type) command and specify the value that you found in the previous step as argument.
dt nt!_EXCEPTION_POINTERS argument
This command displays the structure. Note the address of the context record.
3. Use the .cxr (Display Context Record) command and specify the context record that you found in the previous step as record.
.cxr record
This command sets the register context to the proper value.
4. Use a variety of commands to analyze the source of the error. Start with kb (Display Stack Backtrace) .
Debugging bug check 0xA0 when Parameter 1 equals 0x8 and Parameter 2 equals 0x101
1. Use the dt (Display Type) command and specify the value of Parameter 3 as argument.
dt nt!_EXCEPTION_POINTERS argument
This command displays the structure. Note the address of the context record.
2. Use the .cxr (Display Context Record) command and specify the context record that you found the previous step as record.
.cxr record
This command sets the register context to the proper value.
3. Use a variety of commands to analyze the source of the error. Start with kb (Display Stack Backtrace) .
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Parameter 3
Parameter 4
Cause
Cause
A cyclic redundancy check (CRC) check on the memory range has failed.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
On a system wake operation, various regions of memory might be checked to guard against memory failures.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Four bug check parameters appear on the blue screen. Parameter 1 indicates the kind of the incompatibility. The meaning of the other parameters depends on the value of
Parameter 1.
If the BIOS incompatibility is related to Plug and Play (PnP) or power management, the following parameters are used.
Parameter
Parameter 2
1
0x01
ACPI's deviceExtension
Parameter 3
ACPI's ResourceList
Parameter 4
0: No resource list is found
Cause
ACPI cannot find the System Control Interrupt (SCI) vector in the
resources that are handed to it when ACPI is started.
0x06
0x07
0x08
0x09
0x0A
0x0B
0x0C
The ACPI extension that The (ULONG) name of the 0: Base case
ACPI needs the object for method that ACPI looked for
1: Conflict
0x0E
0x0F
0x10
0x11
0x14
0x15
If an interrupt routing failure or incompatibility has occurred, the following parameters are used.
Parameter
Parameter 2
Parameter 3
Parameter 4
1
0x2001
InterruptModel
The return value from the interpreter
A pointer to the PIC control method
(integer)
0x10001
A pointer to the device A pointer to the parent of the device object A pointer to the _PRT object
object
(See the following Comments section)
0x10002
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
Cause
ACPI tried to evaluate the PIC control method
but failed.
ACPI tried to do interrupt routing, but failed.
9/18/2010
Introduction
0x10005
0x10006
0x10007
0x10008
0x10009
0x1000A
0x1000B
0x20000
If a miscellaneous failure or incompatibility has occurred, the following parameters are used.
Parameter
Parameter 2
1
0x20000
The I/O port in the Fixed
Table
Parameter Parameter
Cause
3
4
0
0
The PM_TMR_BLK entry in the Fixed ACPI Description Table does not point to a working ACPI
timer block.
If Parameter 1 equals 0x02, the ACPI BIOS could not process the resource list for the PCI root buses. In this case, Parameter 3 specifies the exact problem, and the remaining
parameters have the following definitions.
Parameter 2
The ACPI extension
for the PCI bus
The ACPI extension
for the PCI bus
The ACPI extension
for the PCI bus
The ACPI extension
for the PCI bus
The ACPI extension
for the PCI bus
Parameter 3
0x2
A pointer to the
QUERY_RESOURCE_REQUIREMENTS IRP
0
Cause
ACPI cannot convert the BIOS' resource list into the proper format. This
probably represents an error in the BIOS' list encoding procedure.
ACPI cannot convert the BIOS' resource list into the proper format. This
probably represents an error in the BIOS' list encoding procedure.
ACPI found an empty resource list.
0x3
ACPI could not find the current bus number in the CRS.
0x0
0x1
Parameter 4
A pointer to the QUERY_RESOURCES IRP
A pointer to the
A pointer to the E820 memory table
resource list for PCI
The list of resources that PCI claims to decode overlaps with the list of
memory regions that the E820 BIOS interface reports. (This kind of conflict
is never permitted.)
If Parameter 1 equals 0x10, the ACPI BIOS could not determine the system-to-device-state mapping correctly. In this situation, Parameter 3 specifies the exact problem, and
the remaining parameters have the following definitions.
Parameter 2
The ACPI extension whose
mapping is needed
The ACPI extension whose
mapping is needed
The ACPI extension whose
mapping is needed
Parameter
Parameter 4
3
0x0
The DEVICE_POWER_STATE (this is
"x+1")
0x1
The SYSTEM_POWER_STATE that
cannot be mapped
0x2
The SYSTEM_POWER_STATE that
cannot be mapped
Cause
_PRx was mapped back to a non-supported S-state.
ACPI cannot find a D-state to associate with the S-state.
The device claims to be able to wake the system when the system is in this S-state,
but the system does not actually support this S-state.
If Parameter 1 equals 0x11, the system could not enter ACPI mode. In this situation, Parameter 2 specifies the exact problem, and the remaining parameters have the
following definitions.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Parameter 2
Parameter 3
Parameter 4
Cause
0x0
0
0
The system could not initialize the AML interpreter.
0x1
0
0
The system could not find RSDT.
0x2
0
0
The system could not allocate critical driver structures.
0x3
0
0
The system could not load RSDT.
0x4
0
0
The system could not load DDBs.
0x5
0
0
The system cannot connect the Interrupt vector.
0x6
0
0
SCI_EN never becomes set in PM1 Control Register.
0x7
A pointer to the table that had a bad checksum Creator revision The table checksum is incorrect.
0x8
A pointer to the table that ACPI failed to load Creator revision ACPI failed to load DDB.
0x9
FADT version
0
Unsupported firmware version.
0xA
0
0
The system could not find MADT.
0xB
0
0
The system could not find any valid Local SAPIC structures in the MADT.
Cause
The value of Parameter 1 indicates the error.
Resolving the Problem
If you are debugging this error, use the !analyze -v extension. This extension displays all the relevant data (device extensions, nsobjects, or whatever is appropriate to the
specific error).
If you are not performing debugging, this error indicates that you have to obtain a new BIOS. Contact your vendor or visit the internet to get a new BIOS.
If you cannot obtain an updated BIOS, or the latest BIOS is still not ACPI compliant, you can turn off ACPI mode during text-mode setup. To turn off ACPI mode, press the
F7 key when you are prompted to install storage drivers. The system does not notify you that the F7 key was pressed, but it silently disables ACPI and enables you to continue
your installation.
Comments
A PCI routing table (_PRT) is the ACPI BIOS object that specifies how all the PCI devices are connected to the interrupt controllers. A computer with multiple PCI buses
might have multiple _PRTs.
You can display a _PRT in the debugger by using the !acpikd.nsobj extension together with the address of the _PRT object as its argument.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The SESSION_HAS_VALID_POOL_ON_EXIT bug check occurs because a session driver does not free its pool allocations before a session unload. This bug check
indicates a bug in Win32k.sys, Atmfd.dll, Rdpdd.dll, or a video driver.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Cause
The system was not able to go into graphics mode because no display drivers were able to start.
This usually occurs when no video miniport drivers are able to load successfully.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Description
Cause
This error is caused when Windows is booting off a network, and a critical function fails during I/O initialization.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Parameters
The following parameters are displayed on the blue screen.
Parameter
Description
1
Virtual address of attempted write
2
PTE contents
3
Reserved
4
Reserved
If the driver responsible for the error can be identified, its name is printed on the blue screen and stored in memory at the location (PUNICODE_STRING)
KiBugCheckDriver.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Parameter 2
Reserved
Parameter
Cause of Error
4
0x20
A driver attempted to free pool which was not allocated.
Bytes requested
0x21,
0x22
0x23
Reserved
0x24
Number of bytes
Address that the driver tried to
free
Reserved
0x30
0x31
Parameter 3
0x32
The _POOL_TYPE codes are enumerated in ntddk.h. In particular, zero indicates nonpaged pool and one indicates paged pool.
Cause
A driver has written to an invalid section of the special pool.
Resolving the Problem
Obtain a backtrace of the current thread. This backtrace will usually reveal the source of the error.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
For information about the special pool, consult the Driver Verifier section of the Windows Driver Kit.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Parameter 2
Parameter 3
Parameter 4
Cause of Error
0
Pointer to pool
header
Pool type
First part of pool header
contents
Pool tag
0
Reserved
Reserved
The current thread attempted to free the pool, which was already freed.
The current thread attempted to free the pool, which was already freed.
Current IRQL
Current IRQL
Address of pool
Pool type
Pool type
Allocator's tag
0x0B,
0x0C,
or
0x0D
0x40
0x41
0x42
or
0x43
0x44
0x46
0x47
0x48
0x50
0x60
Address of pool
The current thread attempted to free the kernel pool at a user-mode address.
Starting address
Starting address
Starting address
Starting address
Starting address
0
0
Highest physical page frame
Reserved
Size of paged pool, in bytes
Reserved
0
Physical page frame
Reserved
Start offset, in pages, from
beginning of paged pool
Starting address 0
Address that is
being freed
0x9A
Pool type
0x9B
Pool type
0x9C
Pool type
0x9D
0x41286
Caller's address
The current thread attempted to allocate a pool with a tag that does not contain
any letters or digits. Using such tags makes tracking pool issues difficult.
Start offset from the beginning The current thread attempted to free a paged pool address in the middle of an
of the paged pool, in pages
allocation.
The _POOL_TYPE codes are enumerated in Ntddk.h. In particular, 0 indicates nonpaged pool and 1 indicates paged pool.
Cause
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
0x00
0x01
Parameter 1
Parameter 2
Current IRQL
Current IRQL
Parameter 3
Pool type
Pool type
Parameter 4
0
Size of allocation, in bytes
0x02
Current IRQL
Pool type
Reserved
Reserved
Reserved
Bad Address
0x11
Current IRQL
Pool type
Address of pool
0x12
Current IRQL
Pool type
Address of pool
0x13
or
0x14
0x15
Reserved
Timer entry
0x16
Reserved
0x17
Resource entry
0x30
Current IRQL
0
Pool address being freed
0
Cause of Error
The driver requested a zero-byte pool allocation.
The driver attempted to allocate paged memory with IRQL
> APC_LEVEL.
The driver attempted to allocate nonpaged memory with
IRQL > DISPATCH_LEVEL.
The driver attempted to allocate multiple pages of must
succeed pool, but at most one page can be allocated using
this routine.
The driver attempted to free an address that was not
returned from an allocate call.
The driver attempted to free paged pool with IRQL >
APC_LEVEL.
The driver attempted to free nonpaged pool with IRQL >
DISPATCH_LEVEL.
The driver attempted to free memory pool which was
already freed.
The driver attempted to free pool which contains an active
timer.
The driver attempted to free pool at a bad address, or the
driver passed invalid parameters to a memory routine.
The driver attempted to free pool which contains an active
ERESOURCE.
The driver passed an invalid parameter to KeRaiseIrql.
(The parameter was either a value lower than the current
IRQL, or a value higher than HIGH_LEVEL. This may be
the result of using an uninitialized parameter.)
0x31
Current IRQL
Requested IRQL
1: New IRQL is invalid inside a (The parameter was either a value higher than the current
DPC routine
IRQL, or a value higher than HIGH_LEVEL. This may be
the result of using an uninitialized parameter.)
0x32
Current IRQL
0x33
Current IRQL
0x34
Current IRQL
0x35
Current IRQL
Old IRQL
0x36
Current IRQL
Old IRQL
0x37
Current IRQL
0x38
Current IRQL
0x39
Current IRQL
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
0x3A
Current IRQL
0x3B
Current IRQL
Time-out parameter
0x3C
0x3D
0x3E
0x3F
Object address
1: reference case
0x40
Current IRQL
0x41
Current IRQL
0x42
Current IRQL
0x51
Base address of
allocation
0x52
Base address of
allocation
0x53,
0x54,
or
0x59
0x60
Base address of
allocation
0x61
0x62
0x6F
MDL address
Current IRQL
MDL address
Access mode
0x71
Current IRQL
MDL address
Process address
0x72
Current IRQL
MDL address
Process address
0x73
Current IRQL
Current IRQL
MDL address
Access mode
0x75
Current IRQL
MDL address
Access mode
0x76
Current IRQL
MDL address
Access mode
0x77
Current IRQL
MDL address
Access mode
0x78
Current IRQL
MDL address
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
0x79
Current IRQL
MDL address
0x7A
Current IRQL
0x7B
Current IRQL
0x7C
0x7D
MDL address
MDL address
MDL flags
MDL address
Number of bytes
0x80
Current IRQL
Event address
0x81
MDL address
MDL flags
0x82
MDL address
MDL flags
0x83
0x84
0x85
0x86
MDL address
0x87
First page frame number that isn't The driver called MmMapIoSpace without having locked
locked down
down the MDL pages. The physical pages represented by
the physical address range being mapped must have been
locked down prior to making this call.
First page frame number that is The driver called MmMapIoSpace without having locked
on the free list
down the MDL pages (or after freeing the MDL pages).
First page frame number that isn't The driver called MmMapLockedPages without having
locked down
locked down the MDL pages.
First page frame number that is The driver called MmMapLockedPages without having
on the free list
locked down the MDL pages (or after freeing the MDL
pages).
MEMORY_CACHING_TYPE The driver called MmMapIoSpace, but the caller's cache
of the existing mapping
type conflicts with an existing mapping.
MEMORY_CACHING_TYPE
of the requested mapping
Reserved
MDL address
0x8A
MDL address
Reserved
0x91
Reserved
Reserved
Reserved
0xA0 (Windows
Pointer to the IRP
Device object of the lower Number of the sector in which
Server 2003 and later making the read or write device
the error was detected
operating systems only) request
0xA1 (Windows
Copy of the IRP making
Server 2003 and later the read or write request.
operating systems only) (The actual IRP has been
completed.)
0xA2 (Windows
IRP making the read or
Server 2003 and later write request, or a copy
operating systems only) of this IRP
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
MDL address
MDL flags
MDL address
MDL flags
MDL address
MDL flags
MDL address
MDL flags
MDL address
MDL flags
MDL address
MDL flags
MDL address
MDL flags
Number of corrupted
physical pages
Reserved
Reserved
Reserved
Reserved
Reserved
Reserved
Reserved
Reserved
The threads APC disable count A driver dispatch routine has changed the threads APC
disable count.
prior to calling the driver
dispatch routine
The APC disable count is decremented each time a driver
calls KeEnterCriticalRegion, FsRtlEnterFileSystem, or
acquires a mutex.
The threads APC disable count A driver Fast I/O dispatch routine has changed the threads
prior to calling the Fast I/O
APC disable count.
driver dispatch routine
The APC disable count is decremented each time a driver
calls KeEnterCriticalRegion, FsRtlEnterFileSystem, or
acquires a mutex.
The APC disable count is incremented each time a driver
calls KeLeaveCriticalRegion, KeReleaseMutex, or
FsRtlExitFileSystem.
Because these calls should always be in pairs, the APC
disable count should be zero whenever a thread is exited. A
negative value indicates that a driver has disabled APC
calls without re-enabling them. A positive value indicates
that the reverse is true.
Reserved
Reserved
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Address of the lookaside Starting address of the pool Size of the pool allocation
list
allocation
Address of the lookaside Block size specified by the Minimum supported block size
list
caller
Address of the
Reserved
ERESOURCE structure
Reserved
Address of the
Reserved
ERESOURCE structure
Reserved
Address of the
Starting address of the pool Size of the pool allocation
ERESOURCE structure allocation
Address of the
Current
IO_REMOVE_LOCK IoReleaseRemoveLock
structure created by the tag
checked build version of
the driver
Reserved
Address of the
IO_REMOVE_LOCK
structure created by the
checked build version of
the driver
Previous
IoAcquireRemoveLock tag
Reserved
Reserved
Reserved
Reserved
Reserved
Reserved
Reserved
Reserved
Synchronization object
address
Reserved
Reserved
Current IRQL
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
systems only)
0xEB (Windows Vista
and later operating
systems only)
0xF0 (Windows Vista
and later operating
systems only)
0xF5 (Windows Vista
and later operating
systems only)
0xF6
(Windows 7operating
systems and later)
0xFA
(Windows 7operating
systems and later)
0xFB
(Windows 7operating
systems and later)
Current IRQL
Address of the
destination buffer
Object type
Reserved
Completion routine
address.
IRQL value before it calls Current IRQL value, after it calls The IRP completion routine returned at an IRQL that was
the completion routine
the completion routine
different from the IRQL the routine was called at.
Completion routine
address
The threads APC disable count The threads APC disable count was changed by the
before it calls the IRP completion drivers IRP completion routine.
routine
The APC disable count is decremented each time a driver
calls KeEnterCriticalRegion, FsRtlEnterFileSystem, or
acquires a mutex.
The APC disable count is incremented each time a driver
calls KeLeaveCriticalRegion, KeReleaseMutex, or
FsRtlExitFileSystem.
Because these calls should always be in pairs, the APC
disable count should be zero whenever a thread is exited. A
negative value indicates that a driver has disabled APC
calls without re-enabling them. A positive value indicates
that the reverse is true.
0x105
(Windows 7operating
systems and later)
0x10A
(Windows 7operating
systems and later)
The driver attempts to charge pool quota from a DPC
routine. This is incorrect because the current process
context is undefined.
0x10B
(Windows 7operating
systems and later)
0x110
(Windows 7operating
systems and later)
(Windows 7operating
systems and later)
0x11A
Current IRQL
Current IRQL
0x115
(Windows 7operating
systems and later)
0x11B
(Windows 7operating
systems and later)
0x120
(Windows 7operating
systems and later)
0x121
(Windows 7operating
systems and later)
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
0x122
(Windows 7operating
systems and later)
0x123
(Windows 7operating
systems and later)
0x130
(Windows 7operating
systems and later)
0x131
(Windows 7operating
systems and later)
0x135
Address of IRP
Number of milliseconds
allowed between the
IoCancelIrp call and the
completion for this IRP
Incorrect value
0x13A
0x13B
0x13C
0x13D
0x13E
0x13F
0x1000 (Windows XP
and later operating
systems only)
0x1001 (Windows XP
and later operating
systems only)
Reserved
Reserved
Reserved
Reserved
0x1002 (Windows XP
and later operating
systems only)
Reserved
Reserved
0x1003 (Windows XP
and later operating
systems only)
Reserved
0x1004 (Windows XP
and later operating
systems only)
0x1005 (Windows XP
and later operating
systems only)
Reserved
Reserved
0x1006 (Windows XP
and later operating
systems only)
Reserved
0x1007 (Windows XP
and later operating
systems only)
Reserved
Reserved
0x1008
Lock address
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
later)
0x1009
Lock address
Lock address
Cause
See the description of each code in the Parameters section for a description of the cause. Further information can be obtained by using the !analyze -v extension.
Resolving the Problem
This bug check can only occur when Driver Verifier has been instructed to monitor one or more drivers. If you did not intend to use Driver Verifier, you should deactivate it.
You might consider removing the driver which caused this problem as well.
If you are the driver writer, use the information obtained through this bug check to fix the bugs in your code.
For full details on Driver Verifier, see the Driver Verifier section of the Windows Driver Kit (WDK).
Comments
The _POOL_TYPE codes are enumerated in Ntddk.h. In particular, 0 (zero) indicates nonpaged pool and 1 (one) indicates paged pool.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Cause
The kernel attempted to access pageable memory (or perhaps completely invalid memory) when the IRQL was too high. The ultimate cause of this problem is almost certainly
a driver that has corrupted the system pool.
In most cases, this bug check results if a driver corrupts a small allocation (less than PAGE_SIZE). Larger allocations result in bug check 0xD0
(DRIVER_CORRUPTED_MMPOOL).
Resolving the Problem
If you have recently installed any new software, check to see if it is properly installed. Check for updated drivers on the manufacturer's website.
To debug this error, use the special pool option of Driver Verifier. If this fails to reveal the driver that caused the error, use the Global Flags utility to enable the special pool
by pool tag.
For information about the special pool, consult the Driver Verifier section of the Windows Driver Kit.
2009 Microsoft Corporation
Send feedback on this topic
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
0: Kernel mode
1: User mode
Reserved
Comments
The faulty component will be displayed in the current kernel stack. This driver should be either replaced or debugged.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Parameter 3
Start of memory range being
checked
Start of memory range being
checked
Start of memory range being
checked
Processor number
The threads APC disable count
before the kernel calls the DPC
routine
Parameter 4
Cause of error
The timer object was found in a block of memory where a timer object
is not permitted. .
The DPC object was found in a block of memory where a DPC object
is not permitted.
The DPC routine was found in a block of memory where a DPC object
is not permitted.
The processor number for the DPC object is not correct.
The threads APC disable count was changed during DPC routine
execution.
The APC disable count is decremented each time a driver calls
KeEnterCriticalRegion, FsRtlEnterFileSystem, or acquires a mutex.
The APC disable count is incremented each time a driver calls
KeLeaveCriticalRegion, KeReleaseMutex, or FsRtlExitFileSystem.
0x5
Address of the
DPC routine
The threads APC disable count The threads APC disable count was changed during the execution of
after the DPC routine is called timer DPC routine.
The APC disable count is decremented each time a driver calls
KeEnterCriticalRegion, FsRtlEnterFileSystem, or acquires a mutex.
The APC disable count is incremented each time a driver calls
KeLeaveCriticalRegion, KeReleaseMutex, or FsRtlExitFileSystem.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Cause
This condition is usually caused by a driver failing to cancel a timer or DPC before freeing the memory where it resides.
Resolving the Problem
If you are the driver writer, use the information obtained through this bug check to fix the bugs in your code.
If you are a system administrator, you should unload the driver if the problem persists.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
2
3
4
Zero, or APC->KernelRoutine
Zero, or APC
Zero, or APC->NormalRoutine
You can determine "UniqueValue" by computing (Parameter 1 AND 0xFF). If "UniqueValue" is either zero or one, Parameter 2, Parameter 3, and Parameter 4 will equal the
indicated APC pointers. Otherwise, these parameters will equal zero.
Cause
This error is usually caused by a device driver or another lower-level program that changed the IRQL for some period and did not restore the original IRQL at the end of that
period. For example, the routine may have acquired a spin lock and failed to release it.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Parameter 2
0x06
0x07
0x08
Parameter 3
0
0
0
0
IRQL before
IoCallDriver
Address of IRP being
completed
Address of IRP being
completed
IRP major function
code
Parameter 4
0
0
0
0
IRQL after
IoCallDriver
0
0
Exception status
code
Cause of Error
The driver attempted to free an object whose type is not IO_TYPE_IRP.
The driver attempted to free an IRP that is still associated with a thread.
The driver passed IoCallDriver an IRP Type not equal to IRP_TYPE.
The driver passed IoCallDriver an invalid device object.
The IRQL changed during a call to the driver dispatch routine.
The driver called IoCompleteRequest with a status marked as pending (or equal
to -1).
The driver called IoCompleteRequest while its cancel routine was still set.
The driver passed IoBuildAsynchronousFsdRequest an invalid buffer.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
0x09
0x0A
Exception status
code
0
0x0C
0x0D
0x0E
0x0F
Current IRQL
Address of the device object to
which the IRP is being sent
Address of IRP
Pointer to the IRP
0
Pointer to file
object
In addition to the errors mentioned in the previous table, there are a number of I/O Verification errors that will cause Driver Verifier to halt the system, but which are not
actually bug checks.
These errors cause messages to be displayed on the blue screen, in a crash dump file, and in a kernel debugger. These messages will appear differently in each of these
locations. When these errors occur, the hexadecimal bug check code 0xC9 and the bug check string DRIVER_VERIFIER_IOMANAGER_VIOLATION do not appear on the
blue screen or in the debugger, although they will appear in a crash dump file.
On the blue screen, the following data will be displayed:
If a kernel-mode crash dump has been enabled, the following information will appear in the crash dump file:
If a kernel debugger is attached to the system which has caused this violation, the following information will be sent to the debugger:
The message WDM DRIVER ERROR, along with an assessment of the severity of the error.
The name of the driver which caused the error.
A descriptive string which explains the cause of this error. Often additional information is passed along, such as a pointer to the IRP. (See the table below for a list of
these descriptive strings and what additional information is specified.)
A query for further action. Possible responses are b (break), i (ignore), z (zap), r (remove), or d (disable). Instructing the operating system to continue allows you to see
what would happen "down the line" if this error had not occurred. Of course, this often will lead to additional bug checks. The "zap" option will actually remove the
breakpoint that caused this error to be discovered.
Note No other bug checks can be ignored in this manner. Only this kind of I/O Verification errors can be ignored, and even these errors can only be ignored if a kernel
debugger is attached.
The following table lists those I/O Verification errors that can appear. In Windows 2000, these errors will only be displayed if I/O Verification is set to Level 2.
I/O Error Severity
Code
0x200
Unknown
0x201
Fatal error
0x202
Fatal error
0x203
0x204
0x205
Fatal error
Fatal error
Fatal error
0x206
Fatal error
0x207
Fatal error
0x208
0x209
Fatal error
Fatal error
0x20A
0x20B
0x20C
0x20D
Fatal error
Fatal error
Fatal error
Fatal error
0x20E
Non-fatal
error
Non-fatal
error
0x20F
Cause of Error
This code covers all unknown I/O Verification errors.
A device is deleting itself while there is another device beneath it in the driver stack. This may be because the caller has forgotten to call
IoDetachDevice first, or the lower driver may have incorrectly deleted itself.
A driver has attempted to detach from a device object that is not attached to anything. This may occur if detach was called twice on the same device
object. (Device object specified.)
A driver has called IoCallDriver without setting the cancel routine in the IRP to NULL. (IRP specified.)
The caller has passed in NULL as a device object. This is fatal. (IRP specified.)
The caller is forwarding an IRP that is currently queued beneath it. The code handling IRPs returning STATUS_PENDING in this driver appears to
be broken. (IRP specified.)
The caller has incorrectly forwarded an IRP (control field not zeroed). The driver should use IoCopyCurrentIrpStackLocationToNext or
IoSkipCurrentIrpStackLocation. (IRP specified.)
The caller has manually copied the stack and has inadvertently copied the upper layer's completion routine. The driver should use
IoCopyCurrentIrpStackLocationToNext. (IRP specified.)
This IRP is about to run out of stack locations. Someone may have forwarded this IRP from another stack. (IRP specified.)
The caller is completing an IRP that is currently queued beneath it. The code handling IRPs returning STATUS_PENDING in this driver appears to
be broken. (IRP specified.)
The caller of IoFreeIrp is freeing an IRP that is still in use. (Original IRP and IRP in use specified.)
The caller of IoFreeIrp is freeing an IRP that is still in use. (IRP specified.)
The caller of IoFreeIrp is freeing an IRP that is still queued against a thread. (IRP specified.)
The caller of IoInitializeIrp has passed an IRP that was allocated with IoAllocateIrp. This is illegal and unnecessary, and has caused a quota leak.
Check the documentation for IoReuseIrp if this IRP is being recycled.
A PNP IRP has an invalid status. (Any PNP IRP must have its status initialized to STATUS_NOT_SUPPORTED.) (IRP specified.)
A Power IRP has an invalid status. (Any Power IRP must have its status initialized to STATUS_NOT_SUPPORTED.) (IRP specified.)
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
0x210
0x21C
Non-fatal
error
Non-fatal
error
Non-fatal
error
Non-fatal
error
Non-fatal
error
Non-fatal
error
Non-fatal
error
Non-fatal
error
Non-fatal
error
Non-fatal
error
Non-fatal
error
Non-fatal
error
Warning
0x21D
Fatal error
0x21E
Fatal error
0x21F
0x221
Non-fatal
error
Non-fatal
error
Fatal error
0x222
Fatal error
0x223
Fatal error
0x224
Fatal error
0x225
Non-fatal
error
Fatal error
0x211
0x212
0x213
0x214
0x215
0x216
0x217
0x218
0x219
0x21A
0x21B
0x220
0x226
0x227
0x228
0x229
0x22A
0x22B
0x22C
0x22D
0x22E
0x22F
0x230
0x231
0x232
0x233
0x234
0x235
0x236
0x237
Fatal error
Non-fatal
error
Fatal error
Non-fatal
error
Non-fatal
error
Fatal error
Non-fatal
error
Non-fatal
error
Non-fatal
error
Non-fatal
error
Fatal error
Non-fatal
error
Non-fatal
error
Non-fatal
error
Non-fatal
error
Non-fatal
error
Fatal error
A WMI IRP has an invalid status. (Any WMI IRP must have its status initialized to STATUS_NOT_SUPPORTED.) (IRP specified.)
The caller has forwarded an IRP while skipping a device object in the stack. The caller is probably sending IRPs to the PDO instead of to the device
returned by IoAttachDeviceToDeviceStack. (IRP specified.)
The caller has trashed or has not properly copied the IRP's stack. (IRP specified.)
The caller has changed the status field of an IRP it does not understand. (IRP specified.)
The caller has changed the information field of an IRP it does not understand. (IRP specified.)
A non-successful non-STATUS_NOT_SUPPORTED IRP status for IRP_MJ_PNP is being passed down stack. (IRP specified.) Failed PNP IRPs
must be completed.
The previously-set IRP_MJ_PNP status has been converted to STATUS_NOT_SUPPORTED. (IRP specified.)
The driver has not handled a required IRP. The driver must update the status of the IRP to indicate whether or not it has been handled. (IRP
specified.)
The driver has responded to an IRP that is reserved for other device objects elsewhere in the stack. (IRP specified.)
A non-successful non-STATUS_NOT_SUPPORTED IRP status for IRP_MJ_POWER is being passed down stack. (IRP specified.) Failed POWER
IRPs must be completed.
The previously-set IRP_MJ_POWER status has been converted to STATUS_NOT_SUPPORTED. (IRP specified.)
A driver has returned a suspicious status. This is probably due to an uninitialized variable bug in the driver. (IRP specified.)
The caller has copied the IRP stack but not set a completion routine. This is inefficient use IoSkipCurrentIrpStackLocation instead. (IRP
specified.)
An IRP dispatch handler has not properly detached from the stack below it upon receiving a remove IRP. (Device object, dispatch routine, and IRP
specified.)
An IRP dispatch handler has not properly deleted its device object upon receiving a remove IRP. (Device object, dispatch routine, and IRP
specified.)
A driver has not filled out a dispatch routine for a required IRP major function. (IRP specified.)
IRP_MJ_SYSTEM_CONTROL has been completed by someone other than the ProviderId. This IRP should either have been completed earlier or
should have been passed down. (IRP specified, along with the device object where it was targeted.)
An IRP dispatch handler for a PDO has deleted its device object, but the hardware has not been reported as missing in a bus relations query.
(Device object, dispatch routine, and IRP specified.)
A Bus Filter's IRP dispatch handler has detached upon receiving a remove IRP when the PDO is still alive. Bus Filters must clean up in
FastIoDetach callbacks. (Device object, dispatch routine, and IRP specified.)
An IRP dispatch handler for a bus filter has deleted its device object, but the PDO is still present. Bus filters must clean up in FastIoDetach
callbacks. (Device object, dispatch routine, and IRP specified.)
An IRP dispatch handler has returned a status that is inconsistent with the IRP's IoStatus.Status field. (Dispatch handler routine, IRP, IRP's
IoStatus.Status, and returned Status specified.)
An IRP dispatch handler has returned a status that is illegal (0xFFFFFFFF). This is probably due to an uninitialized stack variable. To debug this
error, use the ln (List Nearest Symbols) command with the specified address.
An IRP dispatch handler has returned without passing down or completing this IRP, or someone forgot to return STATUS_PENDING. (IRP
specified.)
An IRP completion routine is in pageable code. (This is never permitted.) (Routine and IRP specified.)
A driver's completion routine has not marked the IRP pending if the PendingReturned field was set in the IRP passed to it. This may cause
Windows to hang, especially if an error is returned by the stack. (Routine and IRP specified.)
A cancel routine has been set for an IRP that is currently being processed by drivers lower in the stack, possibly stomping their cancel routine.
(Routine and IRP specified.)
The physical device object (PDO) has not responded to a required IRP. (IRP specified.)
The physical device object (PDO) has forgotten to fill out the device relation list with the PDO for the TargetDeviceRelation query. (IRP
specified.)
The code implementing the TargetDeviceRelation query has not called ObReferenceObject on the PDO. (IRP specified.)
The caller has completed a IRP_MJ_PNP it didn't understand instead of passing it down. (IRP specified.)
The caller has completed a successful IRP_MJ_PNP instead of passing it down. (IRP specified.)
The caller has completed an untouched IRP_MJ_PNP (instead of passing the IRP down), or non-PDO has failed the IRP using illegal value of
STATUS_NOT_SUPPORTED. (IRP specified.)
The caller has completed an IRP_MJ_POWER it didn't understand instead of passing it down. (IRP specified.)
The caller has completed a successful IRP_MJ_POWER instead of passing it down. (IRP specified.)
The caller has completed an untouched IRP_MJ_POWER (instead of passing the IRP down), or non-PDO has failed the IRP using illegal value of
STATUS_NOT_SUPPORTED. (IRP specified.)
The version field of the query capabilities structure in a query capabilities IRP was not properly initialized. (IRP specified.)
The size field of the query capabilities structure in a query capabilities IRP was not properly initialized. (IRP specified.)
The address field of the query capabilities structure in a query capabilities IRP was not properly initialized to -1. (IRP specified.)
The UI Number field of the query capabilities structure in a query capabilities IRP was not properly initialized to -1. (IRP specified.)
A driver has sent an IRP that is restricted for system use only. (IRP specified.)
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
0x238
Warning
0x239
Warning
0x23A
0x23B
Fatal error
Non-fatal
error
The caller of IoInitializeIrp has passed an IRP that was allocated with IoAllocateIrp. This is illegal, unnecessary, and negatively impacts
performance in normal use. If this IRP is being recycled, see IoReuseIrp in the Windows Driver Kit.
The caller of IoCompleteRequest is completing an IRP that has never been forwarded via a call to IoCallDriver or PoCallDriver. This may be a
bug. (IRP specified.)
A driver has forwarded an IRP at an IRQL that is illegal for this major code. (IRP specified.)
The caller has changed the status field of an IRP it does not understand. (IRP specified.)
The following table lists additional I/O Verification errors that can appear in Windows XP and later. Some of these errors will only be revealed if Enhanced I/O
Verification is activated.
I/O Error Severity
Code
0x23C
Fatal error
0x23D
Non-fatal
error
0x23E
Non-fatal
error
0x23F
Fatal error
0x240
Fatal error
0x241
Fatal error
0x242
Fatal error
0x243
Fatal error
0x244
Fatal error
0x245
0x246
0x247
0x248
0x249
0x24A
0x24B
0x24C
0x24D
Cause of Error
A driver has completed an IRP without setting the cancel routine in the IRP to NULL. (IRP specified.)
A driver has returned STATUS_PENDING but did not mark the IRP pending via a call to IoMarkIrpPending. (IRP specified.)
A driver has marked an IRP pending but didn't return STATUS_PENDING. (IRP specified.)
A driver has not inherited the DO_POWER_PAGABLE bit from the stack it has attached to. (Device object specified.)
A driver is attempting to delete a device object that has already been deleted via a prior call to IoDeleteDevice.
A driver has detached its device object during a surprise remove IRP. (IRP and device object specified.)
A driver has deleted its device object during a surprise remove IRP. (IRP and device object specified.)
A driver has failed to clear the DO_DEVICE_INITIALIZING flag at the end of AddDevice. (Device object specified.)
A driver has not copied either the DO_BUFFERED_IO or the DO_DIRECT_IO flag from the device object it is attaching to. (Device object
specified.)
A driver has set both the DO_BUFFERED_IO and the DO_DIRECT_IO flags. These flags are mutually exclusive. (Device object specified.)
A driver has failed to copy the DeviceType field from the device object it is attaching to. (Device object specified.)
A driver has failed an IRP that cannot legally be failed. (IRP specified.)
A driver has added a device object that is not a PDO to a device relations query. (IRP and device object specified.)
A driver has enumerated two child PDOs that returned identical Device IDs. (Both device objects specified.)
Fatal error
Fatal error
Fatal error
Fatal error
Non-fatal
error
Fatal error A driver has mistakenly called a file I/O function with IRQL not equal to PASSIVE_LEVEL.
Fatal error A driver has completed an IRP_MN_QUERY_DEVICE_RELATIONS request of type TargetDeviceRelation as successful, but did not properly
fill out the request or forward the IRP to the underlying hardware stack. (Device object specified.)
Non-fatal A driver has returned STATUS_PENDING but did not mark the IRP pending by a call to IoMarkIrpPending. (IRP specified.)
error
Fatal error A driver has passed an invalid device object to a function that requires a PDO. (Device object specified.)
Cause
See the description of each code in the Parameters section for a description of the cause.
Resolving the Problem
This bug check can only occur when Driver Verifier has been instructed to monitor one or more drivers. If you did not intend to use Driver Verifier, you should deactivate it.
You might consider removing the driver which caused this problem as well.
If you are the driver writer, use the information obtained through this bug check to fix the bugs in your code.
For full details on Driver Verifier, see the Windows Driver Kit.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
0x2
Parameter 3
Parameter 4
Cause of Error
Duplicate PDO: A specific instance of a driver has enumerated multiple PDOs
with identical device ID and unique IDs.
Invalid PDO: An API which requires a PDO has been called with random
memory, or with an FDO, or with a PDO which hasn't been initialized.
(An uninitialized PDO is one that has not been returned to Plug and Play by
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
QueryDeviceRelation or QueryBusRelations.)
0x3
1: DeviceID
2: UniqueID
3: HardwareIDs
4: CompatibleIDs
0x4
0x5
0x8
0x9
0xA
Driver object
0xB
Related PDO
Reserved
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
If the driver responsible for the error can be identified, its name is printed on the blue screen and stored in memory at the location (PUNICODE_STRING)
KiBugCheckDriver.
Cause
The system has accessed memory in the special pool which was already freed by a driver. This usually indicates a system-driver synchronization problem.
For information about the special pool, consult the Driver Verifier section of the Windows Driver Kit.
Comments
This cannot be protected by a try - except handler it can only be protected by a probe.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
If the driver responsible for the error can be identified, its name is printed on the blue screen and stored in memory at the location (PUNICODE_STRING)
KiBugCheckDriver.
Cause
The driver allocated n bytes of memory from the special pool. Subsequently, the system referenced more than n bytes from this pool. This usually indicates a system-driver
synchronization problem.
For information about the special pool, consult the Driver Verifier section of the Windows Driver Kit.
Comments
This cannot be protected by a try - except handler it can only be protected by a probe.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
If the driver responsible for the error can be identified, its name is printed on the blue screen and stored in memory at the location (PUNICODE_STRING)
KiBugCheckDriver.
Cause
This driver failed to cancel lookaside lists, DPCs, worker threads, or other such items before unload.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
If the driver responsible for the error can be identified, its name is printed on the blue screen and stored in memory at the location (PUNICODE_STRING)
KiBugCheckDriver.
Cause
The driver is referencing session space addresses from the system process context. This probably results from the driver queuing an item to a system worker thread.
This driver needs to comply with Terminal Server's memory management rules.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Cause
The kernel attempted to access pageable memory (or perhaps completely invalid memory) when the IRQL was too high. The ultimate cause of this problem is almost certainly
a driver that has corrupted the system pool.
In most cases, this bug check results if a driver corrupts a large allocation (PAGE_SIZE or larger). Smaller allocations result in bug check 0xC5
(DRIVER_CORRUPTED_EXPOOL).
Resolving the Problem
If you have recently installed any new software, check to see if it is properly installed. Check for updated drivers on the manufacturer's website.
To debug this error, use the special pool option of Driver Verifier. If this fails to reveal the driver that caused the error, use the Global Flags utility to enable the special pool
by pool tag.
For information about the special pool, consult the Driver Verifier section of the Windows Driver Kit.
An alternate method is to open the \\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management registry key. In this
key, create or edit the ProtectNonPagedPool value, and set it equal to DWORD 1. Then reboot. Then the system will unmap all freed nonpaged pool. This will prevent
drivers from corrupting the pool. (This does not protect the pool from DMA hardware, however.)
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Cause
A driver tried to access an address that is pageable (or that is completely invalid) while the IRQL was too high.
This bug check is usually caused by drivers that have used improper addresses.
If the first parameter has the same value as the fourth parameter, and the third parameter indicates an execute operation, this bug check was likely caused by a driver that was
trying to execute code when the code itself was paged out. Possible causes for the page fault include the following:
The function was marked as pageable and was running at an elevated IRQL (which includes obtaining a lock).
The function call was made to a function in another driver, and that driver was unloaded.
The function was called by using a function pointer that was an invalid pointer.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Parameter 3
Parameter 4
Virtual address
being freed
Number of
packets in the
array
0
Wrapper context
Address of
shared memory
signature
In the following instances of this bug check, the meaning of the parameters depends on the message and on the value of Parameter 4.
Parameter 1
Address of the
miniport block
Address of the
miniport block
Address of the
miniport block
Address of the
miniport block
Parameter 2
Address of the miniport
interrupt
Address of the miniport
timer queue
Address of the miniport
interrupt
Address of the miniport
timer queue
Parameter 3
Address of the miniport
timer queue
Address of the miniport
interrupt
Address of the miniport
timer queue
Address of the miniport
interrupt
Parameter
Message and Cause
4
1
Unloading without deregistering interrupt. A miniport driver failed its
initialization without deregistering its interrupt.
2
Unloading without deregistering interrupt. A miniport driver did not deregister
its interrupt during the halt process.
1
Unloading without deregistering timer. A miniport driver failed its initialization
without successfully canceling all its timers.
2
Unloading without deregistering timer. A miniport driver halted without
successfully canceling all its timers.
Comments
This bug check code only occurs on Windows 2000 and Windows XP. In Windows Server 2003 and later, the corresponding code is bug check 0x7C
(BUGCODE_NDIS_DRIVER).
On the checked build of Windows, only the Allocating Shared Memory at Raised IRQL and Completing Reset When One is Not Pending instances of this bug check can
occur. All the other instances of bug check 0xD2 are replaced with ASSERTs. See Breaking Into the Debugger for details.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
2
3
If the driver responsible for the error can be identified, its name is printed on the blue screen and stored in memory at the location (PUNICODE_STRING)
KiBugCheckDriver.
Cause
This bug check is usually caused by drivers that have incorrectly marked their own code or data as pageable.
Resolving the Problem
To begin debugging, use a kernel debugger to get a stack trace.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
If the driver responsible for the error can be identified, its name is printed on the blue screen and stored in memory at the location (PUNICODE_STRING)
KiBugCheckDriver.
Cause
This driver failed to cancel lookaside lists, DPCs, worker threads, or other such items before unload. Subsequently, the system attempted to access the driver's former location
at a raised IRQL.
Resolving the Problem
To begin debugging, use a kernel debugger to get a stack trace. If the driver that caused the error has been identified, activate Driver Verifier and attempt to replicate this bug.
For full details on Driver Verifier, see the Windows Driver Kit.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
0: Read
1: Write
3
4
If the driver responsible for the error can be identified, its name is printed on the blue screen and stored in memory at the location (PUNICODE_STRING)
KiBugCheckDriver.
Cause
The Driver Verifier Special Pool option has caught the driver accessing memory which was earlier freed.
For information about the special pool, consult the Driver Verifier section of the Windows Driver Kit.
Comments
This cannot be protected by a try - except handler it can only be protected by a probe.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
If the driver responsible for the error can be identified, its name is printed on the blue screen and stored in memory at the location (PUNICODE_STRING)
KiBugCheckDriver.
Cause
The driver allocated n bytes of memory and then referenced more than n bytes. The Driver Verifier Special Pool option detected this violation.
For information about the special pool, consult the Driver Verifier section of the Windows Driver Kit.
Comments
This cannot be protected by a try - except handler it can only be protected by a probe.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
3
4
0
0
Comments
The driver that caused the error can be determined from the stack trace.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Parameter 3
The address of the memory
descriptor list
The address of the memory
descriptor list
The address of the internal lock
tracking structure
The address of the memory
descriptor list
Parameter 4
The number of pages locked for the
current process
The number of pages locked for the
current process
The address of the memory
descriptor list
0
Cause of Error
The MDL is being inserted twice on the same
process list.
The MDL is being inserted twice on the
systemwide list.
The MDL was found twice in the process list
when being freed.
The MDL was found in the systemwide list on
free after it was removed.
Cause
The error is indicated by the value of Parameter 1.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Cause of Error
The mapping being freed is a duplicate.
The first page of the mapped MDL has changed since the MDL was mapped.
The start virtual address in the MDL being freed has changed since the MDL was mapped.
The MDL being freed was never (or is currently not) mapped.
(Windows 2000 only) The caller is asking to free several mappings, but at least one of them
is not allocated.
(Windows 2000 only) The caller is asking to allocate zero mappings.
0x0C
0x0D
0x0E
0x0F
0x10
0x11
The type of mapping (Windows 2000 only) The mapping list was already corrupt at the time of this allocation.
pool requested
The corrupt mapping is located below the lowest possible mapping address.
The type of mapping (Windows 2000 only) The mapping list was already corrupt at the time of this allocation.
pool requested
The corrupt mapping is located above the lowest possible mapping address.
The type of mapping (Windows 2000 only) The caller is trying to free zero mappings.
pool
The type of mapping (Windows 2000 only) The caller is trying to free mappings, but the guard mapping has been
pool
overwritten.
The type of mapping (Windows 2000 only) The caller is trying to free a non-existent mapping. The non-existent
pool being freed
mapping is located below the lowest possible mapping address.
The type of mapping (Windows 2000 only) The caller is trying to free a non-existent mapping. The non-existent
pool being freed
mapping is located above the highest possible mapping address.
The type of mapping (Windows 2000 only) The caller is trying to free a non-existent mapping. The non-existent
pool being freed
mapping is at the base of the mapping address space.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
0x100
The number of
mappings being
requested
0x101
0x102
0x103
0x104
0x105
0x107
0x108
0x109
0x10A
0x10B
0x10C
0x200
0x201
0x202
0x300
0x301
0x303
0x304
0x305
0x306
0x400
The owner's
identifying tag
Reserved
The owner's
identifying tag
Reserved
The number of
mappings to unmap
(Windows XP and later only) A caller is trying to free a mapping address range that it does
not own.
(Windows XP and later only) The mapping address space that the caller is trying to free is
apparently empty.
(Windows XP and later only) The mapping address space that the caller is trying to free is
still reserved. MmUnmapReservedMapping
must be called before MmFreeMappingAddress.
(Windows XP and later only) The caller is attempting to map an MDL to a mapping
address space that it does not own.
(Windows XP and later only) The caller is attempting to map an MDL to an invalid
mapping address space. The caller has mostly likely specified an invalid address.
(Windows XP and later only) The caller is attempting to map an MDL to a mapping
address space that has not been properly reserved. The caller should have called
MmUnmapReservedMapping prior to calling
MmMapLockedPagesWithReservedMapping
(Windows XP and later only) The caller is attempting to unmap a locked mapping address
space that it does not own.
(Windows XP and later only) The caller is attempting to unmap a locked virtual address
space that is apparently empty.
(Windows XP and later only) The caller is attempting to unmap more mappings than
actually exist in the locked mapping address space.
(Windows XP and later only) The caller is attempting to unmap a portion of a locked
virtual address space that is not currently mapped.
(Windows XP and later only) The caller is not unmapping the entirety of the locked
mapping address space.
(Windows XP and later only) The caller is attempting to reserve a mapping address space
that contains no mappings.
The number of
(Windows XP and later only) One of the mappings that the caller is attempting to reserve
mappings to reserve has already been reserved.
The number of
mappings to unmap
The number of
mappings to unmap
0
(Windows XP and later only) The caller is attempting to release a mapping address space
that contains no mappings.
0
0
(Windows XP and later only) The caller is attempting to release a mapping that it is not
permitted to release.
The number of
0
(Windows XP and later only) The caller is attempting to release a mapping address range
mappings to release
that was not reserved.
The number of
0
(Windows XP and later only) The caller is attempting to release a mapping address range
mappings to release
that begins in the middle of a different allocation.
The number of
The number of
(Windows XP and later only) The caller is attempting to release the wrong number of
mappings that the caller mappings that should mappings.
is trying to release
be released
The free mapping
The number of
(Windows XP and later only) One of the mappings that the caller is attempting to release is
address
mappings to release already free.
The number of pages to 0
(Windows XP and later only) The caller is trying to free an I/O space mapping that the
be freed
system is unaware of.
0
Cause
The error is indicated by the value of Parameter 1.
A stack trace will identify the driver that caused the error.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Description
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
1
2
3
Memory referenced
IRQL
0: Read
1: Write
Cause
A driver tried to access pageable (or completely invalid) memory at too high of an IRQL. This bug check is almost always caused by drivers that have corrupted system PTEs.
Resolving the Problem
If this bug check occurs, the culprit can be detected by editing the registry. In the
\\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management registry key, create or edit the TrackPtes value, and set
it equal to DWORD 3. Then reboot. The system will then save stack traces, and if the driver commits the same error, the system will issue bug check 0xDA
(SYSTEM_PTE_MISUSE). Then the stack trace will identify the driver that caused the error.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Cause
A worker thread was impersonating another process, and failed to disable impersonation before it returned.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The MANUALLY_INITIATED_CRASH bug check has a value of 0x000000E2. This indicates that the user deliberately initiated a crash dump from either the kernel
debugger or the keyboard.
Parameters
None
Comments
For more information about manually-initiated crash dumps, see Forcing a System Crash. .
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
1
0x00
0x01
0x02
0x03
0x04
0x05
0x06
0x07
0x08
0x09
0x0A
0x0B
0x0C
0x0D
0x0E
0x0F
0x10
0x11
0x13
0x14
0x15
0x16
0x18
0x19
0x1B
0x1D
0x1E
0x1F
0x20
0x21
The performance counter has decreased. The old and new values of the counter are displayed.
The performance counter has increased too fast. The counter value is displayed in the debugger.
The driver freed too many DMA common buffers. Usually this means it freed the same buffer two times.
The driver freed too many DMA adapter channels. Usually this means it freed the same adapter channel two times.
The driver freed too many DMA map registers. Usually this means it freed the same map register two times. The number of active map registers is displayed.
The driver freed too many DMA scatter/gather lists. Usually this means it freed the same scatter/gather list two times. The number of lists allocated and the
number of lists freed is displayed.
The driver tried to release the adapter without first freeing all its common buffers. The adapter address and the number of remaining buffers is displayed.
The driver tried to release the adapter without first freeing all adapter channels, common buffers, or scatter/gather lists. The adapter address and the number of
remaining items is displayed.
The driver tried to release the adapter without first freeing all map registers. The adapter address and the number of remaining map registers is displayed.
The driver tried to release the adapter without first freeing all its scatter/gather lists. The adapter address and the number of remaining scatter/gather lists is
displayed.
HV_TOO_MANY_ADAPTER_CHANNELSThe driver has allocated too many adapter channels at the same time. . (Only one adapter channel is permitted per
adapter.)
The driver tried to allocate too many map registers at the same time. The number requested and the number allowed are displayed.
The driver did not flush its adapter buffers. The number of bytes that the driver tried to map and the maximum number of bytes allowed are displayed.
The driver tried a DMA transfer without locking the buffer. The buffer in question was in paged memory. The address of the MDL is displayed.
The driver or the hardware wrote outside its allocated DMA buffer. The nature of the error (overrun or underrun) is displayed, as well as the relevant addresses.
The driver tried to free its map registers while some were still mapped. The number of map registers still mapped is displayed.
The driver has too many outstanding reference counts for the adapter. The number of reference counts and the adapter address are displayed.
The driver called a DMA routine at an improper IRQL. The required IRQL and the actual IRQL are displayed.
The driver called a DMA routine at an improper IRQL. The required IRQL and the actual IRQL are displayed.
The driver tried to allocate too many map registers. The number requested and the number allowed are displayed.
The driver tried to flush a buffer that is not mapped. The address of the buffer is displayed.
The driver tried a DMA operation by using an adapter that was already released and no longer exists. The adapter address is displayed.
The driver passed a null DMA_ADAPTER value to a HAL routine.
The driver passed an address and MDL to a HAL routine. However, this address is not within the bounds of this MDL. The address passed and the address of
the MDL are displayed.
The driver tried to map an address range that was already mapped. The address range and the current mapping for that range are displayed.
The driver called HalGetAdapter. This function is obsolete you must use IoGetDmaAdapter instead.
HV_BAD_MDLThe driver referenced an invalid system address either before the first MDL, or after the end of the first MDL, or by using a transfer length
that is longer than the MDL buffer and crosses a page boundary within the MDL. . Either the invalid address and the first MDL address, or the MDL address
and the extra transfer length are displayed.
The driver tried to flush a map register that hasn't been mapped. The map register base, flushing address, and MDL are displayed.
The driver tried to map a zero-length buffer for transfer.
Cause
See the description of each code in the Parameters section for a description of the cause.
Resolving the Problem
This bug check can only occur when Driver Verifier has been instructed to monitor one or more drivers. If you did not intend to use Driver Verifier, you should deactivate it.
You might also consider removing the driver that caused this problem.
If you are the driver writer, use the information obtained through this bug check to fix the bugs in your code.
The Driver Verifier DMA Verification option is only available in Windows XP and later versions. For full details on Driver Verifier, see the Windows Driver Kit.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Parameter 2
Parameter 3
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
Cause of Error
9/18/2010
Introduction
0x0
0x1
0x2
The current
IRQL
The current
thread
The saved context flags field is invalid. Either FLOAT_SAVE_VALID is not set, or some
reserved bits are nonzero.
The current processor's IRQL is not the same as when the floating-point context was
saved.
The saved context does not belong to the current thread.
Cause
While restoring the previously-saved floating-point state for a thread, the state was found to be invalid.
Parameter 1 indicates which validity check failed.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The THREAD_STUCK_IN_DEVICE_DRIVER bug check has a value of 0x000000EA. This indicates that a thread in a device driver is endlessly spinning.
Parameters
The following parameters are displayed on the blue screen.
Parameter
Description
1
A pointer to the stuck thread object
2
A pointer to the DEFERRED_WATCHDOG object
3
A pointer to the offending driver name
4
In the kernel debugger: The number of times the "intercepted" bug check 0xEA was hit
On the blue screen: 1
Cause
A device driver is spinning in an infinite loop, most likely waiting for hardware to become idle.
This usually indicates problem with the hardware itself, or with the device driver programming the hardware incorrectly. Frequently, this is the result of a bad video card or a
bad display driver.
Resolving the Problem
Use the .thread (Set Register Context) command together with Parameter 1. Then use kb (Display Stack Backtrace) to find the location where the thread is stuck.
If the kernel debugger is already connected and running when Windows detects a time-out condition. Then DbgBreakPoint will be called instead of KeBugCheckEx. A
detailed message will be printed to the debugger. See Sending Output to the Debuggefor more information.
This message will include what would have been the bug check parameters. Because no actual bug check was issued, the .bugcheck (Display Bug Check Data) command
will not be useful. The four parameters can also be retrieved from Watchdog's global variables by using dd watchdog!g_WdBugCheckData L5" on a 32-bit system, or
dq watchdog!g_WdBugCheckData L5" on a 64-bit system.
Debugging this error in an interactive manner such as this will enable you to find an offending thread, set breakpoints in it, and then use g (Go) to return to the spinning code
to debug it further.
On multiprocessor machines (OS build 3790 or earlier), you can hit a time out if the spinning thread is interrupted by a hardware interrupt and an ISR or DPC routine is
running at the time of the bug check. This is because the time out's work item can be delivered and handled on the second CPU and the same time. If this occurs, you must
look deeper at the offending thread's stack to determine the spinning code which caused the time out to occur. Use the dds (Display Words and Symbols) command to do
this.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Windows Vista and later versions: The most recent modified write error status
Cause
The file system driver stack has deadlocked and most of the modified pages are destined for the file system. Because the file system is non-operational, the system has crashed
because none of the modified pages can be reused without losing data. Any file system or filter driver in the stack may be at fault.
To see general memory statistics, use the !vm 3 extension.
This bug check can occur for any of the following reasons:
A driver has blocked, deadlocking the modified or mapped page writers. Examples of this include mutex deadlocks or accesses to paged out memory in file system
drivers or filter drivers. This indicates a driver bug.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
A storage driver is not processing requests. Examples of this are stranded queues and unresponsive drives. This indicates a driver bug.
If Parameter 1 or Parameter 2 is large, this is a possibility. Use !process 0 7.
Windows Server 2003 only: Not enough pool is available for the storage stack to write out modified pages. This indicates a driver bug.
If Parameter 3 is small, this is a possibility. Use !vm and !poolused 2.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Parameter
Description
1
The process object
2
Reserved
3
Reserved
4
Reserved
Reserved
0x1001
Delay, in microseconds
Reserved
Reserved
0x1002
Address of miniport's
HW_DEVICE_EXTENSION
Duration of the
routine, in
microseconds
Parameter 3
Parameter 4
Cause of Error
The miniport driver passed bad arguments to
ScsiPortInitialize.
The miniport driver called ScsiPortStallExecution and
specified a delay greater than 0.1 second, stalling the
processor too long.
A miniport routine called by the port driver took longer than
0.5 second to execute.
(0.5 seconds is the limit for most routines. However, the
HwInitialize routine is allowed 5 seconds, and the
FindAdapter routine is exempt.)
0x1003
0x1004
0x1005
0x1006
Address of miniport's
HW_DEVICE_EXTENSION
Address of the SRB
Address of miniport's
HW_DEVICE_EXTENSION
Address of miniport's
HW_DEVICE_EXTENSION
Reserved
Address of miniport's
HW_DEVICE_EXTENSION
Address of
LOGICAL_UNIT_EXTENSION
Invalid virtual address
Reserved
Reserved
Reserved
Address of
ADAPTER_EXTENSION
Address of miniport's
HW_DEVICE_EXTENSION
Reserved
The reset hold period for the bus ended, but the miniport
driver still has outstanding requests.
Cause
See the description of each code in the Parameters section for an explanation of the cause.
Resolving the Problem
This bug check can only occur when Driver Verifier has been instructed to monitor one or more drivers. If you did not intend to use Driver Verifier, you should deactivate it.
You might consider removing the driver which caused this problem as well.
If you are the driver writer, use the information obtained through this bug check to fix the bugs in your code.
The Driver Verifier SCSI Verification option is only available in Windows XP and later. For full details on Driver Verifier, see the Windows Driver Kit.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Parameter
Description
1
The total number of dirty pages
2
The number of dirty pages destined for the page file
3
Windows Server 2003 only: The size of the nonpaged pool available at the time of the bug check (in pages)
Windows Vista and later: Reserved
4
Cause
Windows attempted to shut down, but there were no free pages available to continue operations.
Because applications were not terminated and drivers were not unloaded, they continued to access pages even after the modified writer had terminated. This causes the system
to run out of pages, since the page files could be used.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Cause
Several processes and threads are necessary for the operation of the system. When they are terminated for any reason, the system can no longer function.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Parameter 3
Parameter 4
Cause of error
An internal object ran out of space, and the system is unable to allocate new
space.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
0x68
0x6A
0x6B
0x6C
0x6D
0x6E
0
0
BackPocket List
Address of the
CONTEXT_NODE
structure
Address of the
Address of the
minifilter's context CONTEXT_NODE
structure
structure
Thread
Thread
0
Cause
The cause of the problem is indicated by the value of Parameter 1. See the table in the Parameters section.
Resolving the Problem
If Parameter 1 equals 0x66, you can debug this problem by verifying that your minifilter driver has registered a post-operation callback for this operation. The current
operation can be found in the callback data structure. (See Parameter 2.) Use the !fltkd.cbd debugger extension.
If Parameter 1 equals 0x67, you should verify that you do not have a nonpaged pool leak somewhere in the system.
If Parameter 1 equals 0x6A, make sure that your minifilter driver does not reference this file object (see Parameter 2) to get a handle at any point during your minifilter's
processing of this operation.
If Parameter 1 equals 0x6B or 0x6C, then a non-recoverable internal state error has occurred which will cause the operating system to bug check.
If Parameter 1 equals 0x6D, make sure that your minifilter driver does not call FltReleaseContext too many times for the given context (see Parameter 2).
If Parameter 1 equals 0x6E, make sure that your minifilter driver does not call FltReferenceContext after the given context has been deleted (see Parameter 2).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Description
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
1
2
3
4
Cause
A driver overran a stack-based buffer (or local variable) in a way that would have overwritten the function's return address and jumped back to an arbitrary address when the
function returned.
This is the classic "buffer overrun" hacking attack. The system has been brought down to prevent a malicious user from gaining complete control of it.
Resolving the Problem
Use the kb (Display Stack Backtrace) command to get a stack trace.
The last routine on the stack before the buffer overrun handlers and bug check call is the one that overran its local variable.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
NTSTATUS code
0
0
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
STATUS_REPARSE should be returned only for IRP_MJ_CREATE requests with trailing names, as that indicates the driver is supporting name spaces.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Parameter 4
Cause of Error
Line number of the work item check A work item is invalid. This will eventually result in thread pool
within the file
corruption and an access violation.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
This bug check usually occurs because the component that owns the modified non-writeable pages failed to write out these pages after marking the relevant files as "do not
write" to memory management. This indicates a driver bug.
Resolving the Problem
For more information about which driver is causing the problem, use the !vm 3 extension, followed by !memusage 1 .
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Reserved
Address of the USB request block
(URB) that caused the error
Reserved
0x4
Reserved
0x5
Ox6
0x7
0x8
Parameter 4
Cause of Error
Reserved
File name
Reserved
Reserved
Cause
See the description of each code in the Parameters section for an explanation of the cause.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The LOADER_BLOCK_MISMATCH bug check has a value of 0x00000100. This indicates that either the loader block is invalid, or it does not match the system that is
being loaded.
Parameters
The following parameters are displayed on the blue screen.
Parameter
Description
1
3
2
The size of the loader black extension
3
The major version of the loader block
4
The minor version of the loader block
Cause of error
The MUP could not locate the file context that corresponds to a file object. This typically
indicates that the MUP is seeing an I/O request for a file object for which MUP did not see a
corresponding IRP_MJ_CREATE request. The likely cause of this bug check is a filter driver
error.
0x2
A file context is known to exist for the file object, but was not what was expected (for example,
it might be NULL).
0x3
The address of The IRP completion The driver object of the The IRP completion status was unexpected or invalid.
the IRP context. status code.
UNC provider that
This bug check occurs only when you are using a Checked Build of Windows and should only
completed the IRP
be caused by file system filter drivers that are attached to legacy network redirectors. Legacy
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
(might be NULL).
0x4
Address of the
IRP
redirectors use FsRtlRegisterUncProvider to register with MUP. This bug check detects filter
drivers that return an NTSTATUS that is not STATUS_SUCCESS in IRP_MJ_CLEANUP or
IRP_MJ_CLOSE requests.
The file context for the An I/O operation was started on a file object before the create request for the file object was
file object
completed.
Comments
The MUP maintains context information on a per-file object basis for all file objects it handles.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Enable Driver Verifier for any unsigned drivers. Remove them or disable them one by one until the erring driver is identified.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Cause
One possible cause of this bug check is disk corruption. Corruption in the third-party file system or bad blocks (sectors) on the hard disk can induce this error. Corrupted SCSI
and IDE drivers can also adversely affect the Windows operating systems ability to read and write to disk, thus causing the error.
Another possible cause is depletion of nonpaged pool memory. If the nonpaged pool is completely depleted, this error can stop the system.
Resolving the Problem
To debug this problem: Use the .cxr (Display Context Record) command with Parameter 3, and then use kb (Display Stack Backtrace).
To resolve a disk corruption problem: Check Event Viewer for error messages from SCSI, IDE, or other disk controllers in the system that might help pinpoint the device or
driver that is causing the error. Try disabling any virus scanners, backup programs, or disk defragmenter tools that continually monitor the system. You should also run
hardware diagnostics supplied by the file system or the file system filter manufacturer.
To resolve a nonpaged pool memory depletion problem: Add new physical memory to the computer. This will increase the quantity of nonpaged pool memory available to the
kernel.
2009 Microsoft Corporation
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
2
3
4
0
The address of the ECP.
The starting address of the ECP list.
0x4
0x5
0x6
0x7
0x8
0x9
0xA
Parameter 3
Reserved
Reserved
WDFREQUEST handle
Cause of Error
A framework-based driver has timed out during a power operation. This typically
means that the device stack did not set the DO_POWER_PAGABLE bit and a
driver attempted a pageable operation after the paging device stack was powered
down.
An attempt is being made to acquire a lock that is currently being held.
Windows Driver Framework Verifier has encountered a fatal error. In particular,
an I/O request was completed, but a framework request object cannot be deleted
because there are outstanding references to the input buffer, the output buffer, or
both.
Reserved
The number of
outstanding
references that
remain on both
buffers
Reserved
The caller's address A NULL parameter was passed to a function that required a non-NULL value.
The handle value passed in
Reserved
A framework object handle of the incorrect type was passed to a framework
object method.
See table below.
The handle of the framework object
Reserved
A driver attempted to delete a framework object incorrectly by calling
WdfObjectDereference to delete a handle instead of calling WdfObjectDelete.
The handle of the DMA transaction object
Reserved
An operation occurred on a DMA transaction object while it was not in the
correct state.
Currently unused.
A pointer to a WDF_QUEUE_FATAL_ERROR_DATA Reserved
A fatal error has occurred while processing a request that is currently in the
structure
queue.
0xB
0xC
WDFDEVICE handle
0xD
WDFDEVICE handle
0xE
0xF
Reserved
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
If Parameter 1 is equal to 0x6, then a fatal error was made in handling a WDF request. In this case, Parameter 2 further specifies the type of fatal error that has been made, as
defined by the enumeration WDF_REQUEST_FATAL_ERROR.
Parameter
2
0x1
The address of the IRP
Parameter 3
0x2
0x3
0x4
Cause of Error
No more I/O stack locations are
available to format the underlying
IRP.
An attempt was made to format a
framework request object that did
not contain an IRP.
The driver attempted to send a
framework request that has already
been sent to an I/O target.
The driver has completed a
framework request, but has written
more bytes to the output buffer
than are specified in the IRP.
If Parameter 1 is equal to 0xB, then an attempt to acquire or release a lock was invalid. In this case, Parameter 3 further specifies the error that has been made.
Parameter 2
The handle value
A WDF spin lock
handle
Parameter
Cause of Error
3
0x0
A handle passed to WdfObjectAcquireLock or WdfObjectReleaseLock represents an object that does not support synchronization
locks.
0x1
The spin lock is being released by a thread that did not acquire it.
Cause
See the description of each code in the Parameters section for an explanation of the cause.
Resolving the Problem
Typically, the dump file will yield further information on the driver that caused this bug check.
If Parameter 1 is equal to 0x2, examine the callers stack to determine the lock in question.
If Parameter 1 is equal to 0x3, the driver's Kernel-Mode Driver Framework error log will include details about the outstanding references.
If Parameter 1 is equal to 0x4, use the ln debugger command with the value of Parameter 3 as its argument to determine which function requires a non-NULL parameter.
If Parameter 1 is equal to 0x7, use the !wdfkd.wdfhandle Parameter 2 extension command to determine the handle type.
If Parameter 1 is equal to 0xA, then the WDF_QUEUE_FATAL_ERROR_DATA structure will indicate either the problematic request or the queue handle. It will also
indicate the NTSTATUS, if not STATUS_SUCCESS, when available.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
0xD
0xE
0xF
0x10
0x11
0x12
0x13
0x14
0x15
0x16
0x17
0x18
0x19
0x1A
0x1B
Cause
This bug check is usually caused by a video driver behaving improperly.
Resolving the Problem
If the problem persists, check Windows Update for an updated video driver.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The MSRPC_STATE_VIOLATION bug check has a value of 0x00000112. This indicates that the Msrpc.sys driver has initiated a bug check.
Parameters
The following parameters are displayed on the blue screen. Parameters 1 and 2 are the only parameters of interest. Parameter 1 indicates the state violation type; the value for
Parameter 2 is determined by the value of Parameter 1.
Parameter
Parameter 2
1
0x01
The exception code
0x02
The error
0x03
The session to the server
0x04
and
0x05
0x06
0x07
0x08
0x09
0x0A
0x0B
0x0C
and
0x0E
0x0F
0x15
0x16
0x17
0x18
Cause of Error
An attempt was made to bind a remote procedure call (RPC) handle a second time.
An attempt was made to perform an operation on a binding handle that was not bound.
An attempt was made to set security information on a binding handle that was already bound.
An attempt was made to set an option on a binding handle that was already bound.
An attempt was made to cancel an invalid asynchronous remote procedure call.
An attempt was made to push on an asynchronous pipe call when it was not expected.
An attempt was made to push on an asynchronous pipe without waiting for notification.
Cause
The most common cause of this bug check is that the caller of the Msrpc.sys driver violated the state semantics for such a call.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
0x1
0x2
0x3
0x4
Address of
WHEA_ERROR_RECORD
structure.
Address of
WHEA_ERROR_RECORD
structure.
Address of
WHEA_ERROR_RECORD
structure.
Address of
Parameter 3
Parameter 4
Cause of error
High 32 bits of MCi_STATUS Low 32 bits of MCi_STATUS A machine check exception occurred.
MSR for the MCA bank that MSR for the MCA bank that
had the error.
had the error.
These parameter descriptions apply if the processor is based on
the x64 architecture, or the x86 architecture that has the MCA
feature available (for example, Intel Pentium Pro, Pentium IV,
or Xeon).
Reserved.
Reserved.
Reserved.
Reserved.
Reserved.
Reserved.
Reserved
Reserved.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
0x5
0x6
0x7
0x8
0x9
0xA
0xB
WHEA_ERROR_RECORD
structure.
Address of
WHEA_ERROR_RECORD
structure.
Address of
WHEA_ERROR_RECORD
structure
Address of
WHEA_ERROR_RECORD
structure.
Address of
WHEA_ERROR_RECORD
structure
Address of
WHEA_ERROR_RECORD
structure.
Address of
WHEA_ERROR_RECORD
structure
Address of
WHEA_ERROR_RECORD
structure.
Reserved.
Reserved.
Reserved.
Reserved.
Reserved.
Reserved.
Reserved.
Reserved.
Reserved.
Reserved.
Reserved.
Reserved.
Comments
Parameter 1 identifies the type of error source that reported the error. Parameter 2 holds the address of the WHEA_ERROR_RECORD structure that describes the error
condition.
For information about WHEA, see Windows Hardware Error Architecture Design Guide within the WDK documentation .
Note This bug check is not supported in Windows versions prior to Windows Vista. Instead, machine check exceptions are reported through bug check 0x9C.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Description
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
1
2
3
4
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Mismatched system files can also cause this error. This can occur if you have restored your hard disk from a backup. Some backup programs might skip restoring system files
that they determine are in use.
Resolving the Problem
Running the kernel debugger is not useful in this situation because the actual error occurred in a user-mode process.
Resolving an error in a user-mode device driver, system service, or third-party application: Because bug check 0xC000021A occurs in a user-mode process, the most
common culprits are third-party applications. If the error occurred after the installation of a new or updated device driver, system service, or third-party application, the new
software should be removed or disabled. Contact the manufacturer of the software about a possible update.
If the error occurs during system startup, restart your computer, and press F8 at the character-based menu that displays the operating system choices. At the resulting Windows
Advanced Options menu, choose the Last Known Good Configuration option. This option is most effective when only one driver or service is added at a time. If this does
not resolve the error, try manually removing the offending software. If the system partition is formatted with file allocation table (FAT), use an MS-DOS startup disk to gain
access to the computer's hard disk. If the system partition is formatted with NTFS file system, you might be able to use Safe Mode to rename or delete the faulty software. If
the faulty software is used as part of the system startup process in Safe Mode, you need to start the computer using the Recovery Console in order to access the file. If a newly
installed piece if hardware is suspected, remove it to see if this resolves the issue.
Try running the Emergency Recovery Disk (ERD) and allow the system to repair any errors that it detects.
Resolving a mismatched system file problem: If you have recently restored your hard disk from a backup, check if there is an updated version of the Backup/Restore program
available from the manufacturer. Make sure the latest Windows Service Pack is installed.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
different capacities, and more importantly, in different formats (single inline memory modules SIMM or dual inline memory modules DIMM). The electrical
contacts can be either gold or tin and it is not wise to mix these contact types.
If you experience the same error message after reinstalling the new RAM, run hardware diagnostics supplied by the system manufacturer, especially the memory scanner. For
details on these procedures, see the owner's manual for your computer.
When you can log on to the system again, check the System Log in Event Viewer for additional error messages that might help pinpoint the device or driver that is causing the
error.
Disabling memory caching of the BIOS might also resolve this error.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Processor Architecture
This section includes:
The x86 Processor
The x64 Processor
The Itanium Processor
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
x86 Architecture
The Intel x86 processor uses complex instruction set computer (CISC) architecture, which means there is a modest number of special-purpose registers instead of large
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
quantities of general-purpose registers. It also means that complicated special-purpose instructions will predominate.
The x86 processor traces its heritage at least as far back as the 8-bit Intel 8080 processor. Many peculiarities in the x86 instruction are due to the backward compatibility with
that processor (and with its Zilog Z-80 variant).
Microsoft Win32 uses the x86 processor in 32-bit flat mode. This documentation will focus only on the flat mode.
Registers
The x86 architecture consists of the following unprivileged integer registers:
eax Accumulator
ebx Base register
ecx Count register
edx Double-precision register
esi Source index register
edi Destination index register
ebp Base pointer register
esp Stack pointer
All integer registers are 32 bit. However, many of them have 16-bit or 8-bit subregisters.
ax Low 16 bits of eax
bx Low 16 bits of ebx
cx Low 16 bits of ecx
dx Low 16 bits of edx
si Low 16 bits of esi
di Low 16 bits of edi
bp Low 16 bits of ebp
sp Low 16 bits of esp
al Low 8 bits of eax
ah High 8 bits of ax
bl Low 8 bits of ebx
bh High 8 bits of bx
cl Low 8 bits of ecx
ch High 8 bits of cx
dl Low 8 bits of edx
dh High 8 bits of dx
Operating on a subregister affects only the subregister and none of the parts outside the subregister. For example, storing to the ax register leaves the high 16 bits of the eax
register unchanged.
When using the ? (Evaluate Expression) command, registers should be prefixed with an "at" sign ( @ ). For example, you should use ? @ax rather than ? ax. This ensures
that the debugger recognizes ax as a register rather than a symbol.
However, the (@) is not required in the r (Registers) command. For instance, r ax=5 will always be interpreted correctly.
Two other registers are important for the processor's current state.
eip instruction pointer
flags flags
The instruction pointer is the address of the instruction being executed.
The flags register is a collection of single-bit flags. Many instructions alter the flags to describe the result of the instruction. These flags can then be tested by conditional jump
instructions. See x86 Flags for details.
Calling Conventions
The x86 architecture has several different calling conventions. Fortunately, they all follow the same register preservation and function return rules:
Functions must preserve all registers, except for eax, ecx, and edx, which can be changed across a function call, and esp, which must be updated according to the
calling convention.
The eax register receives function return values if the result is 32 bits or smaller. If the result is 64 bits, then the result is stored in the edx:eax pair.
Win32 (__stdcall)
Function parameters are passed on the stack, pushed right to left, and the callee cleans the stack.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
stack.
__fastcall
The first two DWORD-or-smaller arguments are passed in the ecx and edx registers. The remaining parameters are passed on the stack, pushed right to left. The callee
cleans the stack.
__cdecl
Function parameters are passed on the stack, pushed right to left, and the caller cleans the stack. The __cdecl calling convention is used for all functions with variablelength parameters.
x86 Flags
In the preceding example, the two-letter codes at the end of the second line are flags. These are single-bit registers and have a variety of uses.
The following table lists the x86 flags:
Flag Flag Name
Code
of
Overflow Flag
Value
Flag
Status
Status Description
0
nv
No overflow
1
ov
Overflow
df
Direction Flag 0
up
Direction up
1
dn
Direction down
if
Interrupt Flag 0
di
Interrupts disabled
1
ei
Interrupts enabled
sf
Sign Flag
0
pl
Positive (or zero)
1
ng
Negative
zf
Zero Flag
0
nz
Nonzero
1
zr
Zero
af
Auxiliary Carry 0
na
No auxiliary carry
Flag
1
ac
Auxiliary carry
pf
Parity Flag
0
pe
Parity even
1
po
Parity odd
cf
Carry Flag
0
nc
No carry
1
cy
Carry
tf
Trap Flag
If tf equals 1, the processor will raise a STATUS_SINGLE_STEP exception after the execution of one instruction. This flag is used by a debugger to
implement single-step tracing. It should not be used by other applications.
iopl I/O Privilege
This is a two-bit integer, with values between zero and 3. It is used by the operating system to control access to hardware. It should not be used by
Level
applications.
When registers are displayed as a result of some command in the Debugger Command window, it is the flag status that is displayed. However, if you want to change a flag
using the r (Registers) command, you should refer to it by the flag code.
In the Registers window of WinDbg, the flag code is used to view or alter flags. The flag status is not supported.
Here is an example. In the preceding register display, the flag status ng appears. This means that the sign flag is currently set to 1. To change this, use the following command:
r sf=0
This sets the sign flag to zero. If you do another register display, the ng status code will not appear. Instead, the pl status code will be displayed.
The Sign Flag, Zero Flag, and Carry Flag are the most commonly-used flags.
Conditions
A condition describes the state of one or more flags. All conditional operations on the x86 are expressed in terms of conditions.
The assembler uses a one or two letter abbreviation to represent a condition. A condition can be represented by multiple abbreviations. For example, AE ("above or equal") is
the same condition as NB ("not below"). The following table lists some common conditions and their meaning.
Condition Name Flags
Meaning
Z
ZF=1 Result of last operation was zero.
NZ
ZF=0 Result of last operation was not zero.
C
CF=1 Last operation required a carry or borrow. (For unsigned integers, this indicates overflow.)
NC
CF=0 Last operation did not require a carry or borrow. (For unsigned integers, this indicates overflow.)
S
SF=1 Result of last operation has its high bit set.
NS
SF=0 Result of last operation has its high bit clear.
O
OF=1 When treated as a signed integer operation, the last operation caused an overflow or underflow.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
NO
OF=0 When treated as signed integer operation, the last operation did not cause an overflow or underflow.
Conditions can also be used to compare two values. The cmp instruction compares its two operands, and then sets flags as if subtracted one operand from the other. The
following conditions can be used to check the result of cmp value1, value2.
Condition Name
Flags
Meaning after a CMP operation.
E
ZF=1
value1 == value2.
NE
ZF=0
value1 != value2.
GE
SF=OF
value1 >= value2.
NL
Values are treated as signed integers.
LE
ZF=1 or SF!=OF value1 <= value2. Values are treated as signed integers.
NG
G
ZF=0 and SF=OF value1 > value2. Values are treated as signed integers.
NLE
L
SF!=OF
value1 < value2. Values are treated as signed integers.
NGE
AE
CF=0
value1 >= value2. Values are treated as unsigned integers.
NB
BE
CF=1 or ZF=1
value1 <= value2. Values are treated as unsigned integers.
NA
A
CF=0 and ZF=0 value1 > value2. Values are treated as unsigned integers.
NBE
B
CF=1
value1 < value2. Values are treated as unsigned integers.
NAE
Conditions are typically used to act on the result of a cmp or test instruction. For example,
cmp eax, 5
jz equal
compares the eax register against the number 5 by computing the expression (eax - 5) and setting flags according to the result. If the result of the subtraction is zero, then the
zr flag will be set, and the jz condition will be true so the jump will be taken.
Data Types
byte: 8 bits
word: 16 bits
dword: 32 bits
qword: 64 bits (includes floating-point doubles)
tword: 80 bits (includes floating-point extended doubles)
oword: 128 bits
Notation
The following table indicates the notation used to describe assembly language instructions.
Notation
Meaning
r, r1, r2... Registers
m
Memory address (see the succeeding Addressing Modes section for more information.)
#n
Immediate constant
r/m
Register or memory
r/#n
Register or immediate constant
r/m/#n
Register, memory, or immediate constant
cc
A condition code listed in the preceding Conditions section.
T
"B", "W", or "D" (byte, word or dword)
accT
Size T accumulator: al if T = "B", ax if T = "W", or eax if T = "D"
Addressing Modes
There are several different addressing modes, but they all take the form T ptr [expr], where T is some data type (see the preceding Data Types section) and expr is some
expression involving constants and registers.
The notation for most modes can be deduced without much difficulty. For example, BYTE PTR [esi+edx*8+3] means "take the value of the esi register, add to it eight times
the value of the edx register, add three, then access the byte at the resulting address."
Pipelining
The Pentium is dual-issue, which means that it can perform up to two actions in one clock tick. However, the rules on when it is capable of doing two actions at once (known
as pairing) are very complicated.
Because x86 is a CISC processor, you do not have to worry about jump delay slots.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The xchg instruction automatically obeys the previous rules whenever it exchanges a value with memory.
All other instructions default to nonlocking.
Jump Prediction
Unconditional jumps are predicted to be taken.
Conditional jumps are predicted to be taken or not taken, depending on whether they were taken the last time they were executed. The cache for recording jump history is
limited in size.
If the CPU does not have a record of whether the conditional jump was taken or not taken the last time it was executed, it predicts backward conditional jumps as taken and
forward conditional jumps as not taken.
Alignment
The x86 processor will automatically correct unaligned memory access, at a performance penalty. No exception is raised.
A memory access is considered aligned if the address is an integer multiple of the object size. For example, all BYTE accesses are aligned (everything is an integer multiple of
1), WORD accesses to even addresses are aligned, and DWORD addresses must be a multiple of 4 in order to be aligned.
The lock prefix should not be used for unaligned memory accesses.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
x86 Instructions
In the lists in this section, instructions marked with an asterisk (*) are particularly important. Instructions not so marked are not critical.
On the x86 processor, instructions are variable-sized, so disassembling backward is an exercise in pattern matching. To disassemble backward from an address, you should
start disassembling at a point further back than you really want to go, then look forward until the instructions start making sense. The first few instructions may not make any
sense because you may have started disassembling in the middle of an instruction. There is a possibility, unfortunately, that the disassembly will never synchronize with the
instruction stream and you will have to try disassembling at a different starting point until you find a starting point that works.
For well-packed switch statements, the compiler emits data directly into the code stream, so disassembling through a switch statement will usually stumble across instructions
that make no sense (because they are really data). Find the end of the data and continue disassembling there.
Instruction Notation
The general notation for instructions is to put the destination register on the left and the source on the right. However, there can be some exceptions to this rule.
Arithmetic instructions are typically two-register with the source and destination registers combining. The result is stored into the destination.
Some of the instructions have both 16-bit and 32-bit versions, but only the 32-bit versions are listed here. Not listed here are floating-point instructions, privileged
instructions, and instructions that are used only in segmented models (which Microsoft Win32 does not use).
To save space, many of the instructions are expressed in combined form, as shown in the following example.
* MOV r1, r/m/#n r1 = r/m/#n
means that the first parameter must be a register, but the second can be a register, a memory reference, or an immediate value.
To save even more space, instructions can also be expressed as shown in the following.
* MOV r1/m, r/m/#n r1/m = r/m/#n
which means that the first parameter can be a register or a memory reference, and the second can be a register, memory reference, or immediate value.
Unless otherwise noted, when this abbreviation is used, you cannot choose memory for both source and destination.
Furthermore, a bit-size suffix (8, 16, 32) can be appended to the source or destination to indicate that the parameter must be of that size. For example, r8 means an 8-bit
register.
Effective Address
* LEA r, m Load effective address.
(r = address of m)
For example, LEA eax, [esi+4] means eax = esi + 4. This instruction is often used to perform arithmetic.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Data Transfer
* MOV r1/m, r2/m/#n r1/m = r/m/#n
* MOV r1, r/m
Move with sign extension.
* MOV r1, r/m
Move with zero extension.
MOVSX and MOVZX are special versions of the mov instruction that perform sign extension or zero extension from the source to the destination. This is the only instruction
that allows the source and destination to be different sizes. (And in fact, they must be different sizes.
Stack Manipulation
The stack is pointed to by the esp register. The value at esp is the top of the stack (most recently pushed, first to be popped); older stack elements reside at higher addresses.
* PUSH
r/m/#n Push value onto stack.
* POP
r/m
Pop value from stack.
PUSHFD
Push flags onto stack.
POPFD
Pop flags from stack.
PUSHAD
Push all integer registers.
POPAD
Pop all integer registers.
ENTER #n, #n Build stack frame.
* LEAVE
Tear down stack frame
The C/C++ compiler does not use the enter instruction. (The enter instruction is used to implement nested procedures in languages like Algol or Pascal.)
The leave instruction is equivalent to:
mov esp, ebp
pop ebp
Data Conversion
CBW Convert byte (al) to word (ax).
CWD Convert word (ax) to dword (dx:ax).
CWDE Convert word (ax) to dword (eax).
CDQ convert dword (eax) to qword (edx:eax).
All conversions perform sign extension.
Arithmetic
* ADD r1/m, r2/m/#n r1/m += r2/m/#n
ADC r1/m, r2/m/#n r1/m += r2/m/#n + carry
* SUB r1/m, r2/m/#n r1/m -= r2/m/#n
SBB r1/m, r2/m/#n r1/m -= r2/m/#n + carry
* NEG r1/m
r1/m = -r1/m
* INC r/m
r/m += 1
* DEC r/m
r/m -= 1
* CMP r1/m, r2/m/#n Compute r1/m - r2/m/#n
The cmp instruction computes the subtraction and sets flags according to the result, but throws the result away. It is typically followed by a conditional jump instruction that
tests the result of the subtraction.
MUL r/m8
ax = al * r/m8
MUL r/m16
dx:ax = ax * r/m16
* MUL r/m32
edx:eax = eax * r/m32
IMUL r/m8
ax = al * r/m8
IMUL r/m16
dx:ax = ax * r/m16
* IMUL r/m32
edx:eax = eax * r/m32
* IMUL r1, r2/m
r1 *= r2/m
* IMUL r1, r2/m, #n r1 = r2/m * #n
Unsigned and signed multiplication. The state of flags after multiplication is undefined.
DIV r/m8 (ah, al) = (ax % r/m8, ax r/m8)
DIV r/m16 (dx, ax) = dx:ax r/m16
* DIV r/m32 (edx, eax) = edx:eax r/m32
IDIV r/m8 (ah, al) = ax r/m8
IDIV r/m16 (dx, ax) = dx:ax r/m16
* IDIV r/m32 (edx, eax) = edx:eax r/m32
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Unsigned and signed division. The first register in the pseudocode explanation receives the remainder and the second receives the quotient. If the result overflows the
destination, a division overflow exception is generated.
The state of flags after division is undefined.
* SETcc r/m8 Set r/m8 to 0 or 1
If the condition cc is true, then the 8-bit value is set to 1. Otherwise, the 8-bit value is set to zero.
Binary-coded Decimal
You will not see these instructions unless you are debugging code written in COBOL.
DAA Decimal adjust after addition.
DAS Decimal adjust after subtraction.
These instructions adjust the al register after performing a packed binary-coded decimal operation.
AAA ASCII adjust after addition.
AAS ASCII adjust after subtraction.
These instructions adjust the al register after performing an unpacked binary-coded decimal operation.
AAM ASCII adjust after multiplication.
AAD ASCII adjust after division.
These instructions adjust the al and ah registers after performing an unpacked binary-coded decimal operation.
Bits
* AND r1/m, r2/m/#n r1/m = r1/m and r2/m/#n
* OR r1/m, r2/m/#n r1/m = r1/m or r2/m/#n
* XOR r1/m, r2/m/#n r1/m = r1/m xor r2/m/#n
* NOT r1/m
r1/m = bitwise not r1/m
* TEST r1/m, r2/m/#n Compute r1/m and r2/m/#n
The test instruction computes the logical AND operator and sets flags according to the result, but throws the result away. It is typically followed by a conditional jump
instruction that tests the result of the logical AND.
* SHL r1/m, cl/#n r1/m <<= cl/#n
* SHR r1/m, cl/#n r1/m >>= cl/#n zero-fill
* SAR r1/m, cl/#n r1/m >>= cl/#n sign-fill
The last bit shifted out is placed in the carry.
SHLD r1, r2/m, cl/#n Shift left double.
Shift r1 left by cl/#n, filling with the top bits of r2/m. The last bit shifted out is placed in the carry.
SHRD r1, r2/m, cl/#n Shift right double.
Shift r1 right by cl/#n, filling with the bottom bits of r2/m. The last bit shifted out is placed in the carry.
ROL r1, cl/#n Rotate r1 left by cl/#n.
ROR r1, cl/#n Rotate r1 right by cl/#n.
RCL r1, cl/#n Rotate r1/C left by cl/#n.
RCR r1, cl/#n Rotate r1/C right by cl/#n.
Rotation is like shifting, except that the bits that are shifted out reappear as the incoming fill bits. The C-language version of the rotation instructions incorporate the carry bit
into the rotation.
BT r1, r2/#n Copy bit r2/#n of r1 into carry.
BTS r1, r2/#n Set bit r2/#n of r1, copy previous value into carry.
BTC r1, r2/#n Clear bit r2/#n of r1, copy previous value into carry.
Control Flow
* Jcc
dest Branch conditional.
* JMP dest Jump direct.
* JMP r/m Jump indirect.
* CALL dest Call direct.
* CALL r/m Call indirect.
The call instruction pushes the return address onto the stack then jumps to the destination.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
* RET #n Return
The ret instruction pops and jumps to the return address on the stack. A nonzero #n in the RET instruction indicates that after popping the return address, the value #n should
be added to the stack pointer.
LOOP
Decrement ecx and jump if result is nonzero.
LOOPZ Decrement ecx and jump if result is nonzero and zr was set.
LOOPNZ Decrement ecx and jump if result is nonzero and zr was clear.
JECXZ Jump if ecx is zero.
These instructions are remnants of the x86's CISC heritage and in recent processors are actually slower than the equivalent instructions written out the long way.
String Manipulation
* MOVST
CMPST
SCAST
LODST
* STOST
After performing the operation, the source and destination register are incremented or decremented by sizeof(T), according to the setting of the direction flag (up or down).
The instruction can be prefixed by REP to repeat the operation the number of times specified by the ecx register.
The rep mov instruction is used to copy blocks of memory.
The rep stos instruction is used to fill a block of memory with accT.
Flags
LAHF Load ah from flags.
SAHF Store ah to flags.
STC Set carry.
CLC Clear carry.
CMC Complement carry.
STD Set direction to down.
CLD Set direction to up.
STI Enable interrupts.
CLI Disable interrupts.
Interlocked Instructions
XCHG
r1, r/m Swap r1 and r/m.
XADD
r1, r/m Add r1 to r/m, put original value in r1.
CMPXCHG r1, r/m Compare and exchange conditional.
The cmpxchg instruction is the atomic version of the following:
cmp
jz
mov
jmp
match:
mov
done:
accT, r/m
match
accT, r/m
done
r/m, r1
Miscellaneous
INT
#n Trap to kernel.
BOUND r, m Trap if r not in range.
* NOP
No operation.
XLATB
al = [ebx + al]
BSWAP r
Swap byte order in register.
Here is a special case of the int instruction.
INT 3 Debugger breakpoint trap.
The opcode for INT 3 is 0xCC. The opcode for NOP is 0x90.
When debugging code, you may need to patch out some code. You can do this by replacing the offending bytes with 0x90.
Idioms
* XOR r, r r = 0
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
* TEST r, r Check if r = 0.
* ADD r, r Shift r left by 1.
Source Code
The following is the code for the function that will be analyzed.
HRESULT CUserView::CloseView(void)
{
if (m_fDestroyed) return S_OK;
BOOL fViewObjectChanged = FALSE;
ReleaseAndNull(&m_pdtgt);
if (m_psv) {
m_psb->EnableModelessSB(FALSE);
if(m_pws) m_pws->ViewReleased();
IShellView* psv;
HWND hwndCapture = GetCapture();
if (hwndCapture && hwndCapture == m_hwnd) {
SendMessage(m_hwnd, WM_CANCELMODE, 0, 0);
}
m_fHandsOff = TRUE;
m_fRecursing = TRUE;
NotifyClients(m_psv, NOTIFY_CLOSING);
m_fRecursing = FALSE;
m_psv->UIActivate(SVUIA_DEACTIVATE);
psv = m_psv;
m_psv = NULL;
ReleaseAndNull(&_pctView);
if (m_pvo) {
IAdviseSink *pSink;
if (SUCCEEDED(m_pvo->GetAdvise(NULL, NULL, &pSink)) && pSink) {
if (pSink == (IAdviseSink *)this)
m_pvo->SetAdvise(0, 0, NULL);
pSink->Release();
}
fViewObjectChanged = TRUE;
ReleaseAndNull(&m_pvo);
}
if (psv) {
psv->SaveViewState();
psv->DestroyViewWindow();
psv->Release();
}
m_hwndView = NULL;
m_fHandsOff = FALSE;
if (m_pcache) {
GlobalFree(m_pcache);
m_pcache = NULL;
}
m_psb->EnableModelessSB(TRUE);
CancelPendingActions();
}
ReleaseAndNull(&_psf);
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
if (fViewObjectChanged)
NotifyViewClients(DVASPECT_CONTENT, -1);
if (m_pszTitle) {
LocalFree(m_pszTitle);
m_pszTitle = NULL;
}
SetRect(&m_rcBounds, 0, 0, 0, 0);
return S_OK;
}
Assembly Code
This section contains the annotated disassembly example.
Functions which use the ebp register as a frame pointer start out as follows:
HRESULT CUserView::CloseView(void)
SAMPLE!CUserView__CloseView:
71517134 55
push
ebp
71517135 8bec
mov
ebp,esp
This sets up the frame so the function can access its parameters as positive offsets from ebp, and local variables as negative offsets.
This is a method on a private COM interface, so the calling convention is __stdcall. This means that parameters are pushed right to left (in this case, there are none), the "this"
pointer is pushed, and then the function is called. Thus, upon entry into the function, the stack looks like this:
[esp+0] = return address
[esp+4] = this
After the two preceding instructions, the parameters are accessible as:
[ebp+0] = previous ebp pushed on stack
[ebp+4] = return address
[ebp+8] = this
For a function that uses ebp as a frame pointer, the first pushed parameter is accessible at [ebp+8]; subsequent parameters are accessible at consecutive higher DWORD
addresses.
71517137 51
71517138 51
push
push
ecx
ecx
This function requires only two local stack variables, so a sub esp, 8 instruction. The pushed values are then available as [ebp-4] and [ebp-8].
For a function that uses ebp as a frame pointer, stack local variables are accessible at negative offsets from the ebp register.
71517139 56
push
esi
Now the compiler saves the registers that are required to be preserved across function calls. Actually, it saves them in bits and pieces, interleaved with the first line of actual
code.
7151713a 8b7508
7151713d 57
mov
push
esi,[ebp+0x8]
edi
; esi = this
; save another registers
It so happens that CloseView is a method on ViewState, which is at offset 12 in the underlying object. Consequently, this is a pointer to a ViewState class, although when
there is possible confusion with another base class, it will be more carefully specified as (ViewState*)this.
if (m_fDestroyed)
7151713e 33ff
xor
edi,edi
; edi = 0
cmp
jz
[esi+0xac],edi
; this->m_fDestroyed == 0?
NotDestroyed (7151714f) ; jump if equal
The cmp instruction compares two values (by subtracting them). The jz instruction checks if the result is zero, indicating that the two compared values are equal.
The cmp instruction compares two values; a subsequent j instruction jumps based on the result of the comparison.
return S_OK;
71517148 33c0
7151714a e972010000
xor
jmp
eax,eax
; eax = 0 = S_OK
ReturnNoEBX (715172c1) ; return, do not pop EBX
The compiler delayed saving the EBX register until later in the function, so if the program is going to "early-out" on this test, then the exit path needs to be the one that does
not restore EBX.
BOOL fViewObjectChanged = FALSE;
ReleaseAndNull(&m_pdtgt);
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
lea
eax,[esi+0xc0]
; eax = &m_pdtgt
The lea instruction computes the effect address of a memory access and stores it in the destination. The actual memory address is not dereferenced.
The lea instruction takes the address of a variable.
71517155 53
push
ebx
mov ebx,[_imp__ReleaseAndNull]
Because you will be calling ReleaseAndNull frequently, it is a good idea to cache its address in EBX.
7151715c 50
7151715d 897dfc
71517160 ffd3
if (m_psv) {
71517162 397e74
71517165 0f8411010000
push
mov
call
eax
[ebp-0x4],edi
ebx
; parameter to ReleaseAndNull
; fViewObjectChanged = FALSE
; call ReleaseAndNull
cmp
je
[esi+0x74],edi
; this->m_psv == 0?
No_Psv (7151727c) ; jump if zero
Remember that you zeroed out the EDI register a while back and that EDI is a register preserved across function calls (so the call to ReleaseAndNull did not change it).
Therefore, it still holds the value zero and you can use it to quickly test for zero.
7151716b
7151716e
7151716f
71517170
71517172
m_psb->EnableModelessSB(FALSE);
8b4638
mov
eax,[esi+0x38]
57
push
edi
50
push
eax
8b08
mov
ecx,[eax]
ff5124
call
[ecx+0x24]
;
;
;
;
;
eax = this->m_psb
FALSE
"this" for callee
ecx = m_psb->lpVtbl
__stdcall EnableModelessSB
71517175
7151717b
7151717d
7151717f
71517181
71517182
NoWS:
if(m_pws) m_pws->ViewReleased();
8b8614010000
mov
eax,[esi+0x114]
; eax = this->m_pws
3bc7
cmp
eax,edi
; eax == 0?
7406
jz
NoWS (71517185) ; if so, then jump
8b08
mov
ecx,[eax]
; ecx = m_pws->lpVtbl
50
push
eax
; "this" for callee
ff510c
call
[ecx+0xc]
; __stdcall ViewReleased
; call GetCapture
Indirect calls through globals is how function imports are implemented in Microsoft Win32. The loader fixes up the globals to point to the actual address of the target. This is
a handy way to get your bearings when you are investigating a crashed machine. Look for the calls to imported functions and in the target. You will usually have the name of
some imported function, which you can use to determine where you are in the source code.
if (hwndCapture && hwndCapture == m_hwnd) {
SendMessage(m_hwnd, WM_CANCELMODE, 0, 0);
}
7151718b 3bc7
cmp
eax,edi
; hwndCapture == 0?
7151718d 7412
jz
No_Capture (715171a1) ; jump if zero
The function return value is placed in the EAX register.
7151718f 8b4e44
71517192 3bc1
71517194 750b
mov
cmp
jnz
71517196 57
push
71517197 57
push
71517198 6a1f
push
7151719a 51
push
7151719b ff1518195071
call
No_Capture:
m_fHandsOff = TRUE;
m_fRecursing = TRUE;
715171a1 66818e0c0100000180 or
ecx,[esi+0x44]
; ecx = this->m_hwnd
eax,ecx
; hwndCapture = ecx?
No_Capture (715171a1) ; jump if not
edi
; 0
edi
; 0
0x1f
; WM_CANCELMODE
ecx
; hwndCapture
[_imp__SendMessageW] ; SendMessage
NotifyClients(m_psv, NOTIFY_CLOSING);
715171aa 8b4e20
mov
ecx,[esi+0x20]
715171ad 6a04
push
0x4
715171af 8d4620
lea
eax,[esi+0x20]
; ecx = (CNotifySource*)this.vtbl
; NOTIFY_CLOSING
; eax = (CNotifySource*)this
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
715171b2 ff7674
715171b5 50
715171b6 ff510c
push
push
call
[esi+0x74]
eax
[ecx+0xc]
; m_psv
; "this" for callee
; __stdcall NotifyClients
Notice how you had to change your "this" pointer when calling a method on a different base class from your own.
m_fRecursing = FALSE;
715171b9 80a60d0100007f
and
byte ptr [esi+0x10d],0x7f
m_psv->UIActivate(SVUIA_DEACTIVATE);
715171c0 8b4674
mov
eax,[esi+0x74]
; eax = m_psv
715171c3 57
push
edi
; SVUIA_DEACTIVATE = 0
715171c4 50
push
eax
; "this" for callee
715171c5 8b08
mov
ecx,[eax]
; ecx = vtbl
715171c7 ff511c
call
[ecx+0x1c]
; __stdcall UIActivate
psv = m_psv;
m_psv = NULL;
715171ca 8b4674
mov
eax,[esi+0x74]
; eax = m_psv
715171cd 897e74
mov
[esi+0x74],edi
; m_psv = NULL
715171d0 8945f8
mov
[ebp-0x8],eax
; psv = eax
The first local variable is psv.
ReleaseAndNull(&_pctView);
715171d3 8d466c
lea
eax,[esi+0x6c]
715171d6 50
push
eax
715171d7 ffd3
call
ebx
if (m_pvo) {
715171d9 8b86a8000000
mov
eax,[esi+0xa8]
715171df 8dbea8000000
lea
edi,[esi+0xa8]
715171e5 85c0
test
eax,eax
715171e7 7448
jz
No_Pvo (71517231)
; eax = &_pctView
; parameter
; call ReleaseAndNull
;
;
;
;
eax = m_pvo
edi = &m_pvo
eax == 0?
jump if zero
Note that the compiler speculatively prepared the address of the m_pvo member, because you are going to use it frequently for a while. Thus, having the address handy will
result in smaller code.
715171e9
715171eb
715171ee
715171ef
715171f1
715171f3
715171f4
715171f7
715171f9
715171fb
715171fd
71517200
Notice that the compiler concluded that the incoming "this" parameter was not required (because it long ago stashed that into the ESI register). Thus, it reused the memory as
the local variable pSink.
If the function uses an EBP frame, then incoming parameters arrive at positive offsets from EBP and local variables are placed at negative offsets. But, as in this case, the
compiler is free to reuse that memory for any purpose.
If you are paying close attention, you will see that the compiler could have optimized this code a little better. It could have delayed the lea edi, [esi+0xa8] instruction until
after the two push 0x0 instructions, replacing them with push edi. This would have saved 2 bytes.
if (pSink == (IAdviseSink *)this)
These next several lines are to compensate for the fact that in C++, (IAdviseSink *)NULL must still be NULL. So if your "this" is really "(ViewState*)NULL", then the result
of the cast should be NULL and not the distance between IAdviseSink and IBrowserService.
71517202
71517205
71517208
7151720a
7151720c
8d46ec
8d5614
f7d8
1bc0
23c2
lea
lea
neg
sbb
and
eax,[esi-0x14]
edx,[esi+0x14]
eax
eax,eax
eax,edx
;
;
;
;
;
eax
edx
eax
eax
eax
=
=
=
=
=
-(IAdviseSink*)this
(IAdviseSink*)this
-eax (sets carry if != 0)
eax - eax - carry
NULL or edx
Although the Pentium has a conditional move instruction, the base i386 architecture does not, so the compiler uses specific techniques to simulate a conditional move
instruction without taking any jumps.
The general pattern for a conditional evaluation is the following:
neg
sbb
and
add
r
r, r
r, (val1 - val2)
r, val2
The neg r sets the carry flag if r is nonzero, because neg negates the value by subtracting from zero. And, subtracting from zero will generate a borrow (set the carry) if you
subtract a nonzero value. It also damages the value in the r register, but that is acceptable because you are about to overwrite it anyway.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Next, the sbb r, r instruction subtracts a value from itself, which always results in zero. However, it also subtracts the carry (borrow) bit, so the net result is to set r to zero or 1, depending on whether the carry was clear or set, respectively.
Therefore, sbb r, r sets r to zero if the original value of r was zero, or to -1 if the original value was nonzero.
The third instruction performs a mask. Because the r register is zero or -1, "this" serves either to leave r zero or to change r from -1 to (val1 - val1), in that ANDing any value
with -1 leaves the original value.
Therefore, the result of "and r, (val1 - val1)" is to set r to zero if the original value of r was zero, or to "(val1 - val2)" if the original value of r was nonzero.
Finally, you add val2 to r, resulting in val2 or (val1 - val2) + val2 = val1.
Thus, the ultimate result of this series of instructions is to set r to val2 if it was originally zero or to val1 if it was nonzero. This is the assembly equivalent of r = r ? val1 :
val2.
In this particular instance, you can see that val2 = 0 and val1 = (IAdviseSink*)this. (Notice that the compiler elided the final add eax, 0 instruction because it has no effect.)
7151720e 394508
71517211 750b
cmp
jnz
Earlier in this section, you set EDI to the address of the m_pvo member. You are going to be using it now. You also zeroed out the ECX register earlier.
71517213 8b07
71517215 51
71517216 51
71517217 51
71517218 8b10
7151721a 50
7151721b ff521c
No_SetAdvise:
7151721e 8b4508
71517221 50
71517222 8b08
71517224 ff5108
No_Advise:
m_pvo->SetAdvise(0, 0, NULL);
mov
eax,[edi]
push
ecx
push
ecx
push
ecx
mov
edx,[eax]
push
eax
call
[edx+0x1c]
pSink->Release();
mov
push
mov
call
eax,[ebp+0x8]
eax
ecx,[eax]
[ecx+0x8]
;
;
;
;
;
;
;
eax = m_pvo
NULL
0
0
edx = m_pvo->lpVtbl
"this" for callee
__stdcall SetAdvise
;
;
;
;
eax = pSink
"this" for callee
ecx = pSink->lpVtbl
__stdcall Release
; m_pcache
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
7151725d ff15b4135071
call
[_imp__GlobalFree]
; call GlobalFree
m_pcache = NULL;
71517263 83667000
and
dword ptr [esi+0x70],0x0 ; m_pcache = 0
No_Cache:
m_psb->EnableModelessSB(TRUE);
71517267 8b4638
mov
eax,[esi+0x38]
; eax = this->m_psb
7151726a 6a01
push
0x1
; TRUE
7151726c 50
push
eax
; "this" for callee
7151726d 8b08
mov
ecx,[eax]
; ecx = m_psb->lpVtbl
7151726f ff5124
call
[ecx+0x24]
; __stdcall EnableModelessSB
CancelPendingActions();
In order to call CancelPendingActions, you have to move from (ViewState*)this to (CUserView*)this. Note also that CancelPendingActions uses the __thiscall calling
convention instead of __stdcall. According to __thiscall, the "this" pointer is passed in the ECX register instead of being passed on the stack.
71517272 8d4eec
lea
ecx,[esi-0x14]
; ecx = (CUserView*)this
71517275 e832fbffff
call CUserView::CancelPendingActions (71516dac) ; __thiscall
ReleaseAndNull(&_psf);
7151727a 33ff
xor
edi,edi
; edi = 0 (for later)
No_Psv:
7151727c 8d4678
lea
eax,[esi+0x78]
; eax = &_psf
7151727f 50
push
eax
; parameter
71517280 ffd3
call
ebx
; call ReleaseAndNull
if (fViewObjectChanged)
71517282 397dfc
cmp
[ebp-0x4],edi
; fViewObjectChanged == 0?
71517285 740d
jz
NoNotifyViewClients (71517294) ; jump if zero
NotifyViewClients(DVASPECT_CONTENT, -1);
71517287 8b46ec
mov
eax,[esi-0x14]
; eax = ((CUserView*)this)->lpVtbl
7151728a 8d4eec
lea
ecx,[esi-0x14]
; ecx = (CUserView*)this
7151728d 6aff
push
0xff
; -1
7151728f 6a01
push
0x1
; DVASPECT_CONTENT = 1
71517291 ff5024
call
[eax+0x24]
; __thiscall NotifyViewClients
NoNotifyViewClients:
if (m_pszTitle)
71517294 8b8680000000
mov
eax,[esi+0x80]
; eax = m_pszTitle
7151729a 8d9e80000000
lea
ebx,[esi+0x80]
; ebx = &m_pszTitle (for later)
715172a0 3bc7
cmp
eax,edi
; eax == 0?
715172a2 7409
jz
No_Title (715172ad) ; jump if zero
LocalFree(m_pszTitle);
715172a4 50
push
eax
; m_pszTitle
715172a5 ff1538125071
call
[_imp__LocalFree]
m_pszTitle = NULL;
Remember that EDI is still zero and EBX is still &m_pszTitle, because those registers are preserved by function calls.
715172ab 893b
mov
[ebx],edi
No_Title:
SetRect(&m_rcBounds, 0, 0, 0, 0);
715172ad 57
push
edi
715172ae 57
push
edi
715172af 57
push
edi
715172b0 81c6fc000000
add
esi,0xfc
715172b6 57
push
edi
715172b7 56
push
esi
715172b8 ff15e41a5071
call
[_imp__SetRect]
; m_pszTitle = 0
;
;
;
;
;
;
0
0
0
esi = &this->m_rcBounds
0
&m_rcBounds
Notice that you do not need the value of "this" any more, so the compiler uses the add instruction to modify it in place instead of using up another register to hold the address.
This is actually a performance win due to the Pentium u/v pipelining, because the v pipe can do arithmetic, but not address computations.
return S_OK;
715172be 33c0
xor
eax,eax
; eax = S_OK
Finally, you restore the registers you are required to preserve, clean up the stack, and return to your caller, removing the incoming parameters.
715172c0 5b
ReturnNoEBX:
715172c1 5f
715172c2 5e
715172c3 c9
715172c4 c20400
pop
ebx
; restore
pop
pop
leave
ret
edi
esi
;
;
;
;
0x4
restore
restore
restores EBP and ESP simultaneously
return and clear parameters
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
x64 Architecture
The x64 architecture is a backwards-compatible extension of x86. It provides a legacy 32-bit mode, which is identical to x86, and a new 64-bit mode.
The term "x64" includes both AMD 64 and Intel64. The instruction sets are close to identical.
Registers
x64 extends x64's 8 general-purpose registers to be 64-bit, and adds 8 new 64-bit registers. The 64-bit registers have names beginning with "r", so for example the 64-bit
extension of eax is called rax. The new registers are named r8 through r15.
The lower 32 bits, 16 bits, and 8 bits of each register are directly addressable in operands. This includes registers, like esi, whose lower 8 bits were not previously addressable.
The following table specifies the assembly-language names for the lower portions of 64-bit registers.
64-bit register Lower 32 bits Lower 16 bits Lower 8 bits
rax
eax
ax
al
rbx
ebx
bx
bl
rcx
ecx
cx
cl
rdx
edx
dx
dl
rsi
esi
si
sil
rdi
edi
di
dil
rbp
ebp
bp
bpl
rsp
esp
sp
spl
r8
r8d
r8w
r8b
r9
r9d
r9w
r9b
r10
r10d
r10w
r10b
r11
r11d
r11w
r11b
r12
r12d
r12w
r12b
r13
r13d
r13w
r13b
r14
r14d
r14w
r14b
r15
r15d
r15w
r15b
Operations that output to a 32-bit subregister are automatically zero-extended to the entire 64-bit register. Operations that output to 8-bit or 16-bit subregisters are not zeroextended (this is compatible x86 behavior).
The high 8 bits of ax, bx, cx, and dx are still addressable as ah, bh, ch, dh, but cannot be used with all types of operands.
The instruction pointer, eip, and flags register have been extended to 64 bits (rip and rflags, respectively) as well.
The x64 processor also provides several sets of floating-point registers:
Calling Conventions
Unlike the x86, the C/C++ compiler only supports one calling convention on x64. This calling convention takes advantage of the increased number of registers available on
x64:
The first four integer or pointer parameters are passed in the rcx, rdx, r8, and r9 registers.
The first four floating-point parameters are passed in the first four SSE registers, xmm0-xmm3.
The caller reserves space on the stack for arguments passed in registers. The called function can use this space to spill the contents of registers to the stack.
Any additional arguments are passed on the stack.
An integer or pointer return value is returned in the rax register, while a floating-point return value is returned in xmm0.
rax, rcx, rdx, r8-r11 are volatile.
rbx, rbp, rdi, rsi, r12-r15 are nonvolatile.
The calling convention for C++ is very similar: the this pointer is passed as an implicit first parameter. The next three parameters are passed in registers, while the rest are
passed on the stack.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Addressing Modes
The addressing modes in 64-bit mode are similar to, but not identical to, x86.
Instructions that refer to 64-bit registers are automatically performed with 64-bit precision. (For example mov rax, [rbx] moves 8 bytes beginning at rbx into rax.)
A special form of the mov instruction has been added for 64-bit immediate constants or constant addresses. For all other instructions, immediate constants or constant
addresses are still 32 bits.
x64 provides a new rip-relative addressing mode. Instructions that refer to a single constant address are encoded as offsets from rip. For example, the mov rax, [addr]
instruction moves 8 bytes beginning at addr + rip to rax.
Instructions, such as jmp, call, push, and pop, that implicitly refer to the instruction pointer and the stack pointer treat them as 64 bits registers on x64.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
x64 Instructions
Most x86 instructions continue to be valid for x64 in 64-bit mode. Some rarely-used operations are no longer supported in 64-bit mode, such as:
binary-coded decimal arithmetic instructions: AAA, AAD, AAM, AAS, DAA, DAS
BOUND
PUSHAD and POPAD
most operations that dealt with segment registers, such as PUSH DS and POP DS. (Operations that use the FS or GS segment registers are still valid.)
The x64 instruction set includes recent additions to the x86, such as SSE 2. Programs compiled for x64 can freely use these instructions.
Data Transfer
The x64 provides new variants of the MOV instruction that can handle 64-bit immediate constants or memory addresses.
MOV r,#n r = #n
MOV rax, m Move contents at 64-bit address to rax.
MOV m, rax Move contents of rax to 64-bit address.
The x64 also provides a new instruction to sign-extend 32-bit operands to 64 bits.
MOVSXD r1, r/m Move DWORD with sign extension to QWORD.
Ordinary MOV operations into 32-bit subregisters automatically zero extend to 64 bits, so there is no MOVZXD instruction.
Two SSE instructions can be used to move 128-bit values (such as GUIDs) from memory to an xmmn register or vice versa.
MOVDQA r1/m, r2/m Move 128-bit aligned value to xmmn register, or vice versa.
MOVDQU r1/m, r2/m Move 128-bit value (not necessarily aligned) to register, or vice versa.
Data Conversion
CDQE Convert dword (eax) to qword (rax).
CQO convert qword (rax) to oword (rdx:rax).
String Manipulation
MOVSQ Move qword from rsi to rdi.
CMPSQ Compare qword at rsi with rdi.
SCASQ Scan qword at rdi. Compares qword at rdi to rax.
LODSQ Load qword from rsi into rax.
STOSQ Store qword to rdi from rax.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
return i*5 + j + 3;
}
This compiles to code like this:
01001080 lea
01001083 lea
01001087 ret
eax,[rdx+rcx*4]
eax,[rcx+rax+0x3]
; eax = rdx+rcx*4
; eax = rcx+rax+3
The i and j parameters are passed in the ecx and edx registers, respectively. Since there are only two parameters, the routine does not use the stack at all.
The particular code generated exploits three tricks, one of which is specific to the x64:
1. The lea operation can be used to perform a series of simple arithmetic operations as a single operation. The first instruction stores j+i*4 in eax, and the second
instruction adds i+3 to the result, for a total of j+i*5+3.
2. Many operations, such as addition and multiplication, can be done with extra precision, and then truncated to the correct precision. In this instance, the code uses 64-bit
addition and multiplication. We can safely truncate the result to 32 bits.
3. On the x64, any operation that outputs to a 32-bit register automatically zero-extends the result. In this case, outputting to eax has the effect of truncating the result to 32
bits.
Return values are passed in the rax register. In this case, the result is already in the rax register, so the function returns.
Next we consider a more complicated function to demonstrate typical x64 disassembly:
HRESULT Meaningless(IDispatch *pdisp, DISPID dispid, BOOL fUnique, LPCWSTR pszExe)
{
IQueryAssociations *pqa;
HRESULT hr = AssocCreate(CLSID_QueryAssociations, IID_IQueryAssociations, (void**)&pqa);
if (SUCCEEDED(hr)) {
hr = pqa->Init(ASSOCF_INIT_BYEXENAME, pszExe, NULL, NULL);
if (SUCCEEDED(hr)) {
WCHAR wszName[MAX_PATH];
DWORD cchName = MAX_PATH;
hr = pqa->GetString(0, ASSOCSTR_FRIENDLYAPPNAME, NULL, wszName, &cchName);
if (SUCCEEDED(hr)) {
VARIANTARG rgvarg[2] = { 0 };
V_VT(&rgvarg[0]) = VT_BSTR;
V_BSTR(&rgvarg[0]) = SysAllocString(wszName);
if (V_BSTR(&rgvarg[0])) {
DISPPARAMS dp;
LONG lUnique = InterlockedIncrement(&lCounter);
V_VT(&rgvarg[1]) = VT_I4;
V_I4(&rgvarg[1]) = fUnique ? lUnique : 0;
dp.rgvarg = rgvarg;
dp.cArgs = 2;
dp.rgdispidNamedArgs = NULL;
dp.cNamedArgs = 0;
hr = pdisp->Invoke(dispid, IID_NULL, 0, DISPATCH_METHOD, &dp, NULL, NULL, NULL);
VariantClear(&rgvarg[0]);
VariantClear(&rgvarg[1]);
} else {
hr = E_OUTOFMEMORY;
}
}
}
pqa->Release();
}
return hr;
}
We'll go through this function and the equivalent assembly line by line.
When entered, the function's parameters are stored as follows:
rcx = pdisp.
rdx = dispid.
r8 = fUnique.
r9 = pszExe.
Recall that the first four parameters are passed in registers. Since this function has only four registers, none are passed on the stack.
The assembly begins as follows:
Meaningless:
010010e0 push
010010e1 push
010010e2 push
010010e3 push
010010e5 push
010010e7 push
010010e9 push
010010eb sub
010010f2 mov
rbx
rsi
rdi
r12d
r13d
r14d
r15d
rsp,0x2c0
rbx,r9
;
;
;
;
;
;
;
;
;
save
save
save
save
save
save
save
reserve stack
rbx = pszExe
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
010010f5 mov
010010f8 mov
010010fb mov
r12d,r8d
r13d,edx
rsi,rcx
The function begins by saving nonvolatile registers, and then reserving stack space for local variables. It then saves parameters in nonvolatile registers. Note that the
destination of the middle two mov instructions is a 32-bit register, so they are implicitly zero-extended to 64 bits.
IQueryAssociations *pqa;
HRESULT hr = AssocCreate(CLSID_QueryAssociations, IID_IQueryAssociations, (void**)&pqa);
The first parameter to AssocCreate is a 128-bit CLSID passed by value. Since this doesn't fit in a 64-bit register, the CLSID is copied to the stack, and a pointer to the stack
location is passed instead.
010010fe
01001106
0100110c
01001111
01001118
0100111d
The movdqu instruction transfers 128-bits values to and from xmmn registers. In this instance, the assembly code uses it to copy the CLSID to the stack. The pointer to the
CLSID is passed in r8. The other two arguments are passed in rcx and rdx.
if (SUCCEEDED(hr)) {
01001123 test
01001125 jl
eax,eax
ReturnEAX (01001281)
mov
mov
xor
mov
xor
mov
mov
mov
call
rcx,[rsp+0x58]
rax,[rcx]
r14d,r14d
[rsp+0x20],r14
r9d,r9d
r8,rbx
r15d,0x2
edx,r15d
qword ptr [rax+0x18]
;
;
;
;
;
;
;
;
;
arg1 = pqa
rax = pqa.vtbl
r14 = 0
arg5 = 0
arg4 = 0
arg3 = pszExe
r15 = 2 (for later)
arg2 = 2 (ASSOCF_INIT_BY_EXENAME)
call Init method
This is an indirect function call using a C++ vtable. The this pointer is passed in rcx as the first parameter. The first three parameters are passed in registers, while the final
parameter is passed on the stack. The function reserves 16 bytes for the parameters passed in registers, so the fifth parameter begins at rsp+0x20.
if (SUCCEEDED(hr)) {
0100114d mov
0100114f test
01001151 jl
ebx,eax
ebx,ebx
ReleasePQA (01001274)
; ebx = hr
; FAILED?
; jump if so
The assembly-language code saves the result in ebx, and checks to see if it's a success code.
WCHAR wszName[MAX_PATH];
DWORD cchName = MAX_PATH;
hr = pqa->GetString(0, ASSOCSTR_FRIENDLYAPPNAME, NULL, wszName, &cchName);
if (SUCCEEDED(hr)) {
01001157
0100115f
01001164
01001167
0100116c
01001171
01001179
0100117e
01001181
01001187
01001189
0100118c
0100118e
01001190
mov
mov
mov
lea
mov
lea
mov
xor
mov
xor
call
mov
test
jl
Once again, we set up the parameters and call a function, then test the return value for success.
VARIANTARG rgvarg[2] = { 0 };
01001196
0100119e
010011a0
010011a5
lea
xor
mov
rep
rdi,[rsp+0x82]
eax,eax
ecx,0x2e
stosb
;
;
;
;
rdi = &rgvarg
rax = 0
rcx = sizeof(rgvarg)
Zero it out
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The idiomatic method for zeroing out a buffer on x64 is the same as x86.
V_VT(&rgvarg[0]) = VT_BSTR;
V_BSTR(&rgvarg[0]) = SysAllocString(wszName);
if (V_BSTR(&rgvarg[0])) {
010011a7
010011b1
010011b9
010011bf
010011c7
010011ca
mov
lea
call
mov
test
je
010011d0
010011d7
010011dc
010011e0
lea
mov
lock
add
rax,[lCounter (01002000)]
ecx,0x1
xadd [rax],ecx
ecx,0x1
InterlockedIncrement compiles directly to machine code. The lock xadd instruction performs an atomic exchange and add. The final result is stored in ecx.
V_VT(&rgvarg[1]) = VT_I4;
V_I4(&rgvarg[1]) = fUnique ? lUnique : 0;
010011e3
010011ed
010011f0
010011f3
010011f6
mov
mov
test
cmovne
mov
;
;
;
;
;
V_VT(&rgvarg[1]) = VT_I4;
rax = 0 (r14d is still zero)
fUnique set?
if so, then set rax=lCounter
V_I4(&rgvarg[1]) = ...
Since x64 supports the cmov instruction, the ?: construct can be compiled without using a jump.
dp.rgvarg = rgvarg;
dp.cArgs = 2;
dp.rgdispidNamedArgs = NULL;
dp.cNamedArgs = 0;
010011fd
01001205
0100120a
0100120f
01001214
lea
mov
mov
mov
mov
rax,[rsp+0x80]
[rsp+0x60],rax
[rsp+0x70],r15d
[rsp+0x68],r14
[rsp+0x74],r14d
;
;
;
;
;
rax = &rgvarg[0]
dp.rgvarg = rgvarg
dp.cArgs = 2 (r15 is still 2)
dp.rgdispidNamedArgs = NULL
dp.cNamedArgs = 0
This code initializes the rest of the members of DISPPARAMS. Note that the compiler reuses the space on the stack previously used by the CLSID.
hr = pdisp->Invoke(dispid, IID_NULL, 0, DISPATCH_METHOD, &dp, NULL, NULL, NULL);
01001219
0100121c
01001221
01001226
0100122b
01001230
01001235
0100123c
0100123f
01001246
01001249
0100124c
0100124f
mov
mov
mov
mov
lea
mov
mov
xor
lea
mov
mov
call
mov
rax,[rsi]
[rsp+0x40],r14
[rsp+0x38],r14
[rsp+0x30],r14
rcx,[rsp+0x60]
[rsp+0x28],rcx
word ptr [rsp+0x20],0x1
r9d,r9d
r8,[GUID_NULL (01001080)]
edx,r13d
rcx,rsi
qword ptr [rax+0x30]
ebx,eax
;
;
;
;
;
;
;
;
;
;
;
;
;
rax = pdisp.vtbl
arg9 = 0
arg8 = 0
arg7 = 0
rcx = &dp
arg6 = &dp
arg5 = 1 (DISPATCH_METHOD)
arg4 = 0
arg3 = &IID_NULL
arg2 = dispid
arg1 = pdisp
call Invoke method
hr = result
The code then sets up the parameters and calls the Invoke method.
VariantClear(&rgvarg[0]);
VariantClear(&rgvarg[1]);
01001251
01001259
0100125f
01001267
0100126d
lea
call
lea
call
jmp
rcx,[rsp+0x80]
;
qword ptr [_imp_VariantClear
rcx,[rsp+0x98]
;
qword ptr [_imp_VariantClear
ReleasePQA (01001274)
arg1 = &rgvarg[0]
(01001018)]
arg1 = &rgvarg[1]
(01001018)]
The code finishes up the current branch of the conditional, and skips over the else branch.
} else {
hr = E_OUTOFMEMORY;
}
}
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
OutOfMemory:
0100126f mov
ebx,0x8007000e
pqa->Release();
ReleasePQA:
01001274 mov
rcx,[rsp+0x58]
01001279 mov
rax,[rcx]
0100127c call
qword ptr [rax+0x10]
; hr = E_OUTOFMEMORY
; arg1 = pqa
; rax = pqa.vtbl
; release
eax,ebx
rsp,0x2c0
r15d
r14d
r13d
r12d
rdi
rsi
rbx
;
;
;
;
;
;
;
;
;
The return value is stored in rax, and then the non-volatile registers are restored before returning.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Itanium Architecture
The Intel Itanium processor has several features that do not appear on the x86 processor:
Registers
The Itanium has a large number of registers.
Many of the registers are further subdivided into categories such as static, stacked, and rotating.
When discussing register preservation conventions, the term preserved refers to a register whose value must be preserved by a function, and scratch refers to a register whose
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Integer Registers
The 128 integer registers are named r0 through r127 and break down as follows:
r0 r31 Static general registers
r32 r127 Stacked general registers
Some of the registers have special meaning, most of which are assigned by convention rather than hardware requirement. (The only one that is a hardware requirement is r0.)
r0
Reads as zero (writing will AV)
gp
Global pointer (r1)
ret0 ret3 Function return values go here (r8 through r11).
sp
Stack pointer (r12)
r13
TEB
By convention, registers r4 through r7 are preserved. You also should not change the TEB pointer.
The gp register points to your global variables. To access a global variable, you have to indirect OFF the gp register. The gp register is kept up-to-date when you jump from
one DLL to another (by means described later).
The other static registers are scratch.
All integer registers are 64 bits, with a magic NaT bit attached to each one. NaT stands for "not a thing" and is used by speculative execution to indicate that the register
values are undefined.
The static integer registers do not participate in register stacking. The behavior of the stacked registers (including their preservation rules) will be described in Procedure Calls
and the Register Stack subsection of this section.
The return value registers hold function return values and therefore can be destroyed across a function call. Notice that there are four integer return value registers at 64 bits
each, for a total of 256 bits or 32 bytes of data that can be returned from a function (twice the size of a GUID).
Floating-Point Registers
f0
Reads as 0.0 (writing to it will cause an access violation).
f1
Reads as 1.0 (writing to it will cause an access violation).
f2 f31 Static floating-point registers.
f32 f127 Rotating floating-point registers
This document does not discuss floating-point code.
By convention, floating-point registers f2 through f5 and f16 through f31 are preserved across calls; the rest are scratch.
Predicate Registers
pr0
Reads as TRUE (writes are ignored).
pr1 pr15 Static predicate registers.
pr16 pr63 Rotating predicate registers.
Predicate registers act as flags. They record the result of comparison instructions, and you can test them later to perform some sort of conditional action (called "predication").
You can predicate almost any instruction, not just jump instructions. For example,
(p1)
add
instruction means "set register ret0 equal to register r32 plus register r33 if register p1 is TRUE; otherwise, do nothing." Allowing arbitrary predication helps performance
significantly: You have fewer jump instructions and therefore less misprediction You can also pack your instructions more compactly, because jump targets must begin on a
bundle boundary, but predicated instructions can go anywhere.
The parenthesized predicate register is called the qualifying predicate (abbreviated as "qp"). Because predicate register zero is always TRUE, unconditional instructions are
internally encoded as conditional on p0.
By convention, predicate registers pr6 through pr15 are scratch; the rest are preserved.
There is a special pseudo-register called pr (called preds by the debugger) that consists of the 64 predicate registers combined to form a single 64-bit value. This lets you read
and write all the predicate registers so you can preserve them across a call.
Branch Registers
The branch registers b0 through b7 are used for computed jump instructions. These are dedicated to computed jumps so the processor can optimize more efficiently for them.
By convention, the following meanings are assigned to the branch registers.
br
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Application Registers
Of the application registers, ar.unat and ar.lc must be preserved across calls.
r34 = ar.pfs, 2, 2, 2, 0
Essentially, this means: Set up the register stack frame as follows: 2 input registers, 2 local register, 2 output registers, and zero rotating registers. Save the previous register
frame state (pfs) in register r34 so it can be restored later.
This instruction shuffles the registers like this:
static
local rgn
output
r0
...
r31 r32 r33 r34 r35 r36 r37 ...
+--------------+---------------+-------+---------| 0
...
aaa| 3
4 pfs ???|??? ???|...
+--------------+---------------+-------+---------The static registers did not change. What used to be the output registers are now the input registers; the local registers are uninitialized (except for register r34, which was
explicitly set to ar.pfs by the first parameter of the alloc instruction). What used to be in the local variables got pushed onto the register stack; they are not accessible to the
called function.
Note The distinction between input and local registers is purely semantic. It makes no difference for the processor. The only important thing to the encoding of the instruction
is the size of the local region, so when you read the instruction in disassembly, the first number is the size of the local region and the second number is always zero. Thus, the
preceding alloc instruction will be disassembled as
alloc r34 = ar.pfs, 4, 0, 2, 0
Note In reality, this register shuffling process happens in two stages. The br.call instruction is the one that renumbers the registers. The alloc instruction is the one that
describes the layout of the registers on the receiving side. However,in simple cases, you can act as if the alloc instruction does it all. In complicated situations, you may want
to execute multiple alloc instructions to reinterpret all your registers.
The called function now performs its operation, maybe calls some other functions, and then when it is ready to return, the registers look like this:
static
local rgn
output
r0...ret0..r31 r32 r33 r34 r35 r36 r37 ...
+--------------+---------------+-------+---------| 0...rrr...aaa|xxx yyy zzz www|??? ???|...
+--------------+---------------+-------+---------It has placed the function return value (rrr) into the ret0 register. All the registers in the local region contain whatever values are left over from the computation.
When control returns to the calling function, the register stack is popped and the registers look like this:
static
local rgn
output
r0...ret0..r31 r32
r36 r37 r38 r39 ...
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The gp Register
The gp register is used to access global variables in your module. The rules for its management are complicated:
Call to function in same module: Simply call it, there is no need to use gp. The gp register will still be valid on return.
Call to function in other module: Set up gp appropriate for the module you are calling, then restore it after the function returns.
So how do you set up gp for the target? A function pointer on the Itanium is really a pointer to a block of data that describes the target function. One of the items in that block
of data is the value of gp that the target function expects.
Return to the sampleFunction example. Assume this is an exported function. In this case, the code to call it would be:
mov
mov
addl
ld8
ld8
ld8
mov
br.call
mov
r37 = 3
r38 = 4
r31 = 0x108, gp;;
r30 = [r31];;
r41 = [r30], 8;;
gp = [r30]
b6 = r41
rp = b6;;
gp = ...
This means that if you try to disassemble at sampleFunction, you will end up just looking at the function descriptor rather than the function itself. The function itself begins
with a dot, so if you want to see the code for sampleFunction you have to type u .sampleFunction.
=
=
=
=
=
=
=
=
0
0
0
0
0
0
0
0
gp
r3
r5
r7
r9
r11
r13
r15
r17
r19
r21
r23
r25
r27
r29
r31
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
77560000
c000000000000309
1010aa0
0
ffffffffffffffff
ffffffff
6fbfffdc000
0
e0000165e11ae910
0
e000000086b8ee20
1
2f
6
6fbff
0
preds =
8941
dbi1
dbi3
dbi5
dbi7
dbd1
dbd3
dbd5
dbd7
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
r2
r4
r6
r8
r10
sp
r14
r16
r18
r20
r22
r24
r26
r28
r30
intnats
=
=
=
=
=
=
=
=
0
0
0
0
0
0
0
0
=
6fbffc90bf0 0
=
78190000 0
=
6fbfffde000 0
=
6fbffe8d948 0
=
0 0
=
6fbffe8d520 0
=
6fbffc90be8 0
= e0000165e11ae7f0 0
=
6fbffc90bec 0
=
9804c8a70033f 0
= e000000086b96040 0
=
7f05 0
=
14e 0
=
6fb000006fb 0
=
103 0
=
0
b0
b2
b4
b6
=
=
=
=
772b43b0
766e9e88
0
772ba2e0
b1
b3
b5
b7
= e0000000ffa005c0
=
0
=
0
=
0
unat
ec
dcr
bsp
=
=
=
=
0
0
7f05
6fbffe90cc8
lc
ccv
pfs
bspstore
=
0
= e000000086c577b0
= c000000000000309
=
6fbffe90cc8
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
rsc
ipsr
ifs
eflag
ssd
fsr
fdr
=
f
=
1013082a6018
= 8000000000000204
=
202
= cf3fffff00000000
=
0
=
0
r32 =
r34 =
rnat
iip
fcr
csd
cflag
fir
6fbffe8d948 0
104 0
=
0
=
772b4310
=
40
= cfbfffff00000000
=
111
=
0
r33 =
r35 =
6fb000006fb 0
8941 0
At the top of this display are eight instruction debug registers (dbi) and eight data debug registers (dbd).
Next come the static integer registers, followed by intnats, which consists of all the NaT bits combined to form a 32-bit integer.
Then preds, which is all the predicate registers combined into a 64-bit integer.
Next are all the branch registers.
Then there are several special-purpose registers. Of these, the following two are probably the only ones you will need to deal with:
Finally shown are the registers for the current register stack frame. You happen to be in a function that has four registers in its frame, so the debugger showed the first four
stacked registers, r32 through r35. If the function used more registers, this part would have been larger.
Notation
x
1 (byte), 2 (word), 4 (long) or 8 (quad)
Ra, Rb, Rc... Registers
Signed n-bit constant
immn
Rb/immn
Register or a constant
Ba/addr
cc
Rb<n1, n2>
f
For example, Rb<5, 4> means "extract 4 bits from Rb starting at position 5," which is the value (Rb >> 5) & 0x0F.
Many instructions can be modified by suffixes called completers.
Addressing Modes
Unlike the x86 instruction set, which has a significant number of addressing modes, the Itanium instruction set has only one addressing mode: Register indirect. The notation
for register indirect is "[r]" which means "the value stored at memory location r." The thing inside the brackets is always a register.
M - Memory/Move instruction
I - Complex Integer/Multimedia instruction
A - Simple Integer/Logic/Multimedia instruction
F - Floating-Point instruction (Normal/SIMD)
B - Branch instruction
Many instructions can be used in multiple slot types, in which case a completer is specified to disambiguate them. For example, there are five different nop instructions
(nop.m, nop.i, nop.f, nop.b, nop.x) depending on which type of slot it was placed into.
Each valid combination of instruction categories is called a template. There are 32 different templates. Some of the templates differ only in the placement of stops.
A stop is used to indicate that instructions after the stop depend on instructions before the stop. For example, if you have the following series of instructions
mov r3 = r2
add r1 = r2,r4 ;;
add r2 = r1,r3
there is no dependency between the first two instructions, but the third instruction cannot execute until after the first two have completed. Therefore, the compiler inserts a
stop, represented by a double semicolon, after the second instruction.
Note that a stop does not have to go at the end of a bundle. There are some bundle templates that have stops in the middle and some that have more than one stop. For
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
example, template 11 is an M|MI| instruction. Slot 0 (zero) is a memory access, then there is a stop after slot 0 (zero), then slot 1 is another memory access, then slot 2 is an
integer instruction, then there is another stop after slot 2.
An instruction group is a sequence of instructions up to the next stop, taken branch, interrupt, or exception. The instructions within an instruction group cannot have
dependencies among them. This allows the processor to execute them in parallel.
There are some exceptions to the no dependencies rule.
A branch instruction is allowed to depend on a predicate register and branch register set elsewhere in the group.
You can use the result of a successful ld.c without an intervening stop.
Instructions after a branch will implicitly depend on whether the branch was taken; this is acceptable. However, instructions after a branch cannot interfere with
instructions before the branch.
Comparison instructions .and, .andcm, .or and .orcm are allowed to combine with others of the same type into the same target registers. (This means you cannot
combine an .and with an .or.)
You are allowed to write to a register after a previous instruction reads it, with rare exceptions.
Two instructions in the group cannot both write to the same register, with the exception of combined comparison instructions as already noted.
This description omits a number of details that are important only to compiler-writers or people hand-writing Itanium assembly. When reading disassembly, you can assume
that the compiler or author generated correct code, unless you are tracking a compiler bug.
Speculative Execution
The ld instruction (load from memory) supports an .s completer, which means that execution of the instruction is speculated. (You cannot speculatively write to memory.)
An instruction that can be speculated is called a speculative instruction, rather than a speculatable instruction. Consequently, this documentation will use the word
"speculated" to refer to the .s variant of the ld instruction.
A speculated load is just like a regular load, except that if an exception occurs, the processor sets the NaT bit in the destination register instead of raising the exception.
If any input to an integer computation instruction has the NaT bit set, then the result of the computation will also have the NaT bit set. If any input to a comparison instruction
has the NaT bit set, then the result of the comparison is always FALSE.
You can also speculate floating-point instructions, but instead of setting the NaT bit, the entire floating-point register is set to a special NaT-like value called NaTVal. As with
the integer case, NaTVal infects all subsequent computations.
Perhaps you realize that the speculated execution was not necessary. (Maybe you started going down the TRUE branch of an IF statement, only to discover that the value is
FALSE.) In which case, you just ignore the registers that you changed with the speculated execution and continue on your way. (Don't look at them, of course, because they
might be NaT.)
If you decide that the speculated execution was worthwhile, execute a chk.s instruction, which means "verify that this register contains an actual value. If it is a NaT, then
jump to the recovery code." The recovery code typically just consists of all the speculated instructions re-executed normally, so the exception can be raised.
Aside from the instructions previously mentioned, which can handle NaTs and a few other special instructions, attempting to use the value of a NaT register will cause an
exception. This is not useful in general because you cannot tell which speculated instruction caused the exception.
Advanced Loads
The Itanium contains special techniques to optimize in the face of aliased pointers. For example, consider this code snippet:
int MyNewFcn(int *p1, int *p2)
{
*p1 = 1;
*p2 = 2;
return *p1;
}
This function usually returns 1, but if p1 and p2 both point to the same address, then it will return 2.
The advanced load instruction ld.a means "load this value from memory and remember the access as successful." If there is a subsequent write to that address, it is removed
from the list, rendering the advance load unsucessful. (Other events can remove an entry from the list; for example, if you ask it to remember too many advanced loads, it
starts forgetting the older ones.)
Later on, you can check whether the advance load is still valid. If it is not, it means that the value was modified and you have to reload it.
There are two types of checks. The simplest check is ld.c.nc or ld.c.clr. This says, "Check if that advanced load is still valid. If not, then reload the value." The .clr completer
means that this advanced load is not important anymore, so the processor can free up the entry for recording new advanced loads; the .nc completer means that this advanced
load is still valuable, so do not clear it from the table.
Here is an example that uses ld.c.clr.
ld8.a
r6 = [r8]
...
ld8.c.clr r6 = [r8]
...
;;
//
//
//
//
In order to avoid a stall, the compiler requested that register r6 be loaded from the memory address specified by register r8 in advance of when it actually needed the result.
Then, the compiler wanted to use the value in r6, but had not determined if, in the meantime, some pointer dereference had modified the value, thus rendering the prefetched
value in r6 useless.
The ld8.c.clr instruction checks if anything has written to that address (even on another processor). If not, then the instruction does nothing. However, if something has indeed
written to the address, then the instruction refetches the value (taking the memory stall).
The second type of check is if you need more complicated recovery than just reloading the value.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
r6 = [r8]
r5 = r6, r7
continue
;;
;;
//
//
//
//
;;
After doing some precomputation with the value you read from r8, you execute a chk.a.clr instruction, which checks if your advanced load is still valid. If not, you jump to
failed, where you reload the value and redo the precomputation, then jump back to continue normal execution.
Register Rotation
Register rotation is an advanced technique where the registers renumber themselves each time they go through a loop. It is not covered in this documentation.
Control Flow
The types of control flow you will see most of the time are jump (br.cond), call (br.call), and return (br.ret). (Conditional jumps are just regular jump instructions with a
qualifying predicate attached in front.)
The jump and call instructions also have long versions (brl) if the target of the jump is really far away.
The brl instruction is actually emulated on Itanium, so do not expect it to be fast.
Branch Prediction
Each of the standard jump instructions also includes a group of completers. The first completer determines whether the jump should be predicted taken or not taken.
Prediction hardware might not be able to tell, because this instruction was never encountered before, or it was last encountered so long ago that it fell out of the cache.
The second completer specifies how aggressively you should prefetch after the cache. In other words, how sure are you that the prediction is correct.
.few: Prefetch a few instructions. Your prediction could be wrong, or it is not worth prefetching.
.many: Prefetch several instructions. You are confident that your prediction is correct.
Most jumps within a procedure will be marked .few, whereas unconditional subroutine calls and unconditional return instructions are usually marked .many.
Finally, there is an optional completer.
If you clear the entry, the processor will wipe out any knowledge of this jump instruction. Do this if you know the instruction will not be encountered again for a long time.
There is also a bonus instruction brp whose sole purpose is to indicate to the processor: "That computed jump instruction ahead is going to jump to here."
Comparisons
In its simplest form, the comparison instruction compares two values and stores the result into two predicate registers; one gets the the result of the comparison, and the other
gets the opposite of the result. For example,
cmp.eq
compares the two registers for equality and stores the result into p1. Meanwhile, the p2 register gets the opposite value. For example, if they were equal, then p1 would be
TRUE and p2 would be FALSE.
The next most complicated comparison instruction is called the unconditional comparison and it is always used with a qualifying predicate. Here is a sample unconditional
comparison:
(p3)
If the qualifying predicate p3 is TRUE, then this acts just like a regular comparison instruction. However, if the qualifying predicate is FALSE, then both the p1 and p2
registers are set to FALSE. This is a rare case where a qualifying predicate has an effect even though it is FALSE. (Normally, if a qualifying predicate is FALSE, the entire
instruction is ignored.)
The next most complicated comparisons are the parallel comparisons. These are used when you have a chain of "a && b && c" or "a || b || c" results. Here is a sample AND
parallel comparison:
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
p5, p0 = r0, r4
p5, p0 = r5, r6
Notice that because these are both OR type comparisons, they can be combined into a single instruction group and, therefore, executed in parallel.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Itanium Instructions
Only the instructions most likely to be encountered in user-mode code are detailed here. Instructions marked with an asterisk (*) are particularly important.
The general notation for instructions is:
(qp)
op...
where (qp) is the optional qualifying predicate, the ellipses (...) after the opcode are optional completers, dest is the destination (or destinations, for comparison operators),
and src is the source.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Store to memory.
Store with postincrement.
Special Registers
mov Ra = S Read from special register.
mov S = Ra Write to special register.
Special registers, in general, can only be read from and written to. They do not take part in arithmetic computations and cannot be compared against directly.
mov pr = Ra, mask Write to predicate registers.
The mask specifies which predicate registers should be loaded from register Ra. The bottom bit of the mask corresponds to predicate register p1, through bit 14 of the mask
corresponding to predicate register p15. Bit 15 of the mask represents all the predicate registers p16 through p63. (Recall that predicate register zero is hard-wired to TRUE.)
Recall that the predicate register preservation rules are established by convention, so the only masks you are likely to see are -1 (restore all registers) and 0x801F (preserve all
the usual registers).
Interlocked Instructions
xchgx... Ra = [Rb], Rc Interlocked exchange
Store Rc to [Rb] and return the original value in Ra.
cmpxchgx... Ra = [Rb], Rc, ar.ccv Conditional exchange
Check if the value in [Rb] is equal to the special ar.ccv register. If so, store Rc to [Rb]; otherwise, leave it unchanged. In either case, return the original value of [Rb] in Ra.
fetchaddx... Ra = [Rb], Rc/n Interlocked add
Atomically adds Rc/n to [Rb], returning the previous value in Ra.
Control Flow
* br.cond... Ba/addr Branch
* br.call... Ba/addr Call
* br.ret... Ba/addr Return
See the Control Flow section in Itanium Architecture for a description of the various completers.
There are other types of branch instructions as well, but these are not used as much.
Arithmetic
* add Ra = Rb,Rc
Ra = Rb + Rc
* add Ra = Rb,Rc,1 Ra = Rb + Rc + 1
* adds Ra = imm14,Rb Ra = imm14 + Rb
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Multiplication
There is a special floating-point format for handling integer multiplication.
* setf.sig Fa = Rb
Fa = Rb (special form)
* getf.sig Ra = Fb
Ra = Fb (special form)
* xma... Fa = Fb, Fc, Fd Fa = Fb * Fc + Fd (special form)
The setf.sig and getf.sig instructions transfer between integer registers and floating-point registers (in the special form).
The xma instruction performs the operation on numbers in special form, and the result is also in special form.
There are four variations on the xma instruction. The .l version saves the low 64 bits of the result, the .h version saves the high 64 bits of the result, and the .u version
performs an unsigned multiplication, rather than a signed multiplication.
For example, xma.lu performs the multiplication as two unsigned integers and saves the low 64 bits of the result.
Bits
* and
* or
Ra = Rb/imm8,Rc Ra = Rb/imm8 or Rc
The andcm instruction clears the bits specified by the last parameter.
* shl Ra = Rb,Rc/n Ra = Rb SHL Rc/n
* shr Ra = Rb,Rc/n Ra = Rb SAR Rc/n
* shr.u Ra = Rb,Rc/n Ra = Rb SHR Rc/n
The shx instructions do shifting. A more general form of shifting is performed by the extr and dep instructions.
* extr Ra = Rb, n1, n2 Ra = Rb<n1, n2>
* extr.u Ra = Rb, n1, n2 Ra = Rb<n1, n2>
The regular version of the extr (extract) instruction sign-extends the result, whereas the extr.u form zero-extends the result. The bit extraction instructions are also used to
handle unaligned data.
* dep Ra = Rb, Rc, n1, n2 Ra<n1, n2> = Rb;
other bits come from Rc
The dep (deposit) instruction builds its output by taking the <n1, n2> part from Rb and the rest of Rc. Think of it as a masked blt.
* shrp Ra = Rb, Rc, n Ra = (Rb:Rc)<n, 64>
The shrp (shift right pair) instruction treats Rb and Rc as a huge 128-bit value and extracts 64 bits of it into the Ra register.
Constants
* movl Ra = n Load 64-bit number.
Small numbers (up to 22 bits) can be loaded using add Ra = n, r0 instruction. Larger numbers require the movl instruction. This is one of the few instructions that takes up
two slots.
Comparisons
* cmp.cc p1, p2 = Ra, Rb Compare 64-bit values.
* cmp4.cc p1, p2 = Ra, Rb Compare 32-bit values.
See Comparisons section in Itanium Architecture for a detailed explanation.
* tbit p1, p2 = Ra, n Test bit
The tbit instruction tests bit n in register Ra, setting both p1 and p2 accordingly.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Conversion
* sxtx Ra = Rb sign-extend Rb to Ra
* zxtx Ra = Rb zero-extend Rb to Ra
Idioms
* add
* add
* add
* sub
* subx
* xor
shrp
Ra = r0, n
mov Ra = n
Ra = r0, Rb
mov Ra = Rb
Ra = Rb, r0, 1 inc Ra = Rb
Ra = Rb, r0, 1 dec Ra = Rb
Ra = r0, Rb
negx Ra = Rb
Ra = -1, Rb
not Ra = Rb
Ra = Rb, Rb, n rotl Ra = Rb, n
You can rotate by doing a paired shift where the two input registers are the same.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
fViewObjectChanged = TRUE;
ReleaseAndNull(&m_pvo);
}
if (psv) {
psv->SaveViewState();
psv->DestroyViewWindow();
psv->Release();
}
m_hwndView = NULL;
m_fHandsOff = FALSE;
if (m_pcache) {
GlobalFree(m_pcache);
m_pcache = NULL;
}
m_psb->EnableModelessSB(TRUE);
CancelPendingActions();
}
ReleaseAndNull(&_psf);
if (fViewObjectChanged)
NotifyViewClients(DVASPECT_CONTENT, -1);
if (m_pszTitle) {
LocalFree(m_pszTitle);
m_pszTitle = NULL;
}
SetRect(&m_rcBounds, 0, 0, 0, 0);
return S_OK;
}
Assembly Code
This section contains the annotated disassembly.
HRESULT CUserView::CloseView(void)
On entry to a function, the parameters are passed in registers r32 through r39. Remember that for C++ functions, the first parameter is the secret "this" pointer. Therefore, on
entry to CUserView::CloseView, the registers are:
r32 = this
br = return address
Parameters are passed in r32 through r39.
The br variable contains the function return address.
The Itanium separates its registers into several categories. The ones you will see most are r (regular integer registers), b (branch registers, used for branching), and p
(predicate registers, which can hold the value TRUE or FALSE).
It so happens that CloseView is a method on ViewState, which is at offset 12 in the underlying object. This method will be referred to as "this," although when there is
possible confusion with another base class, it will be more carefully specified as "(ViewState*)this".
sample!.CUserView__CloseView:
Notice that the symbol name is preceded by a dot. Recall that function pointers on the Itanium are not pointers to code. Instead, they point to a descriptor block (Intel calls it
the PLABEL), which contains information about the function (including the address of its first instruction). The symbol without a leading dot represents the function
descriptor. The symbol with a leading dot is the first line of code.
{
717796c0
717796c4
alloc
mov
The alloc instruction builds a stack frame. In this case, the stack frame has the local region with 10 (0ah) registers and it needs 5 output registers. Recall that in disassembly,
the input registers and local registers are combined to form the local region. Because you know that you have only one parameter ("this"), there must be 9 local registers.
Every function begins with an alloc instruction.
Because you have a total of 10 registers in your local region, and the local region begins with register r32, the local region registers must be r32 through r41, leaving r42
through r46 as the 5 output registers.
The second instruction saves the predicate registers (pr) into register r40. This allows the predicate registers to be restored before the function returns.
if (m_fDestroyed) return S_OK;
717796c8
adds
r31 = 0180h, r32
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
This is equivalent to "r31 = 0180h + r32". The adds instruction adds a small integer to a register. There is a corresponding addl instruction that adds a large integer, but it can
only add to registers r0, gp, r2, and r3.
Arithmetic operations are of the form "op dst = src, src, src".
Before proceeding with the computations, you need to finish the function prologue.
717796d0
717796d4
717796d8
717796e0
adds
ld8.nta
mov
or
sp = -32, sp ;;
// local stack space
r3 = [sp]
// stack probe
r38 = rp
} // save return address
r41 = gp, r0 ;;
// save gp
Notice that the integer argument to the adds sp instruction is disassembled in decimal rather than hexadecimal. However, the debugger default is to assume hexadecimal for
all inputs, so the command ?sp-32 will typically display as "sp-0x32". You can use the n (Set Number Base) command to change the default radix to 10. (The default radix
can be overridden with the 0x hexadecimal prefix or the 0n decimal prefix.)
The next adds instruction allocates some space on the stack. It is followed by a load instruction that appears unusual.
The ld instruction loads a register from memory.
The "nta" suffix means "this memory location will not be accessed for a long time" and is an indication to the processor to allow it to better optimize its L2 cache. The only
place you will see it in regular code is at the top of a function to perform a stack probe.
The third instruction saves the return address into register r38 so you know where to go when this function is finished.
The fourth instruction says, "r41 = gp | r0".
The r0 register is hard-wired to the value zero.
Therefore, ORing something with zero and storing the result is the same as copying the value.
"or dest = src, r0" copies a register.
The gp register, by convention, always points to the current module's global variables.
Because you are calling functions that might belong to other DLLs, you need to save the gp register so you can access your global variables after calling those functions. This
will require the gp register to point to their global variables.
717796e4
717796e8
ld4
nop.i
r31 = [r31]
00h ;;
// r31 = m_fDestroyed
}
The ld4 instruction is another memory fetch, but this time you load only 32 bits (4 bytes) from memory instead of a full 64 bits.
The ld4 instruction zero-extends the loaded value to 64 bits.
The next instruction is a NOP. The suffix indicates that this is actually an integer NOP However, this is not important, because the instruction does nothing.
717796f0
717796f4
717796f8
{
(p15)
// if m_fDestroyed
}// jump if not to ReturnSOK
The cmp4.eq instruction compares the bottom 32 bits of the two registers r0 and r31. The result of the comparison is saved into the p14 register, and the opposite result is
saved to p15.
The cmp instruction compares two registers. The result of the comparison is saved in the first destination register; the opposite is saved in the second destination register.
The cmp4.eq instruction compares the r31 register (which you just loaded) with r0 (which is zero). If the registers are equal, then p14 is set to TRUE; otherwise, p14 is set to
FALSE. The p15 register is set to the opposite of p14 (that is, FALSE or TRUE, respectively).
After another NOP, check the result of the comparison.
A parenthesized register in the left margin indicates that the instruction is executed only if that register is TRUE.
In this case, you execute the branch instruction only if the p15 register is TRUE, which happens when the previous comparison is FALSE, because p15 was the second
destination of the comparison.
The suffixes on the br.cond instruction are hints to the processor for optimization and do not affect the execution semantics.
The target of the branch instruction is not quite right. The target is disassembled as $+07c0h, but the actual target address is 07b8h bytes away. That is because the branch
target is computed relative to the beginning of the instruction bundle (in other words, relative to the preceding open brace). Thus, when you are disassembling through code
and trying to follow the flow of the code, be careful how you compute your jump targets.
Jump instructions are relative to the start of the bundle, not to the start of the instruction.
Now you can see how that gp register gets used. The compiler has interleaved some instructions for performance, so the next step it does is actually the initial step for calling
an imported function.
ReleaseAndNull(&m_pdtgt);
71779700
{
addl
71779704
adds
r31 = -2025856, gp
r42 = 0198h, r32
// r31 = &__imp__ReleaseAndNull
// r42 = &this->m_pdtgt
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Because the gp register points to your global variables, the addl instruction against the gp register is computing the address of a global variable. In this case, it is the import
table entry for the ReleaseAndNull function.
As you computed at the beginning of the function, the output registers start at r42, and here you see the first output register being loaded with the address of the m_pdtgt
member. This is the first, and in this case, the only parameter of ReleaseAndNull.
if (m_psv)
71779708
adds
The compiler has aggressively started emitting instructions for the line two ahead of where you are.
BOOL fViewObjectChanged = FALSE;
71779710
{
or
r37 = r0, r0 ;;
; r37 = 0
The compiler used the r37 register to represent the local variable fViewObjectChanged. Because the r0 register is hard-wired to zero, the OR instruction zeroes out the r37
register.
ReleaseAndNull(&m_pdtgt);
71779714
ld8
r31 = [r31]
71779718
nop.i
00h ;;
71779720
{
ld8
r30 = [r31], 08h ;;
71779724
ld8
gp = [r31]
71779728
mov
b6 = r30, $+0x0
71779730
{
nop.m
00h
71779734
nop.f
00h
71779738
br.call.dptk.many rp = b6 ;;
// r31 = &ReleaseAndNull
}
// r30 = .ReleaseAndNull
// gp = gp.ReleaseAndNull
}// b6 = .ReleaseAndNull
Here is the remainder of the function call. Recall that a function pointer is really a pointer to a descriptor. Thus, after getting the address of the descriptor, you read the actual
code address and the gp of the target function.
The following diagram outlines this concept.
__imp__Function
+--------------+
| Function
--->
+--------------+
Function
+---------------+
| code pointer --->
+---------------+
| gp
|
+---------------+
.Function
+-----------------------+
| code...
|
|
|
|
|
|
|
Remember, a function name without a period in front of it refers to the function descriptor. The function with a period represents the first line of code.
"ld dest = [src], n" is a post-incremented load.
In this case, "ld8 r30 = [r31], 08h" means "load the r30 register from the 8 bytes pointed to by r31, and then increment r31 by 8."
After you load the code address into r30, you move it into the b6 register so you can branch to it. You cannot move from memory directly into a branch register; you have to
go through a regular integer register.
Finally, execute a br.call instruction to call the target function. (Again, the other suffixes are optimization indications.)
You will see this pattern repeatedly; it is the template for calling an imported function.
To call an imported function
1.
2.
3.
4.
5.
6.
if (m_psv)
71779740
{
71779744
71779748
71779750
{
71779754
71779758
(p14)
ld8
r29 = [r33]
or
gp = r41, r0 ;;
cmp.eq
p14, p15 = r0, r29
nop.m
00h
nop.f
00h
br.cond.dpnt.few $+0620h ;;
// r29 = m_psv
// restore gp
}// m_psv == 0?
After control returns, dereference the r33 register, which you set up before calling ReleaseAndNull. The processor automatically preserves the local region across calls, so
the r33 register still contains the value you set up earlier.
After returning from the imported function call, restore the gp register to point to your own global registers so you can access them once again. (Though theoretically this
often is not necessary because you do not access any global variables before the next call that discards it anyway.)
The following is again a comparison followed by a predicated branch instruction. Check if the value you loaded is zero and branch it if it is.
71779760
71779764
71779768
71779770
m_psb->EnableModelessSB(FALSE);
{
adds
r36 = 0a0h, r32
addl
r43 = 00h, r0
nop.b
00h ;;
{
ld8
r42 = [r36] ;;
// r36 = &this->m_psb
// r43 = 0
}
// r42 = this->m_psb
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
71779774
71779778
71779780
71779784
71779788
71779790
71779794
71779798
717797a0
717797a4
717797a8
ld8
r31 = [r42]
nop.i
00h ;;
adds
r31 = 048h, r31 ;;
ld8
r30 = [r31]
nop.i
00h ;;
ld8
r29 = [r30], 08h ;;
ld8
gp = [r30]
mov
b6 = r29, $+0x0
nop.m
00h
nop.f
00h
br.call.dptk.many rp = b6 ;;
// r31 = this->m_psb.vtbl
}
// r31 = &vtbl.EnableModelessSB
// r30 = &EnableModelessSB
}
// r29 = .EnableModelessSB
// gp = gp.EnableModelessSB
}// b6 = .EnableModelessSB
Now you get to see how a virtual C++ method call gets compiled. As before, registers r42 and r43 receive the parameters to the function.
This time, instead of getting the function pointer from your gp, you load the vtbl out of m_psb, step forward to the method you want to call, then set up for another function
call.
The following diagram outlines this process.
object
+-------+
| vtbl --->
+-------+
| ...
|
object vtbl
+-----------------+
| QueryInterface |
+-----------------+
| AddRef
|
+-----------------+
| Release
|
+-----------------+
| ...
|
+-----------------+
| EnableModeless --->
+-----------------+
| ...
|
EnableModeless
+---------------+
| code pointer --->
+---------------+
| gp
|
+---------------+
.EnableModeless
+-----------------------+
| code...
|
|
|
|
|
|
|
717797b0
717797b4
717797b8
717797c0
717797c4
717797c8
717797d0
717797d4
717797d8
717797e0
717797e4
717797e8
717797f0
717797f4
717797f8
71779800
71779804
71779808
71779810
71779814
71779818
NoWS:
if (m_pws) m_pws->ViewReleased();
{
adds
r28 = 0228h, r32
or
gp = r41, r0
nop.b
00h ;;
{
ld8
r42 = [r28] ;;
cmp.eq
p14, p15 = r0, r42
nop.i
00h
{
nop.m
00h
nop.f
00h
(p14)
br.cond.dpnt.few $+050h ;;
{
ld8
r31 = [r42] ;;
adds
r31 = 018h, r31
nop.i
00h ;;
{
ld8
r30 = [r31] ;;
ld8
r29 = [r30], 08h
nop.i
00h ;;
{
ld8
gp = [r30]
mov
b6 = r29, $+0x0
br.call.dptk.many rp = b6 ;;
{
or
gp = r41, r0
nop.f
00h
nop.b
00h ;;
// r28 = &this->m_pws
// restore gp after call
}
// r42 = this->m_pws
// equal to zero?
}
}//
//
//
}
//
//
}
//
//
}//
//
Y: Jump to NoWS
r31 = this->m_pws.vtbl
r31 = &vtbl.ViewReleased
r30 = &ViewReleased
r29 = .ViewReleased
gp = gp.ViewReleased
b6 = ViewReleased
call .ViewReleased
restore gp after call
You are now familiar enough to read the following entire code sequence, which consists of another variable test, conditional jump, and method call:
71779820
71779824
71779828
71779830
71779834
71779838
71779840
71779844
71779848
// r31 = &__imp__GetCapture
// r30 = &GetCapture
}
// r29 = .GetCapture
// gp = gp.GetCapture
}// b6 = .GetCapture
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
71779850
or
gp = r41, r0
Again, a pattern you already recognize, but this time it is a call to an imported function:
71779854
71779858
71779860
71779864
71779868
71779870
71779874
71779878
//
}//
//
//
}
//
hwndCapture == NULL?
Y: Jump to NoCapture
r31 = &this->m_hwnd
r42 = this->m_hwnd
hwndCapture == this->m_hwnd?
addl
r31 = -2025920, gp
addl
r45 = 00h, r0
addl
r44 = 00h, r0
addl
r43 = 01fh, r0 ;;
ld8
r30 = [r31]
nop.i
00h ;;
ld8
r29 = [r30], 08h ;;
ld8
gp = [r30]
mov
b6 = r29, $+0x0
nop.m
00h
nop.f
00h
br.call.dptk.many rp = b6 ;;
or
gp = r41, r0
nop.f
00h
nop.b
00h
//
//
}//
//
//
}
//
//
}//
r31
r45
r44
r43
r30
=
=
=
=
=
&__imp__SendMessage
0 (lParam)
0 (wParam)
WM_CANCELMODE (uMsg)
&SendMessage
r29 = .SendMessage
gp = gp.SendMessage
b6 = .SendMessage
This time, you have to call a function that takes four parameters, so you fill the output registers r42 through r45 with the parameters. Note that you set up r42 ahead of time
while you were still deciding whether to call SendMessage.
m_fHandsOff = TRUE;
m_fRecursing = TRUE;
NotifyClients(m_psv, NOTIFY_CLOSING);
717798d0
{
ld8
r43 = [r33]
717798d4
adds
r42 = 040h, r32
717798d8
adds
r35 = 0218h, r32
717798e0
{
addl
r31 = 08001h, r0 ;;
717798e4
addl
r44 = 04h, r0
717798e8
nop.i
00h ;;
717798f0
{
ld8
r29 = [r42]
717798f4
ld4
r30 = [r35]
717798f8
nop.b
00h ;;
71779900
{
or
r31 = r31, r30 ;;
71779904
st4
[r35] = r31
//
//
}//
//
//
}
//
//
}
//
//
r43
r42
r35
r31
r44
=
=
=
=
=
m_psv
(CNotifySource*)this
&this->bitfield
0x8001
4
r29 = (CNotifySource*)this->vtbl
r30 = bitfield
set the two bits in r30
store the result
Now you get to see how bitfields get compiled, with some instructions from the upcoming method call interleaved. Recall that you set up the r33 register to point to the
m_psv member, so all you have to do is dereference it to fetch the value.
The other instructions prepare for the method call by setting up the output registers (r42 through r44) and loading the vtbl of m_psv.
Meanwhile, the two bits in the bitfield are set by loading the full bitfield, ORing the values, then storing the result.
71779908
71779910
71779914
71779918
71779920
71779924
71779928
NotifyClients(m_psv, NOTIFY_CLOSING);
adds
r29 = 018h, r29 ;;
{
ld8
r30 = [r29] ;;
ld8
r31 = [r30], 08h
nop.i
00h ;;
{
ld8
gp = [r30]
mov
b6 = r31, $+0x0
br.call.dptk.many rp = b6 ;;
}//
//
//
}
//
//
}//
r29 = &vtbl.NotifyClients
r30 = NotifyClients
r31 = .NotifyClients
//
//
}//
//
//
}//
//
r28 = bitfield
r42 = m_psv
r29 = ~0x8000
r29 = bitfield & ~0x8000
restore gp after call
r43 = 0 (SVUIA_DEACTIVATE)
store updated bitfield
gp = gp.NotifyClients
b6 = .NotifyClients
call .NotifyClients
71779930
71779934
71779938
71779940
71779944
71779948
71779950
m_fRecursing = FALSE;
{
ld4
ld8
addl
{
and
or
addl
{
st4
r28 = [r35]
r42 = [r33]
r29 = -32769, r0 ;;
r29 = r29, r28
gp = r41, r0
r43 = 00h, r0 ;;
[r35] = r29
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
71779954
71779958
71779960
71779964
71779968
71779970
71779974
71779978
71779980
71779984
71779988
m_psv->UIActivate(SVUIA_DEACTIVATE);
ld8
r31 = [r42]
nop.b
00h ;;
{
adds
r31 = 038h, r31 ;;
ld8
r30 = [r31]
nop.i
00h ;;
{
ld8
r29 = [r30], 08h ;;
ld8
gp = [r30]
mov
b6 = r29, $+0x0
{
nop.m
00h
nop.f
00h
br.call.dptk.many rp = b6 ;;
// r31 = m_psv.vtbl
}
// r31 = &vtbl.UIActivate
// r30 = &UIActivate
}
// r29 = .UIActivate
// gp = gp.UIActivate
}// b6 = .UIActivate
//
//
}//
//
//
}
//
//
}
//
//
}//
717799d0
717799d4
717799d8
717799e0
717799e4
717799e8
717799f0
717799f4
717799f8
if (m_pvo) {
{
{
(p14)
adds
r33 = 0178h, r32
or
gp = r41, r0
nop.b
00h ;;
ld8
r42 = [r33] ;;
cmp.eq
p14, p15 = r0, r42
nop.i
00h
nop.m
00h
nop.f
00h
br.cond.dpnt.few $+01a0h ;;
// r33 = &this->m_pvo
// restore gp after call
}
// r42 = this->m_pvo
// m_pvo == NULL?
}
71779a00
71779a04
71779a08
71779a10
71779a14
71779a18
71779a20
71779a24
71779a28
71779a30
71779a34
71779a38
71779a40
71779a44
71779a48
IAdviseSink *pSink;
if (SUCCEEDED(m_pvo->GetAdvise(NULL, NULL, &pSink)) ...
{
ld8
r31 = [r42]
// r31 = this->m_pvo->vtbl
adds
r45 = 010h, sp
// r45 = &pSink
addl
r44 = 00h, r0
}// r44 = NULL
{
addl
r43 = 00h, r0 ;;
// r43 = NULL
adds
r37 = 010h, sp
// r37 = &pSink
nop.i
00h ;;
}
{
adds
r31 = 040h, r31 ;;
// r31 = &vtbl.GetAdvise
ld8
r30 = [r31]
// r30 = &GetAdvise
nop.i
00h ;;
}
{
ld8
r29 = [r30], 08h ;;
// r29 = .GetAdvise
ld8
gp = [r30]
// gp = gp.GetAdvise
mov
b6 = r29, $+0x0
}// b6 = .GetAdvise
{
nop.m
00h
nop.f
00h
br.call.dptk.many rp = b6 ;;
}// call .GetAdvise
Now call the GetAdvise method, and check the return value.
71779a50
71779a54
71779a58
71779a60
71779a64
71779a68
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
After doing the combination testing, you jump if p14 is TRUE, which happens if one of the combination tests was true.
There are two interesting points to note about this sequence. First, the two combination comparisons were executed in parallel. (Notice that they execute as part of the same
instruction group.) Second, you only executed a single conditional jump. Furthermore, that conditional jump was part of the same instruction group, so it all executes in a
single cycle.
A traditional CPU would have had to test the return value, jump conditionally, then test pSink, and jump conditionally again.Those four operations are dependent on each
other, so it would take four cycles to perform the combination test instead of the one cycle that the Itanium required.
if (pSink == (IAdviseSink *)this)
adds
r31 = -40, r32 ;;
cmp.eq
p14, p15 = r0, r31
adds
r31 = 028h, r32
{
nop.m
00h
nop.f
00h
(p15)
br.cond.dpnt.few $+020h ;;
{
or
r31 = r0, r0
nop.f
00h
nop.b
00h ;;
71779a70
71779a74
71779a78
71779a80
71779a84
71779a88
71779a90
71779a94
71779a98
NotNULL:
// r31 = (CUserView*)this
// r31 == NULL?
}// r31 = (IAdviseSink*)this
This is a quirk of the C++ specification, namely that if p is a NULL pointer, then (T*)p must be equal to NULL for all types T. This means that changing from one base class
to another requires the compiler to stick in special checks for NULL.
At the end of the following sequence, the r31 register contains the result of the cast (IAdviseSink*).
if (pSink == (IAdviseSink *)this)
m_pvo->SetAdvise(0, 0, NULL);
cmp.eq
p15, p14 = r42, r31
nop.f
00h
(p14)
br.cond.dptk.few $+070h ;;
ld8
r42 = [r33]
addl
r45 = 00h, r0
addl
r44 = 00h, r0
addl
r43 = 00h, r0 ;;
ld8
r31 = [r42]
nop.i
00h ;;
adds
r31 = 038h, r31 ;;
ld8
r30 = [r31]
nop.i
00h ;;
ld8
r29 = [r30], 08h ;;
ld8
gp = [r30]
mov
b6 = r29, $+0x0
nop.m
00h
nop.f
00h
br.call.dptk.many rp = b6 ;;
ld8
r42 = [r37]
or
gp = r41, r0
nop.b
00h ;;
71779aa0
{
71779aa4
71779aa8
71779ab0
{
71779ab4
71779ab8
71779ac0
{
71779ac4
71779ac8
71779ad0
{
71779ad4
71779ad8
71779ae0
{
71779ae4
71779ae8
71779af0
{
71779af4
71779af8
71779b00
{
71779b04
71779b08
NotSameSink:
// r31 == pSink?
}//
//
//
}//
//
//
}
//
//
}
//
//
}//
N: Jump to NotSameSink
r42 = this->m_pvo
r45 = 0
r44 = 0
r43 = NULL
r31 = this->m_pvo->vtbl
r31 = &vtbl.SetAdvise
r30 = SetAdvise
r29 = .SetAdvise
gp = gp.SetAdvise
b6 = .SetAdvise
Notice that the compiler had to reload the r42 register after the call, because r42 is an output register, and output registers can be modified across a call. (That is not important
in this case, because you also explicitly destroyed the r42 register.)
pSink->Release();
}
71779b10
71779b14
71779b18
71779b20
71779b24
71779b28
71779b30
71779b34
71779b38
71779b40
71779b44
71779b48
NoSink:
ld8
r31 = [r42] ;;
adds
r31 = 010h, r31
nop.i
00h ;;
ld8
r30 = [r31] ;;
ld8
r29 = [r30], 08h
nop.i
00h ;;
ld8
gp = [r30]
mov
b6 = r29, $+0x0
br.call.dptk.many rp = b6 ;;
or
gp = r41, r0
nop.f
00h
nop.b
00h ;;
// r31 = pSink->vtbl
// r31 = &vtbl.Release
}
// r30 = &Release
// r29 = .Release
}
//
//
}//
//
gp = gp.Release
b6 = .Release
call .Release
restore gp after call
addl
or
addl
ld8
ld8
nop.i
ld8
r31 = -2025856, gp
r42 = r33, r0
r37 = 01h, r0 ;;
r30 = [r31] ;;
r29 = [r30], 08h
00h ;;
gp = [r30]
//
//
}//
//
//
}
//
r31
r42
r37
r30
r29
= &__imp__ReleaseAndNull
= r33 = &this->m_pvo
(fViewObjectChanged) = 1 = TRUE
= &ReleaseAndNull
= .ReleaseAndNull
gp
= gp.ReleaseAndNull
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
71779b74
71779b78
71779b80
71779b84
71779b88
mov
b6 = r29, $+0x0
br.call.dptk.many rp = b6 ;;
or
gp = r41, r0
nop.f
00h
nop.b
00h
// b6 = .ReleaseAndNull
}// call .ReleaseAndNull
// restore gp after call
}
Recall that the fViewObjectChanged local variable is being kept in the r37 register.
if (psv) {
psv->SaveViewState();
psv->DestroyViewWindow();
psv->Release();
}
71779b90
{
cmp.eq
p14, p15 = r0, r34
71779b94
nop.f
00h
71779b98
(p14)
br.cond.dptk.few $+0d0h ;;
71779ba0
{
ld8
r31 = [r34]
71779ba4
or
r42 = r34, r0 ;;
71779ba8
adds
r31 = 068h, r31 ;;
71779bb0
{
ld8
r30 = [r31] ;;
71779bb4
ld8
r29 = [r30], 08h
71779bb8
nop.i
00h ;;
71779bc0
{
ld8
gp = [r30]
71779bc4
mov
b6 = r29, $+0x0
71779bc8
br.call.dptk.many rp = b6 ;;
71779bd0
71779bd4
71779bd8
71779be0
71779be4
71779be8
71779bf0
71779bf4
71779bf8
71779c00
71779c04
71779c08
71779c10
71779c14
71779c18
71779c20
71779c24
71779c28
71779c30
71779c34
71779c38
71779c40
71779c44
71779c48
71779c50
71779c54
71779c58
NoPSV2:
Y: Jump to NoPSV2
r31 = psv->vtbl
r42 = psv
r31 = &vtbl.SaveViewState
r30 = &SaveViewState
r29 = .SaveViewState
ld8
r28 = [r34]
or
gp = r41, r0
or
r42 = r34, r0 ;;
adds
r31 = 050h, r28 ;;
ld8
r29 = [r31]
nop.i
00h ;;
ld8
r27 = [r29], 08h ;;
ld8
gp = [r29]
mov
b6 = r27, $+0x0
nop.m
00h
nop.f
00h
br.call.dptk.many rp = b6 ;;
//
//
}//
//
//
}
//
//
}//
r28 = psv->vtbl
restore gp after call (pointless)
r42 = psv
r31 = &vtbl.DestroyViewWindow
r29 = &DestroyViewWindow
ld8
r30 = [r34]
or
gp = r41, r0
or
r42 = r34, r0 ;;
adds
r31 = 010h, r30 ;;
ld8
r28 = [r31]
nop.i
00h ;;
ld8
r29 = [r28], 08h ;;
ld8
gp = [r28]
mov
b6 = r29, $+0x0
nop.m
00h
nop.f
00h
br.call.dptk.many rp = b6 ;;
or
gp = r41, r0
nop.f
00h
nop.b
00h
//
//
}//
//
//
}
//
//
}//
gp = gp.SaveViewState
b6 = .SaveViewState
call .SaveViewState
r27 = .DestroyViewWindow
gp = gp.DestroyViewWindow
b6 = .DestroyViewWindow
The restores of gp after the function call are pointless, because the next function call is going to destroy it anyway. This is an actual compiler error; its optimizer should have
noticed that gp is not read before it is rewritten.
m_hwndView = NULL;
m_fHandsOff = FALSE;
71779c60
{
ld4
71779c64
adds
71779c68
adds
71779c70
{
ld8
71779c74
st4
71779c78
and
71779c80
{
st4
71779c84
st4
r30 =
r31 =
r33 =
r42 =
[r31]
r30 =
[r31]
[r35]
[r35]
0120h, r32
0108h, r32 ;;
[r33]
= r0, 04h
-2, r30 ;;
= r0
= r30
//
//
}//
//
//
}//
//
//
r30 = this->bitfield
r31 = &m_hwndView
r33 = &m_pcache
r42 = m_pcache
[r31] = NULL, r31 += 4
r30 = r30 & ~-2 (clear bit)
[r31] = NULL (other half)
bitfield = r30
The compiler is making additional errors. It splits the m_hwndView into two parts, storing the NULL two DWORDs at a time instead of as a single 64-bit store. The compiler
thinks that the m_hwndView member is unaligned so it has to split the store. So you now get to see a postincremented store.
"st [dest] = src, n" is a post-incremented store.
The "and r30 = -2, r30" clears the bottom bit.
71779c88
71779c90
71779c94
71779c98
if (m_pcache) {
cmp.eq
p14, p15 = r0, r42
{
nop.b
00h
nop.b
00h
(p14)
br.cond.dpnt.few $+090h ;;
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The r42 register was set up while you were clearing bits in the previous block of code.
GlobalFree(m_pcache);
addl
r31 = -2029288, gp ;;
ld8
r30 = [r31]
nop.i
00h ;;
{
ld8
r29 = [r30], 08h ;;
ld8
gp = [r30]
mov
b6 = r29, $+0x0
{
nop.m
00h
nop.f
00h
br.call.dptk.many rp = b6 ;;
71779ca0
71779ca4
71779ca8
71779cb0
71779cb4
71779cb8
71779cc0
71779cc4
71779cc8
// r31 = &__imp__GlobalFree
// r30 = &GlobalFree
}
// r29 = .GlobalFree
// gp = gp.GlobalFree
}// b6 = .GlobalFree
st1
or
nop.b
st1
st1
nop.i
st1
st1
nop.i
st1
st1
nop.i
st1
nop.f
nop.b
// [r33] = 0, r33++
// restore gp after call
}
// [r33] = 0, r33++
// [r33] = 0, r33++
}
// [r33] = 0, r33++
// [r33] = 0, r33++
}
// [r33] = 0, r33++
// [r33] = 0, r33++
}
// [r33] = 0
}
More compiler errors. The compiler assumes that m_pcache is unaligned so it has to zero it out by writing 8 bytes, one at a time, even though it loaded the value at address
71779c70, assuming the address was aligned.
71779d20
71779d24
71779d28
71779d30
71779d34
71779d38
71779d40
71779d44
71779d48
71779d50
71779d54
71779d58
71779d60
}
71779d64
71779d68
NoPSV:
m_psb->EnableModelessSB(TRUE);
{
ld8
r42 = [r36]
addl
r43 = 01h, r0
nop.b
00h ;;
{
ld8
r31 = [r42] ;;
adds
r31 = 048h, r31
nop.i
00h ;;
{
ld8
r30 = [r31] ;;
ld8
r29 = [r30], 08h
nop.i
00h ;;
{
ld8
gp = [r30]
mov
b6 = r29, $+0x0
br.call.dptk.many rp = b6 ;;
{
or
gp = r41, r0
CancelPendingActions();
// r42 = this->m_psb
// r43 = TRUE
}
// r31 = this->m_psb.vtbl
// r31 = &vtl.EnableModeless
}
// r30 = &EnableModeless
// r29 = .EnableModeless
}
//
//
}//
//
gp = gp.EnableModeless
b6 = .EnableModeless
call .EnableModeless
restore gp after call
adds
r42 = -40, r32
// r42 = (CUserView*)this
br.call.sptk.many rp = $-15424 ;; } // call .CancelPendingActions
This is a direct call rather than an imported function or a virtual method call. Notice that you did not have to set up the gp register, because CancelPendingActions was not a
virtual method. Thus, you know that it resides in your own DLL and, therefore, its gp is equal to your gp. It also means that you do not need to restore gp after the call.
ReleaseAndNull(&_psf);
71779d70
{
addl
r31 = -2025856, gp
71779d74
adds
r42 = 0118h, r32
71779d78
nop.b
00h ;;
71779d80
{
ld8
r30 = [r31] ;;
71779d84
ld8
r29 = [r30], 08h
71779d88
nop.i
00h ;;
71779d90
{
ld8
gp = [r30]
71779d94
mov
b6 = r29, $+0x0
71779d98
br.call.dptk.many rp = b6 ;;
71779da0
{
or
gp = r41, r0
if (fViewObjectChanged)
NotifyViewClients(DVASPECT_CONTENT, -1);
71779da4
cmp4.eq p14, p15 = r0, r37
71779da8
(p14)
br.cond.dpnt.few $+060h ;;
71779db0
{
adds
r42 = -40, r32
71779db4
addl
r44 = -1, r0
71779db8
addl
r43 = 01h, r0 ;;
71779dc0
{
ld8
r31 = [r42] ;;
71779dc4
adds
r31 = 048h, r31
71779dc8
nop.i
00h ;;
// r31 = &__imp__ReleaseAndNull
// r42 = &this->_psf
}
// r30 = &ReleaseAndNull
// r29 = .ReleaseAndNull
}
//
//
}//
//
gp = gp.ReleaseAndNull
b6 = .ReleaseAndNull
call .ReleaseAndNull
restore gp after call
//
}//
//
//
}//
//
//
}
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
71779dd0
{
ld8
r30 = [r31] ;;
71779dd4
ld8
r29 = [r30], 08h
71779dd8
nop.i
00h ;;
71779de0
{
ld8
gp = [r30]
71779de4
mov
b6 = r29, $+0x0
71779de8
br.call.dptk.many rp = b6 ;;
71779df0
{
or
gp = r41, r0
71779df4
nop.f
00h
71779df8
nop.b
00h
NoChange:
if (m_pszTitle) {
LocalFree(m_pszTitle);
m_pszTitle = NULL;
}
71779e00
{
adds
r33 = 0128h, r32 ;;
71779e04
ld8
r42 = [r33]
71779e08
nop.i
00h ;;
71779e10
{
cmp.eq
p14, p15 = r0, r42
71779e14
nop.f
00h
71779e18
(p14)
br.cond.dpnt.few $+050h ;;
71779e20
{
addl
r31 = -2029752, gp ;;
71779e24
ld8
r30 = [r31]
71779e28
nop.i
00h ;;
71779e30
{
ld8
r29 = [r30], 08h ;;
71779e34
ld8
gp = [r30]
71779e38
mov
b6 = r29, $+0x0
71779e40
{
nop.m
00h
71779e44
nop.f
00h
71779e48
br.call.dptk.many rp = b6 ;;
71779e50
{
st8
[r33] = r0
71779e54
or
gp = r41, r0
71779e58
nop.b
00h ;;
NoTitle:
// r30 = &NotifyViewClients
// r29 = .NotifyViewClients
}
//
//
}//
//
gp = gp.NotifyViewClients
b6 = .NotifyViewClients
call .NotifyViewClients
restore gp after call
// r33 = &this->m_pszTitle
// r42 = this->m_pszTitle
}
// r42 == NULL?
}//
//
//
}
//
//
}//
Y: Jump to NoTitle
r31 = &__imp__LocalFree
r30 = &LocalFree
r29 = .LocalFree
gp = gp.LocalFree
b6 = .LocalFree
//
//
}//
//
//
}//
//
//
}
//
//
}//
//
r31
r46
r45
r44
r30
r43
r42
r29
=
=
=
=
=
=
=
=
&__imp__SetRect
0
0
0
&SetRect
0
&this->m_rcBounds
.SetRect
gp = gp.SetRect
b6 = .SetRect
call .SetRect
restore gp after call
mov
rp = r38, $+0x0
adds
sp = 020h, sp ;;
nop.m
00h
mov
pr = r40, -2 ;;
mov.i
ar.pfs = r39
nop.m
00h
nop.f
00h
br.ret.sptk.many rp ;;
You restore the rp register to contain your return address that you saved in the prologue.
You clean up the stack.
You restore the predicate registers.
You restore the original stack frame with the value you placed in r39 when you created your stack frame.
Finally, you return to your caller through the rp register.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
RPC Debugging
This section includes:
Overview of RPC Debugging
Enabling RPC State Information
Displaying RPC State Information
Common RPC Debugging Techniques
RPC State Information Internals
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Auto2
On a computer running Windows Server 2003 with less than 128 MB of RAM, or on any Windows XP computer, this is the same as None. On a Windows Server 2003
computer with at least 128 MB RAM, this is the same as Server. This is the default.
If you want to simultaneously set these levels on a set of networked computers, use the Group Policy Editor to roll out a machine policy to the preferred set of machines. The
policy engine will take care that the settings you want are propagated to the preferred set of machines. The Auto1 and Auto2 levels are especially useful in this case, because
the operating system and amount of RAM on each computer may vary.
If the network includes computers running versions of Windows that are earlier than Windows XP, the settings will be ignored on those machines.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
00a8
00a8
00a8
00a8
00c4
00c4
00c4
00d0
00d0
00d0
00d0
0170
0170
0170
0170
0170
0170
01b8
01b8
01b8
00ec
00ec
00ec
00ec
00ec
00ec
0214
022c
022c
022c
022c
02a8
0370
0278
030c
0000.0003
0000.0004
0000.0007
0000.0008
0000.0001
0000.0003
0000.0008
0000.0001
0000.0004
0000.000b
0000.000c
0000.0001
0000.0003
0000.0005
0000.0006
0000.0007
0000.000b
0000.0001
0000.0003
0000.0007
0000.0001
0000.0003
0000.0007
0000.0008
0000.000c
0000.0010
0000.0001
0000.0001
0000.0003
0000.0005
0000.0006
0000.0001
0000.0001
0000.0001
0000.0001
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
01
NMP
NMP
NMP
LRPC
LRPC
NMP
NMP
NMP
NMP
NMP
LRPC
LRPC
TCP
SPX
NB
NB
NMP
NMP
LRPC
LRPC
LRPC
LRPC
NMP
LRPC
NMP
NMP
NMP
LRPC
TCP
SPX
NMP
LRPC
LRPC
TCP
LRPC
\PIPE\SfcApi
\PIPE\ProfMapApi
\pipe\winlogonrpc
OLE5
ntsvcs
\PIPE\ntsvcs
\PIPE\scerpc
\PIPE\lsass
\pipe\WMIEP_d0
\PIPE\POLICYAGENT
policyagent
epmapper
135
34280
135
135
\pipe\epmapper
\pipe\spoolss
spoolss
OLE7
OLE2
senssvc
\pipe\tapsrv
tapsrvlpc
\PIPE\ROUTER
\pipe\WMIEP_ec
\PIPE\winreg
LRPC0000022c.00000001
1058
24576
\PIPE\atsvc
OLE3
OLE9
1120
OLE12
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
If no parameters are supplied, all known SCALLs in the system will be displayed. The following is an example of this long display:
D:\wmsg>dbgrpc -c
Searching for call info ...
PID CELL ID
ST PNO IFSTART TIDNUMBER CALLFLAG CALLID
LASTTIME CONN/CLN
---------------------------------------------------------------------------00c4 0000.0002 00 00f 82273fdc 0000.0007 00000001 00000002 0003595d 0000.0010
00c4 0000.0006 00 009 367abb81 0000.0015 00000001 0000004d 000185bd 0000.0005
00c4 0000.000a 00 007 367abb81 0000.002d 00000001 0000009f 00014672 0000.0009
00c4 0000.000c 00 007 367abb81 0000.002d 00000001 00000083 000122e3 0000.000b
00c4 0000.000d 00 03b 8d9f4e40 0000.002d 00000001 000000f7 0001aba5 0000.0020
00c4 0000.000e 00 03b 8d9f4e40 0000.0026 00000001 00000002 00023056 0000.0021
00c4 0000.000f 00 008 82273fdc 0000.001e 00000009 baadf00d 000366b4 00ec.03bc
00c4 0000.0012 00 00d 8d9f4e40 0000.0004 00000001 00000051 0000a334 0000.0011
00c4 0000.0014 00 000 367abb81 0000.0015 00000001 0000004c 0002db53 0000.0013
00c4 0000.0017 00 007 367abb81 0000.0015 00000001 00000006 0000d102 0000.0016
00c4 0000.0019 00 007 367abb81 0000.0004 00000001 00000006 0000f09e 0000.0018
00c4 0000.001b 00 009 65a93890 0000.0007 00000001 0000012e 00630f65 0000.001a
00c4 0000.001e 00 026 8d9f4e40 0000.0015 00000001 0000037d 0005e579 0000.002c
00c4 0000.001f 00 008 82273fdc 0000.0033 00000009 baadf00d 000145b3 00c4.02f8
00c4 0000.0023 00 000 367abb81 0000.0004 00000001 0000007e 000372f3 0000.0022
00c4 0000.0025 00 03b 8d9f4e40 0000.0026 00000001 0000000b 000122e3 0000.0024
00c4 0000.0027 00 000 367abb81 0000.002d 00000001 0000000b 00012e27 0000.0028
00c4 0000.002a 00 008 82273fdc 0000.0033 00000009 baadf00d 0001245f 022c.0290
00c4 0000.002f 00 007 367abb81 0000.0026 00000001 0000000a 0002983c 0000.002e
00c4 0000.0031 00 004 3ba0ffc0 0000.0026 00000001 00000007 0005c439 0000.001c
00c4 0000.0032 00 00b 82273fdc 0000.0039 00000009 baadf00d 00687db6 00d0.01d4
00c4 0000.0036 00 007 367abb81 0000.0030 00000001 00000065 0003a5e1 0000.0035
00c4 0000.0037 00 00d 8d9f4e40 0000.0015 00000001 0000033f 000376fa 0000.002b
00c4 0000.0038 00 008 8d9f4e40 0000.0015 00000001 00000803 0018485c 0000.003b
00c4 0000.003c 00 00b 82273fdc 0000.0034 00000009 baadf00d 0001f956 00a8.0244
00c4 0000.003d 00 008 82273fdc 0000.0034 00000009 baadf00d 0001ff02 01b8.037c
0170 0000.0009 00 002 e60c73e6 0000.0013 00000009 baadf00d 0005a371 00ec.031c
0170 0000.000a 00 002 0b0a6584 0000.0002 00000009 baadf00d 000126ae 00c4.0130
0170 0000.000c 00 002 0b0a6584 0000.0010 00000009 baadf00d 00012bc4 022c.0290
0170 0000.000d 00 003 00000136 0000.001b 00000009 baadf00d 0005ba71 00ec.0310
0170 0000.000e 00 000 412f241e 0000.0002 00000009 baadf00d 00012f21 02a8.029c
0170 0000.0010 00 003 00000136 0000.0013 00000009 00000003 000341da 0370.0060
0170 0000.0011 00 006 e60c73e6 0000.001b 00000009 baadf00d 000f1d00 0370.0328
0170 0000.0017 00 002 0b0a6584 0000.001b 00000009 baadf00d 0006c803 0278.0184
0170 0000.001a 00 004 00000136 0000.0012 00000001 baadf00d 00038e9b 00ec.0348
00ec 0000.0006 00 009 00000134 0000.0011 00000009 baadf00d 000b233f 0170.0244
00ec 0000.000b 00 001 2f5f6520 0000.001c 00000009 baadf00d 00035510 00ec.0334
00ec 0000.000e 00 001 629b9f66 0000.0014 00000009 baadf00d 00035813 00ec.01c4
00ec 0000.0012 00 000 629b9f66 0000.0014 00000009 baadf00d 00026cc6 00a8.0164
00ec 0000.001b 00 001 2f5f6520 0000.0004 00000001 baadf00d 000352c1 00ec.03a8
02a8 0000.0004 00 009 00000134 0000.0002 00000009 baadf00d 0009a540 0170.0244
0370 0000.0006 00 003 00000134 0000.0005 0000000b baadf00d 0002e7cd 00ec.0350
0370 0000.0008 00 009 00000134 0000.0007 0000000b 01cee9e4 000838fa 0170.0244
0278 0000.0004 02 000 19bb5061 0000.0002 00000001 00000001 00072c09 0000.0003
For details on the optional parameters, see DbgRpc Command-Line Options.
For a similar example using the RPC debugger extensions, see !rpcexts.getcallinfo.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Note Information about Client Call objects is only gathered if the Full state information is being gathered. See Enabling RPC State Information for details.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ntdll!ZwWaitForSingleObject+0xb
KERNEL32!WaitForSingleObjectEx+0x5a
RPCRT4!UTIL_WaitForSyncIO+0x21
RPCRT4!UTIL_GetOverlappedResultEx+0x44
RPCRT4!WS_SyncRecv+0x12a
RPCRT4!OSF_CCONNECTION__TransSendReceive+0xcb
RPCRT4!OSF_CCONNECTION__SendFragment+0x297
RPCRT4!OSF_CCALL__SendNextFragment+0x272
RPCRT4!OSF_CCALL__FastSendReceive+0x165
RPCRT4!OSF_CCALL__SendReceiveHelper+0xed
RPCRT4!OSF_CCALL__SendReceive+0x37
RPCRT4!I_RpcSendReceive+0xc4
RPCRT4!NdrSendReceive+0x4f
rtclnt+0x2850
rtclnt+0x1f32
KERNEL32!CreateFileA+0x11b
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
00c4
00c4
00c4
00c4
00c4
0000.0015
0000.0026
0000.002d
0000.0030
0000.0034
03
03
03
03
03
0000018c
00000264
00000268
0000026c
00000388
008a6236
0005c443
000265bb
000f1d32
007251e9
In this case, there are only seven worker threads, which is reasonable.
If there are over 100 threads, a debugger should be attached to this process and the cause investigated.
Note Running queries such as dbgrpc -t remotely is expensive to the server and the network. If you use this query in a script, you should make sure this command is not run
too often.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
PID CELL ID
ST PNO IFSTART THRDCELL CALLFLAG CALLID
LASTTIME CONN/CLN
---------------------------------------------------------------------------03d4 0000.0004 02 000 19bb5061 0000.0002 00000001 00000001 00a1aced 0000.0003
Look for calls with status 02 or 01 (dispatched or active). In this example, the process only has one call. If there were more, you would have to use the !
rpcexts.getdbgcell extension with the cell number in the THRDCELL column. This would allow you to examine the thread IDs so you could determine which call you
were interested in.
4. After you know which call you are interested in, look at the cell number in the CONN/CLN column. This is the cell ID of the connection object. In this case, the cell
number is 0000.0003. Pass this cell number and the process ID to !rpcexts.getdbgcell:
0:001> !rpcexts.getdbgcell 3d4 0.3
Getting cell info ...
Connection
Connection flags: Exclusive
Authentication Level: Default
Authentication Service: None
Last Transmit Fragment Size: 24 (0x6F56D)
Endpoint for the connection: 0x0.1
Last send time (in seconds since boot):10595.565 (0x2963.235)
Last receive time (in seconds since boot):10595.565 (0x2963.235)
Getting endpoint info ...
Process object for caller is 0xFF9DF5F0
This extension will display all the information available about the client of this connection. The amount of actual information will vary, depending on the transport being used.
In this example, local named pipes are being used as the transport and the process object address of the caller is displayed. If you attach a kernel debugger (or start a local
kernel debugger), you can use the !process extension to interpret this process address.
If LRPC is used as the transport, the process ID and thread ID of the caller will be displayed.
If TCP is used as the transport, the IP address of the caller will be displayed.
If remote named pipes are used as the transport, no information will be available.
Note The previous example shows how to find the client thread if you know the server thread. For an example of the reverse technique, see Analyzing a Stuck Call Problem.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Status
The status value: processing, dispatched, allocated, or idle. A processing thread is one that is within the Run-Time and is processing information. A dispatched thread
has already dispatched (called) to the server-provided manager routine (usually just called the server routine). An allocated thread has been cached. An idle thread is
available to service requests.
LastUpdateTime
The time (in milliseconds after boot) when the information was last updated.
TID
The thread ID of this thread. This is useful when trying to correlate with the thread list in the debugger.
Connection Object Cells
The fields in a connection object cell are:
Flags
Flag values include exclusive/non-exclusive, authentication level, and authentication service.
LastTransmitFragmentSize
The size of the last fragment transmitted over the connection.
Endpoint
The cell ID of the endpoint that this connection was picked up from.
LastSendTime
The last time data was sent on a connection.
LastReceiveTime
The last time data was received on a connection.
Server Call Object Cells
The fields in a Server Call (SCALL) object cell are:
Status
The status value: allocated, active, or dispatched. An allocated call is inactive and cached. When a call is active, the RPC Run-Time is processing information related to
this call. When a call is dispatched, the manager routine (server routine) has been called and has not returned yet.
ProcNum
The procedure number (operation number, in netmon capture files) of this call. The RPC Run-Time identifies individual routines from an interface by numbering them by
position in the IDL file. The first routine in the interface will be number zero, the second number one, and so on.
InterfaceUUIDStart
The first DWORD of the interface UUID.
ServicingTID
The cell ID of the thread that is servicing this call. If the call is not active or dispatched, this contains stale information.
CallFlags
These flag values indicate whether this is the cached call in an exclusive connection, whether this is an asynchronous call, whether this is a pipe call, and whether this is
an LRPC or OSF call.
LastUpdateTime
The time (in milliseconds after boot) when the call object state information was last updated.
PID
The Process ID of the caller. Valid only for LRPC calls.
TID
The Thread ID of the caller. Valid only for LRPC calls.
Client Call Object Cells
A Client Call (CCALL) object is broken into two cells, because the information about a client call is too large to fit in one cell. The first cell is called Client Call Information,
and the second is called Call Target Information. Most tools will show the information together, so you do not need to distinguish between them.
Information about client calls is not maintained unless you are gathering Full state information. There is one exception to this rule: information about client calls made within
a server call is maintained even when only Server state information is being gathered. This allows you to trace calls spanning multiple hops.
The fields in the Client Call Information cell are:
ProcNum
The procedure number (operation number, in netmon capture files) of the method being called. The RPC Run-Time identifies individual routines from an interface by
numbering them by position in the IDL file. The first routine in the interface will be number zero, the second number one, and so on.
ServicingThread
The cell ID of the thread on which this call is made.
IfStart
The first DWORD of the interface UUID on which the call is made.
Endpoint
The first 12 characters of the endpoint on the server to which the call was made.
The fields in the Call Target Information cell are:
ProtocolSequence
The protocol sequence for this call.
LastUpdateTime
The time (in milliseconds after boot) when the information about the client call or the call target was updated.
TargetServer
The first 24 characters of the name of the server to which the call is made.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
ACPI Debugging
This section includes:
The AMLI Debugger
Other ACPI Debugging Extensions
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
When you see the kd> prompt, you are controlling the kernel debugger. All the standard kernel debugger commands and extensions are available. In addition, the
AMLI Debugger extensions are also available. In Windows 2000, these extensions have a syntax of !acpikd.amli command. In Windows XP and later versions of
Windows, these extensions have a syntax of !amli command. The AMLI Debugger commands are not available in this mode.
When you see the AMLI(? for help)-> prompt, you are controlling the AMLI Debugger. (When you are using WinDbg, this prompt will appear in the top pane of the
Debugger Command window, and an Input> prompt will appear in the bottom pane.) From this prompt, you can enter any AMLI Debugger command. You can also
enter any AMLI Debugger extension; these extensions should not be prefixed with !amli. The standard kernel debugging commands are not available in this mode.
When you see no prompt at all, the target computer is running.
At the beginning of any debugging session, you should set your AMLI Debugger options with the !amli set extension. The verboseon, traceon, and errbrkon options are
also very useful. When your target computer is running Windows XP or later, you should always activate the spewon option. See the extension reference page for details.
There are several ways for the AMLI Debugger to become active:
If a breakpoint in AML code is encountered, ACPI will break into the AMLI Debugger.
If a serious error or exception occurs within AML code (such as an int 3), ACPI will break into the AMLI Debugger.
If the errbrkon option has been set, any AML error will cause ACPI to break into the AMLI Debugger.
If you want to deliberately break into the AMLI Debugger, use the !amli debugger extension and then the g (Go) command. The next time any AML code is executed
by the interpreter, the AMLI Debugger will take over.
When you are at the AMLI Debugger prompt, you can type q to return to the kernel debugger, or type g to resume normal execution.
The following extensions are especially useful for AML debugging:
The !amli dns extension displays the ACPI namespace for a particular object, the namespace tree subordinate to that object, or even the entire namespace tree. This
command is especially useful in determining what a particular namespace object is whether it is a method, a fieldunit, a device, or another type of object.
The !amli find extension takes the name of any namespace object and returns its full path.
The !amli u extension unassembles AML code.
The !amli lc extension displays brief information about all active ACPI contexts.
The !amli r extension displays detailed information about the current context of the interpreter. This is useful when the AMLI Debugger prompt appears after an error is
detected.
Breakpoints can be set and controlled within AML code. Use !amli bp to set a breakpoint, !amli bc to clear a breakpoint, !amli bd to disable a breakpoint, !amli be to
re-enable a breakpoint, and !amli bl to list all breakpoints.
The AMLI Debugger is able to run, step, and trace through AML code. Use the run, p, and t commands to perform these actions.
For a full list of extensions and commands, see Using AMLI Debugger Extensions and Using AMLI Debugger Commands .
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Extension Command
!amli ?
!amli bp
!amli bl
!amli bd
!amli be
!amli bc
!amli debugger
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Specific Action
AMLI Debugger
Commands
Controlling the Debugger
Continue Execution
g
Break to Kernel Debugger q
Controlling AML Execution
Run Method
run
Step Over AML Code
p
Trace Into AML Code
t
Controlling Trace Mode Settings Configure Trace Mode
trace
Notifying a Namespace Object
Notify Namespace Object notify
Displaying the Object Count Table Display Object Count Table dc
Accessing Memory
Display Data
d
Display Data Bytes
db
Display Data Words
dw
Display Data DWORDs
dd
Display Data String
da
Edit Memory
e
Accessing Ports
Read Byte from Port
i
Read Word from Port
iw
Read DWORD from Port id
Write Byte to Port
o
Write Word to Port
ow
Write DWORD to Port
od
Displaying Help
Display Help
?
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Specifies a list of arguments to be passed to the method. Each argument must be an integer. Multiple arguments should be separated with spaces.
Accessing Memory
The memory access commands allow you to read and write to memory. When reading memory, you can choose the size of the memory units with the db, dw, dd, or da
command. A simple d command displays memory in the most recently-chosen units. If this is the first display command used, byte units are used.
If no address or method is specified, display will begin where the previous display command ended.
These commands have the same effect as the standard kernel debugger memory commands; they are duplicated within the AMLI Debugger for easy access.
d[b|w|d|a] [ [l=Length] [ Method | [%%]Address ] ]
e [%%]Address DataList
b
Specifies that the data should be displayed in byte units.
w
Specifies that the data should be displayed in word (16-bit) units.
d
Specifies that the data should be displayed in DWORD (32-bit) units.
a
Specifies that the data should be displayed as a string. The data is displayed as ASCII characters. The display terminates when a NULL character is read, or when Length
characters have been displayed.
Length
Specifies the number of bytes to be displayed. Length must be a hexadecimal number (without an 0x prefix). If Length is omitted, the default display size is 0x80 bytes.
Method
Specifies the full path and name of a method. The display will start at the beginning of this method's memory location.
Address
Specifies the memory address where reading or writing will begin. If the address is prefixed with two percent signs (%%), it is interpreted as a physical address.
Otherwise, it is interpreted as a virtual address.
DataList
Specifies the data to be written to memory. Each item in the list can be either a hexadecimal byte or a string. When a string is used, it must be enclosed in quotation
marks. Multiple items should be separated by spaces.
Accessing Ports
The port commands allow you to send output or receive input from a data port. The i and o commands transfer single bytes, the iw and ow commands transfer words (16 bits),
and the id and od commands transfer DWORDS (32 bits).
These commands have the same effect as the standard kernel debugger port commands; they are duplicated within the AMLI Debugger for easy access.
i Port
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
iw Port
id Port
o Port DataForPort
ow Port DataForPort
od Port DataForPort
Port
Specifies the address of the port to be accessed. The port size must match the command chosen.
DataForPort
Specifies the data to be written to the port. The size of this data must match the command chosen.
Displaying Help
This command displays help text for the AMLI Debugger commands.
? [Command]
Command
Specifies the command for which to display help. If this is omitted, a list of all AMLI Debugger commands and AMLI Debugger extensions is displayed.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
:
:
:
:
:
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
\_SB.PCI0.LPC.IDMA._CRS
\_SB.PCI0.LPC.RTC._CRS
\_SB.PCI0.LPC.SPKR._CRS
\_SB.PCI0.LPC.FHUB._CRS
\_SB.PCI0.SBD1._CRS
\_SB.PCI0.SBD2._CRS
\_SB.MBRD._CRS
AMLI(? for help)-> u \_SB.PCI0._CRS
ffffffff80e4a535
ffffffff80e4a540
ffffffff80e4a54b
ffffffff80e4a559
ffffffff80e4a567
:
:
:
:
:
Using Breakpoints
In the following example, you will break into the AMLI Debugger before the method _BST is executed.
Even if you have located a _BST object, you should verify that it is indeed a method. You can use the !amli dns extension to do this.
kd> !amli dns /s \_sb.pci0.isa.bat1._bst
ACPI Name Space: \_SB.PCI0.ISA.BAT1._BST (c29c2044)
Method(_BST:Flags=0x0,CodeBuff=c29c20a5,Len=103)
Now you can use the !amli bp command to place the breakpoint:
kd> !amli bp \_sb.pci0.isa.bat1._bst
You may also want to place breakpoints within the method. You could use the !amli u command to disassemble _BST and then place a breakpoint on one of its steps:
kd> !amli u _sb.pci0.isa.bat1._bst
ffffffffc29c20a5:
ffffffffc29c20c0:
ffffffffc29c20d7:
ffffffffc29c20ee:
ffffffffc29c2107:
Acquire(\_SB_.PCI0.ISA_.EC0_.MUT1, 0xffff)
Store("CMBatt - _BST.BAT1", Debug)
\_SB_.PCI0.ISA_.EC0_.CPOL()
Release(\_SB_.PCI0.ISA_.EC0_.MUT1)
Return(PBST)
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
c18b5f9c:
c18b5fb4:
c18b5fcc:
c18b5fe4:
c18b4040:
Local4=Unknown()
Local5=Unknown()
Local6=Unknown()
Local7=Unknown()
RetObj=Unknown()
| If(LNot(LEqual(Local0=0xffffffff,ACP_=0xffffffff)=0xffffffff)=0x0)
| {
| | Return(Zero)
| }
},Local1)=0x0
!acpicache displays all of the ACPI tables cached by the hardware application layer (HAL)
!acpiinf displays information on the configuration of the ACPI
!acpiirqarb displays the contents of the ACPI IRQ arbiter structure
!facs displays a Firmware ACPI Control Structure
!fadt displays a Fixed ACPI Description Table
!mapic displays an ACPI Multiple APIC Table
!nsobj displays an ACPI namespace object
!nstree displays a section of the ACPI namespace tree
!rsdt displays the ACPI Root System Description Table
NDIS Debugging
This section includes:
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The following values are acceptable for DebugBreakPoint, DebugLevel and DebugSystems:
DebugBreakPoint
Controls whether an NDIS driver will automatically break into the debugger. If this value is set to 1, NDIS will break into the debugger when a driver enters Ndis.sys's
DriverEntry function.
DebugLevel
Selects the level or amount of debug tracing in the NDIS components that you select with the DebugSystems value. This corresponds to using the !ndiskd.dbglevel
extension. The following values specify levels that you can select:
Level
Description
Value
DBG_LEVEL_INFO All available debug information. This is the highest level of trace.
0x00000000
DBG_LEVEL_LOG Log information.
0x00000800
DBG_LEVEL_WARN Warnings.
0x00001000
DBG_LEVEL_ERR
Errors.
0x00002000
DBG_LEVEL_FATAL Fatal errors, which can cause the operating system to crash. This is the lowest level of trace. 0x00003000
DebugSystems
Enables debug tracing for specified NDIS components. This corresponds to using the !ndiskd.dbgsystems extension. The following values specify the NDIS components
that you can select:
Component
Description
Value
DBG_COMP_INIT
Handles adapter initialization.
0x00000001
DBG_COMP_CONFIG
Handles adapter configuration.
0x00000002
DBG_COMP_SEND
Handles sending data over the network.
0x00000004
DBG_COMP_RECV
Handles receiving data from the network.
0x00000008
DBG_COMP_PROTOCOL Handles protocol operations.
0x00000010
DBG_COMP_BIND
Handles binding operations.
0x00000020
DBG_COMP_BUSINFO
Handles bus queries.
0x00000040
DBG_COMP_REG
Handles registry operations.
0x00000080
DBG_COMP_MEMORY
Handles memory management.
0x00000100
DBG_COMP_FILTER
Handles filter operations.
0x00000200
DBG_COMP_REQUEST
Handles requests.
0x00000400
DBG_COMP_WORK_ITEM Handles work-item operations.
0x00000800
DBG_COMP_PNP
Handles Plug and Play operations.
0x00001000
DBG_COMP_PM
Handles power management operations.
0x00002000
DBG_COMP_OPENREF
Handles operations that open reference objects.
0x00004000
DBG_COMP_LOCKS
Handles locking operations.
0x00008000
DBG_COMP_RESET
Handles resetting operations.
0x00010000
DBG_COMP_WMI
Handles Windows Management Instrumentation operations. 0x00020000
DBG_COMP_CO
Handles Connection-Oriented NDIS.
0x00040000
DBG_COMP_REF
Handles reference operations.
0x00080000
DBG_COMP_ALL
Handles all NDIS components.
0xFFFFFFFF
You can select more than one NDIS component. If more than one component is selected, combine the data values with an OR operator. For example, to select
DBG_COMP_PNP, DBG_COMP_PM, DBG_COMP_INIT and DBG_COMP_CONFIG, you would combine the corresponding values (0x1000, 0x2000, 0x1, and 0x2)
to obtain the value 0x3003, and then set it in the registry thus:
"DebugSystems"=dword:00003003
Whenever you change registry values for debug tracing, you must restart your computer for the new settings to take effect.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
A hang. Either a user-mode thread or a kernel-mode thread is not being released by the driver.
A stall. This is the result of a problem with a component in the streaming path. Some possibilities include:
The capture driver is not completing packets. In this case, either a driver component or the hardware might be the source of the stall.
The capture driver has no packets to complete. In this case, the buffers might be stalled in a codec or other downstream component.
If you can reproduce the problem, attach a debugger at this point to determine which is the actual cause.
To determine if the problem is a hang
1. Attach a user-mode debugger to the application and look for blocked user-mode threads.
2. Determine whether the application is responsive. Can the graph be paused? Can the graph be stopped? Does streaming restart if the graph is stopped and restarted?
3. If the application is non-responsive, attempt to end the task by using Task Manager. If this fails, there is a kernel-mode hang.
To determine if the problem is a stall
1. Determine where the samples are in the graph. This can be done locally or in a kernel-mode debugging session.
2. Determine whether samples are flowing downstream. If you can reproduce the bug in GraphEdit, place an intermediate filter in the graph to display samples.
3. Determine if the processing routine is being called. This can be done by attaching a kernel-mode debugger and setting a breakpoint in this routine.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Look for problems in the code related to the driver's deferred procedure call (DPC), especially where buffers are completed or any calls are made to
KsStreamPointerDelete.
Look for problems in the startup code for the stream.
The most effective way to collect this information is by logging everything in the affected region, including processing, buffer acquisition (such as cloning and programming
hardware), buffer release (such as deleting clones), and any gate manipulations. Most of this information is highly timing dependent and requires memory-based logging or
ETW.
To maintain a rolling memory-based log, use the following code:
typedef struct _LOGENTRY {
ULONG Tag;
ULONG Arg[3];
} LOGENTRY, *PLOGENTRY;
#define LOGSIZE 2048
LONG g_LogCount;
LOGENTRY g_Log [LOGSIZE];
#define LOG(tag,arg1,arg2,arg3) do { \
LONG i = InterlockedIncrement (&g_LogCount) % LOGSIZE; \
g_Log [i].Tag = tag; \
g_Log [i].Arg [0] = (ULONG)(arg1); \
g_Log [i].Arg [1] = (ULONG)(arg2); \
g_Log [i].Arg [2] = (ULONG)(arg3); \
} while (0)
Then, use a simple "dc g_Log" to view the contents of the g_Log array in the debugger.
The following example uses the above memory-based scheme to determine the cause of a processing stall. Output is from an AVStream streaming scenario in graphedt. The
following minidriver events were logged:
Abbreviation Description
Strt
This event occurs when the minidriver first queues buffers for the device from within the minidriver's Start dispatch.
Prc<
This event occurs at the start of the minidriver's Process dispatch.
AddB
This event occurs when the minidriver queues buffers to the device from within its Process dispatch.
DPC<
This event occurs at the start of the minidriver's CallOnDPC. It indicates buffer completion.
Atmp
This event occurs when the minidriver calls from within the DPC to KsPinAttemptProcessing.
Dele
This event occurs when the minidriver calls from within the DPC to delete a clone stream pointer.
Log excerpts are as follows:
f9494b80
f9494b90
f9494ba0
f9494bb0
f9494bc0
f9494bd0
f9494be0
f9494bf0
f9494c00
f9494c10
3c435044
656c6544
706d7441
3c637250
42646441
3c435044
656c6544
706d7441
3c637250
42646441
816e2c90
816e2c90
816e2c90
819c1f00
819c1f00
816e2c90
816e2c90
816e2c90
819c1f00
819c1f00
00000000
81750260
ffa4d418
00000000
ffa2eb08
00000000
ffa80348
ffa4d418
00000000
ffa3d9b8
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
DPC<.,n.........
Dele.,n.`.u.....
Atmp.,n.........
Prc<............
AddB............
DPC<.,n.........
Dele.,n.H.......
Atmp.,n.........
Prc<............
AddB............
This first log excerpt is representative of the normal streaming state. In the first line, the minidriver's CallOnDPC is called to complete a buffer (DPC<). The buffer is deleted
(Dele), and KsPinAttemptProcessing is called to move the leading edge forward, if there are any unprocessed buffers in the queue (Atmp). In this case, there were, as can be
seen by the call to the process dispatch (Prc<). More buffers are added to the queue (AddB), and the whole scenario repeats.
This next excerpt includes the last entries in the log right before the stall occurred.
f949b430
f949b440
f949b450
f949b460
f949b470
f949b480
f949b490
f949b4a0
f949b4b0
f949b4c0
f949b4d0
f949b4e0
3c435044
656c6544
706d7441
3c435044
656c6544
706d7441
3c435044
656c6544
706d7441
3c435044
656c6544
706d7441
816e2c90
816e2c90
816e2c90
816e2c90
816e2c90
816e2c90
816e2c90
816e2c90
816e2c90
816e2c90
816e2c90
816e2c90
00000000
ffac4de8
ffa4d418
00000000
816ffc80
ffa4d418
00000000
ffa80348
ffa4d418
00000000
8174e1c0
ffa4d418
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
DPC<.,n.........
Dele.,n..M......
Atmp.,n.........
DPC<.,n.........
Dele.,n...o.....
Atmp.,n.........
DPC<.,n.........
Dele.,n.H.......
Atmp.,n.........
DPC<.,n.........
Dele.,n...t.....
Atmp.,n.........
In this example, several buffers are being completed (indicated by the repeated instances of DPC<), but there are no unprocessed buffers in the queue, so the process dispatch
is not being called (indicated by the absence of Prc<). In fact, all of the processed buffers in the queue have been completed, apparently before any new unprocessed buffers
could be added. Because the application is already running (so that Start will not be called) and no calls are being made to CallOnDPC (because there are no processed
buffers ready to be completed), any new buffers are apparently accumulating ahead of the leading edge, waiting to be processed, with nothing initiating processing.
The problem is that the KSPIN_FLAG_DO_NOT_INITIATE_PROCESSING flag has been set. When this flag is set, processing occurs only through a call to Start or
CallOnDPC. If this flag is not set, processing will be initiated whenever new buffers are added to the queue.
2009 Microsoft Corporation
Send feedback on this topic
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
00001732 000009B4
Hit
Va
- - - - - - - - 81861788 808A7B0C
16000001 80A04224
Pte
- - - - - - - - C020229C
C0202810
For each virtual address (VA) found, look for an IRP signature. Do this by using the dd command with the VA minus one DWORD.
kd> dd 808A7B0C-4 l4
808a7b08 f9949215 81861788 00000026 00000000
kd> $ Not an Irp
kd> dd 80A04224-4 l4
80a04220 00000000 00000000 00000000 00000000
kd> $ Not an Irp
kd> dd 817329B4-4 l4
817329b0 01900006 81861788 00000070 ffa59220
kd> $ Matches signature
After a VA with an IRP signature has been found, use the !irp extension to find out what driver is pending on this IRP.
kd> !irp 817329b0 7
Irp is active with 2 stacks 2 is current (= 0x81732a44)
Mdl = 81861788 System buffer = ffa59220 Thread 00000000: Irp stack trace.
>[ e, 0]
1 1 81a883c8 81ae6158 00000000-00000000
pending
\Driver\TESTCAP
Args: 00000070 00000000 002f4017 00000000
In this case, \Driver\TESTCAP is the likely cause of the bug check.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Overall states. For example, is the stream running? Is the stream paused?
Packet counts. For example, are there IRPs queued to the stream?
Changes in packet counts. Is the stream moving?
Changes in packet lists.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
nt!KiSwapContext+0x25
nt!KeWaitForSingleObject
ks!CKsQueue::CancelAllIrps+0x14
ks!CKsQueue::SetDeviceState+0x170
ks!CKsPipeSection::DistributeDeviceStateChange+0x1d
ks!CKsPipeSection::SetDeviceState+0xb2
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
It supports
According to the above ouput, the KMixer section of the extension is currently disabled (Status : INACTIVE). Since the extension module was first used in a context in which
KMixer was not loaded, Ks.dll has disabled the KMixer section of the extension to prevent time-consuming references to an unloaded module.
To enable KMixer explicitly, you can use !ks.libexts with the enable parameter, as follows:
kd> !libexts enable kmixer
LibExt "kmixer" has been enabled.
kd> !graph ffa0c6d4 7
Attempting a graph build on ffa0c6d4... Please be patient...
Graph With Starting Point ffa0c6d4:
"usbaudio" Filter ffaaa768, Child Factories 2
Output Factory 0:
Pin ffb1caf0 (File 811deeb8, -> "splitter" ffa8b008) Irps(q/p)
"splitter" Filter ffa0c660, Child Factories 2
Output Factory 0:
Pin 81250008 (File ffb10028, -> "kmixer" 8123c000) Irps(q/p) =
Pin 811df9c0 (File ffaaf2f0, -> "kmixer" 81236000) Irps(q/p) =
Input Factory 1:
Pin ffa8b008 (File ffb26d68, <- "usbaudio" ffb1caf0) Irps(q/p)
"kmixer" Filter ffa65b70, Child Factories 4
Input Factory 2:
Pin 81236000 (File ffaaf7d0, <- "splitter" 811df9c0) Irps(q/p)
Output Factory 3:
Pin 81252d00 (File 811df1d8) Irps(q/p) = 10, 0
"kmixer" Filter ffb03808, Child Factories 4
Input Factory 2:
Pin 8123c000 (File ffb10130, <- "splitter" 81250008) Irps(q/p)
Output Factory 3:
Pin ffa1e9c0 (File 81253468) Irps(q/p) = 10, 0
= 7, 1
3, 0
3, 0
= 1, 7
= 0, 0
= 0, 0
Using !ks.graph
The !ks.graph command is one of most powerful extension commands in the kernel streaming extension module. This command displays a picture of an entire graph in kernel
mode from any given starting point.
Before running !ks.graph, you may want to enable all library extensions that are capable of being active. To do this, issue a !ks.libexts enableall command. The output of !
ks.graph will be a textual description of the kernel mode graph in topologically sorted order. Here is an example:
kd> !graph ffa0c6d4 7
Attempting a graph build on ffa0c6d4... Please be patient...
Graph With Starting Point ffa0c6d4:
"usbaudio" Filter ffaaa768, Child Factories 2
Output Factory 0:
Pin ffb1caf0 (File 811deeb8, -> "splitter" ffa8b008) Irps(q/p) = 7, 1
This example displays a capture graph in which two Sndrec32.exe's are capturing from a Telex USB Microphone. Each individual record begins with a name (usbaudio, in the
above section) and shows the filter address (0xFFAAA768) and quantity of child pin factories (2) on the filter.
Below each entry, each factory is enumerated and lists the address of each pin instance (0xFFB1CAF0), the file object (0x811DEEB8) corresponding to each instance, the
direction of the connection, the destination of that connection, and the address of the destination pin (0xFFA8B008). The number of queued (7) and pending IRPs (1) for each
pin is also displayed.
Connections which have forward direction symbols (->) indicate that the pin is an output pin and is connected to an input pin. Connections which have reverse direction
symbols (<-), on the other hand, are input pins and show the origination of the connection. The output continues as follows:
"splitter" Filter ffa0c660, Child Factories 2
Output Factory 0:
Pin 81250008 (File ffb10028, -> "kmixer" 8123c000) Irps(q/p) = 3, 0
Pin 811df9c0 (File ffaaf2f0, -> "kmixer" 81236000) Irps(q/p) = 3, 0
Input Factory 1:
Pin ffa8b008 (File ffb26d68, <- "usbaudio" ffb1caf0) Irps(q/p) = 1, 7
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Please be patient...
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Address
------86352040
86353040
86334a70
862e6040
8633da70
86376040
862e5040
Type
---Device
Device
Device
Device
Device
Device
Device
Name
---adpu160m1Port3Path0Target6Lun0
adpu160m1Port3Path0Target1Lun0
lp6nds351
adpu160m1Port3Path0Target0Lun0
adpu160m1
adpu160m2
adpu160m1Port3Path0Target2Lun0
!pcr
The !pcr extension displays detailed information about the Processor Control Region (PCR) on a processor. The information includes the items in the DPC queue, which can
be useful. when you are debugging a stalled driver or a time-out.
!minipkd.help
The !minipkd.help extension displays a list of all of the Minipkd.dll extension commands.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
If an error message similar to the following appears, it indicates that the symbol path is incorrect and does not point to the correct version of the Scsiport.sys symbols.
minipkd error (0) <path> ... \minipkd\minipkd.c @ line 435
The .sympath (Set Symbol Path) command can be used to display the current path and to change the path. The .reload (Reload Module) command will reload symbols from
the current path.
!minipkd.adapter Adapter
The !minipkd.adapter extension displays detailed information about a specified adapter. The Adapter can be found by looking at the DevExt field in the !minipkd.adapters
display.
!minipkd.adapters
The !minipkd.adapters extension displays all the adapters that work with the SCSI Port driver that have been identified by Windows, and the individual devices associated
with each adapter.
Here is an example:
0: kd> !minipkd.adapters
Adapter \Driver\lp6nds35
Adapter \Driver\adpu160m
LUN 862e60f8 @(0,0,0) c
LUN 863530f8 @(0,1,0) c
LUN 862e50f8 @(0,2,0) c
LUN 863520f8 @(0,6,0)
Adapter \Driver\adpu160m
ev
ev
ev
ev
DO 86334a70
DO 8633da70
pnp(00/ff)
p d pnp(00/ff)
pnp(00/ff)
pnp(00/ff)
DO 86376040
DevExt 86334b28
DevExt 8633db28
pow(0,0) DevObj 862e6040
pow(0,0) DevObj 86353040
pow(0,0) DevObj 862e5040
pow(0,0) DevObj 86352040
DevExt 863760f8
An error message similar to the following indicates that either the symbol path is incorrect and does not point to the correct version of the Scsiport.sys symbols, or that
Windows has not identified any adapters that work with the SCSI Port driver:
minipkd error (0) <path> ... \minipkd\minipkd.c @ line 435
If the !minipkd.help extension command returns help information successfully, the SCSI Port symbols are correct.
!minipkd.exports Adapter
The !minipkd.exports extension displays the addresses of the miniport exports for the specified adapter.
!minipkd.lun {LUN | Device}
The !minipkd.lun extension displays detailed information about a specified Logical Unit Extension (LUN). The LUN can be specified either by its address (which can be
found by looking at the LUN field in the !minipkd.adapters display) or by its physical device object (which can be found in the DevObj field of the !minipkd.adapters
display).
!minipkd.portconfig PortConfig
The !minipkd.portconfig extension displays detailed information about a specified PORT_CONFIGURATION_DATA. The PortConfig can be found in the Port Config
Info field of the !minipkd.adapter display.
!minipkd.req {Adapter | Device}
The !minipkd.req extension displays information about all of the currently active requests on the specified adapter or LUN device.
!minipkd.srb SRB
The !minipkd.srb extension displays detailed information about a specified SCSI request block (SRB). The SRB is specified by address. The addresses of all currently active
requests can be found in the SRB fields of the output from the !minipkd.req command.
!scsikd.classext [Device [Level]]
The !scsikd.classext extension displays detailed information about a specified class Plug and Play (PnP) device or a list of all such devices. The Device is the device object or
device extension of the class PnP device. If Device is omitted, a list of all class PnP extensions is displayed.
Here is an example:
0: kd> !scsikd.classext
'
'
'
'
!scsikd.classext
!scsikd.classext
!scsikd.classext
!scsikd.classext
8633e3f0
86347b48
86347360
861d1898
'
'
'
'
(
) "IBM
" / "DDYS-T09170M
(paging device) "IBM
" / "DDYS-T09170M
(
) "UNISYS " / "003451ST34573WC
(
) "" / "MATSHITA CD-ROM CR-177"
"
"
"
/
/ "S93E"
/ "S80D"
/ "5786"
"7T03" /
/ "
XBY45906"
/ "
VDA60491"
/ "HN0220750000181300L6"
""
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
<1s
<1s
To determine the precise cause of the failure, begin by using the !scsikd.classext extension, which displays information about recently failed requests, including the SRB
status, SCSI status, and sense data of the request.
kd> !scsikd.classext 816e96b0
Storage class device 816e96b0 with extension at 816e9768
Classpnp Internal Information at 817b4008
Failed requests:
Srb
Scsi
Opcode Status Status Sense Code Sector
Time Stamp
------ ------ ------ ---------- -------- -----------2a
0a
02
03 0c 00 0000abcd 23:01:07.453
28
0a
02
03 04 00 0000abcd 23:01:07.984
Retried
Retried
dt classpnp!_CLASS_PRIVATE_FDO_DATA 817b4008
...
In the previous example, opcode 0x2A indicates a write operation, and 0x28 indicates a read operation. The SCSI status in the example is 02, which indicates a check
condition. The sense codes provide more error information.
As always, miniport driver developers are responsible for associating error codes from their hardware to the SRB status codes. Typically, timeouts are associated with SRB
0x0A, the code for a selection timeout. SRB 0x0e is typically associated with a full bus reset, but it can also be associated with controller errors.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
If you suspect that the SCSI miniport DPC is not running, use !pcr to display the DPC queue for the current processor. If the SCSI port DPC routine is in the DPC queue,
place a breakpoint on this routine to determine whether this routine is ever called. Otherwise, use !scsikd.scsiext on each device. Consider the following sample output from
the !scsikd.scsiext extension:
0: kd> !scsikd.scsiext 86353040
Common Extension:
< ..omitted.. >
Logical Unit Extension:
Address (3, 0, 1, 0) Claimed Enumerated Visible
LuFlags (0x00000000):
Retry 0x00
Key 0x008889ff
Lock 0x00000000 Pause 0x00000000
CurrentLock: 0x00000000
HwLuExt 0x862e6f00 Adapter 0x8633db28 Timeout 0x0000000a
NextLun 0x00000000 ReadyLun 0x00000000
Pending 0x00000000 Busy 0x00000000
Untagged 0x00000000
. . .
Request list @0x86353200:
Tick count is 2526
SrbData 8615d700 Srb 8611f4fc Irp 8611f2b8
SrbData 85e72868 Srb 86100c3c Irp 861009f8
Key 60197
Key e29dc7
<1s
<1s
If the timeout slot is -1 and the untagged slot is nonzero, or the time-out slot is nonzero and there are requests shown, the miniport has failed to ask for the next request.
Alternatively, if the retry slot and the busy slot are nonzero, a request may not be completed by the SCSI miniport because it is waiting for map registers. Similarly, if the
untagged and pending slots are nonzero, the SCSI miniport might be waiting for map registers. In either case, the address of the SCSI request block (SRB) is the address in the
busy slot and the address of the request that is not being completed. For more information about the SRB, use the !minipkd.srb extension with this address as input.
The !devobj extension determines whether the SCSI miniport is waiting for map registers. Use the device object address of the device that is issuing the request as input to !
devobj. If the current IRQ is nonzero, it is highly probable that the SCSI miniport is waiting for map registers.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
scsiport!scsiportnotification
scsiport!spstartiosynchronized
miniport!HwStartIo
The routine scsiport!scsiportnotification is called right after a request is sent to the miniport. Thus, if you set a breakpoint in scsiport!scsiportnotification and then run a
stack backtrace using kb 3, you can determine whether the miniport is receiving and completing requests. If the first parameter is zero, the request has been completed. If the
first parameter is nonzero, the third parameter is the address of the SCSI request block (SRB) that is not being completed, and you can use the !minipkd.srb extension to
further analyze the situation.
Placing a breakpoint in either scsiport!spstartiosynchronized or miniport!HwStartIo will cause a break just prior to sending a request to the miniport.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
These extensions can be used on Microsoft Windows XP and later operating systems. Some extensions have additional restrictions; these restrictions are noted on the
individual reference pages.
To use this extension library, you must load the library into your debugger. For information about how to load extension libraries into a debugger, see Loading Debugger
Extension DLLs.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Debugging
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Bus #0
This shows that the device with this CM resource list is using I/O Range 3F8-3FF and IRQ 4.
!dcs
This extension is obsolete its functionality has been subsumed by !pci. See the !pci 100 example later in this section.
!devext
Displays bus-specific device extension information for a variety of devices.
!devnode
Displays information about a node in the device tree.
Device node 0 (zero) is the root of the device tree.
Here is an example:
kd> !devnode 0xff0d4a08
DevNode 0xff0d4a08 for PDO 0xff0d4af0 at level 0
Parent 0xff0daf48
Sibling 0xff0d4848
Child 0000000000
InterfaceType 0xffffffff Bus Number 0xfffffff0
InstancePath is "Root\*PNP0501\PnPBIOS_2"
ServiceName is "Serial"
TargetDeviceNotify List - f 0xff0d4a6c b 0xff0d4a6c
Flags (0x6000122b) DNF_PROCESSED, DNF_STARTED,
DNF_ENUMERATED, DNF_MADEUP,
DNF_RESOURCE_ASSIGNED, DNF_ADDED,
DNF_HAS_BOOT_CONFIG
Unknown flags 0x40000000
!devobj
Displays detailed information about a DEVICE_OBJECT.
Here is an example:
kd> !devobj 0xff0d4af0
Device object (ff0d4af0) is for:
00252d \Driver\PnpManager DriverObject ff0d9030
Current Irp 00000000 RefCount 0 Type 00000004 Flags 00001040AttachedDev ff0b59e0
DevExt ff0d4ba8 DevNode ff0d4a08
Device queue is not busy.
!drivers
The !drivers command is no longer supported. Please use the lm t n command instead.
!drvobj
Displays detailed information about a DRIVER_OBJECT.
Lists all the device objects created by the specified driver.
Here is an example:
kd> !drvobj serial
Driver object (ff0ba630) is for:
\Driver\Serial
Driver Extension List: (id , addr)
Device Object list:
ffba3040 ff0b4040 ff0b59e0
ff0b5040
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Cmd[0106:.mb..s]
Cmd[0007:imb...]
Cmd[0005:i.b...]
Cmd[0107:imb..s]
Sts[2280:.....]
Sts[0280:.....]
Sts[0280:.....]
Sts[0280:.....]
Cmd[0023:im.v..]
Sts[0200:.....]
Device
The following example displays the devices for the secondary bus, with verbose output:
kd> !pci 1 1
PCI Bus 1
08:0 10b7:5900.00
cf8:80014000
IO[0]:fce1
09:0
9004:8178.00
cf8:80014800
IO[0]:f801
Cmd[0107:imb..s] Sts[0200:.....]
IntPin:1 IntLine:f Rom:fa000000
Device Ethernet
cis:0 cap:0
Cmd[0117:imb..s] Sts[0280:.....]
IntPin:1 IntLine:f Rom:fa000000
MEM[1]:f9fff000
Device
cis:0
SubID:9004:8940
cap:0
The following example displays the PCI configuration space for the SCSI controller (bus 1, device 9, function 0):
kd> !pci 100 1 9 0
00: 9004
;VendorID=9004
02: 8178
;DeviceID=8178
04: 0117
;Command=SERREnable,MemWriteEnable,BusInitiate,MemSpaceEnable,IOSpac
eEnable
06: 0280
;Status=FB2BCapable,DEVSELTiming:1
08: 00
;RevisionID=00
09: 00
;ProgIF=00 (SCSI bus controller)
0a: 00
;SubClass=00
0b: 01
;BaseClass=01 (Mass storage controller)
0c: 08
;CacheLineSize=Burst8DW
0d: 20
;LatencyTimer=20
0e: 00
;HeaderType=00
0f: 00
;BIST=00
10: 0000f801;BAR0=0000f801
14: f9fff000;BAR1=f9fff000
18: 00000000;BAR2=00000000
1c: 00000000;BAR3=00000000
20: 00000000;BAR4=00000000
24: 00000000;BAR5=00000000
28: 00000000;CBCISPtr=00000000
2c: 0000
;SubSysVenID=0000
2e: 0000
;SubSysID=0000
30: fa000000;ROMBAR=fa000000
34: 00000000;Reserved=00000000
38: 00000000;Reserved=00000000
3c: 0f
;IntLine=0f
3d: 01
;IntPin=01
3e: 08
;MinGnt=08
3f: 08
;MaxLat=08
40: 00001580,00001580,00000000,00000000,00000000,00000000,00000000,00000000
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
60:
80:
a0:
c0:
e0:
00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000
00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000
00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000
00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000
00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000
!pcitree
Displays information about PCI device objects, including child PCI buses and CardBus buses, as well as the devices attached to them.
!pnpevent
Displays the PnP device event queue.
!rellist
Displays a PnP relation list and any related CM_RESOURCE_LIST and IO_RESOURCE_LIST structures.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Bus 0
Slot 0
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The Device Manager marks a device with a yellow exclamation mark (!) when the device has a problem. The problem codes are in the form CM_PROB_XXX and are defined
in the header file cfg.h. The most important are explained here, together with their mapping to the Device Node Status Flags.
Code 1 (CM_PROB_NOT_CONFIGURED)
Indicates that the device is not installed and was not installed previously. (Corresponds to DNF_NOT_CONFIGURED.)
Code 10 (CM_PROB_FAILED_START)
Indicates that the device did not start for some reason, but the I/O Manager attempted to start it with a set of resources. (Corresponds to DNF_START_FAILED.)
Code 12 (CM_PROB_NORMAL_CONFLICT)
Indicates that there were not sufficient resources to start this device. (Corresponds to DNF_INSUFFICIENT_RESOURCES.)
Code 14 (CM_PROB_NEED_RESTART)
Indicates that user mode reconfigured the device and a reboot is required for the changes to take effect. (Corresponds to DNF_NEED_RESTART.)
Code 18 (CM_PROB_REINSTALL)
Indicates that the device needs to be installed and was installed previously. (Corresponds to DNF_REINSTALL.)
Code 21 (CM_PROB_WILL_BE_REMOVED)
Indicates that the user mode uninstalled this device. (Corresponds to DNF_WILL_BE_REMOVED.)
Code 22 (CM_PROB_DISABLED)
Indicates that the device is disabled. (Corresponds to DNF_DISABLED.)
Code 28 (CM_PROB_FAILED_INSTALL)
Indicates that the installation failed and there is no driver selected for this device, although the kernel did not report a problem (and there is no DNF_XXX match for this
the problem). This problem can be the result of an on-board system device (ISA timer, ISA RTC, RAM Memory, and so forth) that does not yet have an INF file.
Code 31 (CM_FAILED_ADD)
Indicates that the device was not added. Reasons for the failure may include: a driver's AddDevice routine returned an error, there is no service listed for the device in the
registry, there is more than one service listed, or the controlling driver could not be loaded. (Corresponds to DNF_ADD_FAILED.)
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
3ec - 3ef
Owner ff0d0b50 (This device conflicts with another device, see below)
3f2 - 3f5
Owner ff0d4770
3f7 - 3f7 S
Owner ff0d4770
3f8 - 3ff
Owner ff0d4af0
778 - 77b
Owner ff0d4e70
cf8 - cff
Owner 00000000
1000 - 10ff
Owner ff0d1030
1400 - 140f
Owner ff0d1d30
1410 - 141f
Owner ff0d1890
10000 - ffffffffffffffff
Owner 00000000
Possible allocation:
< none >
Note that there are two arbiters: one located in the root of the device tree, and one in PCI_HAL. Also note that the PCI arbiter claims and preallocates ranges for the devices it
arbitrates (0xD000-0xFFFF, which is later suballocated by the PCI arbiter for its devices). The Owner field indicates the device object that owns the range. A value of zero for
Owner indicates that the range is not on the bus. In the case of a PCI bridge, for example, all the ranges it does not pass will be assigned to NULL.
In the following example, the PCI bridge passes I/O 0xD000-0xDFFFF so its arbiter will contain the following two ranges:
0-CFFFF
Owner 00000000
E0000-FFFFFFFFFFFFFFFF
Owner 00000000
The FFFFFFFFFFFFFFFF is because all arbitrated resources are treated as 64-bit ranges.
Examples:
kd> !devobj ff0bb900
Device object (ff0bb900) is for:
Video0 \Driver\mga_mil DriverObject ff0bbc10
Current Irp 00000000 RefCount 1 Type 00000023 Flags 0000204c
DevExt ff0bb9b8 DevNode ff0bb808
Device queue is not busy.
kd> !devnode ff0bb808
DevNode 0xff0bb808 for PDO 0xff0bb900 at level 0xffffffff
Parent 0xff0daf48
Sibling 0000000000
Child 0000000000
InterfaceType 0xffffffff Bus Number 0xffffffff
TargetDeviceNotify List - f 0xff0bb86c b 0xff0bb86c
Flags (0x00000400) DNF_RESOURCE_REPORTED
kd> !devnode ff0bb808 6
DevNode 0xff0bb808 for PDO 0xff0bb900 at level 0xffffffff
Parent 0xff0daf48
Sibling 0000000000
Child 0000000000
InterfaceType 0xffffffff Bus Number 0xffffffff
TargetDeviceNotify List - f 0xff0bb86c b 0xff0bb86c
Flags (0x00000400) DNF_RESOURCE_REPORTED
CmResourceList at 0xe12474e8 Version 0.0 Interface 0x5 Bus #0
Entry 0 - Port (0x1) Shared (0x3)
Flags (0x01) - PORT_MEMORY PORT_IO
Range starts at 0x3c0 for 0x10 bytes
Entry 1 - Port (0x1) Shared (0x3)
Flags (0x01) - PORT_MEMORY PORT_IO
Range starts at 0x3d4 for 0x8 bytes
Entry 2 - Port (0x1) Shared (0x3)
Flags (0x01) - PORT_MEMORY PORT_IO
Range starts at 0x3de for 0x2 bytes
Entry 3 - Memory (0x3) Device Exclusive (0x1)
Flags (0000) - READ_WRITE
Range starts at 0x0000000040000000 for 0x4000 bytes
Entry 4 - Memory (0x3) Device Exclusive (0x1)
Flags (0000) - READ_WRITE
Range starts at 0x0000000040800000 for 0x800000 bytes
As shown in the example, this operation retrieved the legacy video card that owns the range 3c0-3cf. The same device object is listed near the other ranges it owns (3de-3df
and 3d4-3dc). Using the same tracking technique, the range of 3f8-3ff is determined to be that used by the serial port.
A similar technique is required to translate the interrupts:
kd> !arbiter 4
DEVNODE ff0daf48
Interrupt Arbiter "RootIRQ"
Allocated ranges:
31 - 31
Owner
34 - 34 S
Owner
36 - 36
Owner
3b - 3b S
Owner
3b - 3b S
Owner
3c - 3c
Owner
3f - 3f
Owner
Possible allocation:
< none >
at 8045bae0
ff0d4030
ff0d4af0
ff0d4770
ff0d1030
ff0d1d30
ff0d3c70
ff0cf030
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Note that there is a single arbiter for interrupts: the root arbiter.
For example, translate the interrupt 3F to an IRQ. First dump the device object, then the devnode:
kd> !devobj ff0cf030
Device object (ff0cf030) is for:
IdeFdoff0d0398Channel1 \Driver\IntelIde DriverObject ff0d0530
Current Irp 00000000 RefCount 0 Type 00000004 Flags 00001040AttachedDev ff0cd030
DevExt ff0cf0e8 DevNode ff0cfe88
Device queue is not busy.
kd> !devnode ff0cfe88 6
DevNode 0xff0cfe88 for PDO 0xff0cf030 at level 0x3
Parent 0xff0d1348
Sibling 0000000000
Child 0xff0c84a8
InterfaceType 0xffffffff Bus Number 0xfffffff0
InstancePath is "PCIIDE\IDEChannel\1&1"
ServiceName is "atapi"
TargetDeviceNotify List - f 0xff0cfeec b 0xff0cfeec
Flags (0x6000120b) DNF_PROCESSED, DNF_STARTED,
DNF_ENUMERATED, DNF_RESOURCE_ASSIGNED,
DNF_ADDED, DNF_HAS_BOOT_CONFIG
Unknown flags 0x40000000
CmResourceList at 0xe12321c8 Version 0.0 Interface 0x1 Bus #0
Entry 0 - Port (0x1) Device Exclusive (0x1)
Flags (0x01) - PORT_MEMORY PORT_IO
Range starts at 0x170 for 0x8 bytes
Entry 1 - Port (0x1) Device Exclusive (0x1)
Flags (0x01) - PORT_MEMORY PORT_IO
Range starts at 0x376 for 0x1 bytes
Entry 2 - Interrupt (0x2) Device Exclusive (0x1)
Flags (0x01) - LATCHED
Level 0xf, Vector 0xf, Affinity 0xffffffff
IoResList at 0xe12363c8 : Interface 0x1 Bus 0 Slot 0
Reserved Values = {0x0002e0d0, 0x00920092, 0xe1235508}
Alternative 0 (Version 1.1)
Preferred Descriptor 0 - NonArbitrated/ConfigData (0x80) Shared (0x3)
Flags (0000) Data:
: 0x1 0x61004d 0x680063
Preferred Descriptor 1 - Port (0x1) Device Exclusive (0x1)
Flags (0x01) - PORT_IO
0x000008 byte range with alignment 0x000001
170 - 0x177
Preferred Descriptor 2 - Port (0x1) Device Exclusive (0x1)
Flags (0x01) - PORT_IO
0x000001 byte range with alignment 0x000001
376 - 0x376
Preferred Descriptor 3 - Interrupt (0x2) Device Exclusive (0x1)
Flags (0x01) - LATCHED
0xf - 0xf
Alternative 1 (Version 1.1)
Preferred Descriptor 0 - Port (0x1) Device Exclusive (0x1)
Flags (0x01) - PORT_IO
0x000008 byte range with alignment 0x000001
170 - 0x177
Preferred Descriptor 1 - Port (0x1) Device Exclusive (0x1)
Flags (0x01) - PORT_IO
0x000001 byte range with alignment 0x000001
376 - 0x376
Preferred Descriptor 2 - Interrupt (0x2) Device Exclusive (0x1)
Flags (0x01) - LATCHED
0xf - 0xf
For example, try to determine if there is a resource conflict that caused this device not to start, starting with a devnode:
kd> !devnode 0xff0d4bc8 6
DevNode 0xff0d4bc8 for PDO 0xff0d4cb0 at level 0
Parent 0xff0daf48
Sibling 0xff0d4a08
Child 0000000000
InterfaceType 0xffffffff Bus Number 0xffffffff
InstancePath is "Root\*PNP0501\1_0_17_2_0_0"
ServiceName is "Serial"
TargetDeviceNotify List - f 0xff0d4c2c b 0xff0d4c2c
Flags (0x60001129) DNF_PROCESSED, DNF_ENUMERATED,
DNF_MADEUP, DNF_INSUFFICIENT_RESOURCES,
DNF_ADDED, DNF_HAS_BOOT_CONFIG
Unknown flags 0x40000000
IoResList at 0xe1251e28 : Interface 0x1 Bus 0 Slot 0
Reserved Values = {0x0043005c, 0x006e006f, 0x00720074}
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Undetermined Shar
(0)
Undetermined Shar
(0)
First, make the assumption that this is an I/O conflict and dump the arbiters (see the preceding example). The result shows that the range 0x3EC-0x3EF is owned by
0xFF0D0B50, which overlaps the serial device's resources request. Next, dump the device object for the owner of this range, and then dump the devnode for the owner:
kd> !devobj ff0d0b50
Device object (ff0d0b50) is for:
Resource00413e \Driver\isapnp DriverObject ff0d0e10
Current Irp 00000000 RefCount 0 Type 00000004 Flags 00001040
DevExt ff0d0c08 DevNode ff0d0a68
Device queue is not busy.
kd> !devnode ff0d0a68 6
DevNode 0xff0d0a68 for PDO 0xff0d0b50 at level 0xffffffff
Parent 0xff0daf48
Sibling 0000000000
Child 0000000000
InterfaceType 0xffffffff Bus Number 0xffffffff
Duplicate PDO 0xff0d0e10 TargetDeviceNotify List - f 0xff0d0acc b 0xff0d0acc
Flags (0x00000421) DNF_PROCESSED, DNF_MADEUP,
DNF_RESOURCE_REPORTED
CmResourceList at 0xe1233628 Version 0.0 Interface 0x1 Bus #0
Entry 0 - Port (0x1) Device Exclusive (0x1)
Flags (0x01) - PORT_MEMORY PORT_IO
Range starts at 0x3ec for 0x4 bytes
This is a "pseudo-devnode" that corresponds to the range allocated by the ISAPNP driver for its read data port.
To determine the resources that the PnP Manager assigned to a particular device when it attempted to start the device:
1. Place a breakpoint on the routine that is called when the IRP_MN_START_DEVICE request is received by the driver. You can also place a breakpoint on the driver's
dispatch routine (if you know its name). In both cases, the driver and its symbols should be loaded. This may require you to set an initial breakpoint.
For example, for PCMCIA you can set a breakpoint on pcmcia!pcmciastartpccard. The advantage of using this particular routine is that its second parameter is a CM
Resource List that you can dump using !cmreslist (eliminating step 3). See the following PCMCIA example.
2. When you have determined which device is of interest, dump the device object (if you have not done so already), and then dump the devnode with the CM Resource
List. Check which resources were assigned to the device. You may also check whether the resources are a subset of the I/O Resource List. Then type g or single step
through the procedure, and determine whether the device was started and which resources were assigned. If a device was offered a set of resources to start but failed to
do so, the driver might not be behaving properly (for example, if it incorrectly declared that it can use a set of resources it cannot actually use).
Example:
ntoskrnl!IopStartDevice:
80420212 55
push
ebp
kd> kb
ChildEBP RetAddr Args to Child
f64138c0 8048b640 ff0ce870 ff0d7c08 ff0cde88
f64138f0 8048d8e7 ff0cde88 f6413978 ff0cddc8
+0x1a
f6413900 8048de7f ff0cde88 f6413978 ff0cf448
er+0x43
f6413910 8048d8d5 ff0cf448 8048d8a4 f6413978
0x1f
f6413924 8048de7f ff0cf448 f6413978 ff0d3f48
er+0x31
f6413934 8048d8d5 ff0d3f48 8048d8a4 f6413978
0x1f
f6413948 8048d893 ff0d3f48 f6413978 e12052e8
er+0x31
f641395c 804f6f1b ff0d7c08 f6413978 8045c520
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
f
f64139d0 804f5cc1 80088000 f6413aec 8045bba0 ntoskrnl!IopInitializeBootDrivers+0
x2f9
f6413b24 804f4db3 80088000 00000001 00000000 ntoskrnl!IoInitSystem+0x3a6
f6413da8 80447610 80088000 00000000 00000000 ntoskrnl!Phase1Initialization+0x6a3
f6413ddc 8045375a 804f4710 80088000 00000000 ntoskrnl!PspSystemThreadStartup+0x5
4
00000000 00000000 00000000 00000000 00000000 ntoskrnl!KiThreadStartup+0x16
kd> !devobj ff0ce870
Device object (ff0ce870) is for:
NTPNP_PCI0002 \Driver\PCI DriverObject ff0ceef0
Current Irp 00000000 RefCount 0 Type 00000022 Flags 00001040AttachedDev ff0cb9e0
DevExt ff0ce928 DevNode ff0cde88
Device queue is not busy.
kd> !devnode ff0cde88 6
DevNode 0xff0cde88 for PDO 0xff0ce870 at level 0x2
Parent 0xff0cf448
Sibling 0xff0cddc8
Child 0000000000
InterfaceType 0xffffffff Bus Number 0xffffffff
InstancePath is "PCI\VEN_8086&DEV_7010\0&69"
ServiceName is "intelide"
TargetDeviceNotify List - f 0xff0cdeec b 0xff0cdeec
Flags (0x00001209) DNF_PROCESSED, DNF_ENUMERATED,
DNF_RESOURCE_ASSIGNED, DNF_ADDED
(note that the device is not yet started)
CmResourceList at 0xe120fce8 Version 0.0 Interface 0x5 Bus #0
Entry 0 - Port (0x1) Device Exclusive (0x1)
Flags (0x01) - PORT_MEMORY PORT_IO
Range starts at 0xfff0 for 0x10 bytes (these are the resources used: 0xfff0-0xffff)
Entry 1 - DevicePrivate (0x81) Device Exclusive (0x1)
Flags (0000) Data - {0x00000001, 0x00000004, 0000000000}
IoResList at 0xe120df88 : Interface 0x5 Bus 0 Slot 0x2d
Alternative 0 (Version 1.1)
Descriptor 0 - Port (0x1) Device Exclusive (0x1)
Flags (0x01) - PORT_IO
0x000010 byte range with alignment 0x000010
0 - 0xffff
(it could have used any 16 bytes that are 16-byte aligned between 0 and 0xffff)
Descriptor 1 - DevicePrivate (0x81) Device Exclusive (0x1)
Flags (0000) Data:
: 0x1 0x4 0x0
Example for PCMCIA:
kd> bp pcmcia!pcmciastartpccard
Loading symbols for 0x8039d000
kd> kb
Loading symbols for 0x80241000
ChildEBP RetAddr Args to Child
f6413814 803a7cbd ff0d0c30 e11d8808
f6413838 803a3798 ff0d0c30 ff0d1500
f6413848 80418641 ff0d0c30 ff0d1588
f641385c 802455cf ff0d1614 ff0d1638
f641387c 802497cf ff0d1588 ff0d0c30
f64138ac 80418641 ff0c8210 ff0d161c
f64138c0 8048de68 ff0c3508 ff0d16a8
f64138d4 8041ff5e ff0c8210 f64138f8
f6413920 8048b4ae ff0d0c30 ff0e0a68
f6413950 8048d707 ff0d16a8 f64139fc
f6413960 8048dc9f ff0d16a8 f64139fc
f6413970 8048d6f5 ff0d1e88 8048d6c4
f6413984 8048dc9f ff0d1e88 f64139fc
f6413994 8048d6f5 ff0d3268 8048d6c4
f64139a8 8048dc9f ff0d3268 f64139fc
f64139b8 8048d6f5 ff0d7b28 8048d6c4
f64139cc 8048d6b3 ff0d7b28 f64139fc
f64139e0 804f6c97 ff0e0a68 f64139fc
f6413a30 804f5601 000001e0 80087000
f6413b7c 804f4820 80087000 00000001
kd> !cmreslist e11d8808
pcmcia.sys ->
ndis.sys ->
ff0d0c30
ff0d1588
00000000
00040000
ff0c8210
ff0d1640
00000000
ff0c3508
ff0d16a8
00000000
ff0d1e88
f64139fc
ff0d3268
f64139fc
ff0d7b28
f64139fc
80087000
8045c140
00000000
00000000
pcmcia.sys
ndis.sys
pcmcia!PcmciaStartPcCard
pcmcia!PcmciaPdoPnpDispatch+0x169
pcmcia!PcmciaDispatch+0x3a
ntoskrnl!IofCallDriver+0x35
NDIS!ndisPassIrpDownTheStack+0x3b
NDIS!ndisPnPDispatch+0x1f9
ntoskrnl!IofCallDriver+0x35
ntoskrnl!IopAsynchronousCall+0x90
ntoskrnl!IopStartDevice+0x76
ntoskrnl!IopStartAndEnumerateDevice+0x1a
ntoskrnl!IopProcessStartDevicesWorker+0x43
ntoskrnl!IopForAllChildDeviceNodes+0x1f
ntoskrnl!IopProcessStartDevicesWorker+0x31
ntoskrnl!IopForAllChildDeviceNodes+0x1f
ntoskrnl!IopProcessStartDevicesWorker+0x31
ntoskrnl!IopForAllChildDeviceNodes+0x1f
ntoskrnl!IopProcessStartDevicesWorker+0x31
ntoskrnl!IopProcessStartDevices+0x1f
ntoskrnl!IopInitializeSystemDrivers+0x5b
ntoskrnl!IoInitSystem+0x3fe
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Determining Whether a Leak Exists describes a technique you can use if you are not sure whether there is a memory leak on your system.
Finding a Kernel-Mode Memory Leak describes how to find a leak that is caused by a kernel-mode driver or component.
Finding a User-Mode Memory Leak describes how to find a leak that is caused by a user-mode driver or application.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Change the update time to 600 seconds to capture a graph of the leak over time. You might also want to log the data to a file for later examination.
Start the application or test that you believe is causing the leak. Allow the application or test to run undisturbed for some time; do not use the target computer during this time.
Leaks are usually slow and may take hours to detect. Wait for a few hours before deciding whether a leak has occurred.
Monitor the Performance Monitor counters. After the test has started, the counter values will change rapidly, and it may take some time for the memory pools values to reach
a steady state.
User-mode memory leaks are always located in pageable pool and cause both the Pool Paged Bytes counter and the page file Usage counter to increase steadily over time.
Kernel-mode memory leaks usually deplete nonpaged pool, causing the Pool Nonpaged Bytes counter to increase, although pageable memory can be affected as well.
Occasionally these counters may show false positives because an application is caching data.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
PoolMon in the
Paged
Paged
Paged
Paged
1283 ( 0)
10385 ( 10)
6662 ( 8)
614 ( 0)
1002
6658
4971
441
(
(
(
(
0)
4)
6)
0)
281
3727
1691
173
1377312
( 0)
317952 ( 512)
174560 ( 128)
83456
( 0)
4901
85
103
482
PoolMon has command keys that sort the output according to various criteria. Press the letter associated with each command in order to re-sort the data. It takes a few seconds
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
NonPaged
Allocs
Used
0
0
0
0
0
0
1
128
0
0
Paged
Allocs
Used
36405 33930272
552 7863232
10939
998432
2222
924352
22
828384
3. Determine which pool tag is associated with the greatest usage of memory. In this example, the driver using the tag "Abc" is using the most memoryalmost 34 MB.
Therefore, the memory leak is most likely to be in this driver.
Finding the Leak
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
After you have determined the pool tag associated with the leak, follow this procedure to locate the leak itself:
1. Use the ed (Enter Values) command to modify the value of the global system variable PoolHitTag. This global variable causes the debugger to break whenever a pool
tag matching its value is used.
2. Set PoolHitTag equal to the tag that you suspect to be the source of the memory leak. The module name "nt" should be specified for faster symbol resolution. The tag
value must be entered in little-endian format (that is, backward). Because pool tags are always four characters, this tag is actually A-b-c-space, not merely A-b-c. So use
the following command:
kd> ed nt!poolhittag ' cbA'
3. To verify the current value of PoolHitTag, use the db (Display Memory) command:
kd> db nt!poolhittag L4
820f2ba4 41 62 63 20
Abc
4. The debugger will break every time that pool is allocated or freed with the tag Abc. Each time the debugger breaks on one of these allocations or free operations, use
the kb (Display Stack Backtrace) debugger command to view the stack trace.
Using this procedure, you can determine which code resident in memory is overallocating pool with the tag Abc.
To clear the breakpoint, set PoolHitTag to zero:
kd> ed nt!poolhittag 0
If there are several different places where memory with this tag is being allocated and these are in an application or driver that you have written, you can alter your source
code to use unique tags for each of these allocations.
If you cannot recompile the program but you want to determine which one of several possible locations in the code is causing the leak, you can unassemble the code at each
location and use the debugger to edit this code resident in memory so that each instance uses a distinct (and previously unused) pool tag. Then allow the system to run for
several minutes or more. After some time has passed, break in again with the debugger and use the !poolfind extension to find all pool allocations associated with each of the
new tags.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Change the update time to 600 seconds to capture a graph of the leak over time. You might also want to log the data to a file for later examination.
The Private Bytes counter indicates the total amount of memory that a process has allocated, not including memory shared with other processes. The Virtual Bytes counter
indicates the current size of the virtual address space that the process is using.
Some memory leaks appear in the data file as an increase in private bytes allocated. Other memory leaks show up as an increase in the virtual address space.
After you have determined which process is leaking memory, use the UMDH tool to determine the specific routine that is at fault. For details, see Using UMDH to Find UserMode Memory Leaks.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
In the GFlags graphical interface, choose the Image File tab, type the process name (including the file name extension), press the TAB key, select Create user mode
stack trace database, and then click Apply.
Or, equivalently, use the following GFlags command line, where ImageName is the process name (including the file name extension):
gflags /i ImageName +ust
By default, the amount of stack trace data that Windows gathers is limited to 32 MB on an x86 processor, and 64 MB on an x64 or Itanium-based processor. If you must
increase the size of this database, choose the Image File tab in the GFlags graphical interface, type the process name, press the TAB key, check the Stack Backtrace
(Megs) check box, type a value (in MB) in the associated text box, and then click Apply. Increase this database only when necessary, because it may deplete limited
Windows resources. When you no longer need the larger size, return this setting to its original value.
If you changed any flags on the System Registry tab, you must restart Windows to make these changes effective. If you changed any flags on the Image File tab, you
must restart the process to make the changes effective. Changes to the Kernel Flags tab are effective immediately, but they are lost the next time Windows restarts.
Before using UMDH, you must have access to the proper symbols for your application. UMDH uses the symbol path specified by the environment variable
_NT_SYMBOL_PATH. Set this variable equal to a path containing the symbols for your application. If you also include a path to Windows symbols, the analysis may be
more complete. The syntax for this symbol path is the same as that used by the debugger; for details, see Symbol Path.
For example, if the symbols for your application are located at C:\MySymbols, and you want to use the public Microsoft symbol store for your Windows symbols, using
C:\MyCache as your downstream store, you would use the following command to set your symbol path:
set _NT_SYMBOL_PATH=c:\mysymbols;srv*c:\mycache*http://msdl.microsoft.com/download/symbols
In addition, to assure accurate results, you must disable BSTR caching. To do this, set the OANOCACHE environment variable equal to one (1). Make this setting before you
launch the application whose allocations are to be traced.
If you need to trace the allocations made by a service, you must set OANOCACHE as a system environment variable and then restart Windows for this setting to take effect.
On Windows 2000, in addition to setting OANOCACHE equal to 1, you must also install the hotfix available with
and later versions of Windows.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
After making these preparations, you can use UMDH to capture information about the heap allocations of a process. To do so, follow this procedure:
1. Determine the process ID (PID) for the process you want to investigate.
2. Use UMDH to analyze the heap memory allocations for this process, and save it to a log file. Use the -p switch with the PID, and the -f switch with the name of the log
file. For example, if the PID is 124, and you want to name the log file Log1.txt, use the following command:
umdh p:124 f:log1.txt
3. Use Notepad or another program to open the log file. This file contains the call stack for each heap allocation, the number of allocations made through that call stack,
and the number of bytes consumed through that call stack.
4. Because you are looking for a memory leak, the contents of a single log file are not sufficient. You must compare log files recorded at different times to determine
which allocations are growing.
UMDH can compare two different log files and display the change in their respective allocation sizes. You can use the greater-than symbol (>) to redirect the results
into a third text file. You may also want to include the -d option, which converts the byte and allocation counts from hexadecimal to decimal. For example, to compare
Log1.txt and Log2.txt, saving the results of the comparison to the file LogCompare.txt, use the following command:
umdh log1.txt log2.txt > logcompare.txt
5. Open the LogCompare.txt file. Its contents resemble the following:
+ 5320 ( f110 - 9df0) 3a allocs BackTrace00B53
Total increase == 5320
For each call stack (labeled "BackTrace") in the UMDH log files, there is a comparison made between the two log files. In this example, the first log file (Log1.txt)
recorded 0x9DF0 bytes allocated for BackTrace00B53, while the second log file recorded 0xF110 bytes, which means that there were 0x5320 additional bytes allocated
between the time the two logs were captured. The bytes came from the call stack identified by BackTrace00B53.
6. To determine what is in that backtrace, open one of the original log files (for example, Log2.txt) and search for "BackTrace00B53." The results are similar to this data:
00005320 bytes in 0x14 allocations (@ 0x00000428) by: BackTrace00B53
ntdll!RtlDebugAllocateHeap+0x000000FD
ntdll!RtlAllocateHeapSlowly+0x0000005A
ntdll!RtlAllocateHeap+0x00000808
MyApp!_heap_alloc_base+0x00000069
MyApp!_heap_alloc_dbg+0x000001A2
MyApp!_nh_malloc_dbg+0x00000023
MyApp!_nh_malloc+0x00000016
MyApp!operator new+0x0000000E
MyApp!DisplayMyGraphics+0x0000001E
MyApp!main+0x0000002C
MyApp!mainCRTStartup+0x000000FC
KERNEL32!BaseProcessStart+0x0000003D
This UMDH output shows that there were 0x5320 (decimal 21280) total bytes allocated from the call stack. These bytes were allocated from 0x14 (decimal 20) separate
allocations of 0x428 (decimal 1064) bytes each.
The call stack is given an identifier of "BackTrace00B53," and the calls in this stack are displayed. In reviewing the call stack, you see that the DisplayMyGraphics
routine is allocating memory through the new operator, which calls the routine malloc, which uses the Visual C++ run-time library to obtain memory from the heap.
Determine which of these calls is the last one to explicitly appear in your source code. In this case, it is probably the new operator because the call to malloc occurred as
part of the implementation of new rather than as a separate allocation. So this instance of the new operator in the DisplayMyGraphics routine is repeatedly allocating
memory that is not being freed.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
The mouse pointer can be moved, but does not affect any windows on the screen.
The entire screen is still and the mouse pointer does not move, but paging continues between the memory and the disk.
The screen is still and the disk is silent.
If the mouse pointer moves or there is paging to the disk, this is usually due to a problem within the Client Server Run-Time Subsystem (CSRSS).
If NTSD is running on CSRSS, press F12 and dump out each thread to see if there is anything out of the ordinary. (See Debugging CSRSS for more details.)
If an examination of CSRSS reveals nothing, then the problem may be with the kernel after all.
If there is no mouse movement or paging, then it is almost certainly a kernel problem.
Analyzing a kernel crash of this sort is generally a difficult task. To begin, break into KD (with CTRL+C) or WinDbg (with CTRL+BREAK). You can now use the debugger
commands to examine the situation.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
ffffffff
80470650
8046d860
00000000
00000000
00000000
00000000
SelfPcr:
Prcb:
Irql:
IRR:
IDR:
InterruptMode:
IDT:
GDT:
TSS:
ffdff000
ffdff120
00000000
00000000
ffffffff
00000000
80036400
80036000
80257000
CurrentThread: 8046c610
NextThread: 00000000
IdleThread: 8046c610
DpcQueue:
However, the results for Processor 1 are quite different. In this case, the value of NtTib.ExceptionList is f0823cc0, not 0xFFFFFFFF, indicating that this is the processor on
which the exception occurred.
0: kd> ~1
1: kd> !pcr
PCR Processor 1 @81497000
NtTib.ExceptionList:
NtTib.StackBase:
NtTib.StackLimit:
NtTib.SubSystemTib:
NtTib.Version:
NtTib.UserPointer:
NtTib.SelfTib:
f0823cc0
f0823df0
f0821000
00000000
00000000
00000000
00000000
SelfPcr:
Prcb:
Irql:
IRR:
IDR:
InterruptMode:
IDT:
GDT:
TSS:
81497000
81497120
00000000
00000000
ffffffff
00000000
8149b0e8
8149b908
81498000
CurrentThread: 81496d28
NextThread: 00000000
IdleThread: 81496d28
DpcQueue:
When you are in the correct processor context, the !process extension displays the currently running process.
The most interesting parts of the process dump are:
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The times (a high value indicates that process might be the culprit).
The handle count (this is the number in parentheses after ObjectTable in the first entry).
The thread status (many processes have multiple threads). If the current process is Idle, it is likely that either the machine is truly idle or it hung due to some unusual
problem.
Although using the !process 0 7 extension is the best way to find the problem on a hung system, it is sometimes too much information to filter. Instead, use a !process 0 0 and
then a !process on the process handle for CSRSS and any other suspicious processes.
When using a !process 0 7, many of the threads might be marked "kernel stack not resident" because those stacks are paged out. If those pages are still in the cache that is in
transition, you can get more information by using a .cache decodeptes before !process 0 7:
kd> .cache decodeptes
kd> !process 0 7
If you can identify the failing process, use !process <process> 7 to show the kernel stacks for each thread in the process. This output can identify the problem in kernel mode
and reveal what the suspect process is calling.
In addition to !process, the following extensions can help to determine the cause of an unresponsive computer:
Extension
Effect
!ready
Identifies the threads that are ready to run, in order of priority.
!kdext*.locks Identifies any held resource locks, in case there is a deadlock with retail time outs.
!vm
Checks the virtual memory usage.
!poolused
Determines whether one type of pool allocation is disproportionately large (pool tagging required).
!memusage Checks the physical memory status.
!heap
Checks the validity of the heap.
!irpfind
Searches nonpaged pool for active IRPs.
If the information provided does not indicate an unusual condition, try setting a breakpoint at ntoskrnl!KiSwapThread to determine whether the processor is stuck in one
process or if it is still scheduling other processes. If it is not stuck, set breakpoints in common functions, such as NtReadFile, to determine whether the computer is stuck in a
specific code path.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
A hardware device does not release its interrupt signal after being directed to do so by the device driver.
A device driver does not instruct its hardware to release the interrupt signal, because it does not detect that the interrupt was initiated from its hardware.
A device driver claims the interrupt even though the interrupt was not initiated from its hardware. This situation can only occur when multiple devices are sharing the
same IRQ.
The edge level control register (ELCR) is not set correctly.
Edge and level interrupt-triggered devices share an IRQ (for example, a COM port and a PCI SCSI controller).
This example demonstrates one method for detecting and debugging an interrupt storm.
When the machine hangs, use a kernel debugger to break in. Use the !irpfind extension command to look for pending IRPs. Then, use the !irp extension to obtain details
about any pending IRPs. For example:
kd> !irp 81183468
Irp is active with 2 stacks 2 is current (= 0x811834fc)
No Mdl Thread 00000000: Irp stack trace.
cmd flg cl Device
File
Completion-Context
[ 0, 0]
0 0 8145f470 00000000 00000000-00000000
\Driver\E100B
Args: 00000000 00000000 00000000 00000000
>[ 16, 2]
0 e1 8145f470 00000000 8047f744-814187a8 Success Error Cancel pending
\Driver\E100B
ntoskrnl!PopCompleteSystemPowerIrp
Args: 00000000 00000000 00000002 00000002
This example shows that \driver\e100b has not returned the IRP for ntoskrnl!PopCompleteSystemPowerIrp. It appears to be stuck and might be experiencing an interrupt
storm.
To investigate, use the kb command to request a stack trace. For example:
kd> kb
ChildEBP
f714ee68
f714ee68
f714eeec
f714eeec
RetAddr
8046355a
80067a4f
8046380b
80463c50
Args to Child
00000001 80068c10
00000001 80068c10
01001010 0000003b
01001010 0000003b
00000030
00000030
f714ef00
f714ef00
ntoskrnl!RtlpBreakWithStatusInstruction
ntoskrnl!KeUpdateSystemTime+0x13e
halacpi!HalBeginSystemInterrupt+0x83
ntoskrnl!KiChainedDispatch+0x1b
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
RetAddr
8046355a
bfe854b9
f7051796
80463850
80463818
80463c50
80067cc2
80501cb5
8045f744
8042e487
804ab556
8041f75b
804965cd
bfee1eb9
bfedb416
bfed4ddb
bfed5146
8041c60f
8044cc52
8044cb89
Args to Child
00000001 00000010
00000001 00000010
00000000 80463850
8143ec88 81444038
00000202 0000003b
00000202 0000003b
00000000 00000240
00000000 00000240
f714f16c 00020019
f714f16c 00020019
f714f16c 00020019
f714f1e8 8000017c
8145f630 00000000
8145f630 00000000
00000004 00000800
bfed0660 811a2708
811a2708 00000004
81453a30 811a2708
80475b18 811a2708
811a279c 811a2708
00000030
00000030
8143ec88
8046380b
80450bb8
80450bb8
8000017c
8000017c
f714f148
f714f148
f714f148
f714f1d0
00000001
8145f5a0
0045f570
811a2708
8145f570
80475b18
811a279c
811a27c0
ntoskrnl!RtlpBreakWithStatusInstruction
ntoskrnl!KeUpdateSystemTime+0x13e
atimpab!AtiInterrupt+0x109
VIDEOPRT!pVideoPortInterrupt+0x16
ntoskrnl!KiChainedDispatch2ndLvl+0x28
ntoskrnl!KiChainedDispatch+0x28
ntoskrnl!KiDispatchInterrupt
halacpi!HalpDispatchInterrupt2ndEntry+0x1b
ntoskrnl!NtCreateKey+0x113
ntoskrnl!KiSystemService+0xc4
ntoskrnl!ZwCreateKey+0xb
ntoskrnl!IopCreateRegistryKeyEx+0x4e
ntoskrnl!IopProcessSetInterfaceState+0x93
ntoskrnl!IoSetDeviceInterfaceState+0x2b
NDIS!ndisMCommonHaltMiniport+0x1f
NDIS!ndisPmHaltMiniport+0x9a
NDIS!ndisSetPower+0x1d1
NDIS!ndisPowerDispatch+0x84
ntoskrnl!IopfCallDriver+0x35
ntoskrnl!PopPresentIrp+0x62
The system is currently running the ISR for the video card. The system will run the ISR for each of the devices sharing IRQ 0xB. If no process claims the interrupt, the
operating system will wait infinitely, requesting the driver ISRs to handle the interrupt. It is also possible that a process might handle the interrupt and stop it, but if the
hardware is broken the interrupt may simply be re-asserted.
Use the !arbiter 4 extension to determine which devices are on IRQ 0xB. If there is only one device on IRQ 0xB, you have found the cause of the problem.. If there is more
than one device sharing the interrupt (99% of the cases), you will need to isolate the device either by manually programming LNK nodes (which is destructive to the system
state), or by removing or disabling hardware.
kd> !arbiter 4
DEVNODE 8149a008 (HTREE\ROOT\0)
Interrupt Arbiter "RootIRQ" at 80472a20
Allocated ranges:
0000000000000000 - 0000000000000000
0000000000000001 - 0000000000000001
0000000000000002 - 0000000000000002
0000000000000003 - 0000000000000003
0000000000000004 - 0000000000000004
0000000000000005 - 0000000000000005
0000000000000006 - 0000000000000006
0000000000000007 - 0000000000000007
0000000000000008 - 0000000000000008
0000000000000009 - 0000000000000009
000000000000000a - 000000000000000a
000000000000000b - 000000000000000b
000000000000000c - 000000000000000c
000000000000000d - 000000000000000d
000000000000000e - 000000000000000e
000000000000000f - 000000000000000f
0000000000000010 - 0000000000000010
0000000000000011 - 0000000000000011
0000000000000012 - 0000000000000012
0000000000000013 - 0000000000000013
0000000000000014 - 0000000000000014
0000000000000015 - 0000000000000015
0000000000000016 - 0000000000000016
0000000000000017 - 0000000000000017
0000000000000018 - 0000000000000018
0000000000000019 - 0000000000000019
000000000000001a - 000000000000001a
000000000000001b - 000000000000001b
000000000000001c - 000000000000001c
000000000000001d - 000000000000001d
000000000000001e - 000000000000001e
000000000000001f - 000000000000001f
0000000000000020 - 0000000000000020
0000000000000021 - 0000000000000021
0000000000000022 - 0000000000000022
0000000000000023 - 0000000000000023
0000000000000024 - 0000000000000024
0000000000000025 - 0000000000000025
0000000000000026 - 0000000000000026
0000000000000027 - 0000000000000027
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
8149acd0
8149acd0
8149acd0
8149acd0
8149acd0
8149acd0
8149acd0
8149acd0
8149acd0
8149acd0
8149acd0
8149acd0
8149acd0
8149acd0
8149acd0
8149acd0
8149acd0
8149acd0
8149acd0
8149acd0
8149acd0
8149acd0
8149acd0
8149acd0
8149acd0
8149acd0
8149acd0
8149acd0
8149acd0
8149acd0
8149acd0
8149acd0
8149acd0
8149acd0
8149acd0
8149acd0
8149acd0
8149acd0
8149acd0
8149acd0
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
0000000000000028 0000000000000029 000000000000002a 000000000000002b 000000000000002c 000000000000002d 000000000000002e 000000000000002f 0000000000000032 0000000000000039 Possible allocation:
< none >
0000000000000028
0000000000000029
000000000000002a
000000000000002b
000000000000002c
000000000000002d
000000000000002e
000000000000002f
0000000000000032
0000000000000039 S
B
B
B
B
B
B
B
B
B
8149acd0
8149acd0
8149acd0
8149acd0
8149acd0
8149acd0
8149acd0
8149acd0
8149acd0
814776d0
S
S
S
S
B
(ACPI)
81495bb0
814952b0
81495610
8149acd0
81495730
81495a90
814776d0
(i8042prt)
(Serial)
(fdc)
(ACPI)
81453c30 (ds1)
81453a30 (E100B)
81493c30 (uhcd)
8145c390 (atirage3)
814953d0 (i8042prt)
81495850
8145bb50 (atapi)
8145b970 (atapi)
In this case, the audio, Universal Serial Bus (USB), network interface card (NIC), and video are all using the same IRQ.
To find out which ISR claims ownership of the interrupt, examine the return value from the ISR. Simply disassemble the ISR using the U command with address given in
the !arbiter display, and set a breakpoint on the last instruction of the ISR (which will be a 'ret' instruction). Note that using the command g <address> is the equivalent of
setting a breakpoint on that address:
kd> g bfe33e7b
ds1wdm!AdapterIsr+ad:
bfe33e7b c20800
ret
0x8
Use the r command to examine the registers. In particular, look at the EAX register. If the portion of the register contents in bold (in the following code example) is anything
other then zero, this ISR claimed the interrupt. Otherwise, the interrupt was not claimed, and the operating system will call the next ISR. This example shows that the video
card is not claiming the interrupt:
kd> r
eax=00000000 ebx=813f4ff0 ecx=00000010 edx=ffdff848 esi=8145d168 edi=813f4fc8
eip=bfe33e7b esp=f714eec4 ebp=f714eee0 iopl=0
nv up ei pl zr na po nc
cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000
efl=00000246
ds1wdm!AdapterIsr+ad:
bfe33e7b c20800
ret
0x8
In fact, in this case, the interrupt is not claimed by any of the devices on IRQ 0xb. When you encounter this problem, you should also check to see if each piece of hardware
associated with the interrupt is actually enabled. For PCI, this is easy look at the CMD register displayed by the !pci extension output:
kd> !pci 0 0
PCI Bus 0
00:0 8086:7190.03
01:0 8086:7191.03
03:0 1073:000c.03
04:0 8086:1229.05
07:0 8086:7110.02
07:1 8086:7111.01
07:2 8086:7112.01
07:3 8086:7113.02
Cmd[0006:.mb...]
Cmd[0107:imb..s]
Cmd[0000:......]
Cmd[0007:imb...]
Cmd[000f:imb...]
Cmd[0005:i.b...]
Cmd[0005:i.b...]
Cmd[0003:im....]
Sts[2210:c....]
Sts[0220:.6...]
Sts[0210:c....]
Sts[0290:c....]
Sts[0280:.....]
Sts[0280:.....]
Sts[0280:.....]
Sts[0280:.....]
Note that the audio chip's CMD register is zero. This means the audio chip is effectively disabled at this time. This also means that the audio chip will not be capable of
responding to accesses by the driver.
In this case, the audio chip needs to be manually re-enabled.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
THREAD ffaf5410 Cid e7.e8 Teb: 7ffde000 WAIT: (Executive) KernelMode Non-Alertable
feecf698 SynchronizationEvent
IRP List:
fef29208: (0006,00b8) Flags: 00000884 Mdl: feed8328
Not impersonating
Owning Process ffaf5690
WaitTime (seconds)
2781250
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
RetAddr
801044fc
fc655976
fc6509fa
fc6533e5
fc652f26
fc652b14
Args to Child
feecf668 feecf668
feecf698 00000000
e1263968 fef29208
feecf668 e125b3c8
feecf668 fec6bae4
feecf668 fef29208
00000080
00000000
feecf668
ffafae08
fef29208
fee50b60
ntoskrnl!KiSwapContext+0x25
ntoskrnl!_KeWaitForSingleObject+0x218
nwrdr!_ExchangeWithWait+0x38
nwrdr!_CreateScb+0x2ff
nwrdr!_CreateRemoteFile+0x2c9
nwrdr!_NwCommonCreate+0x3a2
fec6bbac
fec6bbc0
fec6bd10
fec6bd7c
fec6be5c
fec6bef4
fec6bef4
80107aea
80142792
80145403
80144c0c
80127803
801385c3
77f716ab
fee50b60
fef37700
fee50b60
00000000
0012dd64
0012dd64
0012dd64
804052ac
fee50b28
fec6bdbc
00000040
80127701
00000000
00000000
nwrdr!_NwFsdCreate+0x56
ntoskrnl!IofCallDriver+0x38
ntoskrnl!_IopParseDevice+0x6a0
ntoskrnl!_ObpLookupObjectName+0x479
ntoskrnl!_ObOpenObjectByName+0xa2
ntoskrnl!_NtQueryAttributesFile+0xc1
ntoskrnl!_KiSystemService+0x83
fef29208
fec6bdbc
00000000
fec6be34
00000000
0012dd3c
0012dd3c
RetAddr
77f79c78
77f71048
5fef0b4b
5fedf83f
5fedfa5b
5fedf678
Args to Child
77f71000 002a6b88
5ffa9f9c 5fef0b4b
5ffa9f9c 002a6b88
002a6b88 0569fdc0
002a6b88 00190000
0569ff18 0031c200
7fffffff
5ffa9f9c
002a0019
0000003e
00000000
0335ee88
ntdll!_DbgBreakPoint
ntdll!_RtlpWaitForCriticalSection+0x89
ntdll!_RtlEnterCriticalSection+0x48
winsrv!_StreamScrollRegion+0x1f0
winsrv!_AdjustCursorPosition+0x8e
winsrv!_DoWriteConsole+0x104
8
1
6d
1d6c
1d47
Now search for the thread that has the ID number 0x6D:
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
0:024> ~
0 id:
1 id:
2 id:
3 id:
4 id:
5 id:
6 id:
7 id:
8 id:
9 id:
10 id:
11 id:
12 id:
13 id:
14 id:
15 id:
16 id:
17 id:
18 id:
19 id:
20 id:
21 id:
22 id:
23 id:
24 id:
16.15
16.13
16.30
16.2f
16.2e
16.6c
16.6d
16.2d
16.33
16.42
16.6f
16.6e
16.52
16.61
16.7e
16.43
16.89
16.95
16.90
16.71
16.bb
16.88
16.cd
16.c1
16.bd
Teb
Teb
Teb
Teb
Teb
Teb
Teb
Teb
Teb
Teb
Teb
Teb
Teb
Teb
Teb
Teb
Teb
Teb
Teb
Teb
Teb
Teb
Teb
Teb
Teb
7ffdd000
7ffdb000
7ffda000
7ffd9000
7ffd8000
7ff6c000
7ff68000
7ffd7000
7ffd6000
7ff6f000
7ff6e000
7ffd5000
7ff6b000
7ff6a000
7ff69000
7ff67000
7ff50000
7ff65000
7ff64000
7ff63000
7ff62000
7ff61000
7ff5e000
7ff5f000
7ff5d000
Unfrozen
Unfrozen
Unfrozen
Unfrozen
Unfrozen
Unfrozen
Unfrozen
Unfrozen
Unfrozen
Unfrozen
Unfrozen
Unfrozen
Unfrozen
Unfrozen
Unfrozen
Unfrozen
Unfrozen
Unfrozen
Unfrozen
Unfrozen
Unfrozen
Unfrozen
Unfrozen
Unfrozen
Unfrozen
Thread 21 owns the first critical section. Make that the active thread and get a stack trace:
0:024> ~21s
ntdll!_ZwWaitForSingleObject+0xb:
77f71bfb c20c00
ret
0xc
0:021> kb
ChildEBP
0556fc44
0556fcb0
0556fcb8
0556fcf4
0556fd70
0556fd8c
RetAddr
77f79c20
77f71048
5feb4f7e
5fef0b76
5fedf83f
5fedfa5b
Args to Child
00000110 00000000
5ffa91b4 5feb4f7e
5ffa91b4 0556fd70
01302005 00000000
002bd880 0556fdc0
002bd880 00190000
77fa4700
5ffa91b4
77f71000
fffffff4
00000025
00000000
ntdll!_ZwWaitForSingleObject+0xb
ntdll!_RtlpWaitForCriticalSection+0x31
ntdll!_RtlEnterCriticalSection+0x48
winsrv!__ScrollDC+0x14
winsrv!_StreamScrollRegion+0x21b
winsrv!_AdjustCursorPosition+0x8e
[eax+0x58],ecx
ds:0023:7f504da8=000000f8
0:006> kb
ChildEBP
01ecfeb4
01ecfed0
01ecfefc
01ecfff4
RetAddr
5fecd0d7
5feccf62
5fe6311b
00000000
Args to Child
00000086 00000000
00000086 01ecfff4
01ecff18 01ecffd0
00000000 00000024
7f5738e0
00000113
00000005
00000024
winsrv!_PtiFromThreadId+0xd
winsrv!__GetThreadDesktop+0x12
winsrv!___GetThreadDesktop+0x8b
csrsrv!_CsrApiRequestThread+0x4ff
Thread 21 has RtlpWaitForCriticalSection near the top of its stack. Thread 6 does not. So thread 21 is the culprit.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The very beginning of the service startup. The debugger is automatically launched when the service begins. Choose this option if you want to debug the service's
initialization code.
The first time that the service encounters an exception. The debugger is automatically launched when an exception or crash occurs or if the service application calls the
DebugBreak function. Choose this option if you want the debugger to appear when a problem is encountered but not before.
After the service is running normally. You can manually attach a debugger to a service that is already running at any time. Choose this option if you do not want to
make advance preparations for debugging.
Local debugging. A single debugger, running on the same computer as the service.
Remote debugging. A debugging server running on the same computer as the service, being controlled from a debugging client running on a second computer.
Kernel-controlled user-mode debugging. A user-mode debugger running on the same computer as the service, being controlled from a kernel debugger on a second
computer.
If your service is running on Windows 2000, Windows XP, or Windows Server 2003, you can combine any of these three attach options with any of these three debugging
configuration options.
If your service is running on Windows Vista or a later version of Windows, there is one restriction on how these choices can be combined. If you want to debug from the
beginning of the service startup, or from the time that an exception is encountered, you must use either remote debugging or kernel-controlled user-mode debugging.
In other words, on Windows Vista and later, you cannot use local debugging unless you plan to attach the debugger manually after the service is already running. This
restriction results from the fact that in these versions of Windows, services run in session 0, and any debugger that is automatically launched and attached to the service is also
in session 0, and does not have a user interface on the computer that the service is running on.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
c:\Debuggers\windbg.exe
Do not choose this option if you are running Windows Vista or a later version of Windows.
If you plan to use remote debugging, specify NTSD with the -noio option. This causes NTSD to run without any console of its own, accessible only through the remote
connection. For example:
c:\Debuggers\ntsd.exe -server ServerTransport -noio -y SymbolPath
If your debugging session begins before Windows is fully loaded, you may not be able to access symbols from a remote share; in such a case, you must use local
symbols. ServerTransport must specify a transport protocol that is implemented by the Windows kernel without interfacing with a user-mode service, such as TCP or
NPIPE. For the syntax of ServerTransport, see Activating a Debugging Server.
If you plan to control the user-mode debugger from a kernel-mode debugger, specify NTSD with the -d option. For example:
c:\Debuggers\ntsd.exe -d -y SymbolPath
If you plan to use this method and your user-mode symbols will be accessed from a symbol server, you should combine this method with remote debugging. In this
case, specify NTSD with the -ddefer option. Choose a transport protocol that is implemented by the Windows kernel without interfacing with a user-mode service, such
as TCP or NPIPE. For example:
c:\Debuggers\ntsd.exe -server ServerTransport -ddefer -y SymbolPath
For details, see Controlling the User-Mode Debugger from the Kernel Debugger.
After this registry edit is complete, the debugger is launched whenever a service with this name is started or restarted.
Enabling the Service Application to Break Into the Debugger
If you want the service application to break into the debugger when it crashes or encounters an exception, this preparatory step is required. This step is also required if you
want the service application to break into the debugger by calling the DebugBreak function.
Note: If you have enabled debugging of the initialization code (the step described in the subsection Enabling the Debugging of the Initialization Code), you should skip
this step. When initialization code debugging is enabled, the debugger attaches to the service application when it starts, which causes all crashes, exceptions, and calls to
DebugBreak to be routed to the debugger without additional preparations being needed.
This preparatory step involves registering the chosen debugger as the postmortem debugger. This is done by using the -iae or -iaec options on the debugger command line.
We recommend the following commands, but if you want to vary them, see the syntax details in Enabling Postmortem Debugging.
If you plan to use remote debugging, specify NTSD with the -noio option. This causes NTSD to run without any console of its own, accessible only through the remote
connection. To install a postmortem debugger that includes the -server parameter, you must manually edit the registry; for details, see Enabling Postmortem
Debugging. For example, the Debugger value of the AeDebug key could be the following:
ntsd -server npipe:pipe=myproc%x -noio -p %ld -e %ld -g -y SymbolPath
In the pipe specification, the %x token is replaced with the process ID of the process that launches the debugger. This guarantees that if more than one process launches
a postmortem debugger, each has a unique pipe name. If your debugging session begins before Windows is fully loaded, you may not be able to access symbols from a
remote share; in such a case, you must use local symbols. ServerTransport must specify a transport protocol that is implemented by the Windows kernel without
interfacing with a user-mode service, such as TCP or NPIPE. For the syntax of ServerTransport, see Activating a Debugging Server.
If you plan to control the user-mode debugger from a kernel-mode debugger, specify NTSD with the -d option. For example:
ntsd -iaec -d -y SymbolPath
If you choose this method and intend to access user-mode symbols from a symbol server, you should combine this method with remote debugging. In this case, specify
NTSD with the -ddefer option. Choose a transport protocol that is implemented by the Windows kernel without interfacing with a user-mode service, such as TCP or
NPIPE. To install a postmortem debugger that includes the -server parameter, you must manually edit the registry; for details, see Enabling Postmortem Debugging.
For example, the Debugger value of the AeDebug key could be the following:
ntsd -server npipe:pipe=myproc%x -ddefer -p %ld -e %ld -g -y SymbolPath
For details, see Controlling the User-Mode Debugger from the Kernel Debugger.
When you issue one of these commands, the postmortem debugger is registered. This debugger will be launched whenever any user-mode program, including a service
application, encounters an exception or runs a DebugBreak function.
Adjusting the Service Application Timeout
If you plan to launch the debugger automatically (either when the service starts or when it encounters an exception), this preparatory step is required.
Locate the following registry key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control
Under this key, locate or create a DWORD data value called ServicesPipeTimeout. Set this entry to the amount of time in milliseconds that you want the service to wait
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
before timing out. For example, a value of 60,000 is one minute, while a value of 86,400,000 is 24 hours. When this registry value is not set, the default timeout is about thirty
seconds.
The significance of this value is that a clock starts to run when each service is launched, and when the timeout value is reached, any debugger attached to the service is
terminated. Therefore, the value you choose should be longer than the total amount of time that elapses between the launching of the service and the completion of your
debugging session.
This setting applies to every service that is started or restarted after the registry edit is complete. If some service crashes or hangs and this setting is still in effect, the problem
is not detected by Windows. Therefore, you should use this setting only while you are debugging, and return the registry key to its original value after your debugging is
complete.
Isolating the Service
Sometimes, multiple services are combined in a single Service Host (Svchost) process. If you want to debug such a service, you must first isolate it into a separate Svchost
process.
There are three methods by which you can isolate a service. Microsoft recommends the Moving the Service to its Own Group method, as follows. The alternative methods
(Changing the Service Type and Duplicating the SvcHost Binary) can be used on a temporary basis for debugging, but because they alter the way the service runs, they are not
as reliable as the first method.
Preferred Method: Moving the Service to its Own Group
1. Issue the following Service Configuration tool (Sc.exe) command, where ServiceName is the name of the service:
sc qc ServiceName
This displays the current configuation values for the service. The value of interest is BINARY_PATH_NAME, which specifies the command line used to launch the
service control program. In this scenario, because your service is not yet isolated, this command line includes a directory path, Svchost.exe, and some SvcHost
parameters, including the -k switch, followed by a group name. For example, it may look something like this:
%SystemRoot%\System32\svchost.exe -k LocalServiceNoNetwork
Remember this path and the group name; they are used in steps 5 and 6.
2. Locate the following registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\SvcHost
Create a new REG_MULTI_SZ value with a unique name (for example, TempGrp).
3. Set this new value equal to the name of the service that you want to isolate. Do not include any directory path or file name extension. For example, you might set the
new value TempGrp equal to MyService.
4. Under the same registry key, create a new key with the same name you used in step 2. For example:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\SvcHost\TempGrp
Now the SvcHost key contains a value with the new name and also has a subordinate key with this same name.
5. Look for another key subordinate to the SvcHost key that has the same name as the group you found in step 1. If such a key exists, examine all the values in it, and
create duplicates of them in the new key you created in step 4.
For example, the old key might be named this:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\SvcHost\LocalServiceNoNetwork
and it might contain values such as CoInitializeSecurityParam, AuthenticationCapabilities, and other values. You would go to the newly created key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\SvcHost\TempGrp
and create values in it that are identical in name, type, and data to those in the old key.
If the old key does not exist, you do not need to create a new key.
6. Use the following Service Configuration tool command to revise the path found in step 1:
sc config ServiceName binPath= "RevisedPath"
In this command, ServiceName is the name of the service, and RevisedPath is the new value you are supplying for BINARY_PATH_NAME. For RevisedPath, use the
exact same path as the one displayed in step 1, including all the options shown on that line, making only one change: replace the parameter following the -k switch with
the name of the new registry value you created in step 2. Enclose RevisedPath in quotation marks. The space after the equal sign is required.
For example, your command might look like this:
sc config MyService binPath= "%SystemRoot%\System32\svchost.exe -k TempGrp"
You may want to use the sc qc command again to review the change you have made.
These settings will take effect the next time the service is started. To clear the effects of the old service, we recommend that you restart Windows rather than just restarting the
service.
After you have completed your debugging, if you want to return this service to the shared service host, use the sc config command again to return the binary path to its
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
original value, and delete the new registry keys and values you created..
Alternative Method: Changing the Service Type
1. Issue the following Service Configuration tool (Sc.exe) command, where ServiceName is the name of the service:
sc config ServiceName type= own
The space after the equal sign is required.
2. Restart the service, by using the following commands:
net stop ServiceName
net start ServiceName
This alternative is not the recommended method because it can alter the behavior of the service. If you do use this method, use the following command to revert to the normal
behavior after you have completed your debugging:
sc config ServiceName type= share
Alternative Method: Duplicating the SvcHost Binary
1. The Svchost.exe executable file is located in the system32 directory of Windows. Make a copy of this file, name it svhost2.exe, and place it in the system32 directory as
well.
2. Issue the following Service Configuration tool (Sc.exe) command, where ServiceName is the name of the service:
sc qc ServiceName
This command displays the current configuation values for the service. The value of interest is BINARY_PATH_NAME, which specifies the command line used to
launch the service control program. In this scenario, because your service is not yet isolated, this command line will include a directory path, Svchost.exe, and probably
some SvcHost parameters. For example, it may look something like this:
%SystemRoot%\System32\svchost.exe -k LocalServiceNoNetwork
3. To revise this path, issue the following command:
sc config ServiceName binPath= "RevisedPath"
In this command, ServiceName is the name of the service, and RevisedPath is the new value you are supplying for BINARY_PATH_NAME. For RevisedPath, use the
exact same path as the one displayed in step 2, including all the options shown on that line, making only one change: replace Svchost.exe with Svchost2.exe. Enclose
RevisedPath in quotation marks. The space after the equal sign is required.
For example, your command might look like this:
sc config MyService binPath= "%SystemRoot%\System32\svchost2.exe -k LocalServiceNoNetwork"
You can use the sc qc command again to review the change you have made.
4. Restart the service by using the following commands:
net stop ServiceName
net start ServiceName
This alternative is not the recommended method because it can alter the behavior of the service. If you do use this method, use the sc config command to change the path back
to its original value after you have completed your debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Arguments
Return Address
Caller's EBP
Local Variables
The stack trace displayed on a kernel debugger is written in assembly code. A simple set of instructions in assembly code could look like this:
push ebp
;Places the caller's base pointer (ebp) onto the stack
mov ebp,esp
;Sets the base pointer (ebp) equal to the stack pointer (esp)
mov eax, [ebp+8]
;Grab the value of the first argument off the stack and store it in eax
add eax, [ebp+c]
;Add the second argument's value to the value in eax
pop ebp
;Restore the caller's base pointer
ret 8
;Return to the calling function and remove 8 bytes from the stack
The compiler can optimize this code, simplifying it so it is shorter and more direct. An optimized routine might look like the following (note how the code omits references to
the base pointer):
mov eax, [esp+4]
add eax, [esp+8]
ret 8
Finally following is how it would look in C:
ULONG Add(ULONG a, ULONG b)
{
return a + b;
}
module name
ntdll
(C:\debug\ntdll.dll, \\ntstress\symbols\dll\ntdll.DBG)
Aha154x
(load from Aha154x.sys deferred)
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
80013000 8001aa60
8001b000 8001fba0
SCSIPORT
Scsidisk
80100000
802f0000
80400000
fe4c0000
fe4d0000
fe4e0000
fe500000
fe510000
801b7b40
8033c000
8040c000
fe4c38c0
fe4d3e60
fe4f0e40
fe5057a0
fe519560
NT
Ntfs
hal
vga
VIDEOPRT
ati
Msfs
Npfs
(ntoskrnl.exe, \\ntstress\symbols\exe\ntoskrnl.DBG)
(load from Ntfs.sys deferred)
(load from hal.dll deferred)
(load from vga.sys deferred)
(load from VIDEOPRT.SYS deferred)
(load from ati.SYS deferred)
(load from Msfs.SYS deferred)
(load from Npfs.SYS deferred)
fe520000
fe530000
fe5603e0
fe580000
fe590000
fe5a0000
fe5c0000
fe5d0000
fe521f60
fe54ed20
fe575360
fe585920
fe59b8a0
fe5b7c40
fe5c1b40
fe5dd580
ndistapi
Fastfat
NDIS
elnkii
ndiswan
nbf
TDI
nwlnkipx
fe5e0000
fe5f0000
fe610000
fe630000
fe650000
fe660000
fe670000
fe680000
fe5ee220
fe5fb320
fe62bf00
fe648600
fe6572a0
fe660000
fe670000
fe6bcf20
nwlnknb
afd
tcpip
netbt
netbios
Parport
Parallel
rdr
srv
fe6c0000 fe6f0920
The second step is dumping out the stack pointer (esp on an x86, sp on an Intel Itanium) to look for addresses in the modules given by the x *! command:
kd> dd esp
fe4cc97c 80136039
fe4cc98c fe682ae4
fe4cc99c fe682a78
fe4cc9ac ff680e08
fe4cc9bc fe6a1198
00000270
801036fe
ffb5b030
801036fe
00000001
00000000
00000000
00000000
00000000
fe4cca78
00000000
fe68f57a
00000000
00000000
ffae9d98
fe4cc9cc
fe4cc9dc
fe4cc9ec
kd> dd
fe4cc9fc
fe4cca0c
fe4cca1c
fe4cca2c
fe4cca3c
fe4cca4c
fe4cca5c
00000270
ffa449a8
ffa449a8
fe685968
ffb0ad48
00000000
c00000d6
fe4cca6c
fe6a10ae
ff680e08
e12820c8
ff680e08
ffb0ad38
ffa44a84
00000000
00000270
fe6b2c04
e1235308
e1235308
00100000
e1235308
004ccb28
ffa44abc
ff680e08
ffa449a8
ffa449a8
ffb0ad38
0000000a
fe4ccbc4
To determine which values are likely function addresses and which are parameters or saved registers, the first thing to consider is what the different types of information look
like on the stack. Most integers are going to be smaller value, which means they will be mostly zeros when displayed as DWORDs (like 0x00000270). Most pointers to local
addresses will be near the stack pointer (like fe4cca78). Status codes usually begin with a c (c00000d6). Unicode and ASCII strings can be identified by the fact that each
character will be in the range of 20-7f. (In KD, the dc (Display Memory) command will show the characters on the right.) Most importantly, the function addresses will be in
the range listed by x *!.
Notice that all modules listed are in the ranges of 77f70000 to 8040c000 and fe4c0000 to fe6f0920. Based on these ranges, the possible function addresses in the preceding list
are: 80136039, 801036fe (listed twice, so more likely a parameter), fe682ae4, fe68f57a, fe682a78, fe6a1198, 8011c901, 80127797, 80110008, fe6a1430, fe6a10ae, fe6b2c04,
fe685968, fe680ba4, and fe682050. Investigate these locations by using an ln (List Nearest Symbols) command for each address:
kd> ln 80136039
(80136039)
NT!_KiServiceExit+0x1e | (80136039)
NT!_KiServiceExit2-0x177
kd> ln fe682ae4
(fe682ae4)
rdr!_RdrSectionInfo+0x2c | (fe682ae4)
rdr!_RdrFcbReferenceLock-0xb4
kd> ln 801036fe
(801036fe)
NT!_KeWaitForSingleObject | (801036fe)
NT!_MmProbeAndLockPages-0x2f8
kd> ln fe68f57a
(fe68f57a)
rdr!_RdrDereferenceDiscardableCode+0xb4
(fe68f57a)
rdr!_RdrUninitializeDiscardableCode-0xa
kd> ln fe682a78
(fe682a78)
rdr!_RdrDiscardableCodeLock | (fe682a78) rdr!_RdrDiscardableCodeTimeout-0x38
kd> ln fe6a1198
(fe6a1198)
rdr!_SubmitTdiRequest+0xae | (fe6a1198)
rdr!_RdrTdiAssociateAddress-0xc
kd> ln 8011c901
(8011c901)
NT!_KeSuspendThread+0x13 | (8011c901)
NT!_FsRtlCheckLockForReadAccess-0x55
kd> ln 80127797
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
(80127797)
NT!_ZwCloseObjectAuditAlarm+0x7 | (80127797)
NT!_ZwCompleteConnectPort-0x9
kd> ln 80110008
(80110008)
NT!_KeWaitForMultipleObjects+0x27c | (80110008) NT!_FsRtlLookupMcbEntry-0x164
kd> ln fe6a1430
(fe6a1430)
rdr!_RdrTdiCloseConnection+0xa | (fe6a1430)
rdr!_RdrDoTdiConnect-0x4
kd> ln fe6a10ae
(fe6a10ae)
rdr!_RdrTdiDisconnect+0x56 | (fe6a10ae)
rdr!_SubmitTdiRequest-0x3c
kd> ln fe6b2c04
(fe6b2c04)
rdr!_CleanupTransportConnection+0x64 | (fe6b2c04)rdr!_RdrReferenceServer-0x20
kd> ln fe685968
(fe685968)
rdr!_RdrReconnectConnection+0x1b6
(fe685968)
rdr!_RdrInvalidateServerConnections-0x32
kd> ln fe682050
(fe682050)
rdr!__strnicmp+0xaa | (fe682050)
rdr!_BackPackSpinLock-0xa10
As noted before, 801036fe is not likely to be part of the stack trace as it is listed twice. If the return addresses have an offset of zero, they can be ignored (you cannot return to
the beginning of a function). Based on this information, the stack trace is revealed to be:
NT!_KiServiceExit+0x1e
rdr!_RdrSectionInfo+0x2c
rdr!_RdrDereferenceDiscardableCode+0xb4
rdr!_SubmitTdiRequest+0xae
NT!_KeSuspendThread+0x13
NT!_ZwCloseObjectAuditAlarm+0x7
NT!_KeWaitForMultipleObjects+0x27c
rdr!_RdrTdiCloseConnection+0xa
rdr!_RdrTdiDisconnect+0x56
rdr!_CleanupTransportConnection+0x64
rdr!_RdrReconnectConnection+0x1b6
rdr!__strnicmp+0xaa
To verify each symbol, unassemble immediately before the return address specified to see if it does a call to the function above it. To reduce length, the following is edited
(the offsets used were found by trial and error):
kd> u 80136039-2 l1
// looks ok, its a call
NT!_KiServiceExit+0x1c:
80136037 ffd3
call
ebx
kd> u fe682ae4-2 l1
// paged out (all zeroes) unknown
rdr!_RdrSectionInfo+0x2a:
fe682ae2 0000
add
[eax],al
kd> u fe68f57a-6 l1
// looks ok, its a call, but not anything above
rdr!_RdrDereferenceDiscardableCode+0xae:
fe68f574 ff15203568fe
call dword ptr [rdr!__imp__ExReleaseResourceForThreadLite]
kd> u fe682a78-6 l1
// paged out (all zeroes) unknown
rdr!_DiscCodeInitialized+0x2:
fe682a72 0000
add
[eax],al
kd> u fe6a1198-5 l1
// looks good, call to something above
rdr!_SubmitTdiRequest+0xa9:
fe6a1193 e82ee3feff
call rdr!_RdrDereferenceDiscardableCode (fe68f4c6)
kd> u 8011c901-2 l1
// not good, its a jump in the function
NT!_KeSuspendThread+0x11:
8011c8ff 7424
jz
NT!_KeSuspendThread+0x37 (8011c925)
kd> u 80127797-2 l1
// looks good, an int 2e -> KiServiceExit
NT!_ZwCloseObjectAuditAlarm+0x5:
80127795 cd2e
int
2e
kd> u 80110008-2 l1
// not good, its a test instruction not a call
NT!_KeWaitForMultipleObjects+0x27a:
80110006 85c9
test
ecx,ecx
kd> u 80110008-5 l1
// paged out (all zeroes) unknown
NT!_KeWaitForMultipleObjects+0x277:
80110003 0000
add
[eax],al
kd> u fe6a1430-6 l1
// looks good its a call to ZwClose...
rdr!_RdrTdiCloseConnection+0x4:
fe6a142a ff15f83468fe
call
dword ptr [rdr!__imp__ZwClose (fe6834f8)]
kd> u fe6a10ae-2 l1
// paged out (all zeroes) unknown
rdr!_RdrTdiDisconnect+0x54:
fe6a10ac 0000
add
[eax],al
kd> u fe6b2c04-5 l1
// looks good, call to something above
rdr!_CleanupTransportConnection+0x5f:
fe6b2bff e854e4feff
call
rdr!_RdrTdiDisconnect (fe6a1058)
kd> u fe685968-5 l1
// looks good, call to immediately above
rdr!_RdrReconnectConnection+0x1b1:
fe685963 e838d20200
call
rdr!_CleanupTransportConnection (fe6b2ba0)
kd> u fe682050-2 l1
rdr!__strnicmp+0xa8:
fe68204e 0000
//
add
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
KiSystemServiceExit. The other functions on the stack are probably leftover portions of previously active stacks.
In this case, the stack trace worked properly. Following is the actual stack trace to check the answer:
kd> k
ChildEBP RetAddr
fe4cc978 80136039 NT!_NtClose+0xd
fe4cc978 80127797 NT!_KiServiceExit+0x1e
fe4cc9f4
fe4cca10
fe4cca28
fe4cca78
fe4ccbd4
fe4ccbe8
fe4ccc98
fe4ccd08
fe4ccde4
fe4cce90
fe4cced0
fe6a1430
fe6b2c04
fe685968
fe688157
80106b1e
8014b289
8014decd
8014d6d2
8014d3ad
8016660d
80136039
NT!_ZwCloseObjectAuditAlarm+0x7
rdr!_RdrTdiCloseConnection+0xa
rdr!_CleanupTransportConnection+0x64
rdr!_RdrReconnectConnection+0x1b6
rdr!_RdrFsdCreate+0x45b
NT!IofCallDriver+0x38
NT!_IopParseDevice+0x693
NT!_ObpLookupObjectName+0x487
NT!_ObOpenObjectByName+0xa2
NT!_IoCreateFile+0x433
NT!_NtCreateFile+0x2d
The first entry was the current location based on the stack trace, but otherwise, the stack was correct up to the point where RdrReconnectConnection was called. The same
process could have been used to trace the entire stack. For a more exact method of manual stack walking, you would need to unassemble each potential function and follow
each push and pop to identify each DWORD on the stack.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
A thread uses the entire stack reserved for it. This is often caused by infinite recursion.
A thread cannot extend the stack because the page file is maxed out, and therefore no additional pages can be committed to extend the stack.
A thread cannot extend the stack because the system is within the brief period used to extend the page file.
Here is an example of how to debug this error. In this example, NTSD is running on the same computer as the target application and is redirecting its output to KD on the host
computer. See Controlling the User-Mode Debugger from the Kernel Debugger for details.
The first step is see what event caused the debugger to break in:
0:002> .lastevent
Last event: Exception C00000FD, second chance
You can look up exception code 0xC00000FD in ntstatus.h, which can be found in the Microsoft Windows SDK and the Windows Driver Kit (WDK). This exception code is
STATUS_STACK_OVERFLOW.
To double-check that the stack overflowed, you can use the k (Display Stack Backtrace) command:
0:002> k
ChildEBP
009fdd0c
009fde78
009fde98
009fdf00
009fdf3c
009fdf5c
009fdfec
009fdffc
009fe074
009fe0d0
009fe128
009fe148
009fe1b0
009fe1d8
009fe200
009fe220
009fe27c
009fe2e4
00000000
RetAddr
71a32520
77cf8290
77cfd634
77cd55e9
77cd63b2
71a45b30
71a45bb0
71a1d688
71a1db30
71a1f196
77cf8290
77cfd634
77cd4490
77cd46c8
77f7bb3f
77cd445e
77cfd634
009fe4a8
00000000
COMCTL32!_chkstk+0x25
COMCTL32!ListView_WndProc+0x4c4
USER32!_InternalCallWinProc+0x18
USER32!UserCallWinProcCheckWow+0x17f
USER32!SendMessageWorker+0x4a3
USER32!SendMessageW+0x44
COMCTL32!CCSendNotify+0xc0e
COMCTL32!CICustomDrawNotify+0x2a
COMCTL32!Header_Draw+0x63
COMCTL32!Header_OnPaint+0x3f
COMCTL32!Header_WndProc+0x4e2
USER32!_InternalCallWinProc+0x18
USER32!UserCallWinProcCheckWow+0x17f
USER32!DispatchClientMessage+0x31
USER32!__fnDWORD+0x22
ntdll!_KiUserCallbackDispatcher+0x13
USER32!DispatchMessageWorker+0x3bc
USER32!UserCallWinProcCheckWow+0x17f
0x9fe4a8
The target thread has broken into COMCTL32!_chkstk, which indicates a stack problem.
Now you should investigate the stack usage of the target process. The process has multiple threads, but the important one is the one that caused the overflow, so identify this
thread first:
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
0:002> ~*k
0 id: 570.574
.....
1 id: 570.590
.....
. 2 id: 570.598
Suspend: 1 Teb 7ffdc000 Unfrozen
ChildEBP RetAddr
009fdd0c 71a32520 COMCTL32!_chkstk+0x25
.....
3
id: 570.760
Now you need to investigate thread 2. The period at the left of this line indicates that this is the current thread.
The stack information is contained in the TEB (Thread Environment Block) at 0x7FFDC000. The easiest way to list it is using !teb. However, this requires you to have the
proper symbols. For maximum versatility, assume you have no symbols:
0:002> dd 7ffdc000 L4
7ffdc000
009fdef0 00a00000 009fc000 00000000
To interpret this, you need to look up the definition of the TEB data structure. If you had complete symbols, you could use dt TEB to do this. But in this case, you will need to
look at the ntpsapi.h file in the Microsoft Windows SDK. For Windows XP and later versions of Windows, this file contains the following information:
typedef struct _TEB {
NT_TIB NtTib;
PVOID EnvironmentPointer;
CLIENT_ID ClientId;
PVOID ActiveRpcHandle;
PVOID ThreadLocalStoragePointer;
PPEB ProcessEnvironmentBlock;
ULONG LastErrorValue;
.....
PVOID DeallocationStack;
.....
} TEB;
typedef struct _NT_TIB {
struct _EXCEPTION_REGISTRATION_RECORD *ExceptionList;
PVOID StackBase;
PVOID StackLimit;
.....
} NT_TIB;
This indicates that the second and third DWORDs in the TEB structure point to the bottom and top of the stack, respectively. In this case, these addresses are 0x00A00000
and 0x009FC000. (The stack grows downward in memory.) You can calculate the stack size using the ? (Evaluate Expression) command:
0:002> ? a00000-9fc000
Evaluate expression: 16384 = 00004000
This shows that the stack size is 16 K. The maximum stack size is stored in the field DeallocationStack. After some calculation, you can determine that this field's offset is
0xE0C.
0:002> dd 7ffdc000+e0c L1
7ffdce0c
009c0000
0:002> ? a00000-9c0000
Evaluate expression: 262144 = 00040000
This shows that the maximum stack size is 256 K, which means more than adequate stack space is left.
Furthermore, this process looks clean it is not in an infinite recursion or exceeding its stack space by using excessively large stack-based data structures.
Now break into KD and look at the overall system memory usage with the !vm extension command:
0:002> .breakin
Break instruction exception - code 80000003 (first chance)
ntoskrnl!_DbgBreakPointWithStatus+4:
80148f9c cc
int
3
kd> !vm
*** Virtual Memory Usage ***
Physical Memory:
16268
(
65072
Page File: \??\C:\pagefile.sys
Current:
147456Kb Free Space:
Minimum:
98304Kb Maximum:
Available Pages:
2299
(
9196
ResAvail Pages:
4579
(
18316
Locked IO Pages:
93
(
372
Kb)
65988Kb
196608Kb
Kb)
Kb)
Kb)
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
42754
5402
348
757
811
6252
1337
893
362
2592
13312
3928
1040
3641
2592
887
45882
50570
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
171016
21608
1392
3028
3244
25008
5348
3572
1448
10368
53248
15712
4160
14564
10368
3548
183528
202280
Kb)
Kb)
Kb)
Kb)
Kb)
Kb)
Kb)
Kb)
Kb)
Kb)
Kb)
Kb)
Kb)
Kb)
Kb)
Kb)
Kb)
Kb)
Total Private:
.....
33309
133236 Kb)
First, look at nonpaged and paged pool usage. Both are well within limits, so these are not the cause of the problem.
Next, look at the number of committed pages: 183528 out of 202280. This is very close to the limit. Although this display does not show this number to be at the limit, you
should keep in mind that while you are performing user-mode debugging, other processes are running on the system. Each time an NTSD command is executed, these other
processes are also allocating and freeing memory. That means you do not know exactly what the memory state was like at the time the stack overflow occurred. Given how
close the committed page number is to the limit, it is reasonable to conclude that the page file was used up at some point and this caused the stack overflow.
This is not an uncommon occurrence, and the target application cannot really be faulted for this. If it happens frequently, you may want to consider raising the initial stack
commitment for the failing application.
Analyzing a Single Function Call
It can also be useful to find out exactly how much stack space a certain function call is allocating.
To do this, disassemble the first few instructions and look for the instruction sub esp,number. This moves the stack pointer, effectively reserving number bytes for local data.
Here is an example:
0:002> k
ChildEBP
009fdd0c
009fde78
009fde98
009fdf00
009fdf3c
009fdf5c
009fdfec
009fdffc
009fe074
009fe0d0
009fe128
009fe148
RetAddr
71a32520
77cf8290
77cfd634
77cd55e9
77cd63b2
71a45b30
71a45bb0
71a1d688
71a1db30
71a1f196
77cf8290
77cfd634
COMCTL32!_chkstk+0x25
COMCTL32!ListView_WndProc+0x4c4
USER32!_InternalCallWinProc+0x18
USER32!UserCallWinProcCheckWow+0x17f
USER32!SendMessageWorker+0x4a3
USER32!SendMessageW+0x44
COMCTL32!CCSendNotify+0xc0e
COMCTL32!CICustomDrawNotify+0x2a
COMCTL32!Header_Draw+0x63
COMCTL32!Header_OnPaint+0x3f
COMCTL32!Header_WndProc+0x4e2
USER32!_InternalCallWinProc+0x18
0:002> u COMCTL32!Header_Draw
COMCTL32!Header_Draw :
71a1d625 55
push
71a1d626 8bec
mov
71a1d628 83ec58
sub
71a1d62b 53
push
71a1d62c 8b5d08
mov
71a1d62f 56
push
71a1d630 57
push
71a1d631 33f6
xor
ebp
ebp,esp
esp,0x58
ebx
ebx,[ebp+0x8]
esi
edi
esi,esi
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Here is an example of how to debug this problem. Although DeviceObject is used in this example, this technique works for all objects.
Fixing a driver that fails to unload
1. Put a breakpoint right after the driver calls IoCreateDevice. Get the DeviceObject address.
2. Find the object header by using the !object extension on this object address:
kd> !object 81a578c0
Object: 81a578c0 Type: (81bd0e70) Device
ObjectHeader: 81a578a8
HandleCount: 0 PointerCount: 3
Directory Object: e1001208 Name: Serial0
The first variable in the ObjectHeader is the pointer count or reference count.
3. Put a write breakpoint on the pointer count, using the ObjectHeader's address:
kd> ba w4 81a578a8 "k;g"
4. Use g (Go). The debugger will produce a log.
5. Look for the mismatched reference/dereference pair specifically, a missing dereference. (Note that ObReferenceObject is implemented as a macro inside the
kernel.)
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Debugging a Deadlock
When a thread needs exclusive access to code or some other resource, it requests a lock. If it can, Windows responds by giving this lock to the thread. At this point, nothing
else in the system can access the locked code. This happens all the time and is a normal part of any well-written multithreaded application. Although a particular code segment
can only have one lock on it at a time, multiple code segments can each have their own lock.
A deadlock arises when two or more threads have requested locks on two or more resources, in an incompatible sequence. For instance, suppose that Thread One has acquired
a lock on Resource A and then requests access to Resource B. Meanwhile, Thread Two has acquired a lock on Resource B and then requests access to Resource A. Neither
thread can proceed until the other thread's lock is relinquished, and, therefore, neither thread can proceed.
User-mode deadlocks arise when multiple threads of one application have blocked each others' access to the same resources. Kernel-mode deadlocks arise when multiple
threads (from the same process or from distinct processes) have blocked each others' access to the same kernel resource. The procedure used to debug a deadlock depends on
whether the deadlock occurs in user mode or in kernel mode.
Debugging a User-Mode Deadlock
When a deadlock occurs in user mode, use the following procedure to debug it:
1. Issue the !ntsdexts.locks extension. In user mode, you can just type !locks at the debugger prompt; the ntsdexts prefix is assumed.
2. This extension displays all the critical sections associated with the current process, along with the ID for the owning thread and the lock count for each critical section.
If a critical section has a lock count of zero, it is not locked. Use the ~ (Thread Status) command to see information about the threads that own the other critical
sections.
3. Use the kb (Display Stack Backtrace) command for each of these threads to determine whether they are waiting on other critical sections.
4. Using the output of these kb commands, you can find the deadlock: two threads that are each waiting on a lock held by the other thread. In rare cases, a deadlock could
be caused by more than two threads holding locks in a circular pattern, but most deadlocks involve only two threads.
Here is an illustration of this procedure. You begin with the !ntdexts.locks extension:
0:006> !locks
CritSec ftpsvc2!g_csServiceEntryLock+0 at 6833dd68
LockCount
0
RecursionCount
1
OwningThread
a7
EntryCount
0
ContentionCount
0
*** Locked
CritSec isatq!AtqActiveContextList+a8 at 68629100
LockCount
2
RecursionCount
1
OwningThread
a3
EntryCount
2
ContentionCount
2
*** Locked
CritSec +24e750 at 24e750
LockCount
6
RecursionCount
1
OwningThread
a9
EntryCount
6
ContentionCount
6
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
*** Locked
The first critical section displayed has no locks and, therefore, can be ignored.
The second critical section displayed has a lock count of 2 and is, therefore, a possible cause of a deadlock. The owning thread has a thread ID of 0xA3.
You can find this thread by listing all threads with the ~ (Thread Status) command, and looking for the thread with this ID:
0:006> ~
0 Id:
1 Id:
2 Id:
3 Id:
4 Id:
5 Id:
. 6 Id:
7 Id:
8 Id:
1364.1330 Suspend:
1364.17e0 Suspend:
1364.135c Suspend:
1364.1790 Suspend:
1364.a3 Suspend: 1
1364.1278 Suspend:
1364.a9 Suspend: 1
1364.111c Suspend:
1364.1588 Suspend:
In this display, the first item is the debugger's internal thread number. The second item (the Id field) contains two hexadecimal numbers separated by a decimal point. The
number before the decimal point is the process ID; the number after the decimal point is the thread ID. In this example, you see that thread ID 0xA3 corresponds to thread
number 4.
You then use the kb (Display Stack Backtrace) command to display the stack that corresponds to thread number 4:
0:006> ~4 kb
4 id: 97.a3
Suspend: 0 Teb 7ffd9000 Unfrozen
ChildEBP RetAddr Args to Child
014cfe64 77f6cc7b 00000460 00000000 00000000 ntdll!NtWaitForSingleObject+0xb
014cfed8 77f67456 0024e750 6833adb8 0024e750 ntdll!RtlpWaitForCriticalSection+0xaa
014cfee0 6833adb8 0024e750 80000000 01f21cb8 ntdll!RtlEnterCriticalSection+0x46
014cfef4 6833ad8f 01f21cb8 000a41f0 014cff20 ftpsvc2!DereferenceUserDataAndKill+0x24
014cff04 6833324a 01f21cb8 00000000 00000079 ftpsvc2!ProcessUserAsyncIoCompletion+0x2a
014cff20 68627260 01f21e0c 00000000 00000079 ftpsvc2!ProcessAtqCompletion+0x32
014cff40 686249a5 000a41f0 00000001 686290e8 isatq!I_TimeOutContext+0x87
014cff5c 68621ea7 00000000 00000001 0000001e isatq!AtqProcessTimeoutOfRequests_33+0x4f
014cff70 68621e66 68629148 000ad1b8 686230c0 isatq!I_AtqTimeOutWorker+0x30
014cff7c 686230c0 00000000 00000001 000c000a isatq!I_AtqTimeoutCompletion+0x38
014cffb8 77f04f2c 00000000 00000001 000c000a isatq!SchedulerThread_297+0x2f
00000001 000003e6 00000000 00000001 000c000a kernel32!BaseThreadStart+0x51
Notice that this thread has a call to the WaitForCriticalSection function, which means that not only does it have a lock, it is waiting for code that is locked by something
else. We can find out which critical section we are waiting on by looking at the first parameter of the call to WaitForCriticalSection. This is the first address under Args to
Child: "24e750". So this thread is waiting on the critical section at address 0x24E750. This was the third critical section listed by the !locks extension that you used earlier.
In other words, thread 4, which owns the second critical section, is waiting on the third critical section. Now turn your attention to the third critical section, which is also
locked. The owning thread has thread ID 0xA9. Returning to the output of the ~ command that you saw previously, note that the thread with this ID is thread number 6.
Display the stack backtrace for this thread:
0:006> ~6 kb
ChildEBP RetAddr
0155fe38 77f6cc7b
0155feac 77f67456
0155feb4 6862142e
0155fec0 686222e1
0155fed0 68621412
0155fed8 686213d1
0155fee8 683331f7
0155fefc 6833984b
0155ff18 6833adcd
0155ff28 6833ad8f
0155ff38 6833324a
0155ff54 686211eb
0155ff88 68622676
0155ffb8 77f04f2c
0155ffec 00000000
Args to Child
00000414 00000000
68629100 6862142e
68629100 0009f238
0009f25c 00000001
0009f238 686213d1
0009f238 00000001
0009f238 00000001
ffffffff 00000000
77f05154 01f26a58
01f26a58 000a3410
01f26a58 00000000
01f26bac 00000000
000a3464 00000000
abcdef01 ffffffff
68622644 abcdef01
00000000
68629100
686222e1
0009f238
0009f238
01f26bcc
01f26bf0
00000000
00000000
0155ff54
00000040
00000040
000a3414
000ad1b0
00000000
ntdll!NtWaitForSingleObject+0xb
ntdll!RtlpWaitForCriticalSection+0xaa
ntdll!RtlEnterCriticalSection+0x46
isatq!ATQ_CONTEXT_LISTHEAD__RemoveFromList
isatq!ATQ_CONTEXT__CleanupAndRelease+0x30
isatq!AtqpReuseOrFreeContext+0x3f
isatq!AtqFreeContext+0x36
ftpsvc2!ASYNC_IO_CONNECTION__SetNewSocket
ftpsvc2!USER_DATA__Cleanup+0x47
ftpsvc2!DereferenceUserDataAndKill+0x39
ftpsvc2!ProcessUserAsyncIoCompletion+0x2a
ftpsvc2!ProcessAtqCompletion+0x32
isatq!AtqpProcessContext+0xa7
isatq!AtqPoolThread+0x32
kernel32!BaseThreadStart+0x51
This thread, too, is waiting for a critical section to be freed. In this case, it is waiting on the critical section at 0x68629100. This was the second critical section in the list
generated earlier by the !locks extension.
This is the deadlock. Thread 4, which owns the second critical section, is waiting on the third critical section. Thread 6, which owns the third critical section, is waiting on the
second critical section.
Having confirmed the nature of this deadlock, you can use the usual debugging techniques to analyze threads 4 and 6.
Debugging a Kernel-Mode Deadlock
There are several debugger extensions that are useful for debugging deadocks in kernel mode:
The !kdexts.locks extension displays information about all locks held on kernel resources and the threads holding these locks. (In kernel mode, you can just type !locks
at the debugger prompt; the kdexts prefix is assumed.)
The !qlocks extension displays the state of all queued spin locks.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The !wdfkd.wdfspinlock extension displays information about a Kernel-Mode Driver Framework (KMDF) spin-lock object.
The !deadlock extension is used in conjunction with Driver Verifier to detect inconsistent use of locks in your code that have the potential to cause deadlocks.
When a deadlock occurs in kernel mode, use the !kdexts.locks extension to list all the locks currently acquired by threads.
You can usually pinpoint the deadlock by finding one non-executing thread that holds an exclusive lock on a resource that is required by an executing thread. Most of the
locks are shared.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
3. In the Start directory text box, enter the path to your device installation package.
4. Click Open.
6. The debugging process will begin, and WinDbg will break into the DevCon process before DevCon installs your driver.
7. Configure the debugger to break into the co-installer process when it is loaded. You can do this by either of the following methods:
In the Debugger Command window, use the sxe (Set Exceptions) command followed by ld: and then the filename of the co-installer, excluding the file
extension. There should be no space after the colon For example, if the name of the co-installer is mycoinst.dll, you would use the following command:
sxe ld:mycoinst
Select Event Filters from WinDbg's Debug menu. In the Event Filters dialog box, select Load module. Under Execution, select Enabled. Under Continue,
select Not Handled. Click the Argument button, and then in the text box enter the filename of the co-installer, excluding the file extension (for example, enter
"mycoinst" for mycoinst.dll). Click OK and then click Close.
8. Resume execution by pressing F5 or entering the g (Go) command in the Debugger Command window.
9. When the co-installer is loaded, execution will break back into the debugger. At this point, you can set any additional breakpoints that you need.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
If you are performing live debugging of a crashed system, callback data will be available if it has already been written by BugCheckCallback. Secondary callback data
will not be available, because it is not stored in any fixed memory location.
If you are debugging a Complete Memory Dump or Kernel Memory Dump in Windows 2000, or Windows XP prior to SP1, all callback data will be available.
If you are debugging a Complete Memory Dump or Kernel Memory Dump in Windows XP SP1, Windows Server 2003, or a later version of Windows, callback data
will not be available. The dump file will contain an image of the buffer that holds this data, but this image will have been made before the BugCheckCallback routine
wrote the callback data to the buffer. On the other hand, secondary callback data will be present.
If you are debugging a Small Memory Dump, callback data will not be available. Secondary callback data will be available in Windows XP SP1, Windows Server 2003,
or a later version of Windows.
See Varieties of Kernel-Mode Dump Files for more details on these different dump file sizes.
Displaying Callback Data
To display bug check callback data, you can use the !bugdump extension.
Without any parameters, !bugdump will display data for all callbacks.
To view data for one specific callback routine, use !bugdump Component, where Component is the same parameter that was passed to KeRegisterBugCheckCallback when
that routine was registered.
Displaying Secondary Callback Data
There are two methods for displaying secondary callback data in Windows XP SP1, Windows Server 2003, and later versions of Windows. You can use the .enumtag
command or you can write your own debugger extension.
Each block of secondary callback data is identified by a GUID tag. This tag is specified by the Guid field of the (KBUGCHECK_SECONDARY_DUMP_DATA)
ReasonSpecificData parameter passed to BugCheckSecondaryDumpDataCallback.
The .enumtag (Enumerate Secondary Callback Data) command is not a very precise instrument. It displays every secondary data block, showing the tag and then showing
the data in hexadecimal and ASCII format. It is generally useful only to determine what tags are actually being used for secondary data blocks.
To use this data in a more practical way, it is recommended that you write your own debugger extension. This extension must call methods in the dbgeng.h header file. For
details, see Writing New Debugger Extensions.
If you know the GUID tag of the secondary data block, your extension should use the method IDebugDataSpaces3::ReadTagged to access the data. Its prototype is as
follows:
STDMETHOD(ReadTagged)(
THIS_
IN LPGUID Tag,
IN ULONG Offset,
OUT OPTIONAL PVOID Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG TotalSize
) PURE;
Here is an example of how to use this method:
UCHAR RawData[MY_DATA_SIZE];
GUID MyGuid = .... ;
Success = DataSpaces->ReadTagged(
&MyGuid, 0, RawData,
sizeof(RawData), NULL);
If you supply a BufferSize that is too small, ReadTagged will succeed but will write only the requested number of bytes to Buffer. If you specify a BufferSize that is too large,
ReadTagged will succeed but will write only the actual block size to Buffer. If you supply a pointer for TotalSize, ReadTagged will use it to return the size of the actual
block. If the block cannot be accessed, ReadTagged will return a failure status code.
If two blocks have identical GUID tags, the first matching block will be returned, and the second block will be inaccessible.
If you are not sure of the GUID tag of your block, you can use the IDebugDataSpaces3::StartEnumTagged, IDebugDataSpaces3::GetNextTagged, and
IDebugDataSpaces3::EndEnumTagged methods to enumerate the tagged blocks. Their prototypes are as follows:
STDMETHOD(StartEnumTagged)(
THIS_
OUT PULONG64 Handle
) PURE;
STDMETHOD(GetNextTagged)(
THIS_
IN ULONG64 Handle,
OUT LPGUID Tag,
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
e0000165`993b4840
e0000165`993b4840
e0000165`993b4718
e0000165`993b46e0
e0000165`993b4680
e0000165`993b4678
e0000165`993b4648
e0000165`993b4648
e0000000`8306e8c0
e0000000`8306ffe0
e0000000`83070640
e0000000`83090310
e0000000`83087d40
e0000165`985b63a4
e0000165`985b6360
e0000165`985b6360
ntkrnlmp!DbgBreakPointWithStatus+0x8
ntkrnlmp!KiBugCheckDebugBreak+0x40
ntkrnlmp!KeBugCheck2+0x980
ntkrnlmp!KeBugCheckEx+0x20
ntkrnlmp!KiMemoryFault+0x3f0
ntkrnlmp!KiGenericExceptionHandler+0x290
0xe0000165`985b63a4
0xe0000165`985b6360
DBGHELP: Can't find runtime function entry info for e0000165`985b6360, results might be unreliable!
In this example, the stack trace failed in the middle of a C++ runtime function.
2. Take a look at the bug check information:
kd> .bugcheck
Bugcheck code 000000D1
Arguments 60000165`97ec42d5 00000000`0000000f 00000000`00000001 e0000165`985b63a0
3. Look up the bug check code parameters in the Bug Check Code Reference section. Pay particular attention to any parameters that specify the address of the fault. In this
case, you have bug check code 0xD1 (DRIVER_IRQL_NOT_LESS_OR_EQUAL), whose fourth parameter indicates the address that caused the failure.
Notice that this address, 0xE0000165`985B63A0, is within a few bytes of the address at which the stack trace failed.
Also notice that the DbgHelp error message indicates that symbol information is unavailable at this same address.
4. To further investigate this address, use the ln (List Nearest Symbols) command:
kd> ln e0000165`985b63a0
In this example, the ln command has returned no nearby symbols.
5. Use the !lmi extension to investigate the module containing this address:
kd> !lmi e0000165`985b63a0
Loaded Module Info: [e0000165`985b63a0]
e0000165985b63a0 is not a valid address.
This address does not appear to be contained in a loaded module.
6. Use the lm (List Loaded Modules) command to list all of the loaded modules, sorted by address. From the resulting display (not shown here), you see that this address
is not present in a loaded module but falls between the following two modules:
e0000165`9793c000 e0000165`979b2fe0
e0000165`98644000 e0000165`98693e60
ks
mup
(deferred)
(deferred)
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
By subtracting the end address of the ks module from the starting address of the mup module, you see that the size of the gap between these two modules is over 1 MB,
which is large.
7. Determine if the memory contains valid instructions by unassembling the code with the u (Unassemble) command:
kd> u e0000165`985b63a0 L3
e0000165`985b63a0
mov.m ar.ccv=r0 ;;
e0000165`985b63a4
cmpxchg1.acq ret1=[r36], ret0, ar.ccv
e0000165`985b63a8
nop.i 0 ;;
The address does contain valid instructions. In particular, it contains a memory dereference. Unassemble the commands prior to this address:
kd> ub e0000165`985b63a0
...
e0000165`985b6340
e0000165`985b6344
e0000165`985b6348
...
L30
alloc
nop.f
mov
r34=ar.pfs, 5, 0, 1, 0
0
r33=rp ;;
Memory was allocated, raw code was written to that memory, the memory was marked executable, and then the memory was referenced.
A firmware failure has occurred.
Because the first option is extremely improbable, the cause must be an Itanium-based-firmware failure.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Install the checked version of $LDR$ on the target computer. If you install the full checked build of Windows, this file will be included. If you want to install only this
file, you need to look for it under the name setupldr.bin. Copy this file to the root of the first bootable partition on the target computer and rename it $LDR$ (with no
file name extension). For instructions on how to install a full checked build or individual checked files, see the Windows Driver Kit.
Make sure the symbols for the checked version of $LDR$ are included in the debugger's symbol path.
Set the debugger baud rate to 19200.
Modify the file txtsetup.sif on the target computer by adding the /debugstop, /debugport, and /baudrate switches to the OsLoadOptions line. Here is an example of a
modified txtsetup.sif file:
OsLoadOptions = "/fastdetect /noguiboot /debugstop /debugport=com2 /baudrate=19200"
; OsLoadOptionsVar = "/fastdetect"
; SetupCmdLinePrepend = "CDB"
The exact contents of your file may differ from this. The baud rate should match that used by the debugger (19200 is recommended). The COM port should be the port
on the target computer to which the debugging cable is attached.
After these steps have been completed, use the following procedure to connect the debugger:
Debugging Windows Setup and the OS Loader
1. Start up the debugger with the -d command-line option, or use CTRL+K to cause the debugger to break in when the first kernel module is loaded.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
2. When the debugger breaks in, you will see a message that the symbol checksum cannot be verified. Ignore this message! If you want to verify that your symbols are
correct, do a stack trace and make sure the first line of the stack trace says osloader!DbgBreakPoint.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Debugging CSRSS
The Client Server Run-Time Subsystem (CSRSS) is the user-mode process that controls the underlying layer for the Windows environment. There are a number of problems
that make it necessary to debug CSRSS itself.
Debugging CSRSS is also useful when the Windows subsystem terminates unexpectedly with a Bug Check 0xC000021A (STATUS_SYSTEM_PROCESS_TERMINATED).
In this case, debugging CSRSS will catch the failure before it gets to an "unexpected" point.
Controlling NTSD from the Kernel Debugger
The easiest way to debug CSRSS is to use NTSD and control it from the kernel debugger.
Enabling CSRSS Debugging
CSRSS debugging must be enabled before you can proceed. If the target computer is running a checked build of Windows, CSRSS debugging is always enabled. If the target
computer is running a free build of Windows, you will have to enable CSRSS debugging through the Global Flags Utility (GFlags).
To do this, start the GFlags utility, select the System Registry radio button, and select Enable debugging of Win32 subsystem.
Alternatively, you can use the following GFlags command-line:
gflags /r +20000
Or, if you prefer, you can edit the registry key manually instead of using GFlags. Open the following registry key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager
Edit the GlobalFlag value entry (of type REG_DWORD) and set the bit 0x00020000.
After using GFlags or manually editing the registry, you must reboot for the changes to take effect.
Starting NTSD
Because you will be controlling the user-mode debugger from the kernel debugger, you will need to set up a kernel debugging connection. See Kernel-Mode Setup for details.
After the registry has been properly configured, it is a simple matter of starting NTSD as follows:
ntsd -See Controlling the User-Mode Debugger from the Kernel Debugger for an explanation of how to proceed.
You will have to set your symbol path to a location on your host computer or to some other location on your network. When CSRSS is being debugged, network
authentication on the target computer will not work properly.
Note that you may see an "in page io error" message. This is another manifestation of a hardware failure.
In Windows XP and later versions of Windows, when the debugging session ends, the debugger will detach from CSRSS while the CSRSS process is still running. This
avoids termination of the CSRSS process itself.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Debugging WinLogon
WinLogon is the user-mode process that handles the task of interactive users logging on and logging off, and handles all instances of CTRL+ALT+DELETE.
Controlling NTSD from the Kernel Debugger
The easiest way to debug WinLogon is to use NTSD and control it from the kernel debugger.
Enabling WinLogon Debugging
Because you will be redirecting the user-mode debugger output to the kernel debugger, you will need to set up a kernel debugging connection. See Kernel-Mode Setup for
details.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
To attach a debugger to WinLogon, you must go through the registry so the process is debugged from the time it starts up. To set up WinLogon debugging, set
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\WinLogon.EXE\Debugger to:
ntsd -d -x -g
The -d option passes control to the kernel debugger. The -x option causes the debugger to capture access violations as second-chance exceptions. The -g option causes the
WinLogon process to run after the attachment. Do not add the -g if you want to start debugging before Winlogon.exe begins (for example, if you want to set an initial
breakpoint).
In addition, you should set the GlobalFlag value under the winlogon.exe key to REG_SZ "0x000400F0". This sets heap checking and
FLG_ENABLE_KDEBUG_SYMBOL_LOAD. However, since this second flag only affects the kernel debugger, symbols must also be copied to the target computer before
starting the debugger.
The registry change requires a reboot to take effect.
Performing the Debugging
After the next reboot, the debugger will break into WinLogon automatically.
See Controlling the User-Mode Debugger from the Kernel Debugger for an explanation of how to proceed.
You will have to set your symbol path to a location on your host computer or to some other location on your network. When WinLogon is being debugged, network
authentication on the target computer will not work properly.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Extra Tools
This section includes:
ADPlus
Application Verifier
Dr. Watson
DumpChk
GFlags
Kill Tool
Logger and LogViewer
Remote Tool
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
TList
UMDH
USBView
Tools Related to Symbol Files and Source Files
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ADPlus
ADPlus (adplus.vbs), also known as Autodump+, is a console-based Microsoft Visual Basic script. This tool automates the CDB debugger to produce memory dumps and log
files that contain debug output from one or more processes.
This section includes the following topics:
Introduction to ADPlus
Running ADPlus
Windows 2000 Server Configuration
Common ADPlus Scenarios
ADPlus Command-Line Options
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Introduction to ADPlus
This section includes the following topics:
ADPlus Overview
When ADPlus Can Be Used
ADPlus Limitations and Restrictions
ADPlus Modes of Operation
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ADPlus Overview
ADPlus automates the CDB debugger to produce memory dumps and log files that contain debug output from one or more processes.
Every time that you run ADPlus, debugging information (such as memory dumps and text files that contain debug information) is put in a new, uniquely named folder (such
as C:\Temp\Crash_Mode__Date_01-22-2001__Time_09-41-08AM) on the local file system or a remote network share. In addition, each file that ADPlus creates is also given
a unique name (such as PID-1708__Inetinfo.exe__Date_01-22-2001__Time_09-41-08AM.log) to avoid overwriting older files with newer ones.
ADPlus works with any user-mode process or service such as Internet Information Services (IIS), Microsoft Transaction Server (MTS), or Microsoft COM+ applications.
ADPlus has the following features:
ADPlus uses the latest Microsoft debuggers for speed and reliability.
ADPlus dumps memory asynchronously for multiple processes so that each process is frozen and dumped at the same time. This process provides an effective
"snapshot" of the whole application at the time ADPlus was run. It is important to capture all of the processes that make up a given application and all of the processes
that a given application uses at the same time so that you can capture the state of the application at the time that the problem occurs. This snapshot is especially
important for applications that make remote procedure calls to other processes.
ADPlus has a command-line interface. Because ADPlus does not have a graphical user interface (GUI), you can run it with the -quiet option in a remote command shell
(a Command Prompt window that is controlled through Remote.exe). The -quiet option suppresses all dialog boxes and logs all output to the event log. For more
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
information about how to run ADPlus from a remote command shell, see Running in Crash Mode Remotely.
When ADPlus monitors for crashes, it can notify you or a computer of a crash through the Microsoft Windows Messenger service. This feature is activated though the notify command-line option.
When ADPlus monitors a process in crash mode and a failure (that is, crash) occurs, ADPlus sends important information about the type of failure to the event log.
ADPlus supports XCOPY deployment. That is, if you copy the Debugging Tools for Windows installation folder to a new location, ADPlus still works correctly. In
addition, ADPlus does not require that you register any custom Component Object Model (COM) components on the system. Therefore, this tool is ideal for use on
production servers that have a locked-down software configuration. To remove ADPlus, you have to only delete the folder that it was installed or copied to.
Note The Exception Monitor tool is obsolete. ADPlus contains all of the functionality of Exception Monitor.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
If you have to troubleshoot an application or process that ends unexpectedly during startup.
You can use ADPlus only together with processes that start successfully. If you have to troubleshoot processes that end unexpectedly during startup, you should use
CDB, WinDbg, or UserDump instead.
If there is a noticeable performance effect when you use ADPlus in crash mode.
This performance effect is typically caused by dynamic-link libraries (DLLs) or applications that throw many Microsoft Visual C++ EH exceptions (which occur when
you use the C++ throw statement or when you use try/catch blocks). Applications that write lots of information to the debug output stream can also cause a decrease in
performance. Frequently, ADPlus does not affect performance noticeably when it is running in crash mode.
You must install the Microsoft Windows Script Host components before you can run ADPlus. The current version of ADPlus requires version 5.6 of the scripting host.
You can run ADPlus with earlier versions of the scripting host if you start ADPlus in a Command Prompt window by using the install directory of Debugging Tools for
Windows as the default directory. However, the -quiet switch requires version 5.5 in any event.
Windows Script Host components might already be installed if you have installed recent versions of certain Microsoft software products. If you want to install or
upgrade the Windows Script Host, visit the Windows Script section of the MSDN Web site.
The -iis option requires version 4.0 or a later version of Internet Information Services (IIS), formerly known as Internet Information Server.
If you use the -quiet option, ADPlus logs information to the event log on systems that are equipped with the Windows Script Host version 5.5 or later.
If you use the -o option, the specified path must not contain more than one nonexistent folder. For example, if you specify -o C:\Temp1\Temp2 and the C:\Temp1 and
\Temp2 folders do no exist, ADPlus displays an error message and does not create these folders. If you specify -o C:\Temp1, ADPlus creates the C:\Temp1 folder if it
does not exist and puts all output files in that folder. If you are specifying multiple subfolders and using the -o option, you should make sure that all of the subfolders
exist before you run ADPlus.
In COM+, you can configure a server package to start in the debugger in the Advanced tab in the Properties dialog box of the package. If you enable the Launch in
Debugger option, ADPlus cannot attach the CDB debugger to a process. (By default, only one debugger can be attached to a process at a time.)
When a remote procedure call (RPC) is made from a process that ADPlus is analyzing in crash mode to another process that has failed or has been shut down, the log
file that ADPlus creates for the process that is being monitored might contain one or more of the following exceptions.
Unknown exception - code 80010105 (first chance)
Unknown exception - code 800706be (first chance)
Unknown exception - code 800706ba (first chance)
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
These exceptions are expected. RPC raises these exceptions when a call is made from a process that is being monitored to a nonexistent or failed process.
This exception typically appears after IIS calls an out-of-process (high-isolation) Web site that has failed. This exception might be followed by two instances of the
following exception.
Unknown exception - code 800706ba (first chance)
You can use hang mode to troubleshoot processes that stop responding (that is, hang), 100 % CPU utilization, and other problems that do not involve a failure (that is,
crash). When you use ADPlus in hang mode, you must wait until the process stops responding before you run the script.
You can use crash mode to troubleshoot failures that typically activate a postmortem debugger or any other type of error that causes an application or service to end
unexpectedly. When you use ADPlus in crash mode, you must start ADPlus before the failure occurs. You can configure ADPlus by using the -notify option to notify
an administrator or a computer of a failure.
Hang Mode
In hang mode, ADPlus immediately produces full memory dumps for all of the processes that are specified at the command prompt after the script has finished running.
ADPlus puts each .dmp file that it creates into a folder that contains the date and time stamp from when ADPlus was run. And each file name contains the process name, the
process ID, and the date and time stamp from when ADPlus was run. While the process memory is being dumped to a file, the process is frozen, with the debugger noninvasively attached to it. After the memory dump is finished, the debugger detaches and the process resumes.
You can use ADPlus in hang mode instead of UserDump to dump the memory for one or more processes. In addition, hang mode works inside a Terminal Server session.
-MiniOnSecond Switch
When you specify the -MiniOnSecond command-line parameter for ADPlus, ADPlus produces log files from a scripted debug session and minidump files (which are
typically less than 100 KB ). This parameter is typically faster than creating full memory dumps for each process that is specified on the command line. (In earlier versions of
ADPlus, this feature was called quick mode.)
A minidump file is especially useful if you do not plan to analyze the file yourself. You can create a .zip file that contains the dump file and send it in an e-mail message to a
professional support technician. This process is easier than having to put the files on an FTP site or use some other method of transfer.
-NoDumpOnSecond Switch
When you use the -NoDumpOnSecond command-line parameter, ADPlus does not create any dump files.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Crash Mode
In crash mode, ADPlus attaches the CDB debugger to all processes that are specified at the command prompt and automatically configures the debugger to monitor for the
following kinds of exceptions:
Invalid handle
Illegal instruction
Integer divide-by-zero
Floating-point divide-by-zero
Integer overflow
Invalid lock sequence
Access violation
Stack overflow
C++ EH exception
Unknown exception
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
You can use ADPlus in crash mode instead of UserDump when you are troubleshooting these kinds of exceptions.
Because crash mode uses an "invasive" attach through the CDB debugger, you cannot use this mode in a Microsoft Windows 2000 Terminal Server session, because these
operating systems do not permit a debugger in one window station to attach to a process in a different window station. Crash mode is supported in a Terminal Server session
on Windows XP and later versions of Windows. Hang mode does work inside a Terminal Server session on any platform.
Note For a workaround in Windows 2000 Terminal Server by using remote.exe, see Running in Crash Mode Remotely. For more information about invasive and noninvasive attaching, see Starting the Debugger.
When ADPlus is running in crash mode, a debugger remains attached to each process that is specified at the command prompt for the lifetime of that process until a fatal
exception is trapped and the process fails (that is, crashes), or until a user presses CTRL+C to detach the debugger from that process. To manually detach the debugger from
the process, you must maximize the debugger window and press CTRL+C to break into the debugger. When you press CTRL+C, ADPlus traps the command, begins to list
the stacks for all threads to a log file, and then produces a minidump file of the process before it detaches from the debugger. Because crash mode performs an invasive attach,
the process is ended when the debugger is detached, and you have to restart it. If the process is a Microsoft Transaction Server (MTS) or COM+ process, the process is
restarted automatically the next time that a call is made to a component in that package.
First-Chance Exceptions
Each kind of exception (access violation, stack overflow, and so on) can be raised to a debugger as a "first chance" or "second chance" exception. First-chance exceptions are
not fatal unless they are not handled properly by an error handler. If a first-change exception is not handled properly by an error handler, they are raised again as a secondchance exception (which only a debugger can handle). If a debugger does not handle a second-chance exception, the application is shut down.
By default, when ADPlus detects a first-chance (nonfatal) exception for all kinds of exceptions (except unknown and EH exceptions), ADPlus does the following:
1. Pauses the process to log the date and time that the exception occurred in the log file for the process that is being monitored.
2. Logs the thread ID and call stack for the thread that raised the exception in the log file for the process that is being monitored.
3. Produces a uniquely-named minidump file of the process at the time that the exception occurred and then resumes the process. (This step is equivalent to .dump -u /m.)
By default, ADPlus does not produce a unique minidump file for first-chance EH and unknown exceptions because processes frequently encounter many of these exceptions.
These kinds of exceptions are typically handled by error handling code in a process or DLL. In other words, these exceptions are typically handled exceptions, and they do not
become second-chance (unhandled) exceptions, which end the process.
However, you can configure ADPlus to produce unique minidump files for first-chance EH and unknown exceptions. For more information about how to configure ADPlus,
see ADPlus Command-Line Options and ADPlus Configuration Files.
Second-Chance Exceptions
When ADPlus detects a second-chance (fatal) exception for all kinds of exceptions (including EH and unknown exceptions), ADPlus does the following:
1.
2.
3.
4.
5.
ADPlus keeps a separate log file for each process that it monitors.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Running ADPlus
This section includes the following topics:
Running ADPlus for the First Time
ADPlus Command Line
ADPlus Configuration Files
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Commands are parsed from left to right. When you specify a target, ADPlus uses all of the options that it has parsed up to that point. This parsing enables you to create a long
command that has multiple targets and specify different options for each target.
To more easily specify options, you can store options in configuration files and use the -c parameter to point to these files. For more information about the ADPlus commandline options, see ADPlus Command-Line Options.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Settings
The Settings section enables you to define the primary settings for ADPlus. Most of these settings are equivalent to command-line parameters.
You can include as many instances as you want for the ProcessID, ProcessName, Spawn. and Notify elements.
<Settings>
<AttachInterval> inseconds </AttachInterval>
<AttachRepeats> numberofrepeatedattachments </AttachRepeats>
<RunMode> runmode </RunMode>
<LastScriptCommand> LastCommand </LastScriptCommand>
<Option> IIS </Option>
<Option> Quiet </Option>
<Option> NoTlist </Option>
<Option> NoTsCheck </Option>
<Option> NoFreeSpaceChecking </Option>
<OutputDir> OutputDirectoryName </OutputDir>
<ProcessID> PID </ProcessID>
<ProcessName> ProcessName </ProcessName>
<GenerateScript> ScriptName </GenerateScript>
<Spawn> Spawn Command </Spawn>
<Sympath> Symbol Path </Sympath>
<SympathPlus> Symbol Path to add </SympathPlus>
<Notify> { ComputerName | UserName } </Notify>
<Debugger> Debugger </ Debugger >
</Settings>
The Settings section contains the following elements:
AttachInterval
Same as the IntervalInSeconds parameter of the r command-line option.
AttachRepeats
Same as the Repeats parameter of the r command-line option.
runmode
runmode can be either CRASH or HANG.
LastCommand
Can be Q, QD, G, GN or Void. The first four options are equivalent to q, qq (Quit), qd (Quit and Detach), g (Go), and gn, gN (Go with Exception Not Handled)
debugger commands.
Void indicates that no debugger command is added. In this situation, you must manually enter the last command in the debug session.
The default behavior is Q. Setting LastCommand to something other than the default is required only if you will use the CTL+C behavior (bpe exception) to induce
dumps.
IIS
Same as the -iis command-line option.
Quiet
Same as the -quiet command-line option.
NoTlist
Same as the -NoTlist command-line option.
NoTsCheck
Same as the -NoTsCheck command-line option.
NoFreeSpaceChecking
Same as the -NoFreeSpaceChecking command-line option.
OutputDirectoryName
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
PreCommands
The PreCommands section has the following format.
<PreCommands>
<Cmd> some command </Cmd>
<ShellSync> some command line </ShellSync>
<ShellAsync> some command line </ShellAsync>
</PreCommands>
With the <Cmd> tag, you can define additional debugger commands that you want to include in the final script, before the commands that are related to each exception are
defined. You can include multiple <Cmd> tags. The related text has to be a command that the CDB debugger understands. For example, you could use the following text to
load a custom extension.
<Cmd> .load SomeExtension.dll </Cmd>
With the <ShellSync> and <ShellAsync> tags, you can define an application that you want to be run before ADPlus starts to attach to the selected processes.
You can run these applications synchronously or asynchronously.
These applications are run only one time, regardless of how many processes you are attaching to.
The following example shows the ShellSync element.
<ShellSync> notepad.exe c:\myfolder\somefile.txt </ShellSync>
PostCommands
The PostCommands section has the following format.
<PostCommands>
<Cmd> some command </Cmd>
<ShellSync> some command line </ShellSync>
<ShellAsync> some command line </ShellAsync>
</PostCommands>
The meaning of the elements tags is the same as with PreCommands, except that these elements occur after the commands that SX* or BP define.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Exceptions
The Exceptions section enables you to customize the actions to be taken when a given exception breaks into the debugger. You can also define new custom exceptions to be
monitored.
<Exceptions>
<!-- options act on all currently defined exceptions -->
<Option> FullDumpOnFirstChance </Option>
<Option> MiniDumpOnSecondChance </Option>
<Option> NoDumpOnFirstChance </Option>
<Option> NoDumpOnSecondChance </Option>
<!-Defining new exceptions -->
<NewException>
<Code> ExceptionCode </Code>
<Name> ExceptionName </Name>
</NewException>
<!-Configuring already defined exceptions -->
<Config>
<Code> { ExceptionCode | AllExceptions } </Code>
<Actions1> Actions </Actions1>
<CustomActions1> CustomActions </CustomActions1>
<Actions2> Actions </Actions2>
<CustomActions2> CustomActions </CustomActions2>
<ReturnAction1> { G | GN | GH | Q | QD } </ReturnAction1>
<ReturnAction2> { G | GN | GH | Q | QD } </ReturnAction2>
</Config>
</Exceptions>
The <Option> tag enables you to set some global behavior options (FullDumpOnFirstChance, MiniDumpOnSecondChance, NoDumpOnFirstChance, and
NoDumpOnSecondChance).
The <NewException> tag enables you to define a new exception by providing an exception code and an exception name. ExceptionCode should be a hexadecimal number or
a short abbreviation that the debugger knows. ExceptionName should be short and not include spaces.
The following example shows ExceptionCode and ExceptionName.
<Code> 0x80010005 </Code>
<Name> My_Custom_Exception </Name>
The <Config> tag enables you to configure the behavior of already defined exceptions. You can configure a given exception by defining its code in the <Code> tag. If you
use the AllExceptions keyword, the behavior applies to all defined exceptions. You can also define multiple exception codes separated by semicolons.
<Config> has the following parameters:
Actions
The Action parameters that are used in the <Actions1> and <Actions2> tags define the actions to be taken on first and second chance exceptions, respectively.
The actions can be a set of predefined actions, separated by semicolons.
<Actions1>MiniDump;Stack;Log;EventLog</Actions1>
If you do not want any actions, use the Void keyword.
<Actions1>Void</Actions1>
You can use the following case-sensitive actions:
Log
Adds a log entry that is related to the exception.
EventLog
Adds an event log that is related to the exception.
MiniDump
Creates a minidump.
FullDump
Creates a full dump.
MiniDumpOver
Creates a minidump and overwrites multiple instances for the same exception.
FullDumpOver
Creates a full dump and overwrites multiple instances for the same exception.
Stack
Lists the faulting call stack into the log.
Stacks
Lists all thread call stacks into the log.
LoadedModules
Lists all loaded modules.
MatchingSymbols
Lists all modules that have matching symbols.
Void
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Does nothing.
CustomActions
The CustomAction parameters that are used in the <CustomActions1> and <CustomActions2> tags define additional actions to be taken on first and second chance
exceptions, respectively. You can include any debugger commands that are available in CDB. You should separate multiple commands by semicolons, as follows.
<CustomActions1>!runaway;!heap</CustomActions1>
{ G | GN | GH | Q | QD }
Specifies how to return from the debugger after taking the specified actions. <ReturnAction1> and <ReturnAction2> are used after first and second chance exceptions,
respectively. These actions work like the g, gn, gh, q, and qd debugger commands. QD is supported only in Microsoft Windows XP and later versions of Windows.
The following example shows a complete <Config> section.
<Config>
<Code> AllExceptions
</Code>
<Actions1>
Log;Stack
</Actions1>
<Actions2>
Log;MiniDump
</Actions2>
<CustomActions2>
!runaway
</CustomActions2>
<ReturnAction1> GN
</ReturnAction1>
<ReturnAction2> Q
</ReturnAction2>
</Config>
<Config>
<Code> av
</Code>
<Actions1>
Log;Stack;MiniDump
</Actions1>
<Actions2>
Log;Stack;FullDump
</Actions2>
</Config>
The first part of this example configures all exceptions to create a log and list the faulting stack for a first chance exception and create a minidump and a log for a second
chance. The second part configures the av exception to create a minidump on first chance and a full dump on second chance.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Breakpoints
The Breakpoints section enables you to define the breakpoints that you want to monitor and to configure the actions that you want the debugger to take when these
breakpoints are hit.
<Breakpoints>
<NewBP>
<Address> Address </Address>
<Type> { BP | BU | BM } </Type>
<Passes> Passes </Passes>
<Actions> Actions </Actions>
<CustomActions> CustomActions </CustomActions>
<ReturnAction> { G | Q | QD } </ReturnAction>
</NewBP>
<Config>
<Address> { Address | AllBreakpoints } </Address>
<Actions> Actions </Actions>
<CustomActions> CustomActions </CustomActions>
<ReturnAction> { G | Q | QD } </ReturnAction>
</Config>
</Breakpoints>
The <NewBP> tag enables you to define new breakpoints. The <Config> tag enables you to define the behavior for breakpoints that are already defined.
All of the subtags of <NewBP> and <Config> are optional, except for <Address>.
You can use the following parameters:
Address
Uses the debugger syntax (MyModule!MyClass::MyMethod). You can separate multiple addresses by semicolons.
{ BP | BU | BM }
Defines which debugger command should be used to create the breakpoint. The default value is BP.
If you use BM, you can define multiple breakpoints at the same time by using wildcard characters in the address. For example, you could define the address as
Advapi32!Crypt*. This syntax creates a breakpoint in all functions in Advapi32.dll that begin with Crypt.
Passes
Specifies the number of hits to ignore before breaking into the debugger.
Actions
Specifies the actions that you want to include. Separate multiple actions with semicolons, as follows.
<Actions> MiniDump;Stack</Actions>
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
HangActions
The HangActions section enables you to select the actions that you want to take when you are running ADPlus in hang mode.
<HangActions>
<Option> MiniDump </Option>
<Option> FullDump </Option>
<Option> NoDump </Option>
<Option> Clear </Option>
<Actions> Actions </Actions>
<CustomActions> CustomActions
</HangActions>
</CustomActions>
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Handle
Executes the !handle extension.
Dlls
Executes the !dlls extension.
Locks
Executes the !ntsdexts.locks extension.
ThreadUsage
Executes the !runaway extension.
Separate multiple actions with semicolons, as follows.
<Actions> MiniDump;Stacks;Heap
</Actions>
CustomActions
Enables you to select additional actions to be taken in hang mode. You can include any debugger commands that are available in CDB, as follows.
<CustomActions> !runaway;!heap </CustomActions>
The following example shows a complete <HangActions> section.
<HangActions>
<Option> Clear </Option>
<Actions> Stacks;FullDump;LoadedModules
</HangActions>
</Actions>
LinkConfig
The LinkConfig section enables you to link to another configuration file.
The following example shows this section.
<LinkConfig> c:\adp\config2.cfg </LinkConfig>
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
<ADPlus>
<!-- Configuring ADPlus for custom actions on a given CLR exception -->
<!-- First we load sos extension -->
<!-- Next we use the !cce command to check if the exception is the one we are looking for -->
<!-- Next we use a j command on $t1 to do what we want -->
<!-- Replace UnhandledException_Console.MyCustomException below with the name of the exception you are looking for
<!-- You need to put the GN in the two branches of the j command and use VOID in the ReturnACtion1 tag -->
<Exceptions>
<Config>
<!-- This is for the CLR exception -->
<Code> clr </Code>
<Actions1> Log </Actions1>
<CustomActions1> !cce UnhandledException_Console.MyCustomException 1; j ($t1 = 1) '.dump /ma /u c:\Dumps\MyCustom.dmp;gn'
<ReturnAction1> VOID </ReturnAction1>
</Config>
</Exceptions>
</ADPlus>
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
1. Install the Windows 2000 with Service Pack 1 (SP1) or Windows 2000 with Service Pack 2 (SP2) symbols (Sp1sym.exe or Sp2sym.exe) to the C:\WINNT\Symbols
folder on your servers. You can download the symbols from the Windows Symbols Web site.
2. After you download Sp1sym.exe or Sp2sym.exe, run the file from the designated folder.
3. When you are prompted, extract the files to a new temporary folder (such as C:\Sp1sym or C:\Sp2sym) or to a drive or folder that has sufficient disk space.
4. Run C:\Sp1sym\Support\Debug\Symbols\i386\Symbolsx.exe or C:\Sp2sym\Support\Debug\Symbols\i386\Symbolsx.exe (where C:\Sp1sym or C:\Sp2sym is the folder
where you extracted the files in the preceding step).
5. Read the license agreement and then click Yes.
6. When you are prompted for a directory where you can extract the files to, select C:\WINNT\Symbols, and then click OK. A new C:\WINNT\Symbols directory appears
with various subdirectories named DLL, EXE, and so on.
7. Copy the symbols for your custom DLLs and any hotfixes that came after the service packs (SP1 and SP2) to the C:\WINNT\Symbols\DLL folder.
8. Copy the symbols for your custom .exe files to the C:\WINNT\Symbols\EXE folder and obtain any .pdb or .dbg files that are related to the target application and put
these files in the C:\WINNT\Symbols\DLL folder.
9. Overwrite any .dbg or .pdb files that already exist in the C:\WINNT\Symbols\DLL directory with versions from your hotfixes.
You can use the latest version of WinZip to open hotfix packages. You can extract the symbols from the \Debug subdirectory, which is contained in each hotfix selfinstaller.
10. Create an _NT_SYMBOL_PATH environment variable, and set it equal to "C:\WINNT\Symbols". This variable can be a system environment variable or a user
environment variable.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
This command runs ADPlus in crash mode for a process with PID 1896 and waits for an exception or a user to press CTRL+C in the minimized debugger window to generate
a memory dump and detach the debugger.
The following command runs ADPlus in crash mode for the process named Myapp.exe and waits for an exception or a user to press CTRL+C in the minimized debugger
window to generate a memory dump and detach the debugger.
ADPlus -crash -pn myapp.exe
The following command runs ADPlus in crash mode for all instances of the process named Myapp.exe, in addition to Inetinfo.exe and all instances of Mtx.exe or Dllhost.exe.
The minimized debugger then waits for an exception or a user to press CTRL+C in the minimized debugger window to generate a memory dump and detach the debugger.
The memory dumps and log files are then put in the C:\Temp folder.
ADPlus -crash -iis -pn myapp.exe -o c:\temp
Reconfiguring ADPlus
By default, ADPlus produces minidump files only when you press CTRL+C. (This restriction conserves disk space.)
If a process stops responding or consumes 100 % CPU, you might want to configure ADPlus to generate a full memory dump when the user presses CTRL+C. For more
information about this configuration, see ADPlus Command-Line Options and ADPlus Configuration Files.
In addition, it might help to capture a performance or system monitor log file for the time up to and including the 100 % CPU condition. At a minimum, this log file should
capture the following objects at 1-5 second intervals:
Memory
Process
Processor
System
Thread
Additional Information
For more information about how to debug a process that is consuming 100% of CPU, see Tracking Down a Processor Hog.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
are run on the remote server. For example, the dir c:\ command lists the contents of the remote server's drive C.
3. In the remote command shell, run ADPlus in crash mode as if you were running it locally from the console. However, you must use the -quiet option to suppress all
message boxes that ADPlus displays by default. If you do not use this option, the remote command shell stops responding (that is, hangs) after you run ADPlus and
does not return to a prompt. Then, you must close the Command Prompt window on the server and start a new instance.
4. To send a debug break (CTRL+C) to a process that ADPlus is currently debugging remotely through crash mode, use the Breakin.exe utility. By default, this utilityis
installed together with the debuggers in the root of the debuggers directory. For example, to stop debugging IIS (Inetinfo.exe) that is running with a process ID of 1975,
type the following command in the remote command shell:
breakin.exe 1975
Alternatively, you can use the Kill.exe utility to end any processes that are being debugged. This utility is located in the root directory of the Debugging Tools for
Windows installation tree.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Use the -notify option, and make sure that the messenger service is started on the server that is being debugged and on the client computer that receives notifications.
In the output directory, open the .log file for each process in a text editor, and scroll to the end of the file. Look for the following text:
0:070> * -------- AutodumpPlus 4.01 finished running at: -------0:070> .time
Debug session time: Mon Aug 06 15:25:15 2001
System Uptime: 3 days 17:00:34
Process Uptime: 1 days 3:10:38
0:070> * -------------------------------------------------------
In the output directory, look for any .dmp files that contain the phrase "__2nd_chance". If a memory dump is labeled with this phrase, a process has failed.
In the output directory, look for any .dmp files that contain the phrase "__Process_was_shutdown". If a memory dump is labeled with this phrase, an administrator
ended the process or, if the process is an MTS or COM+ application, it might have been shut down because the idle limit was reached.
In the output directory, look for any .dmp files that contain the phrase "__CTRL-C". If a memory dump is labeled with this phrase, a debug break exception was thrown
from a DLL that was running inside the process or someone pressed CTRL+C from the console (or used Breakin.exe if running remotely) to stop the current debugging
session.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Enables you to provide an external configuration file that has additional information. You can use more than one configuration file by using several -c switches, as
follows.
adplus -c c:\t\file1.cfg
-c c:\t\file2.cfg
You can omit a required switch at the command prompt if you specify the equivalent setting in the configuration file. For more information about these files, see ADPlus
Configuration Files.
-hang
Configures ADPlus to run in hang mode. When ADPlus is running in hang mode, you must start ADPlus after a process stops responding (that is, hangs) or is consuming
high CPU utilization.
-crash
Configures ADPlus to run in crash mode. When ADPlus is running in crash mode, you must start ADPlus before the process fails (that is, crashes) or becomes unstable.
-iis
Debugs Internet Information Server (IIS) 4.0 or later. When you use ADPlus with the -iis option, ADPlus monitors all of the IIS in-process (Inetinfo.exe) and out-ofprocess (Mtx.exe and Dllhost.exe) applications. You can use this option in addition to the -pn or -p options, or you can use -iis by itself to analyze IIS and all running
MTS or COM+ applications in crash mode or hang mode.
If you are trying to analyze IIS 3.0 (or earlier), you should use the -pn option and specify Inetinfo.exe as the process to monitor.
-pn Process
Specifies a process name that ADPlus should analyze. Process should include the file name extension. To specify more than one process, use multiple -pn options (for
example, -pn process1.exe -pn process2.exe).
-p PID
Specifies the process ID (PID) of a process that ADPlus should analyze. To specify more than one process, use multiple -p options (for example, -p 1896 -p 1702).
-sc SpawningCommandLine
Enables you to provide a command. The debugger creates the process inside the debugger and starts monitoring it. This option is available only in crash mode, and you
must add the -sc switch as the last option, because everything that is provided after this option is considered to be the command to use to create the selected process. If
you want to create more than one process, use the -c switch and a configuration file.
-notify Name
(Crash mode only) Sends a message if a failure occurs. Name is the computer or user who receives the message. Whenever the debugger detaches from the process
because of a second-chance exception, or whenever you press CTRL+C to stop debugging, a notification is sent to this computer or remote user or computer through the
local messenger service. The local messenger service must be running on the target computer for this message to work.
-o Directory
Tells ADPlus where to put the debug output files. You should put long file names and file names that contain spaces in double quotation marks. If you use a UNC path
(\\server\share), ADPlus creates a new folder immediately below the UNC path that is specified with the name of the server that ADPlus is running on (for example,
\\server\share\Web1 or \\server\share\Web2). This option is useful if ADPlus is running on multiple computers in a Web farm that are all putting their output on the same
network share.
-cdh
Signals ADPlus to use the default configuration file for hang mode. You should name the default configuration file ADP_Default_Hang.cfg and you must store it in the
same directory as Adplus.vbs.
-cdc
Signals ADPlus to use the default configuration file for crash mode. You should name the default configuration file ADP_Default_Crash.cfg and you must store it in the
same directory as Adplus.vbs.
-cdj
Signals ADPlus to use the default configuration file for postmortem debugging mode. You should name the default configuration file ADP_Default_JIT.cfg and you must
store it in the same directory as Adplus.vbs. This file is typically used if you decide to use ADPlus as the default postmortem debugger. The configuration for this mode
should be similar to hang mode.
-gs ScriptName
Creates a script named ScriptName to use together with the debugger ADPlus save the script to a file. When you use this switch, you do not have to select any process to
debug.
-ce CustomExceptionCode
Enables you to add custom exceptions for the debugger to monitor.
-bp BreakpointParameters
Enables you to define breakpoints for the debugger to monitor. BreakpointParameters has the syntax of address;parameters. You must separate the additional parameters
by semicolons and the parameters cannot contain spaces. You can use any of the following parameters:
MiniDump, FullDump or NoDump
Indicates whether you want a dump. By default, there is no dump.
Integer
Indicates the number of passes to ignore.
Q or QD or G
Indicates whether you want to quit, quit and detach, or go after the action. The default value is G.
BP or BU or BM
Indicates the type of debugger command that was used to create the breakpoint. The default value is BP. If you use BM, you can define multiple breakpoints by
using wildcard characters in the address.
If you do not include any optional parameters, the default behavior is to create a log, list the call stack, and then let the target run.
-y SymbolPath
Enables you to define the symbol path. This option accepts multiple folders separated by semicolons, including references to symbol servers.
-yp SymbolPathToAdd
Enables you to add a symbol path of the path that is already defined in the debugger . This option accepts multiple folders separated by semicolons, including references
to symbol servers.
-FullOnFirst
Creates full dumps on first chance for all defined exceptions. The default behavior is to have minidumps created on first chance. If several first-chance exceptions of the
same type occur, the dump files are overwritten. If you want another type of behavior, you can use the configuration file for additional options.
-MiniOnSecond
Creates minidumps on second chance for all defined exceptions. The default behavior is to have full dumps created on second chance.
-NoDumpOnFirst
Creates no dumps on first chance for all defined exceptions. The default behavior is to have minidumps created on first chance.
-NoDumpOnSecond
Creates no dumps on second chance for all defined exceptions. The default behavior is to have full dumps created on second chance.
-NoTlist
Does not use the TList tool to obtain the list of running processes. You should use this option only if you are experiencing problems with ADPlus that are related to the
TList tool.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
If you use -NoTlist, you cannot use the -pn switch. In addition, the dump file names do not include the package name for COM+ applications.
-NoTsCheck
Enables ADPlus to attach to a target in a Terminal Server session, if you started the target in the same session as ADPlus. You have to use this switch only in Microsoft
Windows 2000. If this switch is not included in those operating systems, you cannot use ADPlus in a Terminal Server session. In Windows XP and later versions of
Windows, ADPlus can freely attach to targets in Terminal Server, regardless of what session they were started on, and you do not have to use this switch.
-dbg Debugger
Enables you to select the debugger to use. The default debugger is CDB, but you can select WinDbg or NTSD instead. Debugger should include the debugger name and
the .exe extension.
-r Repeats IntervalInSeconds
Enables you to do repeated hang attachments. This option is ignored in crash mode. Repeats specifies the number of times that you want ADPlus to run in hang mode.
IntervalInSeconds specifies the interval, in seconds, between each run.
-lcq
Sets the last script command to Q (quit).
-lcg
Sets the last script command to G (go).
-lcgn
Sets the last script command to GN (go not handled).
-lcv
Sets the last script command to void (no command; waits for user input).
-Help
Displays help information for ADPlus.
Additional Information
For more information about ADPlus, see ADPlus.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Application Verifier
Application Verifier (AppVerif.exe) is a dynamic verification tool for user-mode applications. This tool monitors application actions while the application runs, subjects the
application to a variety of stresses and tests, and generates a report about potential errors in application execution or design.
Application Verifier can detect errors in any user-mode applications that are not based on managed code, including user-mode drivers. It finds subtle programming errors that
might be difficult to detect during standard application testing or driver testing.
You can use Application Verifier alone or in conjunction with a user-mode debugger. This tool runs on Microsoft Windows XP and later versions of Windows. The current
user must be a member of the Administrators group on the computer.
Application Verifier is not included in Debugging Tools for Windows, but you can download and install it from the Microsoft Download Center Web site. The tool comes
with its own documentation. To read the documentation, start Application Verifier and from the Help menu, click Help, or press F1.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Dr. Watson
Dr. Watson for Windows, Drwtsn32.exe, creates memory dump files from user-mode programs which have crashed.
This section includes:
Using Dr. Watson to Create a Dump File
Installing Dr. Watson as the Postmortem Debugger
Reading a Dr. Watson Log File
Dr. Watson Command-Line Options
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The Dr. Watson for Windows program (Drwtsn32.exe) is preinstalled in your system directory (typically c:\winnt\system32) when Windows is set up. The default options are
set the first time Dr. Watson for Windows runs, which can be either when an application error occurs or when you run it from the command prompt or the Run dialog box.
To run Dr. Watson, the following command line is generally used:
drwtsn32 -p ProcessID
For other options, see the Dr. Watson Command-Line Options.
By default, Dr. Watson is set up to save a memory dump file immediately upon the failure of a user-mode component. By default, this file is named User.dmp. Its default
location depends on the version of Windows that is being used:
This dump file is as large as the amount of RAM dedicated to the user-mode process on the system that failed. It includes the contents of the failed user-mode's memory
segment at the time that the error occurred.
As with any user-mode debugging session, symbols for the appropriate executables and DLLs must exist on the local computer. If a warning message box is enabled (see
Enabling Postmortem Debugging), you can copy the symbols when the message box appears. However, the symbols should not be copied after the debugger has started.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
DumpChk
DumpChk (the Microsoft Crash Dump File Checker tool), DumpChk.exe, is a program that performs a quick analysis of a crash dump file. This enables you to see summary
information about what the dump file contains. If the dump file is corrupt in such a way that it cannot be opened by a debugger, DumpChk reveals this fact.
This section includes:
Using DumpChk
DumpChk Command-Line Options
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Using DumpChk
The syntax for DumpChk is as follows:
DumpChk [-y SymbolPath] DumpFile
DumpFile specifies the crash dump file that is to be analyzed. SymbolPath specifies where DumpChk is to search for symbols. Symbol information may be necessary for
some dump files. It can also help to improve the information shown in the dump file by allowing symbol names to be resolved.
For a complete description of the command-line options, see DumpChk Command-Line Options.
Examples
Here is an example in which the dump file is corrupt. The error shown at the end, DebugClient cannot open DumpFile, indicates that some kind of corruption must
have occurred:
C:\Debuggers> dumpchk c:\mydir\dumpfile2.dmp
Loading dump file c:\mydir\dumpfile2.dmp
Microsoft (R) Windows Debugger Version 6.9.0003.113 X86
Copyright (c) Microsoft Corporation. All rights reserved.
(6903)
MiniDumpWithFullMemory
MiniDumpWithHandleData
MiniDumpWithUnloadedModules
MiniDumpWithFullMemoryInfo
MiniDumpWithThreadInfo
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Streams:
Stream 0: type ThreadListStream (3), size 00000064, RVA 000001BC
2 threads
RVA 000001C0, ID 1738, Teb:000000007FFDF000
RVA 000001F0, ID 1340, Teb:000000007FFDE000
Stream 1: type ThreadInfoListStream (17), size 0000008C, RVA 00000220
RVA 0000022C, ID 1738
RVA 0000026C, ID 1340
Stream 2: type ModuleListStream (4), size 00000148, RVA 000002AC
3 modules
RVA 000002B0, 00400000 - 00438000: 'C:\CODE\TimeTest\Debug\TimeTest.exe'
RVA 0000031C, 779c0000 - 77ade000: 'C:\Windows\System32\ntdll.dll'
RVA 00000388, 76830000 - 76908000: 'C:\Windows\System32\kernel32.dll'
Stream 3: type Memory64ListStream (9), size 00000290, RVA 00001D89
40 memory ranges
RVA 0x2019 BaseRva
range#
RVA
Address
Size
0 00002019
00010000
00010000
1 00012019
00020000
00005000
2 00017019
0012e000
00002000
(additional stream data deleted)
Stream 9: type UnusedStream (0), size 00000000, RVA 00000000
Stream 10: type UnusedStream (0), size 00000000, RVA 00000000
Stream 11: type UnusedStream (0), size 00000000, RVA 00000000
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
SystemRoot=C:\Windows
USERDNSDOMAIN=NORTHSIDE.COMPANY.COM
USERDOMAIN=NORTHSIDE
USERNAME=myname
USERPROFILE=C:\Users\myname
WINDBG_DIR=C:\DTFW\200804~2.113
windir=C:\Windows
WINLAYTEST=200804~2.113
_NT_SOURCE_PATH=C:\mysources
_NT_SYMBOL_PATH=C:\mysymbols
Finished dump check
The output begins by identifying the characteristics of the dump file - in this case, a user-mode minidump with full memory information, including application data but not
operating-system data. This is followed by the symbol path being used by DumpChk, and then a summary of the dump file contents.
Because this display ends with the words Finished dump check, the dump file is probably not corrupt, and can be opened by a debugger. However, more subtle forms
of corrruption might still be present in the file.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GFlags
GFlags (the Global Flags Editor), gflags.exe, enables and disables advanced debugging, diagnostic, and troubleshooting features. It is most often used to turn on indicators
that other tools track, count, and log.
Driver developers and testers often use GFlags to turn on debugging, logging and test features, either directly, or by including GFlags commands in a test script. The page
heap verification features can help you to identify memory leaks and buffer errors in kernel-mode drivers.
GFlags has both a dialog box and a command-line interface. Most features are available from both interfaces, but some features are accessible from only one of the interfaces.
(See GFlags Details.)
The version of GFlags described in this document is included in Debugging Tools for Windows.
New Features
Page heap verification. GFlags now includes the functions of PageHeap (pageheap.exe), a tool that enables heap allocation monitoring. PageHeap was included in
previous versions of Windows.
No reboot required for the Special Pool feature. On Windows Vista and later versions of Windows, you can enable, disable, and configure the Special Pool feature
without restarting ("rebooting") the computer. For information, see Special Pool.
Object Reference Tracing. A new flag enables tracing of object referencing and object dereferencing in the kernel. This new feature of Windows detects when an object
reference count is decremented too many times or not decremented even though an object is no longer used. This flag is supported only in Windows Vista and later
versions of Windows.
New dialog box design. The GFlags dialog box has tabbed pages for easier navigation.
Requirements
To use most GFlags features, including setting flags in the registry or in kernel mode, or enabling page heap verification, you must be a member of the Administrators group
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
on the computer. However, prior to Windows Vista, users with at least Guest account access can launch a program from the Global Flags dialog box.
When features do not work, or work differently, on particular operating system versions, the differences are explained in the description of the feature.
This topic includes:
GFlags Overview
GFlags Details
GFlags Commands
GFlags Flag Table
GFlags and PageHeap
Global Flags Dialog Box
GFlags Examples
Global Flag Reference
Caution Incorrect use of this tool can degrade system performance or prevent Windows from starting, requiring you to reinstall Windows.
Important Pool tagging is permanently enabled on Windows Server 2003 and later versions of Windows, including Windows Vista. On these systems, the Enable pool
tagging check box on the Global Flags dialog box is dimmed and commands to enable or disable pool tagging fail.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GFlags Overview
GFlags (gflags.exe), the Global Flags Editor, enables and disables advanced internal system diagnostic and troubleshooting features. You can run GFlags from a Command
Prompt window or use its graphical user interface dialog box.
Use GFlags to activate the following features:
Registry
Set system-wide debugging features for all processes running on the computer. These settings are stored in the GlobalFlag registry entry
(HKEY_LOCAL_MACHINE\ SYSTEM\ CurrentControlSet\ Control\ Session Manager\ GlobalFlag). They take effect when you restart Windows and remain
effective until you change them and restart again.
Kernel flag settings
Set debugging features for this session. These settings are effective immediately, but are lost when Windows shuts down. The settings affect all processes started after
this command completes.
Image file settings
Set debugging features for a particular program. These settings are stored in a GlobalFlag registry entry for each program (HKEY_LOCAL_MACHINE\
SOFTWARE\ Microsoft\ Windows NT\ CurrentVersion\ Image File Execution Options\ ImageFileName\ GlobalFlag). They take effect when you restart the
program and remain effective until you change them.
Debugger
Specify that a particular program always runs in a debugger. This setting is stored in the registry. It is effective immediately and remains effective until you change it.
(This feature is available only in the Global Flags dialog box.)
Launch
Run a program with the specified debugging settings. The debugging settings are effective until the program stops. (This feature is available only from the Global Flags
dialog box.)
Special Pool
Request that allocation with a specified pool tag or of a specified size are filled from the special pool. This feature helps you to detect and identify the source of errors in
kernel pool use, such as writing beyond the allocated memory space, or referring to memory that has already been freed.
Beginning in Windows Vista, you can enable, disable, and configure the special pool feature (Kernel Special Pool Tag) as a kernel flags setting, which does not require
a reboot, or as a registry setting, which requires a reboot.
Page heap verification
Enable, disable, and configure page heap verification for a program. When enabled, page heap monitors dynamic heap memory operations, including allocation and free
operations, and causes a debugger break when it detects a heap error.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GFlags Details
GFlags enables and disables system features by editing the Windows registry and internal settings. This section explains the operation of GFlags in detail and includes tips for
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
To display the GFlags dialog box, at the command line, type gflags (with no parameters).
On Windows Server 2003 and earlier versions of Windows, to set flags in the registry or in kernel mode, you must be a member of the Administrators group on the
computer. However, users with at least Guest account access can launch a program from the GFlags dialog box.
GFlags system-level registry settings appear in the registry immediately, but do not take effect until you restart the system.
GFlags image file registry settings appear in the registry immediately, but do not take effect until you restart the process.
The debugger and launch features in the GFlags dialog box are program specific. You can only set them on one image file at a time.
Flag Details
To clear all flags, set the flag to -FFFFFFFF. Setting the flag to 0 adds 0 to the current flag value.
When you set the flags for an image file to FFFFFFFF (0xFFFFFFFF), Windows clears all flags for the image file and deletes the GlobalFlag entry in the image file
registry key. The image file registry key is retained.
Set the size of the user mode stack trace database (/tracedb).
Set page heap verification options.
Registry Information
GFlags settings that are saved between sessions are stored in the registry. You can use the registry APIs, Regedit, or reg.exe to query or change these values. The following
table lists the types of settings and where they are stored in the registry.
Systemwide settings ("Registry")
Program-specific settings ("Image file")
for all users of the computer.
Page heap options for an image file for
all users of the computer
User mode stack trace database size
(tracedb)
Create user mode stack trace database
(ust, 0x1000) for an image file
Load image using large pages if
possible
Special Pool
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\GlobalFlag
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution
Options\ImageFileName\GlobalFlag
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution
Options\ImageFileName\PageHeapFlags
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution
Options\ImageFileName\StackTraceDatabaseSizeInMb
Windows adds the image file name to the value of the USTEnabled registry entry (HKLM\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Image File Execution Options\USTEnabled).
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\ImageFileName\UseLargePages.
HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\PoolTag
GFlags Commands
To use GFlags, type the following commands at the command line.
You can use the GFlags commands and the Global Flags Dialog Box interchangeably.
Syntax
To open the GFlags dialog box:
gflags
To set or clear global flags in the registry:
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
To set or clear the Special Pool feature (Windows Vista and later)
gflags {/r | /k} {+ | -}spp {PoolTag | 0xSize}
To enable or disable the Object Reference Tracing feature (Windows Vista and later)
gflags {/ro | /ko} [/p] [/i ImageFile | /t PoolTag;[PoolTag...]]
gflags {/ro | /ko} /d
To enable and configure page heap verification:
gflags /p /enable ImageFile [ /full [/backwards] | /random Probability | /size SizeStart SizeEnd | /address AddressStart
[/debug ["DebuggerCommand"] | /kdebug] [/unaligned] [/notraces] [/fault Rate [TimeOut]] [/leaks] [/protect] [/no_sync
To disable page heap verification:
gflags /p [/disable ImageFile] [/?]
To display help:
glags /?
Parameters
Flag
Specifies a three-letter abbreviation (FlagAbbr) or hexadecimal value (FlagHex) that represents a debugging feature. The abbreviations and hexadecimal values are listed
in the GFlags Flag Table.
Use one of the following flag formats:
Format
{+ | -}
FlagAbbr
[+ | -]
FlagHex
Description
Sets (+) or clears (-) the flag represented by the flag abbreviation. Without a plus (+) or minus (-) symbol, the command has no effect.
Adds (+) or subtracts (-) the hexadecimal value of a flag. A flag is set when its value is included in the sum. Add (+) is the default. Enter a hexadecimal
value (without 0x) that represents a single flag or enter the sum of hexadecimal values for multiple flags.
ImageFile
Specifies the name of an executable file, including the file name extension (for example, notepad.exe or mydll.dll).
/r
Registry. Displays or changes system-wide debugging flags stored in the registry. These settings take effect when you restart Windows and remain effective until you
change them.
With no additional parameters, gflags /r displays the system-wide flags set in the registry.
/k
Kernel flag settings. Displays or changes system-wide debugging flags for this session. These settings are effective immediately, but are lost when Windows shuts down.
The settings affect processes started after this command completes.
With no additional parameters, gflags /k displays system-wide flags set for the current session.
/i
Image file settings. Displays or changes debugging flags for a particular process. These settings are stored in the registry. They are effective for all new instances of this
process and they remain effective until you change them.
With no additional parameters, gflags /i ImageFile displays the flags set for the specified process.
/tracedb SizeInMB
Sets the maximum size of the user-mode stack trace database for the process. To use this parameter, the Create user mode stack trace database (ust) flag must be set for
the process.
SizeInMB is a whole number representing the number of megabytes in decimal units. The default value is the minimum size, 8 MB; there is no maximum size. To revert
to the default size, set SizeInMB to 0.
spp
(Windows Vista and later.) Sets or clears the Special Pool feature. For an example, see Example 14: Configuring Special Pool.
PoolTag
(Windows Vista and later.) Specifies a pool tag for the Special Pool feature. Use only with the spp flag.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Enter a four-character pattern for PoolTag, such as Tag1. It can include the ? (substitute for any single character) and * (substitute for multiple characters) wildcard
characters. For example, Fat* or Av?4. Pool tags are always case-sensitive.
0xSize
(Windows Vista and later.) Specifies a size range for the Special Pool feature. Use only with the spp flag. For guidance on selecting a size value, see "Selecting an
Allocation Size" in Special Pool.
/ro
Enables, disables, and displays Object Reference Tracing settings in the registry. To make a change to this setting effective, you must restart Windows.
Without additional parameters, /ro displays the Object Reference Tracing settings in the registry.
To enable Object Reference Tracing, you must include at least one pool tag (/t PoolTag) or one image file (/i ImageFile) in the command. For details, see Example 15:
Using Object Reference Tracing.
The following table lists the subparameters that are valid with /ro.
/t PoolTags Limits the trace to objects with the specified pool tags. Use a semicolon (;) to separate tag names. Enter up to 16 pool tags.
Enter a four-character pattern for PoolTags, such as Tag1.
If you specify more than one pool tag, Windows traces objects with any of the specified pool tags .
If you do not specify any pool tags, Windows traces all objects that are created by the image.
/i
Limits the trace to objects that are created by processes with the specified image file. You can specify only one image file with the /i parameter.
ImageFile
Enter an image file name, such as notepad.exe, with up to 64 characters. "System" and "Idle" are not valid image names.
If you do not specify an image file, Windows traces all objects with the specified pool tags. If you specify both an image file (/i) and one or more pool tags
(/t), Windows traces objects with any of the specified pool tags that are created by the specified image.
/d
/p
Clears the Object Reference Tracing feature settings. When used with /ro, it clears the settings in the registry.
Permanent. The trace data is retained until Object Reference Tracing is disabled, or the computer is shut down or restarted. By default, the trace data for an
object is discarded when the object is destroyed.
/ko
Enables, disables, and displays kernel flag (run time) Object Reference Tracing settings. Changes to this setting are effective immediately, but are lost when the system is
shut down or restarted. For details, see Example 15: Using Object Reference Tracing.
Without additional parameters, /ko displays the kernel flag (run time) Object Reference Tracing settings.
To enable Object Reference Tracing, you must include at least one pool tag (/t PoolTag) or one image file (/i ImageFile) in the command.
The following table lists the subparameters that are valid with /ko.
/t PoolTags Limits the trace to objects with the specified pool tags. Use a semicolon (;) to separate tag names. Enter up to 16 pool tags.
Enter a four-character pattern for PoolTags, such as Tag1.
If you specify more than one pool tag, Windows traces objects with any of the specified pool tags.
If you do not specify any pool tags, Windows traces all objects that are created by the image.
/i ImageFile Limits the trace to objects that are created by processes with the specified image file. You can specify only one image file with the /i parameter.
If you do not specify an image file, Windows traces all objects with the specified pool tags.
If you specify both an image file (/i) and one or more pool tags (/t), Windows traces objects with any of the specified pool tags that are created by the
specified image.
/d
/p
Clears the Object Reference Tracing feature settings. When used with /ro, it clears the settings in the registry.
Permanent. The trace data is retained until Object Reference Tracing is disabled, or the computer is shut down or restarted. By default, the trace data for an
object is discarded when the object is destroyed.
/p
Sets page heap verification options for a process.
With no additional parameters, gflags /p displays a list of image files for which page heap verification is enabled.
Page heap verification monitors dynamic heap memory operations, including allocate operations and free operations, and causes a debugger break when it detects a heap
error.
/disable ImageFile
Turns off page heap verification (standard or full) for the specified image file.
This command is equivalent to turning off the Enable page heap (hpa) flag for a process (gflags /i ImageFile -hpa). You can use the commands interchangeably.
/enable ImageFile
Turns on page heap verification for the specified image file.
By default, the /enable parameter turns on standard page heap verification for the image file. To enable full page heap verification for the image file, add the /full
parameter to the command or use the /i parameter with the +hpa flag.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
/full
Turns on full page heap verification for the process. Full page heap verification places a zone of reserved virtual memory at the end of each allocation.
Using this parameter is equivalent to turning on the Enable page heap (hpa) flag for a process (gflags /i ImageFile +hpa). You can use the commands interchangeably.
/backwards
Places the zone of reserved virtual memory at the beginning of an allocation, rather than at the end. As a result, the debugger traps overruns at the beginning of the buffer,
instead of those at the end of the buffer. Valid only with the /full parameter.
/random Probability
Chooses full or standard page heap verification for each allocation, based on the specified probability.
Probability is a decimal integer from 0 through 100 representing the probability of full page heap verification. A probability of 100 is the same as using the /full
parameter. A probability of 0 is the same as using standard page heap verification.
/size SizeStart SizeEnd
Enables full page heap verification for allocations within the specified size range and enables standard page heap verification for all other allocations by the process.
SizeStart and SizeEnd are decimal integers. The default is standard page heap verification for all allocations.
/address AddressStart AddressEnd
Enables full page heap verification for memory allocated while a return address in the specified address range is on the run-time call stack. It enables standard page heap
verification for all other allocations by the process.
To use this feature, specify a range that includes the addresses of all functions that call the function with the suspect allocation. The address of the calling function will be
on the call stack when the suspect allocation occurs.
AddressStart and AddressEnd specify the address range searched in allocation stack traces. The addresses are specified in hexadecimal format, such as, 0xAABBCCDD.
On Windows Server 2003 and earlier systems, the /address parameter is valid only on x86-based computers. On Windows Vista,: it is valid on all supported
architectures.
/dlls DLL[, DLL...]
Enables full page heap verification for allocations requested by the specified DLLs and standard page heap verification for all other allocations by the process.
DLL is the name of a binary file, including its file name extension. The specified file must be a function library that the process loads during execution.
/debug
Automatically launches the process specified by the /enable parameter under a debugger.
By default, this parameter uses the NTSD debugger with the command line ntsd -g -G -x and with page heap enabled, but you can use the DebuggerCommand variable
to specify a different debugger and command line.
For information about NTSD, see CDB and NTSD.
This option is useful for programs that are difficult to start from a command prompt and those that are started by other processes.
"DebuggerCommand"
Specifies a debugger and the command sent to the debugger. This quoted string can include a fully qualified path to the debugger, the debugger name, and command
parameters that the debugger interprets. The quotation marks are required.
If the command includes a path to the debugger, the path cannot contain any other quotation marks. If other quotation marks appear, the command shell (cmd.exe) will
misinterpret the command.
/kdebug
Automatically launches the process specified by the /enable parameter under the NTSD debugger with the command line ntsd -g -G -x, with page heap enabled, and with
control of NTSD redirected to the kernel debugger.
For information about NTSD, see CDB and NTSD.
/unaligned
Aligns the end of each allocation at an end-of-page boundary, even if doing so means that the starting address is not aligned on an 8-byte block. By default, the heap
manager guarantees that the starting address of an allocation is aligned on an 8-byte block.
This option is used to detect off-by-one-byte errors. When this parameter is used with the /full parameter, the zone of reserved virtual memory begins just after the last
byte of the allocation and an immediate fault occurs when a process tries to read or write even one byte beyond the allocation.
/decommit
This option is no longer valid. It is accepted, but ignored.
The PageHeap program (pageheap.exe) included in Windows 2000 implemented full page heap verification by placing an inaccessible page after an allocation. In that
tool, the /decommit parameter substituted a zone of reserved virtual memory for the inaccessible page. In this version of GFlags, a zone of reserved virtual memory is
always used to implement full page heap verification.
/notraces
Specifies that run-time stack traces are not saved.
This option improves performance slightly, but it makes debugging much more difficult. This parameter is valid, but its use is not recommended.
/fault
Forces the program's memory allocations to fail at the specified rate and after the specified time-out.
This parameter inserts heap allocation errors into the image file being tested (a practice known as "fault injection") so that some memory allocations fail, as might occur
when the program runs in low memory conditions. This test helps to detect errors in handling allocation failure, such as failing to release resources.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Rate
Specifies a decimal integer from 1 (.01%) through 10000 (100%) representing the probability that an allocation will fail. The default is 100 (1%).
TimeOut Determines the time interval between the start of the program and the start of the fault injection routines.
TimeOut is measured in seconds. The default is 5 (seconds).
/leaks
Checks for heap leaks when a process ends.
The /leaks parameter disables full page heap. When /leaks is used, the /full parameter and parameters that modify the /full parameter, such as /backwards, are ignored,
and GFlags performs standard page heap verification with a leak check.
/protect
Protects heap internal structures. This test is used to detect random heap corruptions. It can make execution significantly slower.
/no_sync
Checks for unsynchronized access. This parameter causes a break if it detects that a heap created with the HEAP_NO_SERIALIZE flag is accessed by different threads.
Do not use this flag to debug a program that includes a customized heap manager. Functions that synchronize heap access cause the page heap verifier to report
synchronization faults that do not exist.
/no_lock_checks
Disables the critical section verifier.
/?
Displays help for GFlags. With /p, /? displays help for the page heap verification options in GFlags.
Comments
Typing gflags without parameters opens the Global Flags dialog box.
Typing gflags /p without additional parameters displays a list of programs that have page heap verification enabled.
To clear all flags, set Flag to -FFFFFFFF. (Setting Flag to 0 adds zero to the current flag value. It does not clear all flags.)
When you set Flag for an image file to FFFFFFFF, Windows clears all flags and deletes the GlobalFlag entry in the registry subkey for the image file. The subkey remains.
The /full, /random, /size, /address, and /dlls parameters for the page heap /enable operation determine which allocations are subject to page heap verification and the
verification method used. You can use only one of these parameters in each command. The default is standard page heap verification of all allocations of the process. The
remaining parameters set options for page heap verification.
The page heap features in GFlags only monitor heap memory allocations that use the standard Windows heap manager functions (HeapAlloc, GlobalAlloc, LocalAlloc,
malloc, new, new[], or their corresponding deallocation functions), or those that use custom operations that call the standard heap manager functions.
To determine whether full or standard page heap verification is enabled for a program, at the command line, type gflags /p. In the resulting display, traces indicates that
standard page heap verification is enabled for the program and full traces indicates that full page heap verification is enabled for the program.
The /enable parameter sets the Enable page heap (hpa) flag for the image file in the registry. However, the /enable parameter turns on standard heap verification for the
image file by default, unlike the /i parameter with the +hpa flag, which turns on full heap verification for an image file.
Standard page heap verification places random patterns at the end of an allocation and examines the patterns when a heap block is freed. Full page heap verification places a
zone of reserved virtual memory at the end of each allocation.
Full page heap verification can consume system memory quickly. To enable full page heap verification for memory-intensive processes, use the /size or /dlls parameter.
After using global flags for debugging, submit a gflags /p /disable command to turn off the page heap verification and delete associated registry entries. Otherwise, entries
that the debugger reads remain in the registry. You cannot use the gflags /i hpa command for this task, because it turns off page heap verification, but does not delete the
registry entries.
By default, on Windows Vista and later versions of Windows, program-specific settings (image file flags and page heap verification settings) are stored in the current user
account.
This version of GFlags includes the -v options, which enable features being developed for GFlags. However, these features are not yet complete and, therefore, are not
documented.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Description
Symbolic Name
Hexadecimal Value Abbreviation
Buffer DbgPrint Output
FLG_DISABLE_DBGPRINT
0x08000000
ddp
R,K
Create kernel mode stack trace database
FLG_KERNEL_STACK_TRACE_DB
0x2000
kst
R
Create user mode stack trace database
FLG_USER_STACK_TRACE_DB
0x1000
ust
R,K,I
Debug initial command
FLG_DEBUG_INITIAL_COMMAND
0x4
dic
R
Debug WinLogon
FLG_DEBUG_INITIAL_COMMAND_EX
0x04000000
dwl
R
Disable heap coalesce on free
FLG_HEAP_DISABLE_COALESCING
0x00200000
dhc
R,K,I
Disable paging of kernel stacks
FLG_DISABLE_PAGE_KERNEL_STACKS 0x80000
dps
R
Disable protected DLL verification
FLG_DISABLE_PROTDLLS
0x80000000
dpd
R,K,I
Disable stack extension
FLG_DISABLE_STACK_EXTENSION
0x10000
dse
I
Early critical section event creation
FLG_CRITSEC_EVENT_CREATION
0x10000000
cse
R,K,I
Enable application verifier
FLG_APPLICATION_VERIFIER
0x100
vrf
R,K,I
Enable bad handles detection
FLG_ENABLE_HANDLE_EXCEPTIONS
0x40000000
bhd
R,K
Enable close exception
FLG_ENABLE_CLOSE_EXCEPTIONS
0x00400000
ece
R,K
Enable debugging of Win32 subsystem
FLG_ENABLE_CSRDEBUG
0x20000
d32
R
Enable exception logging
FLG_ENABLE_EXCEPTION_LOGGING
0x00800000
eel
R,K
Enable heap free checking
FLG_HEAP_ENABLE_FREE_CHECK
0x20
hfc
R,K,I
Enable heap parameter checking
FLG_HEAP_VALIDATE_PARAMETERS
0x40
hpc
R,K,I
Enable heap tagging
FLG_HEAP_ENABLE_TAGGING
0x800
htg
R,K,I
Enable heap tagging by DLL
FLG_HEAP_ENABLE_TAG_BY_DLL
0x8000
htd
R,K,I
Enable heap tail checking
FLG_HEAP_ENABLE_TAIL_CHECK
0x10
htc
R,K,I
Enable heap validation on call
FLG_HEAP_VALIDATE_ALL
0x80
hvc
R,K,I
Enable loading of kernel debugger symbols FLG_ENABLE_KDEBUG_SYMBOL_LOAD 0x40000
ksl
R,K
Enable object handle type tagging
FLG_ENABLE_HANDLE_TYPE_TAGGING 0x01000000
eot
R,K
Enable page heap
FLG_HEAP_PAGE_ALLOCS
0x02000000
hpa
R,K,I
Enable pool tagging
FLG_POOL_ENABLE_TAGGING
0x400
ptg
R
(Windows 2000 and Windows XP only)
Enable system critical breaks
FLG_ENABLE_SYSTEM_CRIT_BREAKS 0x100000
scb
R, K, I
Load DLLs top-down
FLG_LDR_TOP_DOWN
0x20000000
ltd
R, K, I
(Win64 only)
Load image using large pages if possible
lpg
I
Maintain a list of objects for each type
FLG_MAINTAIN_OBJECT_TYPELIST
0x4000
otl
R
Object Reference Tracing
R, K
Destination
FLG_SHOW_LDR_SNAPS
0x2
sls
spp
R,K,I
R
R,K (Windows Vista and later)
Stop on exception
Stop on hung GUI
FLG_STOP_ON_EXCEPTION
FLG_STOP_ON_HUNG_GUI
0x1
0x8
soe
shg
R,K,I
K
To enable standard page heap verification for all processes, use gflags /r +hpa or gflags /k +hpa.
To enable standard page heap verification for one process, use gflags /p /enable ImageFileName.
To enable full page heap verification for one process, use gflags /i ImageFileName +hpa or gflags /p /enable ImageFileName /full.
All page heap settings, except for /k, are stored in the registry and remain effective until you change them.
Use care in interpreting the Enable page heap check box for an image file in the GFlags dialog box. It indicates that page heap verification is enabled for an image file, but it
does not indicate whether it is full or standard page heap verification. If the check results from selecting the check box, then full page heap verification is enabled for the
image file. However, if the check results from use of the command-line interface, then the check can represent the enabling of either full or standard page heap verification for
the image file.
To determine whether full or standard page heap verification is enabled for a program, at the command line, type gflags /p. In the resulting display, traces indicates that
standard page heap verification is enabled for the program and full traces indicates that full page heap verification is enabled for the program.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Double-click the gflags.exe icon or, at the command line, or in the Run dialog box, type gflags (without parameters).
- OR
Click Start, point to All Programs, point to Debugging Tools for Windows, and then click Global Flags.
On Windows Vista, click Start, click All Programs, click Debugging Tools for Windows, right-click Global Flags and then click Run as administrator. If you omit
this step, Windows displays the System Registry Gflags Error: 5. The Gflags dialog box opens, but Gflags commands fail.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The following illustration shows the System Registry tab on Windows Vista.
2. Set or clear a flag by selecting or clearing the check box associated with the flag.
3. When you have selected or cleared all of the flags that you want, click Apply.
4. Restart Windows to make the changes effective.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
2. Set or clear a flag by selecting or clearing the check box associated with the flag.
3. When you have selected or cleared all of the flags that you want, click Apply.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
2. In the Image box, type the name of an executable file or DLL, including the file name extension,and then press the TAB key.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Notes Flags set in the registry do not affect the instance of the program that is launched.
Flags set in the dialog box are used for the launched instance even when they are not image file flags.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
4. In the Debugger box, type the command to run the debugger, including the path (optional) and name of the debugger and parameters. For example, ntsd -d -g -G -x or
c:\debuggers\cdb.exe -g -G.
5. Click Apply.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
4.
5. Click Apply.
When you click Apply, GFlags changes the selection from Text to Hex and displays the ASCII characters as hexadecimal values in reverse (lower endian) order. For
example, if you type Tag1, GFlags displays the tag as 0x31676154 (1gaT). This is the way that it is stored in the registry and displayed by the debugger and other tools.
The following illustration shows the effect of clicking Apply.
Comments
To use this feature effectively, make sure that your driver or other kernel-mode program uses a unique pool tag. If you suspect that your driver is consuming all of the special
pool, consider using multiple pool tags in your code. You can then test your driver several times, assigning special pool to one pool tag in each test.
Also, select a pool tag with a hexadecimal value that is greater than the page size of the system. For kernel mode code, if you enter a pool tag that has a value less than
PAGE_SIZE, Gflags requests special pool for all allocations whose size is within the corresponding range and requests special pool for allocations with an equivalent pool
tag. For example, if you select a size of 30, special pool will be used for all allocations between 17 and 32 bytes in size, and for allocations with the pool tag 0x0030.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
In Windows Vista and later versions of Windows, you can also use the command line to request special pool by pool tag. For information, see GFlags Commands.
Note This method is rarely useful for diagnosing driver errors, because it affects all kernel pool requests of the specified size, regardless of which driver or kernel module
requested the allocation.
To request special pool by allocation size
1. Select the System Registry tab or the Kernel Flags tab.
On Windows Vista and later versions of Windows, this option is available on both tabs. On earlier versions of Windows, it is available only on the System Registry
tab.
2. In the Kernel Special Pool Tag section, click Hex, and then type a number in hexadecimal format that represents a range of sizes. All allocations within this size range
will be allocated from special pool. This number must be less than PAGE_SIZE.
3. Click Apply.
The following illustration shows an allocation size entered as a hexadecimal value.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Verify Start enables underrun detection on allocations from the special pool. This causes a bug check when a program tries to access memory preceding its special pool
memory allocation.
Verify End enables overrun detection on allocations from the special pool. This causes a bug check when a program tries to access memory beyond its special pool
memory allocation. Because overruns are much more common, Verify End is the default.
In Windows Vista and later versions of Windows, this option is available on the System Registry and Kernel Flags tabs. In earlier versions of Windows, it is available only
on the System Registry tab.
To specify special pool alignment:
1. Click the System Registry tab.
2. Click Verify Start or Verify End.
3. Click Apply.
The following illustration shows the Verify Start and Verify End settings on the System Registry tab.
Comments
The Verify Start and Verify End alignment settings apply to all allocations from the special pool, including special pool allocation requests set in Driver Verifier. If you set
the alignment without specifying a pool tag or allocation size, then the settings apply only to requests set in Driver Verifier.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GFlags Examples
The following examples show how to submit GFlags commands and how to use GFlags features in practical scenarios.
This section includes the following topics.
Example 1: Displaying Global Flags
Example 2: Setting a Flag by Using a Flag Abbreviation
Example 3: Setting a Flag by Using Its Hexadecimal Value
Example 4: Setting Multiple Flags
Example 5: Clearing a Flag
Example 6: Clearing All Flags
Example 7: Clearing All Flags for an Image File
Example 8: Enlarging the User-Mode Stack Trace Database
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
In this example, the results show that there are three tags set, with a combined value of 0x40001400.
The following command displays the flags set for the current session. It uses the /k parameter to indicate kernel mode.
gflags /k
The following command displays flags set in the registry for the image file notepad.exe. It uses the /i parameter to indicate image file mode and specifies the image file.
gflags /i notepad.exe
Remember that the flag value displayed might not be the current, effective flag value. Changes to the system-wide flags are not effective until you restart Windows. Changes
to image file flag settings are not effective until you restart the program.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
This command uses the /k parameter to specify kernel mode (session only). It sets the value for kernel mode to E0 (0xE0), the sum of the hexadecimal values of the selected
flags (0x20 + 0x40 + 0x80).
gflags /k e0
In response, GFlags displays the revised value of flags set for the session. The display indicates that the command is successful and that the three flags specified in the
command are set.
Current
hfc
hpc
hvc
You can use several different GFlags commands to set flags. Each of the following commands has the same effect as the command used in this example and the methods can
be used interchangeably:
gflags /k +20 +40 +80
gflags /k +E0
gflags /k +hfc +hpc +hvc
Kernel (run time) flags are effective immediately and remain effective until Windows shuts down.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
In response, GFlags displays the current value of the system-wide registry entry. The display indicates that the command is successful and that there are no longer any flags
set.
Current Boot Registry Settings are: 00000000
Note that the following command, which uses the hexadecimal value of the Enable Page Heap flag, has the same effect as the command used in this example. These
commands can be used interchangeably:
gflags /r -02000000
Note The methods demonstrated by this example clear flags only. They do not reset the maximum stack trace size or kernel special pool tag to the default values.
Boot Registry
- Enable heap
- Enable heap
- Enable heap
The command has no effect because it adds the value 0 to system-wide flag entry.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Paged
Paged
Paged
Paged
1283
10385
6662
614
(
(
(
(
0)
10)
8)
0)
1002
6658
4971
441
(
(
(
(
0)
4)
6)
0)
281 1377312 (
3727 317952 (
1691 174560 (
173
83456 (
0) 4901
512)
85
128) 103
0) 482
If the value in the Bytes column for an allocation expands continuously for no obvious reason, there might be a memory leak in that pool.
4. Clear the Enable pool tagging flag.
The following command line uses the flag abbreviation method, but you can identify the flag by its hexadecimal value or use the Global Flags dialog box:
gflags /r -ptg
5. Restart Windows to make the registry change effective.
Note Use the append symbol (>>) to redirect the PoolMon output to a log file. Later, you can examine the log file for pool size trends. For example:
poolmon.exe /b >> poolmon.log
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The following command creates an environment variable that stores the path to the directory of symbol files:
set _NT_SYMBOL_PATH=C:\Windows\symbols
3. Start Notepad.
4. Find the process identifier (PID) of the Notepad process.
You can find the PID of any running process from Task Manager or Tasklist (tasklist.exe), a tool included in Windows XP Professional and Windows Server 2003
operating systems. In this example, the Notepad PID is 1228.
5. Run UMDH.
The following command runs UMDH (umdh.exe). It uses the -p: parameter to specify the PID that, in this example, is 1228. It uses the /f: parameter to specify the name
and location of the output file for the heap dump, notepad.dmp.
umdh -p:1228 -f:notepad.dmp
In response, UMDH writes a complete dump of all active heaps to the notepad.dmp file.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
gflags /p
In response, GFlags displays the following list of programs. In this display, traces indicates standard page heap verification, and full traces indicates full page heap
verification. In this case, pheap-buggy.exe is listed with traces, indicating that standard page heap verification is enabled, as intended.
pheap-buggy.exe: page heap enabled with flags (traces )
===========================================================
VERIFIER STOP 00000008: pid 0xAA0: corrupted suffix pattern
00C81000 : Heap handle
00D81EB0 : Heap block
00000100 : Block size
00000000 :
===========================================================
Break instruction exception - code 80000003 (first chance)
eax=00000000 ebx=00d81eb0 ecx=77f7e257 edx=0006fa18 esi=00000008 edi=00c81000
eip=77f7e098 esp=0006fc48 ebp=0006fc5c iopl=0
nv up ei pl zr na po nc
cs=001b ss=0023 ds=0023 es=0023 fs=0038 gs=0000
efl=00000246
ntdll!DbgBreakPoint:
77f7e098 cc
int
3
The header information includes the address of the heap with the corrupted block (00C81000 : Heap handle), the address of the corrupted block (00D81EB0 : Heap block),
and the size of the allocation (00000100 : Block size).
The "corrupted suffix pattern" message indicates that the application violated the data integrity pattern that GFlags inserted after the end of the pheap-buggy.exe heap
allocation.
As a result, the debugger displays the call stack for pheap-buggy.exe with line numbers. The call stack display shows that the error occurred when the TestCorruptAfterEnd
function in pheap-buggy.exe tried to free an allocation at 0x00c80000 by calling HeapFree, a redirect to RtlFreeHeap.
The most likely cause of this error is that the program wrote past the end of the buffer that it allocated in this function.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
In response, GFlags displays the following list of programs. In this display, traces indicates standard page heap verification, and full traces indicates full page heap
verification. In this case, pheap-buggy.exe is listed with full traces, indicating that full page heap verification is enabled, as intended.
pheap-buggy.exe: page heap enabled with flags (full traces )
The stack trace shows that the problem occurs in line 184 of pheap-buggy.exe. Because full page heap verification is enabled, the call stack starts in the program code, not in a
system DLL. As a result, the violation was caught where it happened, instead of when the heap block was freed.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GlobalFlag
REG_SZ
0x00200000
Tip Type the Reg command into Notepad, then save the file as imageflags.bat. Thereafter, to find image files for which flags have been set, just type ImageFlags.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Use Gflags to enable Object Reference Tracing in the registry or as a kernel flag (run time) setting. If you add the setting to the registry, you must restart the
computer to start tracing. If you enable the run time version of the settings, the trace starts immediately, but the trace settings revert to those in the registry key when
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
These examples show how to use Gflags to enable and disable object reference tracing. \
Enable Run-time Tracing
The following command enables Object Reference Tracing at the command prompt. The command uses the /ko parameter to enable Object Reference Tracing as a kernel flag
(run time) setting. The command uses the /t parameter to specify the pool tags Tag1 and Fred. As a result, all objects that are created with Tag1 or Fred are traced.
gflags /ko /t Tag1;Fred
Because the command changes the kernel flag (run-time) settings, object reference tracing starts immediately. The trace will include all objects with the pool tags Tag1 or
Fred that are created by processes that start after the command is submitted.
Gflags responds by printing the following message:
Running Kernel Settings :
Object Ref Tracing Enabled
Temporary Traces
Pool Tags: Tag1;Fred
Process Name: All Processes
This message indicates that Object Reference Tracing is enabled. "Temporary Traces" indicates that all records of the trace are deleted when the object is destroyed. To make
the trace "permanent," use the /p parameter, which directs Windows to retain the trace data until Object Reference Tracing is disabled, or the computer is shut down or
restarted.
Enable Tracing in the Registry
The following command adds an Object Reference Tracing configuration to the registry. The trace that you configure begins when you restart the computer.
The command uses the /ro parameter to enable Object Reference Tracing as a registry setting. The command uses the /i to specify the process for notepad.exe and the /t
parameter to specify the pool tags Tag1 and Fred. As a result, all objects that are created by the Notepad process with the Tag1 or Fred pool tags are traced. The command
also uses the /p parameter, which retains the trace data until the tracing is disabled.
gflags /ro /t Tag1;Fred /i Notepad.exe /p
When you submit the command, Gflags stores the information in the registry. However, because registry settings are not effective until you restart the computer, this object
reference tracing is configured, but is not yet started.
Gflags responds by printing the following message:
Boot Registry Settings :
Object Ref Tracing Enabled
Permanent Traces
Pool Tags: Tag1;Fred
Process Name: Notepad.exe
The message indicates that Object Reference Tracing is enabled in the registry. "Permanent Traces" indicates that the trace data will be retained until you shut down or restart
the computer. The message also lists the pool tags and image file names that will be traced.
Display the Object Reference Tracing Configuration
You can display the Object Reference Tracing configuration that is currently effective or is stored in the registry to be used when the computer is restarted.
In this example, there is one Object Reference Tracing configuration stored in the registry and a different one configured for run time. The run-time trace begins immediately
(and overrides any registry settings). However, if you restart the system, the run-time settings are lost, and the Object Reference Tracing session registry settings become
effective.
The following command displays the run time Object Reference Tracing configuration. It uses the /ko parameter with no other parameters.
gflags /ko
Running Kernel Settings :
Object Ref Tracing Enabled
Temporary Traces
Pool Tags: Tag1;Fred
Process Name: All Processes
If Object Reference Tracing is enabled, as it is in this example, the settings that are displayed describe a trace that is in progress.
The following command displays the Object Reference Tracing configuration data stored in the registry. It uses the /ro parameter with no other parameters.
gflags /ro
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Comments
GFlags displays this flag as a kernel flag setting, but it is not effective at run time, because the kernel is already started.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Debug WinLogon
The Debug WinLogon flag debugs the WinLogon service.
Abbreviation
dwl
Hexadecimal value 0x04000000
Symbolic Name
FLG_DEBUG_INITIAL_COMMAND_EX
Destination
System-wide registry entry
Comments
NTSD debugs Winlogon (by using the command ntsd -d -g -x), but control is redirected to the kernel debugger.
For details on NTSD, see CDB and NTSD.
See Also
Debug initial command, Enable debugging of Win32 subsystem
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Abbreviation
dse
Hexadecimal value 0x10000
Symbolic Name
FLG_DISABLE_STACK_EXTENSION
Destination
Image file registry entry
Comments
This feature is used to simulate low memory conditions (where stack extensions fail) and to test the strategic system processes that are expected to run well even with low
memory.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Destination
See Also
Enable heap tail checking, Enable heap parameter checking
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Full page heap verification (for /i) places a zone of reserved virtual memory at the end of each allocation.
Standard page heap verification (for /r or /k) places random patterns at the end of an allocation and examines the patterns when a heap block is freed.
Setting this flag for an image file is the same as typing gflags /p enable ImageFile /full for the image file at the command line.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Microsoft Windows
Note The linked lists created when you set this flag use eight bytes of overhead for each object. Remember to clear this flag when your analysis is complete.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Special Pool
The Special Pool feature configures Windows to request memory allocations from a reserved memory pool when the memory is allocated with a specified pool tag or is
within a specified size range.
Abbreviation
spp
Hexadecimal value (None)
Symbolic Name
(None)
Destination
System-wide registry entry
(Windows Vista and later) System-wide registry entry, kernel flag
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The Special Pool feature of Gflags directs Windows to request memory allocations from a reserved memory pool when the memory is allocated with a specified pool tag or is
within a specified size range. To request special pool for all allocations by a particular driver, use Driver Verifier. For more information, see the "Special Pool" topic in the
"Driver Verifier" section of the Windows Driver Kit (WDK).
The special pool features of Gflags and Driver Verifier help you to detect and identify the source of errors in kernel pool use, such as writing beyond the allocated memory
space, or referring to memory that has already been freed.
Not all special pool requests are fulfilled. Each allocation from the special pool uses one page of nonpageable physical memory and two pages of virtual address space. If the
special pool is exhausted, memory is allocated from the standard pool until the special pool becomes available again. When a special pool request is filled from the standard
pool, the requesting function returns a success status. It does not return an error, because the allocation has succeeded, even though it was not filled from special pool.
The size of the special pool increases with the amount of physical memory on the system; ideally this should be at least 1 Gigabyte (GB). On x86 machines, because virtual
(in addition to physical) space is consumed, do not use the /3GB boot option when using special pool. It is also a good idea to increase the pagefile minimum/maximum
quantities by a factor of two or three.
You can also configure the Special Pool feature to align memory allocation to detect references to memory preceding the allocation ("underruns") or references to memory
beyond the allocation ("overruns"). This feature is available only in the Global Flags dialog box on all versions of Windows. For details, see Detecting Overruns and
Underruns.
On Windows Vista and later versions of Windows, you can configure the Special Pool feature as a registry setting that requires a reboot, but remains effective until you
change it, or as a kernel flag setting that does not require a reboot, but is effective only until you reboot or shut down Windows. In earlier versions of Windows, Special Pool
is only available as a registry setting.
On Windows Vista and later versions of Windows, you can configure the Special Pool feature either by using the Global Flags dialog box or at the command line. In earlier
version of Windows, this feature is available only in the Global Flags dialog box.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Stop on exception
The Stop on exception flag causes the kernel to break into the kernel debugger whenever a kernel-mode exception occurs.
Abbreviation
soe
Hexadecimal value 0x1
Symbolic Name
FLG_STOP_ON_EXCEPTION
Destination
System-wide registry entry, kernel flag, image file registry entry
Comments
Windows passes all first chance exceptions (except for STATUS_PORT_DISCONNECT) with a severity of Warning or Error to the debugger before passing them to a local
exception handler.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Kill Tool
The Kill tool, kill.exe, terminates one or more processes and all of their threads. This tool works only on processes running on the local computer.
This section includes:
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Logger
The Logger tool can be activated through two different vehicles. One way is to use the stand-alone Logger.exe program. The other is to start CDB or WinDbg, and use the
Logexts.dll debugger extensions. Both of these methods will produce the same type of log output. However, the best vehicle to use on any NT-based operating system is CDB
or WinDbg with the Logexts.dll extension commands.
The Logger vehicle works as well, but using the debugger gives you the full power of the debugger along with the power of Logger.
This section includes:
Using the Debugger and Logexts.dll
Using Logger.exe
Logger Restrictions and Limitations
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
!logexts.logb
Displays or flushes the current output buffer. As a performance consideration, log output is flushed to disk only when the output buffer is full. By default, the buffer is
2144 bytes.
Since the buffer memory is managed by the target application, the automatic writing of the buffer to the log files on the disk will not occur if there is an access violation
or some other non-recoverable error in the target application. In such cases, you should use this command to manually flush the buffer to the disk, or else the most
recently-logged APIs may not appear in the log files.
!logexts.logm
Displays or creates a module inclusion/exclusion list. It is often desirable to only log those API calls that are made from a certain module or set of modules. To facilitate
that, Logger allows you to specify a module inclusion list or, alternatively, a module exclusion list. For instance, you would use an inclusion list if you only wanted to log
calls from one or two modules. If you wanted to log calls made from all modules except a short list of modules, you would use an exclusion list. The modules Logexts.dll
and Kernel32.dll are always excluded, since Logger is not permitted to log itself.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Using Logger.exe
One way to activate Logger is to run the stand-alone Logger.exe program. This is essentially a very small debugger that can only take a single target. To run it, include the
name of the target application on the command line:
logger Target
When this is activated, it will load the specified application, and insert code into the target application that will jump off to a routine that loads and initializes Logexts.dll in the
target application process. This is referred to as "injecting Logger into the target application."
The Logger.exe utility and the Logexts.dll module are the two components of this Logger vehicle. They communicate through a shared section of memory that includes the
output file handles, current category mask, and a pointer to the log output buffer.
A window entitled Logger (debugger) will appear. This window will display the progress of Logger.
Change Settings Dialog Box
After the initialization finishes and the initial display is complete, the Change Settings dialog box will appear. This allows you to configure the Logger settings. The various
settings are described here:
API Settings
This list displays the available API categories. The highlighted categories will be logged; the non-highlighted categories will not. The first time you run Logger, all
categories will be highlighted. However, on subsequent runs, Logger will keep track of which categories are selected for a given target application.
If a category is disabled, the hooks for all APIs in that category will be removed so that there is no longer any performance overhead. COM hooks are not removed
because they cannot be re-enabled at will.
Enabling only certain categories can be useful when you are only interested in a particular type of interaction that the program is having with Windows for example,
file operations. This reduces the log file size and also reduces the effect that Logger has on the execution speed of the process.
Logging
This section contains Enable and Disable radio buttons. Disabling logging will cause all API hooks to be removed in an effort to allow the program to run freely. COM
hooks are not removed because they cannot be re-enabled at will.
Inclusion / Exclusion List
This section controls the module inclusion/exclusion list. It is often desirable to log only those function calls that are made from a certain module or set of modules. To
facilitate that, Logger allows you to specify a module inclusion list or, alternatively, a module exclusion list. For instance, you would use an inclusion list if you only
wanted to log calls from one or two module. If you wanted to log calls made from all modules except a short list of modules, you would use an exclusion list. The
modules Logexts.dll and Kernel32.dll are always excluded, since Logger is not permitted to log itself.
Flush the Buffer
This button will flush the current output buffer. As a performance consideration, log output is flushed to disk only when the output buffer is full. By default, the buffer is
2144 bytes.
Since the buffer memory is managed by the target application, the automatic writing of the buffer to the log files on the disk will not occur if there is an access violation
or some other non-recoverable error in the target application. In such cases, you should try to activate the target application's window and hit F12 to get this dialog box
back, and then press Flush the Buffer. If this is not done, the most recently-logged functions might not appear in the log files.
Go
This causes the target application to begin executing.
Running the Target Application
Once you have chosen the settings, click Go. The dialog box will close and the target application will begin to run.
If you make the target application's window active and press F12, it will break into Logger. This will cause the target application to freeze and the Change Settings dialog
box to reappear. You can alter the settings if you wish, and then press Go to continue execution.
You can let the target application run for as long as you wish. If it terminates normally or due to an error, the logging will stop and cannot be restarted.
When you wish to exit, select File | Exit and click Yes. If the target application is still running, it will be terminated.
Limitations of Logger.exe
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
When you are running Logger through the Logger.exe tool, it will create only one output file an .lgv file. No text file will be written. However, a .txt file of size zero will be
created; this could overwrite a text log written by the debugger previously.
The output file will always be placed in LogExts subdirectory of the desktop; this location cannot be changed.
These limitations will not apply if you are running Logger through the debugger and Logexts.dll.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
LogViewer
The LogViewer utility can manipulate an .lgv file, which is a compressed log file produced by the Logger tool. To load a file, simply launch Logviewer.exe through Windows
Explorer or from a Command Prompt window. It will take a moment to parse the manifest files. Once this is complete, you can invoke File | Open and select the desired .lgv
file.
Once LogViewer has opened an .lgv file, it will display a list of all functions in the order they were logged. LogViewer supports powerful commands to filter out functions
that you are not interested in. It can also save a filtered version of the log file as a text file.
This section includes:
Reading the LogViewer Display
Filtering the LogViewer Function List
Exporting LogViewer Files to Text
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
The sequential row number of the function call. This is useful when you have filters applied and are interested to know how far apart two function calls are.
The thread number on which the function call was made. This number is not a thread ID, but is rather an assigned number based on the order that threads were
created in the process.
The instruction address that made the function call. This is derived from the return address for the call. It is actually the return address minus 5 bytes (the typical
size of a call dword ptr instruction).
The module that contains the calling instruction.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
API
Function
Return
Value
The name of the function. The name of the module that contains the function is omitted for brevity.
The value returned by the function, if it is not a void function.
Double-clicking on a row in the viewer will expand the row to reveal the parameters to the function and their values "going in" to the function. If they are designated as OUT
parameters, their value "coming out" is shown on the right.
You can also use the ENTER key or the right and left arrow keys to expand and collapse rows.
Function calls that returned failure status codes are shaded in pink.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
In the main viewing area, selected a function by clicking on it or using the cursor keys. (When a function is selected, LogViewer outlines it in red.) Then, press the
DELETE key, or right-click and select Hide. This will hide all instances of that function call from view.
Select View | APIs Display. A dialog box will appear that has three areas. On the right is an alphabetical listing of all functions, and on the left are categorical
groupings. You can enable or disable the display of any function by checking or clearing the box to the left of its name.
Select View | Modules Display. A dialog box will appear that allows you to select calling modules; only those functions that were called from these modules will be
displayed.
Select View | First Level Calls Only. This will display only calls that have "d0" in the left column. It is often desirable to hide function calls that are made by other
logged functions. (For example, it is usually not interesting to know that ShellExecuteEx makes thirty different registry calls during its course of execution.)
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Designation of OUT parameters. These are parameters that should be logged both on their way into an function and also on their way out.
Definition of flag masks. This feature allows LogViewer to break a DWORD flag into its constituent bit labels for easier reading.
Definition of failure cases. This feature allows LogViewer to shade the rows of functions that have returned a failure status code or another error code. Also, if the
function sets the "LastError" value for the thread, LogViewer can store away the error code and expand it to its corresponding human-readable error message.
Designation of parameters that can be aliased for log differencing. This feature gives LogViewer the option of assigning a constant string to a value that changes from
execution to execution like pointers and handles when it exports the data to a file. You can then use a differencing tool to compare two execution logs for discrepancies.
If pointers and handle values were not aliased, they would produce uninteresting discrepancies when the two files are compared.
All additional manifest files must reside in the same directory as Main.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Module Labels
A module label simply declares what DLL exports the functions that are declared thereafter. For example, if your manifest file is for logging a group of functions from
Comctl32.dll, you would include the following module label before declaring any function prototypes:
module COMCTL32.DLL:
A module label must appear before any function declarations in a manifest file. A manifest file can contain any number of module labels.
Category Labels
Similar to a module label, a category label identifies which "category" all subsequent functions and/or COM interfaces belong to. For example, if you are creating a
Comctl32.dll manifest file, you can use the following as your category label:
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
category CommonControls:
A manifest file can contain any number of category labels.
Function Declarations
A function declaration is what actually prompts Logger to log something. It is nearly identical to a function prototype found in a C/C++ header file. There are a few notable
additions to the format, which can be best illustrated by the following example:
HANDLE [gle] FindFirstFileA(
LPCSTR lpFileName,
[out] LPWIN32_FIND_DATAA lpFindFileData);
The function FindFirstFileA takes two parameters. The first is lpFileName, which is a full path (usually with wildcards) defining where to search for a file or files. The
second is a pointer to a WIN32_FIND_DATAA structure that will be used to contain the search results. The returned HANDLE is used for future calls to FindNextFileA. If
FindFirstFileA returns INVALID_HANDLE_VALUE, then the function call failed and an error code can be procured by calling the GetLastError function.
The HANDLE type is declared as follows:
value DWORD HANDLE
{
#define NULL
#define INVALID_HANDLE_VALUE
};
0 [fail]
-1 [fail]
If the value returned by this function is 0 or -1 (0xFFFFFFFF), Logger will assume that the function failed, because such values have a [fail] modifier in the value declaration.
(See the Value Types section later in this section.) Since there is a [gle] modifier right before the function name, Logger recognizes that this function uses GetLastError to
return error codes, so it captures the error code and logs it to the log file.
The [out] modifier on the lpFindFileData parameter informs Logger that the data structure is filled in by the function and should be logged when the function returns.
);
HRESULT GetTypeInfo(
UINT iTInfo,
LCID lcid,
LPVOID ppTInfo );
HRESULT GetIDsOfNames(
REFIID riid,
LPOLECHAR* rgszNames,
UINT cNames,
LCID lcid,
[out] DISPID* rgDispId );
HRESULT Invoke(
DISPID dispIdMember,
REFIID riid,
LCID lcid,
WORD wFlags,
DISPPARAMS* pDispParams,
VARIANT* pVarResult,
EXCEPINFO* pExcepInfo,
UINT* puArgErr );
};
This declares an interface called IDispatch that is derived from IUnknown. It contains four member functions, which are declared in specific order within the interface's
braces. Logger will intercept and log these member functions by replacing the function pointers in the interface's vtable (the actual binary vector of function pointers used at
run time) with its own. See the COM_INTERFACE_PTR Types section later in this section for more details on how Logger captures interfaces as they are handed out.
Type Definitions
Defining data types is the most important (and most tedious) part of manifest file development. The manifest language allows you to define human-readable labels for
numeric values that are passed in or returned from a function.
For example, Winerror.h defines a type called "WinError" that is a list of error values returned by most Microsoft Win32 functions and their corresponding human-readable
labels. This allows Logger and LogViewer to replace uninformative error codes with meaningful text.
You can also label individual bits within a bit mask to allow Logger and LogViewer to break a DWORD bit mask into its components.
There are 13 basic types supported by the manifest. They are listed in the following table.
Type
Length
Display Example
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Pointer
4 bytes
0x001AF320
VOID
0 bytes
BYTE
1 byte
0x32
WORD
2 bytes
0x0A23
DWORD
4 bytes
-234323
BOOL
1 byte
TRUE
LPSTR
Length byte plus any number of characters
"Quick brown fox"
LPWSTR
Length byte plus any number of Unicode characters "Jumped over the lazy dog"
GUID
16 bytes
{0CF774D0-F077-11D1-B1BC-00C04F86C324}
COM_INTERFACE_PTR 4 bytes
0x0203404A
value
Dependent on base type
ERROR_TOO_MANY_OPEN_FILES
mask
Dependent on base type
WS_MAXIMIZED | WS_ALWAYSONTOP
struct
Dependent on size of encapsulated types
+ lpRect
nLeft 34
nRight 54
nTop 100
nBottom 300
Type definitions in manifest files work like C/C++ typedefs. For example, the following statement defines PLONG as a pointer to a LONG:
typedef LONG *PLONG;
Most basic typedefs have already been declared in Main.h. You should only have to add typedefs that are specific to your component. Structure definitions have the same
format as C/C++ struct types.
There are four special types: value, mask, GUID, and COM_INTERFACE_PTR.
Value Types
A value is a basic type that is broken out into human-readable labels. Most function documentation only refers to the #define value of a particular constant used in a
function. For example, most programmers are unaware of what the actual value is for all the codes returned by GetLastError, making it unhelpful to see a cryptic
numerical value in LogViewer. The manifest value overcomes this by allowing value declarations like as in the following example:
value LONG ChangeNotifyFlags
{
#define SHCNF_IDLIST
0x0000
#define SHCNF_PATHA
0x0001
#define SHCNF_PRINTERA
0x0002
#define SHCNF_DWORD
0x0003
#define SHCNF_PATHW
0x0005
#define SHCNF_PRINTERW
0x0006
};
//
//
//
//
//
//
LPITEMIDLIST
path name
printer friendly name
DWORD
path name
printer friendly name
This declares a new type called "ChangeNotifyFlags" derived from LONG. If this is used as a function parameter, the human-readable aliases will be displayed instead of
the raw numbers.
Mask Types
Similar to value types, a mask type is a basic type (usually a DWORD) that is broken out into human-readable labels for each of the bits that have meaning. Take the
following example:
mask DWORD DirectDrawOptSurfaceDescCapsFlags
{
#define DDOSDCAPS_OPTCOMPRESSED
#define DDOSDCAPS_OPTREORDERED
#define DDOSDCAPS_MONOLITHICMIPMAP
};
0x00000001
0x00000002
0x00000004
This declares a new type derived from DWORD that, if used as a function parameter, will have the individual values broken out for the user in LogViewer. So, if the
value is 0x00000005, LogViewer will display:
DDOSDCAPS_OPTCOMPRESSED | DDOSDCAPS_MONOLITHICMIPMAP
GUID Types
GUIDs are 16-byte globally-unique identifiers that are used extensively in COM. They are declared in two ways:
struct __declspec(uuid("00020400-0000-0000-C000-000000000046")) IDispatch;
or
class __declspec(uuid("11219420-1768-11D1-95BE-00609797EA4F")) ShellLinkObject;
The first method is used to declare an interface identifier (IID). When displayed by LogViewer, "IID_" is appended to the beginning of the display name. The second
method is used to declare a class identifier (CLSID). LogViewer appends "CLSID_" to the beginning of the display name.
If a GUID type is a parameter to a function, LogViewer will compare the value against all declared IIDs and CLSIDs. If a match is found, it will display the IID friendly
name. If not, it will display the 32-hexadecimal-character value in standard GUID notation.
COM_INTERFACE_PTR Types
The COM_INTERFACE_PTR type is the base type of a COM interface pointer. When you declare a COM interface, you are actually defining a new type that is derived
from COM_INTERFACE_PTR. As such, a pointer to such a type can be a parameter to a function. If a COM_INTERFACE_PTR basic type is declared as an OUT
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
parameter to a function and there is a separate parameter that has an [iid] label, Logger will compare the passed in IID against all declared GUIDs. If there is a match and
a COM interface was declared that has the same name as the IID, Logger will hook all the functions in that interface and log them.
Here is an example:
STDAPI CoCreateInstance(
REFCLSID rclsid,
//Class identifier (CLSID) of the object
LPUNKNOWN pUnkOuter, //Pointer to controlling IUnknown
CLSCTX dwClsContext, //Context for running executable code
[iid] REFIID riid,
//Reference to the identifier of the interface
[out] COM_INTERFACE_PTR * ppv
//Address of output variable that receives
//the interface pointer requested in riid
);
In this example, riid has an [iid] modifier. This indicates to Logger that the pointer returned in ppv is a COM interface pointer for the interface identified by riid.
It is also possible to declare a function as follows:
DDRESULT DirectDrawCreateClipper( DWORD dwFlags, [out] LPDIRECTDRAWCLIPPER *lplpDDClipper, IUnknown *pUnkOuter );
In this example, LPDIRECTDRAWCLIPPER is defined as a pointer to the IDirectDrawClipper interface. Since Logger can identify which interface type is being
returned in the lplpDDClipper parameter, there is no need for an [iid] modifier on any of the other parameters.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Remote Tool
The Remote tool, Remote.exe, is a command-line tool that lets you run and control any console program from a remote computer.
The Remote tool includes the following components:
A server application that starts a console program and opens a named pipe for client connections.
A client application that establishes a connection to a server. Commands typed on the client computer are sent to the console application on the server, and the remote
client displays the output from the server's console window.
A query feature that lists the remote sessions running on a server computer.
With the Remote tool, you can start multiple server sessions on a single computer where multiple clients can connect to each session. The sessions are limited only by the
computer's resources.
This is an older tool that has been eclipsed by more sophisticated tools, primarily Remote Desktop. However, because it is simple and uses very few resources, it is still
widely used, typically for remote debugging.
The Remote tool requires that commands be submitted on both the local and remote computers. As such, to use this tool on a computer without a local user, you must develop
an alternate way to submit the commands and to restart the computer, if necessary.
The Remote tool can compromise security on your computer, because it does not authenticate users or use Microsoft Windows permissions. By default, any remote computer
that can connect and provide the session name can use the named pipe that this tool creates, although you can use Remote tool options to include and exclude particular users
and groups.
This section includes:
Remote Tool Concepts
Remote Tool Commands
Remote Tool Examples
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Commands that you type at the client and server computers appear in the Command Prompt windows of both computers.
The Server
The server is the computer on which the console program runs. The Remote Server is the instance of the Remote tool running on the server. The server establishes and names
the remote session (named pipe), issues the command to start the console program, and determines who is permitted to connect to the session.
The Client
The client is a remote computer that sends commands to the console program. The Remote Client is the instance of the Remote tool running on the client computer. The client
connects to the remote session that the server established and uses the remote session (named pipe) that the server created to send commands to the console program that runs
on the server.
The Remote tool supports multiple clients in each remote session. Each client is running one Remote Client. All of the clients can send commands to the console program
running on the server, and all of the clients can see the commands sent and output displayed.
Visible Session
When remote sessions are visible, they appear in the list of remote sessions on the computer. To display the list, use the Remote Server query command (/q).
By default, only debugger sessions are visible, that is, sessions in which the value of the Command parameter include the words kd, dbg, remoteds, ntsd, or cdb; otherwise,
the session is not visible. The Command parameter is part of the Remote tool command on the server.
To make a session visible, add the /v parameter to the Remote Server command. To make a debugger session invisible, add the /-v parameter to the command.
For help with the Remote Server query command, see Remote Server Query Command.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Color
Specifies a color. Valid values are black, blue, green, cyan, red, purple, yellow, white, lblack, lblue, lgreen, lred, lpurple, lyellow, and lwhite.
/u
Specifies users or groups that are permitted to connect to the remote session; by default, everyone is permitted. When you use this parameter, everyone is denied
permission, except for the users and groups specified by the User subparameter.
/ud
Specifies users or groups that are denied permission to connect to the remote session; by default, no one is denied permission.
User
Specifies the name of a user or group in [domain | computer]\{user | group} format. When specifying users or groups on the local computer, omit the computer name.
/v
Makes a session visible. For more information, see Visible Session.
By default, only debugger sessions are visible, that is, sessions in which the value of the Command parameter include the words kd, dbg, remoteds, ntsd, or cdb;
otherwise, the session is not visible.
-v
Makes a remote debugger session invisible. For more information, see Visible Session.
Comments
The Command and SessionName parameters must appear in the order shown on the syntax line.
To end a remote session, type @k. For more information, see Remote Session Commands.
The Remote tool will not create a session that the current user does not have permission to join.
When starting more than one remote session on a single computer, open a new command window for each session. Also, use a different session name for each session.
Because the session names are used to label the named pipes, they must be unique on the computer.
Sample Usage
remote
remote
remote
remote
/s
/s
/s
/q
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Keyword Color File. The format of the keyword color file is as follows. The keyword interpreter is not case sensitive.
The keyword or phrase appears on a line by itself. The colors associated with that keyword appear by themselves on the following line, as shown in the syntax:
Keyword
TextColor[, BackgroundColor]
For example, the following file directs Remote to display lines that include the word "error" in black text on a light red background; to display lines that include the word
"warning" in light blue (on the default background), and lines that include the phrase "Windows Vista" in light green on the default background.
ERROR
black, lred
WARNING
lblue
Windows Vista
lgreen
Sample Usage
remote
remote
remote
remote
/c
/c
/c
/q
Server01 TestSession
Domain1\ComputerA0 "cmd" "My Remote Session"
Server01 TestSession /L 50 /f black /b white /k c:\remote_file.txt
Server01
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Generates a pop-up window on the server computer with the specified message. On client computers, the message appears in the command window. Works on server and
client computers.
@Q
Quit. Disconnects a client computer from the session. Works only on a client computer.
@K
Disconnects all clients and ends the remote session. Works only on a server computer.
Comments
For samples, see "Using the Session Commands" in Remote Tool Examples.
In response to the session commands, the Remote tool displays a label with the day and time that the command was executed. The time for all events is displayed in the time
zone of the server computer.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
ntsd
cmd
The display lists the visible sessions, the console programs running on those sessions (NTSD and the Command Prompt window), and the command that connects to the
session. The session name appears in the command syntax in quotation marks.
The display does not show the permissions established for these sessions, if any. Therefore, the display might include sessions that you do not have permission to join.
Using the Session Commands
You can use the remote session commands at any time during a remote session.
The following command sends a message to all computers connected to the session.
@M I think I found the problem.
As a result, the message appears in the Command Prompt windows of all computers in the session. The message includes the computer name and the day and time of the
message.
@m I think I found the problem.
[SERVER01
When the message is sent from the server computer, "Local" appears in the label instead of the computer name.
@m I think I found the problem.
[Local
The following command generates a pop-up message that appears on the server computer. On all client computers in the session, it writes a message to the Command Prompt
window.
@P Did you see that?
On client computers, the pop-up message appears in the command window.
From SERVER02
To end a remote session, on the server computer, type @k. This command automatically disconnects the clients, and then ends the session.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
TList
TList (Task List Viewer), Tlist.exe, is a command-line tool that displays the processes running on the local computer along with useful information about each process.
TList displays:
All processes running on the computer, along with their process IDs (PIDs).
A tree showing which processes created each process.
Details of the process, including its virtual memory use and the command that started the process.
Threads running in each process, including their thread IDs, entry points, last reported error, and thread state.
The modules running in each process, including the version number, attributes, and virtual address of the module.
You can use TList to search for a process by name or PID, or to find all processes that have loaded a specified module.
In Windows XP and later versions of Windows, TList was replaced by TaskList (Tasklist.exe), which is described in Help and Support for those systems. TList is included in
Debugging Tools for Windows to support users who do not have access to TaskList.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
TList Commands
The syntax of the TList command is as follows:
tlist [/p ProcessName | PID | Pattern | /t | /c | /e | /k | /m [Module] | /s | /v
Parameters
tlist
Without additional parameters, TList displays all running processes, their process identifiers (PIDs), and the title of the window in which they are running, if any.
/p ProcessName
Displays the process identifier (PID) of the specified process.
ProcessName is the name of the process (with or without file name extension), not a pattern.
If the value of ProcessName does not match any running process, TList displays -1. If it matches more than one process name, TList displays only the PID of the first
matching process.
PID
Displays detailed information about the process specified by the PID. For information about the display, see the Comments section below. To find a process ID, type
tlist without additional parameter.
Pattern
Displays detailed information about all processes whose names or window titles match the specified pattern. Pattern can be a complete name or a regular expression.
/t
Displays a task tree in which each process appears as a child of the process that created it.
/c
Displays the command line that started each process.
/e
Displays the session identifier for each process.
/k
Displays the COM components active in each process.
/m Module
Lists tasks in which the specified DLL or executable module is loaded. Module can be a complete module name or a module name pattern.
/s
Displays the services that are active in each process.
/v
Displays details of running processes including the process ID, session ID, window title, command line, and the services running in the process.
Comments
In its detailed display of a process (tlist PID or tlist Pattern), TList displays the following information.
When using the /e parameter, valid session identifiers appear in the process list only under the following conditions. Otherwise, the session identifier is zero (0).
On Windows 2000 and Windows Server 2003, at least one user must be connected to a session other than the console session.
On Windows XP, Fast User Switching must be enabled and more than one user must be connected to the non-console session.
On Windows Vista, where all processes are associated with two Terminal Services sessions by default, at least one user must be connected to the non-console session.
TList Examples
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
System Process
System
smss.exe
csrss.exe
winlogon.exe
services.exe
lsass.exe
svchost.exe
svchost.exe
spoolsv.exe
clisvcl.exe
InoRpc.exe
InoRT.exe
InoTask.exe
WTTSvc.exe
Sysparse_com.exe
explorer.exe
launch32.exe
msmsgs.exe
ctfmon.exe
ISATRAY.EXE
tlist.exe
NetDDE Agent
OleMainThreadWndName
Program Manager
SMS Client User Application Launcher
MSBLNetConn
IsaTray
shp
shp
shp
shp
shp
shp
shp
shp
0x01000000
0x77F50000
0x77E60000
0x77C10000
0x77DD0000
0x78000000
0x77C70000
0x77D40000
Explorer.EXE
ntdll.dll
kernel32.dll
msvcrt.dll
ADVAPI32.dll
RPCRT4.dll
GDI32.dll
USER32.dll
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
....
UMDH
The User-Mode Dump Heap (UMDH) tool, Umdh.exe, analyzes the Microsoft Windows heap memory allocations for a given process. UMDH has the following modes.
Analyze a running process ("Mode 1"). UMDH captures and analyzes the heap memory allocations for a process. For each allocation, UMDH displays the size of the
allocation, the size of the overhead, the pointer to the allocation and the allocation stack. If a process has more than one active memory heap, UMDH captures all heaps.
This analysis can be displayed in realtime or saved in a log file.
Analyze UMDH log files ("Mode 2"). UMDH analyzes the log files it has previously created. UMDH can compare two logs created for the same process at different
times, and display the calls in which the allocation size increased the most. This technique can be used to find memory leaks.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
In the GFlags graphical interface, choose the Image File tab. Type the process name, including the file name extension (for example, Notepad.exe). Press the TAB key,
select Create user mode stack trace database, and then click Apply.
Or, equivalently, use the following GFlags command line, where ImageName is the process name (including the file name extension):
gflags /i ImageName +ust
By default, the amount of stack trace data that Windows gathers is limited to 32 MB on an x86 processor, and 64 MB on an x64 or Itanium-based processor. If you must
increase the size of this database, choose the Image File tab in the GFlags graphical interface, type the process name, press the TAB key, check the Stack Backtrace (Megs)
check box, type a value (in MB) in the associated text box, and then click Apply.
Note: Increase this database only when necessary, because it may deplete limited Windows resources. When you no longer need the larger size, return this setting to its
original value.
These settings affects all new instances of the program. It does not affect currently running instances of the program.
Access the Necessary Symbols
Before using UMDH, you must have access to the proper symbols for your application. UMDH uses the symbol path specified by the environment variable
_NT_SYMBOL_PATH. Set this variable equal to a path containing the symbols for your application.
If you also include a path to Windows symbols, the analysis may be more complete. The syntax for this symbol path is the same as that used by the debugger; for details, see
Symbol Path.
For example, if the symbols for your application are located at C:\MyApp\Symbols, and you have installed the Windows symbol files to \\myshare\winsymbols, you would use
the following command to set your symbol path:
set _NT_SYMBOL_PATH=c:\myapp\symbols;\\myshare\winsymbols
As another example, if the symbols for your application are located at C:\MyApp\Symbols, and you want to use the public Microsoft symbol store for your Windows symbols,
using C:\MyCache as your downstream store, you would use the following command to set your symbol path:
set _NT_SYMBOL_PATH=c:\myapp\symbols;srv*c:\mycache*http://msdl.microsoft.com/download/symbols
Disable BSTR Caching
Automation (formerly known as OLE Automation) caches the memory used by BSTR strings. This can prevent UMDH from correctly determining the owner of a memory
allocation. To avoid this problem, you must disable BSTR caching.
To disable BSTR caching, set the OANOCACHE environment variable equal to one (1). This setting must be made before launching the application whose allocations are to
be traced.
Alternatively, you can disable BSTR caching from within the application itself by calling the .NET Framework SetNoOaCache function. If you choose this method, you
should call this function early, because any BSTR allocations that have already been cached when SetNoOaCache is called will remain cached.
If you need to trace the allocations made by a service, you must set OANOCACHE as a system environment variable and then restart Windows for this setting to take effect.
On Windows 2000, in addition to setting OANOCACHE equal to 1, you must also install the hotfix available with
and later versions of Windows.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
UMDH Commands
UMDH has two different modes, each with its own command syntax and parameters:
-?
-p:2230
-p:2230 -f:dump_allocations.txt
-p:2230 -f:c:\Log1.txt -v:c:\Msg1.txt
-p:2230 -g -f:garbage.txt
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Syntax
umdh [-d] [-v] [-l] File1 [File2] [-h | ?]
Parameters
-d
Displays numeric data in decimal numbers. The default is hexadecimal.
-v
Verbose mode. Includes the traces, as well as summary information. The traces are most helpful when analyzing a single log file.
-l
Includes file names and line numbers in the log. (Please note that the parameter is the lowercased letter "L," not the number one.)
File1 [File2]
Specifies the UMDH log files to analyze.
UMDH creates log files when you run it in the analyze a running process mode and save the log content in a text file (-f).
When you specify one log file, UMDH analyzes the file and displays the function calls in each trace in descending order of bytes allocated.
When you specify two log files, UMDH compares the files and displays in descending order the function calls whose allocations have grown the most between the two
trials.
-h | ?
Displays help.
Sample Usage
umdh dump.txt
umdh -d -v dump.txt
umdh dump1.txt dump2.txt
> result.txt
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
USBView
USBView (Universal Serial Bus Viewer, Usbview.exe) is a Windows graphical user interface application that enables you to browse all USB controllers and connected USB
devices on your computer.
USBView works on all versions of Windows. It is included in the Debugging Tools for Windows package to assist in the discovery of USB ports when initiating a USB
debugging session.
Using USBView
USBView can enumerate USB host controllers, USB hubs, and attached USB devices. It can also query information about the devices from the registry and through USB
requests to the devices.
The main USBView window contains two panes. The left pane displays a connection-oriented tree view, enabling you to select any USB device.
The right pane displays the USB data structures that pertain to the selected USB device. These structures include Device, Configuration, Interface, and Endpoint Descriptors,
as well as the current device configuration.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
AgeStore
The AgeStore tool (agestore.exe) deletes files in a directory or directory tree, based on their last access dates. This program is particularly useful for removing old files from
the downstream store used by a symbol server, in order to conserve disk space.
This section includes:
Using AgeStore
AgeStore Command-Line Options
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Using AgeStore
AgeStore is a tool that deletes files in a directory or directory tree, based on their last access dates. Its primary use is for removing old files from the downstream store used by
a symbol server or a source server, in order to conserve disk space. It can also be used as a general file deletion tool.
AgeStore can delete all files in a single directory (the target directory), or in all the directories within a tree (the target tree). The -s option indicates that an entire tree is to be
targeted.
There are three ways to specify which files within the target directory or target tree are to be deleted. The agestore -date=Month-Day-Year command deletes all files that
were last accessed prior to the specified date. The agestore -days=NumberOfDays command deletes all files that were last accessed more than the specified number of days
ago. The agestore -size=SizeRemaining command deletes all files in the target directory or target tree, beginning with the least-recently-accessed files, until the total size of
the remaining files is less than or equal to SizeRemaining.
For example, the following command deletes all files in C:\MyDir that were last accessed prior to January 7, 2008:
agestore c:\mydir -date=01-07-2008
The following command deletes all files in the directory tree subordinate to C:\symbols\downstreamstore that were last accessed over thirty days ago:
agestore c:\symbols\downstreamstore -days=30 -s
The following command deletes files in the directory tree subordinate to C:\symbols\downstreamstore, beginning with those accessed longest ago, until the total size of all
files in this tree is less than or equal to 50,000 bytes:
agestore c:\symbols\downstreamstore -size=50000 -s
The -l option causes AgeStore to delete no files, but merely to list all the files that would be deleted without this option. Before you use any AgeStore command you should
run the intended command with the -l option added, to verify that it will delete exactly those files you intend it to delete.
For the complete command line syntax, see AgeStore Command-Line Options.
Running AgeStore on Windows Vista and Later
Because AgeStore deletes files based on the last time that they were accessed, it can run successfully only if your your file system stores Last Access Time (LAT) data. In the
NTFS file system, LAT data storage can be either enabled or disabled. If it is disabled, AgeStore will not run, but will display the following error message instead:
Last-Access-Time support is disabled on this computer.
Please read the documentation for more details.
In Windows 2000, Windows XP, and Windows Server 2003, LAT data storage is enabled by default. In Windows Vista and later versions of Windows, LAT data storage is
disabled by default, and therefore AgeStore will not run unless you first enable this data.
In Windows Vista and later versions of Windows, you can use the FSUtil (Fsutil.exe) tool to enable the gathering of LAT data. From a Command Prompt window, issue the
following command:
fsutil behavior set disablelastaccess 0
To disable the gathering of LAT data, using the following command:
fsutil behavior set disablelastaccess 1
These changes take effect after the next restart of Windows.
The FAT32 file system always stores LAT information (although only the date, and not the time, are stored). Therefore, AgeStore works with FAT32 file systems. However,
since AgeStore will not run when the NTFS LAT is disabled, you must enable NTFS LAT even if your file system is FAT32.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
DBH
The DBH tool (dbh.exe) is a command-line tool that displays information about the contents of a symbol file.
DBH exposes the functionality of the DbgHelp API (dbghelp.dll) through a convienient command-line interface. Therefore, its behavior may change as DbgHelp is updated.
The source code for one version of DBH is available in the Windows Software Development Kit (WSDK).
This section includes:
Using DBH
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Using DBH
DBH is a command-line tool that exposes many of the functions in the DbgHelp API (dbghelp.dll). It can display information about the contents of a symbol file, display
specific details of the symbols in the file, and search through the file for symbols matching various criteria.
The functionality provided by DBH is similar to that provided within WinDbg, KD, and CDB by commands such as x (Examine Symbols).
Running DBH in Interactive Mode
You start DBH with a simple command line, on which you specify the target module whose symbols you wish to investigate. See DBH Command-Line Options for the full
syntax.
When DBH starts, it loads the symbols for the specified module, and then presents you with a prompt at which you can type a variety of commands. See DBH Commands for
a list of available commands.
For example, the following sequence starts DBH by specifying the target process with process ID 4672, then executes the enum command at the DBH prompt to display
symbols matching a specific pattern, and then executes the q command to quit DBH:
C:\> dbh -p:4672
400000 : TimeTest
77820000 : ntdll
77740000 : kernel32
pid:4672 mod:TimeTest[400000]: enum TimeTest!ma*
index
1
3
5
address
42cc56 :
415810 :
415450 :
name
main
malloc
mainCRTStartup
pid:4672 mod:TimeTest[400000]: q
goodbye
Running DBH in Batch Mode
If you wish to run only a single DBH command, you can specify it at the end of the command line. This causes DBH to start, load the specified module, run the specified
command, and then exit.
For example, the previous example could be replaced with a single command line:
C:\> dbh -p:4672 enum TimeTest!ma*
400000 : TimeTest
77820000 : ntdll
77740000 : kernel32
index
1
3
5
address
42cc56 :
415810 :
415450 :
name
main
malloc
mainCRTStartup
This method of running DBH is called batch mode, because it can be easily used in batch files. This version of the command line can also be followed by a pipe ( | ) which
redirects the DBH output to another program.
Specifying the Target
DBH can select a target in three ways: by the process ID of a running process, by the name of the executable, or by the name of the symbol file. For example, if there is
exactly one instance of MyProg.exe currently running, with process ID 1234, then the following commands are almost equivalent:
C:\> dbh -v -p:1234
C:\> dbh -v c:\mydir\myprog.exe
C:\> dbh -v c:\mydir\myprog.pdb
One difference between these commands is that when you start DBH by specifying the process ID, DBH uses the actual virtual addresses being used by this process. When
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
you start DBH by specifying the executable name or the symbol file name, DBH assumes that the module's base address is a standard value (for example, 0x01000000). You
can then use the base command to specify the actual base address, thus shifting the addresses of all the symbols in the module.
DBH does not attach to the target process in the way that a debugger does. DBH cannot cause a process to begin or end, nor can it alter how that process runs. For DBH to
attach to a process by its process ID, the target process has to be running, but once DBH has been started the target process can be terminated and DBH will continue to access
its symbols.
Decorated and Undecorated Symbols
By default, DBH uses undecorated symbol names when displaying and searching for symbols. If you turn off the SYMOPT_UNDNAME symbol option, or include the -d
option on the DBH command line, decorations will be included.
For information on symbol decorations, see Public and Private Symbols.
Exiting DBH
To exit DBH, use the q command at the DBH prompt.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
:
:
:
:
:
:
:
:
:
:
:
fgets
414fe0
113
0
7e
400000
0
0
SymTagNull (0)
SymTagFunction (5)
7d
:
:
:
:
:
:
:
:
:
:
:
fgets
414fe0
0
0
0
400000
0
0
SymTagNull (0)
SymTagPublicSymbol (a)
7f
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
:
:
:
:
:
:
:
:
:
:
:
_fgets
414fe0
0
0
0
400000
0
0
SymTagNull (0)
SymTagPublicSymbol (a)
7f
If the -d command-line option had been used, the results would have shown the decorated public name from the beginning.
Determining the Decorations of a Specific Symbol
DBH can determine the decorations on a specific symbol. This can be useful when used in conjunction with a program that requires symbols to be specified with their
decorations, such as PDBCopy.
For example, suppose you know that the symbol file mysymbols.pdb contains a symbol whose undecorated name is MyFunction1. To find the decorated name, use the
following procedure.
First, start DBH without the -d command-line option, and then use the symopt +4000 command so that all information comes from the public symbol table:
C:\> dbh c:\mydir\mysymbols.pdb
mysymbols [1000000]: symopt +4000
Symbol Options: 0x10c13
Symbol Options: 0x14c13
Next, use the name command or the enum command to display the address of the desired symbol:
mysymbols [1000000]: enum myfunction1
index
2ab
address
102cb4e :
name
MyFunction1
Now use symopt -2 to make symbol decorations visible, and then use the addr command with the address of this symbol:
mysymbols [1000000]: symopt -2
Symbol Options: 0x14c13
Symbol Options: 0x14c11
mysymbols [1000000]: addr 102cb4e
_MyFunction1@4
name : _InterlockedIncrement@4
addr : 102cb4e
size : 0
flags : 0
type : 0
modbase : 1000000
value :
0
reg : 0
scope : SymTagNull (0)
tag : SymTagPublicSymbol (a)
index : 2ab
This reveals that the decorated name of the symbol is _MyFunction1@4.
Decoding Symbol Decorations
The undec command can be used to reveal the meaning of C++ symbol decorations. In the following example, the decorations attached to ??_C@_03GGCAPAJC@Sep?
$AA@ are decoded to indicate that it is a string:
dbh: undec ??_C@_03GGCAPAJC@Sep?$AA@
??_C@_03GGCAPAJC@Sep?$AA@ =
`string'
The following examples decode the decorations attached to three function names, revealing their prototypes:
dbh: undec ?gcontext@@3_KA
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
?gcontext@@3_KA =
unsigned __int64 gcontext
:
:
:
:
:
:
:
:
:
:
:
CMDPROC
0
8
0
c
1000000
0
0
SymTagNull (0)
SymTagTypedef (11)
c
The value listed after "tag" specifies the nature of this data type. In this case, SymTagTypedef indicates that this type was defined using a typedef statement.
Using Imaginary Symbols
The add command can add an imaginary symbol to the loaded module. The actual symbol file is not altered; only the image of that file in DBH's memory is changed.
The add command can be useful if you wish to temporarily override which symbols are associated with a given address range. In the following example, a portion of the
address range associated with MyModule!main is overridden by the imaginary symbol MyModule!magic.
Here is how the module appears before the imaginary symbol is added. Note that the main function begins at 0x0042CC56, and has size 0x42B. So when the addr command
is used with the address 0x0042CD10, it recognizes this address as lying within the boundaries of the main function:
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
address
42cc56 :
415810 :
415450 :
name
main
malloc
mainCRTStartup
:
:
:
:
:
:
:
:
:
:
:
main
42cc56
42b
0
2
400000
0
0
SymTagNull (0)
SymTagFunction (5)
1
:
:
:
:
:
:
:
:
:
:
:
main
42cc56
42b
0
2
400000
0
0
SymTagNull (0)
SymTagFunction (5)
1
Now the symbol magic is added at the address 0x0042CD00, with size 0x10 bytes. When the enum command is used, the high bit in the index is set, showing that this is an
imaginary symbol:
pid:6040 mod:MyModule[400000]: add magic 42cd00 10
pid:6040 mod:MyModule[400000]: enum timetest!ma*
index
1
3
5
80000001
address
42cc56 :
415810 :
415450 :
42cd00
name
main
malloc
mainCRTStartup
:
magic
When the addr command is used, it looks for any symbols whose ranges include the specified address. Since this search begins with the specified address and runs backward,
the address 0x004CD10 is now associated with magic. On the other hand, the address 0x004CD40 is still associated with main, because it lies outside the range of the magic
symbol. Note also that the tag SymTagCustom indicates an imaginary symbol:
pid:6040 mod:MyModule[400000]: addr 42cd10
magic+10
name :
addr :
size :
flags :
type :
modbase :
value :
reg :
scope :
tag :
index :
magic
42cd00
10
1000
0
400000
0
0
SymTagNull (0)
SymTagCustom (1a)
80000001
:
:
:
:
:
:
:
:
:
:
main
42cc56
42b
0
2
400000
0
0
SymTagNull (0)
SymTagFunction (5)
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
index : 1
Finally, the del command can delete the symbol magic, returning all the symbols to their original ranges:
pid:6040 mod:MyModule[400000]: del magic
pid:6040 mod:MyModule[400000]: enum timetest!ma*
index
1
3
5
address
42cc56 :
415810 :
415450 :
name
main
malloc
mainCRTStartup
DBH Commands
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
From the DBH command line, you can use a variety of commands to analyze symbols and symbol files.
The following table lists the commands that control the DBH options and perform other basic tasks.
Command
verbose
[on|off]
sympath
[Path]
symopt
Options
Effect
Turns verbose mode on or off. With no parameter, displays the current verbose mode setting.
Sets the symbol search path. With no parameter, displays the current symbol search path.
Sets the symbol options. With no + or -, the value of Options replaces the current symbol options. If + or - is used, Options specifies the options to be added or
removed; there must be a space before the + or - but no space after it. With no parameter, the current symbol options are displayed. When DBH is launched, the
default value of all the symbol options is 0x10C13. For a list of available options, see Setting Symbol Options.
symopt
+Options
symopt Options
symopt
help
quit
The following table lists the commands that load, unload, and rebase the target module. These commands cannot be used if DBH was started by specifying a process ID on the
command line.
Command
Effect
load File
Loads the specified module. File should specify the path, file name, and file name extension of either the executable file or the symbol file.
unload
Unloads the current module.
base Address Sets the default base address to the specified value. All symbol addresses will be determined relative to this base address.
The following table lists the commands that search for files and display directory information.
Command
findexe File
Path
finddbg File
Path
dir File Path
srchtree Path
File
ffpath File
Effect
Locates the specified executable file in the specified path, using the FindExecutableImage routine.
Locates the specified .dbg file in the specified path. Including the .dbg extension is optional.
Locates the specified file in the specified path or in any subdirectory under this path, using the EnumDirTree routine.
Locates the specified file in the specified path or in any subdirectory under this path, using the SearchTreeForFile routine. This command is the same as
dir, except that the parameters are reversed.
Finds the specified file in the current symbol path.
The following table lists the commands that parse the module list and control the default module. The default module and its base address are displayed on the DBH prompt.
Command
mod
Address
refresh
omap
epmod PID
info
obj Mask
src Mask
enummod
Effect
Changes the default module to the module with the specified base address.
Refreshes the module list.
Displays the module OMAP structures.
Enumerates all the modules loaded for the specified process. PID specifies the process ID of the desired process.
Displays information about the currently loaded module.
Lists all object files associated with the default module that match the specified pattern. Mask may contain a variety of wildcard characters and specifiers; see
String Wildcard Syntax for details.
Lists all source files associated with the default module that match the specified pattern. Mask may contain a variety of wildcard characters and specifiers; see
String Wildcard Syntax for details.
Enumerates all loaded modules. There is always at least one module, unless DBH is running without a target, in which case there are none.
The following table lists the commands that display and search for symbols.
Command
enum Module!Symbol
enumaddr Address
addr Address
name [Module!]Symbol
next [Module!]Symbol
Effect
Enumerates all symbols matching the specified module and symbol. Module specifies the module to search (without the file name extension).
Symbol specifies a pattern that the symbol must contain. Both Module and Symbol may contain a variety of wildcard characters and specifiers;
see String Wildcard Syntax for details.
Enumerates all symbols associated with the specified address.
Displays detailed information about the symbols associated with the specified address.
Displays detailed information about the specified symbol. An optional Module specifier may be included. Wildcards should not be used,
because if multiple symbols match the pattern, name only displays the first of them.
Displays detailed information about the next symbol after the specified symbol or address. If a symbol is specified by name, an optional
Module specifier may be included, but wildcards should not be used.
next Address
prev [Module!]Symbol
Displays detailed information about the first symbol previous to the specified symbol or address. If a symbol is specified by name, an optional
Module specifier may be included, but wildcards should not be used.
prev Address
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
line File#LineNum
laddr Address
linenext
lineprev
locals Function [Mask]
type TypeName
elines [Source [Obj]]
index Value
scope Address
Displays the hexadecimal address of the binary instruction associated with the specified source line, and any symbols associated with this line.
Also sets the current line number equal to the specified line number. File specifies the name of the source file, and LineNum specifies the line
number within that file; these should be separated with a number sign ( # ).
Displays the object files associated with the specified source line, and the hexadecimal address of the binary instruction associated with this
line. Does not change the current line number. File specifies the name of the source file, and LineNum specifies the line number within that
file; these should be separated with a space.
Displays the source file and line number corresponding to the symbol located at the specified address.
Increments the current line number, and displays information about the new line number.
Decrements the current line number, and displays information about the new line number.
Displays all local variables contained within the specified function. If Mask is included, only those locals matching the specified pattern are
displayed; see String Wildcard Syntax for details.
Displays detailed information about the specified data type. TypeName specifies the name of the data type (for example, WSTRING). If no
type name matches this value, any matching symbol will be displayed. Unlike most DBH command parameters, TypeName is case-sensitive.
Enumerates all source lines matching the specified source mask and object mask. Source specifies the name of the source file, including the
absolute path and file name extension. Obj specifies the name of the object file, including the relative path and file name extension. Both
Source and Obj may contain a variety of wildcard characters and specifiers; see String Wildcard Syntax for details. If a parameter is omitted
this is equivalent to using the asterisk (*) wildcard. If you do not wish to specify path information, prefix the file name with *\ to indicate a
wildcard path.
Displays detailed information about the symbol with the specified index value.
Displays detailed information about the parent of the specified symbol. The symbol may be specified by address or by name.
scope [Module!]Symbol
srch [mask=Symbol]
[index=Index] [tag=Tag]
[addr=Address] [globals]
uw Address
dtag
etypes
dump
Searches for all symbols that match the specified masks. Symbol specifies the symbol name. It should not include the module name, but it may
contain wildcard characters and specifiers; see String Wildcard Syntax for details. Index specifies the hexadecimal address of a symbol to be
used as the parent for the search. Tag specifies the hexadecimal symbol type classifier (SymTagXxx) value that must match the symbol.
Address specifies the address of the symbol. If globals is included, only global symbols will be displayed.
Displays the unwind information for the function at the specified address.
Displays all the symbol type classifier (SymTagXxx) values.
Enumerates all data types.
Displays a complete list of all symbol information in the target file.
The following table lists the commands that relate to symbol servers and symbol stores.
Command
home [Path]
Effect
Sets the home directory used by SymSrv and SrcSrv for the default
downstream store. If the symbol path contains a reference to a symbol
server that uses a default downstream store, then the sym subdirectory of
the home directory will be used for the downstream store. With no
parameter, home displays the current home directory.
srvpath
Tests whether the specified path is the path of a symbol store.
Path
srvind File Finds the symbol server index that corresponds to the specified file. The symbol
server index is a unique value based on the contents of the file, regardless of
whether it actually has been added to any symbol store. File should specify the file
name and absolute path of the desired file.
fii File
Displays the symbol server indexes for the specified binary file and its associated
files.
getfile File Displays the file with the specified name and symbol server index. File specifies
Index
the name of the desired file; this should not include its path. Index specifies the
symbol server index of the desired file. DBH uses the SymFindFileInPath routine
to search the tree under the current symbol path for a file with this name and this
index.
sup Path
Stores a file in a symbol store, based on the values of the parameters. Path
File1 File2 specifies the directory path of the symbol store. File1 and File2 are used to create
a delta value, which is in turn used to determine the file being stored.
storeadd
Adds the specified file to the specified symbol store. Store should be the root path
File Store
of the symbol store.
The following table lists the DBH commands that apply to real and imaginary symbols.
Command
undec Name
add Name
Address Size
del Name
Effect
Reveals the meaning of the decorations attached to the specified symbol name. Name can be any string; it need not correspond to a currently loaded symbol.
If Name contains C++ decorations, the meaning of these decorations is displayed.
Adds the specified imaginary symbol to the list of symbols loaded in DBH. Name specifies the name of the symbol to be added, Address specifies its
hexadecimal address, and Size its hexadecimal size in bytes. This is treated like any other symbol in later DBH commands, until the DBH session is ended
with quit or unload, or until the imaginary symbol is deleted with del. The actual target symbol file is not altered.
Deletes an imaginary symbol previously added with the add command. The symbol can be specified either by name or by address. This cannot be used to
delete real symbols.
del Address
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
PDBCopy
The PDBCopy tool (pdbcopy.exe) is a command-line tool that removes private symbol information from a symbol file. It can also remove selected information from the public
symbol table.
This section includes:
Using PDBCopy
Choosing Which Public Symbols to Remove
PDBCopy Command-Line Options
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Using PDBCopy
PDBCopy is a command-line tool that creates a stripped symbol file from a full symbol file. In other words, it takes a symbol file that contains both private symbol data and a
public symbol table, and creates a copy of that file that contains only the public symbol table. Depending on which PDBCopy options are used, the stripped symbol file
contains either the entire public symbol table or a specified subset of the public symbol table.
PDBCopy works with any PDB-format symbol file (with file name extension .pdb), but not with the older format (.dbg) symbol files.
For a description of public symbol tables and private symbol data, see Public and Private Symbols.
Removing Private Symbols
If you wish to create a stripped symbol file that contains all the public symbols and none of the private symbols, use PDBCopy with three parameters: the path and name of
the original symbol file, the path and name of the new symbol file, and the -p option.
For example, the following command creates a new file, named publicsymbols.pdb, which contains the same public symbol table as mysymbols.pdb but contains none of the
private symbol data:
pdbcopy mysymbols.pdb publicsymbols.pdb -p
If mysymbols.pdb happens to already be a stripped symbol file, the symbolic content of the new file and the old file will be identical.
After issuing this command, you should move the new file to a new location and rename it to the original name of the symbol file (in this example, mysymbols.pdb), because
most debugging programs and symbol extraction programs look for symbols based on a specific file name. Alternatively, you could use the same file name for the input file
and the output file on the PDBCopy command line, as long as different directories are specified:
pdbcopy c:\dir1\mysymbols.pdb c:\dir2\mysymbols.pdb -p
Note The destination file should not exist before PDBCopy is run. If a file with this name exists, various errors may occur.
Removing Private Symbols and Selected Public Symbols
If you wish to not only remove the private symbol data, but also reduce the amount of information in the public symbol table, you can use the -f option to specify a list of
public symbols that are to be removed.
The following example illustrates this procedure:
1. Determine the full names, including decorations, of the symbols you wish to remove. If you are not sure of the decorated symbol names, you can use the DBH tool to
determine them. See Determining the Decorations of a Specific Symbol for details. In this example, let us suppose that the decorated names of the symbols you wish to
remove are _myGlobal1 and _myGlobal2.
2. Create a text file containing a list of the symbols to be removed. Each line in this file should include the name of one symbol, including decorations, but not including
module names. In this example, the file would contain the following two lines:
_myGlobal1
_myGlobal2
The file can be given any name you choose. Let us suppose that you name this file listfile.txt and place it in the directory C:\Temp.
3. Use the following PDBCopy command line:
pdbcopy OldPDB NewPDB -p -f:@TextFile
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
where OldPDB and NewPDB are the original symbol file and the new symbol file, and TextFile is the file created in step two. The -f option indicates that certain public
symbols are to be removed, and the ampersand ( @ ) indicates that these symbols are listed in the specified text file.
In the current example, the command would look like this:
pdbcopy c:\dir1\mysymbols.pdb c:\dir3\mysymbols.pdb -p -f:@c:\temp\listfile.txt
This creates a new symbol file, C:\dir2\mysymbols.pdb, which does not contain any private symbols and does not contain the two global variables you listed in
listfile.txt.
As shown in this example, PDBCopy's -f option removes a specific list of public symbols. The ampersand ( @ ) indicates that these symbols are listed in a text file. An
alternate method is to list all the symbols on the command line, using the -f option without an ampersand. Thus the following command line is equivalent to the example in
the procedure above:
pdbcopy c:\dir1\mysymbols.pdb c:\dir3\mysymbols.pdb -p -f:_myGlobal1 -f:_myGlobal2
Unless you wish to remove only one or two symbols, it is simpler to use a text file than to list them on the command line.
If you wish to remove the majority of public symbols from your .pdb file, the -F option is the easiest method. While the -f option requires you to list those public symbols you
wish to remove, the -F option requires you to list those public symbols you do not wish to remove. All other public symbols (as well as all private symbols) will be removed.
The -F option supports the same two syntax options as the -f option: either -F: followed by the name of a symbol to be retained, or -F:@ followed by the name of a text file
that contains a list of the symbols to be retained. In either case, decorated symbol names must be used.
For example, the following command removes all private symbols and almost all public symbols, leaving only the symbols _myFunction5 and _myGlobal7:
pdbcopy c:\dir1\mysymbols.pdb c:\dir3\mysymbols.pdb -p -F:_myFunction5 -F:_myGlobal7
If you combine multiple instances of the -f option on one line, all the specified symbols are removed. If you combine multiple instances of the -F option on one line, all the
specified symbols are retained, and all other symbols are removed. You cannot combine -f with -F.
The -f and -F options cannot be used without the -p option, which removes all private symbol data. Even if your original file contains no private symbols, you must still
include the -p option (although it has no effect in this case).
The -F option cannot be used to prevent the private symbol data from being removed. If you use this option with a symbol that is not included in the public symbol table,
PDBCopy ignores it.
The mspdb*.dll File
PDBCopy must access either the mspdb80.dll file or the mspdb60.dll file in order to run. By default, PDBCopy uses mspdb80.dll, which is the version used by Visual
Studio .NET 2002 and later versions of Visual Studio. If your symbols were built using Visual Studio 6.0 or an earlier version, you can specify the -vc6 command-line option
so that PDBCopy uses mspdb60.dll instead, although this is not required. PDBCopy looks for the appropriate file even if the -vc6 option is not used. You can find these files
within your installation of Visual Studio, the Platform SDK, or the Windows Driver Kit (WDK).
Before running PDBCopy, make sure that the correct version of mspdb*.dll file is accessible to your computer, and make sure that its location is part of the command path. If
it is not, you should use the path command to add this location to the command path.
The File Signature and the SymSrv Index
Each symbol file has a fixed signature that uniquely identifies it. SymSrv uses the signature to generate a unique "index value" for the file. If two files have different contents
or different creation times, they will also have distinct signatures and distinct SymSrv index values.
Files created with PDBCopy are an exception to the rule of unique index values. When PDBCopy creates a new symbol file, it has the same signature and SymSrv index value
as the old file. This feature allows one file to be replaced with the other without altering the behavior of symbol-related tools.
If you wish the new file to have a distinct signature and SymSrv index, use the -s option. In most cases you will not wish to use this option, since the most common use of
PDBCopy is to create an altered symbol file that can replace the old file without causing a mismatch. A new signature may cause SymSrv to assign a different index value to
the new file than to the old file, preventing new file from properly replacing the old one.
For the complete command line syntax, see PDBCopy Command-Line Options.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Suppose that you write a Windows driver and you use PDBCopy to remove all public symbols from its symbol file, except for FunctionOne and FunctionSix, two inert
functions. Your expectation is that if either FunctionOne or FunctionSix are found on the stack after a crash, they will be ignored by OCA. If any other part of your driver is
on the stack, Microsoft will supply you with the corresponding memory address and you can use the address to debug your driver.
However, let us suppose that your driver occupies memory in the following layout:
Address
Contents of memory
0x1000 Base address of the module
0x2000 Beginning of FunctionOne
0x203F End of FunctionOne
0x3000 Beginning of FunctionSix
0x305F End of FunctionSix
0x7FFF End of the module in memory
If the debugger finds an address on the stack, it selects the symbol with the next lower address. Since the public symbol table contains the address of each symbol but no size
information, there is no way for the debugger to know if an address actually falls within the boundaries of any specific symbol.
Therefore, if a fault occurs at address 0x2031, the debugger run by Microsoft OCA correctly identifies the fault as lying within FunctionOne. Since this is an inert function,
the debugger continues walking the stack to find the cause of the crash.
However, if a fault occurs at 0x2052, the debugger still matches this address to FunctionOne, even though it lies beyond the actual end of this function (0x203F).
Consequently, you must include in your stripped symbol file not only the functions you wish to expose, but also the symbols immediately following these functions. In this
example, you would wish to expose FunctionOne, FunctionTwo, FunctionSix, and FunctionSeven:
Address
Contents of memory
0x1000 Base address of the module
0x2000 Beginning of FunctionOne
0x203F End of FunctionOne
0x2040 Beginning of FunctionTwo
0x3000 Beginning of FunctionSix
0x305F End of FunctionSix
0x3060 Beginning of FunctionSeven
0x7FFF End of the module in memory
If you include all four of these functions in the stripped symbol file, then the Microsoft OCA analysis will not mistakenly treat the address 0x2052 as part of FunctionOne. In
this example it will assume that this address is part of FunctionTwo, but that is not important because you have not registered FunctionTwo with OCA as an inert function.
The important thing is that the address 0x2052 is recognized as not falling within an inert function, and therefore OCA will recognize this as a meaningful fault within your
driver and can inform you of the fault.
If you do not wish to publicize the names of the functions following each inert function, you can insert unimportant functions into your code following each inert function so
that the names of these functions can be included in your public symbol file. Be sure to verify that these added functions do indeed follow your inert functions in your binary's
address space, since some optimization routines may alter this, or even remove some functions entirely.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Causes PDBCopy to remove the specified public symbol from the new symbol file. Symbol must specify the name of the symbol to be removed, including any symbol
name decorations (for example, initial underscores), but not including the module name. This option requires the -p option. If you use multiple -f or -f:@ parameters,
PDBCopy removes all the specified symbols from the new symbol file.
-f:@TextFile
Causes PDBCopy to remove the public symbols listed in the specified text file from the new symbol file. TextFile specifies the file name and path (absolute or relative)
of this file. This file can list the names of any number of symbols, one on each line, including any symbol name decorations (for example, initial underscores), but not
including module names. This option requires the -p option.
-F:Symbol
Causes PDBCopy to remove all public and private symbols from the new symbol file, except for the specified public symbol. Symbol must specify the name of the
symbol to be retained, including any symbol name decorations (for example, initial underscores), but not including the module name. This option requires the -p option.
If multiple -F or -F:@ parameters are used, all the specified symbols are retained in the new symbol file.
-F:@TextFile
Causes PDBCopy to remove all public and private symbols from the new symbol file, except for the public symbols listed in the specified text file. TextFile specifies the
file name and path (absolute or relative) of this file. This file can list the names of any number of symbols, one on each line, including any symbol name decorations (for
example, initial underscores), but not including module names. This option requires the -p option.
Options
Any combination of the following options. These options are case-sensitive.
-s
Causes the new symbol file to have a different signature than the old file. Normally you should not use the -s option, because a new signature may cause SymSrv to
assign a different index value to the new file than to the old file, preventing new file from properly replacing the old one.
-vc6
Causes PDBCopy to use mspdb60.dll instead of mspdb80.dll. This option is never required, because PDBCopy automatically looks for the proper version of
mspdb*.dll. By default, PDBCopy uses mspdb80.dll, which is the version used by Visual Studio .NET 2002 and later versions of Visual Studio. If your symbols
were built using Visual Studio 6.0 or an earlier version, you can specify this command-line option so that PDBCopy will use mspdb60.dll instead. However, this is
not required, since PDBCopy looks for the appropriate file even if this option is not used. Whichever version of mspdb*.dll you use must be in the executable path of
the Command Prompt window from which you launch PDBCopy.
-?
Displays help text for the PDBCopy command line.
Additional Information
For more information about the PDBCopy tool, see Using PDBCopy.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SrcSrv
The SrcSrv tool (Srcsrv.dll) enables a client to retrieve the exact version of the source files that were used to build an application. Because the source code for a module can
change between versions and over the course of years, it is important to look at the source code as it existed when the version of the module in question was built.
SrcSrv retrieves the appropriate files from source control. To use SrcSrv, the application must have been source-indexed.
This section includes:
Using SrcSrv
Source Indexing
Source Control Systems
HTTP Sites and UNC Shares
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Using SrcSrv
To use SrcSrv with WinDbg, KD, NTSD, or CDB, verify that you have installed a recent version of the Debugging Tools for Windows package (version 6.3 or later). Then,
include the text srv* in the source path, followed by the directory specification or UNC path of the source store:
srv*SourceStoreLocation
For example:
.srcpath srv*\\myserver\myshare;c:\mylocaldir
Note that this example also includes a local source path element (c:\mylocaldir). If the debugger cannot retrieve the file using SrcSrv, it searches the specified path.
Regardless of whether srv* is the first element in the path or appears later, the source server is always searched before any other source path elements.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
If a source file is retrieved by SrcSrv, it remains on your hard drive after the debugging session is over. Source files are stored locally in the src subdirectory of the home
directory (unlike the symbol server, the source server does not specify a local cache in the srv* syntax itself). The home directory defaults to the Debugging Tools for
Windows installation directory; it can be changed by using the !homedir extension or by setting the DBGHELP_HOMEDIR environment variable. If the src subdirectory of
the home directory does not already exist, it is created.
Debugging SrcSrv
If you experience any trouble extracting the source files from the debugger, start the debugger with the n command-line parameter to view the actual source extraction
commands along with the output of those commands. The !sym noisy command does the same thing, but you may have already missed important information from previous
extraction attempts. This is because the debugger gives up trying to access source from version control repositories that appear to be unreachable.
Retrieving Source Files
If you use the .open (Open Source File) command to open a new source file through SrcSrv, you must include the -m Address parameter.
To facilitate the use of SrcSrv from tools other than the debuggers listed previously, the DbgHelp API provides access to SrcSrv functionality through the SymGetSourceFile
function. To retrieve the name of the source file to be retrieved, call the SymEnumSourceFiles or SymGetLineFromAddr64 function. For more details on the DbgHelp
API, see the dbghelp.chm documentation, which can be found in the sdk/help subdirectory of the Debugging Tools for Windows installation directory, or see Debug Help
Library on MSDN.
Using AgeStore to Reduce the Cache Size
Any source files downloaded by SrcSrv remain on your hard drive after the debugging session is over. To control the size of the source cache, the AgeStore tool can be used
to delete cached files that are older than a specified date or to reduce the contents of the cache below a specified size. For details, see AgeStore.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Source Indexing
Generally, binaries are source-indexed during the build process after the application has been built. The information needed by SrcSrv is stored in the .pdb files. SrcSrv
currently supports the following source control systems:
Perforce
Microsoft Visual SourceSafe
Microsoft Team Foundation Server
You can also create a custom script to index your code for a different source control system. One such module for Subversion is included in this package. Anyone interested in
using SrcSrv with CVS should send e-mail to [email protected].
SrcSrv includes five tools that are used in the source indexing process:
The Srcsrv.ini File
The Ssindex.cmd Script
The SrcTool Utility
The PDBStr Tool
The VSSDump Tool
These tools are installed with Debugging Tools for Windows in the subdirectory srcsrv, and should remain installed in the same path as SrcSrv. The PERL scripts in these
tools require PERL 5.6 or later.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
This file can also be installed on the computer running the debugger. When SrcSrv starts, it looks at Srcsrv.ini for values; these values override the information contained in
the .pdb file. This enables users to configure a debugger to use an alternative source control server at debug time. However, if you manage your servers well and do not
rename them, there should be no need to include this file with your client debugger installations.
This file also serves other purposes on the client side. For more information, see the sample Srcsrv.ini file installed with SrcSrv tools.
Using a Different Location or File Name
By default, SrcSrv uses as its master configuration file the file named Srcsrv.ini, located in the srcsrv subdirectory of the Debugging Tools for Windows installation directory.
You can specify a different file for configuration by setting the SRCSRV_INI_FILE environment variable equal to the full path and file name of the desired file.
For example, if several people want to share a single configuration file, they could place it on a share accessible to all of their systems, and then set an environment variable
like the following:
set SRCSRV_INI_FILE=\\ourserver\ourshare\bestfile.txt
p4.pm (Perforce)
vss.pm (Visual SourceSafe)
tfs.pm (Team Foundation Servers)
svn.pm (Subversion)
For more information, run Ssindex.cmd with the -? or -?? (verbose help) option or examine the script.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
-f
Causes VSSDump to list directories containing source files without listing the files themselves.
-i
Causes VSSDump to ignore the current directory and list the entire project. This option may not be used with r.
-s
Causes VSSDump to format ouput for use with script files.
-c
Causes VSSDump to display only the Virtual SourceSafe configuration information.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
However, this mode of operation is incompatible with SrcSrv indexing. SrcSrv requires that a working folder be specified. To set the working folder, use the command:
ss.exe workfold Project Folder
where Project indicates the current project and Folder indicates the location corresponding to the root of the project.
Labels
Visual SourceSafe cannot determine what version of a file exists within the working directory of a build machine. Consequently, you must use labels to stamp the project with
an identifier that is used to extract source files on the debugger client. Thus, before indexing, you must verify that all changes are checked into the database and then apply a
label to the project. Labels can be applied using the command:
ss.exe label Project
where Project indicates the current project.
In the following example, the label VERSION_3 is applied to a project called $/sdktools:
E:\nt\user>ss.exe label $/sdktools
Label for $/sdktools: VERSION_3
Comment for $/sdktools:
This is a comment.
After the label is applied, you can specify this label to the SrcSrv indexing script by setting the environment variable, SSLABEL, or by passing it as a command-line
parameter, as in the following example:
vssindex.cmd label=VERSION_3
Again, this label is required for SrcSrv indexing to work. Note that if you pass a label that does not exist in the project, it can take a long time for the script to complete and
the results are of no use.
Credentials
If your Visual SourceSafe database requires a user and optional password for access, these values must be set through the SSUSER and SSPWD environment variables. This
applies not only at the time the build is indexed, but also on the debugger client.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Using CVS
The CVS module for Source Server was developed using Concurrent Versions System (CVS) 1.11.17 (client). It has not been tested with any other versions of CVS.
Furthermore, the current version of the module is a beta version.
CVSROOT
On the computer on which you source index the build, CVSROOT cannot contain password and user information. Use cvs.exe to set your credentialing information.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
To prepare the Srcsrv.ini file for CVS indexing you must enter an alias for your repository that uniquely distinguishes it from any others in your network. This repository must
match the value of CVSROOT in your environment. There is no need to set this value in the copy of Srcsrv.ini that you keep with your debugger clients because the alias is
defined in the source indexed .pdb file.
Client Computer
The client computer that extracts files during debugging does not need a CVS sandbox or CVSROOT set. It does need CVS binaries in the path, and if the repository is
locked, you must set the username and password with Cvs.exe.
Revision Tags
CVS is unable to extract a file by its version number. Instead, it must be done using what is known as a tag. When indexing a CVS-based system, you must ensure that all
changes are checked into the repository and then apply a tag using the cvs tag command. Then, when indexing the file, make certain you use the label command-line
parameter to specify the tag that you want to associate with the build you are indexing. You can achieve the same result by setting CVS_LABEL in the environment. Other
values can be set from the environment or the command line. Use the -?? command-line option with SSIndex to examine your choices and to verify that all was configured
correctly:
ssindex.cmd system=cvs -??
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
$SourcePath
The local directory containing the source to be indexed.
$ServerHashReference
A reference to a hash containing all of the entries from the specified Srcsrv.ini file.
Return Value
None
($VariableHashReference, $FileEntry) = $objref->GetFileInfo($LocalFile)
Purpose
Provides the necessary information to extract a single, specific file from the source control system.
Parameters
$LocalFile
A fully qualified file name.
Return Values
$VariableHashReference
A hash reference of the variables necessary to interpret the returned $FileEntry. Ssindex.cmd caches these variables for every source file used by a single debug
file to reduce the amount of information written to the source index stream.
$FileEntry
The file entry to be written to the source index stream to allow SrcSrv to extract this file from source control. The exact format of this line is specific to the
source control system.
$TextString = $objref->LongName()
Purpose
Provides a descriptive string to identify the source control system to the end user.
Parameters
None
Return Value
$TextString
The descriptive name of the source control system.
@StreamVariableLines=$objref->SourceStreamVariables()
Purpose
Enables the source control system to add source-control-specific variables to the source stream for each debug file. The sample modules use this method for writing
the required EXTRACT_CMD and EXTRACT_TARGET variables.
Parameters
None
Return Value
@StreamVariableLines
The list of entries for the source stream variables.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Language Specification 1
The first version of SrcSrv works as follows. (This behavior may change in future versions.)
First, the client calls SrcSrvInit with the target path to be used as a base for all source file extractions. This path is stored in the special variable TARG.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
When DbgHelp loads a modules .pdb file, it extracts the SrcSrv stream from the .pdb file and passes this data block to SrcSrv by calling SrcSrvLoadModule.
Then when DbgHelp needs to obtain a source file, it calls SrcSrvGetFile to retrieve a specified source file from version control.
SrcSrv reviews all the source file entries in the data block for an entry that matches exactly the requested source specification. This match is found in VAR1.
After SrcSrv finds the entry, it fills in the special variables (VAR1, VAR2, etc.) with the contents of this source file entry. Then the SRCSRVTRG variable is resolved using
these special variables.
The following shows how the SRCSRVTRG variable is resolved using the special variables. We assume that the source path is still:
c:\proj\src\file.cpp*TOOLS_PRJ*tools/mytool/src/file.cpp*3
Each line shows the resolution of one more special variable. The resolved variables are bold.
SRCSRVTRG=%sdtrg%
SDTRG=%targ%\%var2%\%fnbksl%(%var3%)\%var4%\%fnfile%(%var1%)
c:\src\%var2%\%fnbksl%(%var3%)\%var4%\%fnfile%(%var1%)
c:\src\WIN_SDKTOOLS\%fnbksl%(%var3%)\%var4%\%fnfile%(%var1%)
c:\src\WIN_SDKTOOLS\%fnbksl%( sdktools/debuggers/srcsrv/shell.cpp )\%var4%\%fnfile%(%var1%)
c:\src\WIN_SDKTOOLS\ sdktools\debuggers\srcsrv\shell.cpp\%var4%\%fnfile%(%var1%)
c:\src\WIN_SDKTOOLS\sdktools\debuggers\srcsrv\shell.cpp\3\%fnfile%(%var1%)
c:\src\WIN_SDKTOOLS\sdktools\debuggers\srcsrv\shell.cpp\3\%fnfile%( c:\db\srcsrv\shell.cpp)
c:\src\WIN_SDKTOOLS\sdktools\debuggers\srcsrv\shell.cpp\3\shell.cpp
Notice how this generated target path is unique and does not allow two versions of the same file to be extracted to the same location.
SrcSrv now looks to see if the file is already there. If it is, SrcSrv returns the location to the caller. Otherwise, SrcSrv builds the execution command to extract the file by
resolving SRCSRVCMD.
In the following example, each line shows the resolution of one more special variable. The resolved variables are bold.
DEPOT=//depot
WIN_SDKTOOLS= sserver.microsoft.com:4444
SRCSRVCMD=%sdcmd%
SDCMD=sd.exe -p %fnvar%(%var2%) print -o %srcsrvtrg% -q %depot%/%var3%#%var4%
sd.exe -p %fnvar%(WIN_SDKTOOLS) print -o %srcsrvtrg% -q %depot%/%var3%#%var4%
sd.exe -p sserver.microsoft.com:4444 print -o %srcsrvtrg% -q %depot%/%var3%#%var4%
sd.exe -p sserver.microsoft.com:4444 print -o c:\src\WIN_SDKTOOLS\sdktools\debuggers\srcsrv\shell.cpp\3\shell.cpp
sd.exe -p sserver.microsoft.com:4444 print -o c:\src\WIN_SDKTOOLS\sdktools\debuggers\srcsrv\shell.cpp\3\shell.cpp
sd.exe -p sserver.microsoft.com:4444 print -o c:\src\WIN_SDKTOOLS\sdktools\debuggers\srcsrv\shell.cpp\3\shell.cpp
sd.exe -p sserver.microsoft.com:4444 print -o c:\src\WIN_SDKTOOLS\sdktools\debuggers\srcsrv\shell.cpp\3\shell.cpp
-q %depot%/%va
-q //depot
-q //depot/ sd
-q
Now SrcSrv executes this command. If the result of this command is a file in the expected location, this path is returned to the caller.
Note that if a variable cannot be resolved, an attempt is made to look it up as an OS environment variable. If that fails, the variable name is deleted from the text being
processed.
Two consecutive percent sign characters are interpreted as a single percent sign.
Source Server Data Blocks
SrcSrv relies on two blocks of data within the .pdb file, the source file list and the data block.
The source file list is created automatically when a module is built. This list contains fully qualified paths to the source files used to build the module.
The data block is created during source indexing. At this time, an alternative stream named "srcsrv" is added to the .pdb file. The script that inserts this data is dependent on
the specific build process and source control system in use.
The data block is divided into three sections: ini, variables, and source files. The data block has the following syntax.
SRCSRV: ini -----------------------------------------------VERSION=1
VERCTRL=<source_control_str>
DATETIME=<date_time_str>
SRCSRV: variables -----------------------------------------SRCSRVTRG=%sdtrg%
SRCSRVCMD=%sdcmd%
SRCSRVENV=var1=string1\bvar2=string2
DEPOT=//depot
SDCMD=sd.exe -p %fnvar%(%var2%) print -o %srcsrvtrg% -q %depot%/%var3%#%var4%
SDTRG=%targ%\%var2%\%fnbksl%(%var3%)\%var4%\%fnfile%(%var1%)
WIN_SDKTOOLS= sserver.microsoft.com:4444
SRCSRV: source files --------------------------------------<path1>*<var2>*<var3>*<var4>
<path2>*<var2>*<var3>*<var4>
<path3>*<var2>*<var3>*<var4>
<path4>*<var2>*<var3>*<var4>
SRCSRV: end -----------------------------------------------All text is interpreted literally, except for text enclosed in percent signs (%). Text enclosed in percent signs is treated as a variable name to be resolved recursively, unless it is
one of the following functions:
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
%fnvar%()
The parameter text should be enclosed in percent signs and treated as a variable to be resolved.
%fnbksl%()
All forward slashes (/) in the parameter text should be replaced with backward slashes (\).
%fnfile%()
All path information in the parameter text should be stripped out, leaving only the file name.
The [ini] section of the data block contains variables that describe the requirements. The indexing script can add any number of variables to this section. The following are
examples:
VERSION
The language specification version. This variable is required. If you develop a script based on the current language specification, set this value to 1. The SrcSrv client
code does not attempt to execute any script that has a value greater than its own. Current versions of SrcSrv use a value of 2.
VERCTL
A string that describes the source version control system. This variable is optional.
DATETIME
A string that indicates the date and time the .pdb file was processed. This variable is optional.
The [variables] section of the data block contains variables that describe how to extract a file from source control. It can also be used to define commonly used text as
variables to reduce the size of the data block.
SRCSRV
Describes how to build the target path for the extracted file. This is a required variable.
SRCSRVCMD
Describes how to build the command to extract the file from source control. This includes the name of the executable file and its command-line parameters. This is
required if any extraction command must be executed.
SRCSRVENV
Lists environment variables to be created during the file extraction. This is a string. Separate multiple entries with a backspace character (\b). This is an optional variable.
SRCSRVVERCTRL
Specifies the version control system in use. For Perforce, this is perforce. For Visual SourceSafe, this is vss. For Team Foundation Server, this is tfs. This variable is used
to persist server errors. This is an optional variable.
SRCSRVVERRDESC
Specifies the text to display when the version control client is unable to contact the server that contains the source files to extract. SrcSrv uses this value to check for
connection problems. This is an optional variable.
SRCSRVERRVAR
Indicates which variable in a file entry corresponds to a version control server. It is used by SrcSrv to identify commands that do not work, based on previous failures.
The format of the text is varX where X is the number of the variable being indicated. This is an optional variable.
The [source files] section of the data block contains an entry for each source file that has been indexed. The contents of each line are interpreted as variables with the names
VAR1, VAR2, VAR3, and so on until VAR10. The variables are separated by asterisks. VAR1 must specify the fully qualified path to the source file as listed elsewhere in
the .pdb file. For example:
c:\proj\src\file.cpp*TOOLS_PRJ*tools/mytool/src/file.cpp*3
is interpreted as follows:
VAR1=c:\proj\src\file.cpp
VAR2=TOOLS_PRJ
VAR3=tools/mytool/src/file.cpp
VAR4=3
In this example, VAR4 is a revision number. However, most source control systems support labeling files in such a way that the source state for a given build can be restored.
Therefore, you could instead use the label for the build. The sample data block could be modified to contain a variable such as the following:
LABEL=BUILD47
Then, presuming the source control system uses the at sign (@) to indicate a label, you could modify the SRCSRVCMD variable as follows:
sd.exe -p %fnvar%(%var2%) print -o %srcsrvtrg% -q %depot%/%var3%@%label%
Handling Server Errors
Sometimes a client is unable to extract any files at all from a single version control server. This can be because the server is down and off the network or because the user does
not have appropriate privileges to access the source. However, the time consumed attempting to get this source can slow things down significantly. In this situation, it is best
to disable any attempt to extract from a source that has been proven to be unavailable.
Whenever SrcSrv fails to extract a file, it examines the output text produced by the command. If any part of this command contains an exact match for the contents of the
SRCSRVERRDESC, all future commands to the same version control server are skipped. Note that you can define multiple error strings by adding numbers or arbitrary text
to the end of the SRCSRVERRDESC variable name. Here is an example:
SRCSRVERRDESC=lime: server not found
SRCSRVERRDESC_2=pineapple: network error
The identity of the server is acquired from SRCSRVERRVAR. So if SRCSRVERRVAR contains var2 and the file entry in the .pdb file looks like this:
c:\proj\src\file.cpp*TOOLS_PRJ*tools/mytool/src/file.cpp*3
all future attempts to obtain source using a file entry that contains TOOLS_PRJ in variable 2 are bypassed.
You can also add error indicators on the debugger client by editing Srcsrv.ini. See the included sample version of srcsrv.ini for details.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Language Specification 2
This package ships with a srcsrv.dll that can operate without SRCSRVCMD being defined in the srcsrv data stream of a .pdb file. While such capability is of no use for
normal file extraction from source control systems, it is useful for direct access of files from a UNC share or HTTP site. See HTTP Sites and UNC Shares for more details.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
The source directory can now be used for debugging by another computer with a source path of srv*\\SrcMachineName\source.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
This script requires that all the standard SrcSrv tools be available in the path because it calls both SrcTool and PDBStr. Remember that Cv2http.pl is a Perl script and can be
modified to meet your needs.
The third file, the Walk (walk.cmd) script, modifies an entire set of .pdb files. For example:
walk.cmd *.pdb cv2http.cmd SourceRoot \\server\share
The preceding command calls Cv2http.cmd on every .pdb file in a tree, using SourceRoot for the alias and \\server\share for the UNC share. For more details on Walk, see
Extracting Source Files.
After this command is executed on a tree of .pdb files, they are ready for installation into the Web site or whatever location in which you want to put them. Remember that
you can use SrcTool and PDBStr to examine the changes to the .pdb files.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Using HTTP Sites and UNC Shares in Conjuction with Regular Version Control
You may find that you must support your developers using the standard SrcSrv functionality that extracts files from version control but must also make source files available
through a Web site or UNC share. This could happen if you have set up a test lab that does not have access to version control. It is possible to support both users using the
same set of .pdb files.
First, extract the source files using SrcTool; see Extracting Source Files for details. Make the share available as either a Web site or UNC share. For the current purpose, you
should not convert the .pdb files using the Cv2http.cmd script.
Now on the computers that will use the HTTP/UNC shares, edit the Srcsrv.ini file that is in the debugger directory. In the variables section of the file, add the following three
statements:
MY_SOURCE_ROOT=\\server\share
SRCSRVCMD=
SRCSRVTRG=%MY_SOURCE_ROOT%\%var2%\%var3%\%var4%\%fnfile%(%var1%)
You should replace \\server\share with the root of the UNC share that you are providing or the URL of the Web site that contains the source files. You can also change
MY_SOURCE_ROOT to be any alias you want to describe this location. With these exceptions, everything else should be entered exactly as described.
All debuggers set up in this fashion ignore the standard version control extraction instructions and instead access the source files from the location specified. Meanwhile, all
debuggers without these items included in Srcsrv.ini use the normal version control mechanism to extract source files.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SymChk
SymChk (the Microsoft Symbol Checker tool), Symchk.exe, is a program that compares executable files to symbol files to verify that the correct symbols are available.
This section includes:
Using SymChk
SymChk Command-Line Options
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Using SymChk
The basic syntax for SymChk is as follows:
symchk [/r] FileNames /s SymbolPath
FileNames specifies one or more program files whose symbols are needed. If FileNames is a directory and the /r flag is used, this directory is explored recursively, and
SymChk will try to find symbols for all program files in this directory tree. SymbolPath specifies where SymChk is to search for symbols.
There are many more command-line optinos. For a full listing, see SymChk Command-Line Options.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The symbol path specified can include any number of local directories, UNC directories, or symbol servers. Local directories and UNC directories are not searched
recursively. Only the specified directory and a subdirectory based on the executable's extension are searched. For example, the query
symchk thisdriver.sys /s g:\symbols
will search g:\mysymbols and g:\mysymbols\sys.
You can specify a symbol server by using either of the following syntaxes as part of your symbol path:
srv*DownstreamStore*\\Server\Share
srv*\\Server\Share
This is very similar to using a symbol server in the debugger's symbol path. For details on this, see Using Symbol Servers and Symbol Stores.
If a downstream store is specified, SymChk will make copies of all valid symbol files found by the symbol server and place them in the downstream store. Only symbol files
that are complete matches are copied downstream.
SymChk always searches the downstream store before querying the symbol server. Therefore you should be careful about using a downstream store when someone else is
maintaining the symbol store. If you run SymChk once and it finds symbol files, it will copy those to the downstream store. If you then run SymChk again after these files
have been altered or deleted on the symbol store, SymChk will not notice this fact, since it will find what it is looking for on the downstream store and look no further.
Note SymChk always uses SymSrv (Symsrv.dll) as its symbol server DLL. On the other hand, the debuggers can choose a symbol server DLL other than SymSrv if one is
available. (SymSrv is the symbol server included in the Debugging Tools for Windows package.)
Examples
Here are some examples. The following command searches for symbols for the program Myapp.exe:
e:\debuggers> symchk f:\myapp.exe /s f:\symbols\applications
SYMCHK: Myapp.exe
FAILED
- Myapp.pdb is missing
PASSED
MSISAM11.pdb is missing
msuni11link.pdb is missing
Image is split correctly, but msdxm.dbg i
Checksum doesn't match with expsrv.DBG
imeshare.opt.pdb is missing
Built with no debugging information
rpctest.pdb is missing
Built with no debugging information
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Run SymChk with the /om parameter to create a manifest file that describes the files for which you want to retrieve symbols.
Move the manifest file to a network that has a symbol store.
Run SymChk with /im parameter to retrieve symbols for the files described int the manifest file.
Move the symbol files back to the isolated computer.
Example
Suppose yourApp.exe is running on an isolated computer. The following command creates a manifest file that describes all the symbols needed to debug the yourApp.exe
pocess.
C:\>SymChk /om c:\Manifest\man.txt /ie yourApp.exe
SYMCHK: FAILED files = 0
SYMCHK: PASSED + IGNORED files = 28
Now assume you have moved the manifest file to a different computer that is on a network that has access to a symbol store. The following command retrieves the symbols
described in the manifest file and places them in the mySymbols folder.
C:\>SymChk /im c:\FolderOnOtherComputer\man.txt /s srv*c:\mysymbols*\\aServer\symbols
SYMCHK: myApp.exe
ERROR - Unable to download file. Error reported was 2
. . .
SYMCHK: FAILED files = 28
SYMCHK: PASSED + IGNORED files = 28
Now you can move the symbols to the isolated computer and use them for debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
marks.
/ie ExeFile
Specifies the name of a program that is currently executing. The symbols for this program will be checked. ExeFile must include the name of the file and file extension
(usually .exe), but no path information. If there are two different executables with the same name, this option is not recommended. ExeFile can specify any program,
including a kernel-mode driver. If ExeFile is a single asterisk ( * ), SymChk will check the symbols for all running processes, including drivers.
/id DumpFile
Specifies a memory dump file. The symbols for this dump file will be checked.
/ih HotFixFile
Specifies a self-extracting Hotfix CAB file.
/ip ProcessID
Specifies the process ID of a program that is currently executing. The symbols for this program will be checked. ProcessID must be specified as a decimal number. There
are two special wildcards supported:
If ProcessID is zero ( 0 ), SymChk will check the symbols for all running drivers.
If ProcessID is a single asterisk ( * ), SymChk will check the symbols for all running processes, including drivers.
/it TextFileList
Specifies a text file that contains a list of program files. The symbols for all these programs will be checked. TextFileList must specify exactly one file (by relative,
absolute, or UNC path, but with no wildcards); if it contains spaces it should be enclosed in quotation marks. Within this file, each line indicates a program file (by
relative, absolute, or UNC paths), and an asterisk wildcard (*) is permitted. However, any line using this wildcard must use a relative path. If a line in this file contains
spaces, it should be enclosed in quotation marks. A semicolon within this file is a comment character everything between a semicolon and the end of the line will be
ignored.
/im ManifestList
Specifies that the input to the command is a manifest file previously created by using the /om parameter. The manifest file contains information about the files for which
symbols are retrieved. For more information about using a manifest file, see Using a Manifest File with SymChk.
/om Manifest
Specifies that a manifest file is created. The manifest file contains information about a set of files for which symbols will be retrieved, by using the /im parameter, at a
later time.
/s[Opts] SymbolPath
Specifies the directories containing symbols. Absolute paths, relative paths, and UNC paths are permitted. Any number of directories can be specified multiple
directories should be separated with semicolons. If SymbolPath contains spaces, it must be enclosed in quotation marks. If you wish to specify a symbol server within this
path, you should use one of the following syntaxes:
srv*DownstreamStore*\\Server\Share
srv*\\Server\Share
It is not recommended that you omit the /s[Opts] SymbolPath parameter, but if it is omitted, SymChk will point to the public symbol store by using the following default
path:
srv*%SystemRoot%\symbols*http://msdl.microsoft.com/download/symbols
Any number of the following options can follow /s. There can be no space between the /s and these options:
e
SymChk will check each path individually instead of checking all paths at once.
u
Downstream stores will be updated. If the symbol path includes a downstream store, the symbol store will be searched for the symbol files. Only symbol stores that
are being checked by SymChk will be updated.
p
Force checking for private symbols. Public symbols will be treated as not matching. The p option implies e and u, and cannot be used with s.
s
Force checking for public (split) symbols. Private symbols will be treated as not matching. The s option implies e and u, and cannot be used with p.
Options
The available options are divided into several classes. Each class of options controls a different set of features.
Output options. Any number of the following options can be specified. These options can be abbreviated by using /o only once for example, /oi /oe can be written
as /oie.
Option
Effect
/oe
Output will include individual errors. This option is only useful if /q is used, because individual errors are automatically displayed if quiet mode hasn't been
activated.
/op
Output will list each file that passes. (By default, SymChk only displays files that fail testing.)
/oi
Output will list each file that was ignored. (By default, SymChk only displays files that fail testing.)
/od
Output will include full details. Same as /oe /op /oi.
/ot
Output will include result totals. This option is only useful if /q is used, because these totals are automatically displayed if quiet mode hasn't been activated.
/ob
The full path for binaries will be included in all output messages.
/os
The full path for symbols will be included in all output messages.
/oc Dir SymChk will create a traditional symbol tree in the directory Dir that contains a list of all the symbol files checked.
DBG file options. These options control how SymChk checks .dbg symbol files. Only one of the following options can be specified.
Option
Effect
/ds
SymChk will verify that .dbg information was stripped from the executable and only appears in the .dbg file, and that the executable points to the .dbg file. If the
program was built without .dbg symbol files, this option has no effect. This is the default.
/de
SymChk will verify that .dbg information was not stripped from the executable and that the executable does not point to a .dbg file. If the program was built
without .dbg symbol files, this option has no effect.
/dn
SymChk will verify that .dbg information is not present in the image, and that the image does not point to a .dbg file.
PDB file options. These options control how SymChk checks .pdb symbol files. Only one of the following options can be specified.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Option
Effect
/pf
SymChk performs no checking on the contents of the .pdb file it just verifies that the files exist and match the binary. This is the default.
/ps
SymChk will verify that the .pdb files have been stripped of source line, data type, and global information.
/pt
SymChk will verify that the .pdb files contain data type information.
Filtering options. These options control how module filtering is performed when SymChk is checking processes or dump files. Only one of the following options can be
specified.
Option
/fm
Module
Effect
SymChk will only check dump files or processes associated with the specified module. Module must include the full filename, but must not include any part
of the directory path.
Symbol checking options. Any number of the following options can be specified.
Option
Effect
/cs
SymChk won't verify that CodeView data is present. (By default, the presence of CodeView data is verified.)
/cc
When SymChk is checking a hotfix CAB file, it will not look for symbols inside the cab. (By default, SymChk will look for symbols in the cab as well as in the
provided symbol path.)
/ea
SymChk won't verify symbols for the programs listed in the specified file. This allows you to veto certain programs that would otherwise be verified. File must
File
specify exactly one file (by relative, absolute, or UNC path, but without wildcards); if it contains spaces it should be enclosed in quotation marks. Within File,
each line indicates a program file (by relative, absolute, or UNC paths); no wildcards are permitted. If a line in this file contains spaces it should be enclosed in
quotation marks. A semicolon within this file is a comment character everything between a semicolon and the end of the line will be ignored. If a symbol
server is being used, symbols for these programs will not be copied to the downstream store.
/ee
Error messages for those programs listed in the specified file are suppressed. "Success" and "ignore" messages will appear as usual, and symbol files will be
File
copied to the downstream store as usual. The format of File and the format of its contents are the same as that for /ea File.
Additional Information
For more information about SymChk, see Using SymChk.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Introduction
This documentation describes how to use the debugger engine and how to write extensions that will run in WinDbg, KD, CDB, and NTSD. These debugger extensions can be
used when performing user-mode or kernel-mode debugging on Microsoft Windows.
Incomplete Documentation
This is a preliminary document and is currently incomplete.
For many concepts relating to the debuggers and the debugger engine that are not yet documented here, look in the Debuggers and Debugging Techniques sections of this
documentation.
To obtain some of the currently undocumented functionality of the debugger engine API, use the Execute method to execute individual debugger commands.
Debugger Engine
The debugger engine provides an interface for examining and manipulating debugging targets in user-mode and kernel-mode on Microsoft Windows.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The debugger engine can acquire targets, set breakpoints, monitor events, query symbols, read and write memory, and control threads and processes in a target.
You can use the debugger engine to write both debugger extension libraries and stand-alone applications. Such applications are debugger engine applications. A debugger
engine application that uses the full functionality of the debugger engine is a debugger. For example, WinDbg, CDB, NTSD, and KD are debuggers; the debugger engine
provides the core of their functionality.
The debugger engine API is specified by the prototypes in the header file dbgeng.h.
Extensions
You can create your own debugging commands by writing and building an extension DLL. For example, you might want to write an extension command to display a complex
data structure.
There are three different types of debugger extension DLLs:
DbgEng extension DLLs. These are based on the prototypes in the dbgeng.h header file. Each DLL of this type may export DbgEng extension commands. These
extension commands use the Debugger Engine API and may also use the WdbgExts API.
EngExtCpp extension DLLs. These are based on the prototypes in the engextcpp.h and dbgeng.h header files. Each DLL of this type may export DbgEng extension
commands. These extension commands use both the Debugger Engine API and the EngExtCpp extension framework, and may also use the WdbgExts API.
WdbgExts extension DLLs. These are based on the prototypes in the wdbgexts.h header file. Each DLL of this type exports one or more WdbgExts extension commands.
These extension commands use the WdbgExts API exclusively.
The DbgEng API can be used to create extensions or stand-alone applications. The WdbgExts API contains a subset of the functionality of the debugger engine API and can
be used only by extensions.
All debugger extensions should be compiled and built by using the Build utility. The Build utility is included in the Windows Driver Kit (WDK).
Extension code samples are installed as part of the Debugging Tools for Windows package if you perform a custom installation and select the SDK component and all its
subcomponents. They can be found in the sdk\samples subdirectory of the Debugging Tools for Windows installation directory.
The easiest way to write new debugger extensions is to study the sample extensions. Each sample extension includes makefile and sources files for use with the Build utility.
Both types of extensions are represented in the samples.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Client Objects
Almost all interaction with the debugger engine is through client objects, often simply referred to as clients. Each client provides an implementation of the top-level engine
interfaces. Each interface provides a different set of methods, which can be used to interact with the engine and, through the engine, the targets. An instance of the engine can
have many clients, each with its own state.
Primary Clients
A primary client is a client that has joined the current debugging session. Initially, when a new client object is created, it is not a primary client. A client becomes a primary
client when it is used to acquire a target (for example, by calling CreateProcess2) or is connected to the debugging session using ConnectSession. The debugger
command .clients lists only the primary clients.
Callback Objects
Callback objects can be registered with each client. There are three types of callback objects:
1. Input Callback Objects (or input callbacks): the engine calls input callbacks to request input. For example, a debugger with a console window could register an input
callback to provide the engine with input from the user, or a debugger might register an input callback to provide the engine with input from a file.
2. Output Callback Objects (or output callbacks): the engine calls output callbacks to display output. For example, a debugger with a console window could register an
output callback to present the debugger's output to the user, or a debugger might register an output callback to send the output to a log file.
3. Event Callback Objects (or event callbacks): the engine calls event callbacks whenever an event occurs in a target (or there is a change in the engine's state). For
example, a debugger extension library could register an event callback to monitor certain events or perform automated actions when an particular event occurs.
Remote Debugging
Client objects facilitate communication to remote instances of the host engine. The DebugConnect function creates a client object that is connected to a remote engine
instance; methods called on this client are executed by the remote engine and callback objects registered locally with the client will be called when the remote engine makes
callback calls.
Additional Information
For details about creating and using client objects, see Using Callback Objects. For details about registering callback objects, see Using Callback Objects.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Remote Debugging
Remote debugging occurs when a client's communication with a target is indirect, for example, through a network connection. When remote debugging, more than one
instance of the debugger engine can be involved in debugging a target. However, exactly one of these instances is responsible for the debugging session; this instance is called
the host engine.
There are many possible configurations: the client object can be created in the host engine (smart clients), or a different instance of the engine (debugging clients); the host
engine can be connected directly to the target (debugging server); or a proxy can be directly connected to the target (process server and kernel connection server).
Multiple clients can simultaneously connect to the host engine. And the host engine can connect to multiple targets in the same debugging session. Optionally, there can be
one or more proxies between the clients and the host engine and between the host engine and each target.
Smart clients are client objects that communicate directly with the host engine. A debugging client is created by calling DebugConnect; the client communicates with the host
engine using RPC calls that represent method calls in the engine's API (including calls that the host engine makes to the client's callback objects).
A debugging server is an engine instance that communicates directly with the target and is also the host engine. Process servers and kernel connection servers communicate
directly with the target but are not the host engine. The host engine communicates with the process server, or kernel connection server, by sending low-level memory,
processor, and operating system requests, and the server sends back the results.
Note A typical two-computer setup for kernel debuggingwhere one computer is the target and the other the host computeris not considered to be remote debugging as
there is only one instance of the engine (on the host computer) and it communicates directly with the target.
Additional Information
For details about performing remote debugging, see Remote Targets.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Targets
The debugger engine supports debugging different types of targets, user-mode and kernel-mode targets, live targets and crash dump files, and local and remote targets. There
are different methods for connecting the engine to these different types of targets.
Crash Dump Files
Both user-mode, and kernel-mode crash-dump files are opened with OpenDumpFile. The engine is also able to create dump files from a target with WriteDumpFile2.
Live, User-Mode Targets
The debugger engine can both create and attach to user-mode processes.
Creating a process is done by providing a command line, and optionally an initial directory and environment, for the new process. The engine can then connect to the new
process, or keep the new process suspended while it connects to another process. For example, when debugging an application that consists of both a client and server, it is
possible to create a client in a suspended state and attach to an already running server, allowing server breakpoints to be set before the client runs and provokes server
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
operations.
When detaching from a process, the engine can optionally leave the process running normally, kill the process, or abandon the process (leaving it suspended until another
debugger attaches to it or it is killed).
The engine can be queried for information about all of the user-mode processes that are running on the computer, including the process ID and name of the executable image
that is used to start the process. This information can be used to help locate a process to debug.
Live, Kernel-Mode Targets
The method AttachKernel connects the debugger engine to a Windows kernel.
Remote Targets
When using the debugger engine to debug remotely, there are potentially two extra steps:
1. Connect to the host engine. If the host engine is not the local engine instance, use DebugConnect to create a client object that is connected to the host engine.
2. Connect the host engine to the process server or kernel connection server. If the host engine does not connect directly to the target, it must connect to a process server or
kernel connection server that does.
Now the client can tell the host engine to acquire a target through the process server or kernel connection server.
Acquiring Targets
When acquiring a target, the acquisition of the target is not complete until the target generates an event. Typically, this means first calling a method to attach the debugger to
the target, then calling WaitForEvent to let the target generate an event. This still holds true when the target is a crash dump file, as these always store an event-typically the
event that caused the dump file to be created.
Additional Information
For details about attaching to targets, see Connecting to Targets.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Events
The debugger engine provides facilities for monitoring and responding to events in the target. When an event occurs, the engine suspends the target (often only briefly), it then
notifies all of the clients of the event, who in turn instruct the engine on how execution should proceed in the target.
To notify a client of an event, the engine calls the event callback object that is registered with the client. The engine provides each event callback with details of the event, and
the event callback instructs the engine on how execution should proceed in the target. When different event callbacks provide conflicting instructions, the engine acts on the
instruction with the highest precedence (see DEBUG_STATUS_XXX), which typically means choosing the instruction that involves the least execution of the target.
Note While the event callback is handling the event, the target is suspended and the debugging session is accessible; however, because the engine was waiting for an event
either explicitly during a WaitForEvent call or implicitly by executing a command such as g (Go) or p (Step)the event callback cannot call WaitForEvent, and if it
attempts to execute any commands that would cause the debugger to execute, for example g (Go) or p (Step), the engine will interpret these commands as an instruction on
how to proceed.
Event Filters
The debugger engine also provides event filters, which are a simpler alternative for basic event monitoring. The event filters provide a few simple rules that specify whether
an event should be printed to the debugger's output stream or break into the debugger. They can also be used to execute debugger commands when an event occurs.
Additional Information
For details about monitoring events, see Monitoring Events.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Breakpoints
The debugger engine can create and monitor breakpoints in the target.
There are two types of breakpoints that the engine can insert into a target: software breakpoints and processor breakpoints.
Software breakpoints are inserted into the target's code by modifying the processor instruction at the breakpoint's location. The debugger engine keeps track of such
breakpoints; they are invisible to the clients reading and writing memory at that location. A software breakpoint is triggered when the target executes the modified
instruction.
Processor breakpoints are inserted into the target's processor by the debugger engine. A processor breakpoint can be triggered by different actions, for example,
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
executing an instruction at the location (like software breakpoints), or reading or writing memory at the breakpoint's location. Support for processor breakpoints is
dependent on the processor in the target's computer.
A breakpoint's address can be specified by an explicit address, by an expression that evaluates to an address, or by an expression that might evaluate to an address at a future
time. In the last case, each time a module is loaded or unloaded in the target, the engine will attempt to reevaluate the expression and insert the breakpoint if it can determine
the address; this makes it possible to set breakpoints in modules before they are loaded.
A number of parameters can be associated with a breakpoint to control its behavior:
A breakpoint can be associated with a particular thread in the target and will only be triggered by that thread.
A breakpoint can have debugger commands associated with it; these commands will automatically be executed when the breakpoint is triggered.
A breakpoint can be flagged as inactive until the target has passed it a specified number of times.
A breakpoint can be automatically removed the first time it is triggered.
Additional Information
For details about using breakpoints, see Using Breakpoints.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Symbols
A symbol is a named unit of data or code from a source file that appears in a module. Information about symbols can include the name, type (if applicable), the address or
register where it is stored, and any parent or child symbols. Examples of symbols include variables (local and global), functions, and any entry point into a module.
The symbol information is used by the engine to help interpret data and code in the target. With this information, the engine can search for symbols by name or location in
memory and provide a description of a symbol.
The engine gets its information about symbols from symbol files, which are located on the local file system or loaded from a symbol server. When using a symbol server, the
engine will automatically use the correct version of the symbol file to match the module in the target. Symbol files can be loaded whenever the corresponding module is
loaded, or they can be loaded as needed.
Note Often optimizing compilers do not include accurate information in symbol files. This can cause the engine to misinterpret the value of some variables as the variable's
location or lifetime might be incorrectly described, causing the engine to look at the wrong piece of memory or think a variable value is live when it is dead (or vice versa). It
is also possible for an optimizing compiler to change the order of execution or to split a function into several pieces. Best results are usually obtained when debugging
unoptimized code.
Additional Information
For details about using symbols, see Using Symbols. For an overview of using symbol files and symbol servers, see Symbols in the Debuggers section of this documentation.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Memory
The debugger engine can directly read and write the target's main memory, registers, and other data spaces. In kernel-mode debugging, all of the target's memory is available,
including virtual memory, physical memory, registers, Model Specific Registers (MSRs), System Bus Memory, Control-Space Memory, and I/O Memory. In user-mode
debugging, only the virtual memory and registers are available.
The engine exposes, to the clients, all memory in the target using 64-bit addresses. If the target uses 32-bit addresses, when communicating with the target and the clients, the
engine will automatically convert between 32-bit and 64-bit addresses, as needed. If a 32-bit address is recovered from the targetfor example, by reading from memory or a
registerit must be sign-extended to 64 bits before it can be used in the debugger engine API. Sign extension is performed automatically by the ReadPointersVirtual
method.
Additional Information
For details about reading and writing memory, see Memory Access.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Terminology
Thread and a process concepts are different between user-mode debugging and kernel-mode debugging.
In user-mode debugging, a process is an operating system process and a thread is an operating system thread.
In kernel-mode debugging, the debugger engine creates a virtual process for each target; this process represents the kernel and does not correspond to any operating
system process. For each physical processor in the target computer, the debugger creates a virtual thread; these threads represent the processors and do not correspond
to any operating system threads.
When an event occurs, the engine sets the event process and event thread to the process and thread (operating system or virtual) in which the event occurred.
The current thread is the thread (operating system or virtual) that the engine is currently controlling. The current process is the process (operating system or virtual) that the
engine is currently controlling. When an event occurs, the current thread and process are initially set to the event thread and process; but, they can be changed using the clients
while the session is accessible.
In kernel mode, the debugger keeps track of an implicit process and implicit thread. The implicit process is the operating system process that determines the translation from
virtual to physical memory addresses.
The implicit thread is the operating system thread that determines the target's registers, including call stack, stack frame, and instruction offset.
When an event occurs, the implicit thread and implicit process are initially set to the event thread and process; they can be changed while the session is accessible.
Thread and Process Data
The engine maintains several pieces of information about each thread and process. This includes the system thread and process ID and system handles, and the process
environment (PEB), the thread environment block (TEB), and their locations in target's memory.
Additional Information
For details about using thread and processes, see Controlling Threads and Processes.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Target State
Calling Extensions and Extension Functions
Assembling and Disassembling Instructions
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
COM Interfaces
The debugger engine API contains several COM interfaces; they implement the IUnknown interface.
Every one of the interfaces described in the section Client COM Interfaces is implemented by the client (though not necessarily at the latest version). You may use the COM
method IUnknown::QueryInterface to obtain each of these interfaces from any of the others.
The clients implement the IUnknown COM interface and use it for maintaining reference counts and interface selection. However, the clients are not registered COM objects.
The method IUnknown::AddRef is used to increment the reference count on the object, and the method IUnknown::Release is used to decrement the reference count. When
IUnknown::QueryInterface is called, the reference count is incremented, so when a client interface pointer is no longer needed IUnknown::Release should be called to
decrement the reference count.
The reference count will be initialized to one when the client object is created using DebugCreate or DebugConnect.
See the Platform SDK for more information about when reference counts should be incremented and decremented.
IUnknown::QueryInterface, DebugCreate, and DebugConnect each take an interface ID as one of their arguments. This interface ID can be obtained using the __uuidof
operator. For example:
IDebugClient * debugClient;
HRESULT Hr = DebugCreate( __uuidof(IDebugClient), (void **)&debugClient );
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
For an overview of the input and output streams in the debugger engine, see Input and Output.
Input
The engine will ask for input from all its clients if the Input method is called on a client. The input is returned to the caller of Input.
Input Callbacks
When the engine asks for input from a client, it uses the IDebugInputCallbacks object registered with that client. An IDebugInputCallbacks object may be registered with
a client using SetInputCallbacks. Each client can have at most one IDebugInputCallbacks object registered with it.
The request for input begins with the engine calling the IDebugInputCallbacks::StartInput method. This informs the IDebugInputCallbacks object that the engine is now
waiting for input.
If the IDebugInputCallbacks object has some input for the engine, it can call the ReturnInput method of any client. Once the ReturnInput method has been called, the
engine will not take any more input. Subsequent callers of this method will be informed that the input was not received.
The engine will then call IDebugInputCallbacks::EndInput to indicate that it has stopped waiting for input.
Finally, the engine will echo this input to the registered IDebugOutputCallbacks object of every client (except the one used to provide the input) by using
IDebugOutputCallbacks::Output with the bit-mask set to DEBUG_OUTPUT_PROMPT.
Output
Output may be sent to the engine using several client methods for example Output and OutputVaList. Upon receiving output, the engine sends it to some clients.
Clients use an output mask to indicate which types of output they are interested in. Whenever output is produced by the engine, it is accompanied by a mask specifying its
output type. If the type of output matches the output mask of the client, the client will receive the output. The output mask may be set by calling SetOutputMask and queried
using GetOutputMask. See DEBUG_OUTPUT_XXX for details of the output mask values.
The list of clients that the engine will send output to is controlled by the output control. Typically, the output control is set to send output to all clients; however, it can be
temporarily changed using ControlledOutput and ControlledOutputVaList. See DEBUG_OUTCTL_XXX for details about output control values.
Output may be buffered by the engine. If multiple pieces of output are passed to the engine, it may collect them and send them to the clients in one large piece. To flush this
buffer, use FlushCallbacks.
Each client object has an output width, which is the width of the output display for the client object. While this width is only used as a hint, some commands and extension
functions format their output based on this width. The width is returned by the GetOutputWidth method and can be set using the SetOutputWidth method.
Output Callbacks
When the engine sends output to a client, it uses the IDebugOutputCallbacks object registered with the client. An IDebugOutputCallbacks object may be registered with a
client using SetOutputCallbacks. Each client can have at most one IDebugInputCallbacks object registered with it.
To send the output, the engine calls the IDebugOutputCallbacks::Output method.
Output Line Prefix
Each client object has an output line prefix which is prepended to every line of output sent to the output callback associated with the client object. This can be used for
indentation or to place identifying marks on each line of output.
The output line prefix is returned by GetOutputLinePrefix and can be set using SetOutputLinePrefix. To temporarily change the output line prefix and later change it back
again, use PushOutputLinePrefix and PopOutputLinePrefix.
Log Files
The debugger engine supports opening a log file to record a debugging session. At most, one log file can be open at a time. Output sent to the output callbacks is also sent to
this log file (unless it is flagged to not be logged).
To open a log file, use OpenLogFile2 (or OpenLogFile). The method GetLogFile2 (or GetLogFile) returns the currently open log file. To close the log file, use
CloseLogFile.
The method SetLogMask can be used to filter the output sent to the log file, and GetLogMask will return the current log file filter.
Prompt
In an interactive debugging session, a prompt can be used to indicate to the user that the debugger is waiting for user input. The prompt is sent to the output callbacks using
the OutputPrompt and OutputPromptVaList methods. The contents of the standard prompt are returned by GetPromptText.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Monitoring Events
For an overview of events in the debugger engine, see Events.
Events occurring in a target or the debugger engine may be monitored using the IDebugEventCallbacks interface. An IDebugEventCallbacks object may be registered with
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
a client using SetEventCallbacks. Each client can only have at most one IDebugEventCallbacks object registered with it.
When an IDebugEventCallbacks object is registered with a client, the engine will call the object's IDebugEventCallbacks::GetInterestMask to determine which events the
object is interested in. Only events in which the object is interested will be sent to it.
For each type of event, the engine calls a corresponding callback method on IDebugEventCallbacks. For events from the target, the DEBUG_STATUS_XXX value returned
from these calls specifies how the execution of the target should proceed. The engine collects these return values from each IDebugEventCallbacks object it calls and acts on
the one with the highest precedence.
Events from the Target That Break into the Debugger by Default
The following events break into the debugger by default:
Breakpoint Events
Exception Events (not documented here)
System Error
Events from the Target that Do Not Break into the Debugger by Default
The following events do not break into the debugger by default:
Target Change
Engine Change
Engine Symbol Change
Session Status Change
Event Filters
Event filters provide simple event filtering; they influence how the debugger engine proceeds after an event occurs in a target. When an event occurs, the engine determines
whether that event matches an event filter. If it does, the break status for the event filter influences whether the debugger will break into the target. If the event is an exception
event, the handling status determines whether the exception should be considered handled or not-handled in the target.
Note If more sophisticated event filtering is required, event callbacks can be used.
Event filters are divided into three categories.
1. Specific event filters. These are the filters for all the non-exception events. See DEBUG_FILTER_XXX for a list of these events.
2. Specific exception filters. The first specific exception filter is the default exception filter. The rest are filters for those exceptions for which the engine has built-in filters.
See Specific Exceptions for a list of the specific exception filters.
3. Arbitrary exception filters. These are filters for exception events that have been added manually.
The filters in categories 1 and 2 are collectively known as specific filters, and the filters in categories 2 and 3 are collectively known as exception filters. The number of filters
in each category is returned by GetNumberEventFilters.
An event matches a specific event filter if the type of the event is the same as the type of the filter. Some event filters have an additional parameter which further restricts the
events they match.
An exception event matches an exception filter if the exception code for the exception event is the same as the exception code for the exception filter. If there is no exception
filter with the same exception code as the exception event, the exception event will be handled by the default exception filter.
Commands and Parameters
Event filters can have a debugger command associated with them. This command is executed by the engine when an event matching the filter occurs.
GetEventFilterCommand and SetEventFilterCommand can be used to get and set this command. For exception filters, this command is executed on the first-chance of the
exception. A separate second-chance command can be executed upon the second-chance exception event. To get and set the second-chance command, use
GetExceptionFilterSecondCommand and SetExceptionSecondChanceCommand.
The parameters for specific event filters and exception filters are returned by GetSpecificFilterParameters and GetExceptionFilterParameters. The break status and
handling status for event filters can be set using SetSpecificFilterParameters and SetExceptionFilterParameters.
SetExceptionFilterParameters can also be used to add and remove arbitrary exception filters.
A short description of specific filters is returned by GetEventFilterText.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Some specific filters take arguments that restrict which events the filter matches. GetSpecificFilterArgument and SetSpecificFilterArgument will get and set arguments for
those specific filters which support arguments. If a specific filter has no argument, there is no restriction on which events it matches. The following table lists the event filters
that take arguments and how they restrict the events which match them:
Event
Match criteria
Create Process The name of the created process must match the argument.1
Exit Process
The name of the exited process must match the argument.1
The name of the loaded module must match the argument.1
Unload Module The base address of the unloaded module must be the same as the argument.2
Load Module
Target Output The debug output from the target must match the argument.3
Notes
1. The argument uses the string wildcard syntax and is compared with the image name (ignoring path) when the event occurs. If the name of the module or process is not
available, it is considered a match.
2. The argument is an expression that is evaluated by the engine when the argument is set.
3. The argument uses the string wildcard syntax and is compared with the debug output from the target. If the output is not known, it is considered a match.
Index and Exception Code
Each event filter has an index. The index is a number between zero and one less than the total number of filters (inclusive). The index range for each category of filters can be
found from the SpecificEvents, SpecificExceptions, and ArbitraryExceptions values returned by GetNumberEventFilters, as described in the following table:
Event Filters
Index of first filter
Specific event filters
0
specific exception filters SpecificEvents
arbitrary exception filters SpecificEvents + SpecificExceptions
Number of filters
SpecificEvents
SpecificExceptions
ArbitraryExceptions
The indices for the specific event filters are found in the first table located in the topic DEBUG_FILTER_XXX. The index of the default exception filter (the first specific
exception filter) is SpecificEvents. When an arbitrary exception filter is removed, the indices of the other arbitrary exception filters can change.
The exception filters are usually specified by exception code. However, some methods require the index of the exception. To find the index of an exception filter for a given
exception, use GetExceptionFilterParameters to iterate over all the exception filters until you find the one with the same exception code as the exception. The exception
codes for the specific exception filters can be found in the topic Specific Exceptions.
System Errors
When a system error occurs, the engine will break into the debugger or print the error to the output stream, if the error occurs at or below specified levels. These levels are
returned by GetSystemErrorControl and can be changed using SetSystemErrorControl.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Event Information
Whenever a debugging session is accessible, there is a last event. This is the event that caused the session to become accessible. The event target is the target which generated
the last event. When the session becomes accessible, the current target is set to the event target. The details of the last event are returned by GetLastEventInformation. The
instruction pointer for the last event and the memory at the instruction pointer when the event occurred are returned by the Request operations
DEBUG_REQUEST_GET_CAPTURED_EVENT_CODE_OFFSET and DEBUG_REQUEST_READ_CAPTURED_EVENT_CODE_STREAM.
If the target is a crash dump file, the last event is the last event that occurred before the dump file was created. This event is stored in the dump file and the engine generates it
for the event callbacks when the dump file is acquired as a debugging target.
If the target is a kernel-mode target and a bug check occurred, the bug check code and related parameters can be found using ReadBugCheckData.
If the target is a user-mode Minidump, the dump file generator may store an additional event. Typically, this is the event that provoked the generator to save the dump file.
Details of this event are returned by GetStoredEventInformation and the Request operations DEBUG_REQUEST_TARGET_EXCEPTION_CONTEXT,
DEBUG_REQUEST_TARGET_EXCEPTION_THREAD, and DEBUG_REQUEST_TARGET_EXCEPTION_RECORD.
Dump files may contain a static list of events. Each event represents a snapshot of the target at a particular point in time. The number of events in this list is returned by
GetNumberEvents. For a description of each event in the list, use GetEventIndexDescription. To set an event from this list as the current event, use the method
SetNextEventIndex; after calling WaitForEvent, the event becomes the current event. To determine which event in the list is the current event, use
GetCurrentEventIndex.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Using Breakpoints
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Setting Breakpoints
Breakpoints are created with the AddBreakpoint method. This method creates an IDebugBreakpoint object that represents the breakpoint. It also set the breakpoint type
(software breakpoint or processor breakpoint). Once a breakpoint has been created, its type cannot be changed.
Breakpoints are deleted with the RemoveBreakpoint method. This also deletes the IDebugBreakpoint object; this object may not be used again.
Note Although IDebugBreakpoint implements the IUnknown interface, the methods IUnknown::AddRef and IUnknown::Release are not used to control the lifetime of
the breakpoint. These methods have no effect on the lifetime of the breakpoint. Instead, an IDebugBreakpoint object is deleted after the method RemoveBreakpoint is
called.
When the breakpoint is created, it is given a unique breakpoint ID. This identifier will not change. However, after the breakpoint has been deleted, its ID may be used for
another breakpoint. For details on how to receive notification of the removal of a breakpoint, see Monitoring Events.
When a breakpoint is created, it is initially disabled; this means that it will not cause the target to stop executing. This breakpoint may be enabled by using the method
AddFlags to add the DEBUG_BREAKPOINT_ENABLED flag.
When a breakpoint is first created, it has the memory location 0x00000000 associated with it. The location can be changed by using SetOffset with an address, or by using
SetOffsetExpression with a symbolic expression. The breakpoint's location should be changed from its initial value before it is used.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
In addition to its location and breakpoint type, a breakpoint has several parameters controlling its behavior.
Breakpoint parameters can be controlled through a variety of specific methods. In addition, most of the parameters may be queried together using GetParameters.
Breakpoint Flags
Breakpoint flags are one kind of breakpoint parameters.
Breakpoint flags can be queried using GetFlags. They can be changed by using AddFlags, RemoveFlags, or SetFlags.
Breakpoint flags form a bit field. The possible flags that can be used in this bit field, and their meanings, are as follows:
DEBUG_BREAKPOINT_ENABLED
When this flag is set, the breakpoint is enabled and will have its normal effect. When this flag is not set, the breakpoint is disabled and will not have any effect. If you
wish to temporarily deactivate a breakpoint, you can remove this flag; it is then easy to add this flag back when you want to re-enable this breakpoint.
DEBUG_BREAKPOINT_ADDER_ONLY
When this flag is set, the breakpoint is a private breakpoint. This breakpoint is visible only to the client that added it. In this case, other clients will not be able to query
the engine for the breakpoint, and the engine will not send events generated by the breakpoint to other clients. All callbacks (event and output) related to this breakpoint
will be sent only to this client. See GetAdder.
DEBUG_BREAKPOINT_GO_ONLY
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
When this flag is set, the breakpoint will only be triggered if the target is in unrestricted execution. It will not be triggered if the engine is stepping through instructions in
the target.
DEBUG_BREAKPOINT_ONE_SHOT
When this flag is set, the breakpoint will automatically remove itself the first time it is triggered.
DEBUG_BREAKPOINT_DEFERRED
When this flag is set, the breakpoint is deferred. This flag is set by the engine when the offset of the breakpoint is specified using a symbolic expression, and the engine
cannot evaluate the expression. Every time a module is loaded or unleaded in the target, the engine will attempt reevaluate the expression for all breakpoints whose
location is specified using an expression. Those that cannot be evaluated are flagged as deferred. This flag cannot be modified by any client.
Other Breakpoint Parameters
Breakpoint parameters also include:
Pass count
If the breakpoint has a pass count associated with it, it will not be activated until the target has passed the breakpoint the specified number of times. The pass count that
was originally set can be found by using GetPassCount. The number of times remaining that the engine will pass the breakpoint before it is activated can be found using
GetCurrentPassCount. The pass count can be reset to a new value by using SetPassCount.
Match thread
If the breakpoint has a thread associated with it, it will be ignored by the engine when it is encountered by any other thread. The thread can be found by using
GetMatchThreadId, and can be changed by using SetMatchThreadId.
Command
The breakpoint may have a command associated with it. The command is executed when the breakpoint is activated. This command can be found by using
GetCommand, and can be changed by using SetCommand.
Size
If the breakpoint is a processor breakpoint, it must have a specified size. This determines the size of the block of memory whose access will activate the breakpoint the
beginning of the block is the breakpoint's location. The size can be found by using GetDataParameters, and can be changed by using SetDataParameters.
Access type
If the breakpoint is a processor breakpoint, it must have an access type. This determines the type of access that will activate the breakpoint. For example, the breakpoint
may be activated if the target reads from, writes to, or executes the memory specified by the breakpoint. The access type can be found by using GetDataParameters, and
can be changed by using SetDataParameters.
Memory Access
The debugger engine provides interfaces to directly read from and write to the target's main memory, registers, and other data spaces.
In user-mode debugging, only the virtual memory and registers can be accessed; the physical memory and other data spaces cannot be accessed.
The debugger engine API always uses 64-bit addresses when referring to memory locations on the target.
If the target uses 32-bit addresses, the native 32-bit address will automatically be sign-extended by the engine to 64-bit addresses. The engine will automatically convert
between 64-bit addresses and native 32-bit addresses when communicating with the target.
This section includes:
Virtual and Physical Memory
Registers
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Registers
The debugger engine can be used to examine and alter the target's registers.
The registers available on the target depend on its processor architecture. For a description of the registers for the x86 and Itanium processors, see Processor Architecture. For
a complete description of the registers available for a processor, see that processor's documentation.
The Register Set
The GetNumberRegisters method can be used to find the number of registers on the target.
Each register is referred to by its index. The index of the first register is zero, and the index of the last register is the number of registers minus one. To find the index of a
register whose name is known, use GetIndexByName.
The method GetDescription returns information about a register. This includes the register's name, the type of values it can hold, and whether it is a subregister.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
A subregister is a register that is contained within another register. When the subregister changes, the register that contains it also changes. For example, on an x86 processor,
the ax subregister is the same as the low 16 bits of the 32-bit eax register.
There are three special registers whose values may be found by using the following methods. The interpretation of the values of these registers is platform dependent.
The location of the current instruction may be found with GetInstructionOffset and GetInstructionOffset2.
The location of the current processor stack slot may be found with GetStackOffset and GetStackOffset2.
The location of the stack frame for the current function may be found with GetFrameOffset and GetFrameOffset2.
Manipulating Registers
The value of a register can be read by using the method GetValue. Multiple registers can be read by using GetValues and GetValues2.
A value can be written to a register by using the method SetValue. Multiple registers can be written by using SetValues and SetValues2.
When writing a value to a register, if the value supplied has a different type to the type of the register then the value is converted into the register's type. This conversion is the
same as that performed by the method CoerceValue. This conversion may result in data loss if the register's type is not capable of holding the value supplied.
Pseudo-Registers
Pseudo-registers are variables maintained by the debugger engine that hold certain values, for example, $teb is the name of the pseudo-register whose value is the address of
the current thread's Thread Environment Block (TEB). For more information, and a list of the pseudo-registers, see Pseudo-Register Syntax.
Each pseudo-register has an index. The index is a number between zero and the number of pseudo-registers (returned by GetNumberPseudoRegisters) minus one. To find
the index of a pseudo-register by its name, use GetPseudoIndexByName. The values of pseudo-registers can be read using GetPseudoValues, and values can be written to
pseudo-registers using SetPseudoValues. For a description of a pseudo-register, including its type, use GetPseudoDescription.
Note Not all of the pseudo-registers are available in all debugging sessions or at all times in a particular session.
Displaying Registers
The methods OutputRegisters and OutputRegisters2 format the target's registers and sends them to the clients as output.
Events
Whenever the values of the target's registers change, the engine will call the IDebugEventCallbacks::ChangeDebuggeeState callback method with the parameter Flags set
to DEBUG_CDS_REGISTERS.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
A call stack contains the data for the functions calls made by a thread. The data for each function call is called a stack frame and includes the return address, parameters
passed to the function, and the function's local variables. Each time a function call is made a new stack frame is pushed onto the top of the stack. When that function returns,
the stack frame is popped off the stack.
Each thread has its own call stack, representing the calls made in that thread.
To get a stack trace, use the methods GetStackTrace and GetContextStackTrace. A stack trace can be printed using OutputStackTrace and OutputContextStackTrace.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The engine maintains several pieces of information about each process. This information may be queried for the current process, and may be used to find the engine process
ID for a process.
system process ID (user-mode debugging only).
The system process ID of the current process can be found by using GetCurrentProcessSystemId. For a given system process ID, the corresponding engine process ID
may be found by using GetProcessIdBySystemId.
process environment block (PEB)
The address of the PEB for the current process can be found by using GetCurrentProcessPeb. For a given PEB address, the corresponding engine process ID may be
found by using GetProcessIdByPeb. In kernel-mode debugging, the PEB of the (virtual) process is the PEB of the system process that was running when the last event
occurred.
data offset
In user-mode debugging, the data offset of a (system) process is the location of the PEB of that process. In kernel-mode debugging, the data offset of the (virtual) process
is the KPROCESS structure for the system process that was running when the last event occurred. The data offset of the current process can be found by using
GetCurrentProcessDataOffset. For a given data offset, the corresponding engine process ID may be found by using GetProcessIdByDataOffset.
system handle
The system handle of the current process can be found by using GetCurrentProcessHandle. For a given system handle, the corresponding engine process ID may be
found by using GetProcessIdByHandle. In kernel-mode debugging, an artificial handle is created for the (virtual) process. This handle can only be used with debugger
engine queries.
Events
In live user-mode debugging, whenever a thread is created or exits in a target, the create-thread and exit-thread debugging events are generated. These events result in calls to
the IDebugEventCallbacks::CreateThread and IDebugEventCallbacks::ExitThread callback methods.
In live user-mode debugging, whenever a process is created or exits in a target, the create-process and exit-process debugging events are generated. These events result in calls
to the IDebugEventCallbacks::CreateProcess and IDebugEventCallbacks::ExitProcess callback methods.
For more information about events, see Monitoring Events.
Additional Information
For more information about threads and processes, including the TEB, KTHREAD, PEB, and KPROCESS structures, see Microsoft Windows Internals by David Solomon
and Mark Russinovich.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Using Symbols
For an overview of symbols, including using symbol files and symbol servers, see Symbols.
Symbol Names and Locations
To find the location of a symbol given its name, use GetOffsetByName. For details on the syntax used to specify symbol names, see Symbol Syntax and Symbol Matching.
If the exact name of a symbol is not known, or multiple symbols have the same name, StartSymbolMatch will begin a search for symbols whose names match a given
pattern. For details on the syntax, see String Wildcard Syntax.
To find the name of a symbol given its location, use GetNameByOffset. To find the names of symbols in a module near a given location, use GetNearNamebyOffset.
Note Whenever possible, qualify the symbol with the module name for example mymodule!main. Otherwise, if the symbol does not exist (for example, because of a
typographical error) the engine will have to load and search the symbols for every module; this can be a slow process, especially for kernel-mode debugging. If the symbol
name was qualified with a module name, the engine will only need to search the symbols for that module.
A symbol is uniquely identified using the structure DEBUG_MODULE_AND_ID. This structure is returned by the methods GetSymbolEntriesByName and
GetSymbolEntriesByOffset, which search for symbols based on their name and location, respectively.
The method GetSymbolEntryInformation returns a description of a symbol using the DEBUG_SYMBOL_ENTRY structure.
To find the offset of a field within a structure, use GetFieldOffset. To find the name of a field given its index within a structure, use GetFieldName. To find the name of an
enumeration constant given its value, use GetConstantName.
The method GetSymbolInformation can perform several requests for information about symbols.
Symbol Options
A number of options control how the symbols are loaded and unloaded. For a description of these options, see Setting Symbol Options.
Symbol options may be turned on by using AddSymbolOptions, and turned off by using RemoveSymbolOptions.
GetSymbolOptions returns the current symbol options. To set all the symbol options at once, use SetSymbolOptions.
Reloading Symbols
After loading symbol files, the engine stores the symbol information in an internal cache. To flush this cache, use Reload. These symbols will have to be loaded again now or
at a later time.
Synthetic Symbols
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Synthetic symbols are a way to label an arbitrary address for easy reference. Synthetic symbols can be created in any existing module. The method AddSyntheticSymbol
creates a new synthetic symbol. Synthetic symbols can be removed using RemoveSyntheticSymbol. Reloading the symbols for the module deletes all synthetic symbols
associated with that module.
Symbol Path
To add a directory or symbol server to the symbol path, use the method AppendSymbolPath. The whole symbol path is returned by GetSymbolPath and can be changed
using SetSymbolPath.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Modules
An image is an executable, DLL, or driver that Windows has loaded as part of a user-mode process or the kernel. The file from which the image was loaded is referred to as
its image file.
The debugger engine caches a list of modules for each process (or, in kernel-mode, the virtual process). Typically each module in this list represents an image in the process.
The engine's module list can be synchronized with the target using Reload.
Note In kernel-mode debugging, the engine's module list for the virtual process contains both the system-wide kernel-mode modules and the current process's user-mode
modules.
A module can be specified by its base address in the target's virtual address space, or by its index in the list of modules the engine maintains for the target. The module's index
equals its position in the list of modules, and therefore this index will change if a module with a lower index is unloaded. All unloaded modules have indexes; these are always
higher than the indexes of loaded modules. The base address of a module will not change as long as it remains loaded; in some cases it may change if the module is unloaded
and then reloaded.
The index is a number between zero and the number of modules in the target minus one. The number of modules in the current process can be found by calling
GetNumberModules.
The index can be used to find the base address by calling GetModuleByIndex. The base address of a module owning a symbol with a given name can be found using
GetSymbolModule.
The following methods return both the index and base address of the specified module:
The following methods return information about modules specified either by base address or index:
Unloaded Modules
During user-mode debugging, unloaded modules are tracked only in Windows Server 2003 and later versions of Windows. Earlier versions of Windows only tracked
unloaded modules in kernel mode. When they are tracked, they are indexed after the loaded modules. Hence any method that searches the target's modules will search all the
loaded modules and then the unloaded modules. Unloaded modules can be used to analyze failures caused by an attempt to call unloaded code.
Synthetic Modules
Synthetic modules can be created as a way to label a region of memory. These modules cannot contain real symbols, but they can contain synthetic symbols. The method
AddSyntheticModule creates a new synthetic module. Synthetic modules can be removed using RemoveSyntheticModule. Reloading all the modules in the target deletes
all synthetic modules.
Image Path
The executable image path is used by the engine when searching for executable images.
The executable image path can consist of several directories separated by semicolons (;). These directories are searched in order.
For an overview of the executable image path, see Executable Image Path.
To add a directory to the executable image path, use the method AppendImagePath. The whole executable image path is returned by GetImagePath and can be changed
using SetImagePath.
Additional Information
For more information about processes and virtual processes, see Threads and Processes.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Types
Type information from a module's symbol file is identified by two pieces of information: a type ID and the base address of the module to which the type belongs. The
following methods can be used to find a type ID:
The name and size of a type are returned by GetTypeName and GetTypeSize, respectively.
The following convenience methods can be used for reading and writing typed data in the target's physical and virtual memory:
ReadTypedDataPhysical
WriteTypedDataPhysical
ReadTypedDataVirtual
WriteTypedDataVirtual
Printing Typed Data
To format typed data and send it to the output callbacks, use OutputTypedDataPhysical and OutputTypedDataVirtual for data in the target's physical and virtual memory
respectively.
The type options described in DEBUG_TYPEOPTS_XXX affect how the engine formats typed data before sending it to the output callbacks.
The type options may be turned on by using AddTypeOptions, and turned off by using RemoveTypeOptions.
GetTypeOptions returns the current type options. To set all the type options at once, use SetTypeOptions.
Interpreting Raw Data Using Type Information
The debugger engine API supports interpreting typed data. This provides a way to walk object hierarchies on the target, including finding members of structures,
dereferencing pointers, and locating array elements.
Typed data is described by instances of the DEBUG_TYPED_DATA structure and represents regions of memory on the target cast to a particular type. The
DEBUG_REQUEST_EXT_TYPED_DATA_ANSI Request operation is used to manipulate these instances. They can be initialized to the result of expressions or by casting
regions of memory to a specified type. For a list of all the sub-operations that the DEBUG_REQUEST_EXT_TYPED_DATA_ANSI Request operation supports, see
EXT_TDOP.
Additional Information
For details on output callbacks, see Input and Output.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
If a symbol is stored in a register or in a memory location known to the debugger engine, its value can be changed using WriteSymbol.
A symbol is a parent symbol if it contains other symbols. For example, a structure contains its members. A symbol is a child symbol if it is contained in another symbol. A
symbol may be both a parent and child symbol. Each symbol group has a flat structure and contains parent symbols and their children. Each symbol has a depth symbols
without parents in the symbol group have a depth of zero, and the depth of each child symbol is one greater than the depth of its parent. The children of a parent symbol may
or may not be present in the symbol group. When the children are present in the symbol group, the parent symbol is referred to as expanded. To add or remove the children of
a symbol in a symbol group, use ExpandSymbol.
The number of symbols in a symbol group is returned by GetNumberSymbols. The index of a symbol in a symbol group is an identification number; the index ranges from
zero to the number of symbols minus one. Each time a symbol is added to or removed from a symbol group for example, by expanding a symbol the index of all the
symbols in the symbol group may change.
The symbol parameters, including information about parent-child relationships, can be found by using GetSymbolParameters. This method returns a
DEBUG_SYMBOL_PARAMETERS structure.
The symbols in a symbol group can be printed to the debugger's output stream using the method OutputSymbols.
Scopes
The current scope, or current local context, determines the local variables exposed by the debugger engine. The scope has three components:
1. A stack frame.
2. A current instruction.
3. A register context.
If the stack frame is at the top of the call stack, the current instruction is the instruction that resulted in the last event. Otherwise the current instruction is the function call
which resulted in the next higher stack frame.
The methods GetScope and SetScope can be used to get and set the current scope. When an event occurs, the current scope is set to the scope of the event. The current scope
can be reset to the scope of the last event using ResetScope.
Thread Context
The thread context is the state preserved by Windows when switching threads. This is similar to the register context, except that there is some kernel-only processor state that
is part of the register context but not the thread context. This extra state is available as registers during kernel-mode debugging.
The thread context is represented by the CONTEXT structure defined in ntddk.h. This structure is platform-dependent and its interpretation depends on the effective processor
type. The methods GetThreadContext and SetThreadContext can be used to get and set the thread context.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Connecting to Targets
This section includes:
Live User-Mode Targets
Live Kernel-Mode Targets
Dump-File Targets
Remote Targets
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Process Options
The process options determine part of the engine's behavior when attached to a user-mode process, including whether or not the debugger engine will automatically attach to
child processes created by the target process and what the engine does with the target processes when it exits. See DEBUG_PROCESS_XXX for a description of the process
options.
The process options can be queried using GetProcessOptions. They can be changed using AddProcessOptions, RemoveProcessOptions, and SetProcessOptions.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
SetKernelConnectionOptions.
The debugger can attach to the local kernel, but only in a limited way and only if the computer was booted with the /debug boot switch. (In some Windows installations, local
kernel debugging is supported when other switches are used, such as /debugport, but this is not a guaranteed feature of Windows and should not be relied on.)
IsKernelDebuggerEnabled is used to determine if the local computer is available for debugging. For more information about kernel debugging on a single machine, see
Performing Local Kernel Debugging.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Dump-File Targets
For an introduction and overview of crash dump files, see Crash Dump Files.
Remote Targets
There are two different forms of remote debugging, depending on which computer (remote client or server) is the host computer. The host computer is the computer on which
the debugger engine is active. On the other computer, the debugger engine is merely acting as a proxy relaying commands and data to the host engine.
All debugger operations such as executing commands and extensions, and symbol loading are performed by the host engine. A debugger session is also relative to the
host engine.
To list the debugging servers and process servers currently running on a computer, use OutputServers.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
When the remote client is finished with the process server, it can disconnect using DisconnectProcessServer, or it can use EndProcessServer to request that the process
server shut down. To shut down the process server from the computer that it is running on, use Task Manager to end the process. If the instance of the debugger engine that
used StartProcessServer is still running, it can use Execute to issue the debugger command .endsrv 0, which will end the process server (this is an exception to the usual
behavior of .endsrv, which generally does not affect process servers).
The communication between a process server and a smart client typically consists of low-level memory, processor, and operating system operations and requests that are sent
from the remote client to the server. Their results are then sent back to the client.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Target Information
The method GetDebuggeeType returns the nature of the current target (for example, whether it is a kernel-mode or user-mode target), and how the debugger engine is
connected to it.
If the target is a crash dump file file, the method GetDumpFormatFlags will indicate what information is contained in the dump.
Target's Computer
The page size of the target's computer is returned by GetPageSize. IsPointer64Bit will indicate if the computer uses 32-bit or 64-bit addresses.
Note Internally, the debugger engine always uses 64-bit addresses for the target. If the target only uses 32-bit addresses, the engine automatically converts them when
communicating with the target.
The number of processors in the target's computer is returned by GetNumberProcessors.
There are three different processor types associated with the target's computer:
The actual processor type is the type of the physical processor in the target's computer. This is returned by GetActualProcessorType.
The executing processor type is the type of the processor used in the currently executing processor context. This is returned by GetExecutingProcessorType.
The effective processor type is the processor type the debugger uses when interpreting information from the target for example, setting breakpoints, accessing
registers, and getting stack traces. The effective processor type is returned by GetEffectiveProcessorType and can be changed using SetEffectiveProcessorType.
The effective processor type and executing processor type may differ from the actual processor type for example, when the physical processor is an x64 processor and it is
running in x86 mode.
The different executing processor types that are supported by the physical processor on the target's computer are returned by GetPossibleExecutingProcessorTypes. The
number of these is returned by GetNumberPossibleExecutingProcessorTypes.
The list of processor types that is supported by the debugger engine is returned by GetSupportedProcessorTypes. The number of supported processor types is returned by
GetNumberSupportedProcessorTypes.
The names (full and abbreviated) of a processor type are returned by GetProcessorTypeNames.
The current time on the target's computer is returned by GetCurrentTimeDate. The length of time the target's computer has been running since the last boot is returned by
GetCurrentSystemUpTime. Time information may not be available for all targets.
Target Versions
The Windows version running on the target's computer is returned by GetSystemVersionValues and the Request operation
DEBUG_REQUEST_GET_WIN32_MAJOR_MINOR_VERSIONS, and a description of the Windows version is returned by GetSystemVersionString. Some of this
information is also returned by GetSystemVersion.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Target State
The method OutputCurrentState will print the current state of the target to the debugger's output stream.
The current execution status of the target is returned by GetExecutionStatus. If the target is suspended, the method SetExecutionStatus can be used to resume execution in
one of the execution modes.
The method GetReturnOffset returns the address of the instruction that will execute when the current function returns.
GetNearInstruction returns the location of an instruction relative to a given address.
Examining the Stack Trace
A call stack contains the data for the function calls that are made by a thread. The data for each function call is called a stack frame and includes the return address,
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
parameters passed to the function, and the function's local variables. Each time a function call is made, a new stack frame is pushed onto the top of the stack. When that
function returns, the stack frame is popped off the stack. Each thread has its own call stack, which represents the calls that are made in that thread.
Note Not all of the data for a function call can be stored in the stack frame. Parameters and local variables, at times, can be stored in registers.
To retrieve the call stack or stack trace, use the methods GetStackTrace and GetContextStackTrace. The stack trace can be printed using OutputStackTrace and
OutputContextStackTrace.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
disassembled is move ax, [ebp+4], the effective address is the value of ebp+4. This corresponds to the $ea pseudo-register.
To send disassembled instructions to the output callbacks, use the methods OutputDisassembly and OutputDisassemblyLines.
The debugger engine has some options that control the assembly and disassembly. These options are returned by GetAssemblyOptions. They can be set using
SetAssemblyOptions and some options can be turned on with AddAssemblyOptions or turned off with RemoveAssemblyOptions.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Client Functions
This section includes:
DebugConnect
DebugCreate
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
DebugConnect
The DebugConnect and DebugConnectWide functions create a new client object and return an interface pointer to it. The client object will be connected to a remote host.
HRESULT
DebugConnect(
IN PCSTR RemoteOptions,
IN REFIID InterfaceId,
OUT PVOID * Interface
);
HRESULT
DebugConnectWide(
IN PCWSTR RemoteOptions,
IN REFIID InterfaceId,
OUT PVOID * Interface
);
#ifdef UNICODE
#define DebugConnectT DebugConnectWide
#else
#define DebugConnectT DebugConnect
#endif
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Parameters
RemoteOptions
Specifies how the debugger engine will connect to the remote host. These are the same options that get passed to the -remote option on the command line. For details on
the syntax of this string, see Activating a Debugging Client.
InterfaceId
Specifies the interface identifier (IID) of the desired debugger engine client interface. This is the type of the interface that will be returned in Interface. For information
about the interface identifier, see COM Interfaces.
Interface
Receives an interface pointer for the new client. The type of this interface is specified by InterfaceId.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Comments
As with IUnknown::QueryInterface, when the returned interface is no longer needed, its IUnknown::Release method should be called.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
Client Objects, Process Server and Smart Client
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
DebugCreate
The DebugCreate function creates a new client object and returns an interface pointer to it.
HRESULT
DebugCreate(
IN REFIID InterfaceId,
OUT PVOID * Interface
);
Parameters
InterfaceId
Specifies the interface identifier (IID) of the desired debugger engine client interface. This is the type of the interface that will be returned in Interface. For information
about the interface identifier, see COM Interfaces.
Interface
Receives an interface pointer for the new client. The type of this interface is specified by InterfaceId.
Return Value
S_OK
The function was successful.
E_NOINTERFACE
The client object doesn't implement the specified interface.
This method may also return other error values. See Return Values for more details.
Comments
The parameters passed to DebugCreate are the same as those passed to IUnknown::QueryInterface, and they are treated the same way.
As with IUnknown::QueryInterface, when the returned interface is no longer needed, its IUnknown::Release method should be called.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
Client Objects
2009 Microsoft Corporation
Send feedback on this topic
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
IDebugAdvanced
The IDebugAdvanced interface includes the following methods:
GetThreadContext
SetThreadContext
Request
GetSourceFileInformation
FindSourceFileAndToken
GetSymbolInformation
GetSystemObjectInformation
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetThreadContext
The GetThreadContext method returns the current thread context.
HRESULT
IDebugAdvanced::GetThreadContext(
OUT PVOID Context,
IN ULONG ContextSize
);
Parameters
Context
Receives the current thread context. The type of the thread context is the CONTEXT structure for the target's effective processor. The buffer Context must be large
enough to hold this structure.
ContextSize
Specifies the size of the buffer Context.
Return Value
S_OK
The method was successful.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
This method may also return error values. See Return Values for more details.
Interface Version
GetThreadContext is available in all versions of IDebugAdvanced.
Comments
For more information about the thread context, see Scopes and Symbol Groups.
Note The CONTEXT structure varies with operating system and platform. Care should be taken when using the CONTEXT structure.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h. CONTEXT is defined in ntddk.h.
See Also
GetScope, SetThreadContext
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SetThreadContext
The SetThreadContext method sets the current thread context.
HRESULT
IDebugAdvanced::SetThreadContext(
IN PVOID Context,
IN ULONG ContextSize
);
Parameters
Context
Specifies the thread context. The type of the thread context is the CONTEXT structure for the target's effective processor. The buffer Context must be large enough to
hold this structure.
ContextSize
Specifies the size of the buffer Context.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
SetThreadContext is available in all versions of IDebugAdvanced.
Comments
For more information about the thread context, see Scopes and Symbol Groups.
Note The CONTEXT structure varies with operating system and platform. Care should be taken when using the CONTEXT structure.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
SetScope, GetThreadContext
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Request
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
DEBUG_REQUEST_SOURCE_PATH_HAS_SOURCE_SERVER
The DEBUG_REQUEST_SOURCE_PATH_HAS_SOURCE_SERVER Request operation checks the source path for a source server.
Parameters
InBuffer
Not used.
OutBuffer
Not used.
Return Value
S_OK
The source path includes a source server
S_FALSE
The source path does not include a source server.
See Also
Request
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
DEBUG_REQUEST_TARGET_EXCEPTION_CONTEXT
The DEBUG_REQUEST_TARGET_EXCEPTION_CONTEXT Request operation returns the thread context for the stored event in a user-mode minidump file.
Parameters
InBuffer
Not used.
OutBuffer
The thread context for the stored event. The type of the thread context is the CONTEXT structure for the target's effective processor at the time of the event. OutBuffer
must be large enough to hold this structure.
Comments
This information is also returned to the Context parameter by the GetStoredEventInformation method.
See Also
Request, GetStoredEventInformation
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
DEBUG_REQUEST_TARGET_EXCEPTION_THREAD
The DEBUG_REQUEST_TARGET_EXCEPTION_THREAD Request operation returns the operating system thread ID for the stored event in a user-mode minidump file.
Parameters
InBuffer
Not used.
OutBuffer
The operating system thread ID for the stored event. The type of the thread ID is ULONG.
See Also
Request
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
DEBUG_REQUEST_TARGET_EXCEPTION_RECORD
The DEBUG_REQUEST_TARGET_EXCEPTION_RECORD Request operation returns the exception record for the stored event in a user-mode minidump file.
Parameters
InBuffer
Not used.
OutBuffer
The exception record for the stored event. The type of the exception record is EXCEPTION_RECORD64, which is defined in winnt.h.
See Also
Request
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
DEBUG_REQUEST_GET_ADDITIONAL_CREATE_OPTIONS
The DEBUG_REQUEST_GET_ADDITIONAL_CREATE_OPTIONS Request operation returns the default process creation options.
Parameters
InBuffer
Not used.
OutBuffer
The default process creation options. The type of the process creation options is DEBUG_CREATE_PROCESS_OPTIONS.
Comments
The default process creation options are used by methods CreateProcess and CreateProcessAndAttach which, unlike CreateProcess2 and CreateProcessAndAttach2, do
not specify the full range of process creation options.
The CreateFlags field of the DEBUG_CREATE_PROCESS_OPTIONS structure is not used as a default because all process creation operations provide this information.
See Also
Request, DEBUG_REQUEST_SET_ADDITIONAL_CREATE_OPTIONS, DEBUG_CREATE_PROCESS_OPTIONS,
CreateProcess, CreateProcessAndAttach
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
DEBUG_REQUEST_SET_ADDITIONAL_CREATE_OPTIONS
The DEBUG_REQUEST_SET_ADDITIONAL_CREATE_OPTIONS Request operation sets the default process creation options.
Parameters
InBuffer
The new default process creation options. The type of the process creation options is DEBUG_CREATE_PROCESS_OPTIONS.
OutBuffer
Not used.
Comments
The default process creation options are used by methods CreateProcess and CreateProcessAndAttach which, unlike CreateProcess2 and CreateProcessAndAttach2, do
not specify the full range of process creation options.
The CreateFlags field of the DEBUG_CREATE_PROCESS_OPTIONS structure is not used as a default because all process creation operations provide this information.
See Also
Request, DEBUG_REQUEST_GET_ADDITIONAL_CREATE_OPTIONS, DEBUG_CREATE_PROCESS_OPTIONS,
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
CreateProcess, CreateProcessAndAttach
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
DEBUG_REQUEST_GET_WIN32_MAJOR_MINOR_VERSIONS
The DEBUG_REQUEST_GET_WIN32_MAJOR_MINOR_VERSIONS Request operation returns the version of Windows that is currently running on the target.
Parameters
InBuffer
Not used.
OutBuffer
The major and minor version numbers for the version of Windows that is currently running on the target. The type of the version numbers is an array containing two
ULONG values; the first ULONG in the array is the major version number and the second is the minor version number
The following table lists the major and minor version numbers by operating system.
Version of Windows Major version number Minor version number
Windows 2000
5
0
Windows XP
5
1
Windows Server 2003 5
2
See Also
Request, GetSystemVersionValues
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
DEBUG_REQUEST_READ_USER_MINIDUMP_STREAM
The DEBUG_REQUEST_READ_USER_MINIDUMP_STREAM Request operation reads a stream from a user-mode minidump target.
Parameters
InBuffer
The stream to read and the buffer into which to place the contents of the stream. The type of this parameter is DEBUG_READ_USER_MINIDUMP_STREAM.
OutBuffer
Not used.
The DEBUG_READ_USER_MINIDUMP_STREAM structure holds the parameters for the DEBUG_REQUEST_READ_USER_MINIDUMP_STREAM Request
operation.
typedef struct _DEBUG_READ_USER_MINIDUMP_STREAM
{
IN ULONG StreamType;
IN ULONG Flags;
IN ULONG64 Offset;
OUT PVOID Buffer;
IN ULONG BufferSize;
OUT ULONG BufferUsed;
} DEBUG_READ_USER_MINIDUMP_STREAM, *PDEBUG_READ_USER_MINIDUMP_STREAM;
Members
StreamType
Specifies the stream to read from the minidump file. The possible values for StreamType come from the MINIDUMP_STREAM_TYPE enumeration .
For a list of possible values and their interpretation, see the MINIDUMP_STREAM_TYPE topic in the Debug Help Library documentation in dbghelp.chm.
Flags
Set to zero.
Offset
Specifies the offset within the stream to start reading. To start reading from the beginning of the stream, set Offset to zero.
Buffer
Receives the bytes read from the minidump stream. Buffer can not be NULL.
BufferSize
Specifies the size, in bytes, of the buffer Buffer.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
BufferUsed
Receives the number of bytes read into the buffer Buffer.
Comments
The target must be a user-mode minidump file.
Each minidump file contains a number of streams. These streams are blocks of data written to the minidump file.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
Request
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
DEBUG_REQUEST_TARGET_CAN_DETACH
The DEBUG_REQUEST_TARGET_CAN_DETACH Request operation checks to see if it is possible for the debugger engine to detach from the current process (leaving the
process running but no longer being debugged).
Parameters
InBuffer
Not used.
OutBuffer
Not used.
Return Value
S_OK
It is possible to detach the debugger from the current process.
S_FALSE
It is not possible to detach the debugger from the current process.
Comments
Only targets running on Microsoft Windows XP or later versions of Windows support detaching the debugger from the process.
See Also
Request
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
DEBUG_REQUEST_SET_LOCAL_IMPLICIT_COMMAND_LINE
The DEBUG_REQUEST_SET_LOCAL_IMPLICIT_COMMAND_LINE Request operation sets the debugger engine's implicit command line.
Parameters
InBuffer
The new implicit command line. The type of InBuffer is a pointer to a Unicode string (PWSTR). The pointer is copied but the string it points to is not copied.
OutBuffer
Not used.
Comments
The implicit command line can be used as the command line when creating a process. The process creation options (DEBUG_CREATE_PROCESS_OPTIONS) contain an
option for using the implicit command line instead of a supplied command line when creating a process.
See Also
Request, DEBUG_CREATE_PROCESS_OPTIONS, DEBUG_REQUEST_GET_ADDITIONAL_CREATE_OPTIONS,
DEBUG_REQUEST_SET_ADDITIONAL_CREATE_OPTIONS, CreateProcess2, CreateProcessAndAttach2
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
DEBUG_REQUEST_GET_CAPTURED_EVENT_CODE_OFFSET
The DEBUG_REQUEST_GET_CAPTURED_EVENT_CODE_OFFSET Request operation returns the current event's instruction pointer.
Parameters
InBuffer
Not used.
OutBuffer
The instruction pointer of the current event. The type of the instruction pointer is ULONG64.
Return Value
S_OK
The method was successful.
E_NOINTERFACE
The memory at the instruction pointer for the current event is not valid.
This method may also return error values. See Return Values for more details.
Comments
The memory at the instruction pointer for the current event can be read using the Request operation's
DEBUG_REQUEST_READ_CAPTURED_EVENT_CODE_STREAM.
See Also
Request, DEBUG_REQUEST_READ_CAPTURED_EVENT_CODE_STREAM
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
DEBUG_REQUEST_READ_CAPTURED_EVENT_CODE_STREAM
The DEBUG_REQUEST_READ_CAPTURED_EVENT_CODE_STREAM Request operation returns up to 64 bytes of memory at the current event's instruction pointer.
Parameters
InBuffer
Not used.
OutBuffer
The memory at the current event's instruction pointer. Up to 64 bytes of memory may be returned.
Comments
The memory returned is a snapshot of the memory taken when the event occurred. It does not reflect any changes that may have been made to the target's memory since the
event.
The current event's instruction pointer is returned by the Request operation DEBUG_REQUEST_GET_CAPTURED_EVENT_CODE_OFFSET.
See Also
Request, DEBUG_REQUEST_GET_CAPTURED_EVENT_CODE_OFFSET
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
DEBUG_REQUEST_EXT_TYPED_DATA_ANSI
The DEBUG_REQUEST_EXT_TYPED_DATA_ANSI Request operation performs a variety of different sub-operations that aid in the interpretation of typed data.
Parameters
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
InBuffer
Specifies the EXT_TYPED_DATA structure that determines the sub-operation to perform. This EXT_TYPED_DATA structure contains the input parameters for that
sub-operation along with any (optional) additional data. The additional data is included in InBuffer after the EXT_TYPED_DATA structure. The size of InBuffer is the
total size of the buffer that contains the EXT_TYPED_DATA structure and the additional data. See EXT_TYPED_DATA for details on this structure and how to include
the additional data.
The following sub-operations are supported.
Sub-Operation
Description
EXT_TDOP_COPY
Makes a copy of a typed data description.
EXT_TDOP_RELEASE
Releases a typed data description.
EXT_TDOP_SET_FROM_EXPR
Returns the value of an expression.
EXT_TDOP_SET_FROM_U64_EXPR
Returns the value of an expression. An optional address can be provided as a parameter to the expression.
EXT_TDOP_GET_FIELD
Returns a member of a structure.
EXT_TDOP_EVALUATE
Returns the value of an expression. An optional value can be provided as a parameter to the expression.
EXT_TDOP_GET_TYPE_NAME
Returns the type name for typed data.
EXT_TDOP_OUTPUT_TYPE_NAME
Prints the type name for typed data.
EXT_TDOP_OUTPUT_SIMPLE_VALUE
Prints the value of typed data.
EXT_TDOP_OUTPUT_FULL_VALUE
Prints the type and value for typed data.
EXT_TDOP_HAS_FIELD
Determines if a structure contains a specified member.
EXT_TDOP_GET_FIELD_OFFSET
Returns the offset of a member within a structure.
EXT_TDOP_GET_ARRAY_ELEMENT
Returns an element from an array.
EXT_TDOP_GET_DEREFERENCE
Dereferences a pointer, returning the value it points to.
EXT_TDOP_GET_TYPE_SIZE
Returns the size of the specified typed data.
EXT_TDOP_OUTPUT_TYPE_DEFINITION
Prints the definition of the type for the specified typed data.
EXT_TDOP_GET_POINTER_TO
Returns a new typed data description that represents a pointer to specified typed data.
EXT_TDOP_SET_FROM_TYPE_ID_AND_U64
Creates a typed data description from a type and memory location.
EXT_TDOP_SET_PTR_FROM_TYPE_ID_AND_U64 Creates a typed data description that represents a pointer to a specified memory location with specified type.
OutBuffer
Receives the EXT_TYPED_DATA structure that contains the output parameters and any additional data for the sub-operation. As with InBuffer, the size of OutBuffer is
the total size of the buffer that contains the EXT_TYPED_DATA structure and any additional data.
The DEBUG_REQUEST_EXT_TYPED_DATA_ANSI operation will initially copy InBuffer into OutBuffer and then modify the contents of OutBuffer in place. This
means that OutBuffer will be populated with the input parameters of the EXT_TYPED_DATA and any additional data that was provided in InBuffer. It also means that
the size of OutBuffer must be at least as big as the size of InBuffer.
Return Value
S_OK
The operation was successful.
This method can also return error values. See Return Values for more details.
The value returned by this operation is also stored in the Status member of OutBuffer.
Comments
The sub-operation performed by the DEBUG_REQUEST_EXT_TYPED_DATA_ANSI Request operation is determined by the Operation member of the
EXT_TYPED_DATA structure, which takes a value in the EXT_TDOP enumeration.
See Also
EXT_TYPED_DATA, EXT_TDOP, Request
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
EXT_TDOP_COPY
The EXT_TDOP_COPY sub-operation of the DEBUG_REQUEST_EXT_TYPED_DATA_ANSI Request operation makes a copy of a typed data description.
Parameters
Operation
Set to EXT_TDOP_COPY for this sub-operation.
InData
Specifies the original instance of the DEBUG_TYPED_DATA structure.
OutData
Receives the copy of the instance of the DEBUG_TYPED_DATA structure specified by InData.
Status
Receives the status code returned by this sub-operation. This is the same as the value returned by Request.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Comments
EXT_TDOP_COPY is a value in the EXT_TDOP enumeration.
The parameters for this sub-operation are members of the EXT_TYPED_DATA structure. The members of EXT_TYPED_DATA that are not listed in the preceding
Parameters section are not used by this sub-operation and should be set to zero. The descriptions of the members in the preceding Parameters section specify what the
members are used for. For more details on the members, see EXT_TYPED_DATA.
See Also
DEBUG_REQUEST_EXT_TYPED_DATA_ANSI, EXT_TDOP, EXT_TYPED_DATA, Request
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
EXT_TDOP_RELEASE
The EXT_TDOP_RELEASE sub-operation of the DEBUG_REQUEST_EXT_TYPED_DATA_ANSI Request operation releases a typed data description.
Parameters
Operation
Set to EXT_TDOP_RELEASE for this sub-operation.
InData
Specifies the instance of the DEBUG_TYPED_DATA structure to release.
Status
Receives the status code returned by this sub-operation. This is the same as the value returned by Request.
Comments
EXT_TDOP_RELEASE is a value in the EXT_TDOP enumeration.
The parameters for this sub-operation are members of the EXT_TYPED_DATA structure. The members of EXT_TYPED_DATA that are not listed in the preceding
Parameters section are not used by this sub-operation and should be set to zero. The descriptions of the members in the preceding Parameters section specify only the purpose
of the members in this particular setting. See EXT_TYPED_DATA for more details.
See Also
DEBUG_REQUEST_EXT_TYPED_DATA_ANSI, EXT_TDOP, EXT_TYPED_DATA, Request
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
EXT_TDOP_SET_FROM_EXPR
The EXT_TDOP_SET_FROM_EXPR sub-operation of the DEBUG_REQUEST_EXT_TYPED_DATA_ANSI Request operation returns a typed data description that
represents the value of an expression.
Parameters
Operation
Set to EXT_TDOP_SET_FROM_EXPR for this sub-operation.
Flags
Specifies the bit flags that describe the target's memory in which the value of the expression resides. See EXT_TYPED_DATA for details of these flags.
OutData
Receives the DEBUG_TYPED_DATA structure that represents the value of the expression.
InStrIndex
Specifies the expression to evaluate. This expression is evaluated by the default expression evaluator.
Status
Receives the status code returned by this sub-operation. This is the same as the value returned by Request.
Comments
EXT_TDOP_SET_FROM_EXPR is a value in the EXT_TDOP enumeration.
The parameters for this sub-operation are members of the EXT_TYPED_DATA structure. The members of EXT_TYPED_DATA that are not listed in the preceding
Parameters section are not used by this sub-operation and should be set to zero. The descriptions of the members in the preceding Parameters section specify what the
members are used for. See EXT_TYPED_DATA for more details.
See Also
DEBUG_REQUEST_EXT_TYPED_DATA_ANSI, EXT_TDOP, EXT_TYPED_DATA, Request
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
EXT_TDOP_SET_FROM_U64_EXPR
The EXT_TDOP_SET_FROM_U64_EXPR sub-operation of the DEBUG_REQUEST_EXT_TYPED_DATA_ANSI Request operation returns a typed data description that
represents the value of an expression.
Parameters
Operation
Set to EXT_TDOP_SET_FROM_U64_EXPR for this sub-operation.
Flags
Specifies the bit flags that describe the target's memory in which the value of the expression resides. See EXT_TYPED_DATA for details of these flags.
InData
Specifies optional typed data whose address in the target's memory can be used in the expression specified by InStrIndex. This address is used by the expression as the
pseudo-register $extin.
OutData
Receives the DEBUG_TYPED_DATA structure that represents the value of the expression.
InStrIndex
Specifies the expression to evaluate. This expression is evaluated by the default expression evaluator.
Status
Receives the status code returned by this sub-operation. This is the same as the value returned by Request.
Comments
EXT_TDOP_SET_FROM_U64_EXPR is a value in the EXT_TDOP enumeration.
The parameters for this sub-operation are members of the EXT_TYPED_DATA structure. The members of EXT_TYPED_DATA that are not listed in the preceding
Parameters section are not used by this sub-operation and should be set to zero. The descriptions of the members in the preceding Parameters section specify what the
members are used for. See EXT_TYPED_DATA for more details.
See Also
DEBUG_REQUEST_EXT_TYPED_DATA_ANSI, EXT_TDOP, EXT_TYPED_DATA, Request
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
EXT_TDOP_GET_FIELD
The EXT_TDOP_GET_FIELD sub-operation of the DEBUG_REQUEST_EXT_TYPED_DATA_ANSI Request operation returns typed data description that represents a
member of a given structure.
Parameters
Operation
Set to EXT_TDOP_GET_FIELD for this sub-operation.
InData
Specifies an instance of DEBUG_TYPED_DATA that describes the structure whose member is desired.
OutData
Receives an instance of DEBUG_TYPED_DATA for the requested member.
InStrIndex
Specifies the name of the requested member. The name of the member is a dot-separated path and can contain sub-membersfor example, mymember.mysubmember.
Pointers on this dot-separated path will automatically be dereferenced. However, a dot operator (.) should still be used here instead of the usual C pointer dereference
operator (->).
Status
Receives the status code returned by this sub-operation. This is the same as the value returned by Request.
Comments
EXT_TDOP_GET_FIELD is a value in the EXT_TDOP enumeration.
The parameters for this sub-operation are members of the EXT_TYPED_DATA structure. The members of EXT_TYPED_DATA that are not listed in the preceding
Parameters section are not used by this sub-operation and should be set to zero. The descriptions of the members in the preceding Parameters section specify what the
members are used for. See EXT_TYPED_DATA for more details.
See Also
DEBUG_REQUEST_EXT_TYPED_DATA_ANSI, EXT_TDOP, EXT_TYPED_DATA, Request
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
EXT_TDOP_EVALUATE
The EXT_TDOP_EVALUATE sub-operation of the DEBUG_REQUEST_EXT_TYPED_DATA_ANSI Request operation returns the typed data description that represents
the value of an expression.
Parameters
Operation
Set to EXT_TDOP_EVALUATE for this sub-operation.
Flags
Specifies the bit flags that describe the target's memory in which the value of the expression resides. See EXT_TYPED_DATA for details of these flags.
InData
Specifies optional typed data whose value can be used in the expression specified by InStrIndex. This value is used by the expression as the pseudo-register $extin.
OutData
Receives the DEBUG_TYPED_DATA structure that represents the value of the expression.
InStrIndex
Specifies the expression to evaluate. This expression is evaluated by the default expression evaluator.
Status
Receives the status code returned by this sub-operation. This is the same as the value returned by Request.
Comments
EXT_TDOP_EVALUATE is a value in the EXT_TDOP enumeration.
The parameters for this sub-operation are members of the EXT_TYPED_DATA structure. The members of EXT_TYPED_DATA that are not listed in the preceding
Parameters section are not used by this sub-operation and should be set to zero. The descriptions of the members in the preceding Parameters section specify what the
members are used for. See EXT_TYPED_DATA for more details.
See Also
DEBUG_REQUEST_EXT_TYPED_DATA_ANSI, EXT_TDOP, EXT_TYPED_DATA, Request
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
EXT_TDOP_GET_TYPE_NAME
The EXT_TDOP_GET_TYPE_NAME sub-operation of the DEBUG_REQUEST_EXT_TYPED_DATA_ANSI Request operation returns the type name of the specified
typed data.
Parameters
Operation
Set to EXT_TDOP_GET_TYPE_NAME for this sub-operation.
InData
Specifies the typed data whose type name is being requested.
StrBufferIndex
Receives the type name.
StrBufferChars
Specifies the size, in characters, of the ANSI string buffer StrBufferIndex.
StrCharsNeeded
Receives the size, in characters, of the type name.
Status
Receives the status code returned by this sub-operation. This is the same as the value returned by Request.
Comments
EXT_TDOP_GET_TYPE_NAME is a value in the EXT_TDOP enumeration.
The parameters for this sub-operation are members of the EXT_TYPED_DATA structure. The members of EXT_TYPED_DATA that are not listed in the preceding
Parameters section are not used by this sub-operation and should be set to zero. The descriptions of the members in the preceding Parameters section specify what the
members are used for. See EXT_TYPED_DATA for more details.
See Also
DEBUG_REQUEST_EXT_TYPED_DATA_ANSI, EXT_TDOP, EXT_TYPED_DATA, Request
2009 Microsoft Corporation
Send feedback on this topic
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
EXT_TDOP_OUTPUT_TYPE_NAME
The EXT_TDOP_OUTPUT_TYPE_NAME sub-operation of the DEBUG_REQUEST_EXT_TYPED_DATA_ANSI Request operation prints the type name of the specified
typed data.
Parameters
Operation
Set to EXT_TDOP_OUTPUT_TYPE_NAME for this sub-operation.
InData
Specifies the typed data whose type name will be printed.
Status
Receives the status code returned by this sub-operation. This is the same as the value returned by Request.
Comments
The type name is sent to the debugger engine's output callbacks.
EXT_TDOP_OUTPUT_TYPE_NAME is a value in the EXT_TDOP enumeration.
The parameters for this sub-operation are members of the EXT_TYPED_DATA structure. The members of EXT_TYPED_DATA that are not listed in the preceding
Parameters section are not used by this sub-operation and should be set to zero. The descriptions of the members in the preceding Parameters section specify what the
members are used for. See EXT_TYPED_DATA for more details.
See Also
DEBUG_REQUEST_EXT_TYPED_DATA_ANSI, EXT_TDOP, EXT_TYPED_DATA, Request
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
EXT_TDOP_OUTPUT_SIMPLE_VALUE
The EXT_TDOP_OUTPUT_SIMPLE_VALUE sub-operation of the DEBUG_REQUEST_EXT_TYPED_DATA_ANSI Request operation prints the value of the specified
typed data.
Parameters
Operation
Set to EXT_TDOP_OUTPUT_SIMPLE_VALUE for this sub-operation.
InData
Specifies the typed data whose value will be printed.
Status
Receives the status code returned by this sub-operation. This is the same as the value returned by Request.
Comments
The value is formatted and is sent to the debugger engine's output callbacks.
EXT_TDOP_OUTPUT_SIMPLE_VALUE is a value in the EXT_TDOP enumeration.
The parameters for this sub-operation are members of the EXT_TYPED_DATA structure. The members of EXT_TYPED_DATA that are not listed in the preceding
Parameters section are not used by this sub-operation and should be set to zero. The descriptions of the members in the preceding Parameters section specify what the
members are used for. See EXT_TYPED_DATA for more details.
See Also
DEBUG_REQUEST_EXT_TYPED_DATA_ANSI, EXT_TDOP, EXT_TYPED_DATA, Request
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
EXT_TDOP_OUTPUT_FULL_VALUE
The EXT_TDOP_OUTPUT_FULL_VALUE sub-operation of the DEBUG_REQUEST_EXT_TYPED_DATA_ANSI Request operation prints the type and value of the
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
EXT_TDOP_HAS_FIELD
The EXT_TDOP_HAS_FIELD sub-operation of the DEBUG_REQUEST_EXT_TYPED_DATA_ANSI Request operation determines if a structure contains a specified
member.
Parameters
Operation
Set to EXT_TDOP_HAS_FIELD for this sub-operation.
InData
Specifies the typed data that is checked for the existence of the member. The typed data is first checked to see if it represents an instance of a structure, then the structure
is checked to see if it contains the specified member.
InStrIndex
Specifies the name of the member. The name is a dot-separated path and can contain sub-membersfor example, mymember.mysubmember. Pointers on this dotseparated path will automatically be dereferenced. However, a dot operator (.) should still be used here instead of the usual C pointer dereference operator (->).
Status
Receives the status code returned by this sub-operation. This is the same as the value returned by Request.
If the typed data contains the member, Status receives S_OK. If the typed data does not contain the member, Status receives E_NOINTERFACE. Other error values
might also be returned.
Comments
EXT_TDOP_HAS_FIELD is a value in the EXT_TDOP enumeration.
The parameters for this sub-operation are members of the EXT_TYPED_DATA structure. The members of EXT_TYPED_DATA that are not listed in the preceding
Parameters section are not used by this sub-operation and should be set to zero. The descriptions of the members in the preceding Parameters section specify what the
members are used for. See EXT_TYPED_DATA for more details.
See Also
DEBUG_REQUEST_EXT_TYPED_DATA_ANSI, EXT_TDOP, EXT_TYPED_DATA, Request
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
EXT_TDOP_GET_FIELD_OFFSET
The EXT_TDOP_GET_FIELD_OFFSET sub-operation of the DEBUG_REQUEST_EXT_TYPED_DATA_ANSI Request operation returns the offset of a member within a
structure.
Parameters
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Operation
Set to EXT_TDOP_GET_FIELD_OFFSET for this sub-operation.
InData
Specifies the typed data that represents an instance of a structure that contains the member whose offset is being requested.
InStrIndex
Specifies the name of the member whose offset is being requested. The name is a dot-separated path and can contain sub-members. For example,
mymember.mysubmember. Pointers on this dot-separated path will automatically be dereferenced. However, a dot operator (.) should still be used here instead of the
usual C pointer dereference operator (->).
Out32
Receives the offset of the member within an instance of the structure. This is the number of bytes between the beginning of an instance of the structure and the member.
Status
Receives the status code returned by this sub-operation. This is the same as the value returned by Request.
Comments
EXT_TDOP_GET_FIELD_OFFSET is a value in the EXT_TDOP enumeration.
The parameters for this sub-operation are members of the EXT_TYPED_DATA structure. The members of EXT_TYPED_DATA that are not listed in the preceding
Parameters section are not used by this sub-operation and should be set to zero. The descriptions of the members in the preceding Parameters section specify what the
members are used for. See EXT_TYPED_DATA for more details.
See Also
DEBUG_REQUEST_EXT_TYPED_DATA_ANSI, EXT_TDOP, EXT_TYPED_DATA, Request
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
EXT_TDOP_GET_ARRAY_ELEMENT
The EXT_TDOP_GET_ARRAY_ELEMENT sub-operation of the DEBUG_REQUEST_EXT_TYPED_DATA_ANSI Request operation returns an element from an array.
Parameters
Operation
Set to EXT_TDOP_GET_ARRAY_ELEMENT for this sub-operation.
InData
Specifies the array whose element is being requested. InData can also specify a pointer, in which case it is treated as an array.
OutData
Receives the requested element from the array.
In64
Specifies the index of the element in the array.
Status
Receives the status code returned by this sub-operation. This is the same as the value returned by Request.
Comments
EXT_TDOP_GET_ARRAY_ELEMENT is a value in the EXT_TDOP enumeration.
The parameters for this sub-operation are members of the EXT_TYPED_DATA structure. The members of EXT_TYPED_DATA that are not listed in the preceding
Parameters section are not used by this sub-operation and should be set to zero. The descriptions of the members in the preceding Parameters section specify what the
members are used for. See EXT_TYPED_DATA for more details.
See Also
DEBUG_REQUEST_EXT_TYPED_DATA_ANSI, EXT_TDOP, EXT_TYPED_DATA, Request
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
EXT_TDOP_GET_DEREFERENCE
The EXT_TDOP_GET_DEREFERENCE sub-operation of the DEBUG_REQUEST_EXT_TYPED_DATA_ANSI Request operation dereferences a pointer and returns the
value it points to.
Parameters
Operation
Set to EXT_TDOP_GET_DEREFERENCE for this sub-operation.
InData
Specifies the pointer to dereference. InData can also specify an array, in which case the first element in the array is returned.
OutData
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
EXT_TDOP_GET_TYPE_SIZE
The EXT_TDOP_GET_TYPE_SIZE sub-operation of the DEBUG_REQUEST_EXT_TYPED_DATA_ANSI Request operation returns the size of the specified typed data.
Parameters
Operation
Set to EXT_TDOP_GET_TYPE_SIZE for this sub-operation.
InData
Specifies the typed data whose size is being requested.
Out32
Receives the size, in bytes, of the typed data.
Status
Receives the status code returned by this sub-operation. This is the same as the value returned by Request.
Comments
EXT_TDOP_GET_TYPE_SIZE is a value in the EXT_TDOP enumeration.
The parameters for this sub-operation are members of the EXT_TYPED_DATA structure. The members of EXT_TYPED_DATA that are not listed in the preceding
Parameters section are not used by this sub-operation and should be set to zero. The descriptions of the members in the preceding Parameters section specify what the
members are used for. See EXT_TYPED_DATA for more details.
See Also
DEBUG_REQUEST_EXT_TYPED_DATA_ANSI, EXT_TDOP, EXT_TYPED_DATA, Request
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
EXT_TDOP_OUTPUT_TYPE_DEFINITION
The EXT_TDOP_OUTPUT_TYPE_DEFINITION sub-operation of the DEBUG_REQUEST_EXT_TYPED_DATA_ANSI Request operation prints the definition of the
type for the specified typed data.
Parameters
Operation
Set to EXT_TDOP_OUTPUT_TYPE_DEFINITION for this sub-operation.
InData
Specifies the typed data whose type's definition will be printed.
Status
Receives the status code returned by this sub-operation. This is the same as the value returned by Request.
Comments
The definition of the type is formatted and sent to the debugger engine's output callbacks.
EXT_TDOP_OUTPUT_TYPE_DEFINITION is a value in the EXT_TDOP enumeration.
The parameters for this sub-operation are members of the EXT_TYPED_DATA structure. The members of EXT_TYPED_DATA that are not listed in the preceding
Parameters section are not used by this sub-operation and should be set to zero. The descriptions of the members in the preceding Parameters section specify what the
members are used for. See EXT_TYPED_DATA for more details.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
See Also
DEBUG_REQUEST_EXT_TYPED_DATA_ANSI, EXT_TDOP, EXT_TYPED_DATA, Request
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
EXT_TDOP_GET_POINTER_TO
The EXT_TDOP_GET_POINTER_TO sub-operation of the DEBUG_REQUEST_EXT_TYPED_DATA_ANSI Request operation returns a new typed data description that
represents a pointer to specified typed data.
Parameters
Operation
Set to EXT_TDOP_GET_POINTER_TO for this sub-operation.
InData
Specifies the original typed data description to which a pointer is returned.
OutData
Receives a typed data description that represents a pointer to the typed data specified by InData.
Status
Receives the status code returned by this sub-operation. This is the same as the value returned by Request.
Comments
EXT_TDOP_GET_POINTER_TO is a value in the EXT_TDOP enumeration.
The parameters for this sub-operation are members of the EXT_TYPED_DATA structure. The members of EXT_TYPED_DATA that are not listed in the preceding
Parameters section are not used by this sub-operation and should be set to zero. The descriptions of the members in the preceding Parameters section specify what the
members are used for. See EXT_TYPED_DATA for more details.
See Also
DEBUG_REQUEST_EXT_TYPED_DATA_ANSI, EXT_TDOP, EXT_TYPED_DATA, Request
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
EXT_TDOP_SET_FROM_TYPE_ID_AND_U64
The EXT_TDOP_SET_FROM_TYPE_ID_AND_U64 sub-operation of the DEBUG_REQUEST_EXT_TYPED_DATA_ANSI Request operation creates a typed data
description from a data type and a memory location.
Parameters
Operation
Set to EXT_TDOP_SET_FROM_TYPE_ID_AND_U64 for this sub-operation.
Flags
Specifies the bit flags that describe the target's memory in which the value of the typed data resides. See EXT_TYPED_DATA for details of these flags.
InData
Specifies the type and the memory location. This instance of the DEBUG_TYPED_DATA structure can be manually created and populated with the required members.
The following members are used:
ModBase
Specifies the location in the target's virtual memory of the base address of the module that contains the type.
Offset
Specifies the location in the target's memory of the data. Offset is a virtual memory address unless there are flags present in Flags that specify that Offset is a
physical memory address.
TypeId
Specifies the type ID of the type.
OutData
Receives the typed data description.
Status
Receives the status code returned by this sub-operation. This is the same as the value returned by Request.
Comments
EXT_TDOP_SET_FROM_TYPE_ID_AND_U64 is a value in the EXT_TDOP enumeration.
The parameters for this sub-operation are members of the EXT_TYPED_DATA structure. The members of EXT_TYPED_DATA that are not listed in the preceding
Parameters section are not used by this sub-operation and should be set to zero. The descriptions of the members in the preceding Parameters section specify what the
members are used for. See EXT_TYPED_DATA for more details.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
See Also
DEBUG_REQUEST_EXT_TYPED_DATA_ANSI, EXT_TDOP, EXT_TYPED_DATA, Request
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
EXT_TDOP_SET_PTR_FROM_TYPE_ID_AND_U64
The EXT_TDOP_SET_PTR_FROM_TYPE_ID_AND_U64 sub-operation of the DEBUG_REQUEST_EXT_TYPED_DATA_ANSI Request operation creates a typed data
description that represents a pointer to a specified memory location with a specified type.
Parameters
Operation
Set to EXT_TDOP_SET_PTR_FROM_TYPE_ID_AND_U64 for this sub-operation.
Flags
Specifies the bit flags that describe the target's memory in which the value of the typed data resides. See EXT_TYPED_DATA for details of these flags.
InData
Specifies the type and memory location. This instance of the DEBUG_TYPED_DATA structure can be manually created and populated with the required members. The
following members are used:
ModBase
Specifies the location in the target's virtual memory of the base address of the module that contains the type.
Offset
Specifies the location in the target's memory of the data. Offset is a virtual memory address unless there are flags present in Flags that specify that Offset is a
physical memory address.
TypeId
Specifies the type ID of the type.
OutData
Receives the typed data description that represents a pointer to the memory location and type.
Status
Receives the status code returned by this sub-operation. This is the same as the value returned by Request.
Comments
EXT_TDOP_SET_PTR_FROM_TYPE_ID_AND_U64 is a value in the EXT_TDOP enumeration.
The parameters for this sub-operation are members of the EXT_TYPED_DATA structure. The members of EXT_TYPED_DATA that are not listed in the preceding
Parameters section are not used by this sub-operation and should be set to zero. The descriptions of the members in the preceding Parameters section specify what the
members are used for. See EXT_TYPED_DATA for more details.
See Also
DEBUG_REQUEST_EXT_TYPED_DATA_ANSI EXT_TDOP, EXT_TYPED_DATA, Request,
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetSourceFileInformation
The GetSourceFileInformation and GetSourceFileInformationWide methods return specified information about a source file.
HRESULT
IDebugAdvanced2::GetSourceFileInformation(
IN ULONG Which,
IN PSTR SourceFile,
IN ULONG64 Arg64,
IN ULONG Arg32,
OUT OPTIONAL PVOID Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG InfoSize
);
HRESULT
IDebugAdvanced3::GetSourceFileInformationWide(
IN ULONG Which,
IN PWSTR SourceFile,
IN ULONG64 Arg64,
IN ULONG Arg32,
OUT OPTIONAL PVOID Buffer,
IN ULONG BufferSize,
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
InfoSize
#ifdef UNICODE
#define GetSourceFileInformationT GetSourceFileInformationWide
#else
#define GetSourceFileInformationT GetSourceFileInformation
#endif
Parameters
Which
Specifies the piece of information to return. The Which parameter can take one of the values in the following table.
DEBUG_SRCFILE_SYMBOL_TOKEN
Returns a token representing the specified source file on a source server. This token can be passed to FindSourceFileAndToken to retrieve information about the
file. The token is returned to the Buffer buffer as an array of bytes. The size of this token is a reflection of the size of the SrcSrv token.
DEBUG_SRCFILE_SYMBOL_TOKEN_SOURCE_COMMAND_WIDE
Queries a source server for the command to extract the source file from source control. This includes the name of the executable file and its command-line
parameters. The command is returned to the Buffer buffer as a Unicode string.
SourceFile
Specifies the source file whose information is being requested. The source file is looked up on all the source servers in the source path.
Arg64
Specifies a 64-bit argument. The value of Which specifies the module whose symbol token is requested. Regardless of the value of Which, Arg64 is a location within the
memory allocation of the module.
Arg32
Specifies a 32-bit argument. This parameter is currently unused.
Buffer
Receives the requested symbol information. The type of the data returned depends on the value of Which. If Buffer is NULL, this information is not returned.
BufferSize
Specifies the size in bytes of the Buffer buffer. If Buffer is NULL, BufferSize must also be NULL.
InfoSize
Specifies the size in bytes of the information returned to the Buffer buffer. This parameter can be NULL if the data is not required.
Return Value
S_OK
The method was successful.
S_FALSE
The method was successful. However, the information would not fit in the Buffer buffer, so the information or name was truncated.
This method may also return error values. See Return Values for more details.
Interface Version
GetSourceFileInformation is available in IDebugAdvanced2 and later versions. GetSourceFileInformationWide is available in IDebugAdvanced3 and later versions.
Comments
For more information about source files, see Using Source Files.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
FindSourceFileAndToken
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
FindSourceFileAndToken
The FindSourceFileAndToken and FindSourceFileAndTokenWide methods returns the filename of a source file on the source path or return the value of a variable
associated with a file token.
HRESULT
IDebugAdvanced2::FindSourceFileAndToken(
IN ULONG StartElement,
IN ULONG64 ModAddr,
IN PCSTR File,
IN ULONG Flags,
IN OPTIONAL PVOID FileToken,
IN ULONG FileTokenSize,
OUT OPTIONAL PULONG FoundElement,
OUT OPTIONAL PSTR Buffer,
IN ULONG BufferSize,
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
FoundSize
HRESULT
IDebugAdvanced3::FindSourceFileAndTokenWide(
IN ULONG StartElement,
IN ULONG64 ModAddr,
IN PCWSTR File,
IN ULONG Flags,
IN OPTIONAL PVOID FileToken,
IN ULONG FileTokenSize,
OUT OPTIONAL PULONG FoundElement,
OUT OPTIONAL PSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG FoundSize
);
#ifdef UNICODE
#define FindSourceFileAndTokenT FindSourceFileAndTokenWide
#else
#define FindSourceFileAndTokenT FindSourceFileAndToken
#endif
Parameters
StartElement
Specifies the index of an element within the source path to start searching from. All elements in the source path before StartElement are excluded from the search. The
index of the first element is zero. If StartElement is greater than or equal to the number of elements in the source path, the filing system is checked directly.
This parameter can be used with FoundElement to check for multiple matches in the source path.
StartElement is ignored if the flag DEBUG_FIND_SOURCE_TOKEN_LOOKUP is set in Flags.
ModAddr
Specifies a location within the memory allocation of the module in the target to which the source file is related. ModAddr is used for caching the search results and when
querying source servers for the file. ModAddr can be NULL.
ModAddr is ignored if the flag DEBUG_FIND_SOURCE_TOKEN_LOOKUP is set in Flags. And it is not used for querying source servers if FileToken is not NULL.
File
Specifies the path and filename of the file to search for.
If the flag DEBUG_FIND_SOURCE_TOKEN_LOOKUP is set, the file is already specified by the token in FileToken. In this case, File specifies the name of a variable
on the source server related to the file. The variable must begin and end with the percent sign ( % ), for example, %SRCSRVCMD%. The value of this variable is
returned.
Flags
Specifies the flags that control the behavior of this method. For a description of these flags, see DEBUG_FIND_SOURCE_XXX.
FileToken
Specifies a file token representing a file on a source server. A file token can be obtained by setting Which to DEBUG_SRCFILE_SYMBOL_TOKEN in the method
GetSourceFileInformation.
If the flag DEBUG_FIND_SOURCE_TOKEN_LOOKUP is set, FileToken must not be NULL.
FileTokenSize
Specifies the size in bytes of the FileToken token. If FileToken is NULL, this parameter is ignored.
FoundElement
Receives the index of the element within the source path that contained the file. If the file was found directly on the filing system (not using the source path), -1 is
returned to FoundElement. If FoundElement is NULL or Flags contain DEBUG_SRCFILE_SYMBOL_TOKEN, this information is not returned.
Buffer
Receives the name of the file that was found. If the file is not on a source server, this is the name of the file in the local source cache. If the flag
DEBUG_FIND_SOURCE_FULL_PATH is set, this is the full canonical path name for the file. Otherwise, it is the concatenation of the directory in the source path with
the tail of File that was used to find the file.
If the flag DEBUG_SRCFILE_SYMBOL_TOKEN is set in Flags, Buffer receives the value of the variable named File associated with the file token FileToken.
If Buffer is NULL, this information is not returned.
BufferSize
Specifies the size in characters of the Buffer buffer. If Buffer is NULL, this parameter is ignored.
FoundSize
Specifies the size in characters of the name of the file. If foundSize is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
S_FALSE
The method was successful. However, the Buffer buffer was too small to hold the file name or variable value, so the string was truncated to fit in the buffer.
This method may also return error values. See Return Values for more details.
Interface Version
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
FindSourceFileAndToken is available in IDebugAdvanced2 and later versions. FindSourceFileAndTokenWide is available in IDebugAdvanved3 and later versions.
Comments
When the flag DEBUG_SRCFILE_SYMBOL_TOKEN is set in Flags, this method does not search for a file on the source path. Instead, it looks up a variable associated with
the file token provided in FileToken. These variables are documented in the topic Language Specification 1. For example, to retrieve the value of the variable
SRCSRVCMDthe command to extract the source file from source control (also returned by the DEBUG_SRCFILE_SYMBOL_TOKEN_SOURCE_COMMAND_WIDE
function of GetSourceFileInformation)set File to %SRCSRVCMD%.
The engine uses the following stepsin orderto search for the file:
1. If the source path contains any source servers and the flag DEBUG_FIND_SOURCE_NO_SRCSRV is not set, the source server in the source path is searched first.
The first match found is returned.
2. For each directory in the source path, an attempt is made to find an overlap between the end of the directory path and the beginning of the file path. For example, if the
source path contains a directory C:\a\b\c\d and File is c\d\e\foo.c, the file C:\a\b\c\d\e\foo.c is a match.
If the flag DEBUG_FIND_SOURCE_BEST_MATCH is set, the match with the longest overlap is returned; otherwise, the first match is returned.
3. For each directory in the source path, File is appended to the directory. If no match is found, this process is repeated and each time the first directory is removed from
the beginning of the file path. For example, if the source path contains a directory C:\a\b and File is c\d\e\foo.c, the file C:\a\b\e\foo.c is a match.
The first match found is returned.
4. The file File is looked up directly on the filing system.
For more information about source files, see Using Source Files. For an overview of the source path and its syntax, see Source Path.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
FindSourceFile, DEBUG_FIND_SOURCE_XXX, GetSourceFileInformation, GetSourcePathElement
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetSymbolInformation
The GetSymbolInformation and SetSymbolInformationWide methods return specified information about a symbol.
HRESULT
IDebugAdvanced2::GetSymbolInformation(
IN ULONG Which,
IN ULONG64 Arg64,
IN ULONG Arg32,
OUT OPTIONAL PVOID Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG InfoSize,
OUT OPTIONAL PSTR StringBuffer,
IN ULONG StringBufferSize,
OUT OPTIONAL PULONG StringSize
);
HRESULT
IDebugAdvanced3::GetSymbolInformationWide(
IN ULONG Which,
IN ULONG64 Arg64,
IN ULONG Arg32,
OUT OPTIONAL PVOID Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG InfoSize,
OUT OPTIONAL PWSTR StringBuffer,
IN ULONG StringBufferSize,
OUT OPTIONAL PULONG StringSize
);
#ifdef UNICODE
#define GetSymbolInformationT GetSymbolInformationWide
#else
#define GetSymbolInformationT GetSymbolInformation
#endif
Parameters
Which
Specifies the piece of information to return. Which can take one of the values in the follow table.
Value
Information returned
DEBUG_SYMINFO_BREAKPOINT_SOURCE_LINE
Returns the source code file name and line number for a specified breakpoint. The
line number is returned to Buffer as a ULONG. The file name is returned to
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
DEBUG_SYMINFO_IMAGEHLP_MODULEW64
StringBuffer.
Returns an IMAGEHLP_MODULEW64 structure that describes a specified module.
For details about this structure, see the IMAGEHELP_MODULE64 topic in the
Debug Help Library documentation (dbghelp.chm).
No string is returned and StringBuffer, StringBufferSize, and StringSize must all be
set to zero.
DEBUG_SYMINFO_GET_SYMBOL_NAME_BY_OFFSET_AND_TAG_WIDE Returns the Unicode name of the symbol specified by location in memory and PDB
tag type. The name is returned to Buffer. StringBuffer is not used.
DEBUG_SYMINFO_GET_MODULE_SYMBOL_NAMES_AND_OFFSETS
Returns a list of symbol names and offsets for the symbols in the specified module
with the specified PDB tag type. The offsets are returned as an array of ULONG
values to Buffer. The names are returned in the same order as the offsets to
StringBuffer. Some names might contain embedded zeros because annotations can
have multi-part names; hence, each name is terminated with two null characters.
Arg64
Specifies a 64-bit argument. This parameter has the following interpretations depending on the value of Which:
DEBUG_SYMINFO_BREAKPOINT_SOURCE_LINE
Ignored.
DEBUG_SYMINFO_IMAGEHLP_MODULEW64
The base address of the module whose description is being requested.
DEBUG_SYMINFO_GET_SYMBOL_NAME_BY_OFFSET_AND_TAG_WIDE
Specifies the address in the target's memory of the symbol whose name is being requested.
DEBUG_SYMINFO_GET_MODULE_SYMBOL_NAMES_AND_OFFSETS
Specifies the module whose symbols are requested. Arg64 is a location within the memory allocation of the module.
Arg32
Specifies a 32-bit argument. This parameter has the following interpretations depending on the value of Which:
DEBUG_SYMINFO_BREAKPOINT_SOURCE_LINE
The engine breakpoint ID of the desired breakpoint.
DEBUG_SYMINFO_IMAGEHLP_MODULEW64
Set to zero.
DEBUG_SYMINFO_GET_SYMBOL_NAME_BY_OFFSET_AND_TAG_WIDE
The PDB classification of the symbol. Arg32 must be one of the values in the SymTagEnum enumeration defined in Dbghelp.h. For more information, see PDB
documentation.
DEBUG_SYMINFO_GET_MODULE_SYMBOL_NAMES_AND_OFFSETS
The PDB classification of the symbol. Arg32 must be one of the values in the SymTagEnum enumeration defined in Dbghelp.h. For more information, see PDB
documentation.
Buffer
Receives the requested symbol information. The type of the data returned depends on the value of Which. If Buffer is NULL, this information is not returned.
BufferSize
Specifies the size, in bytes, of the buffer Buffer.
InfoSize
Receives the size, in bytes, of the symbol information returned to Buffer. If InfoSize is NULL, this information is not returned.
StringBuffer
Receives the requested string. The interpretation of this string depends on the value of Which. If StringBuffer is NULL, this information is not returned.
StringBufferSize
Specifies the size, in characters, of the string buffer StringBuffer.
StringSize
Receives the size, in characters, of the string returned to StringBuffer. If StringSize is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
S_FALSE
The method was successful. However, the information would not fit in the buffer Buffer or the string would not fit in the buffer StringBuffer, so the information or name
was truncated.
This method may also return error values. See Return Values for more details.
Interface Version
GetSymbolInformation is available in IDebugAdvanced2 and later versions. GetSymbolInformationWide is available in IDebugAdvanved3 and later versions.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetSystemObjectInformation
The GetSystemObjectInformation method returns information about operating system objects on the target.
HRESULT
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
IDebugAdvanced2::GetSystemObjectInformation(
IN ULONG Which,
IN ULONG64 Arg64,
IN ULONG Arg32,
OUT OPTIONAL PVOID Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG InfoSize
);
Parameters
Which
Specifies the type of object and the type of information to return about that object. Which can take the following value.
Value
Information returned
DEBUG_SYSOBJINFO_THREAD_BASIC_INFORMATION Returns details of the thread specified by engine thread ID.
Arg64
Specifies a 64-bit argument. This parameter has the following interpretations depending on the value of Which:
DEBUG_SYSOBJINFO_THREAD_BASIC_INFORMATION
Not used.
Arg32
Specifies a 32-bit argument. This parameter has the following interpretations depending on the value of Which:
DEBUG_SYSOBJINFO_THREAD_BASIC_INFORMATION
The engine thread ID of the desired thread.
Buffer
Receives the requested information. The type of data returned in Buffer depends on the value of Which.
Value
Return type
DEBUG_SYSOBJINFO_THREAD_BASIC_INFORMATION DEBUG_THREAD_BASIC_INFORMATION
BufferSize
Specifies the size, in bytes, of the buffer Buffer.
InfoSize
Receives the size of the information that is returned.
Return Value
S_OK
The method was successful.
S_FALSE
The method was successful. However, the information would not fit in the buffer Buffer, so the information was truncated.
This method may also return error values. See Return Values for more details.
Interface Version
GetSystemObjectInformation is available in IDebugAdvanced2 and later versions.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
IDebugSystemObjects
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
IDebugClient
The IDebugClient Interface includes the following methods:
DispatchCallbacks
ExitDispatch
FlushCallbacks
GetEventCallbacks
SetEventCallbacks
GetNumberEventCallbacks
GetInputCallbacks
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
SetInputCallbacks
GetNumberInputCallbacks
GetOutputCallbacks
SetOutputCallbacks
GetNumberOutputCallbacks
CreateClient
AddDumpInformationFile
AddDumpInformationFileWide
GetDumpFile
GetNumberDumpFiles
OpenDumpFile
OpenDumpFileWide
WriteDumpFile
WriteDumpFile2
WriteDumpFileWide
GetExitCode
GetIdentity
OutputIdentity
AttachKernel
GetKernelConnectionOptions
SetKernelConnectionOptions
IsKernelDebuggerEnabled
PushOutputLinePrefix
PopOutputLinePrefix
GetOutputLinePrefix
SetOutputLinePrefix
GetOutputMask
SetOutputMask
GetOtherOutputMask
SetOtherOutputMask
GetOutputWidth
SetOutputWidth
GetQuitLockString
SetQuitLockString
AttachProcess
CreateProcess
CreateProcess2
CreateProcessAndAttach
CreateProcessAndAttach2
DetachProcesses
TerminateProcesses
AbandonCurrentProcess
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
DetachCurrentProcess
TerminateCurrentProcess
AddProcessOptions
GetProcessOptions
RemoveProcessOptions
SetProcessOptions
GetRunningProcessDescription
GetRunningProcessSystemIds
GetRunningProcessSystemIdByExecutableName
ConnectProcessServer
DisconnectProcessServer
EndProcessServer
StartProcessServer
WaitForProcessServerEnd
OutputServers
StartServer
ConnectSession
EndSession
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
DispatchCallbacks
The DispatchCallbacks method lets the debugger engine use the current thread for callbacks.
HRESULT
IDebugClient::DispatchCallbacks(
IN ULONG Timeout
);
Parameters
Timeout
Specifies how many milliseconds to wait before this method will return. If Timeout is INFINITE, this method will not return until ExitDispatch is called or an error
occurs.
Return Value
S_OK
The method was successful (ExitDispatch was used).
S_FALSE
Timeout milliseconds elapsed.
This method may also return error values. See Return Values for more details.
Interface Version
DispatchCallbacks is available in all versions of IDebugClient.
Comments
This method returns when Timeout milliseconds have elapsed, ExitDispatch is called, or an error occurs.
Almost all client methods must be called from the thread in which the client was created; callback objects registered with the client are also called from this thread. When
DispatchCallbacks is called the engine can use the current thread to make callback calls.
Client threads should call this method whenever possible to allow the callbacks to be called, unless the thread was the same thread used to start the debugger session, in which
case the callbacks are called when WaitForEvent is called.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
ExitDispatch
The ExitDispatch method causes the DispatchCallbacks method to return.
HRESULT
IDebugClient::ExitDispatch(
IN IDebugClient * Client
);
Parameters
Client
Specifies the client whose DispatchCallbacks method should return.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
ExitDispatch is available in all versions of IDebugClient.
Comments
This method is reentrant and may be called from any thread.
This method can be used to interrupt a thread waiting in DispatchCallbacks.
For more information about callbacks, see Callbacks.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
DispatchCallbacks
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
FlushCallbacks
The FlushCallbacks method forces any remaining buffered output to be delivered to the IDebugOutputCallbacks object registered with this client.
HRESULT
IDebugClient::FlushCallbacks(
);
Parameters
None
Return Value
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
FlushCallbacks is available in all versions of IDebugClient.
Comments
The engine sometimes merges compatible callback requests to reduce callback overhead; small pieces of output are collected into larger groups to reduce the number of
IDebugOutputCallbacks::Output calls. Using FlushCallbacks is necessary for a client to guarantee that all pending callbacks have been processed at a particular point. For
example, a caller can flush callbacks before starting a lengthy operation outside of the engine so that pending callbacks are not delayed until after the operation.
For more information about callbacks, see Callbacks.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
IDebugOutputCallbacks, IDebugOutputCallbacks::Output, DispatchCallbacks
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetEventCallbacks
The GetEventCallbacks and GetEventCallbacksWide methods return the event callbacks object registered with this client.
HRESULT
IDebugClient::GetEventCallbacks(
OUT IDebugEventCallbacks * * Callbacks
);
HRESULT
IDebugClient5::GetEventCallbacksWide(
OUT IDebugEventCallbacksWide * * Callbacks
);
#ifdef UNICODE
#define GetEventCallbacksT GetEventCallbacksWide
#define IDebugEventCallbacksT IDebugEventCallbacksWide
#else
#define GetEventCallbacksT GetEventCallbacks
#define IDebugEventCallbacksT IDebugEventCallbacks
#endif
Parameters
Callbacks
Receives an interface pointer to the event callbacks object registered with this client.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetEventCallbacks is available in all versions of IDebugClient. GetEventCallbacksWide is available in IDebugClient5 and later versions.
Comments
Each client can have at most one IDebugEventCallbacks or IDebugEventCallbacksWide object registered with it for receiving events.
If no event callbacks object is registered with the client, the value of Callbacks will be set to NULL.
The IDebugEventCallbacks interface extends the COM interface IUnknown. Before returning the IDebugEventCallbacks object specified by Callbacks, the engine calls
its IUnknown::AddRef method. When this object is no longer needed, its IUnknown::Release method should be called.
For more information about callbacks, see Callbacks.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
IDebugEventCallbacks, SetEventCallbacks
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SetEventCallbacks
The SetEventCallbacks and SetEventCallbacksWide methods register an event callbacks object with this client.
HRESULT
IDebugClient::SetEventCallbacks(
IN IDebugEventCallbacks * Callbacks
);
HRESULT
IDebugClient5::SetEventCallbacksWide(
IN IDebugEventCallbacks * Callbacks
);
#ifdef UNICODE
#define SetEventCallbacksT SetEventCallbacksWide
#define IDebugEventCallbacksT IDebugEventCallbacksWide
#else
#define SetEventCallbacksT SetEventCallbacks
#define IDebugEventCallbacksT IDebugEventCallbacksWide
#endif
Parameters
Callbacks
Specifies the interface pointer to the event callbacks object to register with this client.
Return Value
S_OK
The method was successful.
Depending on the implementation of the method IDebugEventCallbacks::GetInterestMask in the object specified by Callbacks, other values may be returned, as described
in the Comments section.
Interface Version
SetEventCallbacks is available in all versions of IDebugClient. SetEventCallbacksWide is available in IDebugClient5 and later versions.
Comments
If the value of Callbacks is not NULL, the method IDebugEventCallbacks::GetInterestMask is called. If the return value is not S_OK, SetEventCallbacks and
SetEventCallbacksWide have no effect and they return this value.
Each client can have at most one IDebugEventCallbacks or IDebugEventCallbacksWide object registered with it for receiving events.
The IDebugEventCallbacks interface extends the COM interface IUnknown. When SetEventCallbacks and SetEventCallbacksWide are successful, they call the
IUnknown::AddRef method of the object specified by Callbacks. The IUnknown::Release method of this object will be called the next time SetEventCallbacks or
SetEventCallbacksWide is called on this client, or when this client is deleted.
For more information about callbacks, see Callbacks.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
IDebugEventCallbacks, GetEventCallbacks
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetNumberEventCallbacks
The GetNumberEventCallbacks method returns the number of event callbacks that are interested in the given events.
HRESULT
IDebugClient5::GetNumberEventCallbacks(
IN ULONG EventFlags,
OUT PULONG Count
);
Parameters
EventFlags
Specifies a set of events used to filter out some of the event callbacks; only event callbacks that have indicated an interest in one of the events in EventFlags will be
counted. See DEBUG_EVENT_XXX for a list of the events.
Count
Receives the number of event callbacks that are interested in at least one of the events in EventFlags.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetNumberEventCallbacks is available in IDebugClient5 and later versions.
Comments
Each client can have at most one event callback registered with it. When a callback is registered with a client, its IDebugEventCallbacks::GetInterestMask method is called
to allow the client to specify which events it is interested in.
For more information about callbacks, see Callbacks.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
IDebugEventCallbacks, GetEventCallbacks, SetEventCallbacks, GetNumberOutputCallbacks, GetNumberInputCallbacks
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetInputCallbacks
The GetInputCallbacks method returns the input callbacks object registered with this client.
HRESULT
IDebugClient::GetInputCallbacks(
OUT IDebugInputCallbacks * * Callbacks
);
Parameters
Callbacks
Receives an interface pointer for the IDebugInputCallbacks object registered with the client.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetInputCallbacks is available in all versions of IDebugClient.
Comments
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Each client can have at most one IDebugInputCallbacks object registered with it to receive requests for input.
If no IDebugInputCallbacks object is registered with the client, the value of Callbacks will be set to NULL.
The IDebugInputCallbacks interface extends the COM interface IUnknown. Before returning the IDebugInputCallbacks object specified by Callbacks, the engine calls its
IUnknown::AddRef method. When this object is no longer needed, its IUnknown::Release method should be called.
For more information about callbacks, see Callbacks.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
IDebugInputCallbacks, SetInputCallbacks
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SetInputCallbacks
The SetInputCallbacks method registers an input callbacks object with the client.
HRESULT
IDebugClient::SetInputCallbacks(
IN IDebugInputCallbacks * Callbacks
);
Parameters
Callbacks
Specifies the interface pointer to the input callbacks object to register with this client.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
SetInputCallbacks is available in all versions of IDebugClient.
Comments
Each client can have at most one IDebugInputCallbacks object registered with it to receive requests for input.
The IDebugInputCallbacks interface extends the COM interface IUnknown. SetInputCallbacks will call the IUnknown::AddRef method of the object specified by
Callbacks. The IUnknown::Release method of this interface will be called the next time SetInputCallbacks is called on this client, or when this client is deleted.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
IDebugInputCallbacks, GetInputCallbacks
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetNumberInputCallbacks
The GetNumberInputCallbacks method returns the number of input callbacks registered over all clients.
HRESULT
IDebugClient5::GetNumberInputCallbacks(
OUT PULONG Count
);
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Parameters
Count
Receives the number of input callbacks that have been registered.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetNumberInputCallbacks is available in IDebugClient5 and later versions.
Comments
Each client can have at most one input callback registered with it.
For more information about callbacks, see Callbacks.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
IDebugInputCallbacks, GetInputCallbacks, SetInputCallbacks, GetNumberOutputCallbacks, GetNumberEventCallbacks
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetOutputCallbacks
The GetOutputCallbacks and GetOutputCallbacksWide methods return the output callbacks object registered with the client.
HRESULT
IDebugClient::GetOutputCallbacks(
OUT IDebugOutputCallbacks * * Callbacks
);
HRESULT
IDebugClient5::GetOutputCallbacksWide(
OUT IDebugOutputCallbacksWide * * Callbacks
);
#ifdef UNICODE
#define GetOutputCallbacksT GetOutputCallbacksWide
#define IDebugOutputCallbacksT IDebugOutputCallbacksWide
#else
#define GetOutputCallbacksT GetOutputCallbacks
#define IDebugOutputCallbacksT IDebugOutputCallbacks
#endif
Parameters
Callbacks
Receives an interface pointer to the IDebugOutputCallbacks object registered with the client.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetOutputCallbacks is available in all versions of IDebugClient. GetOutputCallbacksWide is available in IDebugClient5 and later versions.
Comments
Each client can have at most one IDebugOutputCallbacks or IDebugOutputCallbacksWide object registered with it for output.
If no output callbacks object is registered with the client, the value of Callbacks will be set to NULL.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The IDebugOutputCallbacks interface extends the COM interface IUnknown. Before returning the IDebugOutputCallbacks object specified by Callbacks, the engine
calls its IUnknown::AddRef method. When this object is no longer needed, its IUnknown::Release method should be called.
For more information about callbacks, see Callbacks.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
IDebugOutputCallbacks, SetOutputCallbacks
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SetOutputCallbacks
The SetOutputCallbacks method registers an output callbacks object with this client.
HRESULT
IDebugClient::SetOutputCallbacks(
IN IDebugOutputCallbacks * Callbacks
);
HRESULT
IDebugClient5::SetOutputCallbacksWide(
IN IDebugOutputCallbacksWide * Callbacks
);
#ifdef UNICODE
#define SetOutputCallbacksT SetOutputCallbacksWide
#define IDebugOutputCallbacksT IDebugOutputCallbacksWide
#else
#define SetOutputCallbacksT SetOutputCallbacks
#define IDebugOutputCallbacksT IDebugOutputCallbacks
#endif
Parameters
Callbacks
Specifies the interface pointer to the output callbacks object to register with this client.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
SetOutputCallbacks is available in all versions of IDebugClient. SetOutputCallbacksWide is available in IDebugClient5 and later versions.
Comments
Each client can have at most one IDebugOutputCallbacks or IDebugOutputCallbacks object registered with it for output.
The IDebugOutputCallbacks interface extends the COM interface IUnknown. SetOutputCallbacks and SetOutputCAllbacksWide call the IUnknown::AddRef method
in the object specified by Callbacks. The IUnknown::Release method of this interface will be called the next time SetOutputCallbacks or SetOutputCallbacksWide is
called on this client, or when this client is deleted.
For more information about callbacks, see Callbacks.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
IDebugOutputCallbacks, GetOutputCallbacks
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetNumberOutputCallbacks
The GetNumberOutputCallbacks method returns the number of output callbacks registered over all clients.
HRESULT
IDebugClient5::GetNumberOutputCallbacks(
OUT PULONG Count
);
Parameters
Count
Receives the number of output callbacks that have been registered.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetNumberOutputCallbacks is available in IDebugClient5 and later versions.
Comments
Each client can have at most one output callback registered with it.
For more information about callbacks, see Callbacks.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
IDebugOutputCallbacks, GetOutputCallbacks, SetOutputCallbacks, GetNumberEventCallbacks, GetNumberInputCallbacks
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
CreateClient
The CreateClient method creates a new client object for the current thread.
HRESULT
IDebugClient::CreateClient(
OUT IDebugClient * * Client
);
Parameters
Client
Receives an interface pointer for the new client.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
CreateClient is available in all versions of IDebugClient.
Comments
This method creates a client that may be used in the current thread.
Clients are specific to the thread that created them. Calls from other threads fail immediately. The CreateClient method is a notable exception; it allows creation of a new
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
AddDumpInformationFile
The AddDumpInformationFile method registers additional files containing supporting information that will be used when opening a dump file. The Unicode version of this
method is AddDumpInformationFileWide.
HRESULT
IDebugClient2::AddDumpInformationFile(
IN PCSTR InfoFile,
IN ULONG Type
);
Parameters
InfoFile
Specifies the name of the file containing the supporting information.
Type
Specifies the type of the file InfoFile. Currently, only files containing paging file information are supported, and Type must be set to
DEBUG_DUMP_FILE_PAGE_FILE_DUMP.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
AddDumpInformationFile is available in IDebugClient2 and later versions.
Comments
If supporting information is to be used when opening a dump file, this method or AddDumpInformationFileWide must be called before OpenDumpFile is called. If a
session has already started, this method cannot be used.
For more information about crash dump files, see Dump File Targets.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
AddDumpInformationFileWide, GetNumberDumpFiles, GetDumpFile, OpenDumpFile, OpenDumpFileWide
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
AddDumpInformationFileWide
The AddDumpInformationFileWide method registers additional files containing supporting information that will be used when opening a dump file. The ASCII version of
this method is AddDumpInformationFile.
HRESULT
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
IDebugClient4::AddDumpInformationFileWide(
IN OPTIONAL PCWSTR FileName,
IN ULONG64 FileHandle,
IN ULONG Type
);
Parameters
FileName
Specifies the name of the file containing the supporting information. If FileHandle is not zero, FileName is used only for informational purposes.
FileHandle
Specifies the handle of the file containing the supporting information. If FileHandle is zero, the file named in FileName is used.
Type
Specifies the type of the file in FileName or FileHandle. Currently, only files containing paging file information are supported, and Type must be set to
DEBUG_DUMP_FILE_PAGE_FILE_DUMP.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
AddDumpInformationFileWide is available in IDebugClient4 and later versions.
Comments
If supporting information is to be used when opening a dump file, this method or AddDumpInformationFile must be called before OpenDumpFile is called. If a session has
already started, this method cannot be used.
For more information about crash dump files, see Dump-File Targets.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
AddDumpInformationFile, GetNumberDumpFiles, GetDumpFile, OpenDumpFile, OpenDumpFileWide
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetDumpFile
The GetDumpFile and GetDumpFileWide methods describe the files containing supporting information that were used when opening the current dump target.
HRESULT
IDebugClient4::GetDumpFile(
IN ULONG Index,
OUT OPTIONAL PSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG NameSize,
OUT OPTIONAL PULONG64 Handle,
OUT PULONG Type
);
HRESULT
IDebugClient4::GetDumpFileWide(
IN ULONG Index,
OUT OPTIONAL PWSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG NameSize,
OUT OPTIONAL PULONG64 Handle,
OUT PULONG Type
);
#ifdef UNICODE
#define GetDumpFileT GetDumpFileWide
#else
#define GetDumpFileT GetDumpFile
#endif
Parameters
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Index
Specifies which file to describe. Index can take values between zero and the number of files minus one; the number of files can be found by using
GetNumberDumpFiles.
Buffer
Receives the file name. If Buffer is NULL, this information is not returned.
BufferSize
Specifies the size in characters of the buffer Buffer.
NameSize
Receives the size of the file name. If NameSize is NULL, this information is not returned.
Handle
Receives the file handle of the file. If Handle is NULL, this information is not returned.
Type
Receives the type of the file.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetDumpFile and GetDumpFileWide are available in IDebugClient4 and later versions.
Comments
For more information about crash dump files, see Dump-File Targets.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
GetNumberDumpFiles, AddDumpInformationFileWide, AddDumpInformationFile
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetNumberDumpFiles
The GetNumberDumpFiles method returns the number of files containing supporting information that were used when opening the current dump target.
HRESULT
IDebugClient4::GetNumberDumpFiles(
OUT PULONG Number
);
Parameters
Number
Receives the number of files.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetNumberDumpFiles is available in all versions of IDebugClient4.
Comments
For more information about crash dump files, see Dump-File Targets.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
GetDumpFile, AddDumpInformationFile, AddDumpInformationFileWide
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
OpenDumpFile
The OpenDumpFile method opens a dump file as a debugger target.
HRESULT
IDebugClient::OpenDumpFile(
IN PCSTR DumpFile
);
Parameters
DumpFile
Specifies the name of the dump file to open. DumpFile must include the file name extension. DumpFile can include a relative or absolute path; relative paths are relative
to the directory in which the debugger was started. DumpFile can have the form of a file URL, starting with "file://". If DumpFile specifies a cabinet (.cab) file, the
cabinet file is searched for the first file with extension .kdmp, then .hdmp, then .mdmp, and finally .dmp.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
OpenDumpFile is available in all versions of IDebugClient.
Comments
The Unicode version of this method is OpenDumpFileWide.
Note The engine doesn't completely attach to the dump file until the WaitForEvent method has been called. When a dump file is created from a process or kernel,
information about the last event is stored in the dump file. After the dump file is opened, the next time execution is attempted, the engine will generate this event for the event
callbacks. Only then does the dump file become available in the debugging session.
For more information about crash dump files, see Dump-File Targets.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
OpenDumpFileWide, .opendump (Open Dump File), AddDumpInformationFile, AddDumpInformationFileWide
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
OpenDumpFileWide
The OpenDumpFileWide method opens a dump file as a debugger target.
HRESULT
IDebugClient4::OpenDumpFileWide(
IN OPTIONAL PCWSTR FileName,
IN ULONG64 FileHandle
);
Parameters
FileName
Specifies the name of the dump file to open unless FileHandle is not zero, in which case FileName is used only when the engine is queried for the name of the dump
file. FileName must include the file name extension. FileName can include a relative or absolute path; relative paths are relative to the directory in which the debugger
was started. FileName can also be in the form of a file URL, starting with "file://". If FileName specifies a cabinet (.cab) file, the cabinet file is searched for the first file
with extension .kdmp, then .hdmp, then .mdmp, and finally .dmp.
FileHandle
Specifies the file handle of the dump file to open. If FileHandle is zero, FileName is used to open the dump file. Otherwise, if FileName is not null, the engine returns it
when queried for the name of the dump file. If FileHandle is not zero and FileName is NULL, the engine will return <HandleOnly> for the file name.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
OpenDumpFileWide is available in IDebugClient4 and later versions.
Comments
The ASCII version of this method is OpenDumpFile.
Note The engine doesn't completely attach to the dump file until the WaitForEvent method has been called. When a dump file is created from a process or kernel,
information about the last event is stored in the dump file. After the dump file is opened, the next time execution is attempted, the engine will generate this event for the event
callbacks. Only then does the dump file become available in the debugging session.
For more information about crash dump files, see Dump-File Targets.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
OpenDumpFile, .opendump (Open Dump File), AddDumpInformationFile, AddDumpInformationFileWide
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
WriteDumpFile
The WriteDumpFile method creates a user-mode or kernel-mode crash dump file.
HRESULT
IDebugClient::WriteDumpFile(
IN PCSTR DumpFile,
IN ULONG Qualifier
);
Parameters
DumpFile
Specifies the name of the dump file to create. DumpFile must include the file name extension. DumpFile can include a relative or absolute path; relative paths are relative
to the directory in which the debugger was started.
Qualifier
Specifies the type of dump file to create. For possible values, see DEBUG_DUMP_XXX.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
WriteDumpFile is available in all versions of IDebugClient.
Comments
To specify the formatting of the file andfor user-mode minidumpsthe information to include in the file, use WriteDumpFile2 or WriteDumpFileWide.
For more information about crash dump files, see Dump-File Targets.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
WriteDumpFile2, WriteDumpFileWide, .dump (Create Dump File)
2009 Microsoft Corporation
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
WriteDumpFile2
The WriteDumpFile2 method creates a user-mode or kernel-mode crash dump file.
HRESULT
IDebugClient2::WriteDumpFile2(
IN PCSTR DumpFile,
IN ULONG Qualifier,
IN ULONG FormatFlags,
IN OPTIONAL PCSTR Comment
);
Parameters
DumpFile
Specifies the name of the dump file to create. DumpFile must include the file name extension. DumpFile can include a relative or absolute path; relative paths are relative
to the directory in which the debugger was started.
Qualifier
Specifies the type of dump file to create. For possible values, see DEBUG_DUMP_XXX.
FormatFlags
Specifies flags that determine the format of the dump file andfor user-mode minidumpswhat information to include in the file. For details, see
DEBUG_FORMAT_XXX.
Comment
Specifies a comment string to be included in the crash dump file. This string is displayed in the debugger console when the dump file is loaded. Some dump file formats
do not support the storing of comment strings.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
WriteDumpFile2 is available in IDebugClient2 and later versions.
Comments
For more information about crash dump files, see Dump-File Targets.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
WriteDumpFileWide, .dump (Create Dump File)
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
WriteDumpFileWide
The WriteDumpFileWide method creates a user-mode or kernel-mode crash dump file.
HRESULT
IDebugClient4::WriteDumpFileWide(
IN OPTIONAL PCWSTR FileName,
IN ULONG64 FileHandle,
IN ULONG Qualifier,
IN ULONG FormatFlags,
IN OPTIONAL PCWSTR Comment
);
Parameters
FileName
Specifies the name of the dump file to create. FileName must include the file name extension. FileName can include a relative or absolute path; relative paths are relative
to the directory in which the debugger was started. If FileHandle is not NULL, FileName is ignored (except when writing status messages to the debugger console).
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
FileHandle
Specifies the file handle of the file to write the crash dump to. If FileHandle is NULL, the file specified in FileName is used instead.
Qualifier
Specifies the type of dump to create. For possible values, see DEBUG_DUMP_XXX.
FormatFlags
Specifies flags that determine the format of the dump file andfor user-mode minidumpswhat information to include in the file. For details, see
DEBUG_FORMAT_XXX.
Comment
Specifies a comment string to be included in the crash dump file. This string is displayed in the debugger console when the dump file is loaded.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
WriteDumpFileWide is available in IDebugClient4 and later versions.
Comments
For more information about crash dump files, see Dump-File Targets.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
WriteDumpFile2, .dump (Create Dump File)
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetExitCode
The GetExitCode method returns the exit code of the current process if that process has already run through to completion.
HRESULT
IDebugClient::GetExitCode(
OUT PULONG Code
);
Parameters
Code
Receives the exit code of the process. If the process is still running, Code will be set to STILL_ACTIVE.
Return Value
S_OK
The method was successful.
S_FALSE
The process is still running.
This method may also return error values. See Return Values for more details.
Interface Version
GetExitCode is available in all versions of IDebugClient.
Comments
This method is available only for live user-mode debugging.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h. STILL_ACTIVE is defined in winbase.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetIdentity
The GetIdentity and GetIdentityWide methods return a string describing the computer and user this client represents.
HRESULT
IDebugClient::GetIdentity(
OUT OPTIONAL PSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG IdentitySize
);
HRESULT
IDebugClient5::GetIdentityWide(
OUT OPTIONAL PWSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG IdentitySize
);
#ifdef UNICODE
#define GetIdentityT GetIdentityWide
#else
#define GetIdentityT GetIdentity
#endif
Parameters
Buffer
Specifies the buffer to receive the string. If Buffer is NULL, this information is not returned.
BufferSize
Specifies the size of the buffer Buffer.
IdentitySize
Receives the size of the string. If IdentitySize is NULL, this information is not returned.
Return Value
S_OK
The method was successful
S_FALSE
The size of the string was greater than the size of the buffer, so it was truncated to fit into the buffer.
This method may also return error values. See Return Values for more details.
Interface Version
GetIdentity is available in all versions of IDebugClient. GetIdentityWide is available in IDebugClient5 and later versions.
Comments
The specific content of the string varies with the operating system. If the client is remotely connected, some network information may also be present.
For more information about client objects, see Client Objects.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
OutputIdentity
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
OutputIdentity
The OutputIdentity and OutputIdentityWide methods format and output a string describing the computer and user this client represents.
HRESULT
IDebugClient::OutputIdentity(
IN ULONG OutputControl,
IN ULONG Flags,
IN PCSTR Format
);
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
HRESULT
IDebugClient5::OutputIdentityWide(
IN ULONG OutputControl,
IN ULONG Flags,
IN PCWSTR Format
);
#ifdef UNICODE
#define OutputIdentityT OutputIdentityWide
#else
#define OutputIdentityT OutputIdentity
#endif
Parameters
OutputControl
Specifies where to send the output. For possible values, see DEBUG_OUTCTL_XXX.
Flags
Set to zero.
Format
Specifies a format string similar to the printf format string. However, this format string must only contain one formatting directive, %s, which will be replaced by a
description of the computer and user this client represents.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
OutputIdentity is available in all versions of IDebugClient. OutputIdentityWide is available in IDebugClient5 and later versions.
Comments
The specific content of the string varies with the operating system. If the client is remotely connected, some network information may also be present.
For more information about client objects, see Client Objects.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
GetIdentity
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
AttachKernel
The AttachKernel and AttachKernelWide methods connect the debugger engine to a kernel target.
HRESULT
IDebugClient::AttachKernel(
IN ULONG Flags,
IN OPTIONAL PCSTR ConnectOptions
);
HRESULT
IDebugClient5::AttachKernelWide(
IN ULONG Flags,
IN OPTIONAL PCWSTR ConnectOptions
);
#ifdef UNICODE
#define AttachKernelT AttachKernelWide
#else
#define AttachKernelT AttachKernel
#endif
Parameters
Flags
Specifies the flags that control how the debugger attaches to the kernel target. The possible values are:
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Value
Description
DEBUG_ATTACH_KERNEL_CONNECTION Attach to the kernel on the target computer.
DEBUG_ATTACH_LOCAL_KERNEL
Attach to the local kernel. To check whether this option is available, use IsKernelDebuggerEnabled.
DEBUG_ATTACH_EXDI_DRIVER
Attach to a kernel by using an eXDI driver.
ConnectOptions
Specifies the connection settings for communicating with the computer running the kernel target. The interpretation of ConnectOptions depends on the value of Flags.
DEBUG_ATTACH_KERNEL_CONNECTION
ConnectOptions will be interpreted the same way as the options that follow the -k switch on the WinDbg and KD command lines. Environment variables affect
ConnectOptions in the same way they affect the -k switch. For details on the syntax of this string, see Choosing Kernel Debugging Settings.
DEBUG_ATTACH_LOCAL_KERNEL
Set to NULL.
DEBUG_ATTACH_EXDI_DRIVER
eXDI drivers are not described in this documentation. If you have an eXDI interface to your hardware probe or hardware simulator, please contact Microsoft for
debugging information.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
AttachKernel is available in all versions of IDebugClient. AttachKernelWide is available in IDebugClient5 and later versions.
Comments
Local debugging and debugging over an IEEE 1394 cable are supported only on Windows XP and later versions of Windows. Both the target computer and the host computer
must be running one of these Windows versions, but not necessarily the same one.
Note The engine doesn't completely attach to the kernel until the WaitForEvent method has been called. Only after the kernel has generated an event for example, the
initial breakpoint does it become available in the debugger session.
For more information about connecting to live kernel-mode targets, see Live Kernel-Mode Targets.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
GetKernelConnectionOptions, AttachProcess, IsKernelDebuggerEnabled
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetKernelConnectionOptions
The GetKernelConnectionOptions and GetKernelConnectionOptionsWide methods return the connection options for the current kernel target.
HRESULT
IDebugClient::GetKernelConnectionOptions(
OUT OPTIONAL PSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG OptionsSize
);
HRESULT
IDebugClient5::GetKernelConnectionOptionsWide(
OUT OPTIONAL PWSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG OptionsSize
);
#ifdef UNICODE
#define GetKernelConnectionOptionsT GetKernelConnectionOptionsWide
#else
#define GetKernelConnectionOptionsT GetKernelConnectionOptions
#endif
Parameters
Buffer
Specifies the buffer to receive the connection options.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
BufferSize
Specifies the size in characters of the buffer Buffer.
OptionsSize
Receives the size in characters of the connection options. If OptionsSize is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
S_FALSE
The size of the string was greater than the size of the buffer, so it was truncated to fit into the buffer.
E_UNEXPECTED
The current target is not a standard live kernel target.
This method may also return error values. See Return Values for more details.
Interface Version
GetKernelConnectionOptions is available in all versions of IDebugClient. GetKernelConnectionOptionsWide is available in IDebugClient5 and later versions.
Comments
This method is available only for live kernel targets that are not local and not connected through eXDI.
The connection options returned are the same options used to connect to the kernel. For details on the syntax of this string, see Choosing Kernel Debugging Settings.
For more information about connecting to live kernel-mode targets, see Live Kernel-Mode Targets.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
AttachKernel, Choosing Kernel Debugging Settings
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SetKernelConnectionOptions
The SetKernelConnectionOptions and SetKernelConnectionOptionsWide methods update some of the connection options for a live kernel target.
HRESULT
IDebugClient::SetKernelConnectionOptions(
IN PCSTR Options
);
HRESULT
IDebugClient5::SetKernelConnectionOptionsWide(
IN PCWSTR Options
);
#ifdef UNICODE
#define SetKernelConnectionOptionsT SetKernelConnectionOptionsWide
#else
#define SetKernelConnectionOptionsT SetKernelConnectionOptions
#endif
Parameters
Options
Specifies the connection options to update. The possible values are:
Value
Description
"resync"
Re-synchronize the connection between the debugger engine and the kernel. For more information, see Synchronizing with the Target Computer.
"cycle_speed" For kernel connections through a COM port, cycle through the supported baud rates; for other connections, do nothing. For more information, see
CTRL+A (Toggle Baud Rate).
Return Value
S_OK
The method was successful.
E_UNEXPECTED
The current target is not a live (non-local) kernel target.
This method may also return error values. See Return Values for more details.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Interface Version
SetKernelConnectionOptions is available in all versions of IDebugClient. SetKernelConnectionOptionsWide is available in IDebugClient5 and later versions.
Comments
This method is available only for live kernel targets that are not local and not connected through eXDI. This method is reentrant.
For more information about connecting to live kernel-mode targets, see Live Kernel-Mode Targets.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
AttachKernel
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
IsKernelDebuggerEnabled
The IsKernelDebuggerEnabled method checks whether kernel debugging is enabled for the local kernel.
HRESULT
IDebugClient2::IsKernelDebuggerEnabled();
Parameters
None
Return Value
S_OK
Kernel debugging is enabled for the local kernel.
S_FALSE
Kernel debugging is not enabled for the local kernel.
This method may also return error values. See Return Values for more details.
Interface Version
IsKernelDebuggerEnabled is available in IDebugClient2 and later versions.
Comments
Kernel debugging is available for the local computer if the computer was booted by using the /debug boot switch. In some Windows installations, local kernel debugging is
supported when other switchessuch as /debugportare used, but this is not a guaranteed feature of Windows and should not be relied on. For more information about
kernel debugging on a single computer, see Performing Local Kernel Debugging.
For more information about connecting to live kernel-mode targets, see Live Kernel-Mode Targets.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
AttachKernel
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetOutputMask
The GetOutputMask method returns the output mask currently set for the client.
HRESULT
IDebugClient::GetOutputMask(
OUT PULONG Mask
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
);
Parameters
Mask
Receives the output mask for the client. See DEBUG_OUTPUT_XXX for details on how to interpret this value.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetOutputMask is available in all versions of IDebugClient.
Comments
For an overview of output in the debugger engine, see Input and Output.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
SetOutputMask, GetOtherOutputMask
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SetOutputMask
The SetOutputMask method sets the output mask for the client.
HRESULT
IDebugClient::SetOutputMask(
IN ULONG Mask
);
Parameters
Mask
Specifies the new output mask for the client. See DEBUG_OUTPUT_XXX for a description of the possible values for Mask.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
SetOutputMask is available in all versions of IDebugClient.
Comments
For an overview of output in the debugger engine, see Input and Output.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
GetOutputMask, SetOtherOutputMask
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetOtherOutputMask
The GetOtherOutputMask method returns the output mask for another client.
HRESULT
IDebugClient::GetOtherOutputMask(
IN PDEBUG_CLIENT Client,
OUT PULONG Mask
);
Parameters
Client
Specifies the client whose output mask is desired.
Mask
Receives the output mask for the client. See DEBUG_OUTPUT_XXX for details on how to interpret this value.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetOtherOutputMask is available in all versions of IDebugClient.
Comments
For an overview of output in the debugger engine, see Input and Output.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
SetOtherOutputMask, GetOutputMask
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SetOtherOutputMask
The SetOtherOutputMask method sets the output mask for another client.
HRESULT
IDebugClient::SetOtherOutputMask(
IN PDEBUG_CLIENT Client,
IN ULONG Mask
);
Parameters
Client
Specifies the client whose output mask will be set.
Mask
Specifies the new output mask for the client. See DEBUG_OUTPUT_XXX for a description of the possible values for Mask.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
SetOtherOutputMask is available in all versions of IDebugClient.
Comments
For an overview of output in the debugger engine, see Input and Output.
Requirements
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
AttachProcess
The AttachProcess method connects the debugger engine to a user-mode process.
HRESULT
IDebugClient::AttachProcess(
IN ULONG64 Server,
IN ULONG ProcessId,
IN ULONG AttachFlags
);
Parameters
Server
Specifies the process server to use to attach to the process. If Server is zero, the engine will connect to a local process without using a process server.
ProcessId
Specifies the process ID of the target process the debugger will attach to.
AttachFlags
Specifies the flags that control how the debugger attaches to the target process. For details on these flags, see DEBUG_ATTACH_XXX.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
AttachProcess is available in all versions of IDebugClient.
Comments
This method is available only for live user-mode debugging.
Note The engine doesn't completely attach to the process until the WaitForEvent method has been called. Only after the process has generated an event for example, the
create-process event does it become available in the debugger session.
For more information about creating and attaching to live user-mode targets, see Live User-Mode Targets.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
.attach (Attach to Process), ConnectProcessServer, CreateProcess2, CreateProcessAndAttach2, GetRunningProcessSystemIds, GetRunningProcessDescription ,
DetachCurrentProcess, TerminateCurrentProcess, AbandonCurrentProcess
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
CreateProcess
The CreateProcess and CreateProcessWide methods create a process from the specified command line.
HRESULT
IDebugClient::CreateProcess(
IN ULONG64 Server,
IN PSTR CommandLine,
IN ULONG CreateFlags
);
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
HRESULT
IDebugClient3::CreateProcessWide(
IN ULONG64 Server,
IN PWSTR CommandLine,
IN ULONG CreateFlags
);
#ifdef UNICODE
#define CreateProcessT CreateProcessWide
#else
#define CreateProcessT CreateProcess
#endif
Parameters
Server
Specifies the process server to use to attach to the process. If Server is zero, the engine will create a local process without using a process server.
CommandLine
Specifies the command line to execute to create the new process.
CreateFlags
Specifies the flags to use when creating the process. For details on these flags, see the CreateFlags member of the DEBUG_CREATE_PROCESS_OPTIONS structure.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
CreateProcess is available in all versions of IDebugClient. CreateProcessWide is available in IDebugClient3 and later versions.
Comments
This method is available only for live user-mode debugging.
If CreateFlags contains either of the flags DEBUG_PROCESS or DEBUG_ONLY_THIS_PROCESS, the engine will also attach to the newly created process; this is similar
to the behavior of CreateProcessAndAttach2 with its argument ProcessId set to zero.
For more information about creating and attaching to live user-mode targets, see Live User-Mode Targets.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
CreateProcess2, AttachProcess, CreateProcessAndAttach2, .create (Create Process), ConnectProcessServer
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
CreateProcess2
The CreateProcess2 and CreateProcess2Wide methods execute the given command to create a new process.
HRESULT
IDebugClient5::CreateProcess2(
IN ULONG64 Server,
IN PSTR CommandLine,
IN PVOID OptionsBuffer,
IN ULONG OptionsBufferSize,
IN OPTIONAL PCSTR InitialDirectory,
IN OPTIONAL PCSTR Environment
);
HRESULT
IDebugClient5::CreateProcess2Wide(
IN ULONG64 Server,
IN PWSTR CommandLine,
IN PVOID OptionsBuffer,
IN ULONG OptionsBufferSize,
IN OPTIONAL PCWSTR InitialDirectory,
IN OPTIONAL PCWSTR Environment
);
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
#ifdef UNICODE
#define CreateProcess2T CreateProcess2Wide
#else
#define CreateProcess2T CreateProcess2
#endif
Parameters
Server
Specifies the process server that will be attached to the process. If Server is zero, the engine will create the local process without using a process server.
CommandLine
Specifies the command line to execute to create the new process.
OptionsBuffer
Specifies the process creation options. OptionsBuffer is a pointer to a DEBUG_CREATE_PROCESS_OPTIONS structure.
OptionsBufferSize
Specifies the size of the buffer OptionsBuffer. This should be set to sizeof(DEBUG_CREATE_PROCESS_OPTIONS).
InitialDirectory
Specifies the starting directory for the process. If InitialDirectory is NULL, the current directory for the process server is used.
Environment
Specifies an environment block for the new process. An environment block consists of a null-terminated block of null-terminated strings. Each string is of the form:
name=value
Note that the last two characters of the environment block are both NULL: one to terminate the string and one to terminate the block.
If Environment is set to NULL, the new process inherits the environment block of the process server. If the DEBUG_CREATE_PROCESS_THROUGH_RTL flag is set
in OptionsBuffer, then Environment must be NULL.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
CreateProcess2 and CreateProcess2Wide are available in IDebugClient5 and later versions.
Comments
This method is available only for live user-mode debugging.
If CreateFlags contains either of the flags DEBUG_PROCESS or DEBUG_ONLY_THIS_PROCESS, the engine will also attach to the newly created process. This is similar
to the behavior of CreateProcessAndAttach2 with its argument ProcessId set to zero.
For more information about creating and attaching to live user-mode targets, see Live User-Mode Targets.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
CreateProcessAndAttach2, AttachProcess, .create (Create Process), ConnectProcessServer, CreateProcess2, GetRunningProcessSystemIds,
GetRunningProcessDescription , DetachCurrentProcess, TerminateCurrentProcess, AbandonCurrentProcess
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
CreateProcessAndAttach
The CreateProcessAndAttach and CreateProcessAndAttachWide methods create a process from a specified command line, then attach to another user-mode process. The
created process is suspended and only allowed to execute when the attach has completed. This allows rough synchronization when debugging both, client and server
processes.
HRESULT
IDebugClient::CreateProcessAndAttach(
IN ULONG64 Server,
IN OPTIONAL PSTR CommandLine,
IN ULONG CreateFlags,
IN ULONG ProcessId,
IN ULONG AttachFlags
);
HRESULT
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
IDebugClient3::CreateProcessAndAttachWide(
IN ULONG64 Server,
IN OPTIONAL PWSTR CommandLine,
IN ULONG CreateFlags,
IN ULONG ProcessId,
IN ULONG AttachFlags
);
#ifdef UNICODE
#define CreateProcessAndAttachT CreateProcessAndAttachWide
#else
#define CreateProcessAndAttachT CreateProcessAndAttach
#endif
Parameters
Server
Specifies the process server to use to attach to the process. If Server is zero, the engine will connect to the local process without using a process server.
CommandLine
Specifies the command line to execute to create the new process. If CommandLine is NULL, then no process is created and these methods attach to an existing process,
as AttachProcess does.
CreateFlags
Specifies the flags to use when creating the process. For details on these flags, see DEBUG_CREATE_PROCESS_OPTIONS.CreateFlags.
ProcessId
Specifies the process ID of the target process the debugger will attach to. If ProcessId is zero, the debugger will attach to the process it created from CommandLine.
AttachFlags
Specifies the flags that control how the debugger attaches to the target process. For details on these flags, see DEBUG_ATTACH_XXX.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
CreateProcessAndAttach is available in all versions of IDebugClient. CreateProcessAndAttachWide is available in IDebugClient3 and later versions.
Comments
This method is available only for live user-mode debugging.
If CommandLine is not NULL and ProcessId is not zero, then the engine will create the process in a suspended state. The engine will resume this newly created process after
it successfully connects to the process specified in ProcessId.
Note The engine doesn't completely attach to the process until the WaitForEvent method has been called. Only after the process has generated an event for example, the
create-process event does it become available in the debugger session.
For more information about creating and attaching to live user-mode targets, see Live User-Mode Targets.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
CreateProcessAndAttach2, AttachProcess, .attach (Attach to Process), .create (Create Process), ConnectProcessServer, CreateProcess2,
GetRunningProcessSystemIds, GetRunningProcessDescription , DetachCurrentProcess, TerminateCurrentProcess, AbandonCurrentProcess
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
CreateProcessAndAttach2
The CreateProcessAndAttach2 and CreateProcessAndAttach2Wide methods create a process from a specified command line, then attach to that process or another usermode process.
HRESULT
IDebugClient5::CreateProcessAndAttach2(
IN ULONG64 Server,
IN OPTIONAL PSTR CommandLine,
IN PVOID OptionsBuffer,
IN ULONG OptionsBufferSize,
IN OPTIONAL PCSTR InitialDirectory,
IN OPTIONAL PCSTR Environment,
IN ULONG ProcessId,
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
IN ULONG
);
AttachFlags
HRESULT
IDebugClient5::CreateProcessAndAttach2Wide(
IN ULONG64 Server,
IN OPTIONAL PWSTR CommandLine,
IN PVOID OptionsBuffer,
IN ULONG OptionsBufferSize,
IN OPTIONAL PCWSTR InitialDirectory,
IN OPTIONAL PCWSTR Environment,
IN ULONG ProcessId,
IN ULONG AttachFlags
);
#ifdef UNICODE
#define CreateProcessAndAttach2T CreateProcessAndAttach2Wide
#else
#define CreateProcessAndAttach2T CreateProcessAndAttach2
#endif
Parameters
Server
Specifies the process server to use to attach to the process. If Server is zero, the engine will connect to the local process without using a process server.
CommandLine
Specifies the command line to execute to create the new process. If CommandLine is NULL, no process is created and these methods will use ProcessId to attach to an
existing process.
OptionsBuffer
Specifies the process creation options. OptionsBuffer is a pointer to a DEBUG_CREATE_PROCESS_OPTIONS structure.
OptionsBufferSize
Specifies the size of the buffer OptionsBuffer. This should be set to sizeof(DEBUG_CREATE_PROCESS_OPTIONS).
InitialDirectory
Specifies the starting directory for the process. This parameter is used only if CommandLine is not NULL. If InitialDirectory is NULL, the current directory for the
process server is used.
Environment
Specifies an environment block for the new process. An environment block consists of a null-terminated block of null-terminated strings. Each string is of the form:
name=value
Note that the last two characters of the environment block are both NULL: one to terminate the string and one to terminate the block.
If Environment is set to NULL, the new process inherits the environment block of the process server. If the DEBUG_CREATE_PROCESS_THROUGH_RTL flag is set
in OptionsBuffer, then Environment must be NULL.
ProcessId
Specifies the process ID of the target process to which the debugger will attach. If ProcessID is zero, the debugger will attach to the process it created from
CommandLine.
AttachFlags
Specifies the flags that control how the debugger attaches to the target process. For details on these flags, see DEBUG_ATTACH_XXX.
Return Value
S_OK
The method was successful.
E_INVALIDARG
This is returned if CommandLine is NULL and ProcessId is zero.
This method may also return error values. See Return Values for more details.
Interface Version
CreateProcessAndAttach2 and CreateProcessAndAttach2Wide are available in IDebugClient5 and later versions.
Comments
This method is available only for live user-mode debugging.
If CommandLine is not NULL and ProcessId is not zero, then the engine will create the process in a suspended state. The engine will resume this newly created process after
it successfully connects to the process specified in ProcessId.
Note The engine doesn't completely attach to the process until the WaitForEvent method has been called. Only after the process has generated an event for example, the
create-process event does it become available in the debugger session.
For more information about creating and attaching to live user-mode targets, see Live User-Mode Targets.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
AttachProcess, .attach (Attach to Process), .create (Create Process), ConnectProcessServer, CreateProcess2, GetRunningProcessSystemIds,
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
DetachProcesses
The DetachProcesses method detaches the debugger engine from all processes in all targets, resuming all their threads.
HRESULT
IDebugClient::DetachProcesses(
);
Parameters
None
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
DetachProcesses is available in all versions of IDebugClient.
Comments
The targets must be running on Windows XP or a later version of Windows.
For more information about creating and attaching to live user-mode targets, see Live User-Mode Targets.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
AttachProcess, CreateProcessAndAttach2, DetachCurrentProcess, TerminateProcesses, .detach (Detach from Process)
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
TerminateProcesses
The TerminateProcesses method attempts to terminate all processes in all targets.
HRESULT
IDebugClient::TerminateProcesses(
);
Parameters
None
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
TerminateProcesses is available in all versions of IDebugClient.
Comments
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Only live user-mode processes are terminated by this method. For other targets, the target is detached from the debugger without terminating.
For more information about creating and attaching to live user-mode targets, see Live User-Mode Targets.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
AttachProcess, CreateProcessAndAttach2, TerminateCurrentProcess, DetachProcesses, .kill (Kill Process)
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
AbandonCurrentProcess
The AbandonCurrentProcess methods removes the current process from the debugger engine's process list without detaching or terminating the process.
HRESULT
IDebugClient2::AbandonCurrentProcess(
);
Parameters
None
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
AbandonCurrentProcess is available in IDebugClient2 and later versions.
Comments
This method is only available for live user-mode debugging. The target must be running on Windows XP or a later version of Windows.
Windows will continue to consider this process as being debugged, and so the process will remain suspended. This method allows the debugger to be shut down and a new
debugger to attach to the process. See Live User-Mode Targets and Re-attaching to the Target Application for more information.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
AttachProcess, CreateProcessAndAttach2, DetachCurrentProcess, TerminateCurrentProcess, .abandon (Abandon Process)
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
DetachCurrentProcess
The DetachCurrentProcess method detaches the debugger engine from the current process, resuming all its threads.
HRESULT
IDebugClient2::DetachCurrentProcess(
);
Parameters
None
Return Value
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
DetachCurrentProcess is available in IDebugClient2 and later versions.
Comments
The target must be running on Windows XP or a later versions of Windows.
For more information about creating and attaching to live user-mode targets, see Live User-Mode Targets.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
AttachProcess, CreateProcessAndAttach2, DetachProcesses, AbandonCurrentProcess, TerminateCurrentProcess, .detach (Detach from Process)
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
TerminateCurrentProcess
The TerminateCurrentProcess method attempts to terminate the current process.
HRESULT
IDebugClient2::TerminateCurrentProcess(
);
Parameters
None
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
TerminateCurrentProcess is available in IDebugClient2 and later versions.
Comments
Only live user-mode process are terminated by this method. For other targets, the target is detached from the debugger engine without terminating.
For more information about creating and attaching to live user-mode targets, see Live User-Mode Targets.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
AttachProcess, CreateProcessAndAttach2, TerminateProcesses, AbandonCurrentProcess, DetachCurrentProcess, .kill (Kill Process)
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
AddProcessOptions
The AddProcessOptions method adds the process options to those options that affect the current process.
HRESULT
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
IDebugClient::AddProcessOptions(
IN ULONG Options
);
Parameters
Options
Specifies the process options to add to those affecting the current process. For details on these process options, see DEBUG_PROCESS_XXX.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
AddProcessOptions is available in all versions of IDebugClient.
Comments
This method is available only in live user-mode debugging.
Some of the process options are global options, others are specific to the current process.
If any process options are modified, the engine will notify the event callbacks by calling their IDebugEventCallbacks::ChangeEngineState method with the
DEBUG_CES_PROCESS_OPTIONS flag set.
For more information about creating and attaching to live user-mode targets, see Live User-Mode Targets.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
GetProcessOptions, SetProcessOptions, RemoveProcessOptions, DEBUG_PROCESS_XXX
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetProcessOptions
The GetProcessOptions method retrieves the process options affecting the current process.
HRESULT
IDebugClient::GetProcessOptions(
OUT PULONG Options
);
Parameters
Options
Receives a set of flags representing the process options for the current process. For details on these options, see DEBUG_PROCESS_XXX.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetProcessOptions is available in all versions of IDebugClient.
Comments
This method is only available in live user-mode debugging.
Some of the process options are global options, others are specific to the current process.
For more information about creating and attaching to live user-mode targets, see Live User-Mode Targets.
Requirements
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
RemoveProcessOptions
The RemoveProcessOptions method removes process options from those options that affect the current process.
HRESULT
IDebugClient::RemoveProcessOptions(
IN ULONG Options
);
Parameters
Options
Specifies the process options to remove from those affecting the current process. For details on these options, see DEBUG_PROCESS_XXX.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
RemoveProcessOptions is available in all versions of IDebugClient.
Comments
This method is available only in live user-mode debugging.
Some of the process options are global options, others are specific to the current process.
If any process options are modified, the engine will notify the event callbacks by calling their IDebugEventCallbacks::ChangeEngineState method with the
DEBUG_CES_PROCESS_OPTIONS flag set.
For more information about creating and attaching to live user-mode targets, see Live User-Mode Targets.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
GetProcessOptions, SetProcessOptions, AddProcessOptions, DEBUG_PROCESS_XXX
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SetProcessOptions
The SetProcessOptions method sets the process options affecting the current process.
HRESULT
IDebugClient::SetProcessOptions(
IN ULONG Options
);
Parameters
Options
Specifies a set of flags that will become the new process options for the current process. For details on these options, see DEBUG_PROCESS_XXX.
Return Value
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
SetProcessOptions is available in all versions of IDebugClient.
Comments
This method is available only in live user-mode debugging.
Some of the process options are global options, others are specific to the current process.
If any process options are modified, the engine will notify the event callbacks by calling their IDebugEventCallbacks::ChangeEngineState method with the
DEBUG_CES_PROCESS_OPTIONS flag set.
For more information about creating and attaching to live user-mode targets, see Live User-Mode Targets.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
GetProcessOptions, AddProcessOptions, RemoveProcessOptions, DEBUG_PROCESS_XXX
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetRunningProcessDescription
The GetRunningProcessDescription and GetRunningProcessDescriptionWide methods return a description of the process that includes the executable image name, the
service names, the MTS package names, and the command line.
HRESULT
IDebugClient::GetRunningProcessDescription(
IN ULONG64 Server,
IN ULONG SystemId,
IN ULONG Flags,
OUT OPTIONAL PSTR ExeName,
IN ULONG ExeNameSize,
OUT OPTIONAL PULONG ActualExeNameSize,
OUT OPTIONAL PSTR Description,
IN ULONG DescriptionSize,
OUT OPTIONAL PULONG ActualDescriptionSize
);
HRESULT
IDebugClient3::GetRunningProcessDescriptionWide(
IN ULONG64 Server,
IN ULONG SystemId,
IN ULONG Flags,
OUT OPTIONAL PWSTR ExeName,
IN ULONG ExeNameSize,
OUT OPTIONAL PULONG ActualExeNameSize,
OUT OPTIONAL PWSTR Description,
IN ULONG DescriptionSize,
OUT OPTIONAL PULONG ActualDescriptionSize
);
#ifdef UNICODE
#define GetRunningProcessDescriptionT GetRunningProcessDescriptionWide
#else
#define GetRunningProcessDescriptionT GetRunningProcessDescription
#endif
Parameters
Server
Specifies the process server to query for the process description. If Server is zero, the engine will query information about the local process directly.
SystemId
Specifies the process ID of the process whose description is desired.
Flags
Specifies a bit-set containing options that affect the behavior of this method. Flags can contain the following bit flags:
Flag
Description
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
DEBUG_PROC_DESC_NO_PATHS
Return only file names without path names.
DEBUG_PROC_DESC_NO_SERVICES
Do not look up service names.
DEBUG_PROC_DESC_NO_MTS_PACKAGES Do not look up MTS package names.
DEBUG_PROC_DESC_NO_COMMAND_LINE Do not retrieve the command line.
ExeName
Receives the name of the executable file used to start the process. If ExeName is NULL, this information is not returned.
ExeNameSize
Specifies the size in characters of the buffer ExeNameSize.
ActualExeNameSize
Receives the size in characters of the executable file name. If ExeNameSize is NULL, this information is not returned.
Description
Receives extra information about the process, including service names, MTS package names, and the command line. If Description is NULL, this information is not
returned.
DescriptionSize
Specifies the size in characters of the buffer Description.
ActualDescriptionSize
Receives the size in characters of the extra information. If ActualDescriptionSize is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
S_FALSE
The method was successful. However, either ExeNameSize or DescriptionSize were smaller than the size of the respective string and the string was truncated to fit inside
the buffer.
This method may also return error values. See Return Values for more details.
Interface Version
GetRunningProcessDescription is available in all versions of IDebugClient. GetRunningProcessDescriptionWide is available in IDebugClient3 and later versions.
Comments
This method is available only for live user-mode debugging.
For more information about creating and attaching to live user-mode targets, see Live User-Mode Targets.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
GetRunningProcessSystemIds, GetRunningProcessSystemIdByExecutableName, ConnectProcessServer, AttachProcess, CreateProcessAndAttach2
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetRunningProcessSystemIds
The GetRunningProcessSystemIds method returns the process IDs for each running process.
HRESULT
IDebugClient::GetRunningProcessSystemIds(
IN ULONG64 Server,
OUT OPTIONAL PULONG Ids,
IN ULONG Count,
OUT OPTIONAL PULONG ActualCount
);
Parameters
Server
Specifies the process server to query for process IDs. If Server is zero, the engine will return the process IDs of the processes running on the local computer.
Ids
Receives the process IDs. The size of this array is Count. If Ids is NULL, this information is not returned.
Count
Specifies the number of process IDs the array Ids can hold.
ActualCount
Receives the actual number of process IDs returned in Ids.
Return Value
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetRunningProcessSystemIds is available in all versions of IDebugClient.
Comments
This method is available only for live user-mode debugging.
For more information about creating and attaching to live user-mode targets, see Live User-Mode Targets.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
GetRunningProcessDescription, GetRunningProcessSystemIdByExecutableName, ConnectProcessServer, AttachProcess, CreateProcessAndAttach2
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetRunningProcessSystemIdByExecutableName
The GetRunningProcessSystemIdByExecutableName and GetRunningProcessSystemIdByExecutableNameWide methods search for a process with a given executable
file name and return its process ID.
HRESULT
IDebugClient::GetRunningProcessSystemIdByExecutableName(
IN ULONG64 Server,
IN PCSTR ExeName,
IN ULONG Flags,
OUT PULONG Id
);
HRESULT
IDebugClient3::GetRunningProcessSystemIdByExecutableNameWide(
IN ULONG64 Server,
IN PCWSTR ExeName,
IN ULONG Flags,
OUT PULONG Id
);
#ifdef UNICODE
#define GetRunningProcessSystemIdByExecutableNameT GetRunningProcessSystemIdByExecutableNameWide
#else
#define GetRunningProcessSystemIdByExecutableNameT GetRunningProcessSystemIdByExecutableName
#endif
Parameters
Server
Specifies the process server to search for the executable name. If Server is zero, the engine will search for the executable name among the processes running on the local
computer.
ExeName
Specifies the executable file name for which to search.
Flags
Specifies a bit-set that controls how the executable name is matched. The following flags may be present:
Flag
Description
DEBUG_GET_PROC_FULL_MATCH ExeName specifies the full path name of the executable file name.
If this flag is not set, this method will not use path names when searching for the process.
DEBUG_GET_PROC_ONLY_MATCH Require that only one process match the executable file name ExeName.
Id
Receives the process ID of the first process to match ExeName.
Return Value
S_OK
The method was successful.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
S_FALSE
More than one process matched the executable file name in ExeName, and DEBUG_GET_PROC_ONLY_MATCH was set in Flags.
E_NOINTERFACE
No process matched the executable file name in ExeName.
This method may also return error values. See Return Values for more details.
Interface Version
GetRunningProcessSystemIdByExecutableName is available in all versions of IDebugClient. GetRunningProcessSystemIdByExecutableNameWide is available in
IDebugClient3 and later versions.
Comments
This method is available only for live user-mode debugging.
For more information about creating and attaching to live user-mode targets, see Live User-Mode Targets.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
GetRunningProcessSystemIds, GetRunningProcessDescription, ConnectProcessServer, AttachProcess, CreateProcessAndAttach2
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ConnectProcessServer
The ConnectProcessServer and ConnectProcessServerWide methods connect to a process server.
HRESULT
IDebugClient::ConnectProcessServer(
IN PCSTR RemoteOptions,
OUT PULONG64 Server
);
HRESULT
IDebugClient5::ConnectProcessServerWide(
IN PCWSTR RemoteOptions,
OUT PULONG64 Server
);
#ifdef UNICODE
#define ConnectProcessServerT ConnectProcessServerWide
#else
#define ConnectProcessServerT ConnectProcessServer
#endif
Parameters
RemoteOptions
Specifies how the debugger engine will connect with the process server. These are the same options passed to the -premote option on the WinDbg and CDB command
lines. For details on the syntax of this string, see Activating a Smart Client.
Server
Receives a handle for the process server. This handle is used when creating or attaching to processes by using the process server.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
ConnectProcessServer is available in all versions of IDebugClient. ConnectProcessServerWide is available in IDebugClient5 and later versions.
Comments
For more information about process servers and remote debugging, see Process Servers, Kernel Connection Servers, and Smart Clients.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
See Also
StartProcessServer, DisconnectProcessServer, EndProcessServer, AttachProcess, CreateProcess2, CreateProcessAndAttach2, GetRunningProcessDescription,
GetRunningProcessSystemIdByExecutableName, GetRunningProcessSystemIds
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
DisconnectProcessServer
The DisconnectProcessServer method disconnects the debugger engine from a process server.
HRESULT
IDebugClient::DisconnectProcessServer(
IN ULONG64 Server
);
Parameters
Server
Specifies the server from which to disconnect. This handle must have been previously returned by ConnectProcessServer.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
DisconnectProcessServer is available in all versions of IDebugClient.
Comments
For more information about process servers and remote debugging, see Process Servers, Kernel Connection Servers, and Smart Clients.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
ConnectProcessServer, StartProcessServer, EndProcessServer
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
EndProcessServer
The EndProcessServer method requests that a process server be shut down.
HRESULT
IDebugClient2::EndProcessServer(
IN ULONG64 Server
);
Parameters
Server
Specifies the process server to shut down. This handle must have been previously returned by ConnectProcessServer.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
StartProcessServer
The StartProcessServer and StartProcessServerWide methods start a process server.
HRESULT
IDebugClient::StartProcessServer(
IN ULONG Flags,
IN PCSTR Options,
IN PVOID Reserved
);
HRESULT
IDebugClient5::StartProcessServerWide(
IN ULONG Flags,
IN PCWSTR Options,
IN PVOID Reserved
);
#ifdef UNICODE
#define StartProcessServerT StartProcessServerWide
#else
#define StartProcessServerT StartProcessServer
#endif
Parameters
Flags
Specifies the class of the targets that will be available through the process server. This must be set to DEBUG_CLASS_USER_WINDOWS.
Options
Specifies the connections options for this process server. These are the same options given to the -t option of the DbgSrv command line. For details on the syntax of this
string, see Activating a Process Server.
Reserved
Set to NULL.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
StartProcessServer is available in all versions of IDebugClient. StartProcessServerWide is available in IDebugClient5 and later versions.
Comments
The process server that is started will be accessible by remote clients through the transport specified in the Options parameter.
To stop the process server from the smart client, use the EndProcessServer method. To shut down the process server from the computer that it is running on, use Task
Manager to end the process. If the instance of the debugger engine that used StartProcessServer is still running, it can use Execute to issue the debugger
command .endsrv 0, which will end the process server (this is an exception to the usual behavior of .endsrv, which generally does not affect process servers).
For more information about process servers and remote debugging, see Process Servers, Kernel Connection Servers, and Smart Clients.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
WaitForProcessServerEnd
The WaitForProcessServerEnd method waits for a local process server to exit.
HRESULT
IDebugClient2::WaitForProcessServerEnd(
IN ULONG Timeout
);
Parameters
Timeout
Specifies how long in milliseconds to wait for a process server to exit. If Timeout is INFINITE, this method will not return until a process server has ended.
Return Value
S_OK
The method was successful.
S_FALSE
A time-out occurred Timeout milliseconds passed without a local process server exiting.
This method may also return error values. See Return Values for more details.
Interface Version
WaitForProcessServerEnd is available in IDebugClient2 and later versions.
Comments
This method will only wait for the first local process server to end. After a process server has ended, subsequent calls to this method will return immediately.
For more information about process servers and remote debugging, see Process Servers, Kernel Connection Servers, and Smart Clients.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h. The constant INFINITE is defined in winbase.h.
See Also
StartProcessServer, EndProcessServer
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
OutputServers
The OutputServers and OutputServersWide methods lists the servers running on a given computer.
HRESULT
IDebugClient::OutputServers(
IN ULONG OutputControl,
IN PCSTR Machine,
IN ULONG Flags
);
HRESULT
IDebugClient5::OutputServersWide(
IN ULONG OutputControl,
IN PCWSTR Machine,
IN ULONG Flags
);
#ifdef UNICODE
#define OutputServersT OutputServersWide
#else
#define OutputServersT OutputServers
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
#endif
Parameters
OutputControl
Specifies the output control to use while outputting the servers. For possible values, see DEBUG_OUTCTL_XXX.
Machine
Specifies the name of the computer whose servers will be listed. Machine has the following form:
\\computername
Flags
Specifies a bit-set that determines which servers to output. The possible bit flags are:
Flag
Description
DEBUG_SERVERS_DEBUGGER Output the debugging servers on the computer.
DEBUG_SERVERS_PROCESS Output the process servers on the computer.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
OutputServers is available in all versions of IDebugClient. OutputServersWide is available in IDebugClient5 and later versions.
Comments
For more information about remote debugging, see Remote Debugging.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
StartServer, DebugConnect, StartProcessServer, ConnectProcessServer
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
StartServer
The StartServer and StartServerWide methods start a debugging server.
HRESULT
IDebugClient::StartServer(
IN PCSTR Options
);
HRESULT
IDebugClient5::StartServerWide(
IN PCWSTR Options
);
#ifdef UNICODE
#define StartServerT StartServerWide
#else
#define StartServerT StartServer
#endif
Parameters
Options
Specifies the connections options for this server. These are the same options given to the .server debugger command or the WinDbg and CDB -server command-line
option. For details on the syntax of this string, see Activating a Debugging Server.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Interface Version
StartServer is available in all versions of IDebugClient. StartServerWide is available in IDebugClient5 and later versions.
Comments
The server that is started will be accessible by other debuggers through the transport specified in the Options parameter.
For more information about debugging servers, see Debugging Server and Debugging Client.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
DebugConnect, StartProcessServer, OutputServers
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ConnectSession
The ConnectSession method joins the client to an existing debugger session.
HRESULT
IDebugClient::ConnectSession(
IN ULONG Flags,
IN ULONG HistoryLimit
);
Parameters
Flags
Specifies a bit-set of option flags for connecting to the session. The possible values of these flags are:
Flag
Description
DEBUG_CONNECT_SESSION_NO_VERSION
Do not output the debugger engine's version to this client.
DEBUG_CONNECT_SESSION_NO_ANNOUNCE Do not output a message notifying other clients that this client has connected.
HistoryLimit
Specifies the maximum number of characters from the session's history to send to this client's output upon connection.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
ConnectSession is available in all versions of IDebugClient.
Comments
When the client object connects to a session, the most recent output from the session is sent to the client. If the session is currently waiting on input, the client object is given
the opportunity to provide input. Thus, the client object synchronizes with the session's input and output.
The client becomes a primary client and will appear among the list of clients in the output of the .clients debugger command.
For more information about debugging clients, see Debugging Server and Debugging Client. For more information about debugger sessions, see Debugging Session and
Execution Model.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
DebugConnect, StartServer, OutputServers
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
EndSession
The EndSession method ends the current debugger session.
HRESULT
IDebugClient::EndSession(
IN ULONG Flags
);
Parameters
Flags
Specifies how to end the session. Flags can be one of the following values:
Flag
Description
DEBUG_END_PASSIVE
Perform cleanup for the session.
DEBUG_END_ACTIVE_TERMINATE Attempt to terminate all user-mode targets before performing cleanup for the session.
DEBUG_END_ACTIVE_DETACH
Attempt to disconnect from all targets before performing cleanup for the session.
DEBUG_END_REENTRANT
Perform only the cleanup that doesn't require acquiring locks. See Comments section for details.
DEBUG_END_DISCONNECT
Do not end the session. Disconnect the client from the session and disable the client.
This flag is intended for when remote clients disconnect. It generates a server message about the disconnection.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
EndSession is available in all versions of IDebugClient.
Comments
This method may be called at any time with Flags set to DEBUG_END_REENTRANT. If, for example, the application needs to exit but another thread is using the engine,
this method can be used to perform as much cleanup as possible.
Using DEBUG_END_REENTRANT may leave the engine in an indeterminate state. If this flag is used, no subsequent calls should be made to the engine.
For more information about debugger sessions, see Debugging Session and Execution Model.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
IDebugControl
The IDebugControl interface includes the following methods:
Assemble
AddAssemblyOptions
GetAssemblyOptions
RemoveAssemblyOptions
SetAssemblyOptions
Disassemble
Evaluate
Execute
ExecuteCommandFile
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
AddBreakpoint
RemoveBreakpoint
GetBreakpointById
GetBreakpointByIndex
GetNumberBreakpoints
GetBreakpointParameters
ReadBugCheckData
GetCodeLevel
SetCodeLevel
GetDebuggeeType
GetDisassembleEffectiveOffset
OutputDisassembly
OutputDisassemblyLines
GetDumpFormatFlags
AddEngineOptions
GetEngineOptions
RemoveEngineOptions
SetEngineOptions
GetSystemErrorControl
SetSystemErrorControl
GetNotifyEventHandle
SetNotifyEventHandle
GetNumberEvents
GetCurrentEventIndex
SetNextEventIndex
GetEventIndexDescription
GetExpressionSyntax
SetExpressionSyntax
GetExpressionSyntaxNames
SetExpressionSyntaxByName
GetNumberExpressionSyntaxes
AddExtension
RemoveExtension
CallExtension
GetExtensionByPath
GetExtensionFunction
GetWindbgExtensionApis32
GetWindbgExtensionApis64
WaitForEvent
GetEventFilterCommand
SetEventFilterCommand
GetNumberEventFilters
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetEventFilterText
GetLastEventInformation
GetStoredEventInformation
GetExceptionFilterParameters
SetExceptionFilterParameters
GetExceptionFilterSecondCommand
SetExceptionFilterSecondCommand
GetSpecificFilterArgument
SetSpecificFilterArgument
GetSpecificFilterParameters
SetSpecificFilterParameters
Input
ReturnInput
GetNearInstruction
GetInterrupt
SetInterrupt
GetInterruptTimeout
SetInterruptTimeout
CloseLogFile
GetLogFile
GetLogFile2
OpenLogFile
OpenLogFile2
GetLogMask
SetLogMask
GetManagedStatus
ResetManagedStatus
GetReturnOffset
Output
ControlledOutput
OutputVaList
ControlledOutputVaList
GetPageSize
IsPointer64Bit
GetActualProcessorType
GetEffectiveProcessorType
SetEffectiveProcessorType
GetExecutingProcessorType
GetNumberProcessors
GetPossibleExecutingProcessorTypes
GetNumberPossibleExecutingProcessorTypes
GetSupportedProcessorTypes
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetNumberSupportedProcessorTypes
GetProcessorTypeNames
OutputPrompt
OutputPromptVaList
GetPromptText
GetRadix
SetRadix
GetStackTrace
OutputStackTrace
GetContextStackTrace
OutputContextStackTrace
OutputCurrentState
GetExecutionStatus
SetExecutionStatus
GetSystemVersion
GetSystemVersionString
GetSystemVersionValues
GetTextMacro
SetTextMacro
GetTextReplacement
SetTextReplacement
OutputTextReplacements
RemoveTextReplacements
GetNumberTextReplacements
GetCurrentTimeDate
GetCurrentSystemUpTime
CoerceValue
CoerceValues
OutputVersionInformation
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Assemble
The Assemble and AssembleWide methods assemble a single processor instruction. The assembled instruction is placed in the target's memory.
HRESULT
IDebugControl::Assemble(
IN ULONG64 Offset,
IN PCSTR Instr,
OUT PULONG64 EndOffset
);
HRESULT
IDebugControl4::AssembleWide(
IN ULONG64 Offset,
IN PCWSTR Instr,
OUT PULONG64 EndOffset
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
);
#ifdef UNICODE
#define AssembleT AssembleWide
#else
#define AssembleT Assemble
#endif
Parameters
Offset
Specifies the location in the target's memory to place the assembled instruction.
Instr
Specifies the instruction to assemble. The instruction is assembled according to the target's effective processor type (returned by SetEffectiveProcessorType).
EndOffset
Receives the location in the target's memory immediately following the assembled instruction. EndOffset can be used when assembling multiple instructions.
Return Value
S_OK
The method was successful.
These methods can also return error values. See Return Values for more details.
Interface Version
Assemble is available in all versions of IDebugControl. AssembleWide is available in IDebugControl4 and later versions.
Comments
The assembly language depends on the effective processor type of the target machine. For information about the assembly language, see the processor documentation.
Note: The Assemble and AssembleWide methods are not supported on some architectures, and on some other architectures not all instructions are supported.
The assembly language optionsreturned by GetAssemblyOptionsaffect the operation of this method.
For an overview of using assembly in debugger applications, see Debugging in Assembly Mode. For more information about using assembly with the debugger engine API,
see Assembling and Disassembling Instructions.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
Disassemble, GetAssemblyOptions, a (Assemble)
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
AddAssemblyOptions
The AddAssemblyOptions method turns on some of the assembly and disassembly options.
HRESULT
IDebugControl3::AddAssemblyOptions(
IN ULONG Options
);
Parameters
Options
Specifies the assembly and disassembly options to turn on. Options is a bit-set that will be combined with the existing engine options using the bitwise OR operator. For a
description of the options, see DEBUG_ASMOPT_XXX.
Return Value
S_OK
The method was successful.
These methods can also return error values. See Return Values for more details.
Interface Version
AddAssemblyOptions is available in IDebugControl3 and later versions.
Comments
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
For more information about using assembly with the debugger engine API, see Assembling and Disassembling Instructions.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
RemoveAssemblyOptions, SetAssemblyOptions, GetAssemblyOptions, DEBUG_ASMOPT_XXX, Assemble, Disassemble, .asm (Change Disassembly Options)
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetAssemblyOptions
The GetAssemblyOptions method returns the assembly and disassembly options that affect how the debugger engine assembles and disassembles processor instructions for
the target.
HRESULT
IDebugControl3::GetAssemblyOptions(
OUT PULONG Options
);
Parameters
Options
Receives a bit-set that contains the assembly and disassembly options. For a description of these options, see DEBUG_ASMOPT_XXX.
Return Value
S_OK
The method was successful.
This method can also return error values. See Return Values for more details.
Interface Version
GetAssemblyOptions is available in IDebugControl3 and later versions.
Comments
For more information about using assembly with the debugger engine API, see Assembling and Disassembling Instructions.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
SetAssemblyOptions, AddAssemblyOptions, RemoveAssemblyOptions, DEBUG_ASMOPT_XXX, Assemble, Disassemble, .asm (Change Disassembly Options)
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
RemoveAssemblyOptions
The RemoveAssemblyOptions method turns off some of the assembly and disassembly options.
HRESULT
IDebugControl3::RemoveAssemblyOptions(
IN ULONG Options
);
Parameters
Options
Specifies the assembly and disassembly options to turn off. Options is a bit-set; the new value of the engine's options will equal the bitwise NOT of Options combined
with the old value by using the bitwise AND operator (
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
SetAssemblyOptions
The SetAssemblyOptions method sets the assembly and disassembly options that affect how the debugger engine assembles and disassembles processor instructions for the
target.
HRESULT
IDebugControl3::SetAssemblyOptions(
IN ULONG Options
);
Parameters
Options
Specifies the new assembly and disassembly options to be used by the debugger engine. Options is a bit-set; it will replace the existing assembly and disassembly
options. For possible values, see DEBUG_ASMOPT_XXX. DEBUG_ASMOPT_DEFAULT can be used to set the default options.
Return Value
S_OK
The method was successful.
This method can also return error values. See Return Values for more details.
Interface Version
SetAssemblyOptions is available in IDebugControl3 and later versions.
Comments
For more information about using assembly with the debugger engine API, see Assembling and Disassembling Instructions.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetAssemblyOptions, AddAssemblyOptions, RemoveAssemblyOptions, DEBUG_ASMOPT_XXX, Assemble, Disassemble, .asm (Change Disassembly Options)
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Disassemble
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The Disassemble and DisassembleWide methods disassemble a processor instruction in the target's memory.
HRESULT
IDebugControl::Disassemble(
IN ULONG64 Offset,
IN ULONG Flags,
OUT OPTIONAL PSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG DisassemblySize,
OUT PULONG64 EndOffset
);
HRESULT
IDebugControl4::DisassembleWide(
IN ULONG64 Offset,
IN ULONG Flags,
OUT OPTIONAL PWSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG DisassemblySize,
OUT PULONG64 EndOffset
);
#ifdef UNICODE
#define DisassembleT DisassembleWide
#else
#define DisassembleT Disassemble
#endif
Parameters
Offset
Specifies the location in the target's memory of the instruction to disassemble.
Flags
Specifies the bit-flags that affect the behavior of this method. Currently the only flag that can be set is DEBUG_DISASM_EFFECTIVE_ADDRESS; when set, the
engine will compute the effective address from the current register information and display it.
Buffer
Receives the disassembled instruction. If Buffer is NULL, this information is not returned.
BufferSize
Specifies the size, in characters, of the Buffer buffer.
DisassemblySize
Receives the size, in characters, of the disassembled instruction. If DisassemblySize is NULL, this information is not returned.
EndOffset
Receives the location in the target's memory of the instruction following the disassembled instruction.
Return Value
S_OK
The method was successful.
S_FALSE
The method was successful. However, Buffer was too small to hold the disassembled instruction and the instruction was truncated to fit.
This method can also return error values. See Return Values for more details.
Interface Version
Disassemble is available in all versions of IDebugControl. DisassembleWide is available in IDebugControl4 and later versions.
Comments
The assembly language depends on the effective processor type of the target system. For information about the assembly language, see the processor documentation.
The disassembly optionsreturned by GetAssemblyOptionsaffect the operation of this method.
For an overview of using assembly in debugger applications, see Debugging in Assembly Mode. For more information about using assembly with the debugger engine API,
see Assembling and Disassembling Instructions.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
Assemble, GetAssemblyOptions, u (Unassemble)
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Evaluate
The Evaluate and EvaluateWide methods evaluate an expression, returning the result.
HRESULT
IDebugControl::Evaluate(
IN PCSTR Expression
IN ULONG DesiredType
OUT PDEBUG_VALUE Value
OUT OPTIONAL PULONG RemainderIndex
);
HRESULT
IDebugControl4::EvaluateWide(
IN PCWSTR Expression,
IN ULONG DesiredType,
OUT PDEBUG_VALUE Value,
OUT OPTIONAL PULONG RemainderIndex
);
#ifdef UNICODE
#define EvaluateT EvaluateWide
#else
#define EvaluateT Evaluate
#endif
Parameters
Expression
Specifies the expression to be evaluated.
DesiredType
Specifies the desired return type. Possible values are described in DEBUG_VALUE; with the addition of DEBUG_VALUE_INVALID, which indicates that the return
type should be the expression's natural type.
Value
Receives the value of the expression.
RemainderIndex
Receives the index of the first character of the expression not used in the evaluation. If RemainderIndex is NULL, this information isn't returned.
Return Value
S_OK
The method was successful.
E_FAIL
An error occurred while evaluating the expression. For example, there was a syntax error, an undefined variable, or a division by zero exception.
This method may also return other error values. See Return Values for more details.
Interface Version
Evaluate is available in all versions of IDebugControl. EvaluateWide is available in IDebugControl4 and later versions.
Comments
Expressions are evaluated by the current expression evaluator. The engine contains multiple expression evaluators; each supports a different syntax. The current expression
evaluator can be chosen by using SetExpressionSyntax.
For details of the available expression evaluators and their syntaxes, see Numerical Expression Syntax.
If an error occurs while evaluating the expression, returning E_FAIL, the RemainderIndex variable can be used to determine approximately where in the expression the error
occurred.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetExpressionSyntax, SetExpressionSyntax, SetExpressionSyntaxByName
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Execute
The Execute and ExecuteWide methods execute the specified debugger commands.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
HRESULT
IDebugControl::Execute(
IN ULONG OutputControl,
IN PCSTR Command,
IN ULONG Flags
);
HRESULT
IDebugControl4::ExecuteWide(
IN ULONG OutputControl,
IN PCWSTR Command,
IN ULONG Flags
);
#ifdef UNICODE
#define ExecuteT ExecuteWide
#else
#define ExecuteT Execute
#endif
Parameters
OutputControl
Specifies the output control to use while executing the command. For possible values, see DEBUG_OUTCTL_XXX. For more information about output, see Input and
Output.
Command
Specifies the command string to execute. The command is interpreted like those typed into a debugger command window. This command string can contain multiple
commands for the engine to execute. See Debugger Commands for the command reference.
Flags
Specifies a bit field of execution options for the command. The default options are to log the command but to not send it to the output. The following table lists the bits
that can be set.
Value
Description
DEBUG_EXECUTE_ECHO
The command string is sent to the output.
DEBUG_EXECUTE_NOT_LOGGED The command string is not logged. This is overridden by DEBUG_EXECUTE_ECHO.
DEBUG_EXECUTE_NO_REPEAT If Command is an empty string, do not repeat the last command, and do not save the current command string for repeat execution
later.
Return Value
S_OK
The method was successful.
This method can also return error values. See Return Values for more details.
Interface Version
Execute is available in all versions of IDebugControl. ExecuteWide is available in IDebugControl4 and later versions.
Comments
These methods execute the given command string. If the string has multiple commands, these methods will not return until all of the commands have been executed. This may
involve waiting for the target to execute, so these methods can take an arbitrary amount of time to complete.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
ExecuteCommandFile
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExecuteCommandFile
The ExecuteCommandFile and ExecuteCommandFileWide methods open the specified file and execute the debugger commands that are contained within.
HRESULT
IDebugControl::ExecuteCommandFile(
IN ULONG OutputControl,
IN PCSTR CommandFile,
IN ULONG Flags
);
HRESULT
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
IDebugControl4::ExecuteCommandFileWide(
IN ULONG OutputControl,
IN PCWSTR CommandFile,
IN ULONG Flags
);
#ifdef UNICODE
#define ExecuteCommandFileT ExecuteCommandFileWide
#else
#define ExecuteCommandFileT ExecuteCommandFile
#endif
Parameters
OutputControl
Specifies where to send the output of the command. For possible values, see DEBUG_OUTCTL_XXX. For more information about output, see Input and Output.
CommandFile
Specifies the name of the file that contains the commands to execute. This file is opened for reading and its contents are interpreted as if they had been typed into the
debugger console.
Flags
Specifies execution options for the command. The default options are to log the command but not to send it to the output. For details about the values that Flags can take,
see Execute.
Return Value
S_OK
The method was successful.
This method might also return error values, including error values caused by a failure to open the specified file. For more information, see Return Values.
Interface Version
ExecuteCommandFile is available in all versions of IDebugControl. ExecuteCommandFileWide is available in IDebugControl4 and later versions.
Comments
These methods read the specified file and execute the commands one line at a time using Execute. If an exception occurred while executing a line, the execution will continue
with the next line.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
Execute
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
AddBreakpoint
The AddBreakpoint and AddBreakpoint2 methods create a new breakpoint for the current target.
HRESULT
IDebugControl::AddBreakpoint(
IN ULONG Type,
IN ULONG DesiredId,
OUT IDebugBreakpoint * * Bp
);
HRESULT
IDebugControl4::AddBreakpoint2(
IN ULONG Type,
IN ULONG DesiredId,
OUT IDebugBreakpoint2 * * Bp
);
Parameters
Type
Specifies the breakpoint type of the new breakpoint. This can be either of the following values:
Value
Description
DEBUG_BREAKPOINT_CODE software breakpoint
DEBUG_BREAKPOINT_DATA processor breakpoint
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
DesiredId
Specifies the desired ID of the new breakpoint. If it is DEBUG_ANY_ID, the engine will pick an unused ID.
Bp
Receives an interface pointer to the new breakpoint.
Return Value
S_OK
The method was successful.
E_INVALIDARG
The breakpoint couldn't be created with the desired ID or the value of Type was not recognized.
This method may also return other error values. See Return Values for more details.
Interface Version
AddBreakpoint is available in all versions of IDebugControl. AddBreakpoint2 is available in IDebugControl4 and later versions.
Comments
If DesiredId is not DEBUG_ANY_ID and another breakpoint already uses the ID DesiredId, these methods will fail.
Breakpoints are created empty and disabled. See Using Breakpoints for details on configuring and enabling the breakpoint.
The client is saved as the adder of the new breakpoint. See GetAdder.
Note Even though IDebugBreakpoint extends the COM interface IUnknown, the lifetime of the breakpoint is not controlled using the IUnknown interface. Instead, the
breakpoint is deleted after RemoveBreakpoint is called.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
Breakpoints, Using Breakpoints, IDebugBreakpoint, RemoveBreakpoint
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
RemoveBreakpoint
The RemoveBreakpoint and RemoveBreakpoint2 methods remove a breakpoint.
HRESULT
IDebugControl::RemoveBreakpoint(
IN IDebugBreakpoint * Bp
);
HRESULT
IDebugControl4::RemoveBreakpoint2(
IN IDebugBreakpoint2 * Bp
);
Parameters
Bp
Specifies an interface pointer to breakpoint to remove.
Return Value
S_OK
The method was successful.
This method may also return other error values. See Return Values for more details.
Interface Version
RemoveBreakpoint is available in all versions of IDebugControl. RemoveBreakpoint2 is available in IDebugControl4 and later versions.
Comments
After RemoveBreakpoint and RemoveBreakpoint2 are called, the breakpoint object specified in the Bp parameter must not be used again.
Note Even though IDebugBreakpoint extends the COM interface IUnknown, the lifetime of the breakpoint is not controlled using the IUnknown interface. Instead, the
breakpoint is deleted after RemoveBreakpoint and RemoveBreakpoint2 are called.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetBreakpointById
The GetBreakpointById and GetBreakpointById2 methods return the breakpoint with the specified breakpoint ID.
HRESULT
IDebugControl::GetBreakpointById(
IN ULONG Id,
OUT IDebugBreakpoint * * Bp
);
HRESULT
IDebugControl4::GetBreakpointById2(
IN ULONG Id,
OUT IDebugBreakpoint2 * * Bp
);
Parameters
Id
Specifies the breakpoint ID of the breakpoint to return.
Bp
Receives the breakpoint.
Return Value
S_OK
The method was successful.
E_NOINTERFACE
No breakpoint was found with the given ID, or the breakpoint with the specified ID does not belong to the current process, or the breakpoint with the given ID is private
(see GetFlags).
This method can also return other error values. See Return Values for more details.
Interface Version
GetBreakpointById is available in all versions of IDebugControl. GetBreakpointById2 is available in IDebugControl4 and later versions.
Comments
If the specified breakpoint does not belong to the current process, the GetBreakpointById and GetBreakpointById2 methods will fail.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
IDebugBreakpoint
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetBreakpointByIndex
The GetBreakpointByIndex and GetBreakpointByIndex2 methods return the breakpoint located at the specified index.
HRESULT
IDebugControl::GetBreakpointByIndex(
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
IN ULONG Index,
OUT IDebugBreakpoint * *
);
Bp
HRESULT
IDebugControl4::GetBreakpointByIndex2(
IN ULONG Index,
OUT IDebugBreakpoint2 * * Bp
);
Parameters
Index
Specifies the zero-based index of the breakpoint to return. This is specific to the current process. The value of Index should be between zero and the total number of
breakpoints minus one. The total number of breakpoints can be determined by calling GetNumberBreakpoints.
Bp
Receives the returned breakpoint.
Return Value
S_OK
The method was successful.
E_NOINTERFACE
No breakpoint was found with the given index, or the breakpoint with the given index is private.
This method can also return other error values. See Return Values for more details.
Interface Version
GetBreakpointByIndex is available in all versions of IDebugControl. GetBreakpointByIndex2 is available in IDebugControl4 and later versions.
Comments
The index and returned breakpoint are specific to the current process. The same index will return a different breakpoint if the current process is changed.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetNumberBreakpoints
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetNumberBreakpoints
The GetNumberBreakpoints method returns the number of breakpoints for the current process.
HRESULT
IDebugControl::GetNumberBreakpoints(
OUT PULONG Number
);
Parameters
Number
Receives the number of breakpoints.
Return Value
S_OK
The method was successful.
This method can also return error values. See Return Values for more details.
Interface Version
GetNumberBreakpoints is available in all versions of IDebugControl.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
AddBreakpoint, RemoveBreakpoint
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetBreakpointParameters
The GetBreakpointParameters method returns the parameters of one or more breakpoints.
HRESULT
IDebugControl::GetBreakpointParameters(
IN ULONG Count,
IN OPTIONAL PULONG Ids,
IN ULONG Start,
OUT PDEBUG_BREAKPOINT_PARAMETERS Params
);
Parameters
Count
Specifies the number of breakpoints whose parameters are being requested.
Ids
Specifies an array containing the IDs of the breakpoints whose parameters are being requested. The number of items in this array must be equal to the value specified in
Count. If Ids is NULL, Start is used instead.
Start
Specifies the beginning index of the breakpoints whose parameters are being requested. The parameters for breakpoints with indices Start through Start plus Count minus
one will be returned. Start is used only if Ids is NULL.
Params
Receives the parameters for the specified breakpoints. The size of this array is equal to the value of Count. For details on the structure returned, see
DEBUG_BREAKPOINT_PARAMETERS.
Return Value
S_OK
The method was successful.
S_FALSE
The method was successful. However, the parameters for some of the breakpoints were not returned. The parameters that were not returned have their Id field set to
DEBUG_ANY_ID.
This method can also return error values. See Return Values for more details.
Interface Version
GetBreakpointParameters is available in all versions of IDebugControl.
Comments
Some of the parameters might not be returned. This happens if either a breakpoint could not be found or a breakpoint is private (see GetFlags).
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetParameters, GetBreakpointById, GetBreakpointByIndex
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ReadBugCheckData
The ReadBugCheckData method reads the kernel bug check code and related parameters.
HRESULT
IDebugControl::ReadBugCheck(
OUT PULONG Code,
OUT PULONG64 Arg1,
OUT PULONG64 Arg2,
OUT PULONG64 Arg3,
OUT PULONG64 Arg4
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
);
Parameters
Code
Receives the bug check code.
Arg1
Receives the first parameter associated with the bug check. The interpretation of this parameter depends on the bug check code.
Arg2
Receives the second parameter associated with the bug check. The interpretation of this parameter depends on the bug check code.
Arg3
Receives the third parameter associated with the bug check. The interpretation of this parameter depends on the bug check code.
Arg4
Receives the fourth parameter associated with the bug check. The interpretation of this parameter depends on the bug check code.
Return Value
S_OK
The method was successful.
This method can also return error values. See Return Values for more details.
Interface Version
ReadBugCheck is available in all versions of IDebugControl.
Comments
This method is only available in kernel-mode debugging.
For more information about bug checks, including a list of bug check codes and their interpretations, see Bug Checks (Blue Screens).
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetCodeLevel
The GetCodeLevel method returns the current code level and is mainly used when stepping through code.
HRESULT
IDebugControl::GetCodeLevel(
OUT PULONG Level
);
Parameters
Level
Receives the current code level. Level can take one of the values in the following table.
Value
Description
DEBUG_LEVEL_SOURCE
Source mode. When stepping through code on the target, the size of a single step will be a line of source code.
DEBUG_LEVEL_ASSEMBLY Assembly mode. When stepping through code on the target, the size of a single step will be a single processor instruction.
Return Value
S_OK
The method was successful.
This method can also return error values. See Return Values for more details.
Interface Version
GetCodeLevel is available in all versions of IDebugControl.
Comments
For more information about the code level, see Using Source Files.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
SetCodeLevel
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SetCodeLevel
The SetCodeLevel method sets the current code level and is mainly used when stepping through code.
HRESULT
IDebugControl::SetCodeLevel(
IN ULONG Level
);
Parameters
Level
Specifies the current code level. Level can take one of the values in the following table.
Value
Description
DEBUG_LEVEL_SOURCE
Source mode. When stepping through code on the target, the size of a single step will be a line of source code.
DEBUG_LEVEL_ASSEMBLY Assembly mode. When stepping through code on the target, the size of a single step will be a single processor instruction.
Return Value
S_OK
The method was successful.
This method can also return error values. See Return Values for more details.
Interface Version
SetCodeLevel is available in all versions of IDebugControl.
Comments
For more information about the code level, see Using Source Files.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetCodeLevel
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetDebuggeeType
The GetDebuggeeType method describes the nature of the current target.
HRESULT
IDebugControl::GetDebuggeeType(
OUT PULONG Class,
OUT PULONG Qualifier
);
Parameters
Class
Receives the class of the current target. It will be set to one of the values in the following table.
Value
Description
DEBUG_CLASS_UNINITIALIZED There is no current target.
DEBUG_CLASS_KERNEL
The current target is a kernel-mode target.
DEBUG_CLASS_USER_WINDOWS The current target is a user-mode target.
Qualifier
Provides more details about the type of the target. Its interpretation depends on the value of Class. When class is DEBUG_CLASS_UNINITIALIZED, Qualifier returns
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetDisassembleEffectiveOffset
The GetDisassembleEffectiveOffset method returns the address of the last instruction disassembled using Disassemble.
HRESULT
IDebugControl::GetDisassembleEffectiveOffset(
OUT PULONG64 Offset
);
Parameters
Offset
Receives the address in the target's memory of the effective offset from the last instruction disassembled.
Return Value
S_OK
The method was successful.
This method can also return error values. See Return Values for more details.
Interface Version
GetDisassembleEffectiveOffset is available in all versions of IDebugControl.
Comments
The effective offset is the memory location used by an instruction. For example, if the last instruction to be disassembled is move ax, [ebp+4], the effective address is
the value of ebp+4. This corresponds to the $ea pseudo-register.
For more information about using assembly with the debugger engine API, see Assembling and Disassembling Instructions.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.Defined in Dbgeng.h. Include Dbgeng.h.
See Also
Disassemble
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
OutputDisassembly
The OutputDisassembly method disassembles a processor instruction and sends the disassembly to the output callbacks.
HRESULT
IDebugControl::OutputDisassembly(
IN ULONG OutputControl,
IN ULONG64 Offset,
IN ULONG Flags,
OUT PULONG64 EndOffset
);
Parameters
OutputControl
Specifies the output control that determines which client's output callbacks receive the output. For possible values, see DEBUG_OUTCTL_XXX. For more information
about output, see Input and Output.
Offset
Specifies the location in the target's memory of the instruction to disassemble.
Flags
Specifies the bit-flags that affect the behavior of this method. The following table lists the bits that can be set.
Bit-Flag
Effect when set
DEBUG_DISASM_EFFECTIVE_ADDRESS Compute the effective address from the current register information and display it.
DEBUG_DISASM_MATCHING_SYMBOLS If the address of the instruction has an exact symbol match, output the symbol.
DEBUG_DISASM_SOURCE_LINE_NUMBER Include the source line number of the instruction in the output.
DEBUG_DISASM_SOURCE_FILE_NAME
Include the source file name in the output.
EndOffset
Receives the location in the target's memory of the instruction that follows the disassembled instruction.
Return Value
S_OK
The method was successful.
This method can also return error values. See Return Values for more details.
Interface Version
OutputDisassembly is available in all versions of IDebugControl.
Comments
The assembly language depends on the effective processor type of the target system. For information about the assembly language, see the processor documentation.
For an overview of using assembly in debugger applications, see Debugging in Assembly Mode. For more information about using assembly with the debugger engine API,
see Assembling and Disassembling Instructions.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
Disassemble, OutputDisassemblyLines, u (Unassemble)
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
OutputDisassemblyLines
The OutputDisassemblyLines method disassembles several processor instructions and sends the resulting assembly instructions to the output callbacks.
HRESULT
IDebugControl::OutputDisassemblyLines(
IN ULONG OutputControl,
IN ULONG PreviousLines,
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
IN ULONG TotalLines,
IN ULONG64 Offset,
IN ULONG Flags,
OUT OPTIONAL PULONG OffsetLine,
OUT OPTIONAL PULONG64 StartOffset,
OUT OPTIONAL PULONG64 EndOffset,
OUT OPTIONAL PULONG64 LineOffsets
);
Parameters
OutputControl
Specifies the output control that determines which client's output callbacks receive the output. For possible values, see DEBUG_OUTCTL_XXX. For more information
about output, see Input and Output.
PreviousLines
Specifies the number of lines of instructions before the instruction at Offset to include in the output. Typically, each instruction is output on a single line. However, some
instructions can take up several lines of output; this can cause the number of lines output before the instruction at Offset to be greater than PreviousLines.
TotalLines
Specifies the total number of lines of instructions to include in the output. Typically, each instruction is output on a single line. However, some instructions can take up
several lines of output; this can cause the number of lines output to be greater than TotalLines.
Offset
Specifies the location in the target's memory of the instructions to disassemble. The disassembly output will start PreviousLines lines before these processor instructions.
Flags
Specifies the bit-flags that affect the behavior of this method. The following table lists the bits that can be set.
Bit-Flag
Effect when set
DEBUG_DISASM_EFFECTIVE_ADDRESS Compute the effective address of each instruction from the current register information and output it.
DEBUG_DISASM_MATCHING_SYMBOLS If the address of an instruction has an exact symbol match, output the symbol.
DEBUG_DISASM_SOURCE_LINE_NUMBER Include the source line number of each instruction in the output.
DEBUG_DISASM_SOURCE_FILE_NAME
Include the source file name in the output.
OffsetLine
Receives the line number in the output that contains the instruction at Offset. If OffsetLine is NULL, this information is not returned.
StartOffset
Receives the location in the target's memory of the first instruction included in the output. If StartOffset is NULL, this information is not returned.
EndOffset
Receives the locaiton in the target's memory of the instruction that follows the last disassembled instruction.
LineOffsets
Receives the locations in the target's memory of the instructions included in the output starting with the instruction at Offset. LineOffsets is an array that contains
TotalLines elements.
Offset is the value of first entry in this array unless there was an error disassembling the instructions before this instruction. In this case, the first entry will contain
DEBUG_ANY_ID and Offset will be placed in the second entry in the array (index one).
If the output for an instruction spans multiple lines, the element in the array that corresponds to the first line of the instruction will contain the address of the instruction.
If LineOffsets is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
This method can also return error values. See Return Values for more details.
Interface Version
OutputDisassemblyLines is available in all versions of IDebugControl.
Comments
The assembly language depends on the effective processor type of the target system. For information about the assembly language, see the processor documentation.
For an overview of using assembly in debugger applications, see Debugging in Assembly Mode. For more information about using assembly with the debugger engine API,
see Assembling and Disassembling Instructions.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
Disassemble, OutputDisassembly, u (Unassemble)
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetDumpFormatFlags
The GetDumpFormatFlags method returns the flags that describe what information is available in a dump file target.
HRESULT
IDebugControl2::GetDumpFormatFlags(
OUT PULONG FormatFlags
);
Parameters
FormatFlags
Receives the flags that describe the information included in a dump file. Different dump files support different sets of format information. For example, see
DEBUG_FORMAT_XXX for a description of the flags used for user-mode Minidump files.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetDumpFormatflags is available in IDebugControl2 and later versions.
Comments
This method is only available when debugging crash dump files. If the crash dump file is in a default format or does not have variable formats, zero will be returned to
FormatFlags.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
WriteDumpFile2, WriteDumpFileWide
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
AddEngineOptions
The AddEngineOptions method turns on some of the debugger engine's options.
HRESULT
IDebugControl::AddEngineOptions(
IN ULONG Options
);
Parameters
Options
Specifies engine options to turn on. Options is a bit-set that will be combined with the existing engine options using the bitwise-OR operator. For a description of the
engine options, see DEBUG_ENGOPT_XXX.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
AddEngineOptions is available in all versions of IDebugControl.
Comments
After the engine options have been changed, the engine sends out notification to each client's event callback object by passing the DEBUG_CES_ENGINE_OPTIONS flag to
the IDebugEventCallbacks::ChangeEngineState method.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
See Also
GetEngineOptions, RemoveEngineOptions, SetEngineOptions
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetEngineOptions
The GetEngineOptions method returns the engine's options.
HRESULT
IDebugControl::GetEngineOptions(
OUT PULONG Options
);
Parameters
Options
Receives a bit-set that contains the engine's options. For a description of the engine options, see DEBUG_ENGOPT_XXX.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetEngineOptions is available in all versions of IDebugControl.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
AddEngineOptions, RemoveEngineOptions, SetEngineOptions
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
RemoveEngineOptions
The RemoveEngineOptions method turns off some of the engine's options.
HRESULT
IDebugControl::RemoveEngineOptions(
IN ULONG Options
);
Parameters
Options
Specifies the engine options to turn off. Options is a bit-set; the new value of the engine's options will equal the bitwise-NOT of Options combined with old value using
the bitwise-AND operator (new_value := old_value AND NOT Options). For a description of the engine options, see DEBUG_ENGOPT_XXX.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
RemoveEngineOptions is available in all versions of IDebugControl.
Comments
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
After the engine options have been changed, the engine sends out notification to each client's event callback object by passing the DEBUG_CES_ENGINE_OPTIONS flag to
the IDebugEventCallbacks::ChangeEngineState method.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.Defined in Dbgeng.h. Include Dbgeng.h.
See Also
AddEngineOptions, GetEngineOptions, SetEngineOptions
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SetEngineOptions
The SetEngineOptions method changes the engine's options.
HRESULT
IDebugControl::SetEngineOptions(
IN ULONG Options
);
Parameters
Options
Specifies the engine's new options. Options is a bit-set; it will replace the existing symbol options. For a description of the engine options, see DEBUG_ENGOPT_XXX.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
SetEngineOptions is available in all versions of IDebugControl.
Comments
This method will set the engine's options to those specified in Options. Unlike AddEngineOptions, any symbol options that are not listed in the Options bit-set will be
removed.
After the engine options have been changed, the engine sends out notification to each client's event callback object by passing the DEBUG_CES_ENGINE_OPTIONS flag to
the IDebugEventCallbacks::ChangeEngineState method.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
AddEngineOptions, GetEngineOptions, RemoveEngineOptions
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetSystemErrorControl
The GetSystemErrorControl method returns the control values for handling system errors.
HRESULT
IDebugControl::GetSystemErrorControl(
OUT PULONG OutputLevel,
OUT PULONG BreakLevel
);
Parameters
OutputLevel
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Receives the level at which system errors are printed to the engine's output. If the level of the system error is less than or equal to OutputLevel, the error is printed to the
debugger console.
BreakLevel
Receives the level at which system errors break into the debugger. If the level of the system error is less than or equal to BreakLevel, the error breaks into the debugger.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetSystemErrorControl is available in all versions of IDebugControl.
Comments
The level of a system error can take one of the following three values, listed from lowest to highest: SLE_ERROR, SLE_MINORERROR, and SLE_WARNING. These
values are defined in Winuser.h.
When a system error occurs, the engine calls the IDebugEventCallbacks::SystemError method of the event callbacks. If the level is less than or equal to BreakLevel, the
error will break into the debugger. If the level is greater than BreakLevel, the engine will proceed with execution in the target as indicated by the
IDebugEventCallbacks::SystemError method calls. For more information about how the engine proceeds after an event, see Monitoring Events.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
IDebugEventCallbacks::SystemError, SetSystemErrorControl
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SetSystemErrorControl
The SetSystemErrorControl method sets the control values for handling system errors.
HRESULT
IDebugControl::SetSystemErrorControl(
IN ULONG OutputLevel,
IN ULONG BreakLevel
);
Parameters
OutputLevel
Specifies the level at which system errors are printed to the engine's output. If the level of the system error is less than or equal to OutputLevel, the error is printed to the
debugger console.
BreakLevel
Specifies the level at which system errors break into the debugger. If the level of the system error is less than or equal to BreakLevel, the error breaks into the debugger.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
SetSystemErrorControl is available in all versions of IDebugControl.
Comments
The level of a system error can take one of the following three values, listed from lowest to highest: SLE_ERROR, SLE_MINORERROR, and SLE_WARNING. These
values are defined in Winuser.h.
When a system error occurs, the engine calls the IDebugEventCallbacks::SystemError method of the event callbacks. If the level is less than or equal to the BreakLevel
parameter, the error will break into the debugger. If the level is greater than BreakLevel, the engine will proceed with execution in the target as indicated by the
IDebugEventCallbacks::SystemError method calls. For more information about how the engine proceeds after an event, see Monitoring Events.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
See Also
GetSystemErrorControl, IDebugEventCallbacks::SystemError
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetNotifyEventHandle
The GetNotifyEventHandle method receives the handle of the event that will be signaled after the next exception in a target.
HRESULT
IDebugControl::GetNotifyEventHandle(
OUT PULONG64 Handle
);
Parameters
Handle
Receives the handle of the event that will be signaled. If Handle is NULL, no event will be signaled.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetNotifyEventHandle is available in all versions of IDebugControl.
Comments
If an event to be signaled was set and an exception occurs in a target, when the engine resumes execution in the target again, the event will be signaled.
The event will only be signaled once. After it has been signaled, this method will return NULL to Handle, unless SetNotifyEventHandle is called to set another event to
signal.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
SetNotifyEventHandle
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SetNotifyEventHandle
The SetNotifyEventHandle method sets the event that will be signaled after the next exception in a target.
HRESULT
IDebugControl::SetNotifyEventHandle(
IN ULONG64 Handle
);
Parameters
Handle
Specifies the handle of the event to signal. If Handle is NULL, no event will be signaled.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Interface Version
SetNotifyEventHandle is available in all versions of IDebugControl.
Comments
After setting the event to signal, and after the next exception occurs in a target, when the engine resumes execution in the target, the event will be signaled.
The event will only be signaled once. After it has been signaled, GetNotifyEventHandle will return NULL, unless this method is called to set another event to signal.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
SetNotifyEventHandle
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetNumberEvents
The GetNumberEvents method returns the number of events for the current target, if the number of events is fixed.
HRESULT
IDebugControl3::GetNumberEvents(
OUT PULONG Events
);
Parameters
Events
Receives the number of events stored in the target. If the target offers multiple events, Events will be set to the number of events available. Otherwise, Events will be set
to one.
Return Value
S_OK
The method was successful, and Events contains the total number of events possible for the target.
S_FALSE
The method was successful, but Events contains only the total number of events possible at the current time. Targets that support variable execution might have different
sets of events available at different points during the targets execution.
This method may also return error values. See Return Values for more details.
Interface Version
GetNumberEvents is available in IDebugControl3 and later versions.
Comments
Crash dump files contain a static list of events; each event represents a snapshot of the target at a particular point in time. If the current target is a crash dump file, this method
sets Events to the number of stored events and returns S_OK.
Live targets generate events dynamically and do not necessarily have a known set of events. If the current target is a live target with unconstrained number of events, this
method sets Events to the number of events currently available and returns S_FALSE.
For more information, see the topic Event Information.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetCurrentEventIndex, SetNextEventIndex
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetCurrentEventIndex
The GetCurrentEventIndex method returns the index of the current event within the current list of events for the current target, if such a list exists.
HRESULT
IDebugControl3::GetCurrentEventIndex(
OUT PULONG Index
);
Parameters
Index
Receives the index of the current event in the target. The index will be a number between zero and one less than the number of events returned by GetNumberEvents.
The index of the first event is zero.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetCurrentEventIndex is available in IDebugControl3 and later versions.
Comments
Targets that do not have fixed sets of events will always return zero to Index.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetNumberEvents, SetNextEventIndex
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SetNextEventIndex
The SetNextEventIndex method sets the next event for the current target by selecting the event from the static list of events for the target, if such a list exists.
HRESULT
IDebugControl3::SetNextEventIndex(
IN ULONG Relation,
IN ULONG Value,
OUT PULONG NextIndex
);
Parameters
Relation
Specifies how to interpret Value when setting the index of the next event. Possible values are: DEBUG_EINDEX_FROM_START, DEBUG_EINDEX_FROM_END,
and DEBUG_EINDEX_FROM_CURRENT.
Value
Specifies the index of the next event relative to the first, last, or current event. The interpretation of Value depends on the value of Relation, as follows.
Value of Relation
Next Event Index
DEBUG_EINDEX_FROM_START
Value.
DEBUG_EINDEX_FROM_END
Number of events minus Value.
DEBUG_EINDEX_FROM_CURRENT The current event index plus Value.
The resulting index must be greater than zero and one less than the number of events returned by GetNumberEvents.
NextIndex
Receives the index of the next event. If NextIndex is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Interface Version
SetNextEventIndex is available in IDebugControl3 and later versions.
Comments
If the specified event is the same as the current event, this method does nothing. Otherwise, this method sets the execution status of the target to DEBUG_STATUS_GO (and
notifies the event callbacks). When WaitForEvent is called, the engine will generate the specified event for the event callbacks and set it as the current event.
This method is only useful if the target offers a list of events.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetNumberEvents, GetCurrentEventIndex
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetEventIndexDescription
The GetEventIndexDescription and GetEventIndexDescriptionWide methods describe the specified event in a static list of events for the current target.
HRESULT
IDebugControl3::GetEventIndexDescription(
IN ULONG Index,
IN ULONG Which,
IN OPTIONAL PSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG DescSize
);
HRESULT
IDebugControl3::GetEventIndexDescriptionWide(
IN ULONG Index,
IN ULONG Which,
IN OPTIONAL PWSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG DescSize
);
#ifdef UNICODE
#define GetEventIndexDescriptionT GetEventIndexDescriptionWide
#else
#define GetEventIndexDescriptionT GetEventIndexDescription
#endif
Parameters
Index
Specifies the index of the event whose description will be returned.
Which
Specifies which piece of the event description to return. Currently only DEBUG_EINDEX_NAME is supported; this returns the name of the event.
Buffer
Receives the description of the event. If Buffer is NULL, this information is not returned.
BufferSize
Specifies the size, in characters, of the Buffer buffer.
DescSize
Receives the size, in characters, of the description. If DescSize is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetEventIndexDescription is available in IDebugControl3 and later versions.
Comments
The amount of descriptive information available for a particular target varies depending on the type of the target.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetNumberEvents, GetCurrentEventIndex
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetExpressionSyntax
The GetExpressionSyntax method returns the current syntax that the engine is using for evaluating expressions.
HRESULT
IDebugControl3::GetExpressionSyntax(
OUT PULONG Flags
);
Parameters
Flags
Receives the expression syntax. It is set to one of the following values:
DEBUG_EXPR_MASM
Expressions will be evaluated according to MASM syntax. For details of this syntax, see MASM Numbers and Operators.
DEBUG_EXPR_CPLUSPLUS
Expressions will be evaluated according to C++ syntax. For details of this syntax, see C++ Numbers and Operators.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetExpressionSyntax is available in IDebugControl3 and later versions.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
SetExpressionSyntax, SetExpressionSyntaxByName, Evaluate
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SetExpressionSyntax
The SetExpressionSyntax method sets the syntax that the engine will use to evaluate expressions.
HRESULT
IDebugControl3::SetExpressionSyntax(
IN ULONG Flags
);
Parameters
Flags
Specifies the syntax that the engine will use to evaluate expressions. It can be one of the following values:
DEBUG_EXPR_MASM
Expressions will be evaluated according to MASM syntax. For details of this syntax, see MASM Numbers and Operators.
DEBUG_EXPR_CPLUSPLUS
Expressions will be evaluated according to C++ syntax. For details of this syntax, see C++ Numbers and Operators.
Return Value
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
SetExpressionSyntax is available in IDebugControl3 and later versions.
Comments
The expression syntax is a global setting within the engine, so setting the expression syntax will affect all clients.
The expression syntax of the engine determines how the engine will interpret expressions passed to Evaluate, Execute, and any other method that evaluates an expression.
After the expression syntax has been changed, the engine sends out notification to the IDebugEventCallbacks registered with each client. It also passes the
DEBUG_CES_EXPRESSION_SYNTAX flag to the IDebugEventCallbacks::ChangeEngineState method.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetExpressionSyntax, SetExpressionSyntaxByName, Evaluate
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetExpressionSyntaxNames
The GetExpressionSyntaxNames and GetExpressionSyntaxNamesWide methods return the full and abbreviated names of an expression syntax.
HRESULT
IDebugControl3::GetExpressionSyntaxNames(
IN ULONG Index,
OUT OPTIONAL PSTR FullNameBuffer,
IN ULONG FullNameBufferSize,
OUT OPTIONAL PULONG FullNameSize,
OUT OPTIONAL PSTR AbbrevNameBuffer,
IN ULONG AbbrevNameBufferSize,
OUT OPTIONAL PULONG AbbrevNameSize
);
HRESULT
IDebugControl4::GetExpressionSyntaxNamesWide(
IN ULONG Index,
OUT OPTIONAL PWSTR FullNameBuffer,
IN ULONG FullNameBufferSize,
OUT OPTIONAL PULONG FullNameSize,
OUT OPTIONAL PWSTR AbbrevNameBuffer,
IN ULONG AbbrevNameBufferSize,
OUT OPTIONAL PULONG AbbrevNameSize
);
#ifdef UNICODE
#define GetExpressionSyntaxNamesT GetExpressionSyntaxNamesWide
#else
#define GetExpressionSyntaxNamesT GetExpressionSyntaxNames
#endif
Parameters
Index
Specifies the index of the expression syntax. Index should be between zero and the number of expression syntaxes returned by GetNumberExpressionSyntaxes minus
one.
FullNameBuffer
Receives the full name of the expression syntax. If FullNameBuffer is NULL, this information is not returned.
FullNameBufferSize
Specifies the size, in characters, of the buffer FullNameBuffer.
FullNameSize
Receives the size, in characters, of the full name of the expression syntax. If FullNameSize is NULL, this information is not returned.
AbbrevNameBuffer
Receives the abbreviated name of the expression syntax. If AbbrevNameBuffer is NULL, this information is not returned.
AbbrevNameBufferSize
Specifies the size, in characters, of the buffer AbbrevNameBufferSize.
AbbrevNameSize
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Receives the size, in characters, of the abbreviated name of the expression syntax. If AbbrevNameSize is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
S_FALSE
The method was successful. However, either FullNameBufferSize or AbbrevNameBufferSize was smaller than the size of the respective expression syntax name, and the
name was truncated to fit inside the buffer.
This method can also return error values. See Return Values for more details.
Interface Version
GetExpressionSyntaxNames is available in IDebugControl3 and later versions. GetExpressionSyntaxNamesWide is available in IDebugControl4 and later versions.
Comments
Currently, there are two expression syntaxes, their full names are "Microsoft Assembler expressions" and "C++ source expressions." The corresponding abbreviated
expression syntaxes are "MASM" and "C++."
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
Evaluate, GetNumberExpressionSyntaxes, SetExpressionSyntaxByName
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SetExpressionSyntaxByName
The SetExpressionSyntaxByName and SetExpressionSyntaxByNameWide methods set the syntax that the engine will use to evaluate expressions.
HRESULT
IDebugControl3::SetExpressionSyntaxByName(
IN PCSTR AbbrevName
);
HRESULT
IDebugControl4::SetExpressionSyntaxByNameWide(
IN PCWSTR AbbrevName
);
#ifdef UNICODE
#define SetExpressionSyntaxNamesT SetExpressionSyntaxNamesWide
#else
#define SetExpressionSyntaxNamesT SetExpressionSyntaxNames
#endif
Parameters
AbbrevName
Specifies the abbreviated name of the syntax. It can be one of the following strings:
C++
Expressions will be evaluated according to C++ syntax. For details of this syntax, see C++ Numbers and Operators.
MASM
Expressions will be evaluated according to MASM syntax. For details of this syntax, see MASM Numbers and Operators.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
SetExpressionSyntaxNames is available in IDebugControl3 and later versions. SetExpressionSyntaxNamesWide is available in IDebugControl4 and later versions.
Comments
The expression syntax is a global setting within the engine, so setting the expression syntax will affect all clients.
The expression syntax of the engine determines how the engine will interpret expressions passed to Evaluate, Execute, and any other method that evaluates an expression.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
After the expression syntax has been changed, the engine sends out notification to the IDebugEventCallbacks callback object registered with each client. It also passes the
DEBUG_CES_EXPRESSION_SYNTAX flag to the IDebugEventCallbacks::ChangeEngineState method.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetExpressionSyntax, SetExpressionSyntax, Evaluate
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetNumberExpressionSyntaxes
The GetNumberExpressionSyntaxes method returns the number of expression syntaxes that are supported by the engine.
HRESULT
IDebugControl3::GetNumberExpressionSyntaxes(
OUT PULONG Number
);
Parameters
Number
Receives the number of expression syntaxes.
Return Value
S_OK
The method was successful.
This method can also return error values. See Return Values for more details.
Interface Version
GetNumberExpressionSyntaxes is available in IDebugControl3 and later versions.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
Evaluate, GetExpressionSyntaxNames, SetExpressionSyntaxByName
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
AddExtension
The AddExtension and AddExtensionWide methods load an extension library into the debugger engine.
HRESULT
IDebugControl::AddExtension(
IN PCSTR Path,
IN ULONG Flags,
OUT PULONG64 Handle
);
HRESULT
IDebugControl4::AddExtensionWide(
IN PCWSTR Path,
IN ULONG Flags,
OUT PULONG64 Handle
);
#ifdef UNICODE
#define AddExtensionT AddExtensionWide
#else
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
RemoveExtension
The RemoveExtension method unloads an extension library.
HRESULT
IDebugControl::RemoveExtension(
IN ULONG64 Handle
);
Parameters
Handle
Specifies the handle of the extension library to unload. This is the handle returned by AddExtension.
Return Value
S_OK
The method was successful.
This method can also return error values. See Return Values for more details.
Interface Version
RemoveExtension is available in all versions of IDebugControl.
Comments
For more information on using extension libraries, see Calling Extensions and Extension Functions.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
AddExtension
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
CallExtension
The CallExtension and CallExtensionWide methods call a debugger extension.
HRESULT
IDebugControl::CallExtension(
IN ULONG64 Handle,
IN PCSTR Function,
IN OPTIONAL PCSTR Arguments
);
HRESULT
IdebugControl4::CallExtensionWide(
IN ULONG64 Handle,
IN PCWSTR Function,
IN OPTIONAL PCWSTR Arguments
);
#ifdef UNICODE
#define AddExtensionT AddExtensionWide
#else
#define AddExtensionT AddExtension
#endif
Parameters
Handle
Specifies the handle of the extension library that contains the extension to call. If Handle is zero, the engine will walk the extension library chain searching for the
extension.
Function
Specifies the name of the extension to call.
Arguments
Specifies the arguments to pass to the extension. Arguments is a string that will be parsed by the extension, just like the extension will parse arguments passed to it when
called as an extension command.
Return Value
S_OK
The method was successful.
This method can also return error values. See Return Values for more details.
Interface Version
CallExtension is available in all versions of IDebugControl. CallExtensionWide is available in IDebugControl4 and later versions.
Comments
If Handle is zero, the engine searches each extension library until it finds one that contains the extension; the extension will then be called. If the extension returns
DEBUG_EXTENSION_CONTINUE_SEARCH, the search will continue.
For more information on using extension libraries, see Calling Extensions and Extension Functions.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
AddExtension, GetExtensionByPath, GetExtensionFunction
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetExtensionByPath
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The GetExtensionByPath and GetExtensionByPathWide methods return the handle for an already loaded extension library.
HRESULT
IDebugControl::GetExtensionByPath(
IN PCSTR Path,
OUT PULONG64 Handle
);
HRESULT
IDebugControl4::GetExtensionByPathWide(
IN PCWSTR Path,
OUT PULONG64 Handle
);
#ifdef UNICODE
#define GetExtensionByPathT GetExtensionByPathWide
#else
#define GetExtensionByPathT GetExtensionByPath
#endif
Parameters
Path
Specifies the fully qualified path and file name of the extension library.
Handle
Receives the handle of the extension library.
Return Value
S_OK
The method was successful.
This method can also return error values. See Return Values for more details.
Interface Version
GetExtensionByPath is available in all versions of IDebugControl. GetExtensionByPathWide is available in IDebugControl4 and later versions.
Comments
Extension libraries are loaded into the host engine, which is where this method looks for the requested extension library. Path is a path and file name for the host engine.
For more information on using extension libraries, see Calling Extensions and Extension Functions.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
AddExtension
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetExtensionFunction
The GetExtensionFunction and GetExtensionFunctionWide methods return a pointer to an extension function from an extension library.
HRESULT
IDebugControl::GetExtensionFunction(
IN ULONG64 Handle,
IN PCSTR FuncName,
OUT FARPROC * Function
);
HRESULT
IDebugControl4::GetExtensionFunctionWide(
IN ULONG64 Handle,
IN PCWSTR FuncName,
OUT FARPROC * Function
);
#ifdef UNICODE
#define GetExtensionFunctionT GetExtensionFunctionWide
#else
#define GetExtensionFunctionT GetExtensionFunction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
#endif
Parameters
Handle
Specifies the handle of the extension library that contains the extension function. If Handle is zero, the engine will walk the extension library chain searching for the
extension function.
FuncName
Specifies the name of the extension function to return. When searching the extension libraries for the function, the debugger engine will prepend "_EFN_" to the name.
For example, if FuncName is "SampleFunction", the engine will search the extension libraries for "_EFN_SampleFunction".
Function
Receives the extension function.
Return Value
S_OK
The method was successful.
This method can also return error values. See Return Values for more details.
Interface Version
GetExtensionFunction is available in all versions of IDebugControl. GetExtensionFunctionWide is available in IDebugControl4 and later versions.
Comments
Extension libraries are loaded into the host engine and extension functions cannot be called remotely. The current client must not be a debugging client, it must belong to the
host engine.
The extension function can have any function prototype. In order for any program to call this extension function, the extension function should be cast to the correct
prototype.
For more information on using extension functions, see Calling Extensions and Extension Functions.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
See Also
AddExtension, CallExtension, GetExtensionByPath
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetWindbgExtensionApis64
The GetWindbgExtensionApis64 method returns a structure that facilitates using the WdbgExts API.
HRESULT
IDebugControl::GetWindbgExtensionApis64(
IN OUT WINDBG_EXTENSION_APIS64 * Api
);
Parameters
Api
Receives a WINDBG_EXTENSION_APIS64 structure. This structure contains the functions used by the WdbgExts API. The nSize member of this structure must be set
to the size of the structure before it is passed to this method.
Return Value
S_OK
The method was successful.
E_INVALIDARG
The value of Api->nSize does not equal the size of the structure WINDBG_EXTENSION_APIS64.
This method may also return other error values. See Return Values for more details.
Interface Version
GetWindbgExtensionApis64 is available in all versions of IDebugControl.
Comments
If you are including Wdbgexts.h in your extension code, you should call this method during the initialization of the extension DLL (see DebugExtensionInitialize).
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Many WdbgExts functions are really macros. To ensure that these macros work correctly, the structure received by the Api parameter should be stored in a global variable
named ExtensionApis.
The WINDBG_EXTENSION_APIS64 structure returned by this method serves the same purpose as the one provided to the callback function WinDbgExtensionDllInit
(used by WdbgExts extensions).
For a list of the functions provided by the WdbgExts API, see WdbgExts Functions.
Requirements
Headers: Defined in Dbgeng.h. WINDBG_EXTENSION_APIS64 is defined in Wdbgexts.h. Include Dbgeng.h and Wdbgexts.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
WaitForEvent
The WaitForEvent method waits for an event that breaks into the debugger engine application.
HRESULT
IDebugControl::WaitForEvent(
IN ULONG Flags,
IN ULONG Timeout
);
Parameters
Flags
Set to zero. There are currently no flags that can be used in this parameter.
Timeout
Specifies how many milliseconds to wait before this method will return. If Timeout is INFINITE, this method will not return until an event that breaks into the debugger
engine application occurs or an exit interrupt is issued. If the current session has a live kernel target, Timeout must be set to INFINITE.
Return Value
S_OK
The method was successful.
S_FALSE
The time-out expired.
E_PENDING
An exit interrupt was issued. The target is not available.
E_UNEXPECTED
Either there is an outstanding request for input, or none of the targets could generate events.
E_FAIL
The engine is already waiting for an event.
This method may return other error values and the above error values may have additional meanings. See Return Values for more details.
Interface Version
WaitForEvent is available in all versions of IDebugControl.
Comments
The method can be called only from the thread that started the debugger session.
When an event occurs, the debugger engine will process the event and call the event callbacks. If one of these callbacks indicates that the event should break into the debugger
engine application (by returning DEBUG_STATUS_BREAK), this method will return; otherwise, it will continue waiting for an event. The event filters can also specify that
an event should break into the debugger engine application. For more information about event filters, see Controlling Exceptions and Events.
This method is not re-entrant. Once it has been called, it can not be called again on any client until it has returned. In particular, it can not be called from the event callbacks,
including extensions and commands executed by the callbacks.
If none of the targets are capable of generating events for example, all the targets have exited this method will end the current session, discard the targets, and then
return E_UNEXPECTED.
For more information about using WaitForEvent to control the execution flow of the debugger application and targets, see Debugging Session and Execution Model. For
details on the event callbacks, see Monitoring Events.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h. The constant INFINITE is defined in Winbase.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetEventFilterCommand
The GetEventFilterCommand and GetEventFilterCommandWide methods return the debugger command that the engine will execute when a specified event occurs.
HRESULT
IDebugControl::GetEventFilterCommand(
IN ULONG Index,
OUT PSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG CommandSize
);
HRESULT
IDebugControl4::GetEventFilterCommandWide(
IN ULONG Index,
OUT PWSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG CommandSize
);
#ifdef UNICODE
#define GetEventFilterCommandT GetEventFilterCommandWide
#else
#define GetEventFilterCommandT GetEventFilterCommand
#endif
Parameters
Index
Specifies the index of the event filter. Index can take any value between zero and one less than the total number of event filters returned by GetNumberEventFilters
(inclusive). For more information about the index of the filters, see Index and Exception Code.
Buffer
Receives the debugger command that the engine will execute when the event occurs.
BufferSize
Specifies the size, in characters, of the buffer that Buffer specifies.
CommandSize
Receives the size in characters of the command. If CommandSize is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetEventFilterCommand is available in all versions of IDebugControl. GetEventFilterCommandWide is available in IDebugControl4 and later versions.
Comments
For more information about event filters, see Event Filters.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
sx, sxd, sxe, sxi, sxn (Set Exceptions), SetEventFilterCommand, GetExceptionFilterSecondCommand
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SetEventFilterCommand
The SetEventFilterCommand and SetEventFilterCommandWide methods set a debugger command for the engine to execute when a specified event occurs.
HRESULT
IDebugControl::SetEventFilterCommand(
IN ULONG Index,
IN PCSTR Command
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
);
HRESULT
IDebugControl4::SetEventFilterCommandWide(
IN ULONG Index,
IN PCWSTR Command
);
#ifdef UNICODE
#define SetEventFilterCommandT SetEventFilterCommandWide
#else
#define SetEventFilterCommandT SetEventFilterCommand
#endif
Parameters
Index
Specifies the index of the event filter. Index can take any value between zero and one less than the total number of event filters returned by GetNumberEventFilters
(inclusive). For more information about the index of the filters, see Index and Exception Code.
Command
Specifies the debugger command for the engine to execute when the event occurs.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
SetEventFilterCommand is available in all versions of IDebugControl. SetEventFilterCommandWide is available in IDebugControl4 and later versions.
Comments
For more information about event filters, see Event Filters.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
sx, sxd, sxe, sxi, sxn (Set Exceptions), GetEventFilterCommand, SetExceptionFilterSecondCommand
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetNumberEventFilters
The GetNumberEventFilters method returns the number of event filters currently used by the engine.
HRESULT
IDebugControl::GetNumberEventFilters(
OUT PULONG SpecificEvents,
OUT PULONG SpecificExceptions,
OUT PULONG ArbitraryExceptions
);
Parameters
SpecificEvents
Receives the number of events that can be controlled using the specific event filters. These events are enumerated using some of the DEBUG_FILTER_XXX constants.
SpecificExceptions
Receives the number of exceptions that can be controlled using the specific exception filters. The first specific exception filter is the default exception filter. The
exceptions controlled by the other specific exception filters will always have their own filter and will not inherit their behavior from the default specific exception filter.
These exception filters are identified by their exception code. See Specific Exceptions for a list of the specific exception filters.
ArbitraryExceptions
Receives the number of arbitrary exception filters currently used by the engine. These exception filters are identified by their exception code.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Interface Version
GetNumberEventFilters is available in all versions of IDebugControl.
Comments
For more information about event filters, see Event Filters.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetEventFilterText
The GetEventFilterText and GetEventFilterTextWide methods return a short description of an event for a specific filter.
HRESULT
IDebugControl::GetEventFilterText(
IN ULONG Index,
OUT PSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG TextSize
);
HRESULT
IDebugControl4::GetEventFilterTextWide(
IN ULONG Index,
OUT PWSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG TextSize
);
#ifdef UNICODE
#define GetEventFilterTextT GetEventFilterTextWide
#else
#define GetEventFilterTextT GetEventFilterText
#endif
Parameters
Index
Specifies the index of the event filter whose description will be returned. Only the specific filters have a description attached to them; Index must refer to a specific filter.
Buffer
Receives the description of the specific filter.
BufferSize
Specifies the size, in characters, of the buffer that Buffer specifies.
TextSize
Receives the size of the event description. If TextSize is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
E_NOINTERFACE
Index did not refer to a specific filter. This can occur if Index refers to an arbitrary exception filter.
This method may also return error values. See Return Values for more details.
Interface Version
GetEventFilterText is available in all versions of IDebugControl. GetEventFilterTextWide is available in IDebugControl4 and later versions.
Comments
For more information about event filters, see Event Filters.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
sx, sxd, sxe, sxi, sxn (Set Exceptions), GetSpecificFilterParameters
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetLastEventInformation
The GetLastEventInformation and GetLastEventInformationWide methods return information about the last event that occurred in a target.
HRESULT
IDebugControl::GetLastEventInformation(
OUT PULONG Type,
OUT PULONG ProcessId,
OUT PULONG ThreadId,
OUT OPTIONAL PVOID ExtraInformation,
IN ULONG ExtraInformationSize,
OUT OPTIONAL PULONG ExtraInformationUsed,
OUT OPTIONAL PSTR Description,
IN ULONG DescriptionSize,
OUT OPTIONAL PULONG DescriptionUsed
);
HRESULT
IDebugControl4::GetLastEventInformationWide(
OUT PULONG Type,
OUT PULONG ProcessId,
OUT PULONG ThreadId,
OUT OPTIONAL PVOID ExtraInformation,
IN ULONG ExtraInformationSize,
OUT OPTIONAL PULONG ExtraInformationUsed,
OUT OPTIONAL PWSTR Description,
IN ULONG DescriptionSize,
OUT OPTIONAL PULONG DescriptionUsed
);
#ifdef UNICODE
#define GetLastEventInformationT GetLastEventInformationWide
#else
#define GetLastEventInformationT GetLastEventInformation
#endif
Parameters
Type
Receives the type of the last event generated by the target. For a list of possible types, see DEBUG_EVENT_XXX.
ProcessId
Receives the process ID of the process in which the event occurred. If this information is not available, DEBUG_ANY_ID will be returned instead.
ThreadId
Receives the thread ID of the thread in which the last event occurred. If this information is not available, DEBUG_ANY_ID will be returned instead.
ExtraInformation
Receives extra information about the event. The contents of this extra information depends on the type of the event. If ExtraInformation is NULL, this information is not
returned.
ExtraInformationSize
Specifies the size, in bytes, of the buffer that ExtraInformation specifies.
ExtraInformationUsed
Receives the size, in bytes, of extra information. If ExtraInformationUsed is NULL, this information is not returned.
Description
Receives the description of the event. If Description is NULL, this information is not returned.
DescriptionSize
Specifies the size, in characters, of the buffer that Description specifies.
DescriptionUsed
Receives the size in characters of the description of the event. If DescriptionUsed is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
S_FALSE
The method was successful. However, either ExtraInformationSize or DescriptionSize were smaller that the size of the respective data or string and the data or string was
truncated to fit inside the buffer.
This method may also return error values. See Return Values for more details.
Interface Version
GetLastEventInformationWide is available in all versions of IDebugControl. GetLastEventInformationWideWide is available in IDebugControl4 and later versions.
Comments
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
For thread and process creation events, the thread ID and process ID returned to ThreadId and ProcessId are for the newly created thread or process.
For more information about the last event, see the topic Event Information.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetStoredEventInformation
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetStoredEventInformation
The GetStoredEventInformation method retrieves information about an event of interest available in the current target.
HRESULT
IDebugControl4::GetStoredEventInformation(
OUT PULONG Type,
OUT PULONG ProcessId,
OUT PULONG ThreadId,
OUT OPTIONAL PVOID Context,
IN ULONG ContextSize,
OUT OPTIONAL PULONG ContextUsed,
OUT OPTIONAL PVOID ExtraInformation,
IN ULONG ExtraInformationSize,
OUT OPTIONAL PULONG ExtraInformationUsed
Parameters
Type
Receives the type of the stored event. For a list of possible types, see DEBUG_EVENT_XXX.
ProcessId
Receives the process ID of the process in which the event occurred. If this information is not available, DEBUG_ANY_ID will be returned instead.
ThreadId
Receives the thread ID of the thread in which the last event occurred. If this information is not available, DEBUG_ANY_ID will be returned instead.
Context
Receives the thread context of the stored event. The type of the thread context is the CONTEXT structure for the target's effective processor at the time of the event. The
Context buffer must be large enough to hold this structure. If Context is NULL, this information is not returned.
ContextSize
Specifies the size, in bytes, of the buffer that Context specifies.
ContextUsed
Receives the size in bytes of the context. If ContextUsed is NULL, this information is not returned.
ExtraInformation
Receives extra information about the event. The contents of this extra information depends on the type of the event. If ExtraInformation is NULL, this information is not
returned.
ExtraInformationSize
Specifies the size, in bytes, of the buffer that ExtraInformation specifies.
ExtraInformationUsed
Receives the size in bytes of extra information. If ExtraInformationUsed is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetStoredEventInformation is available in IDebugControl4 and later versions.
Comments
Many targets do not have an event of interest.
If the target is a user-mode minidump file, the dump file generator may store an additional event. Typically, this is the event that provoked the generator to save the dump file.
For more information, see the topic Event Information.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h. CONTEXT is defined in Ntddk.h.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
See Also
GetLastEventInformation
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetExceptionFilterParameters
The GetExceptionFilterParameters method returns the parameters for exception filters specified by exception codes or by index.
HRESULT
IDebugControl::GetExceptionFilterParameters(
IN ULONG Count,
IN OPTIONAL PULONG Codes,
IN ULONG Start,
OUT DEBUG_EXCEPTION_FILTER_PARAMETERS * Params
);
Parameters
Count
Specifies the number of exception filters for which to return parameters.
Codes
Specifies an array of exception codes. The parameters for the exception filters with these exception codes will be returned. If Codes is NULL, Start is used instead.
Start
Specifies the index of the first exception filter. The parameters for the exception filters starting at Start will be returned. If Codes is not NULL, Start is ignored.
Params
Receives the parameters for the exception filters specified by Codes or Start. Params is an array of elements of type DEBUG_EXCEPTION_FILTER_PARAMETERS.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetExceptionFilterParameters is available in all versions of IDebugControl.
Comments
For more information about event filters, see Event Filters.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
sx, sxd, sxe, sxi, sxn (Set Exceptions), SetExceptionFilterParameters, GetSpecificFilterParameters
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SetExceptionFilterParameters
The SetExceptionFilterParameters method changes the break status and handling status for some exception filters.
HRESULT
IDebugControl::SetExceptionFilterParameters(
IN ULONG Count,
IN DEBUG_EXCEPTION_FILTER_PARAMETERS * Params
);
Parameters
Count
Specifies the number of exception filters to change the parameters for.
Params
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Specifies an array of exception filter parameters of type DEBUG_EXCEPTION_FILTER_PARAMETERS. Only the ExecutionOption, ContinueOption, and
ExceptionCode fields of these parameters are used. The ExceptionCode field is used to identify the exception whose exception filter will be changed. ExceptionOption
specifies the new break status and ContinueOption specifies the new handling status.
If the value of the ExceptionOption field is DEBUG_FILTER_REMOVE and the exception filter is an arbitrary exception filter, the exception filter will be removed.
Return Value
S_OK
The method was successful.
E_OUTOFMEMORY
The maximum number of arbitrary exception filters has been exceeded.
This method may also return error values. See Return Values for more details.
Interface Version
SetExceptionFilterParameters is available in all versions of IDebugControl.
Comments
For each of the exception filter parameters in Params, if the exception, identified by exception code, already has a filter (specific or arbitrary), that filter will be changed.
Otherwise, a new arbitrary exception filter will be added for the exception.
For more information about event filters, see Event Filters.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
sx, sxd, sxe, sxi, sxn (Set Exceptions), GetExceptionFilterParameters, SetSpecificFilterParameters
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetExceptionFilterSecondCommand
The GetExceptionFilterSecondCommand and GetExceptionFilterSecondCommandWide methods return the command that will be executed by the debugger engine upon
the second chance of a specified exception.
HRESULT
IDebugControl::GetExceptionFilterSecondCommand(
IN ULONG Index,
OUT PSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG CommandSize
);
HRESULT
IDebugControl3::GetExceptionFilterSecondCommandWide(
IN ULONG Index,
OUT PWSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG CommandSize
);
#ifdef UNICODE
#define GetExceptionFilterSecondCommandT GetExceptionFilterSecondCommandWide
#else
#define GetExceptionFilterSecondCommandT GetExceptionFilterSecondCommand
#endif
Parameters
Index
Specifies the index of the exception filter whose second-chance command will be returned. Index can also refer to the default exception filter to return the second-chance
command for those exceptions that do not have a specific or arbitrary exception filter.
Buffer
Receives the second-chance command for the exception filter.
BufferSize
Specifies the size, in characters, of the buffer that Buffer specifies.
CommandSize
Receives the size, in characters, of the second-chance command for the exception filter. If CommandSize is NULL, this information is not returned.
Return Value
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetExceptionFilterSecondCommand is available in all versions of IDebugControl. GetExceptionFilterSecondCommandWide is available in IDebugControl3 and later
versions.
Comments
Only exception filters support a second-chance command. If Index refers to a specific event filter, the command returned to Buffer will be empty. The returned command will
also be empty if no second-chance command has been set for the specified exception.
For more information about event filters, see Event Filters.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
sx, sxd, sxe, sxi, sxn (Set Exceptions), SetExceptionFilterSecondCommand, GetEventFilterCommand
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SetExceptionFilterSecondCommand
The SetExceptionFilterSecondCommand and SetExceptionFilterSecondCommandWide methods set the command that will be executed by the debugger engine on the
second chance of a specified exception.
HRESULT
IDebugControl::SetExceptionFilterSecondCommand(
IN ULONG Index,
IN PCSTR Command
);
HRESULT
IDebugControl3::SetExceptionFilterSecondCommandWide(
IN ULONG Index,
IN PCWSTR Command
);
#ifdef UNICODE
#define SetExceptionFilterSecondCommandT SetExceptionFilterSecondCommandWide
#else
#define SetExceptionFilterSecondCommandT SetExceptionFilterSecondCommand
#endif
Parameters
Index
Specifies the index of the exception filter whose second-chance command will be set. Index must not refer to the specific event filters as these are not exception filters
and only exception events get a second chance. If Index refers to the default exception filter, the second-chance command is set for all exceptions that do not have an
exception filter.
Command
Receives the second-chance command for the exception filter.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
SetExceptionFilterSecondCommand is available in all versions of IDebugControl. SetExceptionFilterSecondCommandWide is available in IDebugControl3 and later
versions.
Comments
For more information about event filters, see Event Filters.
Requirements
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetSpecificFilterArgument
The GetSpecificFilterArgument and GetSpecificFilterArgumentWide methods return the value of filter argument for thespecific filters that have an argument.
HRESULT
IDebugControl::GetSpecificFilterArgument(
IN ULONG Index,
OUT OPTIONAL PSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG ArgumentSize
);
HRESULT
IDebugControl3::GetSpecificFilterArgumentWide(
IN ULONG Index,
OUT OPTIONAL PWSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG ArgumentSize
);
#ifdef UNICODE
#define GetSpecificFilterArgumentT GetSpecificFilterArgumentWide
#else
#define GetSpecificFilterArgumentT GetSpecificFilterArgument
#endif
Parameters
Index
Specifies the index of the specific filter whose argument will be returned. Index must be the index of a specific filter that has an argument.
Buffer
Receives the argument for the specific filter. The interpretation of the argument depends on the specific filter.
BufferSize
Specifies the size, in characters, of the buffer that Buffer specifies.
ArgumentSize
Receives the size, in characters, of the argument for the specific filter.
Return Value
S_OK
The method was successful.
E_INVALIDARG
Index does not refer to a specific filter that has an argument.
This method may also return error values. See Return Values for more details.
Interface Version
GetSpecificFilterArgument is available in all versions of IDebugControl. GetSpecificFilterArgumentWide is available in IDebugControl3 and later versions.
Comments
For a list of specific filters that have argument and the interpretation of those arguments, see Event Filters.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
sx, sxd, sxe, sxi, sxn (Set Exceptions), SetSpecificFilterArgument, GetSpecificFilterParameters
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
SetSpecificFilterArgument
The SetSpecificFilterArgument and SetSpecificFilterArgumentWide methods set the value of filter argument for the specific filters that can have an argument.
HRESULT
IDebugControl::SetSpecificFilterArgument(
IN ULONG Index,
IN PCSTR Argument
);
HRESULT
IDebugControl3::SetSpecificFilterArgumentWide(
IN ULONG Index,
IN PCWSTR Argument
);
#ifdef UNICODE
#define SetSpecificFilterArgumentT SetSpecificFilterArgumentWide
#else
#define SetSpecificFilterArgumentT SetSpecificFilterArgument
#endif
Parameters
Index
Specifies the index of the specific filter whose argument will be set. Index must be the index of a specific filter that has an argument.
Argument
Specifies the argument for the specific filter. The interpretation of this argument depends on the specific filter.
Return Value
S_OK
The method was successful.
E_INVALIDARG
Index does not refer to a specific filter that has an argument.
This method may also return error values. See Return Values for more details.
Interface Version
SetSpecificFilterArgument is available in all versions of IDebugControl. SetSpecificFilterArgumentWide is available in IDebugControl3 and later versions.
Comments
For a list of specific filters that have argument and the interpretation of those arguments, see Event Filters.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
sx, sxd, sxe, sxi, sxn (Set Exceptions), GetSpecificFilterArgument
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetSpecificFilterParameters
The GetSpecificFilterParameters method returns the parameters for specific event filters.
HRESULT
IDebugControl::GetSpecificFilterParameters(
IN ULONG Start,
IN ULONG Count,
OUT DEBUG_SPECIFIC_FILTER_PARAMETERS * Params
);
Parameters
Start
Specifies the index of the first specific event filter whose parameters will be returned.
Count
Specifies the number of specific event filters to return parameters for.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Params
Receives the parameters for the specific event filters. Params is an array of elements of type DEBUG_SPECIFIC_FILTER_PARAMETERS.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetSpecificFilterParameters is available in all versions of IDebugControl.
Comments
For more information about event filters, see Event Filters.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
sx, sxd, sxe, sxi, sxn (Set Exceptions), SetSpecificFilterParameters, GetExceptionFilterParameters
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SetSpecificFilterParameters
The SetSpecificFilterParameters method changes the break status and handling status for some specific event filters.
HRESULT
IDebugControl::SetSpecificFilterParameters(
IN ULONG Start,
IN ULONG Count,
IN DEBUG_SPECIFIC_FILTER_PARAMETERS * Params
);
Parameters
Start
Specifies the index of the first specific event filter whose parameters will be changed.
Count
Specifies the number of specific event filters whose parameters will be changed.
Params
Specifies an array of specific event filter parameters of type DEBUG_SPECIFIC_FILTER_PARAMETERS. Only the ExecutionOption and ContinueOption members
are used. ExceptionOption specifies the new break status and ContinueOption specifies the new handling status.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
SetSpecificFilterParameters is available in all versions of IDebugControl.
Comments
For more information about event filters, see Event Filters.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
sx, sxd, sxe, sxi, sxn (Set Exceptions), GetSpecificFilterParameters, SetExceptionFilterParameters
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Input
The Input and InputWide methods request an input string from the debugger engine.
HRESULT
IDebugControl::Input(
OUT PSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG InputSize
);
HRESULT
IDebugControl4::InputWide(
OUT PWSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG InputSize
);
#ifdef UNICODE
#define InputT InputWide
#else
#define InputT Input
#endif
Parameters
Buffer
Receives the input string from the engine.
BufferSize
Specifies the size, in characters, of the buffer that Buffer specifies.
InputSize
Receives the number of characters returned in Buffer. If InputSize is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
S_FALSE
The method was successful. However, the buffer was not big enough to hold the whole input string and it was truncated.
This method may also return error values. See Return Values for more details.
Interface Version
Input is available in all versions of IDebugControl. InputWide is available in IDebugControl4 and later versions.
Additional Information
For an overview of input in the debugger engine, see Input and Output.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ReturnInput
The ReturnInput and ReturnInputWide methods are used by IDebugInputCallbacks objects to send an input string to the engine following a request for input.
HRESULT
IDebugControl::ReturnInput(
IN PCSTR Buffer
);
HRESULT
IDebugControl4::ReturnInputWide(
IN PCWSTR Buffer
);
#ifdef UNICODE
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetNearInstruction
The GetNearInstruction method returns the location of a processor instruction relative to a given location.
HRESULT
IDebugControl::GetNearInstruction(
IN ULONG64 Offset,
IN LONG Delta,
OUT PULONG64 NearOffset
);
Parameters
Offset
Specifies the location in the process's virtual address space from which to start looking for the desired instruction.
Delta
Specifies the number of instructions from Offset of the desired instruction. If Delta is negative, the returned offset is before Offset (see the Comments section for more
information).
NearOffset
Receives the location in the process's virtual address space of the instruction that is Delta instructions away from Offset.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetNearInstruction is available in all versions of IDebugControl.
Comments
On some architectures, like x86 and x64, the size of an instruction may vary. On these architectures, when Delta is negative, the desired instruction location might not be
uniquely defined. In this case, the debugger engine will search backward from Offset until it encounters a location such that there are the Delta number of instructions between
that location and Offset.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetInterrupt
The GetInterrupt method checks whether a user interrupt was issued.
HRESULT
IDebugControl::GetInterrupt(
);
Parameters
None
Return Value
S_OK
The method was successful and an interrupt has been requested.
S_FALSE
The method was successful and an interrupt was not requested.
This method may also return error values. See Return Values for more details.
Interface Version
GetInterrupt is available in all versions of IDebugControl.
Comments
If a user interrupt was issued, it is cleared when this method is called.
Examples of user interrupts include pressing Ctrl+C or pressing the Stop button in a debugger. Calling SetInterrupt also causes a user interrupt.
Note It is recommended that debugger extensions call GetInterrupt while undertaking long tasks.
This method can be called at any time and from any thread.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
SetInterrupt
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SetInterrupt
The SetInterrupt method registers a user interrupt or breaks into the debugger.
HRESULT
IDebugControl::SetInterrupt(
IN ULONG Flags
);
Parameters
Flags
Specifies the type of interrupt to register. Flags can take one of the values listed in the following table.
Value
Description
DEBUG_INTERRUPT_ACTIVE If the target is running, the engine will request a break into the debugger. This request might time out. For more information, see the
"Comments" section.
Otherwise, when the target is suspended, the engine will register a user interrupt.
DEBUG_INTERRUPT_PASSIVE The engine will register a user interrupt.
DEBUG_INTERRUPT_EXIT
If there is currently a WaitForEvent call running, the engine will force it to return. If there are any debugger commands causing
execution in the target for example, g (Go) and p (Step) the engine will force them to complete. This does not force a break
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
into the debugger, so the target might not be suspended. In which case, the WaitForEvent call will return E_PENDING.
Otherwise, when the target is suspended, register a user interrupt.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
SetInterrupt is available in all versions of IDebugControl.
Comments
This method can be called at any time and from any thread. Once the interrupt has been registered, this method returns immediately.
If Flags is DEBUG_INTERRUPT_ACTIVE, and the interrupt times out, the engine will generate a synthetic exception event. This event will be sent to event callback's
IDebugEventCallbacks::Exception method. The amount of time before the interrupt times out can be set using SetInterruptTimeout.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetInterrupt, GetInterruptTimeout, SetInterruptTimeout
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetInterruptTimeout
The GetInterruptTimeout method returns the number of seconds that the engine will wait when requesting a break into the debugger.
HRESULT
IDebugControl::GetInterruptTimeout(
OUT PULONG Seconds
);
Parameters
Seconds
Receives the number of seconds that the engine will wait for the target when requesting a break into the debugger.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetInterruptTimeout is available in all versions of IDebugControl.
Comments
The engine requests a break into the debugger when SetInterrupt is called with DEBUG_INTERRUPT_ACTIVE. If this interrupt times out, the engine will generate a
synthetic exception event. This event will be sent to event callback objects's IDebugEventCallbacks::Exception method.
Most targets do not support interrupt time-outs. Live user-mode debugging is one of the targets that does support them.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
IDebugEventCallbacks::Exception, SetInterrupt, SetInterruptTimeout
2009 Microsoft Corporation
Send feedback on this topic
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
SetInterruptTimeout
The SetInterruptTimeout method sets the number of seconds that the debugger engine should wait when requesting a break into the debugger.
HRESULT
IDebugControl::SetInterruptTimeout(
IN ULONG Seconds
);
Parameters
Seconds
Specifies the number of seconds that the engine should wait for the target when requesting a break into the debugger.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
SetInterruptTimeout is available in all versions of IDebugControl.
Comments
The engine requests a break into the debugger when SetInterrupt is called with the DEBUG_INTERRUPT_ACTIVE flag.
If an interrupt times out, the engine will generate a synthetic exception event. This event will be sent to event callback objects's IDebugEventCallbacks::Exception method.
Most targets do not support interrupt time-outs. Live user-mode debugging is one of the targets that does support them.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetInterruptTimeout, IDebugEventCallbacks::Exception, SetInterrupt
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
CloseLogFile
The CloseLogFile method closes the currently-open log file.
HRESULT
IDebugControl::CloseLogFile(
);
Parameters
None
Return Value
S_OK
The method was successful.
This method can also return error values. See Return Values for more details.
Interface Version
CloseLogFile is available in all versions of IDebugControl.
Comments
If no log file is open, this method has no effect.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
For more about log files, see Using Input and Output.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
OpenLogFile2, GetLogFile2, OpenLogFile, GetLogFile, .logclose
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetLogFile
The GetLogFile and GetLogFileWide methods return the name of the currently open log file.
HRESULT
IDebugControl::GetLogFile(
OUT OPTIONAL PSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG FileSize,
OUT PBOOL Append
);
HRESULT
IDebugControl4::GetLogFileWide(
OUT OPTIONAL PWSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG FileSize,
OUT PBOOL Append
);
#ifdef UNICODE
#define GetLogFileT GetLogFileWide
#else
#define GetLogFileT GetLogFile
#endif
Parameters
Buffer
Receives the name of the currently open log file. If Buffer is NULL, this information is not returned.
BufferSize
Specifies the size, in characters, of the Buffer buffer.
FileSize
Receives the size, in characters, of the name of the log file. If FileSize is NULL, this information is not returned.
Append
Receives TRUE if log messages are appended to the log file, or FALSE if the contents of the log file were discarded when the file was opened.
Return Value
S_OK
The method was successful.
S_FALSE
The method was successful. However, the name of the log file was too long to fit in the Buffer buffer so the name was truncated.
E_NOINTERFACE
There is no currently open log file.
This method can also return error values. See Return Values for more details.
Interface Version
GetLogFile is available in all versions of IDebugControl. GetLogFileWide is available in IDebugControl4 and later versions.
Comments
GetLogFile and GetLogFileWide behave the same way as GetLogFile2 and GetLogFile2Wide with Append receiving only the information about the
DEBUG_LOG_APPEND flag.
For more information about log files, see Using Input and Output.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetLogFile2
The GetLogFile2 and GetLogFile2Wide methods return the name of the currently open log file.
HRESULT
IDebugControl4::GetLogFile2(
OUT OPTIONAL PSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG FileSize,
OUT PULONG Flags
);
HRESULT
IDebugControl4::GetLogFile2Wide(
OUT OPTIONAL PWSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG FileSize,
OUT PULONG Flags
);
#ifdef UNICODE
#define GetLogFile2T GetLogFile2Wide
#else
#define GetLogFile2T GetLogFile2
#endif
Parameters
Buffer
Receives the name of the currently open log file. If Buffer is NULL, this information is not returned.
BufferSize
Specifies the size, in characters, of the Buffer buffer.
FileSize
Receives the size, in characters, of the name of the log file. If FileSize is NULL, this information is not returned.
Flags
Receives the bit-flags that were used when opening the log file. See the Flags parameter of OpenLogFile2 for a description of these flags.
Return Value
S_OK
The method was successful.
S_FALSE
The method was successful. However, the name of the log file was too long to fit in the Buffer buffer so the name was truncated.
E_NOINTERFACE
There is no currently open log file.
This method can also return error values. See Return Values for more details.
Interface Version
GetLogFile2 and GetLogFile2Wide are available in IDebugControl4 and later versions.
Comments
For more information about log files, see Using Input and Output.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
OpenLogFile2, GetLogFile, CloseLogFile, GetLogMask, .logfile
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
OpenLogFile
The OpenLogFile and OpenLogFileWide methods open a log file that will receive output from the client objects.
HRESULT
IDebugControl::OpenLogFile(
IN PCSTR File,
IN BOOL Append
);
HRESULT
IDebugControl4::OpenLogFileWide(
IN PCWSTR File,
IN BOOL Append
);
#ifdef UNICODE
#define OpenLogFileT OpenLogFileWide
#else
#define OpenLogFileT OpenLogFile
#endif
Parameters
File
Specifies the name of the log file. File can include a relative or absolute path; relative paths are relative to the directory in which the debugger was started. If the file does
not exist, it will be created.
Append
Specifies whether or not to append log messages to an existing log file. If TRUE, log messages will be appended to the file; if FALSE, the contents of any existing file
matching File are discarded.
Return Value
S_OK
The method was successful.
This method can also return error values. See Return Values for more details.
Interface Version
OpenLogFile is available in all versions of IDebugControl. OpenLogFileWide is available in IDebugControl4 and later versions.
Comments
OpenLogFile and OpenLogFileWide behave the same way as OpenLogFile2 and OpenLogFile2Wide with Flags set to DEBUG_LOG_APPEND if Append is TRUE and
DEBUG_LOG_DEFAULT otherwise.
Only one log file can be open at a time. If there is already a log file open, it will be closed.
For more information about log files, see Using Input and Output.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
OpenLogFile2, GetLogFile, CloseLogFile, GetLogMask, SetLogMask, .logopen (Open Log File), .logappend (Append Log File)
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
OpenLogFile2
The OpenLogFile2 and OpenLogFile2Wide methods open a log file that will receive output from the client objects.
HRESULT
IDebugControl4::OpenLogFile2(
IN PCSTR File,
IN ULONG Flags
);
HRESULT
IDebugControl4::OpenLogFile2Wide(
IN PCWSTR File,
IN ULONG Flags
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
);
#ifdef UNICODE
#define OpenLogFile2T OpenLogFile2Wide
#else
#define OpenLogFile2T OpenLogFile2
#endif
Parameters
File
Specifies the name of the log file. File can include a relative or absolute path; relative paths are relative to the directory in which the debugger was started. If the file does
not exist, it will be created.
Flags
Specifies the bit-flags that control the nature of the log file. Flags can contain flags from the following table.
Flag
Effect when set
DEBUG_LOG_APPEND Output will be appended to the log file instead of discarding the contents of the log file.
DEBUG_LOG_UNICODE The format of the log file will be Unicode instead of ASCII.
Alternatively, Flags can be set to DEBUG_LOG_DEFAULT for the default set of options that contains none of the flags.
Return Value
S_OK
The method was successful.
This method can also return error values. See Return Values for more details.
Interface Version
OpenLogFile2 and OpenLogFile2Wide are available in IDebugControl4 and later versions.
Comments
Only one log file can be open at a time. If there is already a log file open, it will be closed.
For more information about log files, see Using Input and Output.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
OpenLogFile, GetLogFile2, CloseLogFile, GetLogMask, SetLogMask, .logopen (Open Log File), .logappend (Append Log File)
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetLogMask
The GetLogMask method returns the output mask for the currently open log file.
HRESULT
IDebugControl::GetLogMask(
OUT PULONG Mask
);
Parameters
Mask
Receives the output mask for the log file. See DEBUG_OUTPUT_XXX for details about how to interpret this value.
Return Value
S_OK
The method was successful.
This method can also return error values. See Return Values for more details.
Interface Version
GetLogMask is available in all versions of IDebugControl.
Comments
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
For more information about log files, see Using Input and Output.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
SetLogMask, GetOutputMask, OpenLogFile2
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SetLogMask
The SetLogMask method sets the output mask for the currently open log file.
HRESULT
IDebugControl::SetLogMask(
IN ULONG Mask
);
Parameters
Mask
Specifies the new output mask for the log file. See DEBUG_OUTPUT_XXX for details about this value.
Return Value
S_OK
The method was successful.
This method can also return error values. See Return Values for more details.
Interface Version
SetLogMask is available in all versions of IDebugControl.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetLogMask, SetOutputMask, OpenLogFile2
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetReturnOffset
The GetReturnOffset method returns the return address for the current function.
HRESULT
GetReturnOffset(
OUT PULONG64 Offset
);
Parameters
Offset
Receives the return address.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Output
The Output and OutputWide methods format a string and send the result to output callbacks that have been registered with the engine's clients.
HRESULT
IDebugControl::Output(
IN ULONG Mask,
IN PCSTR Format,
...
);
HRESULT
IDebugControl4::OutputWide(
IN ULONG Mask,
IN PCWSTR Format,
...
);
#ifdef UNICODE
#define OutputT OutputWide
#else
#define OutputT Output
#endif
Parameters
Mask
Specifies the output-type bit field. See DEBUG_OUTPUT_XXX for possible values.
Format
Specifies the format string, as in printf. In general, conversion characters work exactly as in C. For the floating-point conversion characters the 64-bit argument is
interpreted as a 32-bit floating-point number unless the l modifier is used.
The %p conversion character is supported, but it represents a pointer in a target's address space. It can not have any modifiers and it uses the debugger's internal address
formatting. The following additional conversion characters are supported.
Character
Argument type
%p
ULONG64
%N
DWORD_PTR (32 or 64 bits,
depending on the host's architecture)
%I
ULONG64
Argument
Pointer in an address space
Pointer in the host's virtual address space
%ma
ULONG64
%mu
ULONG64
%msa
ULONG64
%msu
ULONG64
%y
ULONG64
%ly
ULONG64
Text printed
The value of the pointer.
The value of the pointer. (This is equivalent to the standard C %p
character.)
The specified value. If this is greater than 0xFFFFFFFF, it is
printed as a 64-bit value. Otherwise, it is printed as a 32-bit value.
The specified string.
The specified string.
The specified string.
The specified string.
String that contains the name of the specified symbol (and
displacement, if any).
String that contains the name of the specified symbol (and
displacement, if any), as well as any available source line
information.
...
Specifies additional parameters that contain values to be inserted into the output during formatting.
Return Value
S_OK
The method was successful.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
This method may also return error values. See Return Values for more details.
Interface Version
Output is available in all versions of IDebugControl. OutputWide is available in IDebugControl4 and later versions.
Comments
When generating very large output strings, it is possible to reach the limits of the debugger engine or of the operating system. For example, some versions of the debugger
engine have a 16K character limit for a single output. If you find that very large output is getting truncated, you might need to split your output into multiple requests.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
dprintf, ControlledOutput, OutputVaList, .printf
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ControlledOutput
The ControlledOutput and ControlledOutputWide methods format a string and send the result to output callbacks that were registered with some of the engine's clients.
HRESULT
IDebugControl::ControlledOutput(
IN ULONG OutputControl,
IN ULONG Mask,
IN PCSTR Format,
...
);
HRESULT
IDebugControl4::ControlledOutputWide(
IN ULONG OutputControl,
IN ULONG Mask,
IN PCWSTR Format,
...
);
#ifdef UNICODE
#define ControlledOutputT ControlledOutputWide
#else
#define ControlledOutputT ControlledOutput
#endif
Parameters
OutputControl
Specifies an output control that determines which of the clients' output callbacks will receive the output. For possible values, see DEBUG_OUTCTL_XXX. For more
information about output, see Input and Output.
Mask
Specifies the output-type bit field. See DEBUG_OUTPUT_XXX for possible values.
Format
Specifies the format string, as in printf. Typically, conversion characters work exactly as they do in C. For the floating-point conversion characters, the 64-bit argument
is interpreted as a 32-bit floating-point number unless the l modifier is used.
The %p conversion character is supported, but it represents a pointer in a target's address space. It might not have any modifiers and it uses the debugger's internal
address formatting. The following additional conversion characters are supported.
Character
Argument type
%p
ULONG64
%N
DWORD_PTR (32 or 64 bits,
depending on the host's architecture)
%I
ULONG64
Argument
Pointer in an address space.
Pointer in the host's virtual address space.
%ma
ULONG64
%mu
ULONG64
%msa
ULONG64
%msu
ULONG64
Text printed
The value of the pointer.
The value of the pointer. (This is equivalent to the standard C %p
character.)
The specified value. If this is greater than 0xFFFFFFFF, it is
printed as a 64-bit value; otherwise, it is printed as a 32-bit value.
The specified string.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
%y
ULONG64
%ly
ULONG64
...
Specifies additional parameters that represent values to be inserted into the output during formatting.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
ControlledOutput is available in all versions of IDebugControl. ControlledOutputWide is available in IDebugControl4 and later versions.
Comments
When generating very large output strings, it is possible to reach the limits of the debugger engine or of the operating system. For example, some versions of the debugger
engine have a 16K character limit for a single output. If you find that very large output is getting truncated, you might need to split your output into multiple requests.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
ControlledOutputVaList, dprintf, Output, .printf
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
OutputVaList
The OutputVaList and OutputVaListWide methods format a string and send the result to the output callbacks that are registered with the engine's clients.
HRESULT
IDebugControl::OutputVaList(
IN ULONG Mask,
IN PCSTR Format,
IN va_list Args
);
HRESULT
IDebugControl4::OutputVaListWide(
IN ULONG Mask,
IN PCWSTR Format,
IN va_list Args
);
#ifdef UNICODE
#define OutputVaListT OutputVaListWide
#else
#define OutputVaListT OutputVaList
#endif
Parameters
Mask
Specifies the output-type bit field. See DEBUG_OUTPUT_XXX for possible values.
Format
Specifies the format string, as in printf. Typically, conversion characters work exactly as they do in C. For the floating-point conversion characters, the 64-bit argument
is interpreted as a 32-bit floating-point number unless the l modifier is used.
The %p conversion character is supported, but it represents a pointer in a target's address space. It might not have any modifiers, and it uses the debugger's internal
address formatting. The following additional conversion characters are supported.
Character
Argument type
%p
ULONG64
%N
DWORD_PTR (32 or 64 bits,
depending on the host's architecture)
%I
ULONG64
Argument
Pointer in an address space.
Pointer in the host's virtual address space.
Any 64-bit value.
Text printed
The value of the pointer.
The value of the pointer. (This is equivalent to the standard C %p
character.)
The specified value. If this is greater than 0xFFFFFFFF, it is
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
%ma
ULONG64
%mu
ULONG64
%msa
ULONG64
%msu
ULONG64
%y
ULONG64
%ly
ULONG64
Args
Specifies additional parameters that represent values to be inserted into the output during formatting. Args must be initialized using va_start. This method does not call
va_end.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
OutputVaList is available in all versions of IDebugControl. OutputVaListWide is available in IDebugControl4 and later versions.
Comments
When generating very large output strings, it is possible to reach the limits of the debugger engine or of the operating system. For example, some versions of the debugger
engine have a 16K character limit for a single output. If you find that very large output is getting truncated, you might need to split your output into multiple requests.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h. The macros va_list, va_start, and va_end are defined in Stdarg.h.
See Also
ControlledOutputVaList, dprintf, Output
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ControlledOutputVaList
The ControlledOutputVaList and ControlledOutputVaListWide methods format a string and send the result to output callbacks that were registered with some of the
engine's clients.
HRESULT
IDebugControl::ControlledOutputVaList(
IN ULONG OutputControl,
IN ULONG Mask,
IN PCSTR Format,
IN va_list Args
);
HRESULT
IDebugControl4::ControlledOutputVaList(
IN ULONG OutputControl,
IN ULONG Mask,
IN PCWSTR Format,
IN va_list Args
);
#ifdef UNICODE
#define ControlledOutputVaListT ControlledOutputVaListWide
#else
#define ControlledOutputVaListT ControlledOutputVaList
#endif
Parameters
OutputControl
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Specifies an output control that determines which client's output callbacks will receive the output. For possible values, see DEBUG_OUTCTL_XXX. For more
information about output, see Input and Output.
Mask
Specifies the output-type bit field. See DEBUG_OUTPUT_XXX for possible values.
Format
Specifies the format string, as in printf. Typically, conversion characters work exactly as they do in C. For the floating-point conversion characters, the 64-bit argument
is interpreted as a 32-bit floating-point number unless the l modifier is used.
The %p conversion character is supported, but it represents a pointer in a target's address space. It might not have any modifiers, and it uses the debugger's internal
address formatting. The following additional conversion characters are supported.
Character
Argument type
%p
ULONG64
%N
DWORD_PTR (32 or 64 bits,
depending on the host's architecture)
%I
ULONG64
Argument
Pointer in an address space.
Pointer in the host's virtual address space.
%ma
ULONG64
%mu
ULONG64
%msa
ULONG64
%msu
ULONG64
%y
ULONG64
%ly
ULONG64
Text printed
The value of the pointer.
The value of the pointer. (This is equivalent to the standard C %p
character.)
The specified value. If this is greater than 0xFFFFFFFF, it is
printed as a 64-bit value; otherwise, it is printed as a 32-bit value.
The specified string.
Args
Specifies additional parameters that represent values to be inserted into the output during formatting. Args must be initialized using va_start. This method does not call
va_end.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
ControlledOutputVaList is available in all versions of IDebugControl. ControlledOutputVaListWide is available in IDebugControl4 and later versions.
Comments
When generating very large output strings, it is possible to reach the limits of the debugger engine or of the operating system. For example, some versions of the debugger
engine have a 16K character limit for a single output. If you find that very large output is getting truncated, you might need to split your output into multiple requests.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h. The macros va_list, va_start, and va_end are defined in Stdarg.h.
See Also
ControlledOutput, dprintf, OutputVaList
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetPageSize
The GetPageSize method returns the page size for the effective processor mode.
HRESULT
IDebugControl::GetPageSize(
OUT PULONG Size
);
Parameters
Size
Receives the page size.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetPageSize is available in all versions of IDebugControl.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
IsPointer64Bit
The IsPointer64Bit method determines if the effective processor uses 64-bit pointers.
HRESULT
IDebugControl::IsPointer64Bit(
void
);
Parameters
None
Return Value
S_OK
The effective processor uses 64-bit pointers.
S_FALSE
The effective processor does not use 64-bit pointers.
This method may also return error values. See Return Values for more details.
Interface Version
IsPointer64Bit is available in all versions of IDebugControl.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetActualProcessorType
The GetActualProcessorType method returns the processor type of the physical processor of the computer that is running the target.
HRESULT
IDebugControl::GetActualProcessorType(
OUT PULONG Type
);
Parameters
Type
Receives the type of the processor. The processor types are listed in the following table.
Value
Processor
IMAGE_FILE_MACHINE_I386 x86 architecture
IMAGE_FILE_MACHINE_ARM ARM architecture
IMAGE_FILE_MACHINE_IA64 Intel Itanium architecture
IMAGE_FILE_MACHNE_AMD64 x64 architecture
IMAGE_FILE_MACHINE_EBC EFI byte code architecture
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Interface Version
GetActualProcessorType is available in all versions of IDebugControl.
Comments
For more information, see Target Information.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetEffectiveProcessorType, GetExecutingProcessorType
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetEffectiveProcessorType
The GetEffectiveProcessorType method returns the effective processor type of the processor of the computer that is running the target.
HRESULT
IDebugControl::GetEffectiveProcessorType(
OUT PULONG Type
);
Parameters
Type
Receives the type of the processor. For possible values, see the Type parameter in GetActualProcessorType.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetEffectiveProcessorType is available in all versions of IDebugControl.
Comments
For more information, see Target Information.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
SetEffectiveProcessorType, GetActualProcessorType, GetExecutingProcessorType
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SetEffectiveProcessorType
The SetEffectiveProcessorType method sets the effective processor type of the processor of the computer that is running the target.
HRESULT
IDebugControl::SetEffectiveProcessorType(
IN ULONG Type
);
Parameters
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Type
Specifies the type of the processor. For possible values, see the Type parameter in GetActualProcessorType.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
SetEffectiveProcessorType is available in all versions of IDebugControl.
Comments
For more information, see Target Information.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetEffectiveProcessorType
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetExecutingProcessorType
The GetExecutingProcessorType method returns the executing processor type for the processor for which the last event occurred.
HRESULT
IDebugControl::GetExecutingProcessorType(
OUT PULONG Type
);
Parameters
Type
Receives the processor type. See GetActualProcessorType for a list of possible values this parameter can receive.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetExecutingProcessorType is available in all versions of IDebugControl.
Comments
For more information, see Target Information.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetActualProcessorType
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetNumberProcessors
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The GetNumberProcessors method returns the number of processors on the computer running the current target.
HRESULT
IDebugControl::GetNumberProcessors(
OUT PULONG Number
);
Parameters
Number
Receives the number of processors.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetNumberProcessors is available in all versions of IDebugControl.
Comments
For more information, see Target Information.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetPossibleExecutingProcessorTypes
The GetPossibleExecutingProcessorTypes method returns the processor types that are supported by the computer running the current target.
HRESULT
IDebugControl::GetPossibleExecutingProcessorTypes(
IN ULONG Start,
IN ULONG Count,
OUT PULONG Types
);
Parameters
Start
Specifies the index of the first processor type to return. The processor types are indexed by numbers zero through to the number of processor types supported by the
current target minus one. The number of processor types supported by the current target can be found using GetNumberPossibleExecutingProcessorTypes.
Count
Specifies how many processor types to return.
Types
Receives the list of processor types. The number of elements this array holds is Count. For a description of the processor types see GetActualProcessorType.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetPossibleExecutingProcessorTypes is available in all versions of IDebugControl.
Comments
For more information, see Target Information.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetNumberPossibleExecutingProcessorTypes, GetActualProcessorType
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetNumberPossibleExecutingProcessorTypes
The GetNumberPossibleExecutingProcessorTypes method returns the number of processor types that are supported by the computer running the current target.
HRESULT
IDebugControl::GetNumberPossibleExecutingProcessorTypes(
OUT PULONG Number
);
Parameters
Number
Receives the number of processor types.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetNumberPossibleExecutingProcessorTypes is available in all versions of IDebugControl.
Comments
For more information, see Target Information.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetPossibleExecutingProcessorTypes
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetSupportedProcessorTypes
The GetSupportedProcessorTypes method returns the processor types supported by the debugger engine.
HRESULT
IDebugControl::GetSupportedProcessorTypes(
IN ULONG Start,
IN ULONG Count,
OUT PULONG Types
);
Parameters
Start
Specifies the index of the first processor type to return. The supported processor types are indexed by the numbers zero through the number of supported processor types
minus one. The number of supported processor types can be found using GetNumberSupportedProcessorTypes.
Count
Specifies the number of processor types to return.
Types
Receives the list of processor types. The number of elements this array holds is Count. For a description of the processor types, see GetActualProcessorType.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Interface Version
GetSupportedProcessorTypes is available in all versions of IDebugControl.
Comments
For more information, see Target Information.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetNumberSupportedProcessorTypes, GetProcessorTypeNames
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetNumberSupportedProcessorTypes
The GetNumberSupportedProcessorTypes method returns the number of processor types supported by the engine.
HRESULT
IDebugControl::GetNumberSupportedProcessorTypes(
OUT PULONG Number
);
Parameters
Number
Receives the number of processor types.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetNumberSupportedProcessorTypes is available in all versions of IDebugControl.
Comments
For more information, see Target Information.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetSupportedProcessorTypes
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetProcessorTypeNames
The GetProcessorTypeNames and GetProcessorTypeNamesWide methods return the full name and abbreviated name of the specified processor type.
HRESULT
IDebugControl::GetProcessorTypeNames(
IN ULONG Type,
OUT OPTIONAL PSTR FullNameBuffer,
IN ULONG FullNameBufferSize,
OUT OPTIONAL PULONG FullNameSize,
OUT OPTIONAL PSTR AbbrevNameBuffer,
IN ULONG AbbrevNameBufferSize,
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
AbbrevNameSize
HRESULT
IDebugControl4::GetProcessorTypeNamesWide(
IN ULONG Type,
OUT OPTIONAL PWSTR FullNameBuffer,
IN ULONG FullNameBufferSize,
OUT OPTIONAL PULONG FullNameSize,
OUT OPTIONAL PWSTR AbbrevNameBuffer,
IN ULONG AbbrevNameBufferSize,
OUT OPTIONAL PULONG AbbrevNameSize
);
#ifdef UNICODE
#define GetProcessorTypeNamesT GetProcessorTypeNamesWide
#else
#define GetProcessorTypeNamesT GetProcessorTypeNames
#endif
Parameters
Type
Specifies the type of the processor whose name is requested. See GetActualProcessorType for a list of possible values.
FullNameBuffer
Receives the full name of the processor type. If FullNameBuffer is NULL, this information is not returned.
FullNameBufferSize
Specifies the size, in characters, of the buffer that FullNameBuffer specifies.
FullNameSize
Receives the size in characters of the full name of the processor type. If FullNameSize is NULL, this information is not returned.
AbbrevNameBuffer
Receives the abbreviated name of the processor type. If AbbrevNameBuffer is NULL, this information is not returned.
AbbrevNameBufferSize
Specifies the size, in characters, of the buffer that AbbrevNameBuffer specifies.
AbbrevNameSize
Receives the size in characters of the abbreviated name of the processor type. If AbbrevNameSize is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
S_FALSE
The method was successful. However, at least one of FullNameBuffer or AbbrevNameBuffer was too small for the corresponding name, so the name was truncated.
This method may also return error values. See Return Values for more details.
Interface Version
GetProcessorTypeNames is available in all versions of IDebugControl. GetProcessorTypeNamesWide is available in IDebugControl4 and later versions.
Comments
For more information, see Target Information.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetSupportedProcessorTypes
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
OutputPrompt
The OutputPrompt and OutputPromptWide methods format and send a user prompt to the output callback objects.
HRESULT
IDebugControl::OutputPrompt(
IN ULONG OutputControl,
IN OPTIONAL PCSTR Format,
...
);
HRESULT
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
IDebugControl4::OutputPromptWide(
IN ULONG OutputControl,
IN OPTIONAL PCWSTR Format,
...
);
#ifdef UNICODE
#define OutputPromptT OutputPromptWide
#else
#define OutputPromptT OutputPrompt
#endif
Parameters
OutputControl
Specifies an output control that determines which of the client's output callbacks will receive the output. For possible values, see DEBUG_OUTCTL_XXX.
Format
Specifies the format string, as in printf. Typically, conversion characters work exactly as they do in C. For the floating-point conversion characters, the 64-bit argument
is interpreted as a 32-bit floating-point number unless the l modifier is used.
The %p conversion character is supported, but it represents a pointer in a target's address space. It might not have any modifiers and it uses the debugger's internal
address formatting. The following additional conversion characters are supported.
Character
Argument type
%p
ULONG64
%N
DWORD_PTR (32 or 64 bits,
depending on the host's architecture)
%I
ULONG64
Argument
Pointer in an address space.
Pointer in the host's virtual address space.
%ma
ULONG64
%mu
ULONG64
%msa
ULONG64
%msu
ULONG64
%y
ULONG64
%ly
ULONG64
Text printed
The value of the pointer.
The value of the pointer. (This is equivalent to the standard C %p
character.)
The specified value. If this is greater than 0xFFFFFFFF, it is
printed as a 64-bit value; otherwise, it is printed as a 32-bit value.
The specified string.
If Format is NULL, only the standard prompt text is sent to the output callbacks.
...
Specifies additional parameters that represent values to be inserted into the output during formatting.
Return Value
S_OK
The method was successful.
This method can also return error values. See Return Values for more details.
Interface Version
OutputPrompt is available in all versions of IDebugControl. OutputPromptWide is available in IDebugControl4 and later versions.
Comments
OutputPrompt and OutputPromptWide can be used to prompt the user for input.
The standard prompt will be sent to the output callbacks before the formatted text described by Format. The contents of the standard prompt is returned by the method
GetPromptText.
The prompt text is sent to the output callbacks with the DEBUG_OUTPUT_PROMPT output mask set.
For more information about prompting the user, see Using Input and Output.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
OutputPromptVaList, GetPromptText, ControlledOutput, DEBUG_OUTPUT_XXX
2009 Microsoft Corporation
Send feedback on this topic
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
OutputPromptVaList
The OutputPromptVaList and OutputPromptVaListWide methods format and send a user prompt to the output callback objects.
HRESULT
IDebugControl::OutputPromptVaList(
IN ULONG OutputControl,
IN OPTIONAL PCSTR Format,
IN va_list Args
);
HRESULT
IDebugControl4::OutputPromptVaListWide(
IN ULONG OutputControl,
IN OPTIONAL PCWSTR Format,
IN va_list Args
);
#ifdef UNICODE
#define OutputPromptVaListT OutputPromptVaListWide
#else
#define OutputPromptVaListT OutputPromptVaList
#endif
Parameters
OutputControl
Specifies an output control that determines which of the client's output callbacks will receive the output. For possible values, see DEBUG_OUTCTL_XXX.
Format
Specifies the format string, as in printf. Typically, conversion characters work exactly as they do in C. For the floating-point conversion characters, the 64-bit argument
is interpreted as a 32-bit floating-point number unless the l modifier is used.
The %p conversion character is supported, but it represents a pointer in a target's address space. It might not have any modifiers and it uses the debugger's internal
address formatting. The following additional conversion characters are supported.
Character
Argument type
%p
ULONG64
%N
DWORD_PTR (32 or 64 bits,
depending on the host's architecture)
%I
ULONG64
Argument
Pointer in an address space.
Pointer in the host's virtual address space.
%ma
ULONG64
%mu
ULONG64
%msa
ULONG64
%msu
ULONG64
%y
ULONG64
%ly
ULONG64
Text printed
The value of the pointer.
The value of the pointer. (This is equivalent to the standard C %p
character.)
The specified value. If this is greater than 0xFFFFFFFF, it is
printed as a 64-bit value; otherwise, it is printed as a 32-bit value.
The specified string.
If Format is NULL, only the standard prompt text is sent to the output callbacks.
Args
Specifies additional parameters that represent values to be inserted into the output during formatting. Args must be initialized using va_start. This method does not call
va_end.
Return Value
S_OK
The method was successful.
This method can also return error values. See Return Values for more details.
Interface Version
OutputPromptVaList is available in all versions of IDebugControl. OutputPromptVaListWide is available in IDebugControl4 and later versions.
Comments
OutputPromptVaList and OutputPromptVaListWide can be used to prompt the user for input.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The standard prompt will be sent to the output callbacks before the formatted text described by Format. The contents of the standard prompt is returned by the method
GetPromptText.
The prompt text is sent to the output callbacks with the DEBUG_OUTPUT_PROMPT output mask set.
For more information about prompting the user, see Using Input and Output.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h. The macros va_list, va_start, and va_end are defined in Stdarg.h.
See Also
OutputPrompt, GetPromptText, ControlledOutputVaList, DEBUG_OUTPUT_XXX
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetPromptText
The GetPromptText and GetPromptTextWide methods return the standard prompt text that will be prepended to the formatted output specified in the OutputPrompt and
OutputPromptVaList methods.
HRESULT
IDebugControl::GetPromptText(
OUT OPTIONAL PSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG TextSize
);
HRESULT
IDebugControl4::GetPromptTextWide(
OUT OPTIONAL PWSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG TextSize
);
#ifdef UNICODE
#define GetPromptTextT GetPromptTextWide
#else
#define GetPromptTextT GetPromptText
#endif
Parameters
Buffer
Receives the prompt text. If Buffer is NULL, this information is not returned.
BufferSize
Specifies the size, in characters, of the Buffer buffer.
TextSize
Receives the size, in characters, of the prompt text. If TextSize is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
S_FALSE
The method was successful. However, the prompt text was too large to fit into the Buffer buffer and the text was truncated.
This method can also return error values. See Return Values for more details.
Interface Version
GetPromptText is available in all versions of IDebugControl. GetPromptTextWide is available in IDebugControl4 and later versions.
Comments
For more information about prompting the user, see Using Input and Output.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
OutputPrompt, OutputPromptVaList
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetRadix
The GetRadix method returns the default radix (number base) used by the debugger engine when it evaluates and displays MASM expressions, and when it displays symbol
information.
HRESULT
IDebugControl::GetRadix(
OUT PULONG Radix
);
Parameters
Radix
Receives the default radix.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetRadix is available in all versions of IDebugControl.
Comments
For more information about the default radix, see Using Input and Output.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
SetRadix, n (Set Number Base)
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SetRadix
The SetRadix method sets the default radix (number base) used by the debugger engine when it evaluates and displays MASM expressions, and when it displays symbol
information.
HRESULT
IDebugControl::SetRadix(
IN ULONG Radix
);
Parameters
Radix
Specifies the new default radix. The following table contains the possible values for the radix.
Value Description
8
Octal
10
Decimal
16
Hexadecimal
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Interface Version
SetRadix is available in all versions of IDebugControl.
Comments
When the radix is changed, the engine notifies the event callbacks by passing the DEBUG_CES_RADIX flag to the IDebugEventCallbacks::ChangeEngineState callback
method.
For more information about the default radix, see Using Input and Output.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetRadix, n (Set Number Base)
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetStackTrace
The GetStackTrace method returns the frames at the top of the specified call stack.
HRESULT
IDebugControl::GetStackTrace(
IN ULONG64 FrameOffset,
IN ULONG64 StackOffset,
IN ULONG64 InstructionOffset,
OUT PDEBUG_STACK_FRAME Frames,
IN ULONG FramesSize,
OUT OPTIONAL PULONG FramesFilled
);
Parameters
FrameOffset
Specifies the location of the stack frame at the top of the stack. If FrameOffset is set to zero, the current frame pointer is used instead.
StackOffset
Specifies the location of the current stack. If StackOffset is set to zero, the current stack pointer is used instead.
InstructionOffset
Specifies the location of the instruction of interest for the function that is represented by the stack frame at the top of the stack. If InstructionOffset is set to zero, the
current instruction is used instead.
Frames
Receives the stack frames. The number of elements this array holds is FrameSize.
FrameSize
Specifies the number of items in the Frames array.
FramesFilled
Receives the number of frames that were placed in the array Frames. If FramesFilled is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
E_FAIL
No stack frames were returned.
This method may also return other error values. See Return Values for more details.
Interface Version
GetStackTrace is available in all versions of IDebugControl.
Comments
The stack trace returned to Frames can be printed using OutputStackTrace.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetContextStackTrace, GetFrameOffset2, GetInstructionOffset2, GetStackOffset2, OutputStackTrace, k, kb, kc, kd, kp, kP, kv (Display Stack Backtrace),
StackTrace
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
OutputStackTrace
The OutputStackTrace method outputs either the supplied stack frame or the current stack frames.
HRESULT
IDebugControl::OutputStackTrace(
IN ULONG OutputControl,
IN OPTIONAL DEBUG_STACK_FRAME *
IN ULONG FramesSize,
IN ULONG Flags
);
Frames,
Parameters
OutputControl
Specifies where to send the output. For possible values, see DEBUG_OUTCTL_XXX.
Frames
Specifies the array of stack frames to output. The number of elements in this array is FramesSize. If Frames is NULL, the current stack frames are used.
FramesSize
Specifies the number of frames to output.
Flags
Specifies bit flags that determine what information to output for each frame. Flags can be any combination of values from the following table.
Flag
Description
DEBUG_STACK_ARGUMENTS
Displays the first three pieces of stack memory at the frame of each call. On platforms where parameters are
passed on the stack, and the code for the frame uses stack arguments, these values will be the arguments to the
function.
DEBUG_STACK_FUNCTION_INFO
Displays information about the function that corresponds to the frame. This includes calling convention and
frame pointer omission (FPO) information.
DEBUG_STACK_SOURCE_LINE
Displays source line information for each frame of the stack trace.
DEBUG_STACK_FRAME_ADDRESSES
Displays the return address, previous frame address, and other relevant addresses for each frame.
DEBUG_STACK_COLUMN_NAMES
Displays column names.
DEBUG_STACK_NONVOLATILE_REGISTERS
Displays the non-volatile register context for each frame. This is only meaningful for some platforms.
DEBUG_STACK_FRAME_NUMBERS
Displays frame numbers.
DEBUG_STACK_PARAMETERS
Displays parameter names and values as given in symbol information.
DEBUG_STACK_FRAME_ADDRESSES_RA_ONLY Displays just the return address in stack frame addresses.
DEBUG_STACK_FRAME_MEMORY_USAGE
Displays the number of bytes that separate the frames.
DEBUG_STACK_PARAMETERS_NEWLINE
Displays each parameter and its type and value on a new line.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
OutputStackTrace is available in all versions of IDebugControl.
Comments
The array of stack frames can be obtained using GetStackTrace.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetContextStackTrace, GetStackTrace, k, kb, kc, kd, kp, kP, kv (Display Stack Backtrace)
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetContextStackTrace
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The GetContextStackTrace method returns the frames at the top of the call stack, starting with an arbitrary register context and returning the reconstructed register context
for each stack frame.
HRESULT
IDebugControl4::GetContextStackTrace(
IN OPTIONAL PVOID StartContext,
IN ULONG StartContextSize,
OUT OPTIONAL PDEBUG_STACK_FRAME Frames,
IN ULONG FramesSize,
OUT OPTIONAL PVOID FrameContexts,
IN ULONG FrameContextsSize,
IN ULONG FrameContextsEntrySize,
OUT OPTIONAL PULONG FramesFilled
);
Parameters
StartContext
Specifies the register context for the top of the stack.
StartContextSize
Specifies the size, in bytes, of the StartContext register context.
Frames
Receives the stack frames. The number of elements this array holds is FrameSize. If Frames is NULL, this information is not returned.
FramesSize
Specifies the number of items in the array Frames.
FrameContexts
Receives the reconstructed register context for each frame in the stack. The entries in this array correspond to the entries in the Frames array. The type of the thread
context is the CONTEXT structure for the target's effective processor. If FrameContexts is NULL, this information is not returned.
FrameContextsSize
Specifies the size, in bytes, of the memory pointed to by FrameContexts. The number of stack frames returned equals the number of contexts returned, and
FrameContextsSize must equal FramesSize times FrameContextsEntrySize.
FrameContextsEntrySize
Specifies the size, in bytes, of each frame context in FrameContexts.
FramesFilled
Receives the number of frames that were placed in the array Frames and contexts in FrameContexts. If FramesFilled is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetContextStackTrace is available in IDebugControl4 and later versions.
Comments
The stack trace returned to Frames and FrameContexts can be printed using OutputContextStackTrace.
It is common for stack unwinds to restore only a subset of the registers. For example, stack unwinds will not always restore the volatile register state because the volatile
registers are scratch registers and code does not need to preserve them. Registers that are not restored on unwind are left as the last value restored, so care should be taken
when using the register state that might not be restored by an unwind.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h. CONTEXT is defined in Ntddk.h.
See Also
GetStackTrace, k, kb, kc, kd, kp, kP, kv (Display Stack Backtrace), OutputContextStackTrace,
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
OutputContextStackTrace
The OutputContextStackTrace method prints the call stack specified by an array of stack frames and corresponding register contexts.
HRESULT
IDebugControl4::OutputContextStackTrace(
IN ULONG OutputControl,
IN PDEBUG_STACK_FRAME Frames,
IN ULONG FramesSize,
IN PVOID FrameContexts,
IN ULONG FrameContextsSize,
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
IN ULONG
IN ULONG
);
FrameContextsEntrySize,
Flags
Parameters
OutputControl
Specifies where to send the output. For possible values, see DEBUG_OUTCTL_XXX.
Frames
Specifies the array of stack frames to output. The number of elements in this array is FramesSize. If Frames is NULL, the current stack frame is used.
FramesSize
Specifies the number of frames to output.
FrameContexts
Specifies the register context for each frame in the stack. The entries in this array correspond to the entries in the Frames array. The type of the thread context is the
CONTEXT structure for the target's effective processor.
FrameContextsSize
Specifies the size, in bytes, of the memory pointed to by FrameContexts. The number of stack frames must equal the number of contexts, and FrameContextsSize must
equal FramesSize multiplied by FrameContextsEntrySize.
FrameContextsEntrySize
Specifies the size, in bytes, of each frame context in FrameContexts.
Flags
Specifies bit flags that determine what information to output for each frame. Flags can be any combination of values from the following table.
Flag
Description
DEBUG_STACK_ARGUMENTS
Displays the first three pieces of stack memory at the frame of each call. On platforms where arguments are
passed on the stack, and the code for the frame uses stack arguments, these values will be the arguments to the
function.
DEBUG_STACK_FUNCTION_INFO
Displays information about the function that corresponds to the frame. This includes calling convention and
frame pointer omission (FPO) information.
DEBUG_STACK_SOURCE_LINE
Displays source line information for each frame of the stack trace.
DEBUG_STACK_FRAME_ADDRESSES
Displays the return address, previous frame address, and other relevant addresses for each frame.
DEBUG_STACK_COLUMN_NAMES
Displays column names.
DEBUG_STACK_NONVOLATILE_REGISTERS
Displays the non-volatile register context for each frame. This is only meaningful for some platforms.
DEBUG_STACK_FRAME_NUMBERS
Displays frame numbers.
DEBUG_STACK_PARAMETERS
Displays parameter names and values as given in symbol information.
DEBUG_STACK_FRAME_ADDRESSES_RA_ONLY Displays just the return address in the stack frame addresses.
DEBUG_STACK_FRAME_MEMORY_USAGE
Displays the number of bytes that separate the frames.
DEBUG_STACK_PARAMETERS_NEWLINE
Displays each parameter and its type and value on a new line.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
OutputContextStackTrace is available in IdebugControl4 and later versions.
Comments
The array of stack frames can be obtained using GetContextStackTrace.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h. CONTEXT is defined in Ntddk.h.
See Also
GetContextStackTrace, k, kb, kc, kd, kp, kP, kv (Display Stack Backtrace), OutputStackTrace
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
OutputCurrentState
The OutputCurrentState method prints the current state of the current target to the debugger console.
HRESULT
IDebugControl::OutputCurrentState(
IN ULONG OutputControl,
IN ULONG Flags
);
Parameters
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
OutputControl
Specifies which clients to send the output to. For possible values see DEBUG_OUTCTL_XXX.
Flags
Specifies the bit set that determines the information to print to the debugger console. Flags can be any combination of values from the following table.
Flag
Description
DEBUG_CURRENT_SYMBOL
Symbol string for the address of the current instruction.
DEBUG_CURRENT_DISASM
Disassembly of the current instruction.
DEBUG_CURRENT_REGISTERS
Current register values.
DEBUG_CURRENT_SOURCE_LINE File name and line number of the source corresponding to the current instruction.
Alternatively, Flags can be set to DEBUG_CURRENT_DEFAULT. This value includes all of the above flags.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
OutputCurrentState is available in all versions of IDebugControl.
Comments
Setting the flags contained in Flags merely allows the information to be printed. The information will not always be printed (for example, it will not be printed if it is not
available).
This is the same status information that is printed when breaking into the debugger.
For more information, see Target Information.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetExecutionStatus
The GetExecutionStatus method returns information about the execution status of the debugger engine.
HRESULT
IDebugControl::GetExecutionStatus(
OUT PULONG Status
);
Parameters
Status
Receives the execution status. This will be set to one of the values in the following table. Note that the description of these values differs slightly from the description in
DEBUG_STATUS_XXX.
Value
Description
DEBUG_STATUS_NO_DEBUGGEE The engine is not attached to a target.
DEBUG_STATUS_STEP_OVER
The target is currently executing a single instruction. If that instruction is a subroutine call, the entire call will be executed.
DEBUG_STATUS_STEP_INTO
The target is currently executing a single instruction.
DEBUG_STATUS_STEP_BRANCH The target is currently running until it encounters a branch instruction.
DEBUG_STATUS_GO
The target is currently running normally. It will continue normal execution until an event occurs.
DEBUG_STATUS_BREAK
The target is not running.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetExecutionStatus is available in all versions of IDebugControl.
Comments
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
SetExecutionStatus
The SetExecutionStatus method requests that the debugger engine enter an executable state. Actual execution will not occur until the next time WaitForEvent is called.
HRESULT
IDebugControl::SetExecutionStatus(
IN ULONG Status
);
Parameters
Status
Specifies the mode for the engine to use when executing. Possible values are those values in the table in DEBUG_STATUS_XXX whose precedence lies between
DEBUG_STATUS_GO and DEBUG_STATUS_STEP_INTO.
Return Value
S_OK
The method was successful.
E_UNEXPECTED
Something prevented the execution of this method. Possible causes include: there is no current target, there is an outstanding request for input, or execution is not
supported in the current target.
E_ACCESSDENIED
The target is already executing.
E_NOINTERFACE
No target can generate any more events.
This method may also return other error values. See Return Values for more details.
Interface Version
SetExecutionStatus is available in all versions of IDebugControl.
Comments
For more information, see Target Information.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetExecutionStatus
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetSystemVersion
The GetSystemVersion method returns information that identifies the operating system on the computer that is running the current target.
HRESULT
IDebugControl::GetSystemVersion(
OUT PULONG PlatformId,
OUT PULONG Major,
OUT PULONG Minor,
OUT OPTIONAL PSTR ServicePackString,
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
IN ULONG ServicePackStringSize,
OUT OPTIONAL PULONG ServicePackStringUsed,
OUT PULONG ServicePackNumber,
OUT OPTIONAL PSTR BuildString,
IN ULONG BuildStringSize,
OUT OPTIONAL PULONG BuildStringUsed
);
Parameters
PlatformId
Receives the platform ID. PlatformId is always VER_PLATFORM_WIN32_NT for NT-based Windows.
Major
Receives 0xF if the target's operating system is a free build, or 0xC if the operating system is a checked build.
Minor
Receives the build number for the target's operating system.
ServicePackString
Receives the string for the service pack level of the target computer. If ServicePackString is NULL, this information is not returned. If no service pack is installed,
ServicePackString can be empty.
ServicePackStringSize
Specifies the size, in characters, of the buffer that ServicePackString specifies.
ServicePackStringUsed
Receives the size, in characters, of the string of the service pack level. If ServicePackStringUsed is NULL, this information is not returned.
ServicePackNumber
Receives the service pack level of the target's operating system.
BuildString
Receives the string that identifies the build of the system. If BuildString is NULL, this information is not returned.
BuildStringSize
Specifies the size, in characters, of the buffer that BuildString specifies.
BuildStringUsed
Receives the size, in characters, of the string that identifies the build. If BuildStringUsed is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
S_FALSE
The method was successful. However, the ServicePackString buffer or the BuildString buffer were too small and the corresponding string was truncated.
This method may also return error values. See Return Values for more details.
Interface Version
GetSystemVersion is available in all versions of IDebugControl.
Comments
For more information, see Target Information.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h. The VER_PLATFORM_XXX values are defined in Ntddk.h.
See Also
GetSystemVersionString, GetSystemVersionValues
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetSystemVersionString
The GetSystemVersionString and GetSystemVersionStringWide methods return a string that describes the target's operating system version.
HRESULT
IDebugControl4::GetSystemVersionString(
IN ULONG Which,
OUT OPTIONAL PSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG StringSize
);
HRESULT
IDebugControl4::GetSystemVersionStringWide(
IN ULONG Which,
OUT OPTIONAL PWSTR Buffer,
IN ULONG BufferSize,
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
StringSize
#ifdef UNICODE
#define GetSystemVersionStringT GetSystemVersionStringWide
#else
#define GetSystemVersionStringT GetSystemVersionString
#endif
Parameters
Which
Specifies which version string to return. The possible values are listed in the following table.
Value
Version string
DEBUG_SYSVERSTR_SERVICE_PACK Returns a description of the service pack for the target's operating system. For example, "Service Pack 1".
DEBUG_SYSVERSTR_BUILD
Returns a description of the target's operating system build version. For example, "kernel32.dll version: 5.1.2600.1106
(xpsp1.020828-1920)".
Buffer
Receives the version string. If Buffer is NULL, this information is not returned.
BufferSize
Specifies the size, in characters, of the buffer that Buffer specifies.
StringSize
Receives the size, in characters, of the string that identifies the build. If SizeString is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
S_FALSE
The method was successful. However, the buffer was too small, so the string was truncated.
This method may also return error values. See Return Values for more details.
Interface Version
GetSystemVersionString and GetSystemVersionStringWide are available in IDebugControl4 and later versions.
Comments
For more information, see Target Information.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetSystemVersion, GetSystemVersionValues
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetSystemVersionValues
The GetSystemVersionValues method returns version number information for the current target.
HRESULT
IDebugControl4::GetSystemVersionValues(
OUT PULONG PlatformId,
OUT PULONG Win32Major,
OUT PULONG Win32Minor,
OUT OPTIONAL PULONG KdMajor,
OUT OPTIONAL PULONG KdMinor
);
Parameters
PlatformId
Receives the platform ID. PlatformId is always VER_PLATFORM_WIN32_NT for NT-based Windows.
Win32Major
Receives the major version number of the target's operating system. For Windows 2000, Windows XP, and Windows Server 2003, this number is 5. For Windows Vista,
this number is 6.
Win32Minor
Receives the minor version number for the target's operating system. For Windows 2000 this is 0; for Windows XP, 1; for Windows Server 2003, 2.
KdMajor
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Receives 0xF if the target's operating system is a free build, and 0xC if it is a checked build.
KdMinor
Receives the build number for the target's operating system.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetSystemVersionValues is available in IDebugControl4 and later versions.
Comments
For more information, see Target Information.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetSystemVersion, GetSystemVersionString
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetTextMacro
The GetTextMacro and GetTextMacroWide methods return the value of a fixed-name alias.
HRESULT
IDebugControl::GetTextMacro(
IN ULONG Slot,
OUT OPTIONAL PSTR Buffer,
IN ULONG BufferSize,
OUt OPTIONAL PULONG MacroSize
);
HRESULT
IDebugControl4::GetTextMacroWide(
IN ULONG Slot,
OUT OPTIONAL PWSTR Buffer,
IN ULONG BufferSize,
OUt OPTIONAL PULONG MacroSize
);
#ifdef UNICODE
#define GetTextMacroT GetTextMacroWide
#else
#define GetTextMacroT GetTextMacro
#endif
Parameters
Slot
Specifies the number of the fixed-name alias. Slot can take the values 0, 1, , 9, that represent the fixed-name aliases $u0, $u1, , $u9.
Buffer
Receives the value of the alias specified by Slot. If Buffer is NULL, this information is not returned.
BufferSize
Specifies the size, in characters, of the Buffer buffer.
MacroSize
Receives the size, in characters, of the value of the alias.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetTextMacro is available in all versions of IDebugControl. GetTextMacroWide is available in IDeubgControl4 and later versions.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Comments
Before executing commands or evaluating expressions, the debugger engine will replace the alias specified by Slot with the value of the alias (returned to the Buffer buffer).
For an overview of aliases used by the debugger engine, see Using Aliases. For more information about using aliases with the debugger engine API, see Interacting with the
Engine.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
SetTextMacro, GetTextReplacement, GetNumberTextReplacements, r (Registers)
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SetTextMacro
The SetTextMacro and SetTextMacroWide methods set the value of a fixed-name alias.
HRESULT
IDebugControl::SetTextMacro(
IN ULONG Slot,
IN PCSTR Macro
);
HRESULT
IDebugControl4::SetTextMacroWide(
IN ULONG Slot,
IN PCWSTR Macro
);
#ifdef UNICODE
#define SetTextMacroT SetTextMacroWide
#else
#define SetTextMacroT SetTextMacro
#endif
Parameters
Slot
Specifies the number of the fixed-name alias. Slot can take the values 0, 1, , 9, that represent the fixed-name aliases $u0, $u1, , $u9.
Macro
Specifies the new value of the alias specified by Slot. The debugger engine makes a copy of this string.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
SetTextMacro is available in all versions of IDebugControl. SetTextMacroWide is available in IDeubgControl4 and later versions.
Comments
Before executing commands or evaluating expressions, the debugger engine will replace the alias specified by Slot with the value of the alias (specified by Macro).
For an overview of aliases used by the debugger engine, see Using Aliases. For more information about using aliases with the debugger engine API, see Interacting with the
Engine.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetTextMacro, SetTextReplacement, RemoveTextReplacements, r (Registers)
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetTextReplacement
The GetTextReplacement and GetTextReplacementWide methods return the value of a user-named alias or an automatic alias.
HRESULT
IDebugControl2::GetTextReplacement(
IN OPTIONAL PCSTR SrcText,
IN ULONG Index,
OUT OPTIONAL PSTR SrcBuffer,
IN ULONG SrcBufferSize,
OUT OPTIONAL PULONG SrcSize,
OUT OPTIONAL PSTR DstBuffer,
IN ULONG DstBufferSize,
OUT OPTIONAL PULONG DstSize
);
HRESULT
IDebugControl4::GetTextReplacementWide(
IN OPTIONAL PCWSTR SrcText,
IN ULONG Index,
OUT OPTIONAL PWSTR SrcBuffer,
IN ULONG SrcBufferSize,
OUT OPTIONAL PULONG SrcSize,
OUT OPTIONAL PWSTR DstBuffer,
IN ULONG DstBufferSize,
OUT OPTIONAL PULONG DstSize
);
#ifdef UNICODE
#define GetTextReplacementT GetTextReplacementWide
#else
#define GetTextReplacementT GetTextReplacement
#endif
Parameters
SrcText
Specifies the name of the alias. The engine first searches the user-named aliases for one with this name. Then, if no match is found, the automatic aliases are searched. If
SrcText is NULL, Index is used to specify the alias.
Index
Specifies the index of an alias. The indexes of the user-named aliases come before the indexes of the automatic aliases. Index is only used if SrcText is NULL. Index can
be used along with GetNumberTextReplacements to iterate over all the user-named and automatic aliases.
SrcBuffer
Receives the name of the alias. This is the name specified in SrcText, if SrcText is not NULL. If SrcBuffer is NULL, this information is not returned.
SrcBufferSize
Specifies the size, in characters, of the SrcBuffer buffer.
SrcSize
Receives the size, in characters, of the name of the alias. If SrcSize is NULL, this information is not returned.
DstBuffer
Receives the value of the alias specified by SrcText and Index. If DstBuffer is NULL, this information is not returned.
DstBufferSize
Specifies the size, in characters, of the DstBuffer buffer.
DstSize
Receives the size, in characters, of the value of the alias. If DstSize is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetTextReplacement is available in IDebugControl2 and later versions. GetTextReplacementWide is available in IDebugControl4 and later versions.
Comments
Before executing commands or evaluating expressions, the debugger engine will replace the alias specified by SrcBuffer with the value of the alias (specified by DstBuffer).
For an overview of aliases used by the debugger engine, see Using Aliases. For more information about using aliases with the debugger engine API, see Interacting with the
Engine.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
SetTextReplacement
The SetTextReplacement and SetTextReplacementWide methods set the value of a user-named alias.
HRESULT
IDebugControl2::SetTextReplacement(
IN PCSTR SrcText,
IN OPTIONAL PCSTR DstText
);
HRESULT
IDebugControl4::SetTextReplacementWide(
IN PCWSTR SrcText,
IN OPTIONAL PCSTR DstText
);
#ifdef UNICODE
#define SetTextReplacementT SetTextReplacementWide
#else
#define SetTextReplacementT SetTextReplacement
#endif
Parameters
SrcText
Specifies the name of the user-named alias. The debugger engine makes a copy of this string. If SrcText is the same as the name of an automatic alias, the automatic alias
is hidden by the new user-named alias.
DstText
Specifies the value of the user-named alias. The debugger engine makes a copy of this string. If DstText is NULL, the user-named alias is removed.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
SetTextReplacement is available in IDebugControl2 and later versions. SetTextReplacementWide is available in IDebugControl4 and later versions.
Comments
Before executing commands or evaluating expressions, the debugger engine will replace the alias specified by SrcText with the value of the alias (specified by DstText).
If SrcText is an asterisk (*) and DstText is NULL, all user-named aliases are removed. This is the same behavior as the RemoveTextReplacements method.
When an alias is changed by this method, the event callbacks are notified by passing the DEBUG_CES_TEXT_REPLACEMENTS flag to the
IDebugEventCallbacks::ChangeEngineState callback method.
For an overview of aliases used by the debugger engine, see Using Aliases. For more information about using aliases with the debugger engine API, see Interacting with the
Engine.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetTextReplacement, RemoveTextReplacements, OutputTextReplacements, SetTextMacro, as, aS (Set Alias), ad (Delete Alias)
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
OutputTextReplacements
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The OutputTextReplacements method prints all the currently defined user-named aliases to the debugger's output stream.
HRESULT
IDebugControl2::OutputTextReplacements(
IN ULONG OutputControl,
IN ULONG Flags
);
Parameters
OutputControl
Specifies the output control to use when printing the aliases. For possible values, see DEBUG_OUTCTL_XXX.
Flags
Must be set to DEBUG_OUT_TEXT_REPL_DEFAULT.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
OutputTextReplacements is available in IDebugControl2 and later versions.
Comments
For an overview of aliases used by the debugger engine, see Using Aliases. For more information about using aliases with the debugger engine API, see Interacting with the
Engine.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetTextReplacement, SetTextReplacement, RemoveTextReplacements, GetNumberTextReplacements, al (List Aliases)
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
RemoveTextReplacements
The RemoveTextReplacements methods removes all user-named aliases.
HRESULT
IDebugControl2::RemoveTextReplacements(
);
Parameters
None
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
RemoveTextReplacements is available in IDebugControl2 and later versions.
Comments
For an overview of aliases used by the debugger engine, see Using Aliases. For more information about using aliases with the debugger engine API, see Interacting with the
Engine.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
SetTextReplacement, GetNumberTextReplacements, OutputTextReplacements, ad (Delete Alias)
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetNumberTextReplacements
The GetNumberTextReplacements method returns the number of currently defined user-named and automatic aliases.
HRESULT
IDebugControl2::GetNumberTextReplacements(
OUT PULONG NumRepl
);
Parameters
NumRepl
Receives the total number of user-named and automatic aliases.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetNumberTextReplacements is available in IDebugControl2 and later versions.
Comments
For an overview of aliases used by the debugger engine, see Using Aliases. For more information about using aliases with the debugger engine API, see Interacting with the
Engine.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetTextReplacement, SetTextReplacement, OutputTextReplacements, RemoveTextReplacements
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetCurrentTimeDate
The GetCurrentTimeDate method returns the time of the current target.
HRESULT
IDebugControl2::GetCurrentTimeDate(
OUT PULONG TimeDate
);
Parameters
TimeDate
Receives the time and date. This is the number of seconds since the beginning of 1970, or 0 if the current time could not be determined.
Return Value
S_OK
The value of the variable TimeDate is either the desired information or is 0.
This method may also return error values. See Return Values for more details.
Interface Version
GetCurrentTimeDate is available in IDebugControl2 and later versions.
Comments
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
For live debugging sessions, this will be the current time as reported by the target's computer. For static debugging sessions, such as crash dump files, this will be the time the
crash dump file was created.
For more information, see Target Information.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetCurrentSystemUpTime
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetCurrentSystemUpTime
The GetCurrentSystemUpTime method returns the number of seconds the current target's computer has been running since it was last started.
HRESULT
IDebugControl2::GetCurrentSystemUpTime(
OUT PULONG UpTime
);
Parameters
UpTime
Receives the number of seconds the computer has been running, or 0 if the engine is unable to determine the running time.
Return Value
S_OK
The value of the variable UpTime is either the desired information or is 0.
This method may also return error values. See Return Values for more details.
Interface Version
GetCurrentSystemUpTime is available in IDebugControl2 and later versions.
Comments
For more information, see Target Information.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetCurrentTimeDate
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
CoerceValue
The CoerceValue method converts a value of one type into a value of another type.
HRESULT
IDebugControl::CoerceValue(
IN PDEBUG_VALUE In
IN ULONG OutType
OUT PDEBUG_VALUE Out
);
Parameters
In
Specifies the value to be converted
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
OutType
Specifies the desired type for the converted value. See DEBUG_VALUE for possible values.
Out
Receives the converted value. The type of this value will be the type specified by OutType.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
CoerceValue is available in all versions of IDebugControl.
Comments
This method converts a value of one type into a value of another type. If the specified OutType is not capable of containing the information supplied by the In variable, data
will be lost.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
DEBUG_VALUE
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
CoerceValues
The CoerceValues method converts an array of values into an array of values of different types.
HRESULT
IDebugControl::CoerceValues(
IN ULONG Count
IN PDEBUG_VALUE In
IN PULONG OutType
OUT PDEBUG_VALUE Out
);
Parameters
Count
Specifies the number of values to convert.
In
Specifies the array of values to convert. The number of elements that this array holds is Count.
OutType
Specifies the array of desired types for the converted values. For possible values, see DEBUG_VALUE. The number of elements that this array holds is Count.
Out
Specifies the array to be populated by the converted values. The types of these values are specified by OutType. The number of elements that this array holds is Count.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
CoerceValues is available in all versions of IDebugControl.
Comments
This method converts an array of values of one type into values of another type. Some of these conversions can result in loss of precision.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
CoerceValue, DEBUG_VALUE
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
OutputVersionInformation
The OutputVersionInformation method prints version information about the debugger engine to the debugger console.
HRESULT
IDebugControl::OutputVersionInformation(
IN ULONG OutputControl
);
Parameters
OutputControl
Specifies where to send the output. For possible values, see DEBUG_OUTCTL_XXX.
Return Value
S_OK
The method was successful.
This method may also return other error values, including error values caused by the engine being busy. See Return Values for more details.
Interface Version
OutputVersionInformation is available in all versions of IDebugControl.
Comments
The information that is sent to the output can include the mode of the debugger, the path and version of the debugger DLLs, the extension DLL search path, the extension
DLL chain, and the version of the operating system that is running on the host computer.
For more information, see Target Information.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
IDebugDataSpaces
The IDebugDataSpaces interface includes the following methods:
ReadBusData
WriteBusData
ReadControl
WriteControl
ReadDebuggerData
ReadHandleData
ReadImageNtHeaders
ReadIo
WriteIo
CheckLowMemory
ReadMsr
WriteMsr
GetOffsetInformation
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
FillPhysical
ReadPhysical
ReadPhysical2
WritePhysical
WritePhysical2
ReadProcessorSystemData
ReadTagged
EndEnumTagged
StartEnumTagged
GetNextTagged
FillVirtual
QueryVirtual
ReadVirtual
SearchVirtual
SearchVirtual2
WriteVirtual
ReadVirtualUncached
WriteVirtualUncached
ReadPointersVirtual
WritePointersVirtual
ReadMultiByteStringVirtual
ReadMultiByteStringVirtualWide
ReadUnicodeStringVirtual
ReadUnicodeStringVirtualWide
VirtualToPhysical
GetVirtualTranslationPhysicalOffsets
GetNextDifferentlyValidOffsetVirtual
GetValidRegionVirtual
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ReadBusData
The ReadBusData method reads data from a system bus.
HRESULT
IDebugDataSpaces::ReadBusData(
IN ULONG BusDataType,
IN ULONG BusNumber,
IN ULONG SlotNumber,
IN ULONG Offset,
OUT PVOID Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG BytesRead
);
Parameters
BusDataType
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Specifies the bus data type to read from. For details of allowed values see the documentation for the BUS_DATA_TYPE enumeration in the Microsoft Windows SDK.
BusNumber
Specifies the system-assigned number of the bus. This is usually zero, unless the system has more than one bus of the same bus data type.
SlotNumber
Specifies the logical slot number on the bus.
Offset
Specifies the offset in the bus data to start reading from.
Buffer
Receives the data from the bus.
BufferSize
Specifies the size in bytes of the buffer Buffer. This is the maximum number of bytes that will be returned.
BytesRead
Receives the number of bytes read from the bus. If BytesRead is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
This method can also return error values. See Return Values for more details.
Interface Version
ReadBusData is available in all versions of IDebugDataSpaces.
Comments
This method is only available in kernel-mode debugging.
The nature of the data read from the bus is system, bus, and slot dependent.
Requirements
Headers: Defined in Dgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
WriteBusData
The WriteBusData method writes data to a system bus.
HRESULT
IDebugDataSpaces::WriteBusData(
IN ULONG BusDataType,
IN ULONG BusNumber,
IN ULONG SlotNumber,
IN ULONG Offset,
IN PVOID Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG BytesWritten
);
Parameters
BusDataType
Specifies the bus data type of the bus to write to. For details of allowed values see the documentation for the BUS_DATA_TYPE enumeration in the Microsoft Windows
SDK.
BusNumber
Specifies the system-assigned number of the bus. This is usually zero, unless the system has more than one bus of the same bus data type.
SlotNumber
Specifies the logical slot number on the bus.
Offset
Specifies the offset in the bus data to start writing to.
Buffer
Specifies the data to write to the bus.
BufferSize
Specifies the size in bytes of the buffer Buffer. This is the maximum number of bytes that will be written.
BytesWritten
Receives the number of bytes written to the bus. If BytesWritten is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
This method can also return error values. See Return Values for more details.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Interface Version
WriteBusData is available in all versions of IDebugDataSpaces.
Comments
This method is only available in kernel-mode debugging.
The nature of the data read from the bus is system, bus, and slot dependent.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ReadControl
The ReadControl method reads implementation-specific system data.
HRESULT
IDebugDataSpaces::ReadControl(
IN ULONG Processor,
IN ULONG64 Offset,
OUT PVOID Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG BytesRead
);
Parameters
Processor
Specifies the processor whose information is to be read.
Offset
Specifies the offset in the control space of the memory to read.
Buffer
Receives the data read from the control-space memory.
BufferSize
Specifies the size in bytes of the buffer Buffer. This is the maximum number of bytes that will be read.
BytesRead
Receives the number of bytes returned in the buffer Buffer. If BytesRead is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
This method can also return error values. See Return Values for more details.
Interface Version
ReadControl is available in all versions of IDebugDataSpaces.
Comments
This method is only available in kernel-mode debugging.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
WriteControl
The WriteControl method writes implementation-specific system data.
HRESULT
IDebugDataSpaces::WriteControl(
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
IN ULONG Processor,
IN ULONG64 Offset,
IN PVOID Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG BytesWritten
);
Parameters
Processor
Specifies the processor whose information is to be written.
Offset
Specifies the offset of the control space of the memory to write.
Buffer
Specifies the data to write to the control-space memory.
BufferSize
Specifies the size in bytes of the buffer Buffer. This is the maximum number of bytes that will be written.
BytesWritten
Receives the number of bytes returned in the buffer Buffer. If BytesWritten is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
This method can also return error values. See Return Values for more details.
Interface Version
WriteControl is available in all versions of IDebugDataSpaces.
Comments
This method is only available in kernel-mode debugging.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ReadDebuggerData
The ReadDebuggerData method returns information about the target that the debugger engine has queried or determined during the current session. The available
information includes the locations of certain key target kernel locations, specific status values, and a number of other things.
HRESULT
IDebugDataSpaces::ReadDebuggerData(
IN ULONG Index,
OUT PVOID Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG DataSize
);
Parameters
Index
Specifies the index of the data to retrieve. The following values are valid:
Value
Return
Description
Type
DEBUG_DATA_KernBase
ULONG64 Returns the base address of the kernel image.
DEBUG_DATA_BreakpointWithStatusAddr
ULONG64 Returns the address of the kernel function BreakpointWithStatusInstruction.
DEBUG_DATA_SavedContextAddr
ULONG64 Returns the address of saved context record during a bugcheck. It is only valid after a
bugcheck.
DEBUG_DATA_KiCallUserModeAddr
ULONG64 Returns the address of the kernel function KiCallUserMode.
DEBUG_DATA_KeUserCallbackDispatcherAddr
ULONG64 Returns the kernel variable KeUserCallbackDispatcher.
DEBUG_DATA_PsLoadedModuleListAddr
ULONG64 Returns the address of the kernel variable PsLoadedModuleList.
DEBUG_DATA_PsActiveProcessHeadAddr
ULONG64 Returns the address of the kernel variable PsActiveProcessHead.
DEBUG_DATA_PspCidTableAddr
ULONG64 Returns the address of the kernel variable PspCidTable.
DEBUG_DATA_ExpSystemResourcesListAddr
ULONG64 Returns the address of the kernel variable ExpSystemResourcesList.
DEBUG_DATA_ExpPagedPoolDescriptorAddr
ULONG64 Returns the address of the kernel variable ExpPagedPoolDescriptor.
DEBUG_DATA_ExpNumberOfPagedPoolsAddr
ULONG64 Returns the address of the kernel variable ExpNumberOfPagedPools.
DEBUG_DATA_KeTimeIncrementAddr
ULONG64 Returns the address of the kernel variable KeTimeIncrement.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
DEBUG_DATA_KeBugCheckCallbackListHeadAddr
ULONG64
DEBUG_DATA_KiBugcheckDataAddr
ULONG64
DEBUG_DATA_IopErrorLogListHeadAddr
ULONG64
DEBUG_DATA_ObpRootDirectoryObjectAddr
ULONG64
DEBUG_DATA_ObpTypeObjectTypeAddr
ULONG64
DEBUG_DATA_MmSystemCacheStartAddr
ULONG64
DEBUG_DATA_MmSystemCacheEndAddr
ULONG64
DEBUG_DATA_MmSystemCacheWsAddr
ULONG64
DEBUG_DATA_MmPfnDatabaseAddr
ULONG64
DEBUG_DATA_MmSystemPtesStartAddr
ULONG64
DEBUG_DATA_MmSystemPtesEndAddr
ULONG64
DEBUG_DATA_MmSubsectionBaseAddr
ULONG64
DEBUG_DATA_MmNumberOfPagingFilesAddr
ULONG64
DEBUG_DATA_MmLowestPhysicalPageAddr
ULONG64
DEBUG_DATA_MmHighestPhysicalPageAddr
ULONG64
DEBUG_DATA_MmNumberOfPhysicalPagesAddr
ULONG64
DEBUG_DATA_MmMaximumNonPagedPoolInBytesAddr ULONG64
DEBUG_DATA_MmNonPagedSystemStartAddr
ULONG64
DEBUG_DATA_MmNonPagedPoolStartAddr
ULONG64
DEBUG_DATA_MmNonPagedPoolEndAddr
ULONG64
DEBUG_DATA_MmPagedPoolStartAddr
ULONG64
DEBUG_DATA_MmPagedPoolEndAddr
ULONG64
DEBUG_DATA_MmPagedPoolInformationAddr
ULONG64
DEBUG_DATA_MmPageSize
ULONG64
DEBUG_DATA_MmSizeOfPagedPoolInBytesAddr
ULONG64
DEBUG_DATA_MmTotalCommitLimitAddr
ULONG64
DEBUG_DATA_MmTotalCommittedPagesAddr
ULONG64
DEBUG_DATA_MmSharedCommitAddr
ULONG64
DEBUG_DATA_MmDriverCommitAddr
ULONG64
DEBUG_DATA_MmProcessCommitAddr
ULONG64
DEBUG_DATA_MmPagedPoolCommitAddr
ULONG64
DEBUG_DATA_MmExtendedCommitAddr
ULONG64
DEBUG_DATA_MmZeroedPageListHeadAddr
ULONG64
DEBUG_DATA_MmFreePageListHeadAddr
ULONG64
DEBUG_DATA_MmStandbyPageListHeadAddr
ULONG64
DEBUG_DATA_MmModifiedPageListHeadAddr
ULONG64
DEBUG_DATA_MmModifiedNoWritePageListHeadAddr ULONG64
DEBUG_DATA_MmAvailablePagesAddr
ULONG64
DEBUG_DATA_MmResidentAvailablePagesAddr
ULONG64
DEBUG_DATA_PoolTrackTableAddr
ULONG64
DEBUG_DATA_NonPagedPoolDescriptorAddr
ULONG64
DEBUG_DATA_MmHighestUserAddressAddr
ULONG64
DEBUG_DATA_MmSystemRangeStartAddr
ULONG64
DEBUG_DATA_MmUserProbeAddressAddr
ULONG64
DEBUG_DATA_KdPrintCircularBufferAddr
ULONG64
DEBUG_DATA_KdPrintCircularBufferEndAddr
ULONG64
DEBUG_DATA_KdPrintWritePointerAddr
ULONG64
DEBUG_DATA_KdPrintRolloverCountAddr
ULONG64
DEBUG_DATA_MmLoadedUserImageListAddr
ULONG64
DEBUG_DATA_PaeEnabled
BOOLEAN
DEBUG_DATA_SharedUserData
ULONG64 Returns the address in the target of the shared user-mode structure,
KUSER_SHARED_DATA. The KUSER_SHARED_DATA structure is defined in ntddk.h (in
the Windows Driver Kit) and ntexapi.h (in the Windows SDK).
Some of the information contained in this structure is displayed by the debugger extension !
kuser.
DEBUG_DATA_ProductType
ULONG
Returns the value of the NtProductType field in the shared user-mode page.
This value should be interpreted the same way as the wProductType field of the structure
OSVERSIONINFOEX, which is documented in the Windows SDK.
DEBUG_DATA_SuiteMask
ULONG
Returns the value of the SuiteMask field in the shared user-mode page.
This value should be interpreted the same way as the wSuiteMask field of the structure
OSVERSIONINFOEX, which is documented in the Windows SDK.
DEBUG_DATA_DumpWriterStatus
ULONG
Returns the status of the writer of the dump file. This value is operating system and dump file
type specific.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The following values are valid for Windows XP and later versions of Windows:
Value
Return Type
Description
DEBUG_DATA_NtBuildLabAddr
ULONG64 Returns the address of the kernel variable NtBuildLab.
DEBUG_DATA_KiNormalSystemCall
ULONG64 (Itanium only) Returns the address of the kernel function KiNormalSystemCall.
DEBUG_DATA_KiProcessorBlockAddr
ULONG64 Returns the kernel variable KiProcessorBlock.
DEBUG_DATA_MmUnloadedDriversAddr
ULONG64 Returns the address of the kernel variable MmUnloadedDrivers.
DEBUG_DATA_MmLastUnloadedDriverAddr
ULONG64 Returns the address of the kernel variable MmLastUnloadedDriver.
DEBUG_DATA_MmTriageActionTakenAddr
ULONG64 Returns the address of the kernel variable VerifierTriageActionTaken.
DEBUG_DATA_MmSpecialPoolTagAddr
ULONG64 Returns the address of the kernel variable MmSpecialPoolTag.
DEBUG_DATA_KernelVerifierAddr
ULONG64 Returns the address of the kernel variable KernelVerifier.
DEBUG_DATA_MmVerifierDataAddr
ULONG64 Returns the address of the kernel variable MmVerifierData.
DEBUG_DATA_MmAllocatedNonPagedPoolAddr
ULONG64 Returns the address of the kernel variable MmAllocatedNonPagedPool.
DEBUG_DATA_MmPeakCommitmentAddr
ULONG64 Returns the address of the kernel variable MmPeakCommitment.
DEBUG_DATA_MmTotalCommitLimitMaximumAddr ULONG64 Returns the address of the kernel variable MmTotalCommitLimitMaximum.
DEBUG_DATA_CmNtCSDVersionAddr
ULONG64 Returns the address of the kernel variable CmNtCSDVersion.
DEBUG_DATA_MmPhysicalMemoryBlockAddr
ULONG64 Returns the address of the kernel variable MmPhysicalMemoryBlock.
DEBUG_DATA_MmSessionBase
ULONG64 Returns the address of the kernel variable MmSessionBase.
DEBUG_DATA_MmSessionSize
ULONG64 Returns the address of the kernel variable MmSessionSize.
DEBUG_DATA_MmSystemParentTablePage
ULONG64 (Itanium only) Returns the address of the kernel variable MmSystemParentTablePage.
The following values are valid for Windows Server 2003 and later versions of Windows:
Value
Return
Type
DEBUG_DATA_MmVirtualTranslationBase
ULONG64
DEBUG_DATA_OffsetKThreadNextProcessor
USHORT
DEBUG_DATA_OffsetKThreadTeb
USHORT
DEBUG_DATA_OffsetKThreadKernelStack
USHORT
DEBUG_DATA_OffsetKThreadInitialStack
USHORT
DEBUG_DATA_OffsetKThreadApcProcess
USHORT
DEBUG_DATA_OffsetKThreadState
USHORT
DEBUG_DATA_OffsetKThreadBStore
USHORT
DEBUG_DATA_OffsetKThreadBStoreLimit
USHORT
DEBUG_DATA_SizeEProcess
USHORT
DEBUG_DATA_OffsetEprocessPeb
USHORT
DEBUG_DATA_OffsetEprocessParentCID
USHORT
DEBUG_DATA_OffsetEprocessDirectoryTableBase USHORT
DEBUG_DATA_SizePrcb
USHORT
DEBUG_DATA_OffsetPrcbDpcRoutine
USHORT
DEBUG_DATA_OffsetPrcbCurrentThread
USHORT
DEBUG_DATA_OffsetPrcbMhz
USHORT
DEBUG_DATA_OffsetPrcbCpuType
USHORT
Description
Returns the address of the kernel variable MmVirtualTranslationBase.
Returns the offset of the NextProcessor field in the KTHREAD structure.
Returns the offset of the Teb field in the KTHREAD structure.
Returns the offset of the KernelStack field in the KTHREAD structure.
Returns the offset of the InitialStack field in the KTHREAD structure.
Returns the offset of the ApcState.Process field in the KTHREAD structure.
Returns the offset of the State field in the KTHREAD structure.
(Itanium only) Returns the offset of the InitialBStore field in the KTHREAD structure.
(Itanium only) Returns the offset of the BStoreLimit field in the KTHREAD structure.
Returns the size of the EPROCESS structure.
Returns the offset of the Peb field in the EPROCESS structure.
Returns the offset of the InheritedFromUniqueProcessId field in the EPROCESS structure.
Returns the offset of the DirectoryTableBase field in the EPROCESS structure.
Returns the size of the KPRCB structure.
Returns the offset of the DpcRoutineActive field in the KPRCB structure.
Returns the offset of the CurrentThread field in the KPRCB structure.
Returns the offset of the MHz field in the KPRCB structure.
For Itanium processors: Returns the offset of the ProcessorModel field in the KPRCB structure.
For all other processors: Returns the offset of the CpuType field in the KPRCB structure.
DEBUG_DATA_OffsetPrcbVendorString
USHORT
For Itanium processors: Returns the offset of the ProcessorVendorString field in the KPRCB
structure.
For all other processors: Returns the offset of the VendorString field in the KPRCB structure.
DEBUG_DATA_OffsetPrcbProcessorState
DEBUG_DATA_OffsetPrcbNumber
DEBUG_DATA_SizeEThread
DEBUG_DATA_KdPrintCircularBufferPtrAddr
DEBUG_DATA_KdPrintBufferSizeAddr
USHORT
USHORT
USHORT
ULONG64
ULONG64
Buffer
Receives the value of the specified debugger data. The Return Type column in the above table specifies the data type that is returned. The data can be accessed by
casting Buffer to a pointer to that type.
BufferSize
Specifies the size in bytes of the buffer Buffer.
DataSize
Receives the number of bytes used in the buffer Buffer. If DataSize is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
This method can also return error values. See Return Values for more details.
Interface Version
ReadDebuggerData is available in all versions of IDebugDataSpaces.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Comments
Some or all of the values may be unavailable in certain debugging sessions. For example, some of the values are only available for particular versions of the operating system.
For details on the different values returned by ReadDebuggerData, see Microsoft Windows Internals by David Solomon and Mark Russinovich, the Microsoft Windows
SDK, and the Windows Driver Kit (WDK).
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ReadHandleData
The ReadHandleData method retrieves information about a system object specified by a system handle.
HRESULT
IDebugDataSpaces2::ReadHandleData(
IN ULONG64 Handle,
IN ULONG DataType,
OUT OPTIONAL PVOID Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG DataSize
);
Parameters
Handle
Specifies the system handle of the object whose data is requested. See Handles for information about system handles.
DataType
Specifies the data type to return for the system handle. The following table contains the valid values, along with the corresponding return type:
Value
Description
DEBUG_HANDLE_DATA_TYPE_BASIC
Returns basic information about the system object.
In this case, the argument Buffer can be considered to have type PDEBUG_HANDLE_DATA_BASIC.
DEBUG_HANDLE_DATA_TYPE_TYPE_NAME
Returns the name of the object type. For example, "Process" or "Thread".
In this case, the argument Buffer can be considered to have type PSTR.
DEBUG_HANDLE_DATA_TYPE_OBJECT_NAME
Returns the name of the object. This includes its location in the object directory.
In this case, the argument Buffer can be considered to have type PSTR.
DEBUG_HANDLE_DATA_TYPE_HANDLE_COUNT
Returns the number of handles held by the object. This is similar to the field
DEBUG_HANDLE_DATA_BASIC.HandleCount.
In this case, the argument Buffer can be considered to have type PULONG.
DEBUG_HANDLE_DATA_TYPE_TYPE_NAME_WIDE
Buffer
Receives the object data. Upon successful completion of the method, the contents of this buffer may be accessed by casting Buffer to the type specified in the above table.
If Buffer is NULL, this information is not returned.
BufferSize
Specifies the size in bytes of the buffer Buffer. This is the maximum number of bytes that will be returned.
DataSize
Receives the size of the data in bytes. If DataSize is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
This method can also return error values. See Return Values for more details.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Interface Version
ReadHandleData is available in IDebugDataSpaces2 and later versions.
Comments
This method is only available in user-mode debugging.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
Handles
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ReadImageNtHeaders
The ReadImageNtHeaders method returns the NT headers for the specified image loaded in the target.
HRESULT
IDebugDataSpaces3::ReadImageNtHeaders(
IN ULONG64 ImageBase,
OUT IMAGE_NT_HEADERS64 * Headers
);
Parameters
ImageBase
Specifies the location in the target's virtual address space of the image whose NT headers are being requested.
Headers
Receives the NT headers for the specified image.
Return Value
S_OK
The method was successful.
E_INVALIDARG
No NT headers were found for the specified image.
This method can also return error values. See Return Values for more details.
Interface Version
ReadImageNtHeaders is available in IDebugDataSpaces3 and later versions.
Comments
If the image's NT headers are 32-bit, they are automatically converted to 64-bit for consistency. To determine if the headers were originally 32-bit, look at the value of
Headers.OptionalHeader.Magic. If the value is IMAGE_NT_OPTIONAL_HDR32_MAGIC, the NT headers were originally 32-bit; otherwise the value is
IMAGE_NT_OPTIONAL_HDR64_MAGIC, indicating the NT headers were originally 64-bit.
This method will not read ROM headers.
IMAGE_NT_HEADERS64, IMAGE_NT_OPTIONAL_HDR32_MAGIC, and IMAGE_NT_OPTIONAL_HDR64_MAGIC appear in the Microsoft Windows SDK header
file winnt.h. IMAGE_NT_HEADERS64 is the 64-bit equivalent of IMAGE_NT_HEADERS, which is described in the Windows SDK documentation.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ReadIo
The ReadIo method reads from the system and bus I/O memory.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
HRESULT
IDebugDataSpaces::ReadIo(
IN ULONG InterfaceType,
IN ULONG BusNumber,
IN ULONG AddressSpace,
IN ULONG64 Offset,
OUT PVOID Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG BytesRead
);
Parameters
InterfaceType
Specifies the interface type of the I/O bus. This parameter may take values in the INTERFACE_TYPE enumeration defined in wdm.h.
BusNumber
Specifies the system-assigned number of the bus. This is usually zero, unless the system has more than one bus of the same interface type.
AddressSpace
This parameter must be equal to one.
Offset
Specifies the I/O address within the address space.
Buffer
Receives the data read from the I/O bus.
BufferSize
Specifies the size in bytes of the buffer Buffer. This is the maximum number of bytes that will be read. At present, this must be 1, 2, or 4.
BytesRead
Receives the number of bytes returned read from the I/O bus. If BytesRead is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
This method can also return error values. See Return Values for more details.
Interface Version
ReadIo is available in all versions of IDebugDataSpaces.
Comments
This method is only available in kernel-mode debugging.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
WriteIo
The WriteIo method writes to the system and bus I/O memory.
HRESULT
IDebugDataSpaces::WriteIo(
IN ULONG InterfaceType,
IN ULONG BusNumber,
IN ULONG AddressSpace,
IN ULONG64 Offset,
IN PVOID Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG BytesWritten
);
Parameters
InterfaceType
Specifies the interface type of the I/O bus. This parameter may take values in the INTERFACE_TYPE enumeration defined in wdm.h.
BusNumber
Specifies the system-assigned number of the bus. This is usually zero, unless the system has more than one bus of the same interface type.
AddressSpace
Set to one.
Offset
Specifies the location of the requested data.
Buffer
Specifies the data to write to the I/O bus.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
BufferSize
Specifies the size in bytes of the buffer Buffer. This is the maximum number of bytes that will be written.
BytesWritten
Receives the number of bytes written to I/O bus. If BytesWritten is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
This method can also return error values. See Return Values for more details.
Interface Version
WriteIo is available in all versions of IDebugDataSpaces.
Comments
This method is only available in kernel-mode debugging.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
CheckLowMemory
The CheckLowMemory method checks for memory corruption in the low 4 GB of memory.
HRESULT
IDebugDataSpaces::CheckLowMemory(
);
Parameters
None
Return Value
S_OK
No corruption was found.
FACILITY_NT_BIT | Page
Corruption was found on the memory page Page.
This method can also return error values. See Return Values for more details.
Interface Version
CheckLowMemory is available in all versions of IDebugDataSpaces.
Comments
This method is only available in kernel-mode debugging, and is only useful when the kernel was booted using the /nolowmem option.
When the kernel is booted with the /nolowmem option, the kernel, drivers, operating system and applications are loaded in memory above 4 GB, while the low 4 GB of
memory is filled with a unique pattern. The CheckLowMemory method checks this pattern for corruption.
This may be used to verify that a driver behaves well when using physical addresses greater than 32 bits in length. See Physical Address Extension (PAE), /pae,
and /nolowmem in the Windows Driver Kit.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ReadMsr
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
WriteMsr
The WriteMsr method writes a value to the specified Model-Specific Register (MSR).
HRESULT
IDebugDataSpaces::WriteMsr(
IN ULONG Msr,
IN ULONG64 Value
);
Parameters
Msr
Specifies the MSR address.
Value
Specifies the value to write to the MSR.
Return Value
S_OK
The method was successful.
This method can also return error values. See Return Values for more details.
Interface Version
WriteMsr is available in all versions of IDebugDataSpaces.
Comments
This method is only available in kernel-mode debugging.
For details on the addresses and values of MSRs, see the processor documentation.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetOffsetInformation
The GetOffsetInformation method provides general information about an address in a process's data space.
HRESULT
IDebugDataSpaces4::GetOffsetInformation(
IN ULONG Space,
IN ULONG Which,
IN ULONG64 Offset,
OUT OPTIONAL PVOID Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG InfoSize
);
Parameters
Space
Specifies the data space to which the Offset parameter applies. The allowed values depend on the Which parameter.
Which
Specifies which information about the data is being queried. This determines the possible values for Space and the type of the data returned in Buffer. Possible values are:
DEBUG_OFFSINFO_VIRTUAL_SOURCE
Returns the source of the target's virtual memory at Offset. This is where the debugger engine reads the memory from. Space must be set to
DEBUG_DATA_SPACE_VIRTUAL. A ULONG is returned to Buffer. This ULONG can take the values listed in the following table.
Value
Description
DEBUG_VSOURCE_INVALID
The Offset offset is not available in the process's virtual address space.
This could mean that the address is invalid, or that the memory is unavailable for example, a crash-dump file might
not contain all of the memory for the process or for the kernel.
DEBUG_VSOURCE_DEBUGGEE
The virtual memory at the Offset offset is provided by the target.
DEBUG_VSOURCE_MAPPED_IMAGE The debugger engine reads the target's virtual memory at Offset offset from a local image file. This is often the case in
minidump files where the module images are not included in the dump file and are instead loaded by the debugger
engine.
Offset
Specifies the offset in the target's data space for which the information is returned.
Buffer
Specifies the buffer to receive the information. The type of the data returned depends on the value of Which. If Buffer is NULL, this information is not returned.
BufferSize
Specifies the size, in bytes, of the Buffer buffer.
InfoSize
Receives the size, in bytes, of the information that is returned. If InfoSize is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
This method can also return error values. See Return Values for more details.
Interface Version
GetOffsetInformation is available in IDebugDataSpaces4 and later versions.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
FillPhysical
The FillPhysical method writes a pattern of bytes to the target's physical memory. The pattern is written repeatedly until the specified memory range is filled.
HRESULT
IDebugDataSpaces2::FillPhysical(
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
IN ULONG64 Start,
IN ULONG Size,
IN PVOID Pattern,
IN ULONG PatternSize,
OUT OPTIONAL PULONG Filled
);
Parameters
Start
Specifies the location in the target's physical memory at which to start writing the pattern.
Size
Specifies how many bytes to write to the target's memory.
Pattern
Specifies the pattern to write.
PatternSize
Specifies the size in bytes of the pattern.
Filled
Receives the number of bytes written. If it is set to NULL, this information isn't returned.
Return Value
S_OK
The method was successful.
This method can also return error values. See Return Values for more details.
Interface Version
FillPhysical is available in IDebugDataSpaces2 and later versions.
Comments
This method writes the pattern to the target's memory as many times as will fit in Size bytes.
If the final copy of the pattern will not completely fit into the memory range, it will only be partially written. This includes the case where the size of the pattern is larger than
the value of Size, and the extra bytes in the pattern are ignored.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
WritePhysical
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ReadPhysical
The ReadPhysical method reads the target's memory from the specified physical address.
HRESULT
IDebugDataSpaces::ReadPhysical(
IN ULONG64 Offset,
OUT PVOID Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG BytesRead
);
Parameters
Offset
Specifies the physical address of the memory to read.
Buffer
Receives the memory that is read.
BufferSize
Specifies the size in bytes of the buffer Buffer. This is the maximum number of bytes that will be read.
BytesRead
Receives the number of bytes read from the target's memory. If BytesRead is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
This method can also return error values. See Return Values for more details.
Interface Version
ReadPhysical is available in all versions of IDebugDataSpaces.
Comments
This method is only available in kernel-mode debugging.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ReadPhysical2
The ReadPhysical2 method reads the target's memory from the specified physical address.
HRESULT
IDebugDataSpaces4::ReadPhysical2(
IN ULONG64 Offset,
IN ULONG Flags,
OUT PVOID Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG BytesRead
);
Parameters
Offset
Specifies the physical address of the memory to read.
Flags
Specifies the properties of the physical memory to be read. This must match the way the physical memory was advertised to the operating system on the target. Possible
values are listed in the following table.
Value
Description
DEBUG_PHYSICAL_DEFAULT
Use the default memory caching.
DEBUG_PHYSICAL_CACHED
The physical memory is cached.
DEBUG_PHYSICAL_UNCACHED
The physical memory is uncached.
DEBUG_PHYSICAL_WRITE_COMBINED The physical memory is write-combined.
Buffer
Receives the memory that is read.
BufferSize
Specifies the size, in bytes, of the Buffer buffer. This is the maximum number of bytes that will be read.
BytesRead
Receives the number of bytes read from the target's memory. If BytesRead is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
This method can also return error values. See Return Values for more details.
Interface Version
ReadPhysical2 is available in IDebugDataSpaces4 and later versions.
Comments
This method is only available in kernel-mode debugging.
The flags DEBUG_PHYSICAL_CACHED, DEBUG_PHYSICAL_UNCACHED, and DEBUG_PHYSICAL_WRITE_COMBINED can only be used when the target is a
live kernel target that is being debugged in the standard way (using a COM port, 1394 bus, or named pipe).
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
ReadPhysical, WritePhysical2
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
WritePhysical
The WritePhysical method writes data to the specified physical address in the target's memory.
HRESULT
IDebugDataSpaces::WritePhysical(
IN ULONG64 Offset,
IN PVOID Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG BytesWritten
);
Parameters
Offset
Specifies the physical address of the memory to write the data to.
Buffer
Specifies the data to write.
BufferSize
Specifies the size in bytes of the buffer Buffer. This is the maximum number of bytes that will be written.
BytesWritten
Receives the number of bytes written to the target's memory. If BytesWritten is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
This method can also return error values. See Return Values for more details.
Interface Version
WritePhysical is available in all versions of IDebugDataSpaces.
Comments
This method is only available in kernel-mode debugging.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
WritePhysical2
The WritePhysical2 method writes data to the specified physical address in the target's memory.
HRESULT
IDebugDataSpaces4::WritePhysical2(
IN ULONG64 Offset,
IN ULONG Flags,
IN PVOID Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG BytesWritten
);
Parameters
Offset
Specifies the physical address of the memory to write the data to.
Flags
Specifies the properties of the physical memory to be written to. This must match the way the physical memory was advertised to the operating system on the target.
Possible values are listed in the following table.
Value
Description
DEBUG_PHYSICAL_DEFAULT
Use the default memory caching.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
DEBUG_PHYSICAL_CACHED
The physical memory is cached.
DEBUG_PHYSICAL_UNCACHED
The physical memory is uncached.
DEBUG_PHYSICAL_WRITE_COMBINED The physical memory is write-combined.
Buffer
Specifies the data to write.
BufferSize
Specifies the size, in bytes, of the Buffer buffer. This is the maximum number of bytes that will be written.
BytesWritten
Receives the number of bytes written to the target's memory. If BytesWritten is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
This method can also return error values. See Return Values for more details.
Interface Version
WritePhysical2 is available in IDebugDataSpaces4 and later versions.
Comments
This method is only available in kernel-mode debugging.
The flags DEBUG_PHYSICAL_CACHED, DEBUG_PHYSICAL_UNCACHED, and DEBUG_PHYSICAL_WRITE_COMBINED can only be used when the target is a
live kernel target that is being debugged in the standard way (using a COM port, 1394 bus, or named pipe).
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
WritePhysical, WritePhysical2
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ReadProcessorSystemData
The ReadProcessorSystemData method returns data about the specified processor.
HRESULT
IDebugDataSpaces::ReadProcessorSystemData(
IN ULONG Processor,
IN ULONG Index,
OUT PVOID Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG DataSize
);
Parameters
Processor
Specifies the processor whose data is to be read.
Index
Specifies the data type to read. The following table contains the valid values. After successful completion, the data returned in the buffer Buffer has the type specified by
the middle column.
Value
Description
DEBUG_DATA_KPCR_OFFSET
Returns the virtual address of the processor's Processor Control Region (PCR).
In this case, the argument Buffer can be considered to have type PULONG64.
DEBUG_DATA_KPRCB_OFFSET
Returns the virtual address of the processor's Processor Control Block (PRCB).
In this case, the argument Buffer can be considered to have type PULONG64.
DEBUG_DATA_KTHREAD_OFFSET
Returns the virtual address of the KTHREAD structure for the system thread running on the processor.
In this case, the argument Buffer can be considered to have type PULONG64.
DEBUG_DATA_BASE_TRANSLATION_VIRTUAL_OFFSET Returns the virtual address of the base of the paging information owned by the operating system or the
processor. The address and the content at the address are processor- and operating-system-dependent.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
In this case, the argument Buffer can be considered to have type PULONG64.
DEBUG_DATA_PROCESSOR_IDENTIFICATION
DEBUG_DATA_PROCESSOR_SPEED
Returns the speed of the processor in MHz. This may not work in a particular session.
In this case, the argument Buffer can be considered to have type PULONG.
Buffer
Receives the processor data. Upon successful completion of the method, the contents of this buffer may be accessed by casting Buffer to the type specified in the above
table.
BufferSize
Specifies the size in bytes of the buffer Buffer. This is the maximum number of bytes that will be returned.
DataSize
Receives the size of the data in bytes. If DataSize is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
This method can also return error values. See Return Values for more details.
Interface Version
ReadProcessorSystemData is available in all versions of IDebugDataSpaces.
Comments
This method is only available in kernel-mode debugging.
For information about the PCR, PRCB, and KTHREAD structures, as well as information about paging tables, see Microsoft Windows Internals by David Solomon and Mark
Russinovich.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ReadTagged
The ReadTagged method reads the tagged data that might be associated with a debugger session.
HRESULT
IDebugDataSpaces3::ReadTagged(
IN LPGUID Tag,
IN ULONG Offset,
OUT OPTIONAL PVOID Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG TotalSize
);
Parameters
Tag
Specifies the GUID identifying the data requested.
Offset
Specifies the offset within the data to read.
Buffer
Receives the data. If Buffer is NULL, the data is not returned.
BufferSize
Specifies the size in bytes of the buffer Buffer. This is the maximum number of bytes that will be returned.
TotalSize
Receives the total size in bytes of the data specified by Tag.
Return Value
S_OK
The method was successful.
E_NOINTERFACE
No data identified by Tag could be found.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
This method can also return error values. See Return Values for more details.
Interface Version
ReadTagged is available in IDebugDataSpaces3 and later versions.
Comments
Some debugger sessions have arbitrary additional data available. For example, when a dump file is created, additional dump information files containing extra information
may also be created. This additional data is tagged with a global unique identifier and can only be retrieved via the tag.
LPGUID is a pointer to a 128-bit unique identifier. It is defined in the Microsoft Windows SDK header file guiddef.h.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetNextTagged
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
EndEnumTagged
The EndEnumTagged method releases the resources used by the specified enumeration.
HRESULT
IDebugDataSpaces3::EndEnumTagged(
IN ULONG64 Handle
);
Parameters
Handle
Specifies the handle identifying the enumeration. This is the handle returned by StartEnumTagged.
Return Value
S_OK
The method was successful.
This method can also return error values. See Return Values for more details.
Interface Version
EndEnumTagged is available in IDebugDataSpaces3 and later versions.
Comments
Once a handle has been passed to this method it is no longer valid and must not be used again.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
StartEnumTagged
The StartEnumTagged method initializes a enumeration over the tagged data associated with a debugger session.
HRESULT
IDebugDataSpaces3::StartEnumTagged(
OUT PULONG64 Handle
);
Parameters
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Handle
Receives the handle identifying the enumeration. This handle can be passed to GetNextTagged and EndEnumTagged.
Return Value
S_OK
The method was successful.
This method can also return error values. See Return Values for more details.
Interface Version
StartEnumTagged is available in IDebugDataSpaces3 and later versions.
Comments
The resources held by an enumeration created with this method can be released using EndEnumTagged.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetNextTagged
The GetNextTagged method returns the GUID for the next block of tagged data in the enumeration.
HRESULT
IDebugDataSpaces3::GetNextTagged(
IN ULONG64 Handle,
OUT LPGUID Tag,
OUT PULONG Size
);
Parameters
Handle
Specifies the handle identifying the enumeration. This is the handle returned by StartEnumTagged.
Tag
Receives the GUID identifying the tagged data. The data may be retrieved by passing this GUID to ReadTagged.
Size
Receives the size of the data identified by the GUID Tag.
Return Value
S_OK
The method was successful.
S_FALSE
There are no more blocks of tagged data available in this enumeration.
This method can also return error values. See Return Values for more details.
Interface Version
GetNextTagged is available in IDebugDataSpaces3 and later versions.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
StartEnumTagged, ReadTagged
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
FillVirtual
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The FillVirtual method writes a pattern of bytes to the target's virtual memory. The pattern is written repeatedly until the specified memory range is filled.
HRESULT
IDebugDataSpaces2::FillVirtual(
IN ULONG64 Start,
IN ULONG Size,
IN PVOID Pattern,
IN ULONG PatternSize,
OUT OPTIONAL PULONG Filled
);
Parameters
Start
Specifies the location in the target's virtual address space at which to start writing the pattern.
Size
Specifies how many bytes to write to the target's memory.
Pattern
Specifies the memory location of the pattern.
PatternSize
Specifies the size in bytes of the pattern.
Filled
Receives the number of bytes written. If it is set to NULL, this information isn't returned.
Return Value
S_OK
The method was successful.
This method can also return error values. See Return Values for more details.
Interface Version
FillVirtual is available in IDebugDataSpaces2 and later versions.
Comments
This method writes the pattern to the target's memory as many times as will fit in Size bytes.
If the final copy of the pattern will not completely fit into the memory range, it will only be partially written. This includes the case where the size of the pattern is larger than
the value of Size, and the extra bytes in the pattern are ignored.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
WriteVirtual
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
QueryVirtual
The QueryVirtual method provides information about the specified pages in the target's virtual address space.
HRESULT
IDebugDataSpaces2::QueryVirtual(
IN ULONG64 Offset,
OUT MEMORY_BASIC_INFORMATION64 *
);
Info
Parameters
Offset
Specifies the location in the target's virtual address space of the pages whose information is requested.
Info
Receives the information about the memory page.
Return Value
S_OK
The method was successful.
This method can also return error values. See Return Values for more details.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Interface Version
QueryVirtual is available in IDebugDataSpaces2 and later versions.
Comments
This method may not work in all sessions.
This method returns attributes for a range of pages. This range is determined by Windows; it begins at the specified page, and includes all subsequent pages with the same
attributes. The size of the range is given by the RegionSize field of the structure returned in Info.
MEMORY_BASIC_INFORMATION64 appears in the Microsoft Windows SDK header file winnt.h. It is the 64-bit equivalent of MEMORY_BASIC_INFORMATION,
which is described in the Windows SDK documentation.
This method behaves in a similar way to the Windows SDK function VirtualQuery. See Windows SDK documentation for details.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ReadVirtual
The ReadVirtual method reads memory from the target's virtual address space.
HRESULT
IDebugDataSpaces::ReadVirtual(
IN ULONG64 Offset,
OUT PVOID Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG BytesRead
);
Parameters
Offset
Specifies the location in the target's virtual address space to be read.
Buffer
Specifies the buffer to read the memory into.
BufferSize
Specifies the size in bytes of the buffer. This is also the number of bytes being requested.
BytesRead
Receives the number of bytes that were read. If it is set to NULL, this information is not returned.
Return Value
S_OK
The method was successful. It is possible that BytesRead is less than BufferSize, but at least one byte of data was returned.
This method can also return error values. See Return Values for more details.
Interface Version
ReadVirtual is available in all versions of IDebugDataSpaces.
Comments
This method fills the buffer with the contents of the memory in the target's virtual address space.
This method may reference a cache of memory data when retrieving data. If the data is volatile, such as memory-mapped hardware state, use ReadVirtualUncached instead.
When reading memory that contains pointers, these pointers are for the target's virtual address space and not the engine's. For example, if a data structure contained a string, a
second call to this method may be needed to read the contents of the string.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
WriteVirtual, ReadVirtualUncached
2009 Microsoft Corporation
Send feedback on this topic
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
SearchVirtual
The SearchVirtual method searches the target's virtual memory for a specified pattern of bytes.
HRESULT
IDebugDataSpaces::SearchVirtual(
IN ULONG64 Offset
IN ULONG64 Length
IN PVOID Pattern
IN ULONG PatternSize
IN ULONG PatternGranularity
OUT PULONG64 MatchOffset
);
Parameters
Offset
Specifies the location in the target's virtual address space to start searching for the pattern.
Length
Specifies how far to search for the pattern. A successful match requires the entire pattern to be found before Length bytes have been examined.
Pattern
Specifies the pattern to search for.
PatternSize
Specifies the size in bytes of the pattern. This must be a multiple of the granularity of the pattern.
PatternGranularity
Specifies the granularity of the pattern. For a successful match the pattern must occur a multiple of this value after the start location.
MatchOffset
Receives the location in the target's virtual address space of the pattern, if it was found.
Return Value
S_OK
The method was successful.
HRESULT_FROM_NT(STATUS_NO_MORE_ENTRIES)
After examining Length bytes the pattern was not found.
This method can also return error values. See Return Values for more details.
Interface Version
SearchVirtual is available in all versions of IDebugDataSpaces.
Comments
This method searches the target's virtual memory for the first occurrence, subject to granularity, of the pattern entirely contained in the Length bytes of the target's memory
starting at the location Offset.
PatternGranularity can be used to ensure the alignment of the match relative to Offset. For example, a value of 0x4 can be used to require alignment to a DWORD. A value of
0x1 can be used to allow the pattern to start anywhere.
For additional options, including the ability to restrict the search to writable memory, see SearchVirtual2.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
ReadVirtual, SearchVirtual2
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SearchVirtual2
The SearchVirtual2 method searches the process's virtual memory for a specified pattern of bytes.
HRESULT
IDebugDataSpaces4::SearchVirtual2(
IN ULONG64 Offset,
IN ULONG64 Length,
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
IN ULONG Flags,
IN PVOID Pattern,
IN ULONG PatternSize,
IN ULONG PatternGranularity,
OUT PULONG64 MatchOffset
);
Parameters
Offset
Specifies the location in the process's virtual address space to start searching for the pattern.
Length
Specifies how far to search for the pattern. A successful match requires the entire pattern to be found before Length bytes have been examined.
Flags
Specifies a bit field of flags for the search. Currently, the only bit-flag that can be set is DEBUG_VSEARCH_WRITABLE_ONLY, which restricts the search to writable
memory.
Pattern
Specifies the pattern to search for.
PatternSize
Specifies the size, in bytes, of the pattern. This must be a multiple of the granularity of the pattern.
PatternGranularity
Specifies the granularity of the pattern. For a successful match, the difference between the location of the found pattern and Offset must be a multiple of
PatternGranularity.
MatchOffset
Receives the location in the process's virtual address space of the pattern, if it was found.
Return Value
S_OK
The method was successful.
HRESULT_FROM_NT(STATUS_NO_MORE_ENTRIES)
After examining Length bytes, the pattern was not found.
This method can also return error values. See Return Values for more details.
Interface Version
SearchVirtual2 is available in IDebugDataSpaces4 and later versions.
Comments
This method searches the target's virtual memory for the first occurrence, subject to granularity, of the pattern that is entirely contained in the Length bytes of the target's
memory, starting at the Offset location.
PatternGranularity can be used to ensure the alignment of the match relative to Offset. For example, a value of 0x4 can be used to require alignment to a DWORD. A value of
0x1 can be used to allow the pattern to start anywhere.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
SearchVirtual
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
WriteVirtual
The WriteVirtual method writes data to the target's virtual address space.
HRESULT
IDebugDataSpaces::WriteVirtual(
IN ULONG64 Offset,
IN PVOID Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG BytesWritten
);
Parameters
Offset
Specifies the location in the target's virtual address space to be written.
Buffer
Specifies the buffer to write the memory from.
BufferSize
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Specifies the size in bytes of the buffer. This is also the number of bytes requested to be written.
BytesWritten
Receives the number of bytes that were written. If it is set to NULL, this information is not returned.
Return Value
S_OK
The method was at least partially successful. BytesWritten indicates the number of bytes successfully written, which may be less than BufferSize.
This method can also return error values. See Return Values for more details.
Interface Version
WriteVirtual is available in all versions of IDebugDataSpaces.
Comments
This method writes the buffer to the memory in the target's virtual address space.
This method may only write to a cache of memory data when storing data. To avoid caching, use WriteVirtualUncached instead.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
ReadVirtual, WriteVirtualUncached
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ReadVirtualUncached
The ReadVirtualUncached method reads memory from the target's virtual address space.
HRESULT
IDebugDataSpaces::ReadVirtualUncached(
IN ULONG64 Offset,
OUT PVOID Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG BytesRead
);
Parameters
Offset
Specifies the location in the target's virtual address space to be read.
Buffer
Specifies the buffer to read the memory into.
BufferSize
Specifies the size in bytes of the buffer. This is also the number of bytes being requested.
BytesRead
Receives the number of bytes that were read. If it is set to NULL, this information is not returned.
Return Value
S_OK
The method was successful. It is possible that BytesRead is less than BufferSize, but at least one byte of data is being returned.
This method can also return error values. See Return Values for more details.
Interface Version
ReadVirtualUncached is available in all versions of IDebugDataSpaces.
Comments
This method fills the buffer with the contents of the memory in the target's virtual address space.
This method behaves identically to ReadVirtual, except that it avoids using the virtual memory cache. It is therefore useful for reading inherently volatile virtual memory,
such as memory-mapped device areas, without contaminating or invalidating the cache.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
See Also
ReadVirtual, WriteVirtualUncached
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
WriteVirtualUncached
The WriteVirtualUncached method writes data to the target's virtual address space.
HRESULT
IDebugDataSpaces::WriteVirtualUncached(
IN ULONG64 Offset,
IN PVOID Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG BytesWritten
);
Parameters
Offset
Specifies the location in the target's virtual address space to be written.
Buffer
Specifies the buffer to write the memory from.
BufferSize
Specifies the size in bytes of the buffer. This is also the number of bytes requested to be written.
BytesWritten
Receives the number of bytes that were actually written. If it is set to NULL, this information is not returned.
Return Value
S_OK
The method was at least partially successful. BytesWritten indicates the number of bytes successfully written, which may be less than BufferSize.
This method can also return error values. See Return Values for more details.
Interface Version
WriteVirtualUncached is available in all versions of IDebugDataSpaces.
Comments
This method writes the buffer to the memory in the target's virtual address space.
This method behaves identically to WriteVirtual, except that it avoids using the virtual memory cache. It is therefore useful for reading inherently volatile virtual memory,
such as memory-mapped device areas, without contaminating or invalidating the cache.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
WriteVirtual, ReadVirtualUncached
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ReadPointersVirtual
The ReadPointersVirtual method is a convenience method for reading pointers from the target's virtual address space.
HRESULT
IDebugDataSpaces::ReadPointersVirtual(
IN ULONG Count
IN ULONG64 Offset
OUT PULONG64 Ptrs
);
Parameters
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Count
Specifies the number of pointers to read.
Offset
Specifies the location in the target's virtual address space to start reading the pointers.
Ptrs
Specifies the array to store the pointers. The number of elements this array holds is Count.
Return Value
S_OK
All the pointers were read from the target's memory and stored in Ptrs.
This method can also return error values. See Return Values for more details.
Interface Version
ReadPointersVirtual is available in all versions of IDebugDataSpaces.
Comments
This method reads from the memory from the target's virtual address space. The memory is then treated as a list of pointers. Any 32-bit pointers are then sign-extended to 64bit values.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
ReadVirtual, WritePointersVirtual
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
WritePointersVirtual
The WritePointersVirtual method is a convenience method for writing pointers to the target's virtual address space.
HRESULT
IDebugDataSpaces::WritePointersVirtual(
IN ULONG Count
IN ULONG64 Offset
IN PULONG64 Ptrs
);
Parameters
Count
Specifies the number of pointers to write.
Offset
Specifies the location in the target's virtual address space at which to start writing the pointers.
Ptrs
Specifies the array of pointers to write. The number of elements in this array is Count.
Return Value
S_OK
All the pointers in Ptrs were written to the target's memory.
This method can also return error values. See Return Values for more details.
Interface Version
WritePointersVirtual is available in all versions of IDebugDataSpaces.
Comments
If the target uses 32-bit pointers, this method casts the specified 64-bit values into 32-bit pointers. Then it writes these pointers to the target's memory.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
WriteVirtual, ReadPointersVirtual
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
ReadMultiByteStringVirtual
The ReadMultiByteStringVirtual method reads a null-terminated, multibyte string from the target.
HRESULT
IDebugDataSpaces4::ReadMultiByteStringVirtual(
IN ULONG64 Offset,
IN ULONG MaxBytes,
OUT OPTIONAL PSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG StringBytes
);
Parameters
Offset
Specifies the location of the string in the process's virtual address space.
MaxBytes
Specifies the maximum number of bytes to read from the target.
Buffer
Receives the string from the target. If Buffer is NULL, this information is not returned.
Note The remainder of the buffer, following the returned string, might be overwritten by this method.
BufferSize
Specifies the size, in characters, of the Buffer buffer.
StringBytes
Receives the size, in bytes, of the string. If StringBytes is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
S_FALSE
The method was successful. However Buffer was not large enough to hold the string and the string was truncated to fit in Buffer. The truncated string is null-terminated if
Buffer has space for at least one character.
E_INVALIDARG
A null-terminator was not found after reading MaxBytes from the target.
This method can also return error values. See Return Values for more details.
Interface Version
ReadMultiByteStringVirtual is available in IDebugDataSpaces4 and later versions.
Comments
The engine will read up to MaxBytes from the target looking for a null-terminator. If the string has more than BufferSize characters, the string will be truncated to fit in Buffer.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
ReadMultiByteStringVirtualWide, ReadUnicodeStringVirtual
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ReadMultiByteStringVirtualWide
The ReadMultiByteStringVirtualWide method reads a null-terminated, multibyte string from the target and converts it to Unicode.
HRESULT
IDebugDataSpaces4::ReadMultiByteStringVirtualWide(
IN ULONG64 Offset,
IN ULONG MaxBytes,
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
IN ULONG CodePage,
OUT OPTIONAL PWSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG StringBytes
);
Parameters
Offset
Specifies the location of the string in the process's virtual address space.
MaxBytes
Specifies the maximum number of bytes to read from the target.
CodePage
Specifies the code page to use to convert the multibyte string read from the target into a Unicode string. For example, CP_ACP is the ANSI code page.
Buffer
Receives the string from the target. If Buffer is NULL, this information is not returned.
BufferSize
Specifies the size, in characters, of the Buffer buffer.
StringBytes
Receives the size, in bytes, of the string in the target. If StringBytes is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
S_FALSE
The method was successful. However Buffer was not large enough to hold the string and the string was truncated to fit in Buffer. The truncated string is null-terminated if
Buffer has space for at least one character.
E_INVALIDARG
A null-terminator was not found after reading MaxBytes from the target.
This method can also return error values. See Return Values for more details.
Interface Version
ReadMultiByteStringVirtualWide is available in IDebugDataSpaces4 and later versions.
Comments
The engine will read up to MaxBytes from the target, looking for a null-terminator. If the string has more than BufferSize characters, the string will be truncated to fit in Buffer.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h. Code pages are defined in Winnls.h.
See Also
ReadMultiByteStringVirtual, ReadUnicodeStringVirtualWide
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ReadUnicodeStringVirtual
The ReadUnicodeStringVirtual method reads a null-terminated, Unicode string from the target and converts it to a multibyte string.
HRESULT
IDebugDataSpaces4::ReadUnicodeStringVirtual(
IN ULONG64 Offset,
IN ULONG MaxBytes,
IN ULONG CodePage,
OUT OPTIONAL PSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG StringBytes
);
Parameters
Offset
Specifies the location in the process's virtual address space of the string.
MaxBytes
Specifies the maximum number of bytes to read from the target.
CodePage
Specifies the code page to use to convert the multibyte string read from the target into a Unicode string. For example, CP_ACP is the ANSI code page.
Buffer
Receives the string from the target. If Buffer is NULL, this information is not returned.
BufferSize
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
ReadUnicodeStringVirtualWide
The ReadUnicodeStringVirtualWide method reads a null-terminated, Unicode string from the target.
HRESULT
IDebugDataSpaces4::ReadUnicodeStringVirtualWide(
IN ULONG64 Offset,
IN ULONG MaxBytes,
OUT OPTIONAL PWSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG StringBytes
);
Parameters
Offset
Specifies the location of the string in the process's virtual address space.
MaxBytes
Specifies the maximum number of bytes to read from the target.
Buffer
Receives the string from the target. If Buffer is NULL, this information is not returned.
Note The remainder of the buffer, following the returned string, might be overwritten by this method.
BufferSize
Specifies the size, in characters, of the Buffer buffer.
StringBytes
Receives the size, in bytes, of the string. If StringBytes is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
S_FALSE
The method was successful. However Buffer was not large enough to hold the string and the string was truncated to fit in Buffer. The truncated string is null-terminated if
Buffer has space for at least one character.
E_INVALIDARG
A null-terminator was not found after reading MaxBytes from the target.
This method can also return error values. See Return Values for more details.
Interface Version
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
VirtualToPhysical
The VirtualToPhysical method translates a location in the target's virtual address space into a physical memory address.
HRESULT
IDebugDataSpaces2::VirtualToPhysical(
IN ULONG64 Virtual,
OUT PULONG64 Physical
);
Parameters
Virtual
Specifies the location in the target's virtual address space to translate.
Physical
Receives the physical memory address.
Return Value
S_OK
The method was successful.
HRESULT_FROM_NT(STATUS_NO_PAGEFILE)
No physical page containing the specified address could be found.
This method can also return error values. See Return Values for more details.
Interface Version
VirtualToPhysical is available in IDebugDataSpaces2 and later versions.
Comments
This method is only available in kernel-mode debugging.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetVirtualTranslationPhysicalOffsets
The GetVirtualTranslationPhysicalOffsets method returns the physical addresses of the system paging structures at different levels of the paging hierarchy.
HRESULT
IDebugDataSpaces2::GetVirtualTranslationPhysicalOffsets(
IN ULONG64 Virtual,
OUT OPTIONAL PULONG64 Offsets,
IN ULONG OffsetsSize,
OUT OPTIONAL PULONG Levels
);
Parameters
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Virtual
Specifies the location in the target's virtual address space to translate.
Offsets
Receives the physical addresses for the system paging structures. If it is set to NULL, this information is not returned.
OffsetsSize
Specifies the number of elements the array Offsets holds. This is the maximum number of addresses that will be returned.
Levels
Receives the number of levels in the paging hierarchy for the specified address. If this is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
HRESULT_FROM_NT(STATUS_NO_PAGEFILE)
No physical page containing the specified address could be found.
This method can also return error values. See Return Values for more details.
Interface Version
GetVirtualTranslationPhysicalOffsets is available in IDebugDataSpaces2 and later versions.
Comments
This method is only available in kernel-mode debugging.
Translating a virtual address to a physical address requires Windows to walk down the paging hierarchy. At each level it reads paging information from physical memory.
This method returns the offsets for these physical pages. The number of levels in the paging hierarchy may be different for different addresses.
The address at the last level of the hierarchy is the physical address corresponding to the specified virtual address. This is what VirtualToPhysical would return.
For details on how virtual addresses are translated into physical addresses, see Microsoft Windows Internals by David Solomon and Mark Russinovich.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetNextDifferentlyValidOffsetVirtual
The GetNextDifferentlyValidOffsetVirtual method returns the offset of the next address whose validity might be different from the validity of the specified address.
HRESULT
IDebugDataSpaces4::GetNextDifferentlyValidOffsetVirtual(
IN ULONG64 Offset,
OUT PULONG64 NextOffset
);
Parameters
Offset
Specifies a start address. The address returned in NextOffset will be the next address whose validity might be defined differently from this one.
NextOffset
Receives the address of the next address whose validity might be defined differently from the address in Offset.
Return Value
S_OK
The method was successful.
This method can also return error values. See Return Values for more details.
Interface Version
GetNextDifferentlyValidOffsetVirtual is available in IDebugDataSpaces4 and later versions.
Comments
The size of regions of validity depends on the target. For example, in live user-mode debugging sessions, where virtual address validity changes from page to page, NextOffset
will receive the address of the next page. In user-mode dump files the validity can change from byte to byte.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
See Also
GetValidRegionVirtual
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetValidRegionVirtual
The GetValidRegionVirtual method locates the first valid region of memory in a specified memory range.
HRESULT
IDebugDataSpaces4::GetValidRegionVirtual(
IN ULONG64 Base,
IN ULONG Size,
OUT PULONG64 ValidBase,
OUT PULONG ValidSize
);
Parameters
Base
Specifies the address of the beginning of the memory range to search for valid memory.
Size
Specifies the size, in bytes, of the memory range to search.
ValidBase
Receives the address of the beginning of the found valid memory.
ValidSize
Receives the size, in bytes, of the valid memory.
Return Value
S_OK
The method was successful.
This method can also return error values. See Return Values for more details.
Interface Version
GetValidRegionVirtual is available in IDebugDataSpaces4 and later versions.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetNextDifferentlyValidOffsetVirtual
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
IDebugRegisters
The IDebugRegisters interface includes the following methods:
GetDescription
GetIndexByName
GetFrameOffset
GetFrameOffset2
GetInstructionOffset
GetInstructionOffset2
GetStackOffset
GetStackOffset2
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetPseudoDescription
GetPseudoIndexByName
GetNumberPseudoRegisters
GetPseudoValues
SetPseudoValues
OutputRegisters
OutputRegisters2
GetNumberRegisters
GetValue
GetValues
GetValues2
SetValue
SetValues
SetValues2
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetDescription
The GetDescription and GetDescriptionWide methods return the description of a register.
HRESULT
IDebugRegisters::GetDescription(
IN ULONG Register
OUT OPTIONAL PSTR NameBuffer,
IN ULONG NameBufferSize,
OUT OPTIONAL PULONG NameSize,
OUT OPTIONAL PDEBUG_REGISTER_DESCRIPTION Desc
);
HRESULT
IDebugRegisters2::GetDescriptionWide(
IN ULONG Register
OUT OPTIONAL PWSTR NameBuffer,
IN ULONG NameBufferSize,
OUT OPTIONAL PULONG NameSize,
OUT OPTIONAL PDEBUG_REGISTER_DESCRIPTION Desc
);
#ifdef UNICODE
#define GetDescriptionT GetDescriptionWide
#else
#define GetDescriptionT GetDescription
#endif
Parameters
Register
Specifies the index of the register for which the description is requested.
NameBuffer
Specifies the buffer in which to store the name of the register. If NameBuffer is NULL, this information is not returned.
NameBufferSize
Specifies the size, in characters, of the buffer that NameBuffer specifies.
NameSize
Receives the size, in characters, of the register's name in NameBuffer buffer. If NameSize is NULL, this information is not returned.
Desc
Receives the description of the register. See DEBUG_REGISTER_DESCRIPTION for more details.
Return Value
S_OK
The method was successful.
S_FALSE
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The method was successful. However, the buffer was not large enough to hold the register's name, so it was truncated.
E_UNEXPECTED
No target machine has been specified, or a description of the register could not be found.
E_INVALIDARG
The index of the register requested is greater than the total number of registers on the target's machine.
This list does not contain all the errors that might occur. For a list of possible errors, see HRESULT Values.
Interface Version
GetDescription is available in all versions of IDebugRegisters. GetDescriptionWide is available in IDebugRegisters2 and later versions.
Comments
For an overview of the IDebugRegisters interface and other register-related methods, see Registers.
Requirements
Headers: Defined in DbgEng.h. Include DbgEng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetIndexByName
The GetIndexByName method returns the index of the named register.
HRESULT
IDebugRegisters::GetIndexByName(
IN PCSTR Name,
OUT PULONG Index
);
HRESULT
IDebugRegisters2::GetIndexByNameWide(
IN PCWSTR Name,
OUT PULONG Index
);
#ifdef UNICODE
#define GetIndexByNameT GetIndexByNameWide
#else
#define GetIndexByNameT GetIndexByName
#endif
Parameters
Name
Specifies the name of the register whose index is requested.
Index
Receives the index of the register.
Return Value
S_OK
The method was successful.
E_NOINTERFACE
The register was not found.
This list does not contain all the errors that might occur. For a list of possible errors, see HRESULT Values.
Interface Version
GetIndexByName is available in all versions of IDebugRegisters. GetIndexByNameWide is available in IDebugRegisters2 and later versions.
Comments
For an overview of the IDebugRegisters interface and other register-related methods, see Registers.
Requirements
Headers: Defined in DbgEng.h. Include DbgEng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetFrameOffset
The GetFrameOffset method returns the location of the stack frame for the current function.
HRESULT
IDebugRegisters::GetFrameOffset(
OUT PULONG64 Offset
);
Parameters
Offset
The location in the target's virtual address space of the stack frame for the current function.
Return Value
S_OK
The method was successful.
This list does not contain all the errors that might occur. For a list of possible errors, see HRESULT Values.
Interface Version
GetFrameOffset is available in all versions of IDebugRegisters.
Comments
The meaning of value returned by this method is architecture-specific.
The method GetFrameOffset2 performs the same task as this method but also allows the register source to be specified.
For an overview of the IDebugRegisters interface and other register-related methods, see Registers.
Requirements
Headers: Defined in DbgEng.h. Include DbgEng.h.
See Also
GetFrameOffset2
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetFrameOffset2
The GetFrameOffset2 method returns the location of the stack frame for the current function.
HRESULT
IDebugRegisters2::GetFrameOffset2(
IN ULONG Source,
OUT PULONG64 Offset
);
Parameters
Source
Specifies the register source to query.
The possible values are listed in the following table.
Value
Register source
DEBUG_REGSRC_DEBUGGEE Fetch register information from the target.
DEBUG_REGSRC_EXPLICIT Fetch register information from the current explicit register context.
DEBUG_REGSRC_FRAME
Fetch register information from the current scope's register context.
Note Stack unwinding does not guarantee accurate updating of the register context, so the scope frame's register context might not be
accurate in all cases.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Offset
The location in the process's virtual address space of the stack frame for the current function.
Return Value
S_OK
The method was successful.
This list does not contain all the errors that might occur. For a list of possible errors, see HRESULT Values.
Interface Version
GetFrameOffset2 is available in IDebugRegisters2 and later versions.
Comments
The meaning of the value that is returned by this method is architecture-specific.
The method GetFrameOffset performs the same task as this method but always uses the target as the register source.
For an overview of the IDebugRegisters interface and other register-related methods, see Registers.
Requirements
Headers: Defined in DbgEng.h. Include DbgEng.h.
See Also
GetFrameOffset
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetInstructionOffset
The GetInstructionOffset method returns the location of the current thread's current instruction.
HRESULT
IDebugRegisters::GetInstructionOffset(
OUT PULONG64 Offset
);
Parameters
Offset
Receives the location in the target's virtual address space of the target's current instruction.
Return Value
S_OK
The method was successful.
This list does not contain all the errors that might occur. For a list of possible errors, see HRESULT Values.
Interface Version
GetInstructionOffset is available in all versions of IDebugRegisters.
Comments
The meaning of the value returned by this method is architecture-dependent. In particular, for an Itanium processor, the virtual address returned can indicate an address within
a bundle.
The method GetInstructionOffset2 performs the same task as this method but also allows the register source to be specified.
For an overview of the IDebugRegisters interface and other register-related methods, see Registers.
Requirements
Headers: Defined in DbgEng.h. Include DbgEng.h.
See Also
GetInstructionOffset2
2009 Microsoft Corporation
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetInstructionOffset2
The GetInstructionOffset2 method returns the location of the current thread's current instruction.
HRESULT
IDebugRegisters2::GetInstructionOffset2(
IN ULONG Source,
OUT PULONG64 Offset
);
Parameters
Source
Specifies the register source to query.
The possible values are listed in the following table.
Value
Register source
DEBUG_REGSRC_DEBUGGEE Fetch register information from the target.
DEBUG_REGSRC_EXPLICIT Fetch register information from the current explicit register context.
DEBUG_REGSRC_FRAME
Fetch register information from the current scope's register context.
Note Stack unwinding does not guarantee accurate updating of the register context, so the scope frame's register context might not be
accurate in all cases.
Offset
Receives the location in the process's virtual address space of the current instruction of the current thread.
Return Value
S_OK
The method was successful.
This list does not contain all the errors that might occur. For a list of possible errors, see HRESULT Values.
Interface Version
GetInstructionOffset2 is available in IDebugRegisters2 and later versions.
Comments
The meaning of the value that is returned by this method is architecture-dependent. In particular, for an Itanium-based processor, the virtual address that is returned can
indicate an address within a bundle.
The method GetInstructionOffset performs the same task as this method but always uses the target as the register source.
For an overview of the IDebugRegisters interface and other register-related methods, see Registers.
Requirements
Headers: Defined in DbgEng.h. Include DbgEng.h.
See Also
GetInstructionOffset
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetStackOffset
The GetStackOffset method returns the current thread's current stack location.
HRESULT
IDebugRegisters::GetStackOffset(
OUT PULONG64 Offset
);
Parameters
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Offset
Receives the location in the process's virtual address space of the current thread's current stack location.
Return Value
S_OK
The method was successful.
This list does not contain all the errors that might occur. For a list of possible errors, see HRESULT Values.
Interface Version
GetStackOffset is available in all versions of IDebugRegisters.
Comments
The meaning of value returned by this method is architecture specific.
The method GetStackOffset2 performs the same task as this method but also allows the register source to be specified.
For an overview of the IDebugRegisters interface and other register-related methods, see Registers.
Requirements
Headers: Defined in DbgEng.h. Include DbgEng.h.
See Also
GetStackOffset2
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetStackOffset2
The GetStackOffset2 method returns the current thread's current stack location.
HRESULT
IDebugRegisters2::GetStackOffset2(
IN ULONG Source,
OUT PULONG64 Offset
);
Parameters
Source
Specifies the register source to query.
The possible values are listed in the following table.
Value
Register source
DEBUG_REGSRC_DEBUGGEE Fetch register information from the target.
DEBUG_REGSRC_EXPLICIT Fetch register information from the current explicit register context.
DEBUG_REGSRC_FRAME
Fetch register information from the current scope's register context.
Note Stack unwinding does not guarantee accurate updating of the register context, so the scope frame's register context might not be
accurate in all cases.
Offset
Receives the location in the process's virtual address space of the current thread's current stack.
Return Value
S_OK
The method was successful.
This list does not contain all the errors that might occur. For a list of possible errors, see HRESULT Values.
Interface Version
GetStackOffset2 is available in IDebugRegisters2 and later versions.
Requirements
Headers: Defined in DbgEng.h. Include DbgEng.h.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
See Also
GetStackOffset
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetPseudoDescription
The GetPseudoDescription and GetPseudoDescriptionWide methods return a description of a pseudo-register, including its name and type.
HRESULT
IDebugRegisters2::GetPseudoDescription(
IN ULONG Register,
OUT OPTIONAL PSTR NameBuffer,
IN ULONG NameBufferSize,
OUT OPTIONAL PULONG NameSize,
OUT OPTIONAL PULONG64 TypeModule,
OUT OPTIONAL PULONG TypeId
);
HRESULT
IDebugRegisters2::GetPseudoDescriptionWide(
IN ULONG Register,
OUT OPTIONAL PWSTR NameBuffer,
IN ULONG NameBufferSize,
OUT OPTIONAL PULONG NameSize,
OUT OPTIONAL PULONG64 TypeModule,
OUT OPTIONAL PULONG TypeId
);
#ifdef UNICODE
#define GetPseudoDescriptionT GetPseudoDescriptionWide
#else
#define GetPseudoDescriptionT GetPseudoDescription
#endif
Parameters
Register
Specifies the index of the pseudo-register whose description is requested. The index is always between zero and the number of pseudo-registers (returned by
GetNumberPseudoRegisters) minus one.
NameBuffer
Receives the name of the pseudo-register. If NameBuffer is NULL, this information is not returned.
NameBufferSize
Specifies the size, in characters, of the buffer that NameBuffer specifies.
NameSize
Receives the size in characters of the name of the pseudo-register. If NameSize is NULL, this information is not returned.
TypeModule
Receives the base address of the module to which the register's type belongs. If the type of the register is not known, zero is returned. If TypeModule is NULL, no
information is returned.
TypeId
Receives the type ID of the type within the module returned in TypeModule. If the type ID is not known, zero is returned. If TypeId is NULL, no information is returned.
Return Value
S_OK
The method was successful.
E_FAIL
The description for the register was not available
This list does not contain all the errors that might occur. For a list of possible errors, see HRESULT Values.
Interface Version
GetPseudoDescription and GetPseudoDescriptionWide are available in IDebugRegisters2 and later versions.
Comments
Descriptions are not always available for all registers. If a pseudo-register does not have a value - for example, $eventip will not have a value before an event has
occurred - or a type cannot be determined for a pseudo-register, this method will return E_FAIL.
For an overview of the IDebugRegisters interface and other register-related methods, see Registers.
Requirements
Headers: Defined in DbgEng.h. Include DbgEng.h.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
See Also
GetNumberPseudoRegisters, GetPseudoIndexByName
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetPseudoIndexByName
The GetPseudoIndexByName and GetPseudoIndexByNameWide methods return the index of a pseudo-register.
HRESULT
IDebugRegisters2::GetPseudoIndexByName(
IN PCSTR Name,
OUT PULONG Index
);
HRESULT
IDebugRegisters2::GetPseudoIndexByNameWide(
IN PCWSTR Name,
OUT PULONG Index
);
#ifdef UNICODE
#define GetPseudoIndexByNameT GetPseudoIndexByNameWide
#else
#define GetPseudoIndexByNameT GetPseudoIndexByName
#endif
Parameters
Name
Specifies the name of the pseudo-register whose index is requested. The name includes the leading dollar sign ( $ ), for example, "$frame".
Index
Receives the index of the pseudo-register.
Return Value
S_OK
The method was successful.
This list does not contain all the errors that might occur. For a list of possible errors, see HRESULT Values.
Interface Version
GetPseudoIndexByName and GetPseudoIndexByNameWide are available in IDebugRegisters2 and later versions.
Comments
For the names of all the pseudo-registers, see Pseudo-Register Syntax.
For an overview of the IDebugRegisters interface and other register-related methods, see Registers.
Requirements
Headers: Defined in DbgEng.h. Include DbgEng.h.
See Also
GetPseudoDescription
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetNumberPseudoRegisters
The GetNumberPseudoRegisters method returns the number of pseudo-registers that are maintained by the debugger engine.
HRESULT
IDebugRegisters2::GetNumberPseudoRegisters(
OUT PULONG Number
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
);
Parameters
Number
Receives the number of pseudo-registers that are maintained by the debugger engine.
Return Value
S_OK
The method was successful.
This list does not contain all the errors that might occur. For a list of possible errors, see HRESULT Values.
Interface Version
GetNumberPseudoRegisters are available in IDebugRegisters2 and later versions.
Comments
Not all of the pseudo-registers are available in all debugging sessions or at all times in a particular session.
The valid indices for pseudo-registers are between zero and the number of pseudo-registers, minus one.
For an overview of the IDebugRegisters interface and other register-related methods, see Registers.
Requirements
Headers: Defined in DbgEng.h. Include DbgEng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetPseudoValues
The GetPseudoValues method returns the values of a number of pseudo-registers.
HRESULT
IDebugRegisters2::GetPseudoValues(
IN ULONG Source,
IN ULONG Count,
IN OPTIONAL PULONG Indices,
IN ULONG Start,
OUT PDEBUG_VALUE Values
);
Parameters
Source
Specifies the register source to query.
The possible values are listed in the following table.
Value
Register source
DEBUG_REGSRC_DEBUGGEE Fetch register information from the target.
DEBUG_REGSRC_EXPLICIT Fetch register information from the current explicit register context.
DEBUG_REGSRC_FRAME
Fetch register information from the current scope's register context.
Note Stack unwinding does not guarantee accurate updating of the register context, so the scope frame's register context might not be
accurate in all cases.
Count
Specifies the number of pseudo-registers whose values are being requested.
Indices
Specifies an array of indices of pseudo-registers whose values will be returned. The size of Indices is Count. If Indices is NULL, Start is used to specify the indices
instead.
Start
Specifies the index of the first pseudo-register whose value will be returned. The pseudo-registers, with indices between Start and Start plus Count minus one, will be
returned. Start is only used if Indices is NULL.
Values
Receives the values of the specified pseudo-registers. The number of elements that this array holds is Count. See DEBUG_VALUE for a description of this parameter
type.
Return Value
S_OK
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
SetPseudoValues
The SetPseudoValues method sets the value of several pseudo-registers.
HRESULT
IDebugRegisters2::SetPseudoValues(
IN ULONG Source,
IN ULONG Count,
IN OPTIONAL PULONG Indices,
IN ULONG Start,
IN PDEBUG_VALUE Values
);
Parameters
Source
Specifies the register source to query.
The possible values are listed in the following table.
Value
Register source
DEBUG_REGSRC_DEBUGGEE Fetch register information from the target.
DEBUG_REGSRC_EXPLICIT Fetch register information from the current explicit register context.
DEBUG_REGSRC_FRAME
Fetch register information from the current scope's register context.
Note Stack unwinding does not guarantee accurate updating of the register context, so the scope frame's register context might not be
accurate in all cases.
Count
Specifies the number of pseudo-registers whose values are being set.
Indices
Specifies an array of indices of pseudo-registers. These are the pseudo-registers whose values will be set. The size of Indices is Count. If Indices is NULL, Start is used
to specify the indices instead.
Start
Specifies the index of the first pseudo-register whose value will be set. The pseudo-registers with indices between Start and Start plus Count minus one, will be set. Start
is only used if Indices is NULL.
Values
Specifies the new values of the pseudo-registers. The number of elements this array holds is Count. See DEBUG_VALUE for a description of this parameter type.
Return Value
S_OK
The method was successful.
This list does not contain all the errors that might occur. For a list of possible errors, see HRESULT Values.
Interface Version
SetPseudoValues is available in IDebugRegisters2 and later versions.
Comments
For an overview of the IDebugRegisters interface and other register-related methods, see Registers.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Requirements
Headers: Defined in DbgEng.h. Include DbgEng.h.
See Also
GetPseudoValues
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
OutputRegisters
The OutputRegisters method formats and sends the target's registers to the clients as output.
HRESULT
IDebugRegisters::OutputRegisters(
IN ULONG OutputControl,
IN ULONG Flags
);
Parameters
OutputControl
Specifies which clients should be sent the output of the formatted registers. See DEBUG_OUTCTL_XXX for possible values.
Flags
Specifies which set of registers to print. This can either be DEBUG_REGISTERS_DEFAULT to print commonly used registers, DEBUG_REGISTERS_ALL to print all
the sets of registers, or a combination of the values listed in the following table.
Value
Description
DEBUG_REGISTERS_INT32 Print the 32-bit register set.
DEBUG_REGISTERS_INT64 Print the 64-bit register set.
DEBUG_REGISTERS_FLOAT Print the floating-point register set.
Return Value
S_OK
The method was successful.
This list does not contain all the errors that might occur. For a list of possible errors, see HRESULT Values.
Interface Version
OutputRegisters is available in all versions of IDebugRegisters.
Comments
The registers are formatted in a way that is specific to the target architecture's register set.
The method OutputRegisters2 performs the same task as this method but also allows the register source to be specified.
For an overview of the IDebugRegisters interface and other register-related methods, see Registers. For details on sending output to the clients, see Input and Output.
Requirements
Headers: Defined in DbgEng.h. Include DbgEng.h.
See Also
OutputRegisters2
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
OutputRegisters2
The OutputRegisters2 method formats and outputs the target's registers.
HRESULT
IDebugRegisters2::OutputRegisters2(
IN ULONG OutputControl,
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
IN ULONG
IN ULONG
);
Source,
Flags
Parameters
OutputControl
Specifies which clients should be sent the output of the formatted registers. See DEBUG_OUTCTL_XXX for possible values.
Source
Specifies the register source to query.
The possible values are listed in the following table.
Value
Register source
DEBUG_REGSRC_DEBUGGEE Fetch register information from the target.
DEBUG_REGSRC_EXPLICIT Fetch register information from the current explicit register context.
DEBUG_REGSRC_FRAME
Fetch register information from the current scope's register context.
Note Stack unwinding does not guarantee accurate updating of the register context, so the scope frame's register context might not be
accurate in all cases.
Flags
Specifies which register sets to print. This can either be DEBUG_REGISTERS_DEFAULT to print commonly used registers, DEBUG_REGISTERS_ALL to print all of
the register sets, or a combination of the values listed in the following table.
Value
Description
DEBUG_REGISTERS_INT32 Print the 32-bit register set.
DEBUG_REGISTERS_INT64 Print the 64-bit register set.
DEBUG_REGISTERS_FLOAT Print the floating-point register set.
Return Value
S_OK
The method was successful.
This list does not contain all the errors that might occur. For a list of possible errors, see HRESULT Values.
Interface Version
OutputRegisters2 is available in IDebugRegisters2 and later versions.
Comments
The registers are formatted in a way that is specific to the target architecture's register set.
The method OutputRegisters performs the same task as this method but always uses the target as the register source.
For an overview of the IDebugRegisters interface and other register-related methods, see Registers.
Requirements
Headers: Defined in DbgEng.h. Include DbgEng.h.
See Also
OutputRegisters
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetNumberRegisters
The GetNumberRegisters method returns the number of registers on the target computer.
HRESULT
IDebugRegisters::GetNumberRegisters(
OUT PULONG Number
);
Parameters
Number
Receives the number of registers on the target's computer.
Return Value
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
S_OK
The method was successful.
This list does not contain all the errors that might occur. For a list of possible errors, see HRESULT Values.
Interface Version
GetNumberRegisters is available in all versions of IDebugRegisters.
Comments
For an overview of the IDebugRegisters interface and other register-related methods, see Registers.
Requirements
Headers: Defined in DbgEng.h. Include DbgEng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetValue
The GetValue method gets the value of one of the target's registers.
HRESULT
IDebugRegisters::GetValue(
IN ULONG Register,
OUT PDEBUG_VALUE Value
);
Parameters
Register
Specifies the index of the register whose value is requested.
Value
Receives the value of the register. See DEBUG_VALUE for a description of this parameter type.
Return Value
S_OK
The method was successful.
E_UNEXPECTED
The target is not accessible, or the register could not be accessed.
E_INVALIDARG
The value of Register is greater than the number of registers on the target machine.
This list does not contain all the errors that might occur. For a list of possible errors, see HRESULT Values.
Interface Version
GetValue is available in all versions of IDebugRegisters.
Comments
To receive the values of multiple registers, use the GetValues method instead.
For an overview of the IDebugRegisters interface and other register-related methods, see Registers.
Requirements
Headers: Defined in DbgEng.h. Include DbgEng.h.
See Also
GetValues, GetValues2
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetValues
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The GetValues method gets the value of several of the target's registers.
HRESULT
IDebugRegisters::GetValues(
IN ULONG Count,
IN OPTIONAL PULONG Indices,
IN ULONG Start,
OUT PDEBUG_VALUE Values
);
Parameters
Count
Specifies the number of registers whose values are requested.
Indices
Specifies an array that contains the indices of the registers from which to get the values. The number of elements in this array is Count. If Indices is NULL, Start is used
instead.
Start
If Indices is NULL, the registers will be read consecutively starting at this index. Otherwise it is ignored.
Values
Receives the values of the registers. The number of elements this array holds is Count. See DEBUG_VALUE for a description of this parameter type.
Return Value
S_OK
The method was successful.
E_UNEXPECTED
The target is not accessible, or one of the registers could not be accessed.
E_INVALIDARG
The value of the index of one of the registers is greater than the number of registers on the target machine. Partial results might have been obtained; those registers that
could not be read will have the type DEBUG_VALUE_INVALID.
This list does not contain all the errors that might occur. For a list of possible errors, see HRESULT Values.
Interface Version
GetValues is available in all versions of IDebugRegisters.
Comments
GetValues gets the value of several of the target's registers.
If the return value is not S_OK, some of the registers still might have been read. If the target was not accessible, the return type is E_UNEXPECTED and Values is
unchanged; otherwise, Values will contain partial results and the registers that could not be read will have type DEBUG_VALUE_INVALID. Ambiguity in the case of the
return value E_UNEXPECTED can be avoided by setting the memory of Values to zero before calling this method.
To receive the value of only a single register, use the GetValue method instead.
The method GetValues2 performs the same task as this method but also allows the register source to be specified.
For an overview of the IDebugRegisters interface and other register-related methods, see Registers.
Requirements
Headers: Defined in DbgEng.h. Include DbgEng.h.
See Also
GetValue, GetValues2
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetValues2
The GetValues2 method fetches the value of several of the target's registers.
HRESULT
IDebugRegisters2::GetValues2(
IN ULONG Source,
IN ULONG Count,
IN PULONG Indices,
IN ULONG Start,
OUT PDEBUG_VALUE Values
);
Parameters
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Source
Specifies the register source to query.
The possible values are listed in the following table.
Value
Register source
DEBUG_REGSRC_DEBUGGEE Fetch register information from the target.
DEBUG_REGSRC_EXPLICIT Fetch register information from the current explicit register context.
DEBUG_REGSRC_FRAME
Fetch register information from the current scope's register context.
Note Stack unwinding does not guarantee accurate updating of the register context, so the scope frame's register context might not be
accurate in all cases.
Count
Specifies the number of registers whose values are requested.
Indices
Specifies an array that contains the indices of the registers from which to get the values. The number of elements in this array is Count. If Indices is NULL, Start is used
instead.
Start
If Indices is NULL, the registers will be read consecutively starting at this index. Otherwise, it is ignored.
Values
Receives the values of the registers. The number of elements that this array holds is Count. See DEBUG_VALUE for a description of this parameter type.
Return Value
S_OK
The method was successful.
E_INVALIDARG
The value of the index of one of the registers is greater than the number of registers on the target computer. Partial results might have been obtained; those registers that
could not be read will have the type DEBUG_VALUE_INVALID.
This list does not contain all the erros that might occur. For a list of possible errors, see HRESULT Values.
Interface Version
GetValues2 is available in IDebugRegisters2 and later versions.
Comments
If the return value is not S_OK, some of the registers still might have been read. If the target was not accessible, the return type is E_UNEXPECTED and Values is
unchanged. Otherwise, Values will contain partial results and the registers that could not be read will have type DEBUG_VALUE_INVALID. Ambiguity in the case of the
return value E_UNEXPECTED can be avoided by setting the memory of Values to zero before calling this method.
The method GetValues performs the same task as this method but always uses the target as the register source.
For an overview of the IDebugRegisters interface and other register-related methods, see Registers.
Requirements
Headers: Defined in DbgEng.h. Include DbgEng.h.
See Also
GetValue, GetValues
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SetValue
The SetValue method sets the value of one of the target's registers.
HRESULT
IDebugRegisters::GetValue(
IN ULONG Register,
IN PDEBUG_VALUE Value
);
Parameters
Register
Specifies the index of the register whose value is to be set.
Value
Specifies the value to which to set the register. See DEBUG_VALUE for a description of this parameter type.
Return Value
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
S_OK
The method was successful.
E_UNEXPECTED
The target is not accessible, or the register could not be accessed.
E_INVALIDARG
The value of Register is greater than the number of registers on the target machine.
This list does not contain all the errors that might occur. For a list of possible errors, see HRESULT Values.
Interface Version
SetValue is available in all versions of IDebugRegisters.
Comments
The engine does its best to coerce the value of Value into the type of the register; this coercion is the same as that performed by CoerceValue. If the value is larger than what
the register can hold, the least significant bits are dropped. Floating-point and integer conversions will also be performed if necessary.
When a subregister is altered, the register containing it is also altered.
To set the values of multiple registers, use the SetValues method instead.
For an overview of the IDebugRegisters interface and other register-related methods, see Registers.
Requirements
Headers: Defined in DbgEng.h. Include DbgEng.h.
See Also
SetValues, SetValues2
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SetValues
The SetValues method sets the value of several of the target's registers.
HRESULT
IDebugRegisters::SetValues(
IN ULONG Count,
IN OPTIONAL PULONG Indices,
IN ULONG Start,
IN PDEBUG_VALUE Values
);
Parameters
Count
Specifies the number of registers for which to set the values.
Indices
Specifies an array that contains the indices of the registers for which to set the values. The number of elements in this array is Count. If Indices is NULL, Start is used
instead.
Start
If Indices is NULL, the registers will be set consecutively starting at this index. Otherwise it is ignored.
Values
Specifies the array that contains values to which to set the registers. The number of elements this array holds is Count. See DEBUG_VALUE for a description of this
parameter type.
Return Value
S_OK
The method was successful.
E_UNEXPECTED
The target is not accessible, or one or more of the registers could not be accessed.
E_INVALIDARG
The value of the index of one or more of the registers is greater than the number of registers on the target machine.
This list does not contain all the errors that might occur. For a list of possible errors, see HRESULT Values.
Interface Version
SetValues is available in all versions of IDebugRegisters.
Comments
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The engine does its best to coerce the values in Values into the type of the registers; this coercion is the same as that performed by CoerceValue. If the value is larger than
what the register can hold, the least significant bits are dropped. Floating-point and integer conversions will also be performed if necessary.
If the return value is not S_OK, some of the registers still might have been set.
When a subregister is altered, the register containing it is also altered.
To set the value of only a single register, use the SetValue method instead.
The method SetValues2 performs the same task as this method but also allows the register source to be specified.
For an overview of the IDebugRegisters interface and other register-related methods, see Registers.
Requirements
Headers: Defined in DbgEng.h. Include DbgEng.h.
See Also
SetValue, SetValues2
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SetValues2
The SetValues2 method sets the value of several of the target's registers.
HRESULT
IDebugRegisters2::SetValues2(
IN ULONG Source,
IN ULONG Count,
IN PULONG Indices,
IN ULONG Start,
IN PDEBUG_VALUE Values
);
Parameters
Source
Specifies the register source to query.
The possible values are listed in the following table.
Value
Register source
DEBUG_REGSRC_DEBUGGEE Fetch register information from the target.
DEBUG_REGSRC_EXPLICIT Fetch register information from the current explicit register context.
DEBUG_REGSRC_FRAME
Fetch register information from the current scope's register context.
Note Stack unwinding does not guarantee accurate updating of the register context, so the scope frame's register context might not be
accurate in all cases.
Count
Specifies the number of registers for which to set the values.
Indices
Specifies an array that contains the indices of the registers for which to set the values. The number of elements in this array is Count. If Indices is NULL, Start is used
instead.
Start
If Indices is NULL, the registers will be set consecutively starting at this index. Otherwise, it is ignored.
Values
An array that contains the values to which to set the registers. The number of elements that this array holds is Count. See DEBUG_VALUE for a description of this
parameter type.
Return Value
S_OK
The method was successful.
This list does not contain all the errors that might occur. For a list of possible errors, see HRESULT Values.
Interface Version
SetValues2 is available in IDebugRegisters2 and later versions.
Comments
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The engine does its best to cast the values in Values into the type of the registers; this conversion is the same as that performed by CoerceValue. If the value is larger than
what the register can hold, the least significant bits are dropped. Floating-point and integer conversions will also be performed if necessary.
If the return value is not S_OK, some of the registers still might have been set.
When a subregister is altered, the register that contains it is also altered.
The method SetValues performs the same task as this method but always uses the target as the register source.
For an overview of the IDebugRegisters interface and other register-related methods, see Registers.
Requirements
Headers: Defined in DbgEng.h. Include DbgEng.h.
See Also
SetValue, SetValues
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
IDebugSymbols
The IDebugSymbols interface includes the following methods:
GetConstantName
ReadTypedDataPhysical
OutputTypedDataPhysical
WriteTypedDataPhysical
ReadTypedDataVirtual
OutputTypedDataVirtual
WriteTypedDataVirtual
GetFieldName
GetFieldOffset
GetFieldTypeAndOffset
GetFunctionEntryByOffset
AppendImagePath
GetImagePath
SetImagePath
GetLineByOffset
GetOffsetByLine
IsManagedModule
GetModuleByIndex
GetModuleByModuleName
GetModuleByModuleName2
GetModuleNames
GetModuleNameString
GetNumberModules
GetModuleByOffset
GetModuleByOffset2
GetModuleParameters
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
AddSyntheticModule
RemoveSyntheticModule
GetModuleVersionInformation
GetNameByOffset
GetNearNameByOffset
GetOffsetByName
Reload
GetScope
ResetScope
SetScope
SetScopeFrameByIndex
GetCurrentScopeFrameIndex
SetScopeFromJitDebugInfo
SetScopeFromStoredEvent
GetScopeSymbolGroup
FindSourceFile
GetSourceFileLineOffsets
AppendSourcePath
GetSourcePath
SetSourcePath
GetSourcePathElement
GetSourceEntriesByLine
GetSourceEntriesByOffset
GetSourceEntryOffsetRegions
GetSourceEntryBySourceEntry
GetSourceEntryString
GetSymbolEntryInformation
GetSymbolEntriesByName
GetSymbolEntriesByOffset
GetSymbolEntryOffsetRegions
GetSymbolEntryString
GetSymbolEntryBySymbolEntry
GetSymbolEntryByToken
CreateSymbolGroup
EndSymbolMatch
GetNextSymbolMatch
StartSymbolMatch
GetSymbolModule
OutputSymbolByOffset
AddSymbolOptions
GetSymbolOptions
RemoveSymbolOptions
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
SetSymbolOptions
AppendSymbolPath
GetSymbolPath
SetSymbolPath
AddSyntheticSymbol
RemoveSyntheticSymbol
GetTypeId
GetOffsetTypeId
GetSymbolTypeId
GetTypeName
GetTypeSize
AddTypeOptions
GetTypeOptions
RemoveTypeOptions
SetTypeOptions
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetConstantName
The GetConstantName and GetConstantNameWide methods return the name of the specified constant.
HRESULT
IDebugSymbols2::GetConstantName(
IN ULONG64 Module,
IN ULONG TypeId,
IN ULONG64 Value,
OUT OPTIONAL PSTR NameBuffer,
IN ULONG NameBufferSize,
OUT OPTIONAL PULONG NameSize
);
HRESULT
IDebugSymbols3::GetConstantName(
IN ULONG64 Module,
IN ULONG TypeId,
IN ULONG64 Value,
OUT OPTIONAL PWSTR NameBuffer,
IN ULONG NameBufferSize,
OUT OPTIONAL PULONG NameSize
);
#ifdef UNICODE
#define GetConstantNameT GetConstantNameWide
#else
#define GetConstantNameT GetConstantName
#endif
Parameters
Module
Specifies the base address of the module in which the constant was defined.
TypeId
Specifies the type ID of the constant.
Value
Specifies the value of the constant.
NameBuffer
Receives the constant's name. If NameBuffer is NULL, this information is not returned.
NameBufferSize
Specifies the size in characters of the buffer NameBuffer.
NameSize
Receives the size in characters of the constant's name.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Return Value
S_OK
The method was successful.
S_FALSE
The method was successful. However, the buffer was not large enough for the constant's name and it was truncated.
This method may also return error values. See Return Values for more details.
Interface Version
GetConstantName is available in IDebugSymbols2 and later versions. GetConstantNameWide is available in IDebugSymbols and later versions.
Comments
For more information about symbols, see Symbols.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ReadTypedDataPhysical
The ReadTypedDataPhysical method reads the value of a variable from the target computer's physical memory.
HRESULT
IDebugSymbols::ReadTypedDataPhysical(
IN ULONG64 Offset,
IN ULONG64 Module,
IN ULONG TypeId,
OUT PVOID Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG BytesRead
);
Parameters
Offset
Specifies the physical address in the target computer's memory of the variable to be read.
Module
Specifies the base address of the module containing the type of the variable.
TypeId
Specifies the type ID of the type of the variable.
Buffer
Receives the data that was read.
BufferSize
Specifies the size in bytes of the buffer Buffer. This is the maximum number of bytes that will be read.
BytesRead
Receives the number of bytes that were read. If BytesRead is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
S_FALSE
The method was successful. However, the buffer Buffer was not large enough to hold all the data and it was truncated.
This method may also return error values. See Return Values for more details.
Interface Version
ReadTypedDataPhysical is available in all versions of IDebugSymbols.
Comments
This method is only available in kernel mode debugging.
The number of bytes this method attempts to read is the smaller of the size of the buffer and the size of the variable.
This is a convenience method. The same result can be obtained by calling GetTypeSize and ReadPhysical.
For more information about types, see Types.
Requirements
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
OutputTypedDataPhysical
The OutputTypedDataPhysical method formats the contents of a variable in the target computer's physical memory, and then sends this to the output callbacks.
HRESULT
IDebugSymbols::OutputTypedDataPhysical(
IN ULONG OutputControl,
IN ULONG64 Offset,
IN ULONG64 Module,
IN ULONG TypeId,
IN ULONG Flags
);
Parameters
OutputControl
Specifies the output control used to determine which output callbacks can receive the output. See DEBUG_OUTCTL_XXX for possible values.
Offset
Specifies the physical address in the target computer's memory of the variable.
Module
Specifies the base address of the module containing the type of the variable.
TypeId
Specifies the type ID of the type of the variable.
Flags
Specifies the bit-set containing the formatting options. See DEBUG_TYPEOPTS_XXX for possible values.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
OutputTypedDataPhysical is available in all versions of IDebugSymbols.
Comments
This method is only available in kernel mode debugging.
The output produced by this method is the same as for the debugger command DT. See dt (Display Type).
For more information about types, see Types. For information about output, see Input and Output.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
WriteTypedDataPhysical
The WriteTypedDataPhysical method writes the value of a variable in the target computer's physical memory.
HRESULT
IDebugSymbols::WriteTypedDataPhysical(
IN ULONG64 Offset,
IN ULONG64 Module,
IN ULONG TypeId,
IN PVOID Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG BytesWritten
);
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Parameters
Offset
Specifies the physical address in the target computer's memory of the variable.
Module
Specifies the base address of the module containing the type of the variable.
TypeId
Specifies the type ID of the type of the variable.
Buffer
Specifies the buffer containing the data to be written.
BufferSize
Specifies the size in bytes of the buffer Buffer. This is the maximum number of bytes to be written.
BytesWritten
Receives the number of bytes that were written. If BytesWritten is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
S_FALSE
The method was successful. All the bytes in the buffer Buffer were written. However, the buffer was smaller than the size of the specified type.
This method may also return error values. See Return Values for more details.
Interface Version
WriteTypedDataPhysical is available in all versions of IDebugSymbols.
Comments
This method is only available in kernel mode debugging.
The number of bytes this method attempts to write is the smaller of the size of the buffer and the size of the variable.
This is a convenience method. The same result can be obtained by calling GetTypeSize and WritePhysical.
For more information about types, see Types.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ReadTypedDataVirtual
The ReadTypedDataVirtual method reads the value of a variable in the target's virtual memory.
HRESULT
IDebugSymbols::ReadTypedDataVirtual(
IN ULONG64 Offset,
IN ULONG64 Module,
IN ULONG TypeId,
OUT PVOID Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG BytesRead
);
Parameters
Offset
Specifies the location in the target's virtual address space of the variable to read.
Module
Specifies the base address of the module containing the type of the variable.
TypeId
Specifies the type ID of the type.
Buffer
Receives the data that is read.
BufferSize
Specifies the size in bytes of the buffer Buffer. This is the maximum number of bytes to be read.
BytesRead
Receives the number of bytes that were read. If BytesRead is NULL, this information is not returned.
Return Value
S_OK
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
OutputTypedDataVirtual
The OutputTypedDataVirtual method formats the contents of a variable in the target's virtual memory, and then sends this to the output callbacks.
HRESULT
IDebugSymbols::OutputTypedDataVirtual(
IN ULONG OutputControl,
IN ULONG64 Offset,
IN ULONG64 Module,
IN ULONG TypeId,
IN ULONG Flags
);
Parameters
OutputControl
Specifies the output control used to determine which output callbacks can receive the output. See DEBUG_OUTCTL_XXX for possible values.
Offset
Specifies the location in the target's virtual address space of the variable.
Module
Specifies the base address of the module containing the type.
TypeId
Specifies the type ID of the type.
Flags
Specifies the formatting flags. See DEBUG_TYPEOPTS_XXX for possible values.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
OutputTypedDataVirtual is available in all versions of IDebugSymbols.
Comments
The output produced by this method is the same as for the debugger command DT. See dt (Display Type).
For more information about types, see Types. For more information about output, see Input and Output.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
WriteTypedDataVirtual
The WriteTypedDataVirtual method writes data to the target's virtual address space. The number of bytes written is the size of the specified type.
HRESULT
IDebugSymbols::WriteTypedDataVirtual(
IN ULONG64 Offset,
IN ULONG64 Module,
IN ULONG TypeId,
IN PVOID Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG BytesWritten
);
Parameters
Offset
Specifies the location in the target's virtual address space where the data will be written.
Module
Specifies the base address of the module containing the type.
TypeId
Specifies the type ID of the type.
Buffer
Specifies the buffer containing the data to be written.
BufferSize
Specifies the size in bytes of the buffer Buffer. This is the maximum number of bytes to be written.
BytesWritten
Receives the number of bytes that were written. If BytesWritten is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
S_FALSE
The method was successful. All the bytes in the buffer Buffer were written. However, the buffer was smaller than the size of the type specified.
This method may also return error values. See Return Values for more details.
Interface Version
WriteTypedDataVirtual is available in all versions of IDebugSymbols.
Comments
This is a convenience method. The same result can be obtained by calling GetTypeSize and WriteVirtual.
For more information about types, see Types.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetFieldName
The GetFieldName and GetFieldNameWide methods return the name of a field within a structure.
HRESULT
IDebugSymbols2::GetFieldName(
IN ULONG64 Module,
IN ULONG TypeId,
IN ULONG FieldIndex,
OUT OPTIONAL PSTR NameBuffer,
IN ULONG NameBufferSize,
OUT OPTIONAL PULONG NameSize
);
HRESULT
IDebugSymbols3::GetFieldNameWide(
IN ULONG64 Module,
IN ULONG TypeId,
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
IN ULONG FieldIndex,
OUT OPTIONAL PSTR NameBuffer,
IN ULONG NameBufferSize,
OUT OPTIONAL PULONG NameSize
);
#ifdef UNICODE
#define GetFieldNameT GetFieldNameWide
#else
#define GetFieldNameT GetFieldName
#endif
Parameters
Module
Specifies the base address of the module in which the structure was defined.
TypeId
Specifies the type ID of the structure.
FieldIndex
Specifies the index of the desired field within the structure.
NameBuffer
Receives the field's name. If NameBuffer is NULL, this information is not returned.
NameBufferSize
Specifies the size in characters of the buffer NameBuffer.
NameSize
Receives the size in characters of the field's name. If NameSize is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
S_FALSE
The method was successful. However, NameBuffer was not large enough to hold the field's name and it was truncated.
This method may also return error values. See Return Values for more details.
Interface Version
GetFieldName is available in IDebugSymbols2 and later versions. GetFieldNameWide is available in IDebugSymbols and later versions.
Comments
For more information about symbols, see Symbols.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetFieldOffset
The GetFieldOffset and GetFieldOffsetWide methods return the offset of a field from the base address of an instance of a type.
HRESULT
IDebugSymbols::GetFieldOffset(
IN ULONG64 Module,
IN ULONG TypeId,
IN PCSTR Field,
OUT PULONG Offset
);
HRESULT
IDebugSymbols3::GetFieldOffsetWide(
IN ULONG64 Module,
IN ULONG TypeId,
IN PCWSTR Field,
OUT PULONG Offset
);
#ifdef UNICODE
#define GetFieldOffsetT GetFieldOffsetWide
#else
#define GetFieldOffsetT GetFieldOffset
#endif
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Parameters
Module
Specifies the module containing the types of both the container and the field.
TypeId
Specifies the type ID of the type containing the field.
Field
Specifies the name of the field whose offset is requested. Subfields may be specified by using a dot-separated path.
Offset
Receives the offset of the specified field from the base memory location of an instance of the type.
Return Value
S_OK
The method was successful.
E_NOINTERFACE
The field Field could not be found in the type specified by TypeId.
This method may also return error values. See Return Values for more details.
Interface Version
GetFieldOffset is available in all versions of IDebugSymbols. GetFieldOffsetWide is available in IDebugSymbols3 and later versions.
Comments
An example of a dot-separated path for the Field parameter is as follows. Suppose the MyStruct structure contains a field MyField of type MySubStruct, and the MySubStruct
structure contains the field MySubField. Then the location of this field relative to the location of MyStruct structure can be found by setting the Field parameter to
"MyField.MySubField".
For more information about types, see Types.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetFieldTypeAndOffset
The GetFieldTypeAndOffset and GetFieldTypeAndOffsetWide methods return the type of a field and its offset within a container.
IDebugSymbols3::GetFieldTypeAndOffset(
IN ULONG64 Module,
IN ULONG ContainerTypeId,
IN PCSTR Field,
OUT OPTIONAL PULONG FieldTypeId,
OUT OPTIONAL PULONG Offset
);
IDebugSymbols3::GetFieldTypeAndOffsetWide(
IN ULONG64 Module,
IN ULONG ContainerTypeId,
IN PCWSTR Field,
OUT OPTIONAL PULONG FieldTypeId,
OUT OPTIONAL PULONG Offset
);
#ifdef UNICODE
#define GetFieldTypeAndOffsetT GetFieldTypeAndOffsetWide
#else
#define GetFieldTypeAndOffsetT GetFieldTypeAndOffset
#endif
Parameters
Module
Specifies the module containing the types of both the container and the field.
ContainerTypeId
Specifies the type ID for the container's type. Examples of containers include structures, unions, and classes.
Field
Specifies the name of the field whose type and offset are requested. Subfields may be specified by using a dot-separated path.
FieldTypeId
Receives the type ID of the field.
Offset
Receives the offset of the field Field from the base memory location of an instance of the container.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Return Value
S_OK
The method was successful.
E_NOINTERFACE
The field Field could not be found in the type specified by ContainerTypeId.
This method may also return error values. See Return Values for more details.
Interface Version
GetFieldTypeAndOffset and GetFieldTypeAndOffsetWide are available in IDebugSymbols3 and later versions.
Comments
An example of a dot-separated path for the Field parameter is as follows. Suppose the MyStruct structure contains a field MyField of type MySubStruct, and the MySubStruct
structure contains the field MySubField. Then the type of this field and its location relative to the location of MyStruct structure can be found by passing
"MyField.MySubField" as the Field parameter to this method.
For more information about types, see Types. For more information about symbols, see Symbols.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetFieldOffset, GetTypeId
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetFunctionEntryByOffset
The GetFunctionEntryByOffset method returns the function entry information for a function.
HRESULT
IDebugSymbols3::GetFunctionEntryByOffset(
IN ULONG64 Offset,
IN ULONG Flags,
OUT OPTIONAL PVOID Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG BufferNeeded
);
Parameters
Offset
Specifies a location in the current process's virtual address space of the function's implementation. This is the value returned in the Offset parameter of
GetNextSymbolMatch and IDebugSymbolGroup::GetSymbolOffset, and the value of the Offset field in the DEBUG_SYMBOL_ENTRY structure.
Flags
Specifies a bit-flag which alters the behavior of this method. If the bit DEBUG_GETFNENT_RAW_ENTRY_ONLY is not set, the engine will provide artificial entries
for well known cases. If this bit is set the artificial entries are not used.
Buffer
Receives the function entry information. If the effective processor is an x86, this is the FPO_DATA structure for the function. For all other architectures, this is the
IMAGE_FUNCTION_ENTRY structure for that architecture.
BufferSize
Specifies the size of the buffer Buffer.
BufferNeeded
Specifies the size of the function entry information.
Return Value
S_OK
The method was successful.
S_FALSE
The method was successful, but the buffer was not large enough to hold the function entry information and so the information was truncated to fit.
E_NOINTERFACE
No function entry information was found for the location Offset.
This method may also return error values. See Return Values for more details.
Interface Version
GetFunctionEntryByOffset is available in IDebugSymbols3 and later versions.
Comments
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The structures FPO_DATA and IMAGE_FUNCTION_ENTRY are documented in "Image Help Library" which is included in Debugging Tools For Windows in the
DbgHelp.chm file.
Note The functions in "Image Help Library" and "Debug Help Library", documented in DbgHelp.chm, should not be called by any extension or debugger engine application.
For more information about symbols, see Symbols.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h. FPO_DATA and IMAGE_FUNCTION_ENTRY are defined in Winnt.h.
See Also
GetNextSymbolMatch, IDebugSymbolGroup::GetSymbolOffset, DEBUG_SYMBOL_ENTRY
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
AppendImagePath
The AppendImagePath and AppendImagePathWide methods append directories to the executable image path.
IDebugSymbols::AppendImagePath(
IN PCSTR Addition
);
IdebugSymbols3::AppendImagePathWide(
IN PCWSTR Addition
);
#ifdef UNICODE
#define AppendImagePathT AppendImagePathWide
#else
#define AppendImagePathT AppendImagePath
#endif
Parameters
Addition
Specifies the directories to append to the executable image path. This is a string that contains directory names separated by semicolons (;).
Return Value
S_OK
The method was successful.
These methods can also return error values. See Return Values for more details.
Interface Version
AppendImagePath is available in all versions of IDebugSymbols. AppendImagePathWide is available in IDebugSymbols3 and later versions.
Comments
The executable image path is used by the engine when searching for executable images.
The executable image path can consist of several directories separated by semicolons (;). These directories are searched in order.
For more information about the executable image path, see Executable Image Path.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetImagePath, SetImagePath
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetImagePath
The GetImagePath and GetImagePathWide methods return the executable image path.
IDebugSymbols::GetImagePath(
OUT OPTIONAL PSTR Buffer,
IN ULONG BufferSize,
Out OPTIONAL PULONG PathSize
);
IdebugSymbols3::GetImagePathWide(
OUT OPTIONAL PWSTR Buffer,
IN ULONG BufferSize,
Out OPTIONAL PULONG PathSize
);
#ifdef UNICODE
#define GetImagePathT GetImagePathWide
#else
#define GetImagePathT GetImagePath
#endif
Parameters
Buffer
Receives the executable image path. This is a string that contains directories separated by semicolons (;). If Buffer is NULL, this information is not returned.
BufferSize
Specifies the size, in characters, of the Buffer buffer.
PathSize
Receives the size, in characters, of the executable image path.
Return Value
S_OK
The method was successful.
S_FALSE
The method was successful. However, the buffer was not large enough to hold the executable image path and the path was truncated.
These methods can also return error values. See Return Values for more details.
Interface Version
GetImagePath is available in all versions of IDebugSymbols. GetImagePathWide is available in IDebugSymbols3 and later versions.
Comments
The executable image path is used by the engine when searching for executable images.
The executable image path can consist of several directories separated by semicolons. These directories are searched in order.
For more information about the executable image path, see Executable Image Path.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
SetImagePath, AppendImagePath
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SetImagePath
The SetImagePath and SetImagePathWide methods set the executable image path.
IDebugSymbols::SetImagePath(
IN PCSTR Path
);
IdebugSymbols3::SetImagePathWide(
IN PCWSTR Path
);
#ifdef UNICODE
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetLineByOffset
The GetLineByOffset and GetLineByOffsetWide methods return the source filename and the line number within the source file of an instruction in the target.
IDebugSymbols::GetLineByOffset(
IN ULONG64 Offset,
OUT OPTIONAL PULONG Line,
OUT OPTIONAL PSTR FileBuffer,
IN ULONG FileBufferSize,
OUT OPTIONAL PULONG FileSize,
OUT OPTIONAL PULONG64 Displacement
);
IdebugSymbols3::GetLineByOffsetWide(
IN ULONG64 Offset,
OUT OPTIONAL PULONG Line,
OUT OPTIONAL PWSTR FileBuffer,
IN ULONG FileBufferSize,
OUT OPTIONAL PULONG FileSize,
OUT OPTIONAL PULONG64 Displacement
);
#ifdef UNICODE
#define GetLineByOffsetT GetLineByOffsetWide
#else
#define GetLineByOffsetT GetLineByOffset
#endif
Parameters
Offset
Specifies the location in the targets virtual address space of the instruction for which to return the source file and line number.
Line
Receives the line number within the source file of the instruction specified by Offset. If Line is NULL, this information is not returned.
FileBuffer
Receives the file name of the file that contains the instruction specified by Offset. If FileBuffer is NULL, this information is not returned.
FileBufferSize
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetOffsetByLine
The GetOffsetByLine and GetOffsetByLineWide methods return the location of the instruction that corresponds to a specified line in the source code.
IDebugSymbols::GetOffsetByLine(
IN ULONG Line,
IN PCSTR File,
OUT PULONG64 Offset
);
IdebugSymbols3::GetOffsetByLineWide(
IN ULONG Line,
IN PCWSTR File,
OUT PULONG64 Offset
);
#ifdef UNICODE
#define GetOffsetByLineT GetOffsetByLineWide
#else
#define GetOffsetByLineT GetOffsetByLine
#endif
Parameters
Line
Specifies the line number in the source file.
File
Specifies the file name of the source file.
Offset
Receives the location in the targets virtual address space of an instruction for the specified line.
Return Value
S_OK
The method was successful.
These methods can also return error values. See Return Values for more details.
Interface Version
GetOffsetByLine is available in all versions of IDebugSymbols. GetOffsetByLineWide is available in IDebugSymbols3 and later versions.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Comments
A line in a source file might correspond to multiple instructions and this method can return any one of these instructions.
For more information about source files, see Using Source Files.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetLineByOffset
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetModuleByIndex
The GetModuleByIndex method returns the location of the module with the specified index.
HRESULT
IDebugSymbols::GetModuleByIndex(
IN ULONG Index,
OUT PULONG64 Base
);
Parameters
Index
Specifies the index of the module whose location is requested.
Base
Receives the location in the target's memory address space of the module.
Return Value
S_OK
The method was successful.
S_FALSE
The specified module was not loaded, and information about the module was not available.
This method may also return other error values. See Return Values for more details.
Interface Version
GetModuleByIndex is available in all versions of IDebugSymbols.
Comments
For more information about modules, see Modules.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetModuleByModuleName
The GetModuleByModuleName and GetModuleByModuleNameWide methods search through the target's modules for one with the specified name.
HRESULT
IDebugSymbols::GetModuleByModuleName(
IN PCSTR Name,
IN ULONG StartIndex,
OUT OPTIONAL PULONG Index,
OUT OPTIONAL PULONG64 Base
);
HRESULT
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
IDebugSymbols::GetModuleByModuleNameWide(
IN PCWSTR Name,
IN ULONG StartIndex,
OUT OPTIONAL PULONG Index,
OUT OPTIONAL PULONG64 Base
);
#ifdef UNICODE
#define GetModuleByModuleNameT GetModuleByModuleNameWide
#else
#define GetModuleByModuleNameT GetModuleByModuleName
#endif
Parameters
Name
Specifies the name of the desired module.
StartIndex
Specifies the index to start searching from.
Index
Receives the index of the first module with the name Name. If Index is NULL, this information is not returned.
Base
Receives the location in the target's memory address space of the base of the module. If Base is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
E_INVALIDARG
One of the arguments passed in was invalid.
This method may also return other error values. See Return Values for more details.
Interface Version
GetModuleByModuleName is available in all versions of IDebugSymbols. GetModuleByModuleNameWide is available in IDebugSymbols3 and later versions.
Comments
Starting at the specified index, these methods return the first module they find with the specified name. If the target has more than one module with this name, then subsequent
modules can be found by repeated calls to these methods with higher values of StartIndex.
For more information about modules, see Modules.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetModuleByModuleName2
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetModuleByModuleName2
The GetModuleByModuleName2 and GetModuleByModuleName2Wide methods search through the process's modules for one with the specified name.
HRESULT
IDebugSymbols3::GetModuleByModuleName2(
IN PCSTR Name,
IN ULONG StartIndex,
IN ULONG Flags,
OUT OPTIONAL PULONG Index,
OUT OPTIONAL PULONG64 Base
);
HRESULT
IDebugSymbols3::GetModuleByModuleName2Wide(
IN PCWSTR Name,
IN ULONG StartIndex,
IN ULONG Flags,
OUT OPTIONAL PULONG Index,
OUT OPTIONAL PULONG64 Base
);
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
#ifdef UNICODE
#define GetModuleByModuleName2T GetModuleByModuleName2Wide
#else
#define GetModuleByModuleName2T GetModuleByModuleName2
#endif
Parameters
Name
Specifies the name of the desired module.
StartIndex
Specifies the index to start searching from.
Flags
Specifies a bit-set containing options used when searching for the module with the specified name. Flags may contain the following bit-flags:
Flag
Effect
DEBUG_GETMOD_NO_LOADED_MODULES
Do not search the loaded modules.
DEBUG_GETMOD_NO_UNLOADED_MODULES Do not search the unloaded modules.
Index
Receives the index of the first module with the name Name. If Index is NULL, this information is not returned.
Base
Receives the location in the target's memory address space of the base of the module. If Base is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
E_INVALIDARG
One of the arguments passed in was invalid.
This method may also return other error values. See Return Values for more details.
Interface Version
GetModuleByModuleName2 and GetModuleByModuleName2Wide are available in IDebugSymbols3 and later versions.
Comments
Starting at the specified index, these methods return the first module they find with the specified name. If the target has more than one module with this name, then subsequent
modules can be found by repeated calls to these methods with higher values of StartIndex.
For more information about modules, see Modules.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetModuleByModuleName
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetModuleNames
The GetModuleNames method returns the names of the specified module.
HRESULT
IDebugSymbols::GetModuleNames(
IN ULONG Index,
IN ULONG64 Base,
OUT OPTIONAL PSTR ImageNameBuffer,
IN ULONG ImageNameBufferSize,
OUT OPTIONAL PULONG ImageNameSize,
OUT OPTIONAL PSTR ModuleNameBuffer,
IN ULONG ModuleNameBufferSize,
OUT OPTIONAL PULONG ModuleNameSize,
OUT OPTIONAL PSTR LoadedImageNameBuffer,
IN ULONG LoadedImageNameBufferSize,
OUT OPTIONAL PULONG LoadedImageNameSize
);
Parameters
Index
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Specifies the index of the module whose names are requested. If it is set to DEBUG_ANY_ID, the module is specified by Base.
Base
Specifies the base address of the module whose names are requested. This parameter is only used if Index is set to DEBUG_ANY_ID.
ImageNameBuffer
Receives the image name of the module. If ImageNameBuffer is NULL, this information is not returned.
ImageNameBufferSize
Specifies the size in characters of the buffer ImageNameBuffer in characters.
ImageNameSize
Receives the size in characters of the image name. If ImageNameSize is NULL, this information is not returned.
ModuleNameBuffer
Receives the module name of the module. If ModuleNameBuffer is NULL, this information is not returned.
ModuleNameBufferSize
Specifies the size in characters of the buffer ModuleNameBuffer.
ModuleNameSize
Receives the size in characters of the module name. If ModuleNameSize is NULL, this information is not returned.
LoadedImageNameBuffer
Receives the loaded image name of the module. If LoadedImageNameBuffer is NULL, this information is not returned.
LoadedImageNameBufferSize
Specifies the size in characters of the buffer LoadedImageNameBuffer.
LoadedImageNameSize
Receives the size in characters of the loaded image name. If LoadedImageNameSize is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
S_FALSE
The method was successful. However, at least one of ImageNameBuffer, ModuleNameBuffer, or LoadedImageNameBuffer was too small for the corresponding name, so
it was truncated.
E_NOINTERFACE
The specified module was not found.
This method may also return other error values. See Return Values for more details.
Interface Version
GetModuleNames is available in all versions of IDebugSymbols.
Comments
For more information about modules, see Modules.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetModuleNameString
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetModuleNameString
The GetModuleNameString and GetModuleNameStringWide methods return the name of the specified module.
HRESULT
IDebugSymbols2::GetModuleNameString(
IN ULONG Which,
IN ULONG Index,
IN ULONG64 Base,
OUT OPTIONAL PSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG NameSize
);
HRESULT
IDebugSymbols3::GetModuleNameStringWide(
IN ULONG Which,
IN ULONG Index,
IN ULONG64 Base,
OUT OPTIONAL PWSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG NameSize
);
#ifdef UNICODE
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetNumberModules
The GetNumberModules method returns the number of modules in the current process's module list.
HRESULT
IDebugSymbols::GetNumberModules(
OUT PULONG Loaded,
OUT PULONG Unloaded
);
Parameters
Loaded
Receives the number of loaded modules in the current process's module list.
Unloaded
Receives the number of unloaded modules in the current process's module list. This number will be zero if the version of Microsoft Windows running on the target
computer does not track unloaded modules.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Return Value
S_OK
The method was successful.
This method may also return other error values. See Return Values for more details.
Interface Version
GetNumberModules is available in all versions of IDebugSymbols.
Comments
The list of loaded and unloaded modules is maintained by Windows. The engine caches a copy of this list, but it may become out of date. Reload can be used to synchronize
the engine's copy of the list with the list maintained by Windows.
The unloaded modules are not tracked in all versions of Windows. Unloaded modules are tracked for user-mode targets in Microsoft Windows Server 2003 and later; for
kernel-mode targets, the unloaded modules are tracked in earlier Windows versions as well. When they are tracked they are indexed after the loaded modules. Unloaded
modules can be used to analyze failures caused by an attempt to call unloaded code.
For more information about modules, see Modules.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetModuleByIndex
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetModuleByOffset
The GetModuleByOffset method searches through the target's modules for one whose memory allocation includes the specified location.
HRESULT
IDebugSymbols::GetModuleByOffset(
IN ULONG64 Offset,
IN ULONG StartIndex,
OUT OPTIONAL PULONG Index,
OUT OPTIONAL PULONG64 Base
);
Parameters
Offset
Specifies a location in the target's virtual address space which is inside the desired module's memory allocation for example, the address of a symbol belonging to the
module.
StartIndex
Specifies the index to start searching from.
Index
Receives the index of the module. If Index is NULL, this information is not returned.
Base
Receives the location in the target's memory address space of the base of the module. If Base is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetModuleByOffset is available in all versions of IDebugSymbols.
Comments
Starting at the specified index, this method returns the first module it finds whose memory allocation address range includes the specified location. If the target has more than
one module whose memory address range includes this location, then subsequent modules can be found by repeated calls to this method with higher values of StartIndex.
For more information about modules, see Modules.
Requirements
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetModuleByOffset2
The GetModuleByOffset2 method searches through the process's modules for one whose memory allocation includes the specified location.
HRESULT
IDebugSymbols3::GetModuleByOffset2(
IN ULONG64 Offset,
IN ULONG StartIndex,
IN ULONG Flags,
OUT OPTIONAL PULONG Index,
OUT OPTIONAL PULONG64 Base
);
Parameters
Offset
Specifies a location in the target's virtual address space which is inside the desired module's memory allocation for example, the address of a symbol belonging to the
module.
StartIndex
Specifies the index to start searching from.
Flags
Specifies a bit-set containing options used when searching for the module with the specified location. Flags may contain the following bit-flags:
Flag
Effect
DEBUG_GETMOD_NO_LOADED_MODULES
Do not search the loaded modules.
DEBUG_GETMOD_NO_UNLOADED_MODULES Do not search the unloaded modules.
Index
Receives the index of the module. If Index is NULL, this information is not returned.
Base
Receives the location in the target's memory address space of the base of the module. If Base is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetModuleByOffset2 is available in IDebugSymbols3 and later versions.
Comments
Starting at the specified index, this method returns the first module it finds whose memory allocation address range includes the specified location. If the target has more than
one module whose memory address range includes this location, then subsequent modules can be found by repeated calls to this method with higher values of StartIndex.
For more information about modules, see Modules.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetModuleByOffset, GetModuleByIndex
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetModuleParameters
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
AddSyntheticModule
The AddSyntheticModule and AddSyntheticModuleWide methods add a synthetic module to the module list the debugger maintains for the current process.
HRESULT
IDebugSymbols3::AddSyntheticModule(
IN ULONG64 Base,
IN ULONG Size,
IN PCSTR ImagePath,
IN PCSTR ModuleName,
IN ULONG Flags
);
HRESULT
IDebugSymbols3::AddSyntheticModuleWide(
IN ULONG64 Base,
IN ULONG Size,
IN PCWSTR ImagePath,
IN PCWSTR ModuleName,
IN ULONG Flags
);
#ifdef UNICODE
#define AddSyntheticModuleT AddSyntheticModuleWide
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
#else
#define AddSyntheticModuleT AddSyntheticModule
#endif
Parameters
Base
Specifies the location in the process's virtual address space of the base of the synthetic module.
Size
Specifies the size in bytes of the synthetic module.
ImagePath
Specifies the image name of the synthetic module. This is the name that will be returned as the name of the executable file for the synthetic module. The full path should
be included if known.
ModuleName
Specifies the module name for the synthetic module.
Flags
Set to DEBUG_ADDSYNTHMOD_DEFAULT.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
AddSyntheticModule and AddSyntheticModuleWide are available in IDebugSymbols3 and later versions.
Comments
The memory region of the synthetic module, described by the Base and Size parameters, must not overlap the memory region of any other module.
If all the modules are reloaded - for example, by calling Reload with the Module parameter set to an empty string - all synthetic modules will be discarded.
For more information about synthetic modules, see Synthetic Modules.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
RemoveSyntheticModule, AddSyntheticSymbol
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
RemoveSyntheticModule
The RemoveSyntheticModule method removes a synthetic module from the module list the debugger maintains for the current process.
HRESULT
IDebugSymbols3::RemoveSyntheticModule(
IN ULONG64 Base
);
Parameters
Base
Specifies the location in the process's virtual address space of the base of the synthetic module.
Return Value
S_OK
The method was successful.
E_INVALIDARG
No synthetic module was found at the specified location. This is returned if a synthetic module at this location was previously removed or discarded.
This method may also return error values. See Return Values for more details.
Interface Version
RemoveSyntheticModule is available in IDebugSymbols3 and later versions.
Comments
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
If all the modules are reloaded - for example, by calling Reload with the Module parameter set to the empty string - all synthetic modules will be discarded.
For more information about synthetic modules, see Synthetic Modules.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
AddSyntheticModule, RemoveSyntheticSymbol
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetModuleVersionInformation
The GetModuleVersionInformation and GetModuleVersionInformationWide methods return version information for the specified module.
HRESULT
IDebugSymbols2::GetModuleVersionInformation(
IN ULONG Index,
IN ULONG64 Base,
IN PCSTR Item,
OUT OPTIONAL PVOID Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG VerInfoSize
);
HRESULT
IDebugSymbols3::GetModuleVersionInformationWide(
IN ULONG Index,
IN ULONG64 Base,
IN PCWSTR Item,
OUT OPTIONAL PVOID Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG VerInfoSize
);
#ifdef UNICODE
#define GetModuleVersionInformationT GetModuleVersionInformationWide
#else
#define GetModuleVersionInformationT GetModuleVersionInformation
#endif
Parameters
Index
Specifies the index of the module. If it is set to DEBUG_ANY_ID, the Base parameter is used to specify the location of the module instead.
Base
If Index is DEBUG_ANY_ID, specifies the location in the target's memory address space of the base of the module. Otherwise it is ignored.
Item
Specifies the version information being requested. This string corresponds to the lpSubBlock parameter of the function VerQueryValue. For details on the
VerQueryValue function, see the Platform SDK.
Buffer
Receives the requested version information. If Buffer is NULL, this information is not returned.
BufferSize
Specifies the size in characters of the buffer Buffer.
VerInfoSize
Receives the size in characters of the version information. If VerInfoSize is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
S_FALSE
The size of the buffer was smaller than the size of the version information. In this case the buffer is filled with the truncated version information.
E_NOINTERFACE
The specified module was not found.
This method may also return other error values. See Return Values for more details.
Interface Version
GetModuleVersionInformation is available in IDebugSymbols2 and later versions. GetModuleVersionInformationWide is available in IDebugSymbols3 and later
versions.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Comments
Module version information is available only for loaded modules and may not be available in all sessions.
For more information about modules, see Modules.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetModuleByOffset2, GetModuleByIndex, GetNumberModules
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetNameByOffset
The GetNameByOffset and GetNameByOffsetWide methods return the name of the symbol at the specified location in the target's virtual address space.
HRESULT
IDebugSymbols::GetNameByOffset(
IN ULONG64 Offset,
OUT OPTIONAL PSTR NameBuffer,
IN ULONG NameBufferSize,
OUT OPTIONAL PULONG NameSize,
OUT OPTIONAL PULONG64 Displacement
);
HRESULT
IDebugSymbols3::GetNameByOffsetWide(
IN ULONG64 Offset,
OUT OPTIONAL PWSTR NameBuffer,
IN ULONG NameBufferSize,
OUT OPTIONAL PULONG NameSize,
OUT OPTIONAL PULONG64 Displacement
);
#ifdef UNICODE
#define GetNameByOffsetT GetNameByOffsetWide
#else
#define GetNameByOffsetT GetNameByOffset
#endif
Parameters
Offset
Specifies the location in the target's virtual address space of the symbol whose name is requested. Offset does not need to specify the base location of the symbol; it only
needs to specify a location within the symbol's memory allocation.
NameBuffer
Receives the symbol's name. The name is qualified by the module to which the symbol belongs (for example, mymodule!main). If NameBuffer is NULL, this
information is not returned.
NameBufferSize
Specifies the size in characters of the buffer NameBuffer.
NameSize
Receives the size in characters of the symbol's name. If NameSize is NULL, this information is not returned.
Displacement
Receives the difference between the value of Offset and the base location of the symbol. If Displacement is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
S_FALSE
The method was successful. However, the buffer was not large enough to hold the symbol's name, so it was truncated.
E_FAIL
No symbol could be found at the specified location.
This method may also return other error values. See Return Values for more details.
Interface Version
GetNameByOffset is available in all versions of IDebugSymbols.
Comments
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
For more information about symbols and symbol names, see Symbols.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetNearNameByOffset, GetOffsetByName
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetNearNameByOffset
The GetNearNameByOffset and GetNearNameByOffsetWide methods return the name of a symbol that is located near the specified location.
HRESULT
IDebugSymbols::GetNearNameByOffset(
IN ULONG64 Offset,
IN LONG Delta,
OUT OPTIONAL PSTR NameBuffer,
IN ULONG NameBufferSize,
OUT OPTIONAL PULONG NameSize,
OUT OPTIONAL PULONG64 Displacement
);
HRESULT
IDebugSymbols3::GetNearNameByOffsetWide(
IN ULONG64 Offset,
IN LONG Delta,
OUT OPTIONAL PWSTR NameBuffer,
IN ULONG NameBufferSize,
OUT OPTIONAL PULONG NameSize,
OUT OPTIONAL PULONG64 Displacement
);
#ifdef UNICODE
#define GetNearNameByOffsetT GetNearNameByOffsetWide
#else
#define GetNearNameByOffsetT GetNearNameByOffset
#endif
Parameters
Offset
Specifies the location in the target's virtual address space of the symbol from which the desired symbol is determined.
Delta
Specifies the relationship between the desired symbol and the symbol located at Offset. If positive, the engine will return the symbol that is Delta symbols after the
symbol located at Offset. If negative, the engine will return the symbol that is Delta symbols before the symbol located at Offset.
NameBuffer
Receives the symbol's name. The name is qualified by the module to which the symbol belongs (for example, mymodule!main). If NameBuffer is NULL, this
information is not returned.
NameBufferSize
Specifies the size in characters of the buffer NameBuffer.
NameSize
Receives the size in characters of the symbol's name. If NameSize is NULL, this information is not returned.
Displacement
Receives the difference between the value of Offset and the location in the target's memory address space of the symbol. If Displacement is NULL, this information is not
returned.
Return Value
S_OK
The method was successful.
S_FALSE
The method was successful. However, the buffer was not large enough to hold the symbol's name so it was truncated.
E_NOINTERFACE
No symbol matching the specifications of Offset and Delta was found.
This method may also return other error values. See Return Values for more details.
Interface Version
GetNearNameByOffset is available in all versions of IDebugSymbols. GetNearNameByOffsetWide is available in IDebugSymbols3 and later versions.
Comments
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
By increasing or decreasing the value of Delta, these methods can be used to iterate over the target's symbols starting at a particular location.
If Delta is zero, these methods behave the same way as GetNameByOffset.
For more information about symbols and symbol names, see Symbols.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetNameByOffset, GetOffsetByName
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetOffsetByName
The GetOffsetByName and GetOffsetByNameWide methods return the location of a symbol identified by name.
HRESULT
IDebugSymbols::GetOffsetByName(
IN PCSTR Symbol,
OUT PULONG64 Offset
);
HRESULT
IDebugSymbols3::GetOffsetByNameWide(
IN PCWSTR Symbol,
OUT PULONG64 Offset
);
#ifdef UNICODE
#define GetOffsetByNameT GetOffsetByNameWide
#else
#define GetOffsetByNameT GetOffsetByName
#endif
Parameters
Symbol
Specifies the name of the symbol to locate. The name may be qualified by a module name (for example, mymodule!main).
Offset
Receives the location in the target's memory address space of the base of the symbol's memory allocation.
Return Value
S_OK
The method was successful.
S_FALSE
The method was successful. However, the name Symbol was not unique and multiple symbols with that name were found. One of these symbols was arbitrarily chosen
and returned.
E_FAIL
No symbol could be found with the specified name.
This method may also return other error values. See Return Values for more details.
Interface Version
GetOffsetByName is available in all versions of IDebugSymbols. GetOffsetByNameWide is available in IDebugSymbols3 and later versions.
Comments
If the name Symbol is not unique and GetOffsetByName finds multiple symbols with that name, then the ambiguity will be resolved arbitrarily. In this case the value
S_FALSE will be returned. StartSymbolMatch can be used to initiate a search to determine which is the desired result.
GetNameByOffset does not support pattern matching (e.g. wildcards). To find a symbol using pattern matching use StartSymbolMatch.
If the module name for the symbol is known, it is best to qualify the symbol name with the module name. Otherwise the engine will search the symbols for all modules until it
finds a match; this can take a long time if it has to load the symbol files for a lot of modules. If the symbol name is qualified with a module name, the engine only searches the
symbols for that module.
For more information about symbols and symbol names, see Symbols.
Requirements
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Reload
The Reload and ReloadWide methods delete the engine's symbol information for the specified module and reload these symbols as needed.
HRESULT
IDebugSymbols::Reload(
IN PCSTR Module
);
HRESULT
IDebugSymbols3::ReloadWide(
IN PCWSTR Module
);
#ifdef UNICODE
#define ReloadT ReloadWide
#else
#define ReloadT Reload
#endif
Parameters
Module
Specifies the module to reload.
Return Value
S_OK
The method was successful
This method may also return error values. See Return Values for more details.
Interface Version
Reload is available in all versions of IDebugSymbols. ReloadWide is available in IDebugSymbols3 and later versions.
Comments
These methods behave the same way as the debugger command .reload. The Module parameter is treated the same way as the arguments to .reload. For example, setting the
Module parameter to "/u ntdll.dll" has the same effect as the command .reload /u ntdll.dll.
For more information about symbols, see Symbols.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
.reload (Reload Module)
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetScope
The GetScope method returns information about the current scope.
HRESULT
IDebugSymbols::GetScope(
OUT OPTIONAL PULONG64 InstructionOffset,
OUT OPTIONAL PDEBUG_STACK_FRAME ScopeFrame,
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
ResetScope
The ResetScope method resets the current scope to the default scope of the current thread.
HRESULT
IDebugSymbols::ResetScope(
);
Parameters
None
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
ResetScope is available in all versions of IDebugSymbols.
Comments
For more information about scopes, see Scopes and Symbol Groups.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetScope, SetScope
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SetScope
The SetScope method sets the current scope.
HRESULT
IDebugSymbols::SetScope(
IN ULONG64 InstructionOffset,
IN OPTIONAL PDEBUG_STACK_FRAME ScopeFrame,
IN OPTIONAL PVOID ScopeContext,
IN ULONG ScopeContextSize
);
Parameters
InstructionOffset
Specifies the location in the process's virtual address space for the scope's current instruction. This is only used if both ScopeFrame and ScopeContext are NULL;
otherwise, it is ignored.
ScopeFrame
Specifies the scope's stack frame. For information about this structure, see DEBUG_STACK_FRAME.
ScopeContext
Specifies the scope's thread context. The type of the thread context is the CONTEXT structure for the target's effective processor. The buffer ScopeContext must be large
enough to hold this structure. If ScopeContext is NULL, the current register context is used instead.
ScopeContextSize
Specifies the size of the buffer ScopeContext.
Return Value
S_OK
The scope identified by InstructionOffset, ScopeFrame, and ScopeContext is the same as the old scope.
S_FALSE
The scope has changed.
This method may also return error values. See Return Values for more details.
Interface Version
SetScope is available in all versions of IDebugSymbols.
Comments
If only InstructionOffset is provided, the scope can be used to look up symbol names; however, the values of these symbols will not be available.
To set the scope to a previous state, ScopeContext must be provided. This is not always necessary (for example, if you only wish to access the symbols and not the registers).
To set the scope to a frame on the current stack, SetScopeFrameByIndex can be used.
For more information about scopes, see Scopes and Symbol Groups.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetScope, ResetScope, SetScopeFrameByIndex
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SetScopeFrameByIndex
The SetScopeFrameByIndex method sets the current scope to the scope of one of the frames on the call stack.
HRESULT
IDebugSymbols3::SetScopeFrameByIndex(
IN ULONG Index
);
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Parameters
Index
Specifies the index of the stack frame from which to set the scope. The index counts the number of frames from the top of the call stack. The frame at the top of the stack,
representing the current call, has index zero.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
SetScopeFrameByIndex is available in IDebugSymbols3 and later versions.
Comments
When an event occurs and the debugger engine breaks into a target, the scope is set to the current function call (the function that was executing when the event occurred).
Calling this method with Index set to one will change the current scope to the caller of the current function; with Index set to two, the scope is changed to the caller's caller,
and so on.
For more information about scopes, see Scopes and Symbol Groups.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
.frame (Set Local Context), GetCurrentScopeFrameIndex, SetScopeFromStoredEvent, SetScope
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetCurrentScopeFrameIndex
The GetCurrentScopeFrameIndex method returns the index of the current stack frame in the call stack.
HRESULT
IDebugSymbols3::GetCurrentScopeFrameIndex(
OUT PULONG Index
);
Parameters
Index
Receives the index of the stack frame corresponding to the current scope. The index counts the number of frames from the top of the call stack. The frame at the top of
the stack, representing the current call, has index zero.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetCurrentScopeFrameIndex is available in IDebugSymbols3 and later versions.
Comments
If the current scope was set using SetScope, Index receives the value of the FrameNumber member of the DEBUG_STACK_TRACE structure passed to the ScopeFrame
parameter of SetScope.
For more information about scopes, see Scopes and Symbol Groups.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
.frame (Set Local Context), SetScopeFrameByIndex, GetScope
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
SetScopeFromStoredEvent
The SetScopeFromStoredEvent method sets the current scope to the scope of the stored event.
HRESULT
IDebugSymbols3::SetScopeFromStoredEvent(
);
Parameters
None
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
SetScopeFromStoredEvent is available in IDebugSymbols3 and later versions.
Comments
Currently only user-mode Minidumps can contain a stored event.
The new scope is printed to the debugger console.
For more information about scopes, see Scopes and Symbol Groups.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
.ecxr (Display Exception Context Record), SetScopeFrameByIndex, SetScope, GetStoredEventInformation
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetScopeSymbolGroup
The GetScopeSymbolGroup and GetScopeSymbolGroup2 methods return a symbol group containing the symbols in the current target's scope.
HRESULT
IDebugSymbols::GetScopeSymbolGroup(
IN ULONG Flags,
IN OPTIONAL IDebugSymbolGroup * Update,
OUT IDebugSymbolGroup * * Symbols
);
HRESULT
IDebugSymbols3::GetScopeSymbolGroup2(
IN ULONG Flags,
IN OPTIONAL IDebugSymbolGroup2 * Update,
OUT IDebugSymbolGroup2 * * Symbols
);
Parameters
Flags
Specifies a bit-set used to determine which symbols to include in the symbol group. To include all symbols, set Flags to DEBUG_SCOPE_GROUP_ALL. The following
bit-flags determine which symbols are included.
Flag
Description
DEBUG_SCOPE_GROUP_ARGUMENTS Include the function arguments for the current scope.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
DEBUG_SCOPE_GROUP_LOCALS
Update
Specifies a previously created symbol group that will be updated to reflect the current scope. If Update is NULL, a new symbol group interface object is created.
Symbols
Receives the symbol group interface object for the current scope. For details on this interface, see IDebugSymbolGroup
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetScopeSymbolGroup is available in all versions of IDebugSymbols. GetScopeSymbolGroup2 is available in IDebugSymbols3 and later versions.
Comments
The Update parameter allows for efficient updates when stepping through code. Instead of creating and populating a new symbol group, the old symbol group can be updated.
For more information about scopes and symbol groups, see Scopes and Symbol Groups.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
IDebugSymbolGroup, GetScope
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
FindSourceFile
The FindSourceFile and FindSourceFileWide methods search the source path for a specified source file.
IDebugSymbols::FindSourceFile(
IN ULONG StartElement,
IN PCSTR File,
IN ULONG Flags,
OUT OPTIONAL PULONG FoundElement,
OUT OPTIONAL PSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG FoundSize
);
IDebugSymbols3::FindSourceFileWide(
IN ULONG StartElement,
IN PCWSTR File,
IN ULONG Flags,
OUT OPTIONAL PULONG FoundElement,
OUT OPTIONAL PWSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG FoundSize
);
#ifdef UNICODE
#define FindSourceFileT FindSourceFileWide
#else
#define FindSourceFileT FindSourceFile
#endif
Parameters
StartElement
Specifies the index of an element within the source path to start searching from. All elements in the source path before StartElement are excluded from the search. The
index of the first element is zero. If StartElement is greater than or equal to the number of elements in the source path, the filing system is checked directly.
This parameter can be used with FoundElement to check for multiple matches in the source path.
File
Specifies the path and file name of the file to search for.
Flags
Specifies the search flags. For a description of these flags, see DEBUG_FIND_SOURCE_XXX.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The flag DEBUG_FIND_SOURCE_TOKEN_LOOKUP should not be set. The flag DEBUG_FIND_SOURCE_NO_SRCSRV is ignored because this method does not
include source servers in the search.
FoundElement
Receives the index of the element within the source path that contains the file. If the file was found directly on the filing system (not using the source path) then -1 is
returned to FoundElement. If FoundElement is NULL, this information is not returned.
Buffer
Receives the path and name of the found file. If the flag DEBUG_FIND_SOURCE_FULL_PATH is set, this is the full canonical path name for the file. Otherwise, it is
the concatenation of the directory in the source path with the tail of File that was used to find the file. If Buffer is NULL, this information is not returned.
BufferSize
Specifies the size, in characters, of the Buffer buffer.
FoundSize
Specifies the size, in characters, of the name of the file. If FoundSize is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
E_NOINTERFACE
File was not found on the source path.
These methods can also return error values. See Return Values for more details.
Interface Version
FindSourceFileis available in all versions of IDebugSymbols. FindSourceFileWide is available in IDebugSymbols3 and later versions.
Comments
The engine uses the following stepsin orderto search for the file:
1. For each directory in the source path, an attempt is made to find an overlap between the end of the directory path and the beginning of the file path. For example, if the
source path contains a directory C:\a\b\c\d and File is c\d\e\samplefile.c, the file C:\a\b\c\d\e\samplefile.c is a match.
If the flag DEBUG_FIND_SOURCE_BEST_MATCH is set, the match with the longest overlap is returned; otherwise, the first match is returned.
2. For each directory in the source path, File is appended to the directory. If no match is found, this process is repeated and each time the first directory is removed from
the beginning of the file path. For example, if the source path contains a directory C:\a\b and File is c\d\e\samplefile.c, then the file C:\a\b\e\samplefile.c is a match.
The first match found is returned.
3. File is looked up directly on the filing system.
Note Any source servers in the source path are ignored. To include the source servers in the search, use FindSourceFileAndToken with a module address specified in
ModAddr.
For more information about using the source path, see Using Source Files. For an overview of the source path and its syntax, see Source Path.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
FindSourceFileAndToken, GetSourcePathElement, GetSourceFileLineOffsets, DEBUG_FIND_SOURCE_XXX
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetSourceFileLineOffsets
The GetSourceFileLineOffsets and GetSourceFileLineOffsetsWide methods map each line in a source file to a location in the target's memory.
IDebugSymbols::GetSourceFileLineOffsets(
IN PCSTR File,
OUT OPTIONAL PULONG64 Buffer,
IN ULONG BufferLines,
OUT OPTIONAL PULONG FileLines
);
Parameters
File
Specifies the name of the file whose lines will be turned into locations in the target's memory. The symbols for each module in the target are queried for this file. If the
file is not located, the path is dropped and the symbols are queried again.
Buffer
Receives the locations in the target's memory that correspond to the lines of the source code. The first entry returned to this array corresponds to the first line of the file,
so that Buffer[i] contains the location for line i+1. If no symbol information is available for a line, the corresponding entry in Buffer is set to
DEBUG_INVALID_OFFSET. If Buffer is NULL, this information is not returned.
BufferLines
Specifies the number of PULONG64 objects that the Buffer array can hold.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
FileLines
Receives the number of lines in the source file specified by File.
Return Value
S_OK
The method was successful.
S_FALSE
The method was successful. However, the number of lines in the source file exceeded the number of entries in the Buffer array and some of the results were discarded.
These methods can also return error values. See Return Values for more details.
Interface Version
GetSourceFileLineOffsets Is available in all versions of IDebugSymbols.
Comments
For more information about using the source path, see Using Source Files.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
FindSourceFile, GetSourceEntriesByLine
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
AppendSourcePath
The AppendSourcePath and AppendSourcePathWide methods append directories to the source path.
IDebugSymbols::AppendSourcePath(
IN PCSTR Addition
);
IDebugSymbols3::AppendSourcePathWide(
IN PWSTR Addition
);
#ifdef UNICODE
#define AppendSourcePathT AppendSourcePathWide
#else
#define AppendSourcePathT AppendSourcePath
#endif
Parameters
Addition
Specifies the directories to append to the source path. This is a string that contains source path elements separated by semicolons (;). Each source path element can
specify either a directory or a source server.
Return Value
S_OK
The method was successful.
These methods can also return error values. See Return Values for more details.
Interface Version
AppendSourcePath is available in all versions of IDebugSymbols. AppendSourcePathWide is available in IDebugSymbols3 and later versions.
Comments
The source path is used by the engine when searching for source files.
For more information about manipulating the source path, see Using Source Files. For an overview of the source path and its syntax, see Source Path.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetSourcePath
The GetSourcePath and GetSourcePathWide methods return the source path.
IDebugSymbols::GetSourcePath(
OUT OPTIONAL PSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG PathSize
);
IDebugSymbols3::GetSourcePathWide(
OUT OPTIONAL PCWSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG PathSize
);
#ifdef UNICODE
#define GetSourcePathT GetSourcePathWide
#else
#define GetSourcePathT GetSourcePath
#endif
Parameters
Buffer
Receives the source path. This is a string that contains source path elements separated by semicolons (;). Each source path element can specify either a directory or a
source server. If Buffer is NULL, this information is not returned.
BufferSize
Specifies the size, in characters, of the Buffer buffer.
PathSize
Receives the size, in characters, of the source path.
Return Value
S_OK
The method was successful.
S_FALSE
The method was successful. However, the buffer was not large enough to hold the source path and the path was truncated.
This method can also return error values. See Return Values for more details.
Interface Version
GetSourcePath is available in all versions of IDebugSymbols. GetSourcePathWide is available in IDebugSymbols3 and later versions.
Comments
The source path is used by the engine when searching for source files.
For more information about manipulating the source path, see Using Source Files. For an overview of the source path and its syntax, see Source Path.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
AppendSourcePath, SetSourcePath, GetSourcePathElement
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SetSourcePath
The SetSourcePath and SetSourcePathWide methods set the source path.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
IDebugSymbols::SetSourcePath(
IN PCSTR Path
);
IDebugSymbols3::SetSourcePathWide(
IN PCWSTR Path
);
#ifdef UNICODE
#define SetSourcePathT SetSourcePathWide
#else
#define SetSourcePathT SetSourcePath
#endif
Parameters
Path
Specifies the new source path. This is a string that contains source path elements separated by semicolons (;). Each source path element can specify either a directory or a
source server.
Return Value
S_OK
The method was successful.
These methods can also return error values. See Return Values for more details.
Interface Version
SetSourcePath is available in all versions of IDebugSymbols. SetSourcePathWide is available in IDebugSymbols3 and later versions.
Comments
The source path is used by the engine when searching for source files.
For more information about manipulating the source path, see Using Source Files. For an overview of the source path and its syntax, see Source Path.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
AppendSourcePath, GetSourcePath
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetSourcePathElement
The GetSourcePathElement and GetSourcePathElementWide methods return an element from the source path.
IDebugSymbols::GetSourcePathElement(
IN ULONG Index,
OUT OPTIONAL PSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG ElementSize
);
IDebugSymbols3::GetSourcePathElementWide(
IN ULONG Index,
OUT OPTIONAL PWSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG ElementSize
);
#ifdef UNICODE
#define GetSourcePathElementT GetSourcePathElementWide
#else
#define GetSourcePathElementT GetSourcePathElement
#endif
Parameters
Index
Specifies the index of the element in the source path that will be returned. The source path is a string that contains elements separated by semicolons (;). The index of the
first element is zero.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Buffer
Receives the source path element. Each source path element can be a directory or a source server. If Buffer is NULL, this information is not returned.
BufferSize
Specifies the size, in characters, of the Buffer buffer.
ElementSize
Receives the size, in characters, of the source path element.
Return Value
S_OK
The method was successful.
E_NOINTERFACE
The source path contains fewer than Index elements.
These methods can also return error values. See Return Values for more details.
Interface Version
GetSourcePathElement is available in all versions of IDebugSymbols. GetSourcePathElementWide is available in IDebugSymbols3 and later versions.
Comments
The source path is used by the engine when searching for source files.
For more information about manipulating the source path, see Using Source Files. For an overview of the source path and its syntax, see Source Path.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
AppendSourcePath, GetSourcePath
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetSourceEntriesByLine
The GetSourceEntriesByLine and GetSourceEntriesByLineWide methods query symbol information and return locations in the target's memory that correspond to lines in
a source file.
IDebugSymbols3::GetSourceEntriesByLine(
IN ULONG Line,
IN PCSTR File,
IN ULONG Flags,
OUT OPTIONAL PDEBUG_SYMBOL_SOURCE_ENTRY
IN ULONG EntriesCount,
OUT OPTIONAL PULONG EntriesAvail
);
IDebugSymbols3::GetSourceEntriesByLineWide(
IN ULONG Line,
IN PCWSTR File,
IN ULONG Flags,
OUT OPTIONAL PDEBUG_SYMBOL_SOURCE_ENTRY
IN ULONG EntriesCount,
OUT OPTIONAL PULONG EntriesAvail
);
Entries,
Entries,
#ifdef UNICODE
#define GetSourceEntriesByLineT GetSourceEntriesByLineWide
#else
#define GetSourceEntriesByLineT GetSourceEntriesByLine
#endif
Parameters
Line
Specifies the line in the source file for which to query. The number for the first line is 1.
File
Specifies the source file. The symbols for each module in the target are queried for this file.
Flags
Specifies bit flags that control the behavior of this method. Flags can be any combination of values from the following table.
Value
Description
DEBUG_GSEL_NO_SYMBOL_LOADS The debugger engine will only search for the file among the modules whose symbols have already been loaded. Symbols for
the other modules will not be loaded.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
If this option is not set, the debugger engine will load the symbols for all modules until it finds the file specified in File.
DEBUG_GSEL_ALLOW_LOWER
DEBUG_GSEL_ALLOW_HIGHER
DEBUG_GSEL_NEAREST_ONLY
To use the default set of flags, set Flags to DEBUG_GSEL_DEFAULT. This has all the flags in the previous table turned off.
Entries
Receives the locations in the target's memory that correspond to the source lines queried for. Each entry in this array is of type DEBUG_SYMBOL_SOURCE_ENTRY
and contains the source line number along with a location in the target's memory.
EntriesCount
Specifies the number of entries in the Entries array.
EntriesAvailable
Receives the number of locations that match the query found in the target's memory.
Return Value
S_OK
The method was successful.
S_FALSE
The method was successful. However, the Entries array was not large enough to hold all the results that matched the query and the extra results were discarded.
E_NOINTERFACE
The query yielded no results. This includes the case where the symbol information was not available for the specified file.
These methods can also return error values. See Return Values for more details.
Interface Version
GetSourceEntriesByLine and GetSourceEntriesByLineWide are available in IDebugSymbols3 and later versions.
Comments
These methods can be used by debugger applications to fetch locations in the target's memory for setting breakpoints or matching source code with disassembled instructions.
For example, setting the flags DEBUG_GSEL_ALLOW_HIGHER and DEBUG_GSEL_NEAREST_ONLY will return the target's memory location for the first piece of code
starting at the specified line.
For more information about source files, see Using Source Files.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
DEBUG_SYMBOL_SOURCE_ENTRY, GetSourceFileLineOffsets
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetSymbolEntryInformation
The GetSymbolEntryInformation method returns the symbol entry information for a symbol.
HRESULT
IdebugSymbols3::GetSymbolEntryInformation(
IN PDEBUG_MODULE_AND_ID Id,
OUT PDEBUG_SYMBOL_ENTRY Info
);
Parameters
Id
Specifies the module and symbol ID of the desired symbol. For details on this structure, see DEBUG_MODULE_AND_ID.
Info
Receives the symbol entry information for the symbol. For details on this structure, see DEBUG_SYMBOL_ENTRY.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Interface Version
GetSymbolEntryInformation is available in IDebugSymbols3 and later versions.
Comments
For details on the symbol entry information, see Scopes and Symbol Groups.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
IdebugSymbolGroup2::GetSymbolEntryInformation
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetSymbolEntriesByName
The GetSymbolEntriesByName and GetSymbolEntriesByNameWide methods return the symbols whose names match a given pattern.
HRESULT
IDebugSymbols3::GetSymbolEntriesByName(
IN PCSTR Symbol,
IN ULONG Flags,
OUT OPTIONAL PDEBUG_MODULE_AND_ID Ids,
IN ULONG IdsCount,
OUT OPTIONAL PULONG Entries
);
HRESULT
IDebugSymbols3::GetSymbolEntriesByNameWide(
IN PCWSTR Symbol,
IN ULONG Flags,
OUT OPTIONAL PDEBUG_MODULE_AND_ID Ids,
IN ULONG IdsCount,
OUT OPTIONAL PULONG Entries
);
#ifdef UNICODE
#define GetSymbolEntriesByNameT GetSymbolEntriesByNameWide
#else
#define GetSymbolEntriesByNameT GetSymbolEntriesByName
#endif
Parameters
Symbol
Specifies the pattern used to determine which symbols to return. This method returns the symbols whose name matches the string wildcard syntax pattern Symbol.
Flags
Set to zero.
Ids
Receives the symbols. This is an array of IdsCount entries of type DEBUG_MODULE_AND_ID. If Ids is NULL, this information is not returned.
IdsCount
Specifies the number of entries that the array Ids can hold.
Entries
Receives the number of symbols whose names match the pattern Symbol. If entries is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetSymbolEntriesByName and GetSymbolEntriesByNameWide are available in IDebugSymbols3 and later versions.
Comments
For more information about symbols, see Symbols.
Requirements
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetSymbolEntriesByOffset
The GetSymbolEntriesByOffset method returns the symbols which are located at a specified address.
HRESULT
IDebugSymbols3::GetSymbolEntriesByOffset(
IN ULONG64 Offset,
IN ULONG Flags,
OUT OPTIONAL PDEBUG_MODULE_AND_ID Ids,
OUT OPTIONAL PULONG64 Displacements,
IN ULONG IdsCount,
OUT OPTIONAL PULONG Entries
);
Parameters
Offset
Specifies a location in the process's memory address space within the desired symbols range. Not all symbols have a known range, so, for best results, use the base
address of the symbol.
Flags
Set to zero.
Ids
Receives the symbols. This is an array of IdsCount entries of type DEBUG_MODULE_AND_ID. If Ids is NULL, this information is not returned.
Displacements
Receives the differences between the base addresses of the found symbols and the given address according to the symbols range.
IdsCount
Specifies the number of entries that the arrays Ids and Displacements can hold.
Entries
Receives the number of symbols located at Offset. If Entries is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetSymbolEntriesByOffset is available in IDebugSymbols3 and later versions.
Comments
For more information about symbols, see Symbols.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetSymbolEntriesByName
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetSymbolEntryString
The GetSymbolEntryString and GetSymbolEntryStringWide methods return string information for the specified symbol.
HRESULT
IDebugSymbols3::GetSymbolEntryString(
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
IN PDEBUG_MODULE_AND_ID Id,
IN ULONG Which,
OUT OPTIONAL PSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG StringSize
);
HRESULT
IDebugSymbols3::GetSymbolEntryStringWide(
IN PDEBUG_MODULE_AND_ID Id,
IN ULONG Which,
OUT OPTIONAL PWSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG StringSize
);
#ifdef UNICODE
#define GetSymbolEntryStringT GetSymbolEntryStringWide
#else
#define GetSymbolEntryStringT GetSymbolEntryString
#endif
Parameters
Id
Specifies the symbols whose memory regions are being requested. The DEBUG_MODULE_AND_ID structure contains the module containing the symbol and the
symbol ID of the symbol within the module.
Which
Specifies the index of the desired string. Often this is zero, as most symbols contain just one string (their name). But some symbols may contain more than one string
for example, annotation symbols.
Buffer
Receives the name of the symbol. If Buffer is NULL, this information is not returned.
BufferSize
Specifies the size in characters of the buffer Buffer.
StringSize
Receives the size in characters of the symbol's name. If StringSize is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetSymbolEntryString is available in IDebugSymbols3 and later versions.
Comments
For more information about symbols, see Symbols.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetSymbolEntriesByName, GetSymbolEntriesByOffset
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
CreateSymbolGroup
The CreateSymbolGroup and CreateSymbolGroup2 methods create a new symbol group.
HRESULT
IDebugSymbols::CreateSymbolGroup(
OUT IDebugSymbolGroup * * Group
);
HRESULT
IDebugSymbols3::CreateSymbolGroup2(
OUT IDebugSymbolGroup2 * * Group
);
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Parameters
Group
Receives an interface pointer for the new IDebugSymbolGroup object.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
CreateSymbolGroup is available in all versions of IDebugSymbols. CreateSymbolGroup2 is available in IDebugSymbols3 and later versions.
Comments
The newly created symbol group is empty; it does not contain any symbols. Symbols may be added to the symbol group using IDebugSymbolGroup::AddSymbol.
References to the returned object are managed like other COM objects, using the IUnknown::AddRef and IUnknown::Release methods. In particular, the
IUnknown::Release method must be called when the returned object is no longer needed. See COM Interfaces for more information about using COM interfaces in the
Debugger Engine API.
For more information about symbol groups, see Scopes and Symbol Groups.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
IDebugSymbolGroup, IDebugSymbolGroup::AddSymbol
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
EndSymbolMatch
The EndSymbolMatch method releases the resources used by a symbol search.
HRESULT
IDebugSymbols::EndSymbolMatch(
IN ULONG64 Handle
);
Parameters
Handle
Specifies the handle returned by StartSymbolMatch when the search was initialized.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
EndSymbolMatch is available in all versions of IDebugSymbols.
Comments
This method releases the resources held by the engine during a symbol search. After these resources are released, the handle becomes invalid, so it must not be passed to
GetNextSymbolMatch after it has been passed to this method.
For more information about symbols, see Symbols.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetNextSymbolMatch, StartSymbolMatch
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetNextSymbolMatch
The GetNextSymbolMatch and GetNextSymbolMatchWide methods return the next symbol found in a symbol search.
HRESULT
IDebugSymbols::GetNextSymbolMatch(
IN ULONG64 Handle,
OUT OPTIONAL PSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG MatchSize,
OUT OPTIONAL PULONG64 Offset
);
HRESULT
IDebugSymbols3::GetNextSymbolMatchWide(
IN ULONG64 Handle,
OUT OPTIONAL PWSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG MatchSize,
OUT OPTIONAL PULONG64 Offset
);
#ifdef UNICODE
#define GetNextSymbolMatchT GetNextSymbolMatchWide
#else
#define GetNextSymbolMatchT GetNextSymbolMatch
#endif
Parameters
Handle
Specifies the handle returned by StartSymbolMatch when the search was initialized.
Buffer
Receives the name of the symbol. If Buffer is NULL, the same symbol will be returned again next time one of these methods are called (with the same handle); this can
be used to determine the size of the name of the symbol.
BufferSize
Specifies the size in characters of the buffer.
MatchSize
Receives the size in characters of the name of the symbol. If MatchSize is NULL, this information is not returned.
Offset
Receives the location in the target's virtual address space of the symbol. If Offset is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
S_FALSE
The size of the buffer was too small for the name of the symbol, or Buffer was NULL.
E_NOINTERFACE
No more symbols were found matching the pattern.
This method may also return other error values. See Return Values for more details.
Interface Version
GetNextSymbolMatch is available in all versions of IDebugSymbols. GetNextSymbolMatchWide is available in IDebugSymbols3 and later versions.
Comments
The search must first be initialized by StartSymbolMatch. Once all the desired symbols have been found, EndSymbolMatch can be used to release the resources the engine
holds for the search.
For more information about symbols, see Symbols.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
EndSymbolMatch, StartSymbolMatch
2009 Microsoft Corporation
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
StartSymbolMatch
The StartSymbolMatch and GetNextSymbolMatchWide methods initialize a search for symbols whose names match a given pattern.
HRESULT
IDebugSymbols::GetNextSymbolMatch(
IN PCSTR Pattern,
OUT PULONG64 Handle
);
HRESULT
IDebugSymbols3::GetNextSymbolMatchWide(
IN PCWSTR Pattern,
OUT PULONG64 Handle
);
#ifdef UNICODE
#define GetNextSymbolMatchT GetNextSymbolMatchWide
#else
#define GetNextSymbolMatchT GetNextSymbolMatch
#endif
Parameters
Pattern
Specifies the pattern for which to search. The search will return all symbols whose names match this pattern. For details of the syntax of the pattern, see Symbol Syntax
and Symbol Matching and String Wildcard Syntax.
Handle
Receives the handle identifying the search. This handle can be passed to GetNextSymbolMatch and EndSymbolMatch.
Return Value
S_OK
The method was successful.
E_NOINTERFACE
The specified module was not found.
This method may also return other error values. See Return Values for more details.
Interface Version
StartSymbolMatch is available in all versions of IDebugSymbols. StartSymbolMatchWide is available in IDebugSymbols3 and later versions.
Comments
These methods initialize a symbol search. The results of the search can be obtained by repeated calls to GetNextSymbolMatch. When all the desired results have been found,
use EndSymbolMatch to release resources the engine holds for the search.
For more information about symbols, see Symbols.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
EndSymbolMatch, GetNextSymbolMatch
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetSymbolModule
The GetSymbolModule and GetSymbolModuleWide methods return the base address of module which contains the specified symbol.
HRESULT
IDebugSymbols::GetSymbolModule(
IN PCSTR Symbol,
OUT PULONG64 Base
);
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
HRESULT
IDebugSymbols3::GetSymbolModuleWide(
IN PCWSTR Symbol,
OUT PULONG64 Base
);
#ifdef UNICODE
#define GetSymbolModuleT GetSymbolModuleWide
#else
#define GetSymbolModuleT GetSymbolModule
#endif
Parameters
Symbol
Specifies the name of the symbol to look up. See the Comments section for details of the syntax of this name.
Base
Receives the location in the target's memory address space of the base of the module. For more information, see Modules.
Return Value
S_OK
The method was successful.
E_NOINTERFACE
The symbol or module could not be found.
This method may also return error values. See Return Values for more details.
Interface Version
GetSymbolModule is available in all versions of IDebugSymbols. GetSymbolModuleWide is available in IDebugSymbols3 and later versions.
Comments
The string Symbol must contain an exclamation point ( ! ). If Symbol is a module-qualified symbol name (for example, mymodules!main) or if the module name is omitted
(for example, !main), the engine will search for this symbol and return the module in which it is found. If Symbol contains just a module name (for example, mymodule!) the
engine returns the first module with this module name.
For more information about symbols, see Symbols.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
OutputSymbolByOffset
The OutputSymbolByOffset method looks up a symbol by address and prints the symbol name and other symbol information to the debugger console.
HRESULT
IDebugSymbols3::OutputSymbolByOffset(
IN ULONG OutputControl,
IN ULONG Flags,
IN ULONG64 Offset
);
Parameters
OutputControl
Specifies where to send the output. For possible values, see DEBUG_OUTCTL_XXX.
Flags
Specifies the flags used to determine what information is printed with the symbol.
The following flags can be present:
Bit-flag
Effect
DEBUG_OUTSYM_FORCE_OFFSET
Include the location of the symbol.
DEBUG_OUTSYM_SOURCE_LINE
Include the file name and line number of the source file where the symbol is defined.
DEBUG_OUTSYM_ALLOW_DISPLACEMENT Do not require an exact match for the symbols location.
This allows the Offset parameter to specify any address within the symbol's memory allocation - not just the base
address.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Offset
Specifies the location in the process's virtual address space of the symbol to be printed.
Return Value
S_OK
The method was successful.
E_NOINTERFACE
No symbol was found at the specified location.
This method may also return error values. See Return Values for more details.
Interface Version
OutputSymbolByOffset is available in IDebugSymbols3 and later versions.
Comments
For more information about symbols, see Symbols.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetNameByOffset
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
AddSymbolOptions
The AddSymbolOptions method turns on some of the engine's global symbol options.
HRESULT
IDebugSymbols::AddSymbolOptions(
IN PULONG Options
);
Parameters
Options
Specifies the symbol options to turns on. Options is a bit-set that will be ORed with the existing symbol options. For a description of the bit flags, see Setting Symbol
Options.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
AddSymbolOptions is available in all versions of IDebugSymbols.
Comments
After the symbol options have been changed, for each client the engine sends out notification to that client's IDebugEventCallbacks by passing the
DEBUG_CES_SYMBOL_OPTIONS flag to the IDebugEventCallbacks::ChangeSymbolState method.
For more information about symbols, see Symbols.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h. The options are defined in Dbghelp.h.
See Also
GetSymbolOptions, RemoveSymbolOptions, SetSymbolOptions
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetSymbolOptions
The GetSymbolOptions method returns the engine's global symbol options.
HRESULT
IDebugSymbols::GetSymbolOptions(
OUT PULONG Options
);
Parameters
Options
Receives the symbol options bit-set. For a description of the bit flags, see Setting Symbol Options.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetSymbolOptions is available in all versions of IDebugSymbols.
Comments
For more information about symbols, see Symbols.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h. The options are defined in Dbghelp.h.
See Also
AddSymbolOptions, RemoveSymbolOptions, SetSymbolOptions
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
RemoveSymbolOptions
The RemoveSymbolOptions method turns off some of the engine's global symbol options.
HRESULT
IDebugSymbols::RemoveSymbolOptions(
IN PULONG Options
);
Parameters
Options
Specifies the symbol options to turn off. Options is a bit-set; the new value of the symbol options will equal the old value AND NOT the value of Options. For a
description of the bit flags, see Setting Symbol Options.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
RemoveSymbolOptions is available in all versions of IDebugSymbols.
Comments
After the symbol options have been changed, for each client the engine sends out notification to that client's IDebugEventCallbacks by it passing the
DEBUG_CES_SYMBOL_OPTIONS flag to the IDebugEventCallbacks::ChangeSymbolState method.
Additional Information
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
SetSymbolOptions
The SetSymbolOptions method changes the engine's global symbol options.
HRESULT
IDebugSymbols::SetSymbolOptions(
IN PULONG Options
);
Parameters
Options
Specifies the new symbol options. Options is a bit-set; it will replace the existing symbol options. For a description of the bit flags, see Setting Symbol Options.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
SetSymbolOptions is available in all versions of IDebugSymbols.
Comments
This method will set the engine's global symbol options to those specified in Options. Unlike AddSymbolOptions, any symbol options not in the bit-set Options will be
removed.
After the symbol options have been changed, for each client the engine sends out notification to that client's IDebugEventCallbacks by passing the
DEBUG_CES_SYMBOL_OPTIONS flag to the IDebugEventCallbacks::ChangeSymbolState method.
For more information about symbols, see Symbols.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h. The options are defined in Dbghelp.h.
See Also
AddSymbolOptions, GetSymbolOptions, RemoveSymbolOptions
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
AppendSymbolPath
The AppendSymbolPath and AppendSymbolPathWide methods append directories to the symbol path.
IDebugSymbols::AppendSymbolPath(
IN PCSTR Addition
);
IDebugSymbols3::AppendSymbolPathWide(
IN PCWSTR Addition
);
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
#ifdef UNICODE
#define AppendSymbolPathT AppendSymbolPathWide
#else
#define AppendSymbolPathT AppendSymbolPath
#endif
Parameters
Addition
Specifies the directories to append to the symbol path. This is a string that contains symbol path elements separated by semicolons (;). Each symbol path element can
specify either a directory or a symbol server.
Return Value
S_OK
The method was successful.
These methods can also return error values. See Return Values for more details.
Interface Version
AppendSymbolPath is available in all versions of IDebugSymbols. AppendSymbolPathWide is available in IDebugSymbols3 and later versions.
Comments
For more information about manipulating the symbol path, see Using Symbols. For an overview of the symbol path and its syntax, see Symbol Path.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetSymbolPath, SetSymbolPath
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetSymbolPath
The GetSymbolPath and GetSymbolPathWide methods return the symbol path.
IDebugSymbols::GetSymbolPath(
OUT OPTIONAL PSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG PathSize
);
IDebugSymbols3::GetSymbolPathWide(
OUT OPTIONAL PSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG PathSize
);
#ifdef UNICODE
#define GetSymbolPathT GetSymbolPathWide
#else
#define GetSymbolPathT GetSymbolPath
#endif
Parameters
Buffer
Receives the symbol path. This is a string that contains symbol path elements separated by semicolons (;). Each symbol path element can specify either a directory or a
symbol server. If Buffer is NULL, this information is not returned.
BufferSize
Specifies the size, in characters, of the Buffer buffer.
PathSize
Receives the size, in characters, of the symbol path.
Return Value
S_OK
The method was successful.
S_FALSE
The method was successful. However, the buffer was not large enough to hold the symbol path and the path was truncated.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
These methods can also return error values. See Return Values for more details.
Interface Version
GetSymbolPath is available in all versions of IDebugSymbols. GetSymbolPathWide is available in IDebugSymbols3 and later versions.
Comments
For more information about manipulating the symbol path, see Using Symbols. For an overview of the symbol path and its syntax, see Symbol Path.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
SetSymbolPath, AppendSymbolPath
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SetSymbolPath
The SetSymbolPath and SetSymbolPathWide methods set the symbol path.
IDebugSymbols::SetSymbolPath(
IN PCSTR Path
);
IDebugSymbols3::SetSymbolPathWide(
IN PWSTR Path
);
#ifdef UNICODE
#define SetSymbolPathT SetSymbolPathWide
#else
#define SetSymbolPathT SetSymbolPath
#endif
Parameters
Path
Specifies the new symbol path. This is a string that contains symbol path elements separated by semicolons (;). Each symbol path element can specify either a directory
or a symbol server.
Return Value
S_OK
The method was successful.
These methods can also return error values. See Return Values for more details.
Interface Version
SetSymbolPath is available in all versions of IDebugSymbols. SetSymbolPathWide is available in IDebugSymbols3 and later versions.
Comments
For more information about manipulating the symbol path, see Using Symbols. For an overview of the symbol path and its syntax, see Symbol Path.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
AppendSymbolPath, GetSymbolPath
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
AddSyntheticSymbol
The AddSyntheticSymbol and AddSyntheticSymbolWide methods add a synthetic symbol to a module in the current process.
HRESULT
IDebugSymbols3::AddSyntheticSymbol(
IN ULONG64 Offset,
IN ULONG Size,
IN PCSTR Name,
IN ULONG Flags,
OUT OPTIONAL PDEBUG_MODULE_AND_ID
);
Id
HRESULT
IDebugSymbols3::AddSyntheticSymbolWide(
IN ULONG64 Offset,
IN ULONG Size,
IN PCSTR Name,
IN ULONG Flags,
OUT OPTIONAL PDEBUG_MODULE_AND_ID Id
);
#ifdef UNICODE
#define AddSyntheticSymbolT AddSyntheticSymbolWide
#else
#define AddSyntheticSymbolT AddSyntheticSymbol
#endif
Parameters
Offset
Specifies the location in the process's virtual address space of the synthetic symbol.
Size
Specifies the size in bytes of the synthetic symbol.
Name
Specifies the name of the synthetic symbol.
Flags
Set to DEBUG_ADDSYNTHSYM_DEFAULT.
Id
Receives the DEBUG_MODULE_AND_ID structure that identifies the synthetic symbol. If Id is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
AddSyntheticSymbol and AddSyntheticSymbolWide are available in IDebugSymbols3 and later versions.
Comments
The location of the synthetic symbol must not be the same as the location of another symbol.
If the module containing a synthetic symbol is reloaded - for example, by calling Reload with the Module parameter set to the name of the module - the synthetic symbol
will be discarded.
For more information about synthetic symbols, see Synthetic Symbols.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
RemoveSyntheticSymbol, AddSyntheticModule
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
RemoveSyntheticSymbol
The RemoveSyntheticSymbol method removes a synthetic symbol from a module in the current process.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
HRESULT
IDebugSymbols3::RemoveSyntheticSymbol(
IN PDEBUG_MODULE_AND_ID Id
);
Parameters
Id
Specifies the synthetic symbol to remove. This must be the same value returned in the Id parameter of AddSyntheticSymbol. See DEBUG_MODULE_AND_ID for
details about the type of this parameter.
Return Value
S_OK
The method was successful.
E_INVALIDARG
No synthetic symbol was found at the specified location. This is returned if a synthetic symbol at this location was previously removed or discarded.
This method may also return error values. See Return Values for more details.
Interface Version
RemoveSyntheticSymbol is available in IDebugSymbols3 and later versions.
Comments
If the module containing a synthetic symbol is reloaded - for example, by calling Reload with the Module parameter set to the name of the module - the synthetic symbol
will be discarded.
For more information about synthetic symbols, see Synthetic Symbols.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
AddSyntheticSymbol, RemoveSyntheticModule
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetTypeId
The GetTypeId and GetTypeIdWide methods look up the specified type and return its type ID.
HRESULT
IDebugSymbols::GetTypeId(
IN ULONG64 Module,
IN PCSTR Name,
OUT PULONG TypeId
);
HRESULT
IDebugSymbols3::GetTypeIdWide(
IN ULONG64 Module,
IN PCWSTR Name,
OUT PULONG TypeId
);
#ifdef UNICODE
#define GetTypeIdT GetTypeIdWide
#else
#define GetTypeIdT GetTypeId
#endif
Parameters
Module
Specifies the base address of the module to which the type belongs. For more information, see Modules. If Name contains a module name, Module is ignored.
Name
Specifies the name of the type whose type ID is desired. If Name is a module-qualified name (for example mymodule!main), the Module parameter is ignored.
TypeId
Receives the type ID of the symbol.
Return Value
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetTypeId is available in all versions of IDebugSymbols. GetTypeIdWide is available in IDebugSymbols3 and later versions.
Comments
If the specified symbol is a type, these methods return the type ID for that type; otherwise, they return the type ID for the type of the symbol.
A variable whose type was defined using typedef has a type ID that identifies the original type, not the type created by typedef. In the following example, the type ID of
MyInstance corresponds to the name MyStruct (this correspondence can be seen by passing the type ID to GetTypeName):
struct MyStruct { int a; };
typedef struct MyStruct MyType;
MyType MyInstance;
Moreover, calling these methods for MyStruct and MyType yields type IDs corresponding to MyStruct and MyType, respectively.
For more information about symbols and symbol names, see Symbols.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetOffsetTypeId, GetSymbolTypeId
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetOffsetTypeId
The GetOffsetTypeId method returns the type ID of the symbol closest to the specified memory location.
HRESULT
IDebugSymbols::GetOffsetTypeId(
IN ULONG64 Offset,
OUT PULONG TypeId,
OUT OPTIONAL PULONG64 Module
);
Parameters
Offset
Specifies the location in the target's memory for the symbol. The symbol closest to this location is used.
TypeId
Receives the type ID of the symbol.
Module
Specifies the location in the target's memory address space of the base of the module to which the symbol belongs. For more information, see Modules. If Module is
NULL, this information is not returned.
Return Value
S_OK
The method was successful
This method may also return error values. See Return Values for more details.
Interface Version
GetOffsetTypeId is available in all versions of IDebugSymbols.
Comments
For more information about symbols, see Symbols.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetTypeId, GetSymbolTypeId
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetSymbolTypeId
The GetSymbolTypeId and GetSymbolTypeIdWide methods return the type ID and module of the specified symbol.
HRESULT
IDebugSymbols::GetSymbolTypeId(
IN PCSTR Symbol,
OUT PULONG TypeId,
OUT OPTIONAL PULONG64 Module
);
HRESULT
IDebugSymbols3::GetSymbolTypeIdWide(
IN PCWSTR Symbol,
OUT PULONG TypeId,
OUT OPTIONAL PULONG64 Module
);
#ifdef UNICODE
#define GetSymbolTypeIdT GetSymbolTypeIdWide
#else
#define GetSymbolTypeIdT GetSymbolTypeId
#endif
Parameters
Symbol
Specifies the expression whose type ID is requested. See the Comments section for details on the syntax of this expression.
TypeId
Receives the type ID.
Module
Receives the base address of the module containing the symbol. For more information, see Modules. If Module is NULL, this information is not returned.
Return Value
S_OK
The method was successful
This method may also return error values. See Return Values for more details.
Interface Version
GetSymbolTypeId is available in all versions of IDebugSymbols. GetSymbolTypeIdWide is available in IDebugSymbols3 and later versions.
Comments
The Symbol expression may contain structure fields, pointer dereferencing, and array dereferencing for example my_struct.some_field[0].
For more information about symbols, see Symbols.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetTypeId, GetSymbolTypeId
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetTypeName
The GetTypeName and GetTypeNameWide methods return the name of the type symbol specified by its type ID and module.
HRESULT
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
IDebugSymbols::GetTypeName(
IN ULONG64 Module,
IN ULONG TypeId,
OUT OPTIONAL PSTR NameBuffer,
IN ULONG NameBufferSize,
OUT OPTIONAL PULONG NameSize
);
HRESULT
IDebugSymbols3::GetTypeNameWide(
IN ULONG64 Module,
IN ULONG TypeId,
OUT OPTIONAL PWSTR NameBuffer,
IN ULONG NameBufferSize,
OUT OPTIONAL PULONG NameSize
);
#ifdef UNICODE
#define GetTypeNameT GetTypeNameWide
#else
#define GetTypeNameT GetTypeName
#endif
Parameters
Module
Specifies the base address of the module to which the type belongs. For more information, see Modules.
TypeId
Specifies the type ID of the type.
NameBuffer
Receives the name of the type. If NameBuffer is NULL, this information is not returned.
NameBufferSize
Specifies the size in characters of the buffer NameBuffer.
NameSize
Receives the size in characters of the type's name. If NameSize is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
S_FALSE
The method was successful. However, the buffer was not large enough to hold the name of the type and it was truncated.
E_FAIL
The specified type could not be found in the specified module.
This method may also return other error values. See Return Values for more details.
Interface Version
GetTypeName is available in all versions of IDebugSymbols. GetTypeNameWide is available in IDebugSymbols3 and later versions.
Comments
For more information about symbols, see Symbols.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetTypeSize
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetTypeSize
The GetTypeSize method returns the number of bytes of memory an instance of the specified type requires.
HRESULT
IDebugSymbols::GetTypeSize(
IN ULONG64 Module,
IN ULONG TypeId,
OUT PULONG Size
);
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Parameters
Module
Specifies the base address of the module containing the type. For more information, see Modules.
TypeId
Specifies the type ID of the type.
Size
Receives the number of bytes of memory an instance of the specified type requires.
Return Value
S_OK
The method was successful
This method may also return error values. See Return Values for more details.
Interface Version
GetTypeSize is available in all versions of IDebugSymbols.
Comments
For more information about symbols, see Symbols.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetTypeName
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
AddTypeOptions
The AddTypeOptions method turns on some type formatting options for output generated by the engine.
HRESULT
IDebugSymbols2::AddTypeOptions(
IN ULONG Options
);
Parameters
Options
Specifies type formatting options to turn on. Options is a bit-set that will be ORed with the existing type formatting options. For a description of the bit flags, see
DEBUG_TYPEOPTS_XXX.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
AddTypeOptions is available in IDebugSymbols2 and later versions.
Comments
After the type options have been changed, for each client the engine sends out notification to that client's IDebugEventCallbacks by passing the
DEBUG_CES_TYPE_OPTIONS flag to the IDebugEventCallbacks::ChangeSymbolState method.
For more information about types, see Types.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetTypeOptions, RemoveTypeOptions, SetTypeOptions
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetTypeOptions
The GetTypeOptions method returns the type formatting options for output generated by the engine.
HRESULT
IDebugSymbols2::GetTypeOptions(
OUT PULONG Options
);
Parameters
Options
Receives the type formatting options. Options is a bit-set; for a description of the bit flags, see DEBUG_TYPEOPTS_XXX.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetTypeOptions is available in IDebugSymbols2 and later versions.
Comments
After the type options have been changed, for each client the engine sends out notification to that client's IDebugEventCallbacks by passing the
DEBUG_CES_TYPE_OPTIONS flag to the IDebugEventCallbacks::ChangeSymbolState method.
For more information about types, see Types.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
AddTypeOptions, RemoveTypeOptions, SetTypeOptions
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
RemoveTypeOptions
The RemoveTypeOptions method turns off some type formatting options for output generated by the engine.
HRESULT
IDebugSymbols2::RemoveTypeOptions(
IN ULONG Options
);
Parameters
Options
Specifies the type formatting options to turn off. Options is a bit-set; the new value of the options will equal the old value AND NOT the value of Options. For a
description of the bit flags, see DEBUG_TYPEOPTS_XXX.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
RemoveTypeOptions is available in IDebugSymbols2 and later versions.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Comments
After the type options have been changed, for each client the engine sends out notification to that client's IDebugEventCallbacks by passing the
DEBUG_CES_TYPE_OPTIONS flag to the IDebugEventCallbacks::ChangeSymbolState method.
For more information about types, see Types.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
AddTypeOptions, GetTypeOptions, SetTypeOptions
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SetTypeOptions
The SetTypeOptions method changes the type formatting options for output generated by the engine.
HRESULT
IDebugSymbols2::SetTypeOptions(
IN ULONG Options
);
Parameters
Options
Specifies the new value for the type formatting options. Options is a bit-set; it will replace the existing options. For a description of the bit flags, see
DEBUG_TYPEOPTS_XXX.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
SetTypeOptions is available in IDebugSymbols2 and later versions.
Comments
After the type options have been changed, for each client the engine sends out notification to that client's IDebugEventCallbacks by passing the
DEBUG_CES_TYPE_OPTIONS flag to the IDebugEventCallbacks::ChangeSymbolState method.
For more information about types, see Types.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
AddTypeOptions, GetTypeOptions, RemoveTypeOptions
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
IDebugSystemObjects
The IDebugSystemObjects interface includes the following methods:
GetEventProcess
GetEventThread
GetNumberProcesses
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetProcessIdByDataOffset
GetCurrentProcessDataOffset
GetCurrentProcessExecutableName
GetProcessIdByHandle
GetCurrentProcessHandle
GetCurrentProcessId
SetCurrentProcessId
GetProcessIdsByIndex
GetProcessIdByPeb
GetCurrentProcessPeb
GetProcessIdBySystemId
GetCurrentProcessSystemId
GetNumberThreads
GetTotalNumberThreads
GetThreadIdByDataOffset
GetCurrentThreadDataOffset
GetThreadIdByHandle
GetCurrentThreadHandle
GetCurrentThreadId
SetCurrentThreadId
GetThreadIdsByIndex
GetThreadIdByProcessor
GetThreadIdBySystemId
GetCurrentThreadSystemId
GetThreadIdByTeb
GetCurrentThreadTeb
GetCurrentProcessUpTime
GetImplicitProcessDataOffset
SetImplicitProcessDataOffset
GetImplicitThreadDataOffset
SetImplicitThreadDataOffset
GetNumberSystems
GetEventSystem
GetSystemIdsByIndex
GetCurrentSystemId
SetCurrentSystemId
GetSystemByServer
GetCurrentSystemServer
GetCurrentSystemServerName
GetTotalNumberThreadsAndProcesses
2009 Microsoft Corporation
Send feedback on this topic
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetEventThread
The GetEventThread method returns the engine thread ID for the thread on which the last event occurred.
HRESULT
IDebugSystemObjects::GetEventThread(
OUT PULONG Id
);
Parameters
Id
Receives the engine thread ID.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetEventThread is available in all versions of IDebugSystemObjects.
Comments
In kernel-mode debugging, the engine thread ID for the virtual thread representing the processor on which the event occurred is returned.
For more information about threads, see Threads and Processes. For details about debugger engine events, see Monitoring Events.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetEventProcess
The GetEventProcess method returns the engine process ID for the process on which the last event occurred.
HRESULT
IDebugSystemObjects::GetEventProcess(
OUT PULONG Id
);
Parameters
Id
Receives the engine process ID.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetEventProcess is available in all versions of IDebugSystemObjects.
Comments
In kernel-mode debugging, the engine process ID for the virtual process representing the kernel is returned.
For more information about processes, see Threads and Processes. For details about debugger engine events, see Monitoring Events.
Requirements
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetNumberProcesses
The GetNumberProcesses method returns the number of processes for the current target.
HRESULT
IDebugSystemObjects::GetNumberProcesses(
OUT PULONG Number
);
Parameters
Number
Receives the number of processes.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetNumberProcesses is available in all versions of IDebugSystemObjects.
Comments
In kernel-mode debugging, there is only a single virtual process representing the kernel.
In user-mode debugging, the number of processes changes with the create-process and exit-process debugging events.
For more information about processes, see Threads and Processes.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetProcessIdByDataOffset
The GetProcessIdByDataOffset method returns the engine process ID for the specified process. The process is specified by its data offset.
HRESULT
IDebugSystemObjects::GetProcessIdByDataOffset(
IN ULONG64 Offset,
OUT PULONG Id
);
Parameters
Offset
Specifies the location in the target's virtual address space of the data offset of the process.
Id
Receives the engine process ID for the process.
Return Value
S_OK
The method was successful.
E_NOTIMPL
The current target is a kernel-mode target. This method is currently not available in kernel-mode debugging.
This method may also return other error values. See Return Values for more details.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Interface Version
GetProcessIdByDataOffset is available in all versions of IDebugSystemObjects.
Comments
This method is currently not available in kernel-mode debugging.
In user-mode debugging, this method behaves the same as GetProcessIdByPeb.
For more information about processes, see Threads and Processes.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetCurrentProcessDataOffset
The GetCurrentProcessDataOffset method returns the location of the system data structure describing the current process.
HRESULT
IDebugSystemObjects::GetCurrentProcessDataOffset(
OUT PULONG64 Offset
);
Parameters
Offset
Receives the location in the target's virtual address space of the system data structure describing the current process.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetCurrentProcessDataOffset is available in all versions of IDebugSystemObjects.
Comments
In user-mode debugging, the location returned is of the process environment block (PEB) for the current process. This is the same location returned by
GetCurrentProcessPeb.
In kernel-mode debugging, the location returned is of the KPROCESS structure for the system process in which the last event occurred.
Note In kernel mode, the current process of the target is always the single virtual process the debugger engine created for the kernel. However, because events may occur in
different system processes, the KPROCESS location returned by this method may change.
For more information about processes, see Threads and Processes. For details about the PEB and KPROCESS structures, see Microsoft Windows Internals by David Solomon
and Mark Russinovich.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetCurrentProcessExecutableName
The GetCurrentProcessExecutableName and GetCurrentProcessExecutableNameWide methods return the name of executable file loaded in the current process.
HRESULT
IDebugSystemObjects::GetCurrentProcessExecutableName(
OUT OPTIONAL PSTR Buffer,
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
IN ULONG BufferSize,
OUT OPTIONAL PULONG ExeSize
);
HRESULT
IDebugSystemObjects4::GetCurrentProcessExecutableNameWide(
OUT OPTIONAL PWSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG ExeSize
);
#ifdef UNICODE
#define GetCurrentProcessExecutableNameT GetCurrentProcessExecutableNameWide
#else
#define GetCurrentProcessExecutableNameT GetCurrentProcessExecutableName
#endif
Parameters
Buffer
Receives the name of the executable file. If Buffer is NULL, this information is not returned.
BufferSize
Specifies the size in characters of the buffer Buffer.
ExeSize
Receives the size in characters of the name of the executable file. If ExeSize is NULL, this information is not returned.
Return Value
S_OK
The method was successful.
S_FALSE
The method was successful. However, the buffer was not large enough to hold the name of the executable file and it was truncated.
This method may also return error values. See Return Values for more details.
Interface Version
GetCurrentProcessExecutableName is available in all versions of IDebugSystemObjects. GetCurrentProcessExecutableNameWide is available in
IDebugSystemObjects4 and later versions.
Comments
These methods are only available in user-mode debugging.
If the engine cannot determine the name of the executable file, it writes the string "?NoImage?" to the buffer.
For more information about processes, see Threads and Processes.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetProcessIdByHandle
The GetProcessIdByHandle method returns the engine process ID for the specified process. The process is specified by its system handle.
HRESULT
IDebugSystemObjects::GetProcessIdByHandle(
IN ULONG64 Handle,
OUT PULONG Id
);
Parameters
Handle
Specifies the handle of the process whose process ID is requested. This handle must be a process handle previously retrieved from the debugger engine.
Id
Receives the engine process ID.
Return Value
S_OK
The method was successful.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
This method may also return error values. See Return Values for more details.
Interface Version
GetProcessIdByHandle is available in all versions of IDebugSystemObjects.
Comments
For more information about processes, see Threads and Processes. For details on system handles, see Handles.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetCurrentProcessHandle
The GetCurrentProcessHandle method returns the system handle for the current process.
HRESULT
IDebugSystemObjects::GetCurrentProcessHandle(
OUT PULONG64 Handle
);
Parameters
Handle
Receives the system handle of the current process.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetCurrentProcessHandle is available in all versions of IDebugSystemObjects
Comments
In kernel-mode debugging, the only process in the target is the virtual process created for the kernel. In this case, an artificial handle is created. The artificial handle can only
be used with the debugger engine API.
For more information about processes, see Threads and Processes. For details on system handles, see Handles.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetCurrentProcessId
The GetCurrentProcessId method returns the engine process ID for the current process.
HRESULT
IDebugSystemObjects::GetCurrentProcessId(
OUT PULONG Id
);
Parameters
Id
Receives the engine process ID for the current process.
Return Value
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetCurrentProcessId is available in all versions of IDebugSystemObjects.
Comments
For more information about processes, see Threads and Processes.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SetCurrentProcessId
The SetCurrentProcessId method makes the specified process the current process.
HRESULT
IDebugSystemObjects::SetCurrentProcessId(
IN ULONG Id
);
Parameters
Id
Specifies the engine process ID for the process that is to become the current process.
Return Value
S_OK
The method was successful.
E_NOINTERFACE
No process with the given process ID was found.
E_FAIL
No suitable candidate for the current thread could be found in the process.
This method may also return other error values. See Return Values for more details.
Interface Version
SetCurrentProcessId is available in all versions of IDebugSystemObjects.
Comments
This method also changes the current thread, and may change the current target and current computer.
If the process is changed, the callback IDebugEventCallbacks::ChangeEngineState will be called with the DEBUG_CES_CURRENT_THREAD bit set.
Note In kernel-mode debugging, the current process is a virtual process, it is not a system process. This method cannot be used to change between system processes in kernelmode debugging. However, the implicit process may be changed by using SetImplicitProcessDataOffset.
For more information about processes, see Threads and Processes. For details on monitoring events, see Monitoring Events.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetProcessIdsByIndex
The GetProcessIdsByIndex method returns the engine process ID and system process ID for the specified processes in the current target.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
HRESULT
IDebugSystemObjects::GetProcessIdsByIndex(
IN ULONG Start,
IN ULONG Count,
OUT OPTIONAL PULONG Ids,
OUT OPTIONAL PULONG SysIds
);
Parameters
Start
Specifies the index of the first process whose ID is requested.
Count
Specifies the number of processes whose IDs are requested.
Ids
Receives the engine process IDs. If Ids is NULL, this information is not returned; otherwise, Ids is treated as an array of Count ULONG values.
SysIds
Receives the system process IDs. If SysIds is NULL, this information is not returned; otherwise, SysIds is treated as an array of Count ULONG values.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetProcessIdsByIndex is available in all versions of IDebugSystemObjects.
Comments
The index of the first process is zero. The index of the last process is the number of processes returned by GetNumberProcesses minus one.
For more information about processes, see Threads and Processes.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetProcessIdByPeb
The GetProcessIdByPeb method returns the engine process ID for the specified process. The process is specified by its process environment block (PEB).
HRESULT
IDebugSystemObjects::GetProcessIdByPeb(
IN ULONG64 Offset,
OUT PULONG Id
);
Parameters
Offset
Specifies the location in the target's virtual address space of the PEB of the process whose process ID is requested.
Id
Receives the engine process ID.
Return Value
S_OK
The method was successful.
E_NOTIMPL
The target is a kernel-mode target. This method is currently not available in kernel-mode debugging.
This method may also return other error values. See Return Values for more details.
Interface Version
GetProcessIdByPeb is available in all versions of IDebugSystemObjects.
Comments
This method is not available in kernel-mode debugging.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetCurrentProcessPeb
The GetCurrentProcessPeb method returns the process environment block (PEB) of the current process.
HRESULT
IDebugSystemObjects::GetCurrentProcessPeb(
OUT PULONG64 Offset
);
Parameters
Offset
Receives the location in the target's virtual address space of the PEB of the current process.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetCurrentProcessPeb is available in all versions of IDebugSystemObjects.
Comments
In user-mode debugging, this method provides the same information as GetCurrentProcessDataOffset.
In kernel-mode debugging, the location returned is that of the PEB structure for the system process in which the last event occurred.
Note In kernel mode, the current process of the target is always the single virtual process the debugger engine created for the kernel. However, because events may occur in
different system processes, the PEB location returned by this method may change.
For more information about processes, see Threads and Processes.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetProcessIdBySystemId
The GetProcessIdBySystemId method returns the engine process ID for a process specified by its system process ID.
HRESULT
IDebugSystemObjects::GetProcessIdBySystemId(
IN ULONG SysId,
OUT PULONG Id
);
Parameters
SysId
Specifies the system process ID.
Id
Receives the engine process ID.
Return Value
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
S_OK
The method was successful.
E_NOTIMPL
The target is a kernel-mode target.
This method may also return other error values. See Return Values for more details.
Interface Version
GetProcessIdBySystemId is available in all versions of IDebugSystemObjects.
Comments
This method is only available in user-mode debugging.
For more information about processes, see Threads and Processes.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetCurrentProcessSystemId
The GetCurrentProcessSystemId method returns the system process ID of the current process.
HRESULT
IDebugSystemObjects::GetCurrentProcessSystemId(
OUT PULONG SysId
);
Parameters
SysId
Receives the system process ID.
Return Value
S_OK
The method was successful.
E_NOTIMPL
The target is a kernel-mode target.
This method may also return other error values. See Return Values for more details.
Interface Version
GetCurrentProcessSystemId is available in all versions of IDebugSystemObjects.
Comments
This method is only available in user-mode debugging.
For more information about processes, see Threads and Processes.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetNumberThreads
The GetNumberThreads method returns the number of threads in the current process.
HRESULT
IDebugSystemObjects::GetNumberThreads(
OUT PULONG Number
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
);
Parameters
Number
Receives the number of threads in the current process.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetNumberThreads is available in all versions of IDebugSystemObjects.
Comments
In kernel-mode debugging, there is a virtual thread representing each processor.
In user-mode debugging, the number of threads changes with the IDebugEventCallbacks::CreateThread and IDebugEventCallbacks::ExitThread events.
For more information about threads, see Threads and Processes.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetTotalNumberThreads
The GetTotalNumberThreads method returns the total number of threads for all the processes in the current target, in addition to the largest number of threads in any
process for the current target.
HRESULT
IDebugSystemObjects::GetTotalNumberThreads(
OUT PULONG Total,
OUT PULONG LargestProcess
);
Parameters
Total
Receives the total number of threads for all the processes in the current target.
LargestProcess
Receives the largest number of threads in any process for the current target.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetTotalNumberThreads is available in all versions of IDebugSystemObjects.
Comments
For more information about threads, see Threads and Processes.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetThreadIdByDataOffset
The GetThreadIdByDataOffset method returns the engine thread ID for the specified thread. The thread is specified by its system data structure.
HRESULT
IDebugSystemObjects::GetThreadIdByDataOffset(
IN ULONG64 Offset,
OUT PULONG Id
);
Parameters
Offset
Specifies the location of the system data structure for the thread.
Id
Receives the engine thread ID.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetThreadIdByDataOffset is available in all versions of IDebugSystemObjects.
Comments
In kernel-mode debugging, this method returns the engine thread ID for the virtual thread representing the processor on which the specified thread is executing. If the thread is
not executing on a processor, this method will fail.
For more information about threads, see Threads and Processes.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetCurrentThreadDataOffset
The GetCurrentThreadDataOffset method returns the location of the system data structure for the current thread.
HRESULT
IDebugSystemObjects::GetCurrentThreadDataOffset(
OUT PULONG64 Offset
);
Parameters
Offset
Receives the location of the system data structure for the current thread.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetCurrentThreadDataOffset is available in all versions of IDebugSystemObjects.
Comments
In user-mode debugging, the location returned is of the thread environment block (TEB) for the current thread. This is the same location returned by GetCurrentThreadTeb.
In kernel-mode debugging, the location returned is of the KTHREAD structure of the system thread that was executing on the processor represented by the current thread
when the last event occurred.
Note In kernel mode debugging, the current thread is always a virtual thread the debugger engine created for a processor in the target computer. Because events may occur in
different system threads, the KTHREAD location for a virtual thread may change.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
For more information about threads, see Threads and Processes. For details on the KTHREAD and TEB structures, see Microsoft Windows Internals by David Solomon and
Mark Russinovich.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetThreadIdByHandle
The GetThreadIdByHandle method returns the engine thread ID for the specified thread. The thread is specified by its system handle.
HRESULT
IDebugSystemObjects::GetThreadIdByHandle(
IN ULONG64 Handle,
OUT PULONG Id
);
Parameters
Handle
Specifies the system handle of the thread whose thread ID is requested.
Id
Receives the engine thread ID.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetThreadIdByHandle is available in all versions of IDebugSystemObjects.
Comments
In kernel-mode debugging, because the handle is an artificial handle for a processor, this method returns the engine thread ID for the virtual thread representing that processor.
For more information about threads, see Threads and Processes. For details on system handles, see Handles.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetCurrentThreadHandle
The GetCurrentThreadHandle method returns the system handle for the current thread.
HRESULT
IDebugSystemObjects::GetCurrentThreadHandle(
OUT PULONG64 Handle
);
Parameters
Handle
Receives the current thread's system handle.
Return Value
S_OK
The method was successful.
This method may also return other error values. See Return Values for more details.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Interface Version
GetCurrentThreadHandle is available in all versions of IDebugSystemObjects.
Comments
In kernel-mode debugging, an artificial handle is created because the threads are virtual threads.
For more information about threads, see Threads and Processes. For details on system handles, see Handles.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetCurrentThreadId
The GetCurrentThreadId method returns the engine thread ID for the current thread.
HRESULT
IDebugSystemObjects::GetCurrentThreadId(
OUT PULONG Id
);
Parameters
Id
Receives the engine thread ID.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetCurrentThreadId is available in all versions of IDebugSystemObjects.
Comments
For more information about threads, see Threads and Processes.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SetCurrentThreadId
The SetCurrentThreadId method makes the specified thread the current thread.
HRESULT
IDebugSystemObjects::SetCurrentThreadId(
IN ULONG Id
);
Parameters
Id
Specifies the engine thread ID of the thread that is to become the current thread.
Return Value
S_OK
The method was successful.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
E_NOINTERFACE
No thread with the specified ID was found.
This method may also return other error values. See Return Values for more details.
Interface Version
SetCurrentThreadId is available in all versions of IDebugSystemObjects.
Comments
This method may also change the current process, current target, and current computer.
If the thread is changed, the callback IDebugEventCallbacks::ChangeEngineState will be called with the DEBUG_CES_CURRENT_THREAD bit set.
Note In kernel-mode debugging, the current thread is a virtual thread, it is not a system thread. This method cannot be used to change between system threads in kernel-mode
debugging. However, the implicit thread may be changed by using SetImplicitThreadDataOffset.
For more information about threads, see Threads and Processes. For details on monitoring events, see Monitoring Events.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetThreadIdsByIndex
The GetThreadIdsByIndex method returns the engine and system thread IDs for the specified threads in the current process.
HRESULT
IDebugSystemObjects::GetThreadIdsByIndex(
IN ULONG Start,
IN ULONG Count,
OUT OPTIONAL PULONG Ids,
OUT OPTIONAL PULONG SysIds
);
Parameters
Start
Specifies the index of the first thread whose IDs are requested.
Count
Specifies the number of threads whose IDs are requested.
Ids
Receives the engine thread IDs. If Ids is NULL, this information is not returned; otherwise, Ids is treated as an array of Count ULONG valuess.
SysIds
Receives the system thread IDs. If SysIds is NULL, this information is not returned; otherwise, SysIds is treated as an array of Count ULONG values.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetThreadIdsByIndex is available in all versions of IDebugSystemObjects.
Comments
The index of the first thread is zero. The index of the last thread is the number of threads returned by GetNumberThreads minus one.
For more information about threads, see Threads and Processes.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetThreadIdByProcessor
The GetThreadIdByProcessor method returns the engine thread ID for the kernel-mode virtual thread corresponding to the specified processor.
HRESULT
IDebugSystemObjects::GetThreadIdByProcessor(
IN ULONG Processor,
OUT PULONG Id
);
Parameters
Processor
Specifies the processor corresponding to the desired thread.
Id
Receives the engine thread ID.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetThreadIdByProcessor is available in all versions of IDebugSystemObjects.
Comments
This method is only available in kernel-mode debugging.
For more information about threads, see Threads and Processes.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetThreadIdBySystemId
The GetThreadIdBySystemId method returns the engine thread ID for the specified thread. The thread is specified by its system thread ID.
HRESULT
IDebugSystemObjects::GetThreadIdBySystemId(
IN ULONG SysId,
OUT PULONG Id
);
Parameters
SysId
Specifies the system thread ID.
Id
Receives the engine thread ID.
Return Value
S_OK
The method was successful.
E_NOTIMPL
The target is a kernel-mode target.
This method may also return other error values. See Return Values for more details.
Interface Version
GetThreadIdBySystemId is available in all versions of IDebugSystemObjects.
Comments
This method is only available in user-mode debugging.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetCurrentThreadSystemId
The GetCurrentThreadSystemId method returns the system thread ID of the current thread.
HRESULT
IDebugSystemObjects::GetCurrentThreadSystemId(
OUT PULONG SysId
);
Parameters
SysId
Receives the system thread ID.
Return Value
S_OK
The method was successful.
E_NOTIMPL
The target is a kernel-mode target.
This method may also return other error values. See Return Values for more details.
Interface Version
GetCurrentThreadSystemId is available in all versions of IDebugSystemObjects.
Comments
This method is only available in user-mode debugging.
For more information about threads, see Threads and Processes.
Requirements
Versions:
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetThreadIdByTeb
The GetThreadIdByTeb method returns the engine thread ID of the specified thread. The thread is specified by its thread environment block (TEB).
HRESULT
IDebugSystemObjects::GetThreadIdByTeb(
IN ULONG64 Offset,
OUT PULONG Id
);
Parameters
Offset
Specifies the location of the thread's TEB.
Id
Receives the engine thread ID.
Return Value
S_OK
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetCurrentThreadTeb
The GetCurrentThreadTeb method returns the location of the thread environment block (TEB) for the current thread.
HRESULT
IDebugSystemObjects::GetCurrentThreadTeb(
OUT PULONG64 Offset
);
Parameters
Offset
Receives the location in the target's virtual address space of the TEB for the current thread.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetCurrentThreadTeb is available in all versions of IDebugSystemObjects.
Comments
In user-mode debugging, this method provides the same information as GetCurrentThreadDataOffset.
In kernel-mode debugging, the location returned is of the TEB structure of the system thread that was executing on the processor represented by the current thread when the
last event occurred.
Note In kernel mode, the current thread is always a virtual thread the debugger created for a processor in the target computer. Because events may occur in different system
threads, the TEB location for a virtual thread may change.
For more information about threads, see Threads and Processes. For details on the TEB structure, see Microsoft Windows Internals by David Solomon and Mark Russinovich.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetCurrentProcessUpTime
The GetCurrentProcessUpTime method returns the length of time the current process has been running.
HRESULT
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
IDebugSystemObjects2::GetCurrentProcessUpTime(
OUT PULONG UpTime
);
Parameters
UpTime
Receives the number of seconds the current process has been running.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetCurrentProcessUpTime is available in IDebugSystemObjects2 and later versions.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetImplicitProcessDataOffset
The GetImplicitProcessDataOffset method returns the implicit process for the current target.
HRESULT
IDebugSystemObjects2::GetImplicitProcessDataOffset(
OUT PULONG64 Offset
);
Parameters
Offset
Receives the location in the target's memory address space of the data structure of the system process that is the implicit process for the current target.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetImplicitProcessDataOffset is available in IDebugSystemObjects2 and later versions.
Comments
In kernel-mode debugging, the data structure is the KPROCESS structure for the process.
In user-mode debugging, the data structure is the process environment block (PEB) for the process.
For more information about the implicit process, see Threads and Processes. For details on the KPROCESS and PEB structures, see Microsoft Windows Internals by David
Solomon and Mark Russinovich.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SetImplicitProcessDataOffset
The SetImplicitProcessDataOffset method sets the implicit process for the current target.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
HRESULT
IDebugSystemObjects2::SetImplicitProcessDataOffset(
IN ULONG64 Offset
);
Parameters
Offset
Specifies the location in the target's memory address space of the data structure of the system process that is to become the implicit process for the current target. If this is
zero, the implicit process for the current target is set to the default implicit process.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
SetImplicitProcessDataOffset is available in IDebugSystemObjects2 and later versions.
Comments
In kernel-mode debugging, the data structure is the KPROCESS structure for the process.
In user-mode debugging, the data structure is the process environment block (PEB) for the process.
Caution Because it is possible to use SetImplicitThreadDataOffset to set the implicit thread independently of the implicit process, the implicit thread might not belong to
the implicit process. This can cause errors if you attempt to access any of the user state for the implicit thread, because it will be incompatible with the virtual address space
(specified by the implicit process).
For more information about the current implicit process, see Threads and Processes. For details on the KPROCESS and PEB structures, see Microsoft Windows Internals by
David Solomon and Mark Russinovich.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetImplicitThreadDataOffset
The GetImplicitThreadDataOffset method returns the implicit thread for the current process.
HRESULT
IDebugSystemObjects2::GetImplicitThreadDataOffset(
OUT PULONG64 Offset
);
Parameters
Offset
Receives the location in the target's memory address space of the data structure of the system thread that is the implicit thread for the current process.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetImplicitThreadDataOffset is available in IDebugSystemObjects2 and later versions.
Comments
In kernel-mode debugging, the data structure is the KTHREAD structure for the process.
In user-mode debugging, the data structure is the thread environment block (TEB) for the process.
For more information about the implicit thread, see Threads and Processes. For details on the KTHREAD structure and TEB, see Microsoft Windows Internals by David
Solomon and Mark Russinovich.
Requirements
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
SetImplicitThreadDataOffset
The SetImplicitThreadDataOffset method sets the implicit thread for the current process.
HRESULT
IDebugSystemObjects2::SetImplicitThreadDataOffset(
IN ULONG64 Offset
);
Parameters
Offset
Specifies the location in the target's memory address space of the data structure of the system thread that is to become the implicit thread for the current process. If this is
zero, the implicit thread for the current process is set to the default implicit thread.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
SetImplicitThreadDataOffset is available in IDebugSystemObjects2 and later versions.
Comments
In kernel-mode debugging, the data structure is the KTHREAD structure for the process.
In user-mode debugging, the data structure is the thread environment block (TEB) for the process.
Caution Because it is possible to use SetImplicitProcessDataOffset to set the implicit process independently of the implicit thread, the implicit thread might not belong to
the implicit process. This can cause errors if you attempt to access any of the user state for the implicit thread, because it will be incompatible with the virtual address space
(specified by the implicit process).
For more information about the current implicit thread, see Threads and Processes. For details on the KTHREAD structure and TEB, see Microsoft Windows Internals by
David Solomon and Mark Russinovich.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetNumberSystems
The GetNumberSystems method returns the number of targets to which the engine is currently connected.
HRESULT
IDebugSystemObjects3::GetNumberSystems(
OUT PULONG Number
);
Parameters
Number
Receives the number of targets.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Interface Version
GetNumberSystems is available in IDebugSystemObjects3 and later versions.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
Debugging Session and Execution Model
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetEventSystem
The GetEventSystem method returns the engine target ID for the target in which the last event occurred.
HRESULT
IDebugSystemObjects3::GetEventSystem(
OUT PULONG Id
);
Parameters
Id
Receives the engine target ID.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetEventSystem is available in IDebugSystemObjects3 and later versions.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
Monitoring Events, Debugging Session and Execution Model
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetSystemIdsByIndex
The GetSystemIdsByIndex method returns the engine target IDs for the specified targets.
HRESULT
IDebugSystemObjects3::GetSystemIdsByIndex(
IN ULONG Start,
IN ULONG Count,
OUT PULONG Ids
);
Parameters
Start
Specifies the index of the first target whose target ID is requested.
Count
Specifies the number of processes whose IDs are requested.
Ids
Receives the engine target IDs. If Ids is NULL, this information is not returned; otherwise, Ids is treated as an array of Count ULONG values.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetSystemIdsByIndex is available in IDebugSystemObjects3 and later versions.
Comments
The index of the first target is zero. The index of the last target is the number of targets returned by GetNumberSystems minus one.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
Debugging Session and Execution Model
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetCurrentSystemId
The GetCurrentSystemId method returns the engine target ID for the current process.
HRESULT
IDebugSystemObjects3::GetCurrentSystemId(
OUT PULONG Id
);
Parameters
Id
Receives the engine target ID.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetCurrentSystemId is available in IDebugSystemObjects3 and later versions.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
Debugging Session and Execution Model
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SetCurrentSystemId
The SetCurrentSystemId method makes the specified target the current target.
HRESULT
IDebugSystemObjects3::SetCurrentSystemId(
IN ULONG Id
);
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Parameters
Id
Specifies the engine target ID for the target that is to become the current target.
Return Value
S_OK
The method was successful.
E_NOINTERFACE
No process with the given ID was found.
This method may also return error values. See Return Values for more details.
Interface Version
SetCurrentSystemId is available in IDebugSystemObjects3 and later versions.
Comments
This method also sets the current thread and current process, and may change the current computer.
If the current target is changed, the callback IDebugEventCallbacks::ChangeEngineState will be called with the DEBUG_CES_CURRENT_THREAD bit set.
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
Debugging Session and Execution Model, Monitoring Events
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetTotalNumberThreadsAndProcesses
The GetTotalNumberThreadsAndProcesses method returns the total number of threads and processes in all the targets the engine is attached to, in addition to the largest
number of threads and processes in a target.
HRESULT
IDebugSystemObjects3::GetTotalNumberThreadsAndProcesses(
OUT PULONG TotalThreads,
OUT PULONG TotalProcesses,
OUT PULONG LargestProcessThreads,
OUT PULONG LargestSystemThreads,
OUT PULONG LargestSystemProcesses
);
Parameters
TotalThreads
Receives the total number of threads in all processes in all targets.
TotalProcesses
Receives the total number of processes in all targets.
LargestProcessThreads
Receives the largest number of threads in any process on any target.
LargestSystemThreads
Receives the largest number of threads in any target.
LargestSystemProcesses
Receives the largest number of processes in any target.
Return Value
S_OK
The method was successful.
This method may also return error values. See Return Values for more details.
Interface Version
GetTotalNumberThreadsAndProcesses is available in IDebugSystemObjects3 and later versions.
Comments
If no target is found, all the values are set to zero.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Requirements
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
Threads and Processes
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
IDebugEventCallbacks
The IDebugEventCallbacks interface includes the following methods:
IDebugEventCallbacks::Breakpoint
IDebugEventCallbacks::ChangeDebuggeeState
IDebugEventCallbacks::ChangeEngineState
IDebugEventCallbacks::Exception
IDebugEventCallbacks::GetInterestMask
IDebugEventCallbacks::LoadModule
IDebugEventCallbacks::UnloadModule
IDebugEventCallbacks::CreateProcess
IDebugEventCallbacks::ExitProcess
IDebugEventCallbacks::SessionStatus
IDebugEventCallbacks::ChangeSymbolState
IDebugEventCallbacks::SystemError
IDebugEventCallbacks::CreateThread
IDebugEventCallbacks::ExitThread
The IDebugEventCallbacksWide interface includes Unicode versions of these methods; the Unicode methods share the same names as those used by the methods in
IDebugEventCallbacks.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
IDebugEventCallbacks::Breakpoint
The Breakpoint callback method is called by the engine when the target issues a breakpoint exception.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
HRESULT
IDebugEventCallbacks::Breakpoint(
IN IDebugBreakpoint * Bp
);
HRESULT
IDebugEventCallbacksWide::Breakpoint(
IN IDebugBreakpoint2 * Bp
);
#ifdef UNICODE
#define IDebugEventCallbacksT IDebugEventCallbacksWide
#else
#define IDebugEventCallbacksT IDebugEventCallbacks
#endif
Parameters
Bp
Specifies a pointer to the IDebugBreakpoint object corresponding to the breakpoint that was triggered.
Return Value
This method returns a DEBUG_STATUS_XXX value, which indicates how the execution of the target should proceed after the engine processes this event. For details on how
the engine treats this value, see Monitoring Events.
Comments
If the breakpoint has an associated command, the engine executes that command before calling this method.
The engine will only call this method if an IDebugBreakpoint object corresponding to the breakpoint exists in the engine, andif the breakpoint is a private breakpoint
this IDebugEventCallbacks object was registered with the client that added the breakpoint.
The engine calls this method only if the DEBUG_EVENT_BREAKPOINT flag is set in the mask returned by IDebugEventCallbacks::GetInterestMask.
Because the engine deletes the corresponding IDebugBreakpoint object when a breakpoint is removed (for example, by using RemoveBreakpoint), the value of Bp might be
invalid after Breakpoint returns. Therefore, implementations of IDebugEventCallbacks should not access Bp after Breakpoint returns.
For more information about handling events, see Monitoring Events. For information about managing breakpoints, see Breakpoints.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
IDebugEventCallbacks::ChangeDebuggeeState
The ChangeDebuggeeState callback method is called by the engine when it makes or detects changes to the target.
HRESULT
IDebugEventCallbacks::ChangeDebuggeeState(
IN ULONG Flags,
IN ULONG64 Argument
);
HRESULT
IDebugEventCallbacks::ChangeDebuggeeState(
IN ULONG Flags,
IN ULONG64 Argument
);
#ifdef UNICODE
#define IDebugEventCallbacksT IDebugEventCallbacksWide
#else
#define IDebugEventCallbacksT IDebugEventCallbacks
#endif
Parameters
Flags
Specifies the type of changes made to the target. Flags may take one of the following values:
Value
Description
DEBUG_CDS_ALL
A general change in the target has occurred. For example, the target has been executing, or the engine has just attached to the target.
DEBUG_CDS_REGISTERS The processor's register for the target have changed.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
DEBUG_CDS_DATA
Argument
Provides additional information about the change in the target. The interpretation of the value of Argument depends on the value of Flags:
DEBUG_CDS_ALL
The value of Argument is zero.
DEBUG_CDS_REGISTERS
If a single register has changed, the value of Argument is the index of that register. Otherwise, the value of Argument is DEBUG_ANY_ID.
DEBUG_CDS_DATA
The value of Argument specifies which data space was changed. The following table contains the possible values of Argument.
Value
Description
DEBUG_DATA_SPACE_VIRTUAL The target's virtual memory has changed.
DEBUG_DATA_SPACE_PHYSICAL The target's physical memory has changed.
DEBUG_DATA_SPACE_CONTROL The target's control memory has changed.
DEBUG_DATA_SPACE_IO
The target's I/O ports have received input or output.
DEBUG_DATA_SPACE_MSR
The target's Model-Specific Registers (MSRs) have changed.
DEBUG_DATA_SPACE_BUS_DATA The target's bus memory has changed.
Return Value
The return value is ignored by the engine unless it indicates a remote procedure call error; in this case the client, with which this IDebugEventCallbacks object is registered,
is disabled.
Comments
The engine calls ChangeDebuggeeState only if the DEBUG_EVENT_CHANGE_DEBUGGEE_STATE flag is set in the mask returned by
IDebugEventCallbacks::GetInterestMask.
For more information about handling events, see Monitoring Events. For information about managing the target's memory, including registers and data spaces, see Memory
Access. For information about the target's virtual and physical memory, see Virtual and Physical Memory. For information about the target's control memory, I/O ports, MSR,
and bus memory, see Other Data Spaces.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
IDebugEventCallbacks::ChangeEngineState
The ChangeEngineState callback method is called by the engine when its state has changed.
HRESULT
IDebugEventCallbacks::ChangeEngineState(
IN ULONG Flags,
IN ULONG64 Argument
);
HRESULT
IDebugEventCallbacksWide::ChangeEngineState(
IN ULONG Flags,
IN ULONG64 Argument
);
#ifdef UNICODE
#define IDebugEventCallbacksT IDebugEventCallbacksWide
#else
#define IDebugEventCallbacksT IDebugEventCallbacks
#endif
Parameters
Flags
Specifies a bit-set indicating the type of changes that occurred in the engine's state. The following bit flags might be set:
Value
Description
DEBUG_CES_CURRENT_THREAD
The current thread has changed, which implies that the current target and current process might also have changed.
DEBUG_CES_EFFECTIVE_PROCESSOR The effective processor has changed.
DEBUG_CES_BREAKPOINTS
One or more breakpoints have changed.
DEBUG_CES_CODE_LEVEL
The code interpretation level has changed.
DEBUG_CES_EXECUTION_STATUS
The execution status has changed.
DEBUG_CES_ENGINE_OPTIONS
The engine options have changed.
DEBUG_CES_LOG_FILE
The log file has been opened or closed.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
DEBUG_CES_RADIX
DEBUG_CES_EVENT_FILTERS
DEBUG_CES_PROCESS_OPTIONS
DEBUG_CES_EXTENSIONS
DEBUG_CES_SYSTEMS
DEBUG_CES_ASSEMBLE_OPTIONS
DEBUG_CES_EXPRESSION_SYNTAX
DEBUG_CES_TEXT_REPLACEMENTS
Argument
Provides additional information about the change to the engine's state. If more than one bit flag is set in the Flags parameter, the Argument parameter is not used.
Otherwise, the interpretation of the value of Argument depends on the value of Flags:
DEBUG_CES_CURRENT_THREAD
The value of Argument is the current engine thread ID orif there is no current threadDEBUG_ANY_ID. For more information, see Threads and Processes.
DEBUG_CES_EFFECTIVE_PROCESSOR
The value of Argument is the type of the effective processor.
DEBUG_CES_BREAKPOINTS
The value of Argument is the breakpoint ID of the breakpoint that was changed orif more than one breakpoint was changedDEBUG_ANY_ID. For more
information, see Breakpoints.
DEBUG_CES_CODE_LEVEL
The value of Argument is the code interpretation level.
DEBUG_CES_EXECUTION_STATUS
The value of Argument is the execution status (as described in the DEBUG_STATUS_XXX topic) possibly combined with the bit flag
DEBUG_STATUS_INSIDE_WAIT. DEBUG_STATUS_INSIDE_WAIT is set when a WaitForEvent call is pending. For more information, see Debugging
Session and Execution Model.
DEBUG_CES_ENGINE_OPTIONS
The value of Argument is the engine options.
DEBUG_CES_LOG_FILE
The value of Argument is TRUE if the log file was opened and FALSE if the log file was closed.
DEBUG_CES_RADIX
The value of Argument is the default radix.
DEBUG_CES_EVENT_FILTERS
The value of Argument is the index of the event filter that was changed orif more than one event filter was changedDEBUG_ANY_ID.
DEBUG_CES_PROCESS_OPTIONS
The value of Argument is the process options for the current process.
DEBUG_CES_EXTENSIONS
The value of Argument is zero.
DEBUG_CES_SYSTEMS
The value of Argument is the target ID of the target that was added orif a target was removedDEBUG_ANY_ID.
DEBUG_CES_ASSEMBLE_OPTIONS
The value of Argument is the assemble options.
DEBUG_CES_EXPRESSION_SYNTAX
The value of Argument is the default expression syntax.
DEBUG_CES_TEXT_REPLACEMENTS
The value of Argument is DEBUG_ANY_ID.
Return Value
The return value is ignored by the engine unless it indicates a remote procedure call error; in this case the client, with which this IDebugEventCallbacks object is registered,
is disabled.
Comments
This method is only called by the engine if the DEBUG_EVENT_CHANGE_ENGINE_STATE flag is set in the mask returned by
IDebugEventCallbacks::GetInterestMask.
For more information about handling events, see Monitoring Events.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
IDebugEventCallbacks::Exception
The Exception callback method is called by the engine when an exception debugging event occurs in the target.
HRESULT
IDebugEventCallbacks::Exception(
IN PEXCEPTION_RECORD64 Exception,
IN ULONG FirstChance
);
HRESULT
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
IDebugEventCallbacksWide::Exception(
IN PEXCEPTION_RECORD64 Exception,
IN ULONG FirstChance
);
#ifdef UNICODE
#define IDebugEventCallbacksT IDebugEventCallbacksWide
#else
#define IDebugEventCallbacksT IDebugEventCallbacks
#endif
Parameters
Exception
Specifies the nature of the exception. EXCEPTION_RECORD64 is defined in winnt.h.
FirstChance
Specifies whether this exception has been previously encountered. A nonzero value means that this is the first time the exception has been encountered ("first chance"). A
zero value means that the exception has already been offered to all possible handlers, and each one declined to handle it ("second chance").
Return Value
This method returns a DEBUG_STATUS_XXX value, which indicates how the execution of the target should proceed after the engine processes this event. For details on how
the engine treats this value, see Monitoring Events.
Comments
This method is only called by the engine if the DEBUG_EVENT_EXCEPTION flag is set in the mask returned by IDebugEventCallbacks::GetInterestMask.
Because the structure that Exception points to might be deleted after this method returns, implementations of IDebugEventCallbacks should not access this structure after
returning.
For more information about handling events, see Monitoring Events.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
IDebugEventCallbacks::GetInterestMask
The GetInterestMask callback method is called to determine which events the IDebugEventCallbacks object is interested in. The engine calls GetInterestMask when the
object is registered with a client by using SetEventCallbacks.
HRESULT
IDebugEventCallbacks::GetInterestMask(
OUT PULONG Mask
);
HRESULT
IDebugEventCallbacksWide::GetInterestMask(
OUT PULONG Mask
);
#ifdef UNICODE
#define IDebugEventCallbacksT IDebugEventCallbacksWide
#else
#define IDebugEventCallbacksT IDebugEventCallbacks
#endif
Parameters
Mask
Receives a bitmask that indicates which events the object is interested in. The engine will call only those methods that correspond to the bit flags set by
GetInterestMask. For a description of the bit flags and their corresponding methods, see DEBUG_EVENT_XXX.
Return Value
The return value S_OK indicates the method was successful. All other return values indicate an error occurred, in which case the SetEventCallbacks call will fail and the
callback object will not be used nor will it receive events.
Comments
For more information about handling events, see Monitoring Events.
Requirements
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
IDebugEventCallbacks::LoadModule
The LoadModule callback method is called by the engine when a module-load debugging event occurs in the target.
HRESULT
IDebugEventCallbacks::LoadModule(
IN ULONG64 ImageFileHandle,
IN ULONG64 BaseOffset,
IN ULONG ModuleSize,
IN PCSTR ModuleName,
IN PCSTR ImageName,
IN ULONG CheckSum,
IN ULONG TimeDateStamp
);
HRESULT
IDebugEventCallbacksWide::LoadModule(
IN ULONG64 ImageFileHandle,
IN ULONG64 BaseOffset,
IN ULONG ModuleSize,
IN PCWSTR ModuleName,
IN PCWSTR ImageName,
IN ULONG CheckSum,
IN ULONG TimeDateStamp
);
#ifdef UNICODE
#define IDebugEventCallbacksT IDebugEventCallbacksWide
#else
#define IDebugEventCallbacksT IDebugEventCallbacks
#endif
Parameters
ImageFileHandle
Specifies the handle to the module's image file. If this information is not available, ImageFileHandle will be NULL.
BaseOffset
Specifies the base address of the module in the target's memory address space. If this information is not available, BaseOffset will be NULL.
ModuleSize
Specifies the module's image size in bytes. If this information is not available, ModuleSize will be NULL.
ModuleName
Specifies the simplified module name that is used by the debugger engine. In most cases, this matches the image file name excluding the extension. For details, see
Executable Image Path. If this information is not available, ModuleName will be NULL.
ImageName
Specifies the module's image file name, which can include the path. If this information is not available, ImageName will be NULL.
CheckSum
Specifies the checksum of the module's image file. If this information is not available, CheckSum will be NULL.
TimeDateStamp
Specifies the time and date stamp of the module's image file. If this information is not available, TimeDateStamp will be zero.
Return Value
This method returns a DEBUG_STATUS_XXX value, which indicates how the execution of the target should proceed after the engine processes this event. For details on how
the engine treats this value, see Monitoring Events.
Comments
This method is only called by the engine if the DEBUG_EVENT_LOAD_MODULE flag is set in the mask returned by IDebugEventCallbacks::GetInterestMask.
After calling this method, the engine will call IDebugEventCallbacks::ChangeSymbolState, with the Flags parameter containing the bit flag DEBUG_CSS_LOADS.
For more information about handling events, see Monitoring Events.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
IDebugEventCallbacks::UnloadModule
The UnloadModule callback method is called by the engine when a module-unload debugging event occurs in the target.
HRESULT
IDebugEventCallbacks::UnloadModule(
IN PCSTR ImageBaseName,
IN ULONG64 BaseOffset
);
HRESULT
IDebugEventCallbacksWide::UnloadModule(
IN PCWSTR ImageBaseName,
IN ULONG64 BaseOffset
);
#ifdef UNICODE
#define IDebugEventCallbacksT IDebugEventCallbacksWide
#else
#define IDebugEventCallbacksT IDebugEventCallbacks
#endif
Parameters
ImageBaseName
Specifies the name of the module's image file, which can include the path. If this information is not available, ImageBaseName will be NULL.
BaseOffset
Specifies the base address of the module in the target's memory address space. If this information is not available, BaseOffset will be NULL.
Return Value
This method returns a DEBUG_STATUS_XXX value, which indicates how the execution of the target should proceed after the engine processes this event. For details on how
the engine treats this value, see Monitoring Events.
Comments
This method is only called by the engine if the DEBUG_EVENT_UNLOAD_MODULE flag is set in the mask returned by IDebugEventCallbacks::GetInterestMask.
After calling this method, the engine will call IDebugEventCallbacks::ChangeSymbolState, with the Flags parameter containing the bit flag DEBUG_CSS_UNLOADS.
For more information about handling events, see Monitoring Events.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
IDebugEventCallbacks::CreateProcess
The CreateProcess callback method is called by the engine when a create-process debugging event occurs in the target.
HRESULT
IDebugEventCallbacks::CreateProcess(
IN ULONG64 ImageFileHandle,
IN ULONG64 Handle,
IN ULONG64 BaseOffset,
IN ULONG ModuleSize,
IN PCSTR ModuleName,
IN PCSTR ImageName,
IN ULONG CheckSum,
IN ULONG TimeDateStamp,
IN ULONG64 InitialThreadHandle,
IN ULONG64 ThreadDataOffset,
IN ULONG64 StartOffset
);
HRESULT
IDebugEventCallbacksWide::CreateProcess(
IN ULONG64 ImageFileHandle,
IN ULONG64 Handle,
IN ULONG64 BaseOffset,
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
IN
IN
IN
IN
IN
IN
IN
IN
);
ULONG ModuleSize,
PCWSTR ModuleName,
PCWSTR ImageName,
ULONG CheckSum,
ULONG TimeDateStamp,
ULONG64 InitialThreadHandle,
ULONG64 ThreadDataOffset,
ULONG64 StartOffset
#ifdef UNICODE
#define IDebugEventCallbacksT IDebugEventCallbacksWide
#else
#define IDebugEventCallbacksT IDebugEventCallbacks
#endif
Parameters
ImageFileHandle
Specifies the handle to the process's image file. If this information is not available, ImageFileHandle will be NULL.
Handle
Specifies the handle to the process. This parameter corresponds to the hProcess field in the CREATE_PROCESS_DEBUG_INFO structure. If this information is not
available, ImageFileHandle will be NULL.
BaseOffset
Specifies the base address of the process's executable image in the target's memory address space. If this information is not available, BaseOffset will be NULL.
ModuleSize
Specifies the process's executable image size in bytes. If this information is not available, ModuleSize will be zero.
ModuleName
Specifies the simplified module name that is used by the debugger engine. In most cases, this matches the image file name excluding the extension. For details, see
Executable Image Path. If this information is not available, ModuleName will be NULL.
ImageName
Specifies the process's executable-image file name, which can include the path. If this information is not available, ImageName will be NULL.
CheckSum
Specifies the checksum of the process's executable image. If this information is not available, CheckSum will be zero.
TimeDateStamp
Specifies the time and date stamp of the process's executable-image file. If this information is not available, TimeDateStamp will be zero.
InitialThreadHandle
Specifies the handle to the process's initial thread. This parameter corresponds to the hThread field in the CREATE_PROCESS_DEBUG_INFO structure. If this
information is not available, InitialThreadHandle will be NULL.
ThreadDataOffset
Specifies a block of data that the operating system maintains for this thread. The actual data in the block is operating systemspecific. If this information is not available,
ThreadDataOffset will be NULL.
StartOffset
Specifies the starting address of the thread in the process's virtual address space. If this information is not available, StartOffset will be NULL.
Return Value
This method returns a DEBUG_STATUS_XXX value, which indicates how the execution of the target should proceed after the engine processes this event. For details on how
the engine treats this value, see Monitoring Events.
Comments
This method is only called by the engine if the DEBUG_EVENT_CREATE_PROCESS flag is set in the mask returned by IDebugEventCallbacks::GetInterestMask.
For more information about handling events, see Monitoring Events. For information about threads, see Threads and Processes.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
IDebugEventCallbacks::ExitProcess
The ExitProcess callback method is called by the engine when an exit-process debugging event occurs in the target.
HRESULT
IDebugEventCallbacks::ExitProcess(
IN ULONG ExitCode
);
HRESULT
IDebugEventCallbacksWide::ExitProcess(
IN ULONG ExitCode
);
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
#ifdef UNICODE
#define IDebugEventCallbacksT IDebugEventCallbacksWide
#else
#define IDebugEventCallbacksT IDebugEventCallbacks
#endif
Parameters
ExitCode
Specifies the exit code for the process.
Return Value
This method returns a DEBUG_STATUS_XXX value, which indicates how the execution of the target should proceed after the engine processes this event. For details on how
the engine treats this value, see Monitoring Events.
Comments
This method is only called by the engine if the DEBUG_EVENT_EXIT_PROCESS flag is set in the mask returned by IDebugEventCallbacks::GetInterestMask.
For more information about handling events, see Monitoring Events. For information about threads, see Threads and Processes.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
IDebugEventCallbacks::SessionStatus
The SessionStatus callback method is called by the engine when a change occurs in the debugger session.
HRESULT
IDebugEventCallbacks::SessionStatus(
IN ULONG Status
);
HRESULT
IDebugEventCallbacksWide::SessionStatus(
IN ULONG Status
);
#ifdef UNICODE
#define IDebugEventCallbacksT IDebugEventCallbacksWide
#else
#define IDebugEventCallbacksT IDebugEventCallbacks
#endif
Parameters
Status
Specifies the new status of the debugger session. The following table describes the possible values.
Value
Description
DEBUG_SESSION_ACTIVE
A debugger session has started.
DEBUG_SESSION_END_SESSION_ACTIVE_TERMINATE The session was ended by sending DEBUG_END_ACTIVE_TERMINATE to EndSession.
DEBUG_SESSION_END_SESSION_ACTIVE_DETACH
The session was ended by sending DEBUG_END_ACTIVE_DETACH to EndSession.
DEBUG_SESSION_END_SESSION_PASSIVE
The session was ended by sending DEBUG_END_PASSIVE to EndSession.
DEBUG_SESSION_END
The target ran to completion, ending the session.
DEBUG_SESSION_REBOOT
The target computer rebooted, ending the session.
DEBUG_SESSION_HIBERNATE
The target computer went into hibernation, ending the session.
DEBUG_SESSION_FAILURE
The engine was unable to continue the session.
Return Value
This method's return value is ignored by the engine.
Comments
This method is only called by the engine if the DEBUG_EVENT_SESSION_STATUS flag is set in the mask returned by IDebugEventCallbacks::GetInterestMask.
After the engine has notified all the event callbacks of the change in the session status, it will also notify any loaded extensions that export the DebugExtensionNotify
callback method. The value that it passes to the extensions depends on the value of Status. If Status is DEBUG_SESSION_ACTIVE, it passes DEBUG_SESSION_ACTIVE;
otherwise, it passes DEBUG_SESSION_INACTIVE.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
In the DEBUG_SESSION_ACTIVE case, the engine follows the debugger session change notification with a target state change notification by calling
IDebugEventCallbacks::ChangeDebuggeeState on the event callbacks and passing DEBUG_CDS_ALL in the Flags parameter. In all other cases, the engine precedes this
notification with an engine state change notification by calling IDebugEventCallbacks::ChangeEngineState on the event callbacks and passing
DEBUG_CES_EXECUTION_STATUS in the Flags parameter.
For more information about handling events, see Monitoring Events. For information about debugger sessions, see Debugging Session and Execution Model.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
IDebugEventCallbacks::ChangeSymbolState
The ChangeSymbolState callback method is called by the engine when the symbol state changes.
HRESULT
IDebugEventCallbacks::ChangeSymbolState(
IN ULONG Flags,
IN ULONG64 Argument
);
HRESULT
IDebugEventCallbacksWide::ChangeSymbolState(
IN ULONG Flags,
IN ULONG64 Argument
);
#ifdef UNICODE
#define IDebugEventCallbacksT IDebugEventCallbacksWide
#else
#define IDebugEventCallbacksT IDebugEventCallbacks
#endif
Parameters
Flags
Specifies a bit-set indicating the nature of the change to the symbol state. The following bit flags might be set.
Value
Description
DEBUG_CSS_LOADS
The engine has loaded some module symbols.
DEBUG_CSS_UNLOADS
The engine has unloaded some module symbols.
DEBUG_CSS_SCOPE
The current symbol scope has changed.
DEBUG_CSS_PATHS
The executable image, source , or symbol search paths have changed.
DEBUG_CSS_SYMBOL_OPTIONS The symbol options have changed.
DEBUG_CSS_TYPE_OPTIONS
The type options have changed.
Argument
Provides additional information about the change to the symbol state. If more than one bit flag is set in the Flags parameter, the Argument parameter is not used.
Otherwise, the value of Argument depends on the value of Flags:
DEBUG_CSS_LOADS
The value of Argument is the base location (in the target's memory address space) of the module image that the engine loaded symbols for.
DEBUG_CSS_UNLOADS
The value of Argument is the base location (in the target's memory address space) of the module image that the engine unloaded symbols for. If the engine unloaded
symbols for more than one image, the value of Argument is zero.
DEBUG_CSS_SCOPE
The value of Argument is zero.
DEBUG_CSS_PATHS
The value of Argument is zero.
DEBUG_CSS_SYMBOL_OPTIONS
The value of Argument is the symbol options.
DEBUG_CSS_TYPE_OPTIONS
The value of Argument is zero.
Return Value
The return value is ignored by the engine unless it indicates a remote procedure call error; in this case the client, with which this IDebugEventCallbacks object is registered,
is disabled.
Comments
This method is only called by the engine if the DEBUG_EVENT_CHANGE_SYMBOL_STATE flag is set in the mask returned by
IDebugEventCallbacks::GetInterestMask.
For more information about handling events, see Monitoring Events.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
IDebugEventCallbacks::SystemError
The SystemError callback method is called by the engine when a system error occurs in the target.
HRESULT
IDebugEventCallbacks::SystemError(
IN ULONG Error,
IN ULONG Level
);
HRESULT
IDebugEventCallbacksWide::SystemError(
IN ULONG Error,
IN ULONG Level
);
#ifdef UNICODE
#define IDebugEventCallbacksT IDebugEventCallbacksWide
#else
#define IDebugEventCallbacksT IDebugEventCallbacks
#endif
Parameters
Error
Specifies the error that caused the event.
Level
Specifies the severity of the error.
Return Value
This method returns a DEBUG_STATUS_XXX value, which indicates how the execution of the target should proceed after the engine processes this event. For details on how
the engine treats this value, see Monitoring Events.
Comments
This method is only called by the engine if the DEBUG_EVENT_SYSTEM_ERROR flag is set in the mask returned by IDebugEventCallbacks::GetInterestMask.
For more information about handling events, see Monitoring Events.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
IDebugEventCallbacks::CreateThread
The CreateThread callback method is called by the engine when a create-thread debugging event occurs in the target.
HRESULT
IDebugEventCallbacks::CreateThread(
IN ULONG64 Handle,
IN ULONG64 DataOffset,
IN ULONG64 StartOffset
);
HRESULT
IDebugEventCallbacksWide::CreateThread(
IN ULONG64 Handle,
IN ULONG64 DataOffset,
IN ULONG64 StartOffset
);
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
#ifdef UNICODE
#define IDebugEventCallbacksT IDebugEventCallbacksWide
#else
#define IDebugEventCallbacksT IDebugEventCallbacks
#endif
Parameters
Handle
Specifies the handle for the thread whose creation caused the event. If this information is not available, Handle will be NULL.
DataOffset
Specifies a block of data that the operating system maintains for this thread. The actual data in the block is operating systemspecific. If the operating system does not
have such a block, DataOffset will be NULL.
StartOffset
Specifies the starting location in the target's virtual address space of the thread. If this information is not available, StartOffset will be NULL.
Return Value
This method returns a DEBUG_STATUS_XXX value, which indicates how the execution of the target should proceed after the engine processes this event. For details on how
the engine treats this value, see Monitoring Events.
Comments
This method is only called by the engine if the DEBUG_EVENT_CREATE_THREAD flag is set in the mask returned by IDebugEventCallbacks::GetInterestMask.
For more information about handling events, see Monitoring Events. For information about threads, see Threads and Processes.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
IDebugEventCallbacks::ExitThread
The ExitThread callback method is called by the engine when an exit-thread debugging event occurs in the target.
HRESULT
IDebugEventCallbacks::ExitThread(
IN ULONG ExitCode
);
HRESULT
IDebugEventCallbacksWide::ExitThread(
IN ULONG ExitCode
);
#ifdef UNICODE
#define IDebugEventCallbacksT IDebugEventCallbacksWide
#else
#define IDebugEventCallbacksT IDebugEventCallbacks
#endif
Parameters
ExitCode
Specifies the exit code for the thread.
Return Value
This method returns a DEBUG_STATUS_XXX value, which indicates how the execution of the target should proceed after the engine processes this event. For details on how
the engine treats this value, see Monitoring Events.
Comments
This method is only called by the engine if the DEBUG_EVENT_EXIT_THREAD flag is set in the mask returned by IDebugEventCallbacks::GetInterestMask.
For more information about handling events, see Monitoring Events. For information about threads, see Threads and Processes.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
2009 Microsoft Corporation
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
IDebugInputCallbacks
The IDebugInputCallbacks interface includes the following methods:
IDebugInputCallbacks::EndInput
IDebugInputCallbacks::StartInput
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
IDebugInputCallbacks::EndInput
The EndInput callback method is called by the engine to indicate that it is no longer waiting for input.
HRESULT
IDebugInputCallbacks::EndInput(
void
);
Parameters
None
Return Value
This method's return value is ignored by the engine.
Comments
Even if the engine has not called IDebugInputCallbacks::StartInput for this IDebugInputCallbacks object, the engine will call EndInput if another
IDebugInputCallbacks object returned an error from the IDebugInputCallbacks::StartInput method.
For more information about debugger engine input, see Input and Output.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
IDebugInputCallbacks::StartInput
The StartInput callback method is called by the engine to indicate that it is waiting for a line of input.
HRESULT
IDebugInputCallbacks::StartInput(
IN ULONG BufferSize
);
Parameters
BufferSize
Specifies the number of characters requested. Any input longer than this size will be truncated.
Return Value
The return value is ignored by the engine unless it indicates a remote procedure call error; in this case the client, with which this IDebugEventCallbacks object is registered,
is disabled.
Comments
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
This method indicates that the engine is waiting for a line of input from any client. This can occur if, for example, the Input method was called on a client.
After calling this method, the engine waits until it receives some input. When it does receive input, it calls IDebugInputCallbacks::EndInput to inform all the
IDebugInputCallbacks objects that are registered with clients that it is no longer waiting for input.
The IDebugInputCallbacks object can provide the engine with a line of input by calling either the ReturnInput or ReturnInputWide methods.
For more information about debugger engine input, see Input and Output.
Requirements
Headers: Defined in dbgeng.h. Include dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
IDebugOutputCallbacks
The IDebugOutputCallbacks interface includes the following method:
IDebugOutputCallbacks::Output
The IDebugOutputCallbacksWide interface includes the Unicode version of this method; the Unicode method shares the same name as that used by the method in
IDebugOutputCallbacks.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
IDebugOutputCallbacks::Output
The Output callback method is called by the engine to send output from the client to the IDebugOutputCallbacks or IDebugOutputCallbacksWide object that is registered
with the client.
HRESULT
IDebugOutputCallbacks::Output(
IN ULONG Mask,
IN PCSTR Text
);
HRESULT
IDebugOutputCallbacksWide::Output(
IN ULONG Mask,
IN PCWSTR Text
);
#ifdef UNICODE
#define IDebugOutputCallbacksT IDebugOutputCallbacksWide
#else
#define IDebugOutputCallbacksT IDebugOutputCallbacks
#endif
Parameters
Mask
Specifies the DEBUG_OUTPUT_XXX bit flags that indicate the nature of the output.
Text
Specifies the output that is being sent.
Return Value
The return value is ignored by the engine unless it indicates a remote procedure call error; in this case the client, with which this IDebugEventCallbacks object is registered,
is disabled.
Comments
The engine calls this method only if the supplied value of Mask is allowed by the client's output control.
For more information about debugger engine output, see Input and Output.
Requirements
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
IDebugBreakpoint
This IDebugBreakpoint interface includes the following methods:
GetAdder
GetCommand
SetCommand
AddFlags
GetFlags
RemoveFlags
SetFlags
GetId
GetOffset
SetOffset
GetOffsetExpression
SetOffsetExpression
GetParameters
GetDataParameters
SetDataParameters
GetPassCount
SetPassCount
GetCurrentPassCount
GetMatchThreadId
SetMatchThreadId
GetType
Although IDebugBreakpoint implements the IUnknown interface, the IUnknown::AddRef and IUnknown::Release methods are not used to control the lifetime of the
breakpoint. Instead, an IDebugBreakpoint object is deleted after the method RemoveBreakpoint is called.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetAdder
The GetAdder method returns the client that owns the breakpoint.
HRESULT
IDebugBreakpoint::GetAdder(
OUT IDebugClient * * Adder
);
Parameters
Adder
An IDebugClient interface pointer to the client object that added the breakpoint.
Return Value
GetAdder might return one of the following values:
S_OK
The method was successful.
This method might also return error values. For more information about possible return values, see Return Values.
Comments
The client that owns the breakpoint is the client that created the breakpoint by using the AddBreakpoint method. A breakpoint might not have an owner. If a breakpoint does
not have an owner, Adder is set to NULL.
For more information about how to use breakpoints, see Using Breakpoints.
Requirements
Versions: Available in all versions of IDebugBreakpoint.
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetCommand
The GetCommand and GetCommandWide methods return the command string that is executed when a breakpoint is triggered.
HRESULT
IDebugBreakpoint::GetCommand(
OUT OPTIONAL PSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG CommandSize
);
HRESULT
IDebugBreakpoint2::GetCommandWide(
OUT OPTIONAL PWSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG CommandSize
);
#ifdef UNICODE
#define GetCommandT GetCommandWide
#else
#define GetCommandT GetCommand
#endif
Parameters
Buffer
The command string that is executed when the breakpoint is triggered. If Buffer is NULL, this information is not returned.
BufferSize
The size, in characters, of the buffer that Buffer points to.
CommandSize
The size of the command string. If CommandSize is NULL, this information is not returned.
Return Value
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
SetCommand
The SetCommand and SetCommandWide methods set the command that is executed when a breakpoint is triggered.
HRESULT
IDebugBreakpoint::SetCommand(
IN PCSTR Command
);
HRESULT
IDebugBreakpoint2::SetCommandWide(
IN PCSTR Command
);
#ifdef UNICODE
#define SetCommandT SetCommandWide
#else
#define SetCommandT SetCommand
#endif
Parameters
Command
The command string that is executed when the breakpoint is triggered.
Return Value
SetCommand and SetCommandWide might return one of the following values:
S_OK
The method was successful.
This method might also return error values. For more information about possible return values, see Return Values.
Comments
The command string is a list of debugger commands that are separated by semicolons. These commands are executed every time that the breakpoint is triggered. The
commands are executed before the engine informs any event callbacks that the breakpoint has been triggered.
If the command string includes an execution command such as G (Go), this command should be the last command in the Command string. If a command causes the target to
resume execution, the rest of the command string is ignored.
For more information about breakpoint properties, see Controlling Breakpoint Flags and Parameters.
Requirements
Versions: SetCommand is available in all versions of IDebugBreakpoint. SetCommandWide is available in IDebugBreakpoint2 and later versions.
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
AddFlags
The AddFlags method adds flags to a breakpoint.
HRESULT
IDebugBreakpoint::AddFlags(
IN ULONG Flags
);
Parameters
Flags
Additional flags to add to the breakpoint. Flags is a bit field that is combined together with the existing flags by using a bitwise OR. For more information about the flag
bit field and an explanation of each flag, see Controlling Breakpoint Flags and Parameters. You cannot modify the DEBUG_BREAKPOINT_DEFERRED flag in the
engine. This bit in Flags must always be zero.
Return Value
AddFlags might return one of the following values:
S_OK
The method was successful.
This method might also return error values. For more information about possible return values, see Return Values.
Comments
For more information about breakpoint properties, see Controlling Breakpoint Flags and Parameters.
Requirements
Versions: Available in all versions of IDebugBreakpoint.
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetFlags
The GetFlags method returns the flags for a breakpoint.
HRESULT
IDebugBreakpoint::GetFlags(
OUT PULONG Flags
);
Parameters
Flags
The breakpoint's flags. For more information about the flag bit field and an explanation of each flag, see Controlling Breakpoint Flags and Parameters.
Return Value
GetFlags might return one of the following values:
S_OK
The method was successful.
This method might also return error values. For more information about possible return values, see Return Values.
Comments
The GetParameters method also returns the breakpoint's flags.
For more information about breakpoint properties, see Controlling Breakpoint Flags and Parameters.
Requirements
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
RemoveFlags
The RemoveFlags method removes flags from a breakpoint.
HRESULT
IDebugBreakpoint::RemoveFlags(
IN ULONG Flags
);
Parameters
Flags
Flags to remove from the breakpoint. Flags is a bit field. Tthe new value of the flags in the engine is the old value and not the value of Flags. For more information about
the flag bit field and an explanation of each flag, see Controlling Breakpoint Flags and Parameters. You cannot modify the DEBUG_BREAKPOINT_DEFERRED flag in
the engine. This bit in Flags must always be zero.
Return Value
RemoveFlags might return one of the following values:
S_OK
The method was successful.
This method might also return error values. For more information about possible return values, see Return Values.
Comments
For more information about breakpoint properties, see Controlling Breakpoint Flags and Parameters.
Requirements
Versions: Available in all versions of IDebugBreakpoint.
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SetFlags
The SetFlags method sets the flags for a breakpoint.
HRESULT
IDebugBreakpoint::SetFlags(
IN ULONG Flags
);
Parameters
Flags
The new flags for the breakpoint. Flags is a bit field. It replaces the existing flag bits. For more information about the flag bit field and an explanation of each flag, see
Controlling Breakpoint Flags and Parameters. You cannot change the DEBUG_BREAKPOINT_DEFERRED flag in the engine. This bit in Flags must always be zero.
Return Value
SetFlags might return one of the following values:
S_OK
The method was successful.
This method might also return error values. For more information about possible return values, see Return Values.
Comments
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
For more information about breakpoint properties, see Controlling Breakpoint Flags and Parameters.
Requirements
Versions: Available in all versions of IDebugBreakpoint.
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetId
The GetId method returns a breakpoint ID, which is the engine's unique identifier for a breakpoint.
HRESULT
IDebugBreakpoint::GetId(
OUT PULONG Id
);
Parameters
Id
The breakpoint ID.
Return Value
GetId might return one of the following values:
S_OK
The method was successful.
This method might also return error values. For more information about possible return values, see Return Values.
Comments
The breakpoint ID remains fixed as long as the breakpoint exists. However, after the breakpoint has been removed, you can use its ID for another breakpoint.
The GetParameters method also returns the breakpoint ID.
For more information about how to use breakpoints, see Using Breakpoints.
Requirements
Versions: Available in all versions of IDebugBreakpoint.
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetOffset
The GetOffset method returns the location that triggers a breakpoint.
HRESULT
IDebugBreakpoint::GetOffset(
OUT PULONG64 Offset
);
Parameters
Offset
The location on the target that triggers the breakpoint.
Return Value
GetOffset might return one of the following values:
S_OK
The method was successful.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
E_NOINTERFACE
The breakpoint is deferred and does not currently specify a location in the target's memory address space. To determine the breakpoint location in this case, call
GetOffsetExpression.
This method might also return error values. For more information about possible return values, see Return Values.
Comments
The GetParameters method also returns the location that triggers a breakpoint.
For more information about how to use breakpoints, see Using Breakpoints.
Requirements
Versions: Available in all versions of IDebugBreakpoint.
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SetOffset
The SetOffset method sets the location that triggers a breakpoint.
HRESULT
IDebugBreakpoint::SetOffset(
IN ULONG64 Offset
);
Parameters
Offset
The location on the target that triggers the breakpoint.
Return Value
SetOffset might return one of the following values:
S_OK
The method was successful.
E_UNEXPECTED
The breakpoint is deferred.
This method might also return error values. For more information about possible return values, see Return Values.
Comments
For more information about how to use breakpoints, see Using Breakpoints.
Requirements
Versions: Available in all versions of IDebugBreakpoint.
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetOffsetExpression
The GetOffsetExpression and GetOffsetExpressionWide methods return the expression string that evaluates to the location that triggers a breakpoint.
HRESULT
IDebugBreakpoint::GetOffsetExpression(
OUT OPTIONAL PSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG ExpressionSize
);
HRESULT
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
IDebugBreakpoint2::GetOffsetExpressionWide(
OUT OPTIONAL PWSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG ExpressionSize
);
#ifdef UNICODE
#define GetOffsetExpressionT GetOffsetExpressionWide
#else
#define GetOffsetExpressionT GetOffsetExpression
#endif
Parameters
Buffer
The expression string that evaluates to the location on the target that triggers the breakpoint. If Buffer is NULL, this information is not returned.
BufferSize
The size, in characters, of the buffer that Buffer points to.
ExpressionSize
The size, in characters, of the expression string. If ExpressionSize is NULL, this information is not returned.
Return Value
GetOffsetExpression and GetOffsetExpressionWide might return one of the following values:
S_OK
The method was successful.
S_FALSE
The method was successful, but the buffer was not large enough to hold the expression string and so the string was truncated to fit.
This method might also return error values. For more information about possible return values, see Return Values.
Comments
The expression is evaluated every time that a module is loaded or unloaded. If the debugger cannot evaluate the expression (for example, if the expression contains a symbol
that cannot be interpreted), the breakpoint is flagged as deferred. (For more information about deferred breakpoints, see Controlling Breakpoint Flags and Parameters.)
The GetParameters method also returns the size of the expression string that specifies the location that triggers the breakpoint, ExpressionSize.
For more information about how to use breakpoints, see Using Breakpoints.
Requirements
Versions: GetOffsetExpression is available in all versions of IDebugBreakpoint. GetOffsetExpressionWide is available in IDebugBreakpoint2 and later versions.
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SetOffsetExpression
The SetOffsetExpression and SetOffsetExpressionWide methods set an expression string that evaluates to the location that triggers a breakpoint.
HRESULT
IDebugBreakpoint::SetOffsetExpression(
IN PCSTR Expression
);
HRESULT
IDebugBreakpoint2::SetOffsetExpressionWide(
IN PCSTR Expression
);
#ifdef UNICODE
#define SetOffsetExpressionT SetOffsetExpressionWide
#else
#define SetOffsetExpressionT SetOffsetExpression
#endif
Parameters
Expression
The expression string that evaluates to the location on the target that triggers the breakpoint. If the engine icannot evaluate the expression (for example, if the expression
contains a symbol that cannot be interpreted), the breakpoint is flagged as deferred. (For more information about deferred breakpoints, see Controlling Breakpoint Flags
and Parameters.) For more information about the expression syntax, see Using Breakpoints.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Return Value
SetOffsetExpression and SetOffsetExpressionWide might return one of the following values:
S_OK
The method was successful.
This method might also return error values. For more information about possible return values, see Return Values.
Comments
For more information about how to use breakpoints, see Using Breakpoints.
Requirements
Versions: SetOffsetExpression is available in all versions of IDebugBreakpoint. SetOffsetExpressionWide is available in IDebugBreakpoint2 and later versions.
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetParameters
The GetParameters method returns the parameters for a breakpoint.
HRESULT
IDebugBreakpoint::GetParameters(
OUT PDEBUG_BREAKPOINT_PARAMETERS
);
Params
Parameters
Params
The breakpoint's parameters. For more information about the parameters, see DEBUG_BREAKPOINT_PARAMETERS.
Return Value
GetParameters might return one of the following values:
S_OK
The method was successful.
This method might also return error values. For more information about possible return values, see Return Values.
Comments
The GetParameters method is a convenience method that returns most of the parameters that the other IDebugBreakpoint methods return.
For a list of the parameters and flags that this method retrieves, and for other ways to read and write these parameters and flags, see Controlling Breakpoint Flags and
Parameters and Using Breakpoints.
Requirements
Versions: Available in all versions of IDebugBreakpoint.
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetDataParameters
The GetDataParameters method returns the parameters for a processor breakpoint.
HRESULT
IDebugBreakpoint::GetDataParameters(
OUT PULONG Size,
OUT PULONG AccessType
);
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Parameters
Size
The size, in bytes, of the memory block whose access triggers the breakpoint. For more information about restrictions on the value of Size based on the processor type,
see Valid Parameters for Processor Breakpoints.
AccessType
Tthe type of access that triggers the breakpoint. For a list of possible values, see Valid Parameters for Processor Breakpoints.
Return Value
GetDataParameters might return one of the following values:
S_OK
The method was successful.
E_NOINTERFACE
The breakpoint is not a processor breakpoint. For more information about the breakpoint type, see GetType.
This method might also return other error values. For more information about possible return values, ssee Return Values.
Comments
The GetParameters method also returns the information that is returned in Size and AccessType.
For more information about breakpoint properties, see Controlling Breakpoint Flags and Parameters.
Requirements
Versions: Available in all versions of IDebugBreakpoint.
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SetDataParameters
The SetDataParameters method sets the parameters for a processor breakpoint.
HRESULT
IDebugBreakpoint::SetDataParameters(
IN ULONG Size,
IN ULONG AccessType
);
Parameters
Size
The size, in bytes, of the memory block whose access triggers the breakpoint. For more information about restrictions on the value of Size based on the processor type,
see Valid Parameters for Processor Breakpoints.
AccessType
The type of access that triggers the breakpoint. For a list of possible value, see Valid Parameters for Processor Breakpoints.
Return Value
SetDataParametes might return one of the following values:
S_OK
The method was successful.
E_NOINTERFACE
The breakpoint is not a processor breakpoint. For more information about the breakpoint type, see GetType.
This method might also return other error values. For more information about possible return values, see Return Values.
Comments
For more information about breakpoint properties, see Controlling Breakpoint Flags and Parameters.
Requirements
Versions: Available in all versions of IDebugBreakpoint.
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetPassCount
The GetPassCount method returns the number of times that the target was originally required to reach the breakpoint location before the breakpoint is triggered.
HRESULT
IDebugBreakpoint::GetPassCount(
OUT PULONG Count
);
Parameters
Count
The number of times that the target was originally required to hit the breakpoint before it is triggered. The number of times that the target was originally required to pass
the breakpoint without triggering it is the value that is returned to Count, minus one.
Return Value
GetPassCount might return one of the following values:
S_OK
The method was successful.
This method might also return error values. For more information about possible return values, see Return Values.
Comments
The GetPassCount method returns the number of hits that were originally required to trigger the breakpoint. The GetCurrentPassCount method returns the number of hits
that still must occur to trigger the breakpoint. For example, if a breakpoint was created with a pass count of 20, and there have been 5 passes so far, this method
GetPassCount returns 20 and GetCurrentPassCount returns 15.
After the target has hit the breakpoint enough times to trigger it, the breakpoint is triggered every time that it is hit, unless you call SetPassCount. You can also call
SetPassCount to change the pass count before the breakpoint has been triggered. This call resets the original pass count and the remaining pass count.
If the debugger executes the code at the breakpoint location while stepping through the code, this execution does not contribute to the number of times that remain before the
breakpoint is triggered.
The GetParameters method also returns the information that is returned in Count.
For more information about breakpoint properties, see Controlling Breakpoint Flags and Parameters.
Requirements
Versions: Available in all versions of IDebugBreakpoint.
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SetPassCount
The SetPassCount method sets the number of times that the target must reach the breakpoint location before the breakpoint is triggered.
HRESULT
IDebugBreakpoint::SetPassCount(
IN ULONG Count
);
Parameters
Count
The number of times that the target must hit the breakpoint before it is triggered. The number of times the target must pass the breakpoint without triggering it is the value
of Count, minus one.
Return Value
SetPassCount might return one of the following values:
S_OK
The method was successful.
This method might also return error values. For more information about possible return values, see Return Values.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Comments
Every time that the SetPassCount method is called, the number of times that the target must reach the breakpoint location before the breakpoint is triggered is reset.
After the target has hit the breakpoint enough times to trigger the breakpoint, the breakpoint is triggered every time that it is hit, unless SetPassCount is called again.
If the debugger executes the code at the breakpoint location while stepping through the code, this execution does not contribute to the number of times that remain before the
breakpoint is triggered.
For more information about breakpoint properties, see Controlling Breakpoint Flags and Parameters.
Requirements
Versions: Available in all versions of IDebugBreakpoint.
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetCurrentPassCount
The GetCurrentPassCount method returns the remaining number of times that the target must reach the breakpoint location before the breakpoint is triggered.
HRESULT
IDebugBreakpoint::GetCurrentPassCount(
OUT PULONG Count
);
Parameters
Count
The remaining number of times that the target must hit the breakpoint before it is triggered. The number of times that the target must pass the breakpoint without
triggering it is the value that is returned to Count, minus one.
Return Value
GetCurrentPassCount might return one of the following values:
S_OK
The method was successful.
This method might also return error values. For more information about possible return values, see Return Values.
Comments
The GetPassCount method returns the number of hits that were originally required to trigger the breakpoint. GetCurrentPassCount returns the number of hits that still must
occur to trigger the breakpoint. For example, if a breakpoint was created with a pass count of 20, and there have been 5 passes so far, GetPassCount returns 20 and
GetCurrentPassCount returns 15.
After the target has hit the breakpoint enough times to trigger it, the breakpoint is triggered every time that it is hit, unless SetPassCount is called again. You can also call
SetPassCount to change the pass count before the breakpoint has been triggered. This call resets the original pass count and the remaining pass count.
If the debugger executes the code at the breakpoint location while stepping through the code, this execution does not contribute to the number of times that remain before the
breakpoint is triggered.
The GetParameters method also returns the information that is returned in Count.
For more information about breakpoint properties, see Controlling Breakpoint Flags and Parameters.
Requirements
Versions: Available in all versions of IDebugBreakpoint.
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetMatchThreadId
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The GetMatchThreadId method returns the engine thread ID of the thread that can trigger a breakpoint.
HRESULT
IDebugBreakpoint::GetMatchThreadId(
OUT PULONG Id
);
Parameters
Id
The engine thread ID of the thread that can trigger this breakpoint.
Return Value
GetMatchThreadId might return one of the following values:
S_OK
The method was successful.
E_NOINTERFACE
No specific thread has been set for this breakpoint. Any thread can trigger the breakpoint.
This method might also return other error values. For more information about possible return values, see Return Values.
Comments
If you have set a thread for the breakpoint, the breakpoint can be triggered only if that thread hits the breakpoint. If you have not set a thread , any thread can trigger the
breakpoint and Id receives NULL.
The GetParameters method also returns the engine thread ID of the thread that can trigger the breakpoint.
For more information about breakpoint properties, see Controlling Breakpoint Flags and Parameters.
Requirements
Versions: Available in all versions of IDebugBreakpoint.
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SetMatchThreadId
The SetMatchThreadId method sets the engine thread ID of the thread that can trigger a breakpoint.
HRESULT
IDebugBreakpoint::SetMatchThreadId(
IN ULONG Thread
);
Parameters
Thread
The engine thread ID of the thread that can trigger this breakpoint.
Return Value
SetMatchThreadId might return one of the following values:
S_OK
The method was successful.
E_NOINTERFACE
The thread that Thread specifies could not be found.
E_INVALIDARG
The target is in a kernel and the breakpoint is a processor breakpoint. Processor breakpoints cannot be limited to threads in kernel mode.
This method might also return other error values. For more information about possible return values, see Return Values.
Comments
If you have set a thread for the breakpoint, the breakpoint can be triggered only if that thread hits the breakpoint. If you have not set a thread, any thread can trigger the
breakpoint.
If you have set a thread, you can remove the setting by setting Id to DEBUG_ANY_ID.
For more information about breakpoint properties, see Controlling Breakpoint Flags and Parameters.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Requirements
Versions: Available in all versions of IDebugBreakpoint.
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetType
The GetType method returns the type of the breakpoint and the type of the processor that a breakpoint is set for.
HRESULT
IDebugBreakpoint::GetType(
OUT PULONG BreakType,
OUT PULONG ProcType
);
Parameters
BreakType
The type of the breakpoint. The type can be one of the following values.
Value
Description
DEBUG_BREAKPOINT_CODE Software breakpoint
DEBUG_BREAKPOINT_DATA Processor breakpoint
ProcType
The type of the processor that the breakpoint is set for.
Return Value
GetType might return one of the following values:
S_OK
The method was successful.
This method might also return error values. For more information about possible return values, see Return Values.
Comments
If changes are made to the breakpoint, the processor type might change.
The GetParameters method also returns the information that is returned in BreakType and ProcType.
For more information about breakpoint types, see Breakpoints.
Requirements
Versions: Available in all versions of IDebugBreakpoint.
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
IDebugSymbolGroup
The IDebugSymbolGroup interface includes the following methods:
OutputAsType
AddSymbol
GetSymbolEntryInformation
ExpandSymbol
GetSymbolName
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetNumberSymbols
GetSymbolOffset
OutputSymbols
GetSymbolParameters
GetSymbolRegister
RemoveSymbolByIndex
RemoveSymbolByName
GetSymbolSize
GetSymbolTypeName
GetSymbolValueText
WriteSymbol
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
OutputAsType
The OutputAsType and OutputAsTypeWide methods change the type of a symbol in a symbol group. The symbol's entry is updated to represent the new type.
HRESULT
IDebugSymbolGroup::OutputAsType(
IN ULONG Index,
IN PCSTR Type
);
HRESULT
IDebugSymbolGroup2::OutputAsTypeWide(
IN ULONG Index,
IN PCWSTR Type
);
#ifdef UNICODE
#define OutputAsTypeT OutputAsTypeWide
#else
#define OutputAsTypeT OutputAsType
#endif
Parameters
Index
The index of the entry in this symbol group. The index of a symbol is an identification number. The index ranges from zero through the number of symbols in the symbol
group minus one.
Type
Tthe name of the type of the symbol that you want. If the name begins with an exclamation mark (!), the name is treated as an extension. For more information about how
to use an extension as a type, see the Comments section.
Return Value
OutputAsType and OutputAsTypeWide might return one of the following values:
S_OK
The method was successful.
This method might also return error values. For more information about possible return values, see Return Values.
Comments
Because the children of the new entry type might differ from the children of the old entry type, the OutputAsType method removes all of the children of the entry from the
symbol group. You can add the children back by using the ExpandSymbol method.
If Type is an extension, the address of the symbol is passed to the extension. Every line of output from the extension becomes a child symbol of the specified symbol. These
child symbols are text and you cannot manipulate them in any way. For example, if the name of a variable is @$teb, you can change its type to !teb.
For more information about symbol groups, see Scopes and Symbol Groups.
Requirements
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Versions: OutputAsType is available in all versions of IDebugSymbolGroup. OutputAsTypeWide is available in IDebugSymbolGroup2 and later versions.
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetNumberSymbols, ExpandSymbol
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
AddSymbol
The AddSymbol and AddSymbolWide methods add a symbol to a symbol group.
HRESULT
IDebugSymbolGroup::AddSymbol(
IN PCSTR Name,
IN OUT PULONG Index
);
HRESULT
IDebugSymbolGroup2::AddSymbolWide(
IN PCWSTR Name,
IN OUT PULONG Index
);
#ifdef UNICODE
#define AddSymbolT AddSymbolWide
#else
#define AddSymbolT AddSymbol
#endif
Parameters
Name
The symbol's name. Name is examined as an expression to determine the symbol's type. This expression can include pointer, array, and structure dereferencing (for
example, *my_pointer, my_array[1], or my_struct.some_field).
Index
The index of the entry in the symbol group. When you are calling AddSymbol or AddSymbolWide, Index should point to the index of the symbol that you want. Or, if
Index points to DEBUG_ANY_ID, the symbol is appended to the end of the list.
When this method returns, Index points to the actual index of the symbol. The index of a symbol is an identification number. The index ranges from zero through the
number of symbols in the symbol group minus one.
Return Value
AddSymbol and AddSymbolWide might return one of the following values:
S_OK
The method was successful.
This method might also return error values. For more information about possible return values, see Return Values.
Comments
The symbol name in Name is evaluated by the C++ expression evaluator and can contain any C++ expression (for example, x+y).
If the index that you want is less than the size of the symbol group, the new symbol is added at the desired index. If the desired index is larger than the size of the symbol
group, the new symbol is added to the end of the list (as in the case of DEBUG_ANY_ID).
For more information about symbol groups, see Scopes and Symbol Groups.
Requirements
Versions: AddSymbol is available in all versions of IDebugSymbolGroup. AddSymbolWide is available in IDebugSymbolGroup2 and later versions.
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetNumberSymbols, RemoveSymbolByIndex, RemoveSymbolByName
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetSymbolEntryInformation
The GetSymbolEntryInformation method returns information about a symbol in a symbol group.
HRESULT
IDebugSymbolGroup2::GetSymbolEntryInformation(
IN ULONG Index,
OUT PDEBUG_SYMBOL_ENTRY Entry
);
Parameters
Index
The index of the symbol whose information iyou want. The index of a symbol is an identification number. The index ranges from zero through the number of symbols in
the symbol group minus one.
Entry
The information about the symbol. For more information about this structure, see DEBUG_SYMBOL_ENTRY.
Return Value
GetSymbolEntryInformation might return one of the following values:
S_OK
The method was successful.
This method might also return error values. For more information about possible return values, see Return Values.
Comments
For more information about symbol groups, see Scopes and Symbol Groups.
Requirements
Versions: Available in IdebugSymbolGroup2 and later versions.
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
DEBUG_SYMBOL_ENTRY, GetNumberSymbols, IDebugSymbols3::GetSymbolEntryInformation
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExpandSymbol
The ExpandSymbol method adds or removes the children of a symbol from a symbol group.
HRESULT
ExpandSymbol(
IN ULONG Index,
IN BOOL Expand
);
Parameters
Index
The index of the symbol whose children will be added or removed. The index of a symbol is an identification number. The index ranges from zero through the number of
symbols in the symbol group minus one.
Expand
A Boolean value that specifies whether to add or remove the symbols children from the symbol group. If Expand is true, the children are added. If Expand is false, the
children are removed.
Return Value
ExpandSymbol might return one of the following values:
S_OK
The method was successful.
S_FALSE
The symbol has no children to add.
E_INVALIDARG
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The depth of the symbol is DEBUG_SYMBOL_EXPANSION_LEVEL_MASK, which is the maximum depth. This depth prevented the specified symbol's children
from being added to this symbol group.
This method might also return error values. For more information about possible return values, see Return Values.
Comments
For more information about symbol groups, see Scopes and Symbol Groups.
Requirements
Versions: Available in all versions of IDebugSymbolGroup.
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetNumberSymbols
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetSymbolName
The GetSymbolName and GetSymbolNameWide methods return the name of a symbol in a symbol group.
HRESULT
IDebugSymbolGroup::GetSymbolName(
IN ULONG Index,
OUT OPTIONAL PSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG NameSize
);
HRESULT
IDebugSymbolGroup2::GetSymbolNameWide(
IN ULONG Index,
OUT OPTIONAL PWSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG NameSize
);
#ifdef UNICODE
#define GetSymbolNameT GetSymbolNameWide
#else
#define GetSymbolNameT GetSymbolName
#endif
Parameters
Index
The index of the symbol whose name you want. The index of a symbol is an identification number. The index ranges from zero through the number of symbols in the
symbol group minus one.
Buffer
The symbol name. If Buffer is NULL, this information is not returned.
BufferSize
The size of the buffer that Buffer points to.
NameSize
The size of the symbol name. If NameSize is NULL, this information is not returned.
Return Value
GetSymbolName and GetSymbolNameWide might return one of the following values:
S_OK
The method was successful.
S_FALSE
The method was successful. However, the name of the symbol did not fit in the Buffer buffer, so a truncated name was returned.
This method might also return error values. For more information about possible return values, see Return Values.
Comments
For more information about symbol groups, see Scopes and Symbol Groups.
Requirements
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Versions: GetSymbolName is available in all versions of IDebugSymbolGroup. GetSymbolNameWide is available in IDebugSymbolGroup2 and later versions.
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetNumberSymbols
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetNumberSymbols
The GetNumberSymbols method returns the number of symbols that are contained in a symbol group.
HRESULT
IDebugSymbolGroup::GetNumberSymbols(
OUT PULONG Number
);
Parameters
Number
The number of symbols that are contained in this symbol group.
Return Value
GetNumberSymbol might return one of the following values:
S_OK
The method was successful.
This method might also return error values. For more information about possible return values, see Return Values.
Comments
Each symbol in a symbol group is identified by an index. This index is a number between zero and the number that is returned to Number minus one. Every time that a symbol
is added or removed from the symbol group, the index of all of the symbols in the group might change.
For more information about symbol groups, see Scopes and Symbol Groups.
Requirements
Versions: Available in all versions of IDebugSymbolGroup.
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetSymbolOffset
The GetSymbolOffset method retrieves the location in the process's virtual address space of a symbol in a symbol group, if the symbol has an absolute address.
HRESULT
IDebugSymbolGroup2::GetSymbolOffset(
IN ULONG Index,
OUT PULONG64 Offset
);
Parameters
Index
The index of the symbol whose address you want. The index of a symbol is an identification number. The index ranges from zero through the number of symbols in the
symbol group minus one.
Offset
The location in the process's virtual address space of the symbol.
Return Value
GetSymbolOffset might return one of the following values:
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
S_OK
The method was successful.
E_NOINTERFACE
The symbol does not have an absolute address.
This method might also return error values. For more information about possible return values, see Return Values.
Comments
For more information about symbol groups, see Scopes and Symbol Groups.
Requirements
Versions: Available in IDebugSymbolGroup2 and later versions.
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetNumberSymbols
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
OutputSymbols
The OutputSymbols method prints the specified symbols to the debugger console.
HRESULT
IDebugSymbolGroup::OutputSymbols(
IN ULONG OutputControl,
IN ULONG Flags,
IN ULONG Start,
IN ULONG Count
);
Parameters
OutputControl
The output control to use when printing the symbols' information. For more information about possible values, see DEBUG_OUTCTL_XXX. For more information about
output, see Input and Output.
Flags
Tthe flags that determine what information is printed for each symbol. By default, the output includes the symbol's name, offset, value, and type. The format for the
output is as follows:
Name**NAME**Offset**OFF**Value**VALUE**Type**TYPE**
You can use the following bit flags to suppress the output of one of these pieces of information together with the corresponding marker.
Value
Description
DEBUG_OUTPUT_SYMBOLS_NO_NAMES Suppress output of the symbol's name.
DEBUG_OUTPUT_SYMBOLS_NO_OFFSETS Suppress output of the symbol's offset.
DEBUG_OUTPUT_SYMBOLS_NO_VALUES Suppress output of the symbol's value.
DEBUG_OUTPUT_SYMBOLS_NO_TYPES Suppress output of the symbol's type.
Start
The index of the first symbol in the symbol group to print. The index of a symbol is an identification number. This number ranges from zero through the number of
symbols in the symbol group minus one.
Count
The number of symbols to print.
Return Value
OutputSymbols might return one of the following values:
S_OK
The method was successful.
This method might also return error values. For more information about possible return values, see Return Values.
Comments
For more information about symbol groups, see Scopes and Symbol Groups.
Requirements
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetSymbolParameters
The GetSymbolParameters method returns the symbol parameters that describe the specified symbols in a symbol group.
HRESULT
IDebugSymbolGroup::GetSymbolParameters(
IN ULONG Start,
IN ULONG Count,
OUT DEBUG_SYMBOL_PARAMETERS * Params
);
Parameters
Start
The index in the symbol group of the first symbol whose parameters you want. The index of a symbol is an identification number. This number ranges from zero through
the number of symbols in the symbol group minus one.
Count
The number of symbol parameters that you want.
Params
The symbol parameters. This array must hold at least Count elements. For a description of these parameters, see DEBUG_SYMBOL_PARAMETERS.
Return Value
GetSymbolParameters might return one of the following values:
S_OK
The method was successful.
This method might also return error values. For more information about possible return values, see Return Values.
Comments
For more information about symbol groups, see Scopes and Symbol Groups.
Requirements
Versions: Available in all versions of IDebugSymbolGroup.
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
DEBUG_SYMBOL_PARAMETERS, GetNumberSymbols
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetSymbolRegister
The GetSymbolRegister method returns the register that contains the value or a pointer to the value of a symbol in a symbol group.
HRESULT
IDebugSymbolGroup2::GetSymbolRegister(
IN ULONG Index,
OUT PULONG Register
);
Parameters
Index
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The index of the symbol to return the register for. The index of a symbol is an identification number. The index ranges from zero through the number of symbols in the
symbol group minus one.
Register
The index of the register that contains the value or a pointer to the value of the symbol.
Return Value
GetSymbolRegister might return one of the following values:
S_OK
The method was successful.
E_NOINTERFACE
The symbol's value and a pointer to it are not contained in a register, or the register is not known.
This method might also return error values. For more information about possible return values, see Return Values.
Comments
For more information about symbol groups, see Scopes and Symbol Groups. For more information about registers and the register index, see Registers.
Requirements
Versions: Available in IDebugSymbolGroup2 and later versions.
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetNumberSymbols
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
RemoveSymbolByIndex
The RemoveSymbolByIndex method removes the specified symbol from a symbol group.
HRESULT
IDebugSymbolGroup::RemoveSymbolByIndex(
IN ULONG Index
);
Parameters
Index
The index of the symbol to remove. The index of a symbol is an identification number. The index ranges from zero through the number of symbols in the symbol group
minus one.
Return Value
RemoveSymbolByIndex might return one of the following values:
S_OK
The method was successful.
This method might also return error values. For more information about possible return values, see Return Values.
Comments
When a symbol is removed, the indexes of the symbols that remain in the symbol group might change.
For more information about symbol groups, see Scopes and Symbol Groups.
Requirements
Versions: Available in all versions of IDebugSymbolGroup.
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
AddSymbol, GetNumberSymbols, RemoveSymbolByName
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
RemoveSymbolByName
The RemoveSymbolByName and RemoveSymbolByNameWide methods remove the specified symbol from a symbol group.
HRESULT
IDebugSymbolGroup::RemoveSymbolByName(
IN PCSTR Name
);
HRESULT
IDebugSymbolGroup2::RemoveSymbolByNameWide(
IN PCWSTR Name
);
#ifdef UNICODE
#define RemoveSymbolByNameT RemoveSymbolByNameWide
#else
#define RemoveSymbolByNameT RemoveSymbolByName
#endif
Parameters
Name
The name of the symbol to remove from the symbol group.
Return Value
RemoveSymbolByName and RemoveSymbolByNameWide might return one of the following values:
S_OK
The method was successful.
This method might also return error values. For more information about possible return values, see Return Values.
Comments
When a symbol is removed, the indexes of the symbols that remain in the symbol group might change.
For more information about symbol groups, see Scopes and Symbol Groups.
Requirements
Versions: RemoveSymbolByName is available in all versions of IDebugSymbolGroup. RemoveSymbolByNameWide is available in IDebugSymbolGroup2 and later
versions.
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
AddSymbol, GetSymbolName, RemoveSymbolByIndex
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetSymbolSize
The GetSymbolSize method returns the size of a symbol's value.
HRESULT
IDebugSymbolGroup2::GetSymbolSize(
IN ULONG Index,
OUT PULONG Size
);
Parameters
Index
The index of the symbol to remove. The index of a symbol is an identification number. The index ranges from zero through the number of symbols in the symbol group
minus one.
Size
The size, in bytes, of the symbol's value. This information might not be available. If this information is not available, Size is set to zero. For some symbols (for example, a
function's code), the data might be split over multiple regions. In this situation, Size is not meaningful.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Return Value
GetSymbolSize might return one of the following values:
S_OK
The method was successful.
E_NOINTERFACE
The symbol does not have type data associated with it.
This method might also return error values. For more information about possible return values, see Return Values.
Comments
For more information about symbol groups, see Scopes and Symbol Groups.
Requirements
Versions: Available in IDebugSymbolGroup2 and later versions.
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetNumberSymbols, IDebugSymbols::GetTypeSize
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetSymbolTypeName
The GetSymbolTypeName and GetSymbolTypeNameWide methods return the name of the specified symbol's type.
HRESULT
IDebugSymbolGroup::GetSymbolTypeName(
IN ULONG Index,
OUT OPTIONAL PSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG NameSize
);
HRESULT
IDebugSymbolGroup2::GetSymbolTypeNameWide(
IN ULONG Index,
OUT OPTIONAL PWSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG NameSize
);
#ifdef UNICODE
#define GetSymbolTypeNameT GetSymbolTypeNameWide
#else
#define GetSymbolTypeNameT GetSymbolTypeName
#endif
Parameters
Index
The index of the symbol whose type name you want. The index of a symbol is an identification number. The index ranges from zero through the number of symbols in
the symbol group minus one.
Buffer
The name of the symbol's type. If Buffer is NULL, this information is not returned.
BufferSize
The size, in characters, of the Buffer buffer.
NameSize
The size, in characters, of the name of the symbol's type. If NameSize is NULL, this information is not returned.
Return Value
GetSymbolTypeName and GetSymbolTypeNameWide might return one of the following values:
S_OK
The method was successful.
S_FALSE
The size of the buffer was smaller than the size of the name of the symbol's type. The buffer is filled with the truncated name.
This method might also return error values. For more information about possible return values, see Return Values.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Comments
For more information about symbol groups, see Scopes and Symbol Groups.
Requirements
Versions: Available in IDebugSymbolGroup2 and later versions.
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetNumberSymbols, IDebugSymbols::GetTypeName
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetSymbolValueText
The GetSymbolValueText and GetSymbolValueTextWide methods return a string that represents the value of a symbol.
HRESULT
IDebugSymbolGroup2::GetSymbolValueText(
IN ULONG Index,
OUT OPTIONAL PSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG NameSize
);
HRESULT
IDebugSymbolGroup2::GetSymbolValueTextWide(
IN ULONG Index,
OUT OPTIONAL PSTR Buffer,
IN ULONG BufferSize,
OUT OPTIONAL PULONG NameSize
);
#ifdef UNICODE
#define GetSymbolValueTextT GetSymbolValueTextWide
#else
#define GetSymbolValueTextT GetSymbolValueText
#endif
Parameters
Index
The index of the symbol whose value you want. The index of a symbol is an identification number. The index ranges from zero through the number of symbols in the
symbol group minus one.
Buffer
The value of the symbol as a string. If Buffer is NULL, this information is not returned.
BufferSize
The size, in characters, of the Buffer buffer.
NameSize
The size, in characters, of the value of the symbol. If NameSize is NULL, this information is not returned.
Return Value
GetSymbolValueText and GetSymbolValueTextWide might return one of the following values:
S_OK
The method was successful.
S_FALSE
The method was successful. However, the value of the symbol would not fit in the Buffer buffer, so a truncated value was returned.
This method might also return error values. For more information about possible return values, see Return Values.
Comments
If you added the symbol to the symbol group by using the AddSymbol method, the string that is returned to Buffer is the name of the symbol that is passed to AddSymbol.
For more information about symbol groups, see Scopes and Symbol Groups.
Requirements
Versions: Available in IDebugSymbolGroup2 and later versions.
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
See Also
GetNumberSymbols, WriteSymbol
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
WriteSymbol
The WriteSymbol and WriteSymbolWide methods set the value of the specified symbol.
HRESULT
IDebugSymbolGroup::WriteSymbol(
IN ULONG Index,
IN PCSTR Value
);
HRESULT
IDebugSymbolGroup::WriteSymbolWide(
IN ULONG Index,
IN PCWSTR Value
);
#ifdef UNICODE
#define WriteSymbolT WriteSymbolWide
#else
#define WriteSymbolT WriteSymbol
#endif
Parameters
Index
The index of the symbol whose value will be changed. The index of a symbol is an identification number. The index ranges from zero through the number of symbols in
the symbol group minus one.
Value
A C++ expression that is evaluated to give the symbol's new value.
Return Value
WriteSymbol and WriteSymbolWide might return one of the following values:
S_OK
The method was successful.
This method might also return error values. For more information about possible return values, see Return Values.
Comments
Th WriteSymbol and WriteSymbolWide methods can change symbols only if the symbols are stored in a register or memory location that the debugger engine knowns and
if they have not had their type changed to an extension by using the OutputAsType method.
For more information about symbol groups, see Scopes and Symbol Groups.
Requirements
Versions: WriteSymbol is available in all versions of IDebugSymbolGroup. WriteSymbolWide is available in IDebugSymbolGroup2 and later versions.
Headers: Defined in Dbgeng.h. Include Dbgeng.h.
See Also
GetNumberSymbols, GetSymbolValueText
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
DEBUG_ATTACH_XXX
DEBUG_BREAKPOINT_PARAMETERS
DEBUG_CREATE_PROCESS_OPTIONS
DEBUG_DATA_SPACE_XXX
DEBUG_DUMP_XXX
DEBUG_ENGOPT_XXX
DEBUG_EVENT_XXX
DEBUG_EXCEPTION_FILTER_PARAMETERS
DEBUG_FILTER_XXX
DEBUG_FIND_SOURCE_XXX
DEBUG_FORMAT_XXX
DEBUG_HANDLE_DATA_BASIC
DEBUG_LAST_EVENT_INFO_XXX
DEBUG_MODULE_AND_ID
DEBUG_MODULE_PARAMETERS
DEBUG_OFFSET_REGION
DEBUG_OUTCTL_XXX
DEBUG_OUTPUT_XXX
DEBUG_PROCESS_XXX
DEBUG_PROCESSOR_IDENTIFICATION_ALL
DEBUG_REGISTER_DESCRIPTION
DEBUG_SPECIFIC_FILTER_PARAMETERS
DEBUG_STACK_FRAME
DEBUG_STATUS_XXX
DEBUG_SYMBOL_XXX
DEBUG_SYMBOL_ENTRY
DEBUG_SYMBOL_PARAMETERS
DEBUG_SYMBOL_SOURCE_ENTRY
DEBUG_THREAD_BASIC_INFORMATION
DEBUG_TYPED_DATA
DEBUG_TYPEOPTS_XXX
DEBUG_VALUE
EXT_TDOP
EXT_TYPED_DATA
SYMOPT_XXX
Return Values (HRESULT Values)
Specific Exceptions
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
DEBUG_ASMOPT_XXX
The assembly and disassembly options affect how the debugger engine assembles and disassembles processor instructions for the target.
The options are represented by a bitset with the following bit flags.
Value
DEBUG_ASMOPT_VERBOSE
Description
When this bit is set, additional information is included in the disassembly.
This is equivalent to the verbose option in the .asm command.
DEBUG_ASMOPT_NO_CODE_BYTES
When this bit is set, the raw bytes for an instruction are not included in the disassembly.
This is equivalent to the no_code_bytes option in the .asm command.
DEBUG_ASMOPT_IGNORE_OUTPUT_WIDTH When this bit is set, the debugger ignores the width of the output display when formatting instructions during
disassembly.
This is equivalent to the ignore_output_width option in the .asm command.
DEBUG_ASMOPT_SOURCE_LINE_NUMBER When this bit is set, each line of the disassembly output is prefixed with the line number of the source code provided by
symbol information.
This is equivalent to the source_line option in the .asm command.
Comments
Additionally, the value DEBUG_ASMOPT_DEFAULT represents the default set of assembly and disassembly options. This means that all the options in the preceding table
are turned off.
Requirements
Headers: Defined in DbgEng.h. Include DbgEng.h.
See Also
GetAssemblyOptions, SetAssemblyOptions, AddAssemblyOptions, RemoveAssemblyOptions, Assemble, Disassemble, .asm (Change Disassembly Options)
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
DEBUG_ATTACH_XXX
The DEBUG_ATTACH_XXX bit-flags described in this topic control how the debugger engine attaches to a user-mode process. For the DEBUG_ATTACH_XXX options
used when attaching to a kernel target, see AttachKernel.
The following table describes the possible flag values.
Value
DEBUG_ATTACH_NONINVASIVE
Description
Attach to the target noninvasively. For more information about noninvasive debugging, see Noninvasive
Debugging (User Mode).
Re-attach to an application to which a debugger has already attached (and possibly abandoned). For more
information about re-attaching to targets, see Re-attaching to the Target Application.
If this flag is set, then the other DEBUG_ATTACH_XXX flags must not be set.
DEBUG_ATTACH_NONINVASIVE_NO_SUSPEND
If this flag is set, then the flag DEBUG_ATTACH_NONINVASIVE must also be set.
DEBUG_ATTACH_INVASIVE_NO_INITIAL_BREAK (Windows XP and later) Do not request an initial break-in when attaching to the target.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
If this flag is set, then the flags DEBUG_ATTACH_NONINVASIVE and DEBUG_ATTACH_EXISTING must
not be set.
DEBUG_ATTACH_INVASIVE_RESUME_PROCESS Resume all of the target's threads when attaching invasively.
If this flag is set, then the flags DEBUG_ATTACH_NONINVASIVE and DEBUG_ATTACH_EXISTING must
not be set.
Requirements
Headers: Defined in DbgEng.h. Include DbgEng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
DEBUG_BREAKPOINT_PARAMETERS
The DEBUG_BREAKPOINT_PARAMETERS structure contains most of the parameters for describing a breakpoint.
typedef struct _DEBUG_BREAKPOINT_PARAMETERS {
ULONG64 Offset;
ULONG Id;
ULONG BreakType;
ULONG ProcType;
ULONG Flags;
ULONG DataSize;
ULONG DataAccessType;
ULONG PassCount;
ULONG CurrentPassCount;
ULONG MatchThread;
ULONG CommandSize;
ULONG OffsetExpressionSize;
} DEBUG_BREAKPOINT_PARAMETERS, * PDEBUG_BREAKPOINT_PARAMETERS;
Members
Offset
The location in the target's memory address space that will trigger the breakpoint. If the breakpoint is deferred (see GetFlags), Offset is DEBUG_INVALID_OFFSET.
See GetOffset.
Id
The breakpoint ID. See GetId.
BreakType
Specifies if the breakpoint is a software breakpoint or a processor breakpoint. See GetType.
ProcType
The processor type for which the breakpoint is set. See GetType.
Flags
The flags for the breakpoint. See GetFlags.
DataSize
The size, in bytes, of the memory block whose access will trigger the breakpoint. If the type of the breakpoint is not a data breakpoint, this is zero. See
GetDataParameters.
DataAccessType
The type of access that will trigger the breakpoint. If the type of the breakpoint is not a data breakpoint, this is zero. See GetDataParameters.
PassCount
The number of times the target will hit the breakpoint before it is triggered. See GetPassCount.
CurrentPassCount
The remaining number of times that the target will hit the breakpoint before it is triggered. See GetCurrentPassCount.
MatchThread
The engine thread ID of the thread that can trigger this breakpoint. If any thread can trigger this breakpoint, MatchThread is DEBUG_ANY_ID. See
GetMatchThreadId.
CommandSize
The size, in characters, of the command string that will be executed when the breakpoint is triggered. If no command is set, CommandSize is zero. See GetCommand.
OffsetExpressionSize
The size, in characters, of the expression string that evaluates to the location in the target's memory address space where the breakpoint is triggered. If no expression
string is set, OffsetExpressionSize is zero. See GetOffsetExpression.
Comments
For an overview of how to use breakpoints, and a description of all breakpoint-related methods, see Breakpoints.
Requirements
Headers: Defined in DbgEng.h. Include DbgEng.h.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
DEBUG_CREATE_PROCESS_OPTIONS
The DEBUG_CREATE_PROCESS_OPTIONS structure specifies the process creation options to use when creating a new process.
typedef struct _DEBUG_CREATE_PROCESS_OPTIONS
{
ULONG CreateFlags;
ULONG EngCreateFlags;
ULONG VerifierFlags;
ULONG Reserved;
} DEBUG_CREATE_PROCESS_OPTIONS, *PDEBUG_CREATE_PROCESS_OPTIONS;
Members
CreateFlags
The flags to use when creating the process. In addition to the flags described in the "Process Creation Flags" topic in the Platform SDK documentation, the debugger
engine uses the following flags when creating a process.
Values
Description
DEBUG_CREATE_PROCESS_NO_DEBUG_HEAP (Microsoft Windows Server 2003 and later) Prevents the debug heap from being used in the new process.
DEBUG_CREATE_PROCESS_THROUGH_RTL The native NT RTL process creation routines should be used instead of Win32. This is only meaningful for
special processes that run as NT native processes. No Win32 process can be created with this flag.
When creating and attaching to a process through the debugger engine, set one of the Platform SDK's process creation flags: DEBUG_PROCESS or
DEBUG_ONLY_THIS_PROCESS.
EngCreateFlags
The engine specific flags used when creating the process. EngCreateFlags is a combination of the following bit-flags:
Value
Description
DEBUG_ECREATE_PROCESS_INHERIT_HANDLES
The new process will inherit system handles from the debugger or process server.
DEBUG_ECREATE_PROCESS_USE_VERIFIER_FLAGS
(Windows Vista and later) Use Application Verifier flags in the VerifierFlags field.
DEBUG_ECREATE_PROCESS_USE_IMPLICIT_COMMAND_LINE Use the debugger's or process server's implicit command line to start the process instead of a
supplied command line.
VerifierFlags
The Application Verifier flags. Only used if DEBUG_ECREATE_PROCESS_USE_VERIFIER_FLAGS is set in the EngCreateFlags field. For possible values, see the
Application Verifier documentation.
Reserved
Set to zero.
Requirements
Headers: Defined in DbgEng.h. Include DbgEng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
DEBUG_DUMP_XXX
The DEBUG_DUMP_XXX constants are used by the methods WriteDumpFile, WriteDumpFile2, and WriteDumpFileWide to specify the type of crash dump file to create.
The possible values include the following.
Value
Type of Dump File Created
DEBUG_DUMP_SMALL Small Memory Dump (kernel-mode) or Minidump (user-mode).
DEBUG_DUMP_DEFAULT Full User-Mode Dump (user-mode) or Kernel Summary Dump (kernel-mode).
DEBUG_DUMP_FULL
(kernel-mode only) Complete Memory Dump.
Moreover, the following aliases are available for kernel-mode debugging.
Alias
Value
DEBUG_KERNEL_SMALL_DUMP DEBUG_DUMP_SMALL
DEBUG_KERNEL_DUMP
DEBUG_DUMP_DEFAULT
DEBUG_KERNEL_FULL_DUMP DEBUG_DUMP_FULL
Additionally, the following aliases are available for user-mode debugging.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Alias
Value
DEBUG_USER_WINDOWS_SMALL_DUMP DEBUG_DUMP_SMALL
DEBUG_USER_WINDOWS_DUMP
DEBUG_DUMP_DEFAULT
Comments
For a description of kernel-mode dump files, see Varieties of Kernel-Mode Dump Files. For a description of user-mode dump files, see Varieties of User-Mode Dump Files.
Requirements
Headers: Defined in DbgEng.h. Include DbgEng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
DEBUG_ENGOPT_XXX
The following global options affect the behavior of the debugger engine.
Value
DEBUG_ENGOPT_IGNORE_DBGHELP_VERSION
DEBUG_ENGOPT_IGNORE_EXTENSION_VERSIONS
DEBUG_ENGOPT_ALLOW_NETWORK_PATHS
DEBUG_ENGOPT_DISALLOW_NETWORK_PATHS
Network shares cannot be used for loading symbols and extensions. The engine attempts to set this option
when debugging some system processes.
This option cannot be set if DEBUG_ENGOPT_ALLOW_NETWORK_PATHS is set.
DEBUG_ENGOPT_IGNORE_LOADER_EXCEPTIONS
Ignore expected first-chance exceptions that are generated by the loader in certain versions of Windows.
For example, this option allows Windows 3.51 binaries to run when debugging Windows 3.1 and 3.5
systems.
DEBUG_ENGOPT_INITIAL_BREAK
DEBUG_ENGOPT_INITIAL_MODULE_BREAK
DEBUG_ENGOPT_FINAL_BREAK
DEBUG_ENGOPT_NO_EXECUTE_REPEAT
DEBUG_ENGOPT_FAIL_INCOMPLETE_INFORMATION
DEBUG_ENGOPT_ALLOW_READ_ONLY_BREAKPOINTS Allow the debugger engine to manipulate page protections on the target to allow for setting software
breakpoints in a read-only section of memory.
When setting software breakpoints, the engine transparently alters the target's memory to insert an interrupt
instruction.
DEBUG_ENGOPT_SYNCHRONIZE_BREAKPOINTS
In live user-mode debugging, the engine performs extra work when inserting and removing breakpoints to
ensure that all threads in the target have a consistent breakpoint state at all times.
This option is useful when multiple threads can use the code for which the breakpoint is set. However, it can
introduce the possibility of deadlocks.
DEBUG_ENGOPT_DISALLOW_SHELL_COMMANDS
Turn on quiet mode. For more information, see sq (Set Quiet Mode).
Disables debugger engine support for managed code. If support for managed code is already in use, this
option has no effect.
DEBUG_ENGOPT_DISABLE_MODULE_SYMBOL_LOAD The debugger does not load symbols for modules that are loaded while this flag is set.
DEBUG_ENGOPT_DISABLE_EXECUTION_COMMANDS Prevents any commands that would cause the target to begin executing.
DEBUG_ENGOPT_KD_QUIET_MODE
DEBUG_ENGOPT_DISABLE_MANAGED_SUPPORT
Requirements
Headers: Defined in DbgEng.h. Include DbgEng.h.
See Also
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
DEBUG_EVENT_XXX
The following events are generated by the target.
Flag
IDebugEventCallbacks
Event Description
Method
DEBUG_EVENT_BREAKPOINT
Breakpoint
A breakpoint exception occurred in the target.
Exception
An exception debugging event occurred in the target.
DEBUG_EVENT_EXCEPTION
DEBUG_EVENT_CREATE_THREAD CreateThread
A create-thread debugging event occurred in the target.
DEBUG_EVENT_EXIT_THREAD
ExitThread
An exit-thread debugging event occurred in the target.
DEBUG_EVENT_CREATE_PROCESS CreateProcess
A create-process debugging event occurred in the target.
ExitProcess
An exit-process debugging event occurred in the target.
DEBUG_EVENT_EXIT_PROCESS
DEBUG_EVENT_LOAD_MODULE
LoadModule
A module-load debugging event occurred in the target.
DEBUG_EVENT_UNLOAD_MODULE UnloadModule
A module-unload debugging event occurred in the target.
DEBUG_EVENT_SYSTEM_ERROR SystemError
A system error occurred in the target.
The following events are generated by the debugger engine.
Flag
IDebugEventCallbacks
Description
Method
DEBUG_EVENT_SESSION_STATUS
SessionStatus
A change has occurred in the session status.
DEBUG_EVENT_CHANGE_DEBUGGEE_STATE ChangeDebuggeeState The engine has made or detected a change in the target status.
DEBUG_EVENT_CHANGE_ENGINE_STATE
ChangeEngineState
The engine state has changed.
DEBUG_EVENT_CHANGE_SYMBOL_STATE ChangeSymbolState The symbol state has changed.
Requirements
Headers: Defined in DbgEng.h. Include DbgEng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
DEBUG_EXCEPTION_FILTER_PARAMETERS
The DEBUG_EXCEPTION_FILTER_PARAMETERS structure contains the parameters for an exception filter.
typedef struct _DEBUG_EXCEPTION_FILTER_PARAMETERS
{
ULONG ExecutionOption;
ULONG ContinueOption;
ULONG TextSize;
ULONG CommandSize;
ULONG SecondCommandSize;
ULONG ExceptionCode;
} DEBUG_EXCEPTION_FILTER_PARAMETERS, *PDEBUG_EXCEPTION_FILTER_PARAMETERS;
Members
ExecutionOption
The break status of the exception filter, including the terminator. For possible values, see DEBUG_FILTER_XXX.
ContinueOption
The handling status of the exception filter. For possible values, see DEBUG_FILTER_XXX.
TextSize
The size, in characters, of the name (including the terminator) of the exception filter. If the filter is an arbitrary exception filter, it does not have a name and TextSize is
zero.
CommandSize
The size, in characters, of the command (including the terminator) to execute upon the first chance of the exception.
SecondCommandSize
The size, in characters, of the command (including the terminator) to execute upon the second chance of the exception.
ExceptionCode
The exception code for the exception filter.
Requirements
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
DEBUG_FILTER_XXX
The DEBUG_FILTER_XXX constants are used for three different purposes: to specify individual specific event filters, to specify the break status of an event filter, and to
specify the handling status of an exception filter.
Specific Event Filter
The following constants are used to specify specific event filters.
Value
Event
DEBUG_FILTER_CREATE_THREAD
Create Thread
DEBUG_FILTER_EXIT_THREAD
Exit Thread
DEBUG_FILTER_CREATE_PROCESS
Create Process
DEBUG_FILTER_EXIT_PROCESS
Exit Process
DEBUG_FILTER_LOAD_MODULE
Load Module
DEBUG_FILTER_UNLOAD_MODULE
Unload Module
DEBUG_FILTER_SYSTEM_ERROR
System Error
DEBUG_FILTER_INITIAL_BREAKPOINT Initial Break Point
DEBUG_FILTER_INITIAL_MODULE_LOAD Initial Module Load
DEBUG_FILTER_DEBUGGEE_OUTPUT
Target Output
Break Status
The following constants are used to specify the break status of an event filter.
Value
Description
DEBUG_FILTER_BREAK
The event will break into the debugger.
DEBUG_FILTER_SECOND_CHANCE_BREAK The event will break into the debugger if it is a second chance exception.
DEBUG_FILTER_OUTPUT
A notification of the event will be printed to the debugger console.
DEBUG_FILTER_IGNORE
The event is ignored.
Additionally, for an arbitrary exception filter, setting the break status to DEBUG_FILTER_REMOVE, removes the event filter.
Handling Status
The following constants are used to specify the handling status of an exception filter.
Value
Description
DEBUG_FILTER_GO_HANDLED
The exception has been handled.
DEBUG_FILTER_GO_NOT_HANDLED The exception has not been handled.
Requirements
Headers: Defined in DbgEng.h. Include DbgEng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
DEBUG_FIND_SOURCE_XXX
The DEBUG_FIND_SOURCE_XXX bit-flags are used to control the behavior of the methods FindSourceFile and FindSourceFileAndToken when searching for source
files.
The flags can be any combination of values from the following table.
Value
DEBUG_FIND_SOURCE_FULL_PATH
Description
Always return the full canonical path name for the found file.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
If not set and the source path contains relative directories, relative path names can be returned.
DEBUG_FIND_SOURCE_BEST_MATCH
Continue searching after a match has been found to look for a better match.
DEBUG_FIND_SOURCE_NO_SRCSRV
Do not include source servers in the search.
DEBUG_FIND_SOURCE_TOKEN_LOOKUP Return a variable associated with a file token.
If this flag is set, the other flags are ignored. This flag cannot be used in the FindSourceFile method.
The value DEBUG_FIND_SOURCE_DEFULT defines the default set of flags, which means that all of the flags in the previous table are turned off.
Requirements
Headers: Defined in DbgEng.h. Include DbgEng.h.
See Also
FindSourceFile, FindSourceFileAndToken
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
DEBUG_FORMAT_XXX
The DEBUG_FORMAT_XXX bit-flags are used by WriteDumpFile2 and WriteDumpFileWide to determine the format of a crash dump file and, for user-mode Minidumps,
what information to include in the file.
The following bit-flags apply to all crash dump files.
Value
DEBUG_FORMAT_WRITE_CAB
Description
Package the crash dump file in a CAB file. The supplied file name or file handle is used for the CAB file; the crash dump
is first created in a temporary file before being moved into the CAB file.
DEBUG_FORMAT_CAB_SECONDARY_FILES Include the current symbols and mapped images in the CAB file.
If DEBUG_FORMAT_WRITE_CAB is not set, this flag is ignored.
DEBUG_FORMAT_NO_OVERWRITE
Do not overwrite existing files.
The following bit-flags can also be included for user-mode Minidumps.
Value
DEBUG_FORMAT_USER_SMALL_FULL_MEMORY
Description
Add full memory data. All accessible committed pages owned by the target application will
be included.
DEBUG_FORMAT_USER_SMALL_HANDLE_DATA
Add data about the handles that are associated with the target application.
DEBUG_FORMAT_USER_SMALL_UNLOADED_MODULES
Add unloaded module information. This information is available only in Windows
Server 2003 and later versions of Windows.
DEBUG_FORMAT_USER_SMALL_INDIRECT_MEMORY
Add indirect memory. A small region of memory that surrounds any address that is
referenced by a pointer on the stack or backing store is included.
DEBUG_FORMAT_USER_SMALL_DATA_SEGMENTS
Add all data segments within the executable images.
DEBUG_FORMAT_USER_SMALL_FILTER_MEMORY
Set to zero all of the memory on the stack and in the backing store that is not useful for
recreating the stack trace. This can make compression of the Minidump more efficient and
increase privacy by removing unnecessary information.
DEBUG_FORMAT_USER_SMALL_FILTER_PATHS
Remove the module paths, leaving only the module names. This is useful for protecting
privacy by hiding the directory structure (which may contain the users name).
DEBUG_FORMAT_USER_SMALL_PROCESS_THREAD_DATA
Add the process environment block (PEB) and thread environment block (TEB). This flag can
be used to provide Windows system information for threads and processes.
DEBUG_FORMAT_USER_SMALL_PRIVATE_READ_WRITE_MEMORY Add all committed private read-write memory pages.
DEBUG_FORMAT_USER_SMALL_NO_OPTIONAL_DATA
Prevent privacy-sensitive data from being included in the Minidump. Currently, this flag
excludes from the Minidump data that would have been added due to the following flags
being set:
DEBUG_FORMAT_USER_SMALL_PROCESS_THREAD_DATA,
DEBUG_FORMAT_USER_SMALL_FULL_MEMORY,
DEBUG_FORMAT_USER_SMALL_INDIRECT_MEMORY,
DEBUG_FORMAT_USER_SMALL_PRIVATE_READ_WRITE_MEMORY.
DEBUG_FORMAT_USER_SMALL_FULL_MEMORY_INFO
Add all basic memory information. This is the information returned by the QueryVirtual
method. The information for all memory is included, not just valid memory, which allows the
debugger to reconstruct the complete virtual memory layout from the Minidump.
DEBUG_FORMAT_USER_SMALL_THREAD_INFO
Add additional thread information, which includes execution time, start time, exit time, start
address, and exit status.
DEBUG_FORMAT_USER_SMALL_CODE_SEGMENTS
Add all code segments with the executable images.
Requirements
Headers: Defined in DbgEng.h. Include DbgEng.h.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
DEBUG_HANDLE_DATA_BASIC
The DEBUG_HANDLE_DATA_BASIC structure contains handle-related information about a system object.
typedef struct _DEBUG_HANDLE_DATA_BASIC
{
ULONG TypeNameSize;
ULONG ObjectNameSize;
ULONG Attributes;
ULONG GrantedAccess;
ULONG HandleCount;
ULONG PointerCount;
} DEBUG_HANDLE_DATA_BASIC, *PDEBUG_HANDLE_DATA_BASIC;
Members
TypeNameSize
The size, in characters, of the object-type name.
ObjectNameSize
The size, in characters, of the objects name.
Attributes
A bit-set that contains the handle's attributes. For possible values, see "Handle" in the Windows Driver Kit (WDK).
GrantedAccess
A bit-set that specifies the access mask for the object that is represented by the handle. For details, see ACCESS_MASK in the Platform SDK documentation.
HandleCount
The number of handle references for the object.
PointerCount
The number of pointer references for the object.
Requirements
Headers: Defined in DbgEng.h. Include DbgEng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
DEBUG_MODULE_AND_ID
The DEBUG_MODULE_AND_ID structure describes a symbol within a module.
typedef struct _DEBUG_MODULE_AND_ID
{
ULONG64 ModuleBase;
ULONG64 Id;
} DEBUG_MODULE_AND_ID, * PDEBUG_MODULE_AND_ID;
Members
ModuleBase
The location in the target's virtual address space of the modules base address.
Id
The symbol ID of the symbol within the module.
Requirements
Headers: Defined in DbgEng.h. Include DbgEng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
DEBUG_MODULE_PARAMETERS
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The DEBUG_MODULE_PARAMETERS structure contains most of the parameters for describing a module.
typedef struct _DEBUG_MODULE_PARAMETERS
{
ULONG64 Base;
ULONG Size;
ULONG TimeDateStamp;
ULONG Checksum;
ULONG Flags;
ULONG SymbolType;
ULONG ImageNameSize;
ULONG ModuleNameSize;
ULONG LoadedImageNameSize;
ULONG SymbolFileNameSize;
ULONG MappedImageNameSize;
...
} DEBUG_MODULE_PARAMETERS, *PDEBUG_MODULE_PARAMETERS;
Members
Base
The location in the target's virtual address space of the modules base. If the value of Base is DEBUG_INVALID_OFFSET, the structure is invalid.
Size
The size, in bytes, of the memory range that is occupied by the module.
TimeDateStamp
The date and time stamp of the module's executable file. This is the number of seconds elapsed since midnight (00:00:00), January 1, 1970 Coordinated Universal Time
(UTC) as stored in the image file header.
Checksum
The checksum of the image. This value can be zero.
Flags
A bit-set that contains the module's flags. The bit-flags that can be present are as follows.
Value
Description
DEBUG_MODULE_UNLOADED
The module was unloaded.
DEBUG_MODULE_USER_MODE
The module is a user-mode module.
DEBUG_MODULE_SYM_BAD_CHECKSUM The checksum in the symbol file did not match the checksum for the module image.
SymbolType
The type of symbols that are loaded for the module. This member can have one of the following values.
Value
Description
DEBUG_SYMTYPE_NONE
No symbols are loaded.
DEBUG_SYMTYPE_COFF
The symbols are in common object file format (COFF).
DEBUG_SYMTYPE_CODEVIEW The symbols are in Microsoft CodeView format.
DEBUG_SYMTYPE_PDB
Symbols in PDB format have been loaded through the pre-Debug Interface Access (DIA) interface.
DEBUG_SYMTYPE_EXPORT
No actual symbol files were found; symbol information was extracted from the binary file's export table.
DEBUG_SYMTYPE_DEFERRED The module was loaded, but the engine has deferred its loading of the symbols.
DEBUG_SYMTYPE_SYM
Symbols in SYM format have been loaded.
DEBUG_SYMTYPE_DIA
Symbols in PDB format have been loaded through the DIA interface.
ImageNameSize
The size of the file name for the module. The size is measured in characters, including the terminator.
ModuleNameSize
The size of the module name of the module. The size is measured in characters, including the terminator.
LoadedImageNameSize
The size of the loaded image name for the module. The size is measured in characters, including the terminator.
SymbolFileNameSize
The size of the symbol file name for the module. The size is measured in characters, including the terminator.
MappedImageNameSize
The size of the mapped image name of the module. The size is measured in characters, including the terminator.
Comments
This structure is returned by GetModuleParameters.
To locate the different names for the module, use GetModuleNameString.
For more information about modules, see Modules. For details about the different names for the module, see GetModuleNameString.
Requirements
Headers: Defined in DbgEng.h. Include DbgEng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
DEBUG_OUTCTL_XXX
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The DEBUG_OUTCTL_XXX constants are used for output control. The constants form a bit field that specifies the current policy of where to send output. The bit field is
divided into two sections.
The lower bits must be exactly one of the following values.
Value
Description
DEBUG_OUTCTL_THIS_CLIENT
Output generated by methods called by this client will be sent only to this client's output callbacks.
DEBUG_OUTCTL_ALL_CLIENTS
Output will be sent to all clients.
DEBUG_OUTCTL_ALL_OTHER_CLIENTS Output will be sent to all clients (except to the client that generated the output).
DEBUG_OUTCTL_IGNORE
Output will be discarded immediately and will not be logged or sent to callbacks.
DEBUG_OUTCTL_LOG_ONLY
Output will be logged but not sent to callbacks.
The higher bits of the bit field may contain the following values:
Value
Description
DEBUG_OUTCTL_NOT_LOGGED
Do not place output from this client in the global log file.
DEBUG_OUTCTL_OVERRIDE_MASK Send output to clients regardless of whether the client's output mask allows it or not.
To create a valid output control bit-field, take exactly one value from the first table, along with zero, one, or more values from the second table, and combine them using the
bitwise-OR operator. Alternatively, when setting the output control, the value DEBUG_OUTCTL_AMBIENT can be used to set the new output control to the same value as
the current output control.
The default value of the output control bit-field is DEBUG_OUTCTL_ALL_CLIENTS.
Requirements
Headers: Defined in DbgEng.h. Include DbgEng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
DEBUG_OUTPUT_XXX
The DEBUG_OUTPUT_XXX constants are output flags. The output flags form a bit field that indicates the type of the output that accompanies them.
The possible values include the following.
Value
Description
DEBUG_OUTPUT_NORMAL
Normal output.
DEBUG_OUTPUT_ERROR
Error output.
DEBUG_OUTPUT_WARNING
Warnings.
DEBUG_OUTPUT_VERBOSE
Additional output.
DEBUG_OUTPUT_PROMPT
Prompt output.
DEBUG_OUTPUT_PROMPT_REGISTERS Register dump before prompt.
DEBUG_OUTPUT_EXTENSION_WARNING Warnings specific to extension operation.
DEBUG_OUTPUT_DEBUGGEE
Debug output from the target (for example, OutputDebugString or DbgPrint).
DEBUG_OUTPUT_DEBUGGEE_PROMPT Debug input expected by the target (for example, DbgPrompt).
DEBUG_OUTPUT_SYMBOLS
Symbol messages (for example, !sym noisy).
Requirements
Headers: Defined in DbgEng.h. Include DbgEng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
DEBUG_PROCESS_XXX
The process options are a bit set that control how the debugger engine treats user-mode processes. Some of these process options are global; others are specific to a process.
The following flags can be present.
Bit-flag
DEBUG_PROCESS_DETACH_ON_EXIT
Description
(Windows XP and later) The debugger automatically detaches itself from the target process when the debugger exits. This is
a global setting.
DEBUG_PROCESS_ONLY_THIS_PROCESS (Windows XP and later) The debugger will not debug child processes that are created by this process.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
DEBUG_REGISTER_DESCRIPTION
The DEBUG_REGISTER_DESCRIPTION structure is returned by GetDescription to describe a processor's register.
typedef struct _DEBUG_REGISTER_DESCRIPTION
{
ULONG Type;
ULONG Flags;
ULONG SubregMaster;
ULONG SubregLength;
ULONG64 SubregMask;
ULONG SubregShift;
...
} DEBUG_REGISTER_DESCRIPTION, *PDEBUG_REGISTER_DESCRIPTION;
Members
Type
The type of value that this register holds. The possible values are the same as for the Type field in the DEBUG_VALUE structure.
Flags
A bit field of flags for the register. Currently, the only bit that can be set is DEBUG_REGISTERS_SUB_REGISTER, which indicates that this register is a subregister.
SubregMaster
The index of the register of which this register is a sub-register. This field is only used if the DEBUG_REGISTERS_SUB_REGISTER bit is set in Flags; otherwise, it is
set to zero.
SubregLength
The size, in bits, of this sub-register. This field is only used if the DEBUG_REGISTERS_SUB_REGISTER bit is set in Flags; otherwise, it is set to zero.
SubregMask
The bit mask that converts the register specified in SubregMaster into this sub-register. This field is only used if the DEBUG_REGISTERS_SUB_REGISTER bit is set
in Flags; otherwise, it is set to zero.
SubregShift
The bit shift that converts the register specified in SubregMaster into this sub-register. This field is only used if the DEBUG_REGISTERS_SUB_REGISTER bit is set
in Flags; otherwise, it is set to zero.
Comments
If this register is a subregister, the value of the full register can be turned into the value of the sub-register by first shifting SubregShift bits to the right and then combining
the result with SubregMask using the bitwise-AND operator. The size of the sub-register (SubregLength) is the number of bits set in SubregMask.
For general information about registers, see Registers.
Requirements
Headers: Defined in DbgEng.h. Include DbgEng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
DEBUG_SPECIFIC_FILTER_PARAMETERS
The DEBUG_SPECIFIC_FILTER_PARAMETERS structure contains the parameters for a specific event filter.
typedef struct _DEBUG_SPECIFIC_FILTER_PARAMETERS
{
ULONG ExecutionOption;
ULONG ContinueOption;
ULONG TextSize;
ULONG CommandSize;
ULONG ArgumentSize;
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
} DEBUG_SPECIFIC_FILTER_PARAMETERS, *PDEBUG_SPECIFIC_FILTER_PARAMETERS;
Members
ExecutionOption
The break status of the specific event filter. For possible values, see DEBUG_FILTER_XXX.
ContinueOption
The handling status of the specific event filter. For possible values, see DEBUG_FILTER_XXX.
TextSize
The size, in characters (including the terminator), of the name of the specific event filter.
CommandSize
The size, in characters, of the command (including the terminator), to execute when the event occurs.
ArgumentSize
Specifies the size, in characters, of the specific event filter argument. This size includes the NULL terminator. If the specific event filter does not take an argument,
ArgumentSize is zero.
Note If the filter does take an argument, but the argument is empty, ArgumentSize will be one, reflecting the NULL terminator.
Requirements
Headers: Defined in DbgEng.h. Include DbgEng.h.
See Also
GetSpecificFilterParameters, SetSpecificFilterParameters
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
DEBUG_STACK_FRAME
The DEBUG_STACK_FRAME structure describes a stack frame and the address of the current instruction for the stack frame.
typedef struct _DEBUG_STACK_FRAME
{
ULONG64 InstructionOffset;
ULONG64 ReturnOffset;
ULONG64 FrameOffset;
ULONG64 StackOffset;
ULONG64 FuncTableEntry;
ULONG64 Params[4];
ULONG64 Reserved[6];
BOOL Virtual;
ULONG FrameNumber;
} DEBUG_STACK_FRAME, *PDEBUG_STACK_FRAME;
Members
InstructionOffset
The location in the process's virtual address space of the related instruction for the stack frame. This is typically the return address for the next stack frame, or the current
instruction pointer if the frame is at the top of the stack.
ReturnOffset
The location in the process's virtual address space of the return address for the stack frame. This is typically the related instruction for the previous stack frame.
FrameOffset
The location in the process's virtual address space of the stack frame, if known. Some processor architectures do not have a frame or have more than one. In these cases,
the engine chooses a value most representative for the given level of the stack.
StackOffset
The location in the process's virtual address space of the processor stack.
FuncTableEntry
The location in the target's virtual address space of the function entry for this frame, if available. When set, this pointer is not guaranteed to remain valid indefinitely and
should not be held for future use. Instead, save the value of InstructionOffset and use it with IDebugSymbols3::GetFunctionEntryByOffset to retrieve function entry
information later.
Params
The values of the first four stack slots that are passed to the function, if available. If there are less than four arguments, the remaining entries are set to zero. These stack
slots are not guaranteed to contain parameter values. Some calling conventions and compiler optimizations might interfere with identification of parameter information.
For more detailed argument information and proper location handling, use IDebugSymbols::GetScopeSymbolGroup to retrieve the actual parameter symbols.
Reserved
Reserved for future use.
Virtual
The value is set to TRUE if this stack frame was generated by the debugger by unwinding. Otherwise, the value is FALSE if it was formed from a threads current
context. Typically, this is TRUE for the frame at the top of the stack, where InstructionOffset is the current instruction pointer.
FrameNumber
The index of the frame. This index counts the number of frames from the top of the call stack. The frame at the top of the stack, representing the current call, has index
zero.
Requirements
Headers: Defined in DbgEng.h. Include DbgEng.h.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
DEBUG_STATUS_XXX
The DEBUG_STATUS_XXX status codes have two purposes. They instruct the engine on how execution in the target should proceed, and they are used by the engine to
report the execution status of the target.
After an event occurs, the engine can receive several instructions that tell it how execution in the target should proceed. In this case, it acts on the instruction with the highest
precedence. Typically, the higher precedence status codes represent less execution for the target.
The values in the following table are reverse ordered by precedence; the values that appear earlier in the table have higher precedence.
Status Code
DEBUG_STATUS_NO_DEBUGGEE
DEBUG_STATUS_BREAK
When reporting
No debugging session is active.
The target is suspended.
DEBUG_STATUS_STEP_INTO
When instructing
N/A
Suspend the target.
Precedence
Highest
precedence
Note The precedence of the status codes does not follow the numeric values of the constants.
Requirements
Headers: Defined in DbgEng.h. Include DbgEng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
DEBUG_SYMBOL_XXX
The DEBUG_SYMBOL_XXX constants are used for the symbol flags bit-set. The symbol flags describe (in part) a symbol in a symbol group.
The least significant bits of the symbol flagsthe bits found in DEBUG_SYMBOL_EXPANSION_LEVEL_MASKform a number that represents the expansion depth of
the symbol within the symbol group. The depth of a child symbol is always one more than the depth of its parent symbol. For example, to find the depth of a symbol whose
flags are contained in the variable flags, use the following statement:
depth = flags & DEBUG_SYMBOL_EXPANSION_LEVEL_MASK;
The rest of the symbol flags bit-set can contain the following bit-flags.
Value
Meaning when set
DEBUG_SYMBOL_EXPANDED
The children of the symbol are part of the symbol group.
DEBUG_SYMBOL_READ_ONLY The symbol represents a read-only variable.
DEBUG_SYMBOL_IS_ARRAY
The symbol represents an array variable.
DEBUG_SYMBOL_IS_FLOAT
The symbol represents a floating-point variable.
DEBUG_SYMBOL_IS_ARGUMENT The symbol represents an argument passed to a function.
DEBUG_SYMBOL_IS_LOCAL
The symbol represents a local variable in a scope.
Requirements
Headers: Defined in DbgEng.h. Include DbgEng.h.
See Also
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
DEBUG_SYMBOL_PARAMETERS
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
DEBUG_SYMBOL_ENTRY
The DEBUG_SYMBOL_ENTRY structure describes a symbol in a symbol group.
typedef struct _DEBUG_SYMBOL_ENTRY
{
ULONG64 ModuleBase;
ULONG64 Offset;
ULONG64 Id;
ULONG64 Arg64;
ULONG Size;
ULONG Flags;
ULONG TypeId;
ULONG NameSize;
ULONG Token;
ULONG Tag;
ULONG Arg32;
ULONG Reserved;
} DEBUG_SYMBOL_ENTRY, * PDEBUG_SYMBOL_ENTRY;
Members
ModuleBase
The base address of the module in the target's virtual address space.
Offset
The location of the symbol in the target's virtual address space.
Id
The symbol ID of the symbol. If the symbol ID is not known, Id is DEBUG_INVALID_OFFSET.
Arg64
The interpretation of Arg64 depends on the type of the symbol. If the value is not known, Arg64 is zero.
Size
The size, in bytes, of the symbol's value. This might not be known or might not completely represent all of the data for a symbol. For example, a function's code might be
split among multiple regions and the size only describes one region.
Flags
Symbol entry flags. Currently, no flags are defined.
TypeId
The type ID of the symbol.
NameSize
The size, in characters, of the symbol's name. If the size is not known, NameSize is zero.
Token
The managed token of the symbol. If the token value is not known or the symbol does not have a token, Token is zero.
Tag
The symbol tag for the type of the symbol. This is a value from the SymTagEnum enumeration.
Arg32
The interpretation of Arg32 depends on the type of the symbol. Currently, the value of Arg32 is the register that holds the value or a pointer to the value of the symbol. If
the symbol is not held in a register, or the register is not known, Arg32 is zero.
Reserved
Set to zero.
Requirements
Headers: Defined in DbgEng.h. Include DbgEng.h. SymTagEnum is defined in DbgHelp.h. Include DbgHelp.h.
See Also
IdebugSymbolGroup2::GetSymbolEntryInformation, IdebugSymbols3::GetSymbolEntryInformation
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
DEBUG_SYMBOL_PARAMETERS
The DEBUG_SYMBOL_PARAMETERS structure describes a symbol in a symbol group.
typedef struct _DEBUG_SYMBOL_PARAMETERS
{
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
ULONG64 Module;
ULONG TypeId;
ULONG ParentSymbol;
ULONG SubElements;
ULONG Flags;
ULONG64 Reserved;
} DEBUG_SYMBOL_PARAMETERS, *PDEBUG_SYMBOL_PARAMETERS;
Members
Module
The location in the target's virtual address space of the base of the module to which the symbol belongs.
TypeId
The type ID of the symbol.
ParentSymbol
The index within the symbol group of the symbol's parent symbol. If the parent symbol is not known, ParentSymbol is DEBUG_ANY_ID.
SubElements
The number of children of the symbol. If this symbol has never been expanded within this symbol group, this number will be an estimate that is based on the symbol's
type.
Flags
The symbol flags. See DEBUG_SYMBOL_XXX for details.
Reserved
Set to zero.
Requirements
Headers: Defined in DbgEng.h. Include DbgEng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
DEBUG_SYMBOL_SOURCE_ENTRY
The DEBUG_SYMBOL_SOURCE_ENTRY structure describes a section of the source code and a corresponding region of the target's memory.
typedef struct _DEBUG_SYMBOL_SOURCE_ENTRY
{
ULONG64 ModuleBase;
ULONG64 Offset;
ULONG64 FileNameId;
ULONG64 EngineInternal;
ULONG Size;
ULONG Flags;
ULONG FileNameSize;
ULONG StartLine;
ULONG EndLine;
ULONG StartColumn;
ULONG EndColumn;
ULONG Reserved;
} DEBUG_SYMBOL_SOURCE_ENTRY, *PDEBUG_SYMBOL_SOURCE_ENTRY;
Members
ModuleBase
The base address, in the target's virtual address space, of the module that the source symbol came from.
Offset
The location of the memory corresponding to the source code in the target's virtual address space.
FileNameId
Identifier for the source code file name. If this information is not available, FieldNameId is set to zero.
EngineInternal
Reserved for internal debugger engine use.
Size
The size of the region of memory corresponding to the source code. If this information is not available, Size is set to one.
Flags
Set to zero.
FileNameSize
The number of characters in the source filename, including the terminator.
StartLine
The line number of the start of the region of source code in the file. The number of the first line in the file is one. If this information is not available, StartLine is set to
DEBUG_ANY_ID.
EndLine
The line number of the end of the region of source code in the file. The number of the first line in the file is one. If this information is not available, StartLine is set to
DEBUG_ANY_ID.
StartColumn
The column number of the start of the region of source code. The number of the first column is one. If this information is not available, StartLine is set to
DEBUG_ANY_ID.
EndColumn
The column number of the end of the region of source code. The number of the first column is one. If this information is not available, StartLine is set to
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
DEBUG_ANY_ID.
Reserved
Reserved for future use.
Requirements
Headers: Defined in DbgEng.h. Include DbgEng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
DEBUG_THREAD_BASIC_INFORMATION
The DEBUG_THREAD_BASIC_INFORMATION structure describes an operating system thread.
typedef struct _DEBUG_THREAD_BASIC_INFORMATION
{
ULONG Valid;
ULONG ExitStatus;
ULONG PriorityClass;
ULONG Priority;
ULONG64 CreateTime;
ULONG64 ExitTime;
ULONG64 KernelTime;
ULONG64 UserTime;
ULONG64 StartOffset;
ULONG64 Affinity;
} DEBUG_THREAD_BASIC_INFORMATION, *PDEBUG_THREAD_BASIC_INFORMATION;
Members
Valid
A bitset that specifies which other members of the structure contain valid information. A member of the structure is valid if the corresponding bit flag is set in Valid.
Flag
Members
DEBUG_TBINFO_EXIT_STATUS
ExitStatus
DEBUG_TBINFO_PRIORITY_CLASS PriorityClass
DEBUG_TBINFO_PRIORITY
Priority
DEBUG_TBINFO_TIMES
CreateTime, ExitTime, KernelTime, UserTime
DEBUG_TBINFO_START_OFFSET StartOffset
DEBUG_TBINFO_AFFINITY
Affinity
ExitStatus
The exit code of the thread. If the thread is still running, ExitStatus is set to STILL_ACTIVE.
ExitStatus is only valid if the DEBUG_TBINFO_EXIT_STATUS bit flag is set in Valid.
PriorityClass
The priority class of the thread. The priority classes are defined by the XXX_PRIORITY_CLASS constants in WinBase.h. For more information about thread priority
classes, see the Platform SDK.
PriorityClass is only valid if the DEBUG_TBINFO_PRIORITY_CLASS bit flag is set in Valid.
Priority
The priority of the thread relative to the priority class. Some thread priorities are defined by the THREAD_PRIORITY_XXX constants in WinBase.h. For more
information about thread priorities, see the Platform SDK.
Priority is only valid if the DEBUG_TBINFO_PRIORITY bit flag is set in Valid.
CreateTime
The creation time of the thread.
CreateTime is only valid if the DEBUG_TBINFO_TIMES bit flag is set in Valid.
ExitTime
The exit time of the thread.
ExitTime is only valid if the DEBUG_TBINFO_TIMES bit flag is set in Valid.
KernelTime
The amount of time the thread has executed in kernel mode.
KernelTime is only valid if the DEBUG_TBINFO_TIMES bit flag is set in Valid.
UserTime
The amount of time the thread has executed in user-mode.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
DEBUG_TYPED_DATA
The DEBUG_TYPED_DATA structure describes typed data in the memory of the target.
typedef struct _DEBUG_TYPED_DATA
{
ULONG64 ModBase;
ULONG64 Offset;
ULONG64 EngineHandle;
ULONG64 Data;
ULONG Size;
ULONG Flags;
ULONG TypeId;
ULONG BaseTypeId;
ULONG Tag;
ULONG Register;
ULONG64 Internal[9];
} DEBUG_TYPED_DATA, *PDEBUG_TYPED_DATA;
Members
ModBase
The base address of the module, in the target's virtual address space, that contains the typed data.
Offset
The location of the typed data in the target's memory. Offset is a virtual memory address unless there are flags present in Flags that specify that Offset is a physical
memory address.
EngineHandle
Set to zero.
Data
The data cast to a ULONG64. If Flags does not contain the DEBUG_TYPED_DATA_IS_IN_MEMORY flag, the data is not available and Data is set to zero.
Size
The size, in bytes, of the data.
Flags
The flags describing the target's memory in which the data resides. The following bit flags can be set.
Flag
Description
DEBUG_TYPED_DATA_IS_IN_MEMORY
The data is in the target's memory and is available.
DEBUG_TYPED_DATA_PHYSICAL_DEFAULT
Offset is a physical memory address, and the physical memory at Offset uses the default memory
caching.
DEBUG_TYPED_DATA_PHYSICAL_CACHED
Offset is a physical memory address, and the physical memory at Offset is cached.
DEBUG_TYPED_DATA_PHYSICAL_UNCACHED
Offset is a physical memory address, and the physical memory at Offset is uncached.
DEBUG_TYPED_DATA_PHYSICAL_WRITE_COMBINED Offset is a physical memory address, and the physical memory at Offset is write-combined.
TypeId
The type ID for the data's type.
BaseTypeId
For generated types, the type ID of the type on which the data's type is based. For example, if the typed data represents a pointer (or an array), BaseTypeId is the type of
the object pointed to (or held in the array).
For other types, BaseTypeId is the same as TypeId.
Tag
The symbol tag of the typed data. This is a value from the SymTagEnum enumeration. For descriptions of the values, see the DbgHelp API documentation.
Register
The index of the processor's register containing the data, or zero if the data is not contained in a register. (Note that the zero value can represent either that the data is not
in a register or that it is in the register whose index is zero.)
Internal
Internal debugger engine data.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Comments
Instances of this structure should be manipulated using the DEBUG_REQUEST_EXT_TYPED_DATA_ANSI Request operation. In particular, instances should be created
and released using this method, and members of this structure should not be changed directly.
There is one exception to the preceding rule: the EXT_TDOP_SET_FROM_TYPE_ID_AND_U64 and EXT_TDOP_SET_PTR_FROM_TYPE_ID_AND_U64
suboperations take a DEBUG_TYPED_DATA instance that is not manipulated using the Request method. These suboperations take a manually created instance with some
members manually filled in.
Requirements
Headers: Defined in WbgExts.h. Include WdbgExts.h before including DbgEng.h. SymTagEnum is defined in DbgHelp.h. Include DbgHelp.h.
See Also
DEBUG_REQUEST_EXT_TYPED_DATA_ANSI, Request
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
DEBUG_TYPEOPTS_XXX
The type options affect how the engine formats numbers and strings for output.
The options are represented by a bit-set with the following bit flags.
Value
DEBUG_TYPEOPTS_UNICODE_DISPLAY
Description
When this bit is set, USHORT pointers and arrays are output as Unicode characters.
This is equivalent to the debugger command .enable_unicode 1.
DEBUG_TYPEOPTS_LONGSTATUS_DISPLAY When this bit is set, LONG integers are output in the default base instead of decimal.
This is equivalent to the debugger command .enable_long_status 1.
DEBUG_TYPEOPTS_FORCERADIX_OUTPUT When this bit is set, integers (except for LONG integers) are output in the default base instead of decimal.
This is equivalent to the debugger command .force_radix_output 1.
Comments
By default, all of the type formatting options are turned off.
For more information about types, see Types.
Requirements
Headers: Defined in DbgEng.h. Include DbgEng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
DEBUG_VALUE
The DEBUG_VALUE structure holds register and expression values.
typedef struct _DEBUG_VALUE {
union {
UCHAR I8;
USHORT I16;
ULONG I32;
struct {
ULONG64 I64;
BOOL Nat;
};
float F32;
double F64;
UCHAR F80Bytes[10];
UCHAR F82Bytes[11];
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
UCHAR F128Bytes[16];
UCHAR VI8[16];
USHORT VI16[8];
ULONG VI32[4];
ULONG64 VI64[2];
float VF32[4];
double VF64[2];
struct {
ULONG LowPart;
ULONG HighPart;
} I64Parts32;
struct {
ULONG64 LowPart;
LONG64 HighPart;
} F128Parts64;
UCHAR RawBytes[24];
};
...
ULONG Type;
} DEBUG_VALUE, *PDEBUG_VALUE;
The Type field specifies the value type that is being held by the structure. This also specifies which field in the structure is valid. The possible values of the Type field, and
the corresponding field specified as valid in the structure, include the following.
Type Name
Type
Valid DEBUG_VALUE Field
DEBUG_VALUE_INT8
8-bit signed integer
I8
DEBUG_VALUE_INT16
16-bit signed integer
I16
DEBUG_VALUE_INT32
32-bit signed integer
I32
DEBUG_VALUE_INT64
64-bit signed integer
I64
DEBUG_VALUE_FLOAT32
32-bit floating point number F32
DEBUG_VALUE_FLOAT64
64-bit floating point number F64
DEBUG_VALUE_FLOAT80
80-bit floating point number F80Bytes
DEBUG_VALUE_FLOAT128 128-bit floating point number F128Bytes
DEBUG_VALUE_VECTOR64 64-bit vector
VI8[8], VI16[4], VI32[2], VI64[1], VF32[2], VF64[1]
DEBUG_VALUE_VECTOR128 128-bit vector
VI8[16], VI16[8], VI32[4], VI64[2], VF32[4], VF64[2]
Requirements
Headers: Defined in DbgEng.h. Include DbgEng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
EXT_TDOP
The EXT_TDOP enumeration is used in the Operation member of the EXT_TYPED_DATA structure to specify which suboperation the
DEBUG_REQUEST_EXT_TYPED_DATA_ANSI Request operation will perform.
typedef enum _EXT_TDOP {
EXT_TDOP_COPY,
EXT_TDOP_RELEASE,
EXT_TDOP_SET_FROM_EXPR,
EXT_TDOP_SET_FROM_U64_EXPR,
EXT_TDOP_GET_FIELD,
EXT_TDOP_EVALUATE,
EXT_TDOP_GET_TYPE_NAME,
EXT_TDOP_OUTPUT_TYPE_NAME,
EXT_TDOP_OUTPUT_SIMPLE_VALUE,
EXT_TDOP_OUTPUT_FULL_VALUE,
EXT_TDOP_HAS_FIELD,
EXT_TDOP_GET_FIELD_OFFSET,
EXT_TDOP_GET_ARRAY_ELEMENT,
EXT_TDOP_GET_DEREFERENCE,
EXT_TDOP_GET_TYPE_SIZE,
EXT_TDOP_OUTPUT_TYPE_DEFINITION,
EXT_TDOP_GET_POINTER_TO,
EXT_TDOP_SET_FROM_TYPE_ID_AND_U64,
EXT_TDOP_SET_PTR_FROM_TYPE_ID_AND_U64,
EXT_TDOP_COUNT
} EXT_TDOP;
Values
Value
Operation
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
EXT_TDOP_COPY
Makes a copy of a typed data description.
EXT_TDOP_RELEASE
Releases a typed data description.
EXT_TDOP_SET_FROM_EXPR
Returns the value of an expression.
EXT_TDOP_SET_FROM_U64_EXPR
Returns the value of an expression. An optional address can be provided as a parameter to the expression.
EXT_TDOP_GET_FIELD
Returns a member of a structure.
EXT_TDOP_EVALUATE
Returns the value of an expression. An optional value can be provided as a parameter to the expression.
EXT_TDOP_GET_TYPE_NAME
Returns the type name for typed data.
EXT_TDOP_OUTPUT_TYPE_NAME
Prints the type name for typed data.
EXT_TDOP_OUTPUT_SIMPLE_VALUE
Prints the value of typed data.
EXT_TDOP_OUTPUT_FULL_VALUE
Prints the type and value for typed data.
EXT_TDOP_HAS_FIELD
Determines whether a structure contains a specified member.
EXT_TDOP_GET_FIELD_OFFSET
Returns the offset of a member within a structure.
EXT_TDOP_GET_ARRAY_ELEMENT
Returns an element from an array.
EXT_TDOP_GET_DEREFERENCE
Dereferences a pointer, returning the value it points to.
EXT_TDOP_GET_TYPE_SIZE
Returns the size of the specified typed data.
EXT_TDOP_OUTPUT_TYPE_DEFINITION
Prints the definition of the type for the specified typed data.
EXT_TDOP_GET_POINTER_TO
Returns a new typed data description that represents a pointer to specified typed data.
EXT_TDOP_SET_FROM_TYPE_ID_AND_U64
Creates a typed data description from a type and memory location.
EXT_TDOP_SET_PTR_FROM_TYPE_ID_AND_U64 Creates a typed data description representing a pointer to a specified memory location with specified type.
The remaining value, EXT_TDOP_COUNT, does not specify an operation. Instead, it represents the number of suboperations defined in the EXT_TDOP enumeration.
Requirements
Headers: Defined in WbgExts.h. Include WdbgExts.h before including DbgEng.h.
See Also
EXT_TYPED_DATA, DEBUG_REQUEST_EXT_TYPED_DATA_ANSI, Request
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
EXT_TYPED_DATA
The EXT_TYPED_DATA structure is passed to and returned from the DEBUG_REQUEST_EXT_TYPED_DATA_ANSI Request operation. It contains the input and output
parameters for the operation as well as specifying which particular suboperation to perform.
typedef struct _EXT_TYPED_DATA {
IN EXT_TDOP Operation;
IN ULONG Flags;
IN DEBUG_TYPED_DATA InData;
OUT DEBUG_TYPED_DATA OutData;
IN ULONG InStrIndex;
IN ULONG In32;
OUT ULONG Out32;
IN ULONG64 In64;
OUT ULONG64 Out64;
OUT ULONG StrBufferIndex;
IN ULONG StrBufferChars;
OUT ULONG StrCharsNeeded;
IN OUT ULONG DataBufferIndex;
IN ULONG DataBufferBytes;
OUT ULONG DataBytesNeeded;
OUT HRESULT Status;
ULONG64 Reserved[8];
} EXT_TYPED_DATA, *PEXT_TYPED_DATA;
Members
Operation
Specifies which suboperation the DEBUG_REQUEST_EXT_TYPED_DATA_ANSI Request operation should perform. The interpretation of some of the other
members depends on Operation. For a list of possible suboperations, see EXT_TDOP.
Flags
Specifies the bit flags describing the target's memory in which the data resides. If no flags are present, the data is considered to be in virtual memory. One of the
following flags may be present:
Flag
Description
EXT_TDF_PHYSICAL_DEFAULT
The typed data is in physical memory, and this physical memory uses the default memory caching.
EXT_TDF_PHYSICAL_CACHED
The typed data is in physical memory, and this physical memory is cached.
EXT_TDF_PHYSICAL_UNCACHED
The typed data is in physical memory, and this physical memory is uncached.
EXT_TDF_PHYSICAL_WRITE_COMBINED The typed data is in physical memory, and this physical memory is write-combined.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
InData
Specifies typed data to be used as input to the operation. For details about this structure, see DEBUG_TYPED_DATA.
The interpretation of InData depends on the value of Operation.
OutData
Receives typed data as output from the operation. Any suboperation that returns typed data to OutData initially copies the contents of InData to OutData, then modifies
OutData in place, so that the input parameters in InData are also present in OutData. For details about this structure, see DEBUG_TYPED_DATA.
The interpretation of OutData depends on the value of Operation.
InStrIndex
Specifies the position of an ANSI string to be used as input to the operation. InStrIndex can be zero to indicate that the input parameters do not include an ANSI string.
The position of the string is relative to the base address of this EXT_TYPED_DATA structure. The string must follow this structure, so InStrIndex must be greater than
the size of this structure. The string is part of the input to the operation and InStrIndex must be smaller than InBufferSize, the size of the input buffer passed to Request.
The interpretation of the string depends on the value of Operation.
In32
Specifies a 32-bit parameter to be used as input to the operation.
The interpretation of In32 depends on the value of Operation.
Out32
Receives a 32-bit value as output from the operation.
The interpretation of Out32 depends on the value of Operation.
In64
Specifies a 64-bit parameter to be used as input to the operation.
The interpretation of In64 depends on the value of Operation.
Out64
Receives a 64-bit value as output from the operation.
The interpretation of Out64 depends on the value of Operation.
StrBufferIndex
Specifies the position to return an ANSI string as output from the operation. StrBufferIndex can be zero if no ANSI string is to be received from the operation.
The position of the string is relative to the base address of the returned EXT_TYPED_DATA structure. The string must follow the structure, so StrBufferIndex must be
greater than the size of this structure. The string is part of the output from the suboperation, and StrBufferIndex plus StrBufferChars must be smaller than
OutBufferSize, the size of the output buffer passed to Request.
The interpretation of the string depends on the value of Operation.
StrBufferChars
Specifies the size in characters of the ANSI string buffer specified by StrBufferIndex.
StrCharsNeeded
Receives the number of characters needed by the string buffer specified by StrBufferIndex.
DataBufferIndex
Set to zero.
DataBufferBytes
Set to zero.
DataBytesNeeded
Set to zero,
Status
Receives the status code returned by the operation. This is the same value returned by Request.
Reserved
Set to zero.
Comments
The members of this structure are used as the input and output parameters to the DEBUG_REQUEST_EXT_TYPED_DATA_ANSI Request operation. The interpretation of
most of the parameters depends on the particular suboperation being performed, as specified by the Operation member.
This structure can optionally specify additional datausing the members InStrIndex and StrBufferIndexthat is included with the structure. This additional data is
specified relative to the address of the instance of this structure. When used with the DEBUG_REQUEST_EXT_TYPED_DATA_ANSI Request operation, the additional
data is included in the InBuffer and OutBuffer (as appropriate) and should be included in the size of these two buffers.
Requirements
Headers: Defined in WbgExts.h. Include WdbgExts.h before including DbgEng.h.
See Also
DEBUG_REQUEST_EXT_TYPED_DATA_ANSI, Request, DEBUG_TYPED_DATA, EXT_TDOP
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
HRESULT Values
The following is a list of common return values for functions and methods, and their usual meanings.
Successful results. These values are defined in WinError.h.
S_OK
Successful completion.
S_FALSE
Completed without error, but only partial results were obtained.
If a buffer is not large enough to hold the information that is returned to it, the returned information is often truncated to fit into the buffer and S_FALSE is returned from
the method.
Error results. These values are defined in WinError.h.
E_FAIL
The operation could not be performed.
E_INVALIDARG
One of the arguments passed in was invalid.
E_NOINTERFACE
The object searched for was not found.
E_OUTOFMEMORY
A memory allocation attempt failed.
E_UNEXPECTED
The target was not accessible, or the engine was not in a state where the function or method could be processed.
E_NOTIMPL
Not implemented.
HRESULT_FROM_WIN32(ERROR_ACCESS_DENIED)
The operation was denied because the debugger is in Secure Mode.
NT error results. Other error codes, such as STATUS_CONTROL_C_EXIT and STATUS_NO_MORE_ENTRIES, can sometimes occur. These results are passed to the
HRESULT_FROM_NT macro that is defined in WinError.h before being returned.
Win32 error results. Other error codes, such as ERROR_READ_FAULT and ERROR_WRITE_FAULT, can sometimes occur. These results are passed to the
HRESULT_FROM_WIN32 macro that is defined in WinError.h before being returned.
Requirements
Headers: Defined in DbgEng.h. Include DbgEng.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Specific Exceptions
The following table lists the exception codes for the specific exception filters.
Exception Code
Exception
Header file or value
STATUS_ACCESS_VIOLATION
Access violation
NtStatus.h
STATUS_ASSERTION_FAILURE
Assertion failure
NtStatus.h
STATUS_APPLICATION_HANG
Application hang
0xCFFFFFFF
STATUS_BREAKPOINT
Break instruction exception
NtStatus.h
STATUS_CPP_EH_EXCEPTION
C++ exception handling exception
0xE06D7363
STATUS_CLR_EXCEPTION
Common language runtime (CLR) exception 0xE0434f4D
DBG_CONTROL_BREAK
CTRL+Break exception
NtStatus.h
DBG_CONTROL_C
CTRL+C exception
NtStatus.h
STATUS_DATATYPE_MISALIGNMENT Data misaligned
NtStatus.h
DBG_COMMAND_EXCEPTION
Debugger command exception
NtStatus.h
STATUS_GUARD_PAGE_VIOLATION Guard page violation
NtStatus.h
STATUS_ILLEGAL_INSTRUCTION
Illegal instruction
NtStatus.h
STATUS_IN_PAGE_ERROR
In-page I/O error
NtStatus.h
STATUS_INTEGER_DIVIDE_BY_ZERO Integer divide-by-zero
NtStatus.h
STATUS_INTEGER_OVERFLOW
Integer overflow
NtStatus.h
STATUS_INVALID_HANDLE
Invalid handle
NtStatus.h
STATUS_INVALID_LOCK_SEQUENCE Invalid lock sequence
NtStatus.h
STATUS_INVALID_SYSTEM_SERVICE Invalid system call
NtStatus.h
STATUS_PORT_DISCONNECTED
Port disconnected
NtStatus.h
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
STATUS_SINGLE_STEP
STATUS_STACK_BUFFER_OVERRUN
STATUS_STACK_OVERFLOW
STATUS_VERIFIER_STOP
STATUS_WAKE_SYSTEM_DEBUGGER
Single-step exception
Stack buffer overflow
Stack overflow
Application Verifier stop
Wake debugger
NtStatus.h
NtStatus.h
NtStatus.h
NtStatus.h
NtStatus.h
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
An extension DLL may export DebugExtensionUninitialize. If this is exported, it will be called before the extension DLL is unloaded. It may be used by the DLL to clean up
before it is unloaded.
An extension DLL may export DebugExtensionNotify. If this is exported, it will be called when a session begins or ends, and when a target starts or stops executing. These
notifications are also provided to IDebugEventCallbacks objects registered with a client.
An extension DLL may export KnownStructOutput. If this is exported, it will be called when the DLL is loaded. This function returns a list of structures that the DLL
knows how to print on a single line. It may be called later to format instances of these structures for printing.
Engine Procedure for Loading a DbgEng Extension DLL
When an extension DLL is loaded, the callback functions are called by the engine in the following order:
1. DebugExtensionInitialize is called so the extension DLL can initialize.
2. If exported, DebugExtensionNotify is called if the engine has an active session, and called again if the session is suspended and accessible.
3. If exported, KnownStructOutput is called to request a list of structures the DLL knows how to print on a single line.
See Loading Debugger Extension DLLs for information about how to use the debugger to load and unload an extension DLL, and see Using Debugger Extension Commands
for information about executing an extension command.
The debugger engine will place a try / except block around a call to an extension DLL. This protects the engine from some types of bugs in the extension code; but, since the
extension calls are executed in the same thread as the engine, they can still cause it to crash.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The WDK has several different build environment windows. Each of these has a corresponding shortcut placed in the Start menu when the WDK is installed. To build
a debugger extension, you must use the Windows Server 2003 build environment regardless of what platform you will be running the extension on.
The Build utility is usually not able to compile code that is located in a directory path containing spaces. Your extension code should be located in a directory whose
full path contains no spaces. (In particular, this means that if you install Debugging Tools for Windows to the default location Program Files\Debugging Tools for
Windows you will not be able to build the sample extensions.)
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
DebugExtensionInitialize
The DebugExtensionInitialize callback function is called by the engine after loading a DbgEng extension DLL.
HRESULT
CALLBACK
DebugExtensionInitialize(
OUT PULONG Version,
OUT PULONG Flags
);
Parameters
Version
Receives the version of the extension. The high 16 bits contain the major version number, and the low 16 bits contain the minor version number.
Flags
Set this to zero. (Reserved for future use.)
Return Value
S_OK
The extension was successfully initialized.
Any other value indicates that the extension DLL was unable to initialize and the engine will unload it.
Comments
The engine looks for this function by name in each extension DLL. This function must be exported by a DbgEng extension DLL.
The version number can be set by using the macro DEBUG_EXTENSION_VERSION found in dbgeng.h, for example:
*Version = DEBUG_EXTENSION_VERSION(Major, Minor)
Implementations of this function should initialize any global variables required by the extension DLL.
There may or may not be a session active when this function is called, so the extension should not assume that it is able to query session information.
Requirements
Headers: The function type is defined as PDEBUG_EXTENSION_INITIALIZE in dbgeng.h.
See Also
DebugExtensionUninitialize, DebugExtensionNotify, KnownStructOutput
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
DebugExtensionNotify
The engine calls the DebugExtensionNotify callback function to inform the extension DLL when a session changes its active or accessible status.
void
CALLBACK
DebugExtensionNotify(
IN ULONG Notify,
IN ULONG64 Argument
);
Parameters
Notify
Can be any of the following values:
Value
Description
DEBUG_NOTIFY_SESSION_ACTIVE
A debugging session is active. The session may not necessarily be suspended.
DEBUG_NOTIFY_SESSION_INACTIVE
No debugging session is active.
DEBUG_NOTIFY_SESSION_ACCESSIBLE The debugging session has suspended and is now accessible.
DEBUG_NOTIFY_SESSION_INACCESSIBLE The debugging session has started running and is now inaccessible.
Argument
Set to zero. (Reserved for future use.)
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Return Value
None
Comments
This function is optional. A DbgEng extension DLL only needs to export DebugExtensionNotify if it wants to be notified when the session state changes. The engine looks
for this function by name in the extension DLL.
This function allows the extension DLL to cache information about the session without needing to register explicit callbacks. It is called at the beginning and end of a session,
and each time a target starts or stops executing.
After the extension DLL is initialized, the engine will use this function to notify the DLL if it has started a session. If the current session is suspended, the engine will call this
function a second time to notify the DLL that the session is accessible.
Requirements
Headers: The function type is defined as PDEBUG_EXTENSION_NOTIFY in dbgeng.h.
See Also
DebugExtensionInitialize
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
DebugExtensionProvideValue
The DebugExtensionProvideValue function sets pseudo-register values.
HRESULT CALLBACK
DebugExtensionProvideValue (
__in PDEBUG_CLIENT Client,
__in ULONG Flags,
__in PCWSTR Name,
__out PULONG64 Value,
__out PULONG64 TypeModBase,
__out PULONG TypeId,
__out PULONG TypeFlags
);
Parameters
Client
A client to use if the extension needs DbgEng functions.
Flags
Provides behavioral flags. This parameter is currently reserved.
Name
The name of the value to return. This name might be one of the names that the DebugExtensionQueryValueNames function returned or a name that the caller might
already be aware of.
Value
A pointer to the value to be set.
TypeModBase
The base starting address for Client.
TypeId
A pointer to the ID for the type of Value.
TypeFlags
A parameter that you can use to return one of the following flags:
DEBUG_EXT_PVTYPE_IS_VALUE
The value that is pointed to by Value is not a pointer.
DEBUG_EXT_PVTYPE_IS_POINTER
The value that is pointed to by Value is an address for a pointer to data of the type that TypeModBase and TypeId specify.
Return Value
DebugExtensionProvideValue might return one of the following values:
S_OK
The function was successfully completed.
This function might also return error values. For more information about possible return values, see Return Values.
Comments
The name that the Name parameter specifies must start with $$ and have a terminating NULL character.
Requirements
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Headers: The Dbgeng.h header file has the definitions of the callback prototypes.
See Also
DebugExtensionInitialize, DebugExtensionNotify, DebugExtensionQueryValueNames, DebugExtensionUninitialize, KnownStructOutput
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
DebugExtensionQueryValueNames
The DebugExtensionQueryValueNames callback function recovers pseudo-register values.
HRESULT CALLBACK
DebugExtensionQueryValueNames (
__in PDEBUG_CLIENT Client,
__in ULONG Flags,
__out_ecount(BufferChars) PWSTR
__in ULONG BufferChars,
__out PULONG BufferNeeded
);
Buffer,
Parameters
Client
A client to use if the extension needs DbgEng functions.
Flags
Provides behavioral flags. This parameter is currently reserved.
Buffer
A string buffer that the caller provides, to be filled with the set of value names that the client wants to expose.
BufferChars
The count of wide characters in Buffer.
BufferNeeded
The number of wide characters that this function needs to complete successfully.
Return Value
DebugExtensionQueryValueNames might return one of the following values:
S_OK
The function was successfully completed.
S_FALSE
The function completed without error, but it obtained only partial results.
This function might also return error values. For more information about possible return values, see Return Values.
Comments
Value names must start with $$ and have a terminating NULL character. The Buffer string must also be NULL-terminated. For example, Buffer could be $$myval1\0
$$myval2\0\0.
Requirements
Headers: The Dbgeng.h header file has the definitions of the callback prototypes.
See Also
DebugExtensionInitialize, DebugExtensionNotify, DebugExtensionProvideValue, DebugExtensionUninitialize, KnownStructOutput
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
DebugExtensionUninitialize
The DebugExtensionUninitialize callback function is called by the engine to uninitialize the DbgEng extension DLL before it is unloaded.
void
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
CALLBACK
DebugExtensionUninitialize(
void
);
Parameters
None
Return Value
None
Comments
This function is optional. A DbgEng extension DLL only needs to export DebugExtensionUninitialize if it needs to be notified before it is unloaded. The engine looks for
this function by name in the extension DLL.
This function can be used by the extension DLL to clean up before it is unloaded.
There may or may not be a session active when this function is called, so the extension should not assume that it is able to query session information.
Requirements
Headers: The function type is defined as PDEBUG_EXTENSION_UNINITIALIZE in dbgeng.h.
See Also
DebugExtensionInitialize
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
KnownStructOutput
The engine calls the KnownStructOutput callback function once after the DLL is initialized to obtain a list of structures the DLL can print, and again each time the engine
wants to print a summary of one of these structures.
HRESULT
CALLBACK
KnownStructOutput (
IN ULONG Flag,
IN ULONG64 Address,
IN PSTR StructName,
OUT PSTR Buffer,
IN OUT PULONG BufferSize
);
Parameters
Flag
Can be either of the following values, depending on which action the engine wants the function to perform.
Value
Description
DEBUG_KNOWN_STRUCT_GET_NAMES
Get a list of names of known structures.
DEBUG_KNOWN_STRUCT_GET_SINGLE_LINE_OUTPUT Format a structure for printing on a single line.
Address
When getting names: Unused.
When printing a structure: Specifies the location in the target's memory address space of the structure to be printed.
StructName
When getting names: Unused.
When printing a structure: Specifies the name of the structure to be printed. This is one of the names returned from the DEBUG_KNOWN_STRUCT_GET_NAMES
query.
Buffer
When getting names: Receives a list of the names of each structure that the extension knows how to print. One null character must appear between each pair of names.
The list must be terminated with two null characters.
When printing a structure: Receives a representation of the structure, identified by StructName and Address, as a string.
In each case, the number of characters written to this buffer must not exceed the value of BufferSize.
BufferSize
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
PDEBUG_EXTENSION_CALL
Callback functions of the type PDEBUG_EXTENSION_CALL are called by the engine to execute extension commands. You can give these functions any name you want, as
long as it contains no uppercase letters.
HRESULT
CALLBACK
(* PDEBUG_EXTENSION_CALL)(
IN IDebugClient * Client
IN OPTIONAL PCSTR Args
);
Parameters
Client
Specifies an interface pointer to the client. This can be used to interact with the engine. Typically, this is the client through which the extension command was issued.
Args
Specifies the arguments passed to the extension command. In particular, if the extension command was called from a command line, Args contains the rest of the
command line. It can be NULL or empty.
Return Value
S_OK
The function was successful.
DEBUG_EXTENSION_CONTINUE_SEARCH
Indicates that the function cannot handle the command, or that other implementations of the same command in other extension DLLs should also run. The engine should
continue searching other extension DLLs for another function to handle the command. For example, this can be used to have all help functions run if each one returns
CONTINUE_SEARCH.
All other return values are ignored by the engine.
Comments
The name of the function becomes the name of the extension command. When executing an extension command, the engine searches through each of the loaded extension
DLLs in turn, looking for an exported function that has the same name as the command. For example, when executing the command !stack, the engine will look for an
exported function named stack in each loaded extension DLL. For information about the order in which extension DLLs are searched, see Using Debugger Extension
Commands.
The extension function should use the client that was passed to it in Client for all interaction with the engine, unless it has a specific reason to use another client. The
extension function should not maintain the pointer to the client object after it has finished.
Requirements
Headers: The function type is defined in dbgeng.h.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
See Also
IDebugClient
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
EngExtCpp Extensions
[This is preliminary documentation and subject to change.]
This section includes:
EngExtCpp Extension Design Guide
EngExtCpp Extension Reference
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
using the EXT_COMMAND_METHOD macro. The implementation of a command is defined by using the EXT_COMMAND macro.
Known Structures
The EXT_CLASS class can contain a number of methods that use the ExtKnownStructMethod prototype. The methods can be used by the engine to format instances of
certain structure types for output.
Provided Values
The EXT_CLASS class can contain a number of methods that use the ExtProvideValueMethod prototype. The methods can be used by the engine to evaluate some pseudoregisters provided by the extension.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
For a full list of interfaces in dbgeng.h that can be used in an extension command, see Debugger Engine Reference.
For a full list of functions in wdbgexts.h that can be used in an extension command, see WdbgExts Functions. A number of these functions appear in 32-bit versions and 64-bit
versions. Typically, the 64-bit versions end in "64" and the 32-bit versions have no numerical ending for example, ReadIoSpace64 and ReadIoSpace. When calling a
wdbgexts.h function from a DbgEng extension, you should always use the function name ending in "64". This is because the debugger engine always uses 64-bit pointers
internally, regardless of the target platform. When including wdbgexts.h, engextcpp.h selects the 64-bit version of the API. The ExtensionApis global variable used by the
WDbgExts API is automatically initialized on entry to a EngExtCpp method and cleared on exit.
When an EngExtCpp extension is used with remote DbgEng interfaces, the WDbgExts interfaces will not be available and the ExtensionApis structure can be zeroed. If an
EngExtCpp extension is expected to function in such an environment, it should avoid using the WDbgExts API.
Note You must not attempt to call any DbgHelp or ImageHlp routines from any debugger extension. Calling these routines is not supported and may cause a variety of
problems.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
DebugExtensionInitialize so that the Initialize method can be called to initialize the library.
DebugExtensionUnitialize so that the Uninitialize method can be called to uninitialize the library.
KnownStructOutputEx so that the engine can call the ExtKnownStructMethod methods to format known structures for output.
DebugExtensionNotify so that the engine can call the OnSessionActive, OnSessionInactive, OnSessionAccessible, and OnSessionInaccessible methods to notify
the extension library of changes to the debugging session's state.
help so that the EngExtCpp extension framework can automatically provide a !help extension.
These functions can be exported even if the functionality they provide is not needed. Moreover, if they are not exported, the functionality they provide will be lost.
DebugExtensionInitialize must be exported in order for the debugger engine to recognize the DLL as a valid DbgEng extension DLL.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Directives specify how the arguments are parsed. They are enclosed by double braces ('{{' and '}}'). Each directive can optionally appear zero or one times in the string
that describes the arguments.
The following directives are available:
custom
Turns off the parsing done by the extension framework and lets the extension perform its own parsing.
l:str
Overrides the default long description of the command-line arguments. The extension framework will use str for the full description of all the arguments.
opt:str
Overrides the default prefix characters for named commands. The default value is "/-", allowing '/' or '-' to be used as the prefix that identifies named arguments.
s:str
Overrides the default short description of the command-line arguments. The extension framework will use str for the short description of all the arguments.
Here are some examples of directives. The following string is used by an extension command that parses its own arguments. It also provides short and long descriptions for
use with the automatic !help extension command:
{{custom}}{{s:<arg1> <arg2>}}{{l:arg1 - Argument 1\narg2 - Argument 2}}
The following string changes the argument option prefix characters to '/' or '-'. With this directive, the arguments will be specified using '+arg' and ':arg' instead of '/arg'
and '-arg':
{{opt:+:}}
Arguments
Arguments can be of two types: named and unnamed. Unnamed arguments are read positionally. Both types of argument also have a display name, used by the help
command.
Argument descriptions are enclosed by single braces ('{' and '}').
Each argument description has the following syntax:
{[optname];[type[,flags]];[argname];[argdesc]}
where:
optname
The name of the argument. This is the name used in commands and in methods that fetch arguments by name. This name is optional. If it is present, the argument
becomes a "named argument"; it can appear anywhere on the command-line and is referenced by name. If it is not present, the argument becomes an "unnamed
argument"; its position on the command-line is important and it is referenced by its position relative to the other unnamed arguments.
type
The type of the argument. This affects how the argument is parsed and how it is retrieved. The type parameter can have one of the following values:
b
Boolean type. The argument is either present or not present. Named Boolean arguments can be retrieved using HasArg.
e[d][s][bits]
Expression type. The argument has a numeric value. Named expression arguments can be retrieved using GetArgU64 and unnamed expression arguments can be
retrieved using GetUnnamedArgU64.
d
The expression is limited to the next space character in the argument string. If this is not present, the expression evaluator will consume characters from the
command line until it determines that it reached the end of the expression.
s
The value of the expression is signed. Otherwise, the value of the expression is unsigned.
bits
The number of bits in the value of the argument. The maximum value for bits is 64.
s
String type. The string is limited to the next space character. Named string arguments can be retrieved using GetArgStr and unnamed string arguments can be
retrieved using GetUnnamedArgStr.
x
String type. The argument is the rest of the command line. The argument is retrieved using GetArgStr or GetUnnamedArgStr, as with the s string type.
flags
The argument flags. These determine how the argument will be treated by the parser. The flags parameter can have one of the following values:
d=expr
The default value of the argument. If the argument is not present on the command line, then the argument is set to expr. The default value is a string that is parsed
according to the type of the argument.
ds
The default value will not be displayed in the argument description provided by the help.
o
The argument is optional. This is the default for named arguments.
r
The argument is required. This is the default for unnamed arguments.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
argname
The display name of the argument. This is the name used by the automatic !help extension command and by the automatic /? or -? command-line arguments. Used when
printing a summary of the command-line options.
argdesc
A description of the argument. This is the description printed by the automatic !help extension and by the automatic "/?" or "-?" command-line arguments.
Here are some examples of argument descriptions. The following expression defines a command which takes a single optional expression argument. The argument must fit in
32bits. If the argument isn't present on the command line, the default value of 0x100 will be used.
{;e32,o,d=0x100;flags;Flags to control command}
The following expression defines a command with an optional Boolean "/v" argument and a required unnamed string argument.
{v;b;;Verbose mode}{;s;name;Name of object}
The following expression defines a command that has an optional named expression argument /oname expr and an optional named string argument /eol str. If /eol
is present, its value will be set to the remainder of the command line and no further arguments will be parsed.
{oname;e;expr;Address of object}{eol;x;str;Commands to use}
Command Line
The following is a list of some ways that arguments are parsed on the command line:
The values of named expression and string arguments follow the name on the command line. For example, /name expr or /name str.
For named Boolean arguments, the value is true if the name appears on the command line; false otherwise.
Multiple single-character-named Boolean options can be grouped together on the command line. For example, "/a /b /c" can be written using the shorthand
notation "/abc" (unless there is already an argument named "abc").
If the command line contains the named argument "?" for example, "/?" and "-?" the argument parsing ends, and the help text for the extension is displayed.
Parsing Internals
Several methods are used by the argument parser to set arguments.
The method SetUnnamedArg will change the value of an unnamed argument. And, for convenience, the methods SetUnnamedArgStr and SetUnnamedArgU64 will set
unnamed string and expression arguments respectively.
Similar methods exist for named arguments. SetArg is used to change the value of any named argument and SetArgStr and SetArgU64 are used for named string and
expression arguments respectively.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Typed Data
The EngExtCpp extension framework provides a few classes to help manipulate the target's memory. The ExtRemoteData class describes a small piece of the target's
memory. If the type of this memory is known, it is referred to as typed data and is described by ExtRemoteTyped objects.
Windows lists can be iterated over by using ExtRemoteList and, if the type of the objects in the list is known, ExtRemoteTypedList.
Note Like the client objects in ExtExtension, instances of these classes are only valid while the extension library is used to execute an extension command or format a
structure for output. In particular, they should not be cached. For more information about when client objects are valid, see Client Objects and the Engine, .
Remote Data
Remote data should be handled using the class ExtRemoteData. This class is a wrapper around a small section of a target's memory. ExtRemoteData automatically retrieves
the memory and wraps other common requests with throwing methods.
Remote Typed Data
If the type of the remote data is known, it should be handled using the ExtRemoteTyped class. This class is an enhanced remote data object that understands data typed with
type information from symbols. It is initialized to a particular object by symbol or cast, after which it can be used like an object of the given type.
Remote Lists
To handle remote lists, use the ExtRemoteList class. This class can be used for either a singly linked or doubly linked list. If the list is doubly linked, it is assumed that the
previous pointer immediately follows the next pointer. The class contains methods that can iterate over the list and retrieve nodes both forward and backward. ExtRemoteList
can be used with either null-terminated or circular lists also.
Remote Typed Lists
To handle remote lists when the type of the nodes in the list is known, use the ExtRemoteTypedList class. This is an enhanced version of ExtRemoteList. In addition to the
basic functionality of ExtRemoteList, ExtRemoteTypedList automatically determines link offsets from type information.
2009 Microsoft Corporation
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
EXT_CLASS
The EXT_CLASS constant specifies the name of the C++ class that represents the EngExtCpp extension library.
#ifndef EXT_CLASS
#define EXT_CLASS Extension
#endif
Comments
The default value of EXT_CLASS is Extension. You can change this value by defining EXT_CLASS before you include the header file Engextcpp.hpp.
Each extension command in the library is declared as a member of the class EXT_CLASS using the macro EXT_COMMAND_METHOD. For example, a library with two
extension commands, extcmd and anotherextcmd, could define the class EXT_CLASS as follows:
class EXT_CLASS : public ExtExtension
{
public:
EXT_COMMAND_METHOD(extcmd);
EXT_COMMAND_METHOD(anotherextcmd);
}
Extension commands that have been declared by using EXT_COMMAND_METHOD should be defined by using EXT_COMMAND and should be exported from the
library.
The EXT_DECLARE_GLOBALS macro creates a single instance of the EXT_CLASS class.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
EXT_COMMAND, EXT_COMMAND_METHOD, EXT_DECLARE_GLOBALS
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
EXT_COMMAND_METHOD
The EXT_COMMAND_METHOD macro declares an extension command from inside the definition of the EXT_CLASS class.
#define EXT_COMMAND_METHOD(_Name) \
void _Name (void);
Parameters
_Name
The name of the extension command. As with all extension commands, the name must consist entirely of lowercase letters.
Comments
This macro must be used inside the definition of the EXT_CLASS class.
The macro EXT_COMMAND should be used to define the extension command. As with all C++ declarations, the EXT_COMMAND_METHOD declaration should appear
in the source files before the EXT_COMMAND definition.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
EXT_CLASS, EXT_COMMAND
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
EXT_COMMAND
The EXT_COMMAND macro is used to define an extension command that was declared by using the EXT_COMMAND_METHOD macro.
An extension command is defined as follows
EXT_COMMAND(_Name, _Desc, _Args)
{
...
}
Parameters
_Name
The name of the extension command. This must be the same as the _Name parameter that is used to declare the extension command by using
EXT_COMMAND_METHOD.
Because EXT_COMMAND is a macro, _Name must be the bare name of the extension command and should not be enclosed in quotation marks or be a variable.
_Desc
A string describing the extension command.
_Args
A string describing the arguments that are expected by the extension command.
Note The format of the _Args string is not yet documented. EngExtCpp.hpp has comments that describe exactly how to specify the argument syntax for a command.
Alternatively, the string "{{custom}}" can be used to indicate that the extension command will parse the arguments itself. The method GetRawArgStr can be used to
fetch the raw argument for parsing.
Comments
The body of the extension command does not take any arguments. However, because the extension command is declared as a method of the EXT_CLASS class, it has access
to all the members of the ExtExtension base class, some of which are initialized for the execution of the extension command.
The macro EXT_COMMAND_METHOD should be used to declare the extension command. As with all C++ declarations, the EXT_COMMAND_METHOD declaration
should appear in the source files before the EXT_COMMAND definition.
When the debugger engine calls an extension command method, it wraps the call in a try / except block. This protects the engine from some types of bugs in the extension
code; but, since the extension calls are executed in the same thread as the engine, they can still cause it to crash.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
This macro also creates a function called _Name (which calls the method defined by the macro). In order for the engine to call the extension, this function must be exported
from the extension library DLL.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
EXT_CLASS, EXT_COMMAND_METHOD, ExtExtension
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
EXT_DECLARE_GLOBALS
The EXT_DECLARE_GLOBALS macro sets up some global variables for use by the EngExtCpp extension framework. This include creating a single instance of the
EXT_CLASS class that represents the EngExtCpp extension library.
One of the source files to be compiled into the EngExtCpp extension library should include the following command
EXT_DECLARE_GLOBALS()
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
EXT_CLASS
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtExtension
The ExtExtension class is the base class for the C++ class that represents the EngExtCpp extension library.
The ExtExtension class includes the following methods, which can be used by the subclass:
Initialize
Uninitialize
OnSessionActive
OnSessionInactive
OnSessionAccessible
OnSessionInaccessible
IsUserMode
IsKernelMode
IsLiveLocalUser
IsMachine32
IsCurMachine32
IsMachine64
IsCurMachine64
Is32On64
CanQueryVirtual
HasFullMemBasic
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
IsExtensionRemote
AreOutputCallbacksDmlAware
RequireUserMode
RequireKernelMode
GetNumUnnamedArgs
GetUnnamedArgStr
GetUnnamedArgU64
HasUnnamedArg
GetArgStr
GetArgU64
HasArg
HasCharArg
SetUnnamedArg
SetUnnamedArgStr
SetUnnamedArgU64
SetArg
SetArgStr
SetArgU64
GetRawArgStr
GetRawArgCopy
Out
Warn
Err
Verb
Dml
DmlWarn
DmlErr
DmlVerb
DmlCmdLink
DmlCmdExec
RefreshOutputCallbackFlags
WrapLine
OutWrapStr
OutWrapVa
OutWrap
DemandWrap
AllowWrap
TestWrap
RequestCircleString
CopyCircleString
PrintCircleStringVa
PrintCircleString
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
SetAppendBuffer
AppendBufferString
AppendStringVa
AppendString
IsAppendStart
SetCallStatus
GetCachedSymbolTypeId
GetCachedFieldOffset
GetCachedFieldOffset
AddCachedSymbolInfo
GetExpr64
GetExprU64
GetExprS64
ThrowCommandHelp
ThrowInterrupt
ThrowOutOfMemory
ThrowContinueSearch
ThrowReloadExtension
ThrowInvalidArg
ThrowRemote
ThrowStatus
ThrowLastError
The ExtExtension class also contains the following fields that can be used by the subclass:
class ExtExtension
{
public:
USHORT m_ExtMajorVersion;
USHORT m_ExtMinorVersion;
ULONG m_ExtInitFlags;
ExtKnownStruct * m_KnownStructs;
ExtProvidedValue * m_ProvidedValues;
ExtCheckedPointer<IDebugAdvanced> m_Advanced;
ExtCheckedPointer<IDebugClient> m_Client;
ExtCheckedPointer<IDebugControl> m_Control;
ExtCheckedPointer<IDebugDataSpaces> m_Data;
ExtCheckedPointer<IDebugRegisters> m_Registers;
ExtCheckedPointer<IDebugSymbols> m_Symbols;
ExtCheckedPointer<IDebugSystemObjects> m_System;
ExtCheckedPointer<IDebugAdvanced2> m_Advanced2;
ExtCheckedPointer<IDebugAdvanced3> m_Advanced3;
ExtCheckedPointer<IDebugClient2> m_Client2;
ExtCheckedPointer<IDebugClient3> m_Client3;
ExtCheckedPointer<IDebugClient4> m_Client4;
ExtCheckedPointer<IDebugClient5> m_Client5;
ExtCheckedPointer<IDebugControl2> m_Control2;
ExtCheckedPointer<IDebugControl3> m_Control3;
ExtCheckedPointer<IDebugControl4> m_Control4;
ExtCheckedPointer<IDebugDataSpaces2> m_Data2;
ExtCheckedPointer<IDebugDataSpaces3> m_Data3;
ExtCheckedPointer<IDebugDataSpaces4> m_Data4;
ExtCheckedPointer<IDebugRegisters2> m_Registers2;
ExtCheckedPointer<IDebugSymbols2> m_Symbols2;
ExtCheckedPointer<IDebugSymbols3> m_Symbols3;
ExtCheckedPointer<IDebugSystemObjects2> m_System2;
ExtCheckedPointer<IDebugSystemObjects3> m_System3;
ExtCheckedPointer<IDebugSystemObjects4> m_System4;
ULONG m_OutputWidth;
ULONG m_ActualMachine;
ULONG m_Machine;
ULONG m_PageSize;
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
ULONG m_PtrSize;
ULONG m_NumProcessors;
ULONG64 m_OffsetMask;
ULONG m_DebuggeeClass;
ULONG m_DebuggeeQual;
ULONG m_DumpFormatFlags;
bool m_IsRemote;
bool m_OutCallbacksDmlAware;
ULONG m_OutMask;
ULONG m_CurChar;
ULONG m_LeftIndent;
bool m_AllowWrap;
bool m_TestWrap;
ULONG m_TestWrapChars;
PSTR m_AppendBuffer;
ULONG m_AppendBufferChars;
PSTR m_AppendAt;
};
Members
m_ExtMajorVersion
The major version number of the extension library. This should be set by the Initialize method. If it is not set, it defaults to 1.
m_ExtMinorVersion
The minor version number of the extension library. This should be set by the Initialize method. If it is not set, it defaults to 0 (zero).
m_ExtInitFlags
The DbgEng extension initialization flags for DebugExtensionInitialize.
m_KnownStructs
An array of ExtKnownStruct structures that the extension library is capable of formatting for output. This member should be set by the Initialize method and should not
be changed once this method returns.
If m_KnownStructs is not NULL, the TypeName member of the last ExtKnownStruct structure in the array must be NULL.
When formatting a target's structure for output, if the name of the structure's type matches the TypeName member of one of the ExtKnownStruct structures in this
array, the callback function specified in the Method member is called to perform the formatting.
m_ProvidedValues
An array of ExtProvidedValue structures listing the pseudo registers that the extension library can provide values for. This member should be set by the Initialize
method and should not be changed once this method returns.
If m_ProvidedValues is not NULL, the ValueName member of the last ExtProvidedValue structure in the array must be NULL.
When evaluating a pseudo register, if the name of the pseudo register matches the ValueName member of one of the ExtProvidedValue structures in this array, the
callback function specified in the Method member is called to evaluate the pseudo register.
m_Advanced
The IDebugAdvanced interface pointer for the client object that can be used by the extension library. It is valid during the invocation of externally-called extension
methods-for example, the execution of an extension command, a call to ExtKnownStructMethod and ExtProvideValueMethod.
m_Client
The IDebugClient interface pointer for the client object that can be used by the extension library. It is valid during the invocation of externally-called extension
methods-for example, the execution of an extension command, a call to ExtKnownStructMethod and ExtProvideValueMethod.
m_Control
The IDebugControl interface pointer for the client object that can be used by the extension library. It is valid during the invocation of externally-called extension
methods-for example, the execution of an extension command, a call to ExtKnownStructMethod and ExtProvideValueMethod.
m_Data
The IDebugDataSpaces interface pointer for the client object that can be used by the extension library. It is valid during the invocation of externally-called extension
methods-for example, the execution of an extension command, a call to ExtKnownStructMethod and ExtProvideValueMethod.
m_Registers
The IDebugRegisters interface pointer for the client object that can be used by the extension library. It is valid during the invocation of externally-called extension
methods-for example, the execution of an extension command, a call to ExtKnownStructMethod and ExtProvideValueMethod.
m_Symbols
The IDebugSymbols interface pointer for the client object that can be used by the extension library. It is valid during the invocation of externally-called extension
methods-for example, the execution of an extension command, a call to ExtKnownStructMethod and ExtProvideValueMethod.
m_System
The IDebugSystemObjects interface pointer for the client object that can be used by the extension library. It is valid during the invocation of externally-called extension
methods-for example, the execution of an extension command, a call to ExtKnownStructMethod and ExtProvideValueMethod.
m_Advanced2
The IDebugAdvanced2 interface pointer for the client object that can be used by the extension library. It is valid during the invocation of externally-called extension
methods-for example, the execution of an extension command, a call to ExtKnownStructMethod and ExtProvideValueMethod. This interface might not be available
in all versions of the debugger engine.
m_Advanced3
The IDebugAdvanced3 interface pointer for the client object that can be used by the extension library. It is valid during the invocation of externally-called extension
methods-for example, the execution of an extension command, a call to ExtKnownStructMethod and ExtProvideValueMethod. This interface might not be available
in all versions of the debugger engine.
m_Client2
The IDebugClient2 interface pointer for the client object that can be used by the extension library. It is valid during the invocation of externally-called extension
methods-for example, the execution of an extension command, a call to ExtKnownStructMethod and ExtProvideValueMethod. This interface might not be available
in all versions of the debugger engine.
m_Client3
The IDebugClient3 interface pointer for the client object that can be used by the extension library. It is valid during the invocation of externally-called extension
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
methods-for example, the execution of an extension command, a call to ExtKnownStructMethod and ExtProvideValueMethod. This interface might not be available
in all versions of the debugger engine.
m_Client4
The IDebugClient4 interface pointer for the client object that can be used by the extension library. It is valid during the invocation of externally-called extension
methods-for example, the execution of an extension command, a call to ExtKnownStructMethod and ExtProvideValueMethod. This interface might not be available
in all versions of the debugger engine.
m_Client5
The IDebugClient5 interface pointer for the client object that can be used by the extension library. It is valid during the invocation of externally-called extension
methods-for example, the execution of an extension command, a call to ExtKnownStructMethod and ExtProvideValueMethod. This interface might not be available
in all versions of the debugger engine.
m_Control2
The IDebugControl2 interface pointer for the client object that can be used by the extension library. It is valid during the invocation of externally-called extension
methods-for example, the execution of an extension command, a call to ExtKnownStructMethod and ExtProvideValueMethod. This interface might not be available
in all versions of the debugger engine.
m_Control3
The IDebugControl3 interface pointer for the client object that can be used by the extension library. It is valid during the invocation of externally-called extension
methods-for example, the execution of an extension command, a call to ExtKnownStructMethod and ExtProvideValueMethod. This interface might not be available
in all versions of the debugger engine.
m_Control4
The IDebugControl4 interface pointer for the client object that can be used by the extension library. It is valid during the invocation of externally-called extension
methods-for example, the execution of an extension command, a call to ExtKnownStructMethod and ExtProvideValueMethod. This interface might not be available
in all versions of the debugger engine.
m_Data2
The IDebugDataSpaces2 interface pointer for the client object that can be used by the extension library. It is valid during the invocation of externally-called extension
methods-for example, the execution of an extension command, a call to ExtKnownStructMethod and ExtProvideValueMethod. This interface might not be available
in all versions of the debugger engine.
m_Data3
The IDebugDataSpaces3 interface pointer for the client object that can be used by the extension library. It is valid during the invocation of externally-called extension
methods-for example, the execution of an extension command, a call to ExtKnownStructMethod and ExtProvideValueMethod. This interface might not be available
in all versions of the debugger engine.
m_Data4
The IDebugDataSpaces4 interface pointer for the client object that can be used by the extension library. It is valid during the invocation of externally-called extension
methods-for example, the execution of an extension command, a call to ExtKnownStructMethod and ExtProvideValueMethod. This interface might not be available
in all versions of the debugger engine.
m_Registers2
The IDebugRegisters2 interface pointer for the client object that can be used by the extension library. It is valid during the invocation of externally-called extension
methods-for example, the execution of an extension command, a call to ExtKnownStructMethod and ExtProvideValueMethod. This interface might not be available
in all versions of the debugger engine.
m_Symbols2
The IDebugSymbols2 interface pointer for the client object that can be used by the extension library. It is valid during the invocation of externally-called extension
methods-for example, the execution of an extension command, a call to ExtKnownStructMethod and ExtProvideValueMethod. This interface might not be available
in all versions of the debugger engine.
m_Symbols3
The IDebugSymbols3 interface pointer for the client object that can be used by the extension library. It is valid during the invocation of externally-called extension
methods-for example, the execution of an extension command, a call to ExtKnownStructMethod and ExtProvideValueMethod. This interface might not be available
in all versions of the debugger engine.
m_System2
The IDebugSystemObjects2 interface pointer for the client object that can be used by the extension library. It is valid during the invocation of externally-called
extension methods-for example, the execution of an extension command, a call to ExtKnownStructMethod and ExtProvideValueMethod. This interface might not be
available in all versions of the debugger engine.
m_System3
The IDebugSystemObjects3 interface pointer for the client object that can be used by the extension library. It is valid during the invocation of externally-called
extension methods-for example, the execution of an extension command, a call to ExtKnownStructMethod and ExtProvideValueMethod. This interface might not be
available in all versions of the debugger engine.
m_System4
The IDebugSystemObjects4 interface pointer for the client object that can be used by the extension library. It is valid during the invocation of externally-called
extension methods-for example, the execution of an extension command, a call to ExtKnownStructMethod and ExtProvideValueMethod. This interface might not be
available in all versions of the debugger engine.
m_PtrSize
The size of a pointer on the current target. If the target uses 32-bit pointers, m_PtrSize is 4. If the target uses 64-bit pointers, m_PtrSize is 8.
m_AppendBuffer
A character buffer used to return strings from the extension library to the engine. The size of this buffer is m_AppendBufferChars. The methods AppendBufferString,
AppendStringVa, and AppendString can be used to write strings to this buffer.
m_AppendBufferChars
The size, in characters, of the buffer m_AppendBuffer.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Initialize
The Initialize method is called by the engine to initialize an EngExtCpp extension library after loading it.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
virtual HRESULT
ExtExtension::Initialize(
void
)
Parameters
None
Return Value
S_OK
The extension library was successfully initialized.
Any other value indicates that the extension DLL was unable to initialize and the engine will unload it.
Comments
The extension library version number should be set by this method. This can be done by setting the members m_ExtMajorVersion and m_ExtMinorVersion of the base
class ExtExtension.
The ExtExtension member m_KnownStructs should be set by this method to indicate to the engine which structures the extension library is capable of formatting for output.
If this method is defined in the extension library class EXT_CLASS, it can be used by the extension library to initialize any variables it requires.
There may or may not be a debugging session active when this function is called, so you should not assume that the extension can query session information.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
EXT_CLASS, ExtExtension, Uninitialize
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Uninitialize
The Uninitialize method is called by the engine to uninitialize an EngExtCpp extension library before it is unloaded.
virtual void
Uninitialize(
void
)
Parameters
None
Return Value
None
Comments
If this method is defined in the extension library class EXT_CLASS, it can be used by the extension library to clean up before it is unloaded.
There may or may not be a debugging session active when this function is called, so you should not assume that the extension can query session information.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
EXT_CLASS, Initialize
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
OnSessionActive
The OnSessionActive method is called by the engine to inform the EngExtCpp extension library when the debugging session becomes active.
virtual void
ExtExtension::OnSessionActive(
IN ULONG64 Argument
)
Parameters
Argument
Set to zero. (Reserved for future use).
Return Value
None
Comments
The session might not be accessible.
If this method is defined in the extension library class EXT_CLASS, it can be used to allow the extension library to cache information about the session without the need to
register event callbacks.
This method is called at the beginning of a session and, if a session has already started, after the extension library is initialized.
If a target is suspended, OnSessionAccessible is called instead.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
EXT_CLASS, Initialize, OnSessionAccessible, OnSessionInactive
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
OnSessionInactive
The OnSessionInactive method is called by the engine to inform the EngExtCpp extension library when the debugging session becomes inactive.
virtual void
OnSessionInactive(
IN ULONG64 Argument
)
Parameters
Argument
Set to zero. (Reserved for future use).
Return Value
None
Comments
If this method is defined in the extension library class EXT_CLASS, it can be used to allow the extension library to cache information about the session without the need to
register event callbacks.
This method is called at the end of a session.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
EXT_CLASS, OnSessionActive
2009 Microsoft Corporation
Send feedback on this topic
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
OnSessionAccessible
The OnSessionAccessible method is called by the engine to inform the EngExtCpp extension library when the debugging session becomes accessible.
virtual void
ExtExtension::OnSessionAccessible(
IN ULONG64 Argument
)
Parameters
Argument
Set to zero. (Reserved for future use).
Return Value
None
Comments
If this method is defined in the extension library class EXT_CLASS, it can be used to allow the extension library to cache information about the session without the need to
register event callbacks.
This method is called when a target is suspended and, if the session is already accessible, after the extension library is initialized (and OnSessionActive has been called).
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
EXT_CLASS, OnSessionActive, OnSessionInaccessible
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
OnSessionInaccessible
The OnSessionInaccessible method is called by the engine to inform the EngExtCpp extension library when the debugging session becomes inaccessible.
virtual void
OnSessionInaccessible(
IN ULONG64 Argument
)
Parameters
Argument
Set to zero. (Reserved for future use).
Return Value
None
Comments
If this method is defined in the extension library class EXT_CLASS, it can be used to allow the extension library to cache information about the session without the need to
register event callbacks.
This method is called when a target starts executing.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
EXT_CLASS, OnSessionAccessible
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetNumUnnamedArgs
The GetNumUnnamedArgs method returns the number of unnamed arguments in the command line used to invoke the current extension command.
ULONG
ExtExtension::GetNumUnnamedArgs(
void
)
Parameters
None.
Return Value
GetNumUnnamedArgs returns the number of unnamed arguments.
Comments
The indices of the unnamed arguments returned by GetNumUnnamedArgs range from zero to the number of unnamed arguments minus one (unnamed args - 1).
For an overview of argument parsing in the EngExtCpp extensions framework, see Parsing Extension Arguments.
This method should only be called during the execution of an extension command provided by this class.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetUnnamedArgStr
The GetUnnamedArgStr method returns an unnamed string argument from the command line used to invoke the current extension command.
PCSTR
ExtExtension::GetUnnamedArgStr(
IN ULONG Index
) throw(...)
Parameters
Index
Specifies the index of the argument. The command-line description used in EXT_COMMAND must specify that the type of this argument is string. The value of Index
should be between zero and the number of unnamed arguments returned by GetNumUnnamedArgs minus one (unnamed arguments - 1).
Return Value
GetUnnamedArgStr returns the unnamed string argument.
Comments
For an overview of argument parsing in the EngExtCpp extensions framework, see Parsing Extension Arguments.
The string returned by GetUnnamedArgStr is only meaningful during the execution of the current extension command.
This method should only be called during the execution of an extension command provided by this class.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
EXT_COMMAND, GetNumUnnamedArgs
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetUnnamedArgU64
The GetUnnamedArgU64 method returns the value of an unnamed expression argument from the command line used to invoke the current extension command.
ULONG64
ExtExtension::GetUnnamedArgU64(
IN ULONG Index
) throw(...)
Parameters
Index
Specifies the index of the argument. The command-line description used in EXT_COMMAND must specify that the type of this argument is string. Index should be
between zero and the number of unnamed arguments returned by GetNumUnnamedArgs minus one (unnamed arguments - 1).
Return Value
GetUnnamedArgU64 returns the value of the unnamed expression argument.
Comments
For an overview of argument parsing in the EngExtCpp extensions framework, see Parsing Extension Arguments.
This method should only be called during the execution of an extension command provided by this class.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
EXT_COMMAND, GetNumUnnamedArgs
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
HasUnnamedArg
The HasUnnamedArg method indicates whether a specified unnamed argument is present in the command line used to invoke the current extension command.
bool
ExtExtension::HasUnnamedArg(
IN ULONG Index
)
Parameters
Index
Specifies the index of the argument. Index should be between zero and the number of unnamed arguments returned by GetNumUnnamedArgs minus one (unnamed
arguments - 1).
Return Value
HasUnnamedArg returns true if the argument is present; false if it is not present.
Comments
This method will work for all types of unnamed arguments. For an overview of argument parsing in the EngExtCpp extensions framework, see Parsing Extension Arguments.
This method should only be called during the execution of an extension command provided by this class.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
GetNumUnnamedArgs
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetArgStr
The GetArgStr method returns a named string argument from the command line used to invoke the current extension command.
PCSTR
ExtExtension::GetArgStr(
IN PCSTR Name,
IN bool Required = true
) throw(...)
Parameters
Name
Specifies the name of the argument. The command-line description used in EXT_COMMAND must specify that the type of this argument is string.
Required
Specifies if the argument is required. If Required is true and the argument was not present on the command line, ExtInvalidArgumentException is thrown. You do
not need to set this parameter; if it is not set Required defaults to true.
Return Value
GetArgStr returns the named string argument.
Comments
For an overview of argument parsing in the EngExtCpp extensions framework, see Parsing Extension Arguments.
The string returned by GetArgStr is only meaningful during the execution of the current extension command.
This method should only be called during the execution of an extension command provided by this class.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
EXT_COMMAND
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetArgU64
The GetArgU64 method returns the value of a named expression argument from the command line used to invoke the current extension command.
ULONG64
ExtExtension::GetArgU64(
IN PCSTR Name,
IN bool Required = true
) throw(...)
Parameters
Name
Specifies the name of the argument. The command-line description used in EXT_COMMAND must specify that the type of this argument is expression.
Required
Specifies if the argument is required. If Required is true and the argument was not present on the command line, ExtInvalidArgumentException is called. You do not
need to set this parameter; if it is not set Required defaults to true.
Return Value
GetArgU64 returns the value of the named expression argument.
Comments
For an overview of argument parsing in the EngExtCpp extensions framework, see Parsing Extension Arguments.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
This method should only be called during the execution of an extension command provided by this class.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
EXT_COMMAND
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
HasArg
The HasArg method indicates whether a specified named argument is present in the command line used to invoke the current extension command.
bool
ExtExtension::HasArg(
IN PCSTR Name
)
Parameters
Name
Specifies the name of the argument.
Return Value
HasArg returns true if the argument is present; false if it is not present.
Comments
This method will work for all types of named arguments. In particular, it can be used to detect the presence of a named argument of Boolean type.
If the name of the argument is a single character, the convenience method HasCharArg can be used instead.
For an overview of argument parsing in the EngExtCpp extensions framework, see Parsing Extension Arguments.
This method should only be called during the execution of an extension command provided by this class.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
HasCharArg
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
HasCharArg
The HasCharArg method indicates whether a specified single-character named argument is present in the command line used to invoke the current extension command.
bool
ExtExtension::HasCharArg(
IN CHAR Name
)
Parameters
Name
Specifies the name of the argument.
Return Value
HasCharArg returns true if the argument is present; false if it is not present.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Comments
This method will work for all types of named arguments. In particular, it can be used to detect the presence of a named argument of Boolean type.
This is a convenience method and is restricted to arguments whose name is a single character. For arguments whose names are longer than a single character, use HasArg.
For an overview of argument parsing in the EngExtCpp extensions framework, see Parsing Extension Arguments.
This method should only be called during the execution of an extension command provided by this class.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
HasArg
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SetUnnamedArg
The SetUnnamedArg method sets an unnamed argument for the current extension command.
bool
ExtExtension::SetUnnamedArg(
IN ULONG Index,
IN OPTIONAL PCSTR StrArg,
IN ULONG64 NumArg,
IN bool OnlyIfUnset = false
) throw(...)
Parameters
Index
Specifies the index of the argument. Index should be between zero and the number of unnamed arguments, as specified in the command-line description used in
EXT_COMMAND, minus one (unnamed arguments - 1).
StrArg
A string that specifies the value of the unnamed argument.
If the argument is of type string, a pointer to the first non-space character is saved as the argument. In this case, StrArg must not be NULL.
If the argument is of type expression, StrArg is evaluated using the default expression evaluator and the value returned by the default expression evaluator becomes the
value of the argument. In this case, StrArg can be NULL and NumArg should be used instead.
If the argument is of type Boolean, StrArg is ignored and can be NULL.
NumArg
Specifies the value of an unnamed expression argument. NumArg is only used if the argument is of type expression and StrArg is NULL.
OnlyIfUnset
Specifies what happens if the argument is already set. If OnlyIfUnset is true and the argument has already been set, the argument will not be changed. If OnlyIfUnset is
false and the argument has already been set, the argument will be changed.
Return Value
SetUnnamedArg returns true if the argument was changed; false otherwise.
Comments
For an overview of argument parsing in the EngExtCpp extensions framework, see Parsing Extension Arguments.
This method should only be called during the execution of an extension command provided by this class.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
EXT_COMMAND
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
SetUnnamedArgStr
The SetUnnamedArgStr method sets an unnamed string argument for the current extension command.
bool
ExtExtension::SetUnnamedArgStr(
IN ULONG Index,
IN PCSTR Arg,
IN bool OnlyIfUnset = false
) throw(...)
Parameters
Index
Specifies the index of the argument. The command-line description used in EXT_COMMAND must specify that the type of this argument is string. Index should be
between zero and the number of unnamed arguments as specified in the command-line description used in EXT_COMMAND minus one.
Arg
A string that specifies the value of the unnamed argument. A pointer to the first non-space character is saved as the argument.
OnlyIfUnset
Specifies what happens if the argument is already set. If OnlyIfUnset is true and the argument has already been set, the argument will not be changed. If OnlyIfUnset is
false and the argument has already been set, the argument will be changed.
Return Value
SetUnnamedArgStr returns true if the argument was changed; false otherwise.
Comments
For an overview of argument parsing in the EngExtCpp extensions framework, see Parsing Extension Arguments.
This method should only be called during the execution of an extension command provided by this class.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
EXT_COMMAND
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SetUnnamedArgU64
The SetUnnamedArgU64 method sets the value of an unnamed expression argument for the current extension command.
bool
ExtExtension::SetUnnamedArgU64(
IN ULONG Index,
IN ULONG64 Arg,
IN bool OnlyIfUnset = false
) throw(...)
Parameters
Index
Specifies the index of the argument. The command-line description used in EXT_COMMAND must specify that the type of this argument is expression. Index should be
between zero and the number of unnamed arguments as specified in the command-line description used in EXT_COMMAND minus one.
Arg
Specifies the value of an unnamed expression argument.
OnlyIfUnset
Specifies what happens if the argument is already set. If OnlyIfUnset is true and the argument has already been set, the argument will not be changed. If OnlyIfUnset is
false and the argument has already been set, the argument will be changed.
Return Value
SetUnnamedArgU64 returns true if the argument was changed; false otherwise.
Comments
For an overview of argument parsing in the EngExtCpp extensions framework, see Parsing Extension Arguments.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
This method should only be called during the execution of an extension command provided by this class.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
EXT_COMMAND
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SetArg
The SetArg method sets a named argument for the current extension command.
bool
ExtExtension::SetArg(
IN PCSTR Name,
IN OPTIONAL PCSTR StrArg,
IN ULONG64 NumArg,
IN bool OnlyIfUnset = false
) throw(...)
Parameters
Name
Specifies the name of the argument.
StrArg
A string that specifies the value of the named argument.
If the argument is of type string, a pointer to the first non-space character is saved as the argument. In this case, StrArg must not be NULL.
If the argument is of type expression, StrArg is evaluated using the default expression evaluator and the value becomes the value of the argument. In this case, StrArg can
be NULL and NumArg is used instead.
If the argument is of type Boolean, StrArg is ignored and can be NULL.
NumArg
Specifies the value of a named expression argument. NumArg is only used if the type of the argument is an expression and StrArg is NULL.
OnlyIfUnset
Specifies what happens if the argument is already set. If OnlyIfUnset is true and the argument has already been set, the argument will not be changed. If OnlyIfUnset is
false and the argument has already been set, the argument will be changed.
Return Value
SetArg returns true if the argument was changed; false otherwise.
Comments
For an overview of argument parsing in the EngExtCpp extensions framework, see Parsing Extension Arguments.
This method should only be called during the execution of an extension command provided by this class.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SetArgStr
The SetArgStr method sets a named string argument for the current expression command.
bool
ExtExtension::SetArgStr(
IN PCSTR Name,
IN PCSTR Arg,
IN bool OnlyIfUnset = false
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
) throw(...)
Parameters
Name
Specifies the name of the argument. The command-line description used in EXT_COMMAND must specify that the type of this argument is string.
Arg
A string that specifies the value of the named argument. A pointer to the first non-space character is saved as the argument. In this case, Arg must not be NULL.
OnlyIfUnset
Specifies what happens if the argument is already set. If OnlyIfUnset is true and the argument has already been set, the argument will not be changed. If OnlyIfUnset is
false and the argument has already been set, the argument will be changed.
Return Value
SetArgStr returns true if the argument was changed; false otherwise.
Comments
For an overview of argument parsing in the EngExtCpp extensions framework, see Parsing Extension Arguments.
This method should only be called during the execution of an extension command provided by this class.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
EXT_COMMAND
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SetArgU64
The SetArgU64 method sets a named expression argument for the current expression command.
bool
ExtExtension::SetArgU64(
IN PCSTR Name,
IN ULONG64 Arg,
IN bool OnlyIfUnset = false
) throw(...)
Parameters
Name
Specifies the name of the argument. The command-line description used in EXT_COMMAND must specify that the type of this argument is expression.
Arg
Specifies the value of the named expression argument.
OnlyIfUnset
Specifies what happens if the argument is already set. If OnlyIfUnset is true and the argument has already been set, the argument will not be changed. If OnlyIfUnset is
false and the argument has already been set, the argument will be changed.
Return Value
SetArgU64 returns true if the argument was changed; false otherwise.
Comments
For an overview of argument parsing in the EngExtCpp extensions framework, see Parsing Extension Arguments.
This method should only be called during the execution of an extension command provided by this class.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
EXT_COMMAND
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetRawArgStr
The GetRawArgStr method returns a string that represents the arguments passed to the extension command.
PCSTR
ExtExtension::GetRawArgStr(
void
)
Parameters
None
Return Value
GetRawArgStr returns a string that represents the arguments passed to the extension command. In particular, if the extension command was called from a command line, this
string contains the portion of the command line that follows the extension command. The return value can be NULL or empty.
Comments
For an overview of argument parsing in the EngExtCpp extensions framework, see Parsing Extension Arguments.
The string returned by this method is only meaningful during the execution of the current extension command.
This method should only be called during the execution of an extension command provided by this class.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtKnownStruct
The ExtKnownStruct structure is used to specify how a target's structure can be formatted for output.
struct ExtKnownStruct
{
PCSTR TypeName;
ExtKnownStructMethod Method;
bool SuppressesTypeName;
};
Members
TypeName
The name of the structure type.
Method
The ExtKnownStructMethod callback function that can be called to format an instance of the structure specified in TypeName.
SuppressesTypeName
A Boolean flag that specifies whether the formatted output includes the name of the structure's type. If FALSE, the name is included in the formatted output; otherwise,
the name is not included.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
ExtKnownStructMethod
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtKnownStructMethod
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The ExtKnownStructMethod callback method is called by the engine to format an instance of a structure for output on a single line.
typedef void
(ExtExtension::*ExtKnownStructMethod)(
IN PCSTR TypeName,
IN ULONG Flags,
IN ULONG64 Offset
)
Parameters
TypeName
Specifies the name of the type of the structure pointed to by Offset. This is the same as the TypeName field of the ExtKnownStruct structure used to register this
callback method.
Flags
Specifies bit flags that indicate how the output should be formatted. Currently, this is set to DEBUG_KNOWN_STRUCT_GET_SINGLE_LINE_OUTPUT, which
indicates that the output should be formatted for output on a single line.
Offset
Specifies the location in the target's memory of the instance of the structure to be formatted for output.
Return Value
None
Comments
The debugger engine expects the output to be formatted for printing on a single line, hence it does not expect the formatted structure to have any line breaks.
The formatted output from this method should be placed in the buffer m_AppendBuffer a member of ExtExtension.
Instances of this callback method are registered with the engine by using an instance of the ExtKnownStruct structure that is placed into the array m_KnownStructs (a
member of ExtExtension) by the Initialize method. The ExtKnownStruct structure also specifies the name of the type of structure this method formats.
When the debugger engine calls a known structure method, it wraps the call in a try / except block. This protects the engine from some types of bugs in the extension code;
but, because the extension calls are executed in the same thread as the engine, they can still cause it to crash.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
ExtExtension, ExtKnownStruct, Initialize
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtRemoteData
The ExtRemoteData class provides a wrapper around a small section of a target's memory. ExtRemoteData automatically retrieves the memory and provides a number of
convenience methods.
The ExtRemoteData class includes the following constructors and methods:
ExtRemoteData
Set
Read
Write
GetData
GetChar
GetUchar
GetBoolean
GetStdBool
GetW32Bool
GetShort
GetUshort
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetLong
GetUlong
GetLong64
GetUlong64
GetFloat
GetDouble
GetLongPtr
GetUlongPtr
GetPtr
ReadBuffer
WriteBuffer
GetString
class ExtRemoteData
{
public:
PCSTR m_Name;
ULONG64 m_Offset;
bool m_ValidOffset;
ULONG m_Bytes;
ULONG64 m_Data;
bool m_ValidData;
bool m_Physical;
ULONG m_SpaceFlags;
};
Members
m_Name
The name given to this instance of ExtRemoteData. This name is used to provide meaningful error messages and is set by the constructor,
ExtRemoteData::ExtRemoteData.
m_Offset
The location in the target's memory (virtual or physical) of the region of memory represented by this instance of ExtRemoteData. It can be set by the
ExtRemoteData::ExtRemoteData constructor or by the ExtRemoteData::Set method.
m_ValidOffset
Indicates whether the m_Offset location is valid. If m_ValidOffset is false, the location is not valid and most of the methods for this object will not work. In this case,
the ExtRemoteData::Set method can be called to change m_Offset to a valid location.
m_Bytes
The size, in bytes, of the region of memory represented by this object. It can be set by the ExtRemoteData::ExtRemoteData constructor or by the ExtRemoteData::Set
method.
m_Data
The cached contents of the region of memory specified by this instance of ExtRemoteData. Setting this member is optional. If the region of memory is large, it will not
be cached.
m_ValidData
Indicates whether the m_Data cached data is valid. If m_ValidData is false, the cached data is not valid and most of the methods for this object will not work. In this
case, the ExtRemoteData::Read method can be called to refresh the cached data.
m_Physical
Indicates whether the m_Offset location is in the target's virtual address space or in its physical address space. If m_Physical is true, the m_Offset location is in the
target's physical address space. If m_Physical is false, the m_Offset location is in the target's virtual address space.
m_SpaceFlags
The DEBUG_PHYSICAL_XXX flags used for accessing physical memory on the target. These flags are only used if m_Physical is true. For a description of these
flags, see the ReadPhysical2 method.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
ExtRemoteData::ExtRemoteData, ExtRemoteData::Read, ExtRemoteData::Set, ReadPhysical2
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtRemoteData::ExtRemoteData
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
ExtRemoteData::Set
The Set method sets the region of the target's memory represented by the ExtRemoteData object.
void
ExtRemoteData::Set(
IN ULONG64 Offset,
IN ULONG Bytes
) throw(...)
void
ExtRemoteData::Set(
IN const DEBUG_TYPED_DATA *
)
Typed
Parameters
Offset
Location of the beginning of the memory region in the target's virtual address space.
Bytes
Number of bytes in the memory region.
Typed
Specifies the region of memory by using a DEBUG_TYPED_DATA structure.
Return Value
None
Comments
The Set method will read the contents of the specified region of memory and cache the data. The data can be retrieved using ExtRemoteData::GetData or one of the
ExtRemoteTyped::GetXxx methods.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
ExtRemoteData::ExtRemoteData, ExtRemoteData::GetData
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtRemoteData::Read
The Read method reads the contents of the target's memory, represented by the ExtRemoteData object, and then caches the data.
void
ExtRemoteData::Read(
void
) throw(...)
Parameters
None
Return Value
None
Comments
When the region of memory is specified either by the , ExtRemoteData::ExtRemoteData constructor or by the ExtRemoteData::Set method, the contents are automatically
read from the target and cached. This method only needs to be called if the memory on the target might have changed.
The data can be retrieved using ExtRemoteData::GetData or one of the typed "get" methods.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
ExtRemoteData::ExtRemoteData, ExtRemoteData::GetData, ExtRemoteData::Set
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtRemoteData::Write
The Write method writes the data cached by the ExtRemoteData object to the region of memory on the target, represented by this object.
void
ExtRemoteData::Write(
void
) throw(...)
Parameters
None
Return Value
None
Comments
This method can be used to reset the region of memory on the target to the currently cached value that was previously read from the target.
It is also possible to directly set the value cached by the ExtRemoteData object, for example:
ExtRemoteData ext_remote_data = new ExtRemoteData(address, sizeof(USHORT));
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
ExtRemoteData::GetData
The GetData method returns the contents of the target's memory, represented by the ExtRemoteData object.
ULONG64
ExtRemoteData::GetData(
IN ULONG Request
) throw(...)
Parameters
Request
Number of bytes requested. This must be the same as the size of the memory specified by the ExtRemoteData::ExtRemoteData constructor or the
ExtRemoteData::Set method. If it is not the same, ExtRemoteException is thrown.
Return Value
GetData returns the cached contents of the target's memory, represented by the ExtRemoteData object.
Comments
The contents of the region of memory represented by an ExtRemoteData object are only cached if the size of the region is less than 8 bytes. If the size of the region is greater
than 8 bytes, the GetData method does not return a meaningful value.
A number of convenience methods are available for various primitive types. These methods will automatically provide the size of the type and cast the return value to that
type. These methods are listed in the See Also section.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
ExtRemoteData, ExtRemoteData::ExtRemoteData, ExtRemoteData::Set, GetBoolean, GetChar, GetDouble, GetFloat, GetLong, GetLong64, GetLongPtr, GetPtr,
GetShort, GetStdBool, GetUchar, GetUlong, GetUlong64, GetUlongPtr, GetUshort, GetW32Bool
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtRemoteData::GetChar
The GetChar method returns a CHAR version of the ExtRemoteData object, which represents the contents of the target's memory.
CHAR
ExtRemoteData::GetChar(
void
) throw (...)
Parameters
None
Return Value
GetChar returns the CHAR version of the ExtRemoteData object.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Comments
The size of the memory represented by the ExtRemoteData object must be sizeof(CHAR).
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
ExtRemoteData, ExtRemoteData::GetData, ExtRemoteData::GetUchar
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtRemoteData::GetUchar
The GetUChar method returns a UCHAR version of the ExtRemoteData object, which represents the contents of the target's memory.
UCHAR
ExtRemoteData::GetUchar(
void
) throw (...)
Parameters
None
Return Value
GetUchar returns the UCHAR version of the ExtRemoteData object.
Comments
The size of the memory represented by the ExtRemoteData object must be sizeof(UCHAR).
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
ExtRemoteData, ExtRemoteData::GetChar, ExtRemoteData::GetData
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtRemoteData::GetBoolean
The GetBoolean method returns a Boolean version of the ExtRemoteData object, which represents the contents of the target's memory.
BOOLEAN
ExtRemoteData::GetBoolean(
void
) throw (...)
Parameters
None
Return Value
GetBoolean returns the BOOLEAN version of the ExtRemoteData object.
Comments
The size of the memory represented by the ExtRemoteData object must be sizeof(BOOLEAN).
Note There are several different types that can be used to represent a Boolean value. BOOLEAN is one of these types. For the C++ bool type, use
ExtRemoteData::GetStdBool. For the BOOL type, use ExtRemoteData::GetW32Bool.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
ExtRemoteData, ExtRemoteData::GetData, ExtRemoteData::GetStdBool, ExtRemoteData::GetW32Bool
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtRemoteData::GetStdBool
The GetStdBool method returns a bool version of the ExtRemoteData object, which represents the contents of the target's memory.
bool
ExtRemoteData::GetStdBool(
void
) throw (...)
Parameters
None
Return Value
The bool version ofthe ExtRemoteData object.
Comments
The size of the memory represented by the ExtRemoteData object must be sizeof(bool).
Note There are several different types that can be used to represent a Boolean value. bool is one of these types. For the BOOLEAN type, use ExtRemoteData::GetBoolean.
For the BOOL type, use ExtRemoteData::GetW32Bool.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
ExtRemoteData, ExtRemoteData::GetBoolean, ExtRemoteData::GetData, ExtRemoteData::GetW32Bool
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtRemoteData::GetW32Bool
The GetW32Bool method returns a BOOL version of the ExtRemoteData object, which represents the contents of the target's memory.
BOOL
ExtRemoteData::GetW32Bool(
void
) throw (...)
Parameters
None
Return Value
GetW32Bool returns the BOOL version of the ExtRemoteData object.
Comments
The size of the memory represented by the ExtRemoteData object must be sizeof(BOOL).
Note There are several different types that can be used to represent a Boolean value. BOOL is one of these types. For the C++ bool type, use ExtRemoteData::GetStdBool.
For the BOOLEAN type, use ExtRemoteData::GetBoolean.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
ExtRemoteData, ExtRemoteData::GetBoolean, ExtRemoteData::GetData, ExtRemoteData::GetStdBool
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtRemoteData::GetShort
The GetShort method returns a SHORT version of the ExtRemoteData object, which represents the contents of the target's memory.
SHORT
ExtRemoteData::GetShort(
void
) throw (...)
Parameters
None
Return Value
GetShort returns the SHORT version of the ExtRemoteData object.
Comments
The size of the memory represented by the ExtRemoteData object must be sizeof(SHORT).
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
ExtRemoteData, ExtRemoteData::GetData, ExtRemoteData::GetUshort
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtRemoteData::GetUshort
The GetUshort method returns a USHORT version of the ExtRemoteData object, which represents the contents of the target's memory.
USHORT
ExtRemoteData::GetUshort(
void
) throw (...)
Parameters
None
Return Value
GetUshort returns the USHORT version of the ExtRemoteData object.
Comments
The size of the memory represented by the ExtRemoteData object must be sizeof(USHORT).
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
ExtRemoteData::GetLong
The GetLong method returns a LONG version of the ExtRemoteData object, which represents the contents of the target's memory.
LONG
ExtRemoteData::GetLong(
void
) throw (...)
Parameters
None
Return Value
GetLong returns the LONG version of the ExtRemoteData object.
Comments
The size of the memory represented by this ExtRemoteData object must be sizeof(LONG).
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
ExtRemoteData, ExtRemoteData::GetData, ExtRemoteData::GetLong64, ExtRemoteData::GetUlong
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtRemoteData::GetUlong
The GetUlong method returns a ULONG version of the ExtRemoteData object, which represents the contents of the target's memory.
ULONG
ExtRemoteData::GetUlong(
void
) throw (...)
Parameters
None
Return Value
GetUlong returns the ULONG version of the ExtRemoteData object.
Comments
The size of the memory represented by the ExtRemoteData object must be sizeof(ULONG).
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
ExtRemoteData, ExtRemoteData::GetData, ExtRemoteData::GetLong64, ExtRemoteData::GetUlong
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
ExtRemoteData::GetLong64
The GetLong64 method returns a LONG64 version of the ExtRemoteData object, which represents the contents of the target's memory.
LONG64
ExtRemoteData::GetLong64(
void
) throw (...)
Parameters
None
Return Value
GetLong64 returns the LONG64 version of the ExtRemoteData object.
Comments
The size of the memory represented by the ExtRemoteData object must be sizeof(LONG64).
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
ExtRemoteData, ExtRemoteData::GetData, ExtRemoteData::GetLong64, ExtRemoteData::GetUlong
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtRemoteData::GetUlong64
The GetUlong64 method returns a ULONG64 version of the ExtRemoteData object, which represents the contents of the target's memory.
ULONG64
ExtRemoteData::GetUlong64(
void
) throw (...)
Parameters
None
Return Value
GetUlong64 returns the ULONG64 version of the ExtRemoteData object.
Comments
The size of the memory represented by the ExtRemoteData object must be sizeof(ULONG64).
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
ExtRemoteData, ExtRemoteData::GetData, ExtRemoteData::GetLong64, ExtRemoteData::GetUlong
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtRemoteData::GetFloat
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
The GetFloat method returns a float version of the ExtRemoteData object, which represents the contents of the target's memory.
float
ExtRemoteData::GetFloat(
void
) throw (...)
Parameters
None
Return Value
GetFloat returns the float version of the ExtRemoteData object.
Comments
The size of the memory represented by the ExtRemoteData object must be sizeof(float).
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
ExtRemoteData, ExtRemoteData::GetData, ExtRemoteData::GetDouble,
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtRemoteData::GetDouble
The GetDouble method returns a double version of the ExtRemoteData object, which represents the contents of the target's memory.
double
ExtRemoteData::GetDouble(
void
) throw (...)
Parameters
None
Return Value
GetDouble returns the double version of the ExtRemoteData object.
Comments
The size of the memory represented by the ExtRemoteData object must be sizeof(double).
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
ExtRemoteData, ExtRemoteData::GetData, ExtRemoteData::GetFloat
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtRemoteData::GetLongPtr
The GetLongPtr method returns a signed integer version (extended to LONG64) of the ExtRemoteData object, which represents the contents of the target's memory. The
size of the unsigned integer from the target is the same size as a pointer on the target.
LONG64
ExtRemoteData::GetLongPtr(
void
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
) throw (...)
Parameters
None
Return Value
GetLongPtr returns a signed integer version of the ExtRemoteData object, extended to LONG64.
Comments
The size of the memory represented by the ExtRemoteData object must be the same as the size of a pointer on the target, ExtExtension::m_PtrSize.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
ExtRemoteData, ExtRemoteData::GetData, ExtRemoteData::GetLong, ExtRemoteData::GetLong64, ExtRemoteData::GetUlongPtr
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtRemoteData::GetUlongPtr
The GetUlongPtr method returns an unsigned integer version (extended to ULONG64) of the ExtRemoteData object, which represents the contents of the target's memory.
The size of the unsigned integer from the target is the same size as a pointer on the target.
ULONG64
ExtRemoteData::GetUlongPtr(
void
) throw (...)
Parameters
None
Return Value
GetUlongPtr returns an unsigned integer version of the ExtRemoteData object, extended to ULONG64.
Comments
The size of the memory represented by the ExtRemoteData object must be the same as the size of a pointer on the target, ExtExtension::m_PtrSize.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
ExtRemoteData, ExtRemoteData::GetData, ExtRemoteData::GetLongPtr, ExtRemoteData::GetUlong, ExtRemoteData::GetUlong64
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtRemoteData::GetPtr
The GetPtr method returns a pointer from the target's memory version of the ExtRemoteData object, which represents the contents of the target's memory. The size of the
unsigned integer from the target is the same size as a pointer on the target.
ULONG64
ExtRemoteData::GetPtr(
void
) throw (...)
Parameters
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
None
Return Value
GetPtr returns a pointer from the target's memory. As with all pointers, if the target uses 32-bit pointers, it is sign-extended to 64-bits.
Comments
The size of the memory represented by the ExtRemoteData object must be the same as the size of a pointer on the target, ExtExtension::m_PtrSize.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
ExtRemoteData, ExtRemoteData::GetData, ExtRemoteData::GetLongPtr, ExtRemoteData::GetUlong, ExtRemoteData::GetUlong64
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtRemoteData::ReadBuffer
The ReadBuffer method reads data from the target's memory. The data is located in the beginning of the region represented by the ExtRemoteData object. However, the size
of the data can be different.
ULONG
ExtRemoteData::ReadBuffer(
OUT PVOID Buffer,
IN ULONG Bytes,
IN bool MustReadAll = true
) throw(...);
Parameters
Buffer
Pointer that receives the data read from the target.
Bytes
Specifies the number of bytes to read. The Buffer buffer must be at least this size.
MustReadAll
Specifies what happens if the debugger engine is unable to read all the data from the target. If MustReadAll is true and the debugger engine is unable to read Bytes
bytes from the target, an ExtRemoteException will be thrown. If MustReadAll is false, no exception will be thrown if the engine is unable to read the requested
number of bytes from the target.
Return Value
ReadBuffer returns the number of bytes read from the target and copied into the Buffer buffer. If MustReadAll is true, the value of Bytes will be returned (unless an
exception is thrown).
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
ExtRemoteData, ExtRemoteData::WriteBuffer
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtRemoteData::WriteBuffer
The WriteBuffer method writes data to the target's memory. The data is located in the beginning of the region represented by the ExtRemoteData object. However, the size
of the data can be different.
ULONG
ExtRemoteData::WriteBuffer(
IN PVOID Buffer,
IN ULONG Bytes,
IN bool MustReadAll = true
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
) throw(...);
Parameters
Buffer
Specifies the data to write to the target.
Bytes
Specifies the number of bytes to write. The Buffer buffer must be at least this size.
MustReadAll
Specifies what happens if the debugger engine is unable to write all the data to the target. If MustReadAll is true and the debugger engine is unable to write Bytes bytes
to the target, an ExtRemoteException will be thrown. If MustReadAll is false, no exception will be thrown if the engine is unable to write the requested number of
bytes to the target.
Return Value
WriteBuffer returns the number of bytes written to the target from the Buffer buffer. If MustReadAll is true, the value of Bytes will be returned (unless an exception is
thrown).
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
ExtRemoteData, ExtRemoteData::ReadBuffer
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtRemoteData::GetString
The GetString method reads a null-terminated string from the target's memory. The string is located in the beginning of the region represented by the ExtRemoteData object.
PSTR
GetString(
OUT PSTR Buffer,
IN ULONG BufferChars,
IN ULONG MaxChars = 1024,
IN bool MustFit = false
) throw(...);
PWSTR
GetString(
OUT PWSTR Buffer,
IN ULONG BufferChars,
IN ULONG MaxChars = 1024,
IN bool MustFit = false
) throw(...);
Parameters
Buffer
Receives the null-terminated string read from the target. The type of Buffer must be the same as the type of the string on the target. If the string is a Unicode string, the
type of Buffer must be PWSTR. If the string is a multibyte string, the type of Buffer must be PSTR.
Note the remainder of the Buffer buffer, after the string, can be overwritten by this method.
BufferChars
Specifies the size, in characters, of the Buffer buffer.
MaxChars
Specifies the maximum number of characters to read from the target.
MustFit
Specifies what happens if the string is larger than BufferChars characters. If MustFit is true and the string is larger than BufferChars characters, an
ExtRemoteException will be thrown. If MustFit is false and the string is larger than BufferChars characters, the string will be truncated and null-terminated to fit
inside the Buffer buffer.
Return Value
GetString returns the null-terminated string that was read from the target. This is Buffer.
Comments
This method can only be used if the region represented by the ExtRemoteData object is in virtual memory. It will not work if the region specifies physical memory.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
See Also
ExtRemoteData, ExtRemoteData::ReadBuffer
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtRemoteTyped
The ExtRemoteTyped class provides the ability to manipulate typed data on the target. An instance of this class represents a small region of memory on the target. This
region is interpreted as a specific type. This class provides methods for manipulating the memory according to the type and for accessing the object hierarchy on the target.
ExtRemoteTyped is a subclass of ExtRemoteData.
The ExtRemoteTyped class includes the following constructors, operators, and methods:
ExtRemoteTyped
operator=
Copy
Set
SetPrint
HasField
GetTypeSize
GetFieldSize
GetFieldOffset
Field
ArrayElement
Dereference
GetPointerTo
Eval
operator[]
operator*
GetTypeName
OutTypeName
OutSimpleValue
OutFullValue
OutTypeDefinition
Release
GetTypeFieldOffset
class ExtRemoteTyped : public ExtRemoteData
{
public:
DEBUG_TYPED_DATA m_Typed;
bool m_Release;
};
Members
m_Typed
The DEBUG_TYPED_DATA structure that describes the typed data represented by this instance of ExtRemoteTyped.
m_Release
Indicates whether or not the destructor for this instance of ExtRemoteTyped needs to release the DEBUG_TYPED_DATA structure that is specified in m_Typed.
Requirements
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
ExtRemoteTyped::ExtRemoteTyped
The ExtRemoteTyped constructors create a new instance of the ExtRemoteTyped class.
ExtRemoteTyped(
void
)
ExtRemoteTyped(
IN PCSTR Expr
) throw(...)
ExtRemoteTyped(
IN const DEBUG_TYPED_DATA *
) throw(...)
ExtRemoteTyped(
IN const ExtRemoteTyped &
) throw(...)
Typed
Typed
ExtRemoteTyped(
IN PCSTR Expr,
IN ULONG64 Offset
) throw(...)
ExtRemoteTyped(
IN PCSTR Type,
IN ULONG64 Offset,
IN bool PtrTo,
IN OUT OPTIONAL PULONG64 CacheCookie = NULL,
IN OPTIONAL PCSTR LinkField = NULL
) throw(...)
Parameters
Expr
An expression that evaluates to the desired symbol. This expression is evaluated by the default expression evaluator.
Offset
When used with Expr, specifies an additional parameter that can be used when evaluating the Expr expression. This additional parameter is available in the expression as
the $extin pseudo-register. For example, to specify a process environment block (PEB) at a particular location, you could set Expr to the C++ expression (ntdll!_PEB
*)@$extin. This casts the pseudo-register $extin to a pointer to a PEB. Then, set Offset to the location of the PEB structure.
When used with Type, Offset specifies the location of the data in the target's virtual address space.
Typed
The typed data represented by the RemoteExtTyped. This can be either a DEBUG_TYPED_DATA structure that describes the data and type to be represented by this
object, or, for the copy constructor, an existing ExtRemoteTyped object.
Type
The type name of the type. Type can include a module qualifier (for example, mymodule!mytype). The module qualifier can be omitted, but it is recommended that it be
included if the module is known.
PtrTo
Specifies whether or not to set the ExtRemoteTyped instance to the specified typed data, or to a pointer to the specified typed data. If PtrTo is true, the
ExtRemoteTyped instance will contain a pointer to the typed data.
CacheCookie
The cache cookie to use for caching type information. If CacheCookie is NULL, the debugger engine will search for type information each time.
For more information about CacheCookie, see ExtRemoteTyped::Set.
LinkField
The name of a field in the typed data that contains the pointer to the next item in a list. LinkField should be set if CacheCookie is being used for the first time and will
later be used with ExtRemoteTypedList.
Comments
The typed data can also be set or changed using the ExtRemoteTyped::Set method.
Requirements
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
ExtRemoteTyped::operator=
The operator= overloaded assignment operator sets the typed data represented by the ExtRemoteTyped object by copying the information from another object.
ExtRemoteTyped &
operator=(
IN const DEBUG_TYPED_DATA *
) throw(...)
ExtRemoteTyped &
operator=(
IN const ExtRemoteTyped &
) throw(...)
Typed
Typed
Parameters
Typed
The typed data description to copy. This becomes the typed data represented by this object. Typed can be either a DEBUG_TYPED_DATA structure that describes the
data and type to be represented by this object, or an existing ExtRemoteTyped object.
Return Value
operator= returns the ExtRemoteTyped object.
Comments
The typed data can also be copied using the ExtRemoteTyped::Copy method.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
For other methods used to set the initial values of ExtRemoteTyped, see
DEBUG_TYPED_DATA, ExtRemoteTyped, t
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtRemoteTyped::Copy
The Copy method sets the typed data represented by the ExtRemoteTyped object by copying the information from another object.
void
Copy(
IN const DEBUG_TYPED_DATA *
) throw(...)
void
Copy(
IN const ExtRemoteTyped &
) throw(...)
Typed
Typed
Parameters
Typed
The typed data description to copy. Tthis becomes the typed data represented by this object. Typed can be either a DEBUG_TYPED_DATA structure that describes the
data and type to be represented by this object, or an existing ExtRemoteTyped object.
Return Value
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
None
Comments
The typed data can also be copied using the ExtRemoteTyped::Copy method.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
DEBUG_TYPED_DATA, ExtRemoteTyped, ExtRemoteTyped::operator=
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtRemoteTyped::Set
The Set method sets the typed data represented by the ExtRemoteTyped object.
void
Set(
IN PCSTR
) throw(...)
Expr
void
Set(
IN PCSTR Expr,
IN ULONG64 Offset
) throw(...)
void
Set(
IN bool PtrTo,
IN ULONG64 TypeModBase,
IN ULONG TypeId,
IN ULONG64 Offset
) throw(...)
void
Set(
IN PCSTR Type,
IN ULONG64 Offset,
IN bool PtrTo,
IN OUT OPTIONAL PULONG64 CacheCookie = NULL,
IN OPTIONAL PCSTR LinkField = NULL
) throw(...)
Parameters
Expr
An expression that evaluates to the desired symbol. This expression is evaluated by the default expression evaluator.
Offset
When used with Expr, specifies an additional parameter that can be used when evaluating the Expr expression. This additional parameter is available in the expression as
the $extin pseudo-register. For example, to specify a process environment block (PEB) at a particular location, you could set Expr to the C++ expression (ntdll!_PEB
*)@$extin. This casts the pseudo-register $extin to a pointer to a PEB. Then, set Offset to the location of the PEB instance.
When used with Type or TypeId, Offset specifies the location of the data in the target's memory.
PtrTo
Specifies whether or not to set the ExtRemoteTyped instance to the specified typed data, or to a pointer to the specified typed data. If PtrTo is true, the
ExtRemoteTyped instance will be a pointer to the typed data.
TypeModBase
The base address of the module to which the type belongs.
TypeId
The type ID of the type.
Type
The type name of the type. Type can include a module qualifierfor example, mymodule!mytype. The module qualifier can be omitted, but it is recommended that it be
included if the module is known.
CacheCookie
A cache cookie used for caching the type information. If CacheCookie is NULL, the debugger engine will search for the type information each time.
A cache cookie is a pointer to a ULONG64. It is associated with a particular symbol that is uniquely identified by the symbol's type ID and the address of the module that
contains the symbol. The first time it is used, the ULONG64 that cache cookie points to must be set to 0. In this case, the debugger engine will search for the symbol
information and cache it, then it will set the cookie so that the symbol information can be easily retrieved later. Whenever you use a subsequent method that will need
information about the same symbol, use the cache cookie. The debugger engine will then be able to retrieve the symbol information from the cache instead of searching
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
for it. Each cache cookie should only be used with a single type. If a cache cookie is used in conjunction with a different symbol, the cache cookie might be corrupted.
LinkField
The name of a field in the typed data structure which contains the pointer to the next item in a list. LinkField should be set if CacheCookie is being used for the first time
and will later be used with ExtRemoteTypedList.
Return Value
None
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
ExtRemoteTyped, ExtRemoteTyped::SetPrint, ExtRemoteTypedList
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtRemoteTyped::SetPrint
The SetPrint method sets the typed data represented by the ExtRemoteTyped object by formatting an expression and then evaluating that expression.
void
ExtRemoteData::SetPrint(
IN PCSTR Format,
...
) throw(...)
Parameters
Format
The format string used to create the expression. This is the same as the format string used by the C printf function.
Note While other methods and functions in the debugger engine API provide additional, debugger-specific conversion characters, SetPrint only supports the conversion
characters used by printf.
The arguments for the format string, as in printf. The arguments should match the conversion characters in Format.
Return Value
None
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
ExtRemoteTyped, ExtRemoteTyped::Set
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtRemoteTyped::HasField
The HasField method determines if the type of the data represented by this object contains the specified member.
bool
ExtRemoteData::HasField(
IN PCSTR Field
)
Parameters
Field
The name of the member. The name of the member is a dot-separated path and can contain sub-members (for example, mymember.mysubmember). Pointers on this
dot-separated path will automatically be dereferenced. However, a dot operator (.) should still be used here instead of the usual C pointer dereference operator (->).
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Return Value
HasField returns true if the typed data contains the member; false otherwise.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtRemoteTyped::GetTypeSize
The GetTypeSize method returns the size of the type represented by this object.
ULONG
ExtRemoteData::GetTypeSize(
void
) throw(...)
Parameters
None
Return Value
GetTypeSize returns the size, in bytes, of instance of the type.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
GetTypeSize
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtRemoteTyped::GetFieldOffset
The GetFieldOffset method returns the offset of a member from the base address of an instance of the type that is represented by this object.
ULONG
ExtRemoteData::GetFieldOffset(
IN PCSTR Field
) throw(...)
Parameters
Field
The name of the member whose offset is requested. Sub-members can be specified using a dot-separated path (for example, mymember.mysubmember).
Return Value
GetFieldOffset returns the offset of the member from the base address of an instance of the type.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
GetFieldOffset, IDebugSymbols::GetFieldOffset
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
ExtRemoteTyped::Field
The Field method returns the typed data for a member in the typed data that is represented by this object.
ExtRemoteData
ExtRemoteData::Field(
IN PCSTR Field
) throw(...)
Parameters
Field
The name of the member whose typed data is requested. Sub-members can be specified using a dot-separated path (for example, mymember.mysubmember). Pointers
on this dot-separated path will automatically be dereferenced. However, a dot operator (.) should still be used here instead of the usual C pointer dereference operator (>).
Return Value
Field returns a new ExtRemoteTyped object that represents the typed data for the specified member.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtRemoteTyped::ArrayElement
The ArrayElement method returns the typed data in the specified array element of the typed data represented by the ExtRemoteTyped object.
ExtRemoteData
ExtRemoteData::ArrayElement(
IN LONG64 Index
) throw(...)
Parameters
Index
The index of the array element.
Return Value
ArrayElement returns a new ExtRemoteData object that represents the typed data for the specified element of the array.
Comments
If the typed data represented by this object is a pointer and not an array, the pointer is treated like an array.
The ExtRemoteTyped::operator[] overloaded operator performs a similar function.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
ExtRemoteTyped::operator[]
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtRemoteTyped::Dereference
The Dereference method returns the typed data that is pointed to by the typed data represented by this object.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
ExtRemoteData
ExtRemoteData::Dereference(
void
) throw(...)
Parameters
None
Return Value
Dereference returns a new ExtRemoteData object that represents the typed data pointed to by the typed data represented by this object.
Comments
If the typed data represented by this object is an array, the first element in the array is returned.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtRemoteTyped::GetPointerTo
The GetPointerTo method returns typed data that is a pointer to the typed data represented by this object.
ExtRemoteTyped
ExtRemoteData::GetPointerTo(
void
) throw(...)
Parameters
None
Return Value
GetPointerTo returns a new ExtRemoteData object that represents typed data that is a pointer to the typed data represented by this object.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtRemoteTyped::Eval
The Eval method returns typed data that is the result of evaluating an expression.
ExtRemoteData
ExtRemoteTyped::Eval(
IN PCSTR Expr
) throw(...)
Parameters
Expr
The expression to evaluate. Expr is evaluated using the default expression evaluator.
Return Value
Eval returns a new ExtRemoteData object that represents the typed data that is the result of evaluating the expression.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
ExtRemoteTyped::operator[]
The operator[] overloaded operator returns the typed data in the specified array element of the typed data represented by this object.
ExtRemoteTyped
ExtRemoteData::operator[](
IN LONG Index
)
ExtRemoteTyped
ExtRemoteData::operator[](
IN ULONG Index
)
ExtRemoteTyped
ExtRemoteData::operator[](
IN LONG64 Index
)
ExtRemoteTyped
ExtRemoteData::operator[](
IN ULONG64 Index
)
Parameters
Index
The index of the array element.
Return Value
The operator[] operator returns a new ExtRemoteTyped object that represents the typed data for the specified element of the array.
Comments
If the typed data represented by this object is a pointer and not an array, the pointer is treated like an array.
The ExtRemoteTyped::ArrayElement performs a similar function.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
ExtRemoteTyped::ArrayElement
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtRemoteTyped::operator*
The operator* overloaded operator returns the typed data that is pointed to by the typed data represented by this object.
ExtRemoteData
ExtRemoteData::operator*(
void
)
Parameters
None
Return Value
The operator* operator returns a new ExtRemoteData object that represents the typed data pointed to by the typed data represented by this object.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Comments
If the typed data represented by this object is an array, the first element in the array is returned.
The ExtRemoteTyped::Dereference method performs the same function.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
ExtRemoteTyped::Dereference
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtRemoteTyped::GetTypeName
The GetTypeName method returns the type name of the typed data represented by this object.
PSTR
ExtRemoteData::GetTypeName(
void
) throw (...)
Parameters
None
Return Value
GetTypeName returns a string that contains the name of the type.
Note The returned string is part of a buffer maintained by the ExtExtension superclass of the global EXT_CLASS instance that is declared using
EXT_DECLARE_GLOBALS. Subsequent calls to methods in the EngExtCpp extension framework API might overwrite this string.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
EXT_CLASS, EXT_DECLARE_GLOBALS, ExtExtension
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtRemoteTyped::OutTypeName
The OutTypeName method prints the type name of the typed data represented by this object.
void
ExtRemoteData::OutTypeName(
void
) throw(...)
Parameters
None
Return Value
None
Comments
The type name is sent to the debugger engine's output callbacks.
Requirements
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
ExtRemoteTyped::OutSimpleValue
The OutSimpleValue method prints the value of the typed data represented by this object.
void
ExtRemoteData::OutSimpleValue(
void
) throw(...)
Parameters
None
Return Value
None
Comments
The OutSimpleValue method does not print as much detail as the ExtRemoteTyped::OutFullValue method.
The value is sent to the debugger engine's output callbacks.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
ExtRemoteTyped::OutFullValue
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtRemoteTyped::OutFullValue
The OutFullValue method prints the type and value of the typed data represented by this object.
void
ExtRemoteData::OutFullValue(
void
) throw(...)
Parameters
None
Return Value
None
Comments
The OutFullValue method prints more detail than the ExtRemoteTyped::OutSimpleValue method. For example, OutFullValue prints dereferenced pointers and the values
that they point to.
The type and value information is sent to the debugger engine's output callbacks.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
ExtRemoteTyped::OutSimpleValue
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
ExtRemoteTyped::OutTypeDefinition
The OutTypeDefinition method prints the type of the typed data represented by this object.
void
ExtRemoteData::OutTypeDefinition(
void
) throw(...)
Parameters
None
Return Value
None
Comments
The type is sent to the debugger engine's output callbacks.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtRemoteTyped::Release
The Release method releases any resources held by this object.
void
ExtRemoteData::Release(
void
)
Parameters
None
Return Value
None
Comments
The Release method is called by the destructor and does not need to be called directly. However, since there is no harm in calling this method multiple times, it can be used to
manage resources.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtRemoteTyped::GetTypeFieldOffset
The GetTypeFieldOffset static method returns the offset of a member within a structure.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
static
ULONG
ExtRemoteTyped::GetTypeFieldOffset(
IN PCSTR Type,
IN PCSTR Field
) throw(...)
Parameters
Type
The name of the type of the structure. This can be qualified with a module name, for example, mymodule!mystruct.
Field
The name of the member in the structure. You can specify sub-members by using a dot operator (.) (for example, mymember.mysubmember).
Return Value
GetTypeFieldOffset returns the number of bytes between the address of an instance of the structure and address of the instance's member.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtRemoteList
The ExtRemoteList class provides a wrapper around a singly-linked or doubly-linked list. The class contains methods that can be used to move both forward and backward
through the list.
ExtRemoteList supports both NULL-terminated and circular lists.
Note ExtRemoteList expects that a list is lists implemented in the way that NT-based versions of Windows implements a list. It also expects that the list uses the
SINGLE_LIST_ENTRY or LIST_ENTRY structure. In particular, ExtRemoteList expects the lists to have the following characteristics:
1. The list has a head. The head represents the beginning (and, for circular and doubly-linked lists, the end) of the list and is not a list item. The type of the head is
SINGLE_LIST_ENTRY or LIST_ENTRY.
2. The pointer to the next item in the list points to the pointer to the following item. In other words, the pointer to the next item points to the SINGLE_LIST_ENTRY or
LIST_ENTRY structure embedded in the next item.
3. For doubly-linked lists, the pointer to the previous item in the list points to the pointer to the current item. In other words, the pointer to the previous item points to the
LIST_ENTRY structure embedded in the previous item.
4. For doubly-linked lists, the pointer to the previous item immediately follows the pointer to the next item. This matches the layout of the LIST_ENTRY structure in
memory.
For more information about the SINGLE_LIST_ENTRY and LIST_ENTRY structures and their use, see the Windows Driver Kit (WDK) documentation.
The ExtRemoteList class includes the following methods:
ExtRemoteList
StartHead
StartTail
HasNode
GetNodeOffset
Next
Prev
class ExtRemoteList
{
public:
ULONG64 m_Head;
ULONG m_LinkOffset;
bool m_Double;
ULONG m_MaxIter;
ExtRemoteData m_Node;
ULONG m_CurIter;
};
Members
m_Head
The location in the target's memory of the head of the list.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
m_LinkOffset
The offset of the SINGLE_LIST_ENTRY or LIST_ENTRY structures embedded within the list items.
m_Double
true for a doubly-linked list. false for a singly-linked list.
m_MaxIter
The maximum number of nodes that can be returned when iterating over the list. The default value of m_MaxIter is 65536. Limiting the number of nodes that can be
returned in an iteration protects against loops.
m_Node
The pointer to the current item in the list. m_Node is not set until an iteration is initialized using StartHead or StartTail. m_Node is of type ExtRemoteData, which
describes the pointer.
m_CurIter
The number of steps taken in the current list iteration. For doubly-linked lists, m_CurIter is increased for both forward and backward steps.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
ExtRemoteData, StartHead, StartTail
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtRemoteList::ExtRemoteList
The ExtRemoteList constructors create a new instance that wraps a singly-linked or doubly-linked list.
ExtRemoteList(
IN ULONG64 Head,
IN ULONG LinkOffset,
IN bool Double = false
)
ExtRemoteList(
IN ExtRemoteData & Head,
IN ULONG LinkOffset,
IN bool Double = false
)
Parameters
Head
The location, in the target's memory, of the head of the list. The head is not considered to be an item in the list. The type of the head of the list is SINGLE_LIST_ENTRY
or LIST_ENTRY.
LinkOffset
The offset from the beginning of a list item to the pointer to the next item in the list. This is the offset of the SINGLE_LIST_ENTRY or LIST_ENTRY structure
embedded within the list item structure.
Double
Specifies whether the list is singly-linked or doubly-linked. If Double is true, the list is doubly-linked. If Double is false, the list is singly-linked.
Comments
For more information about the SINGLE_LIST_ENTRY and LIST_ENTRY structures, see the Windows Driver Kit (WDK) documentation.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtRemoteList::StartHead
The StartHead method initializes the list for iterating forward starting at the head.
void
ExtRemoteData::StartHead(
void
)
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Parameters
None
Return Value
None
Comments
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtRemoteList::StartTail
The StartTail method initializes the list for iterating backward, starting at the head.
void
ExtRemoteData::StartTail(
void
)
Parameters
None
Return Value
None
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtRemoteList::HasNode
The HasNode method determines if there is a current item in the list iteration.
bool
ExtRemoteData::HasNode(
void
)
Parameters
None
Return Value
HasNode returns true if there is a current item in the list iteration, and false otherwise.
Comments
If this method returns true, ExtRemoteList::GetNodeOffset can be used to return the current item in the list.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
ExtRemoteList::GetNodeOffset
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
ExtRemoteList::GetNodeOffset
The GetNodeOffset method returns the address of the current list item.
ULONG64
ExtRemoteData::GetNodeOffset(
void
)
Parameters
None
Return Value
GetNodeOffset returns the location, in the target's memory, of the current item for the current list iteration.
Note This is the location of the start of the item. It is not the location of the SINGLE_LIST_ENTRY or LIST_ENTRY structure.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtRemoteList::Next
The Next method changes the current item to the next item in the list.
void
ExtRemoteData::Next(
void
)
Parameters
None
Return Value
None
Comments
If Next reaches the end of the list, subsequent calls to ExtRemoteList::HasNode will return false.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
ExtRemoteList::HasNode
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtRemoteList::Prev
The Prev method changes the current item to the previous item in the list.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
void
ExtRemoteList::Prev(
void
)
Parameters
None
Return Value
None
Comments
This method can only be used when iterating over doubly-linked lists.
If Prev reaches the end of the list, subsequent calls to ExtRemoteList::HasNode will return false.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
ExtRemoteList::HasNode
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtRemoteTypedList
The ExtRemoteTypedList class extends the ExtRemoteList class. The ExtRemoteTypedList class adds type information allowing each item in the list to be represented by
an instance of the ExtRemoteTyped class.
The ExtRemoteTypedList class includes the following constructors and methods:
ExtRemoteTypedList
SetTypeAndLink
GetTypedNodePtr
GetTypedNode
class ExtRemoteTypedList : public ExtRemoteList
{
public:
PCSTR m_Type;
ULONG64 m_TypeModBase;
ULONG m_TypeId;
};
Members
m_Type
The type name for the list items. Type can include a module qualifier (for example, mymodule!mytype). If m_TypeId is not zero, Type is not used.
m_TypeModBase
The location in the target's memory of the base address of the module that contains the type specified by m_TypeId. If m_TypeId is zero, m_TypeModBase is not used.
m_TypeId
The type ID of the type relative to the module specified by m_TypeModBase. If m_TypeId is zero, m_Type is used to specify the type of the list items.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
ExtRemoteList, ExtRemoteTyped, ExtRemoteTypedList, GetTypedNode, GetTypedNodePtr, SetTypeAndLink
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
ExtRemoteTypedList::ExtRemoteTypedList
The ExtRemoteTypedList constructors create a new instance that wraps a typed singly-linked or doubly-linked list.
ExtRemoteTypedList(
IN ULONG64 Head,
IN PCSTR Type,
IN PCSTR LinkField,
IN ULONG64 TypeModBase = 0,
IN ULONG TypeId = 0,
IN OUT PULONG64 CacheCookie = NULL,
IN bool Double = false
) throw(...)
ExtRemoteTypedList(
IN ExtRemoteData & Head,
IN PCSTR Type,
IN PCSTR LinkField,
IN ULONG64 TypeModBase = 0,
IN ULONG TypeId = 0,
IN OUT OPTIONAL PULONG64 CacheCookie = NULL,
IN bool Double = false
) throw(...)
Parameters
Head
The location, in the target's memory, of the head of the list. The head is not considered to be an item in the list. The type of the head of the list is SINGLE_LIST_ENTRY
or LIST_ENTRY.
Type
The type name for the list items. Type can include a module qualifier (for example, mymodule!mytype). If TypeId is not zero, Type is not used.
LinkField
The name of the field of the typed data structure that contains the pointer to the next list item. This is either the SINGLE_LIST_ENTRY structure or the LIST_ENTRY
structure embedded in the list item.
TypeModBase
The location in the target's memory of the base address of the module that contains the type specified by TypeId. If TypeId is zero, TypeModBase is not used.
TypeId
The type ID of the type relative to the module specified by TypeModBase. If TypeId is zero, Type is used to specify the type of the list items.
CacheCookie
The cache cookie to use for caching the type information. If CacheCookie is NULL, the debugger engine will search for the type information each time.
For more information about CacheCookie, see ExtRemoteTyped::Set.
Double
Specifies whether the list is singly-linked or doubly-linked. If Double is true, the list is doubly-linked. If Double is false, the list is singly-linked.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
ExtRemoteTyped::Set
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtRemoteTypedList::SetTypeAndLink
The SetTypeAndLink method sets the type information for the typed list.
void
ExtRemoteData::SetTypeAndLink(
IN PCSTR Type,
IN PCSTR LinkField,
IN ULONG64 TypeModBase = 0,
IN ULONG TypeId = 0,
IN OUT OPTIONAL PULONG64 CacheCookie = NULL
) throw(...)
Parameters
Type
The type name for the list items. Type can include a module qualifier (for example, mymodule!mytype). If TypeId is not zero, Type is not used.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
LinkField
The name of the field of the typed data structure that contains the pointer to the next list item. This is either the SINGLE_LIST_ENTRY structure or the LIST_ENTRY
structure embedded in the list item.
TypeModBase
The location in the target's memory of the base address of the module that contains the type specified by TypeId. If TypeId is zero, TypeModBase is not used.
TypeId
The type ID of the type relative to the module specified by TypeModBase. If TypeId is zero, Type is used to specify the type of the list items.
CacheCookie
The cache cookie to use for caching the type information. If CacheCookie is NULL, the debugger engine will search for the type information each time.
For more information about CacheCookie, see ExtRemoteTyped::Set.
Return Value
None
Comments
For more information about the SINGLE_LIST_ENTRY and LIST_ENTRY structures, see the Windows Driver Kit documentation.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
See Also
ExtRemoteTyped::Set
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtRemoteTypedList::GetTypedNodePtr
The GetTypedNodePtr method returns a pointer to the current list item.
ExtRemoteTyped
ExtRemoteData::GetTypedNodePtr(
void
) throw(...)
Parameters
None
Return Value
GetTypedNodePtr returns a typed data description of a pointer to the current list item.
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtRemoteTypedList::GetTypedNode
The GetTypedNode method returns the current list item.
ExtRemoteTyped
ExtRemoteTypedList::GetTypedNode(
void
) throw(...)
Parameters
None
Return Value
GetTypedNode returns a typed data description of the current list item.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Requirements
Headers: Defined in Engextcpp.hpp. Include Engextcpp.hpp.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
hCurrentProcess,
hCurrentThread,
dwCurrentPc,
dwProcessor,
args
\
\
\
\
\
\
\
\
If you are using 32-bit pointers, DECLARE_API remains the same, except that dwCurrentPc will be of the type ULONG instead of ULONG64. However, 64-bit pointers are
recommended for any extension that you are writing. See 32-Bit Pointers and 64-Bit Pointers for details.
2009 Microsoft Corporation
Send feedback on this topic
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
To check the low 4 GB of memory for corruption when using physical address extension (PAE), use the Ioctl operation IG_LOWMEM_CHECK.
Physical Memory
Physical memory can only be directly accessed in kernel-mode debugging.
The physical memory on the target can be read by using the ReadPhysical and ReadPhysicalWithFlags functions, and written by using the WritePhysical and
WritePhysicalWithFlags functions.
To search the physical memory for pointers to locations within a specified range, use the Ioctl operation IG_POINTER_SEARCH_PHYSICAL.
Other Data Spaces
In kernel-mode debugging, it is possible to read and write data to a variety of data spaces in addition to the main memory. The following data spaces can be accessed:
Control-Space Memory
The functions ReadControlSpace, ReadControlSpace64, ReadTypedControlSpace32, and ReadTypedControlSpace64 will read data from a control space. The
WriteControlSpace function will write data to a control space.
I/O Memory
The functions ReadIoSpace, ReadIoSpace64, ReadIoSpace64, ReadIoSpaceEx64 will read data from system I/O memory and bus I/O memory. The functions
WriteIoSpace, WriteIoSpace64, WriteIoSpaceEx, and WriteIoSpaceEx64 will write data to system I/O memory and bus I/O memory.
Model Specific Register (MSR)
The functions ReadMsr and WriteMsr read and write MSRs.
System Bus
The Ioctl operations IG_GET_BUS_DATA and IG_SET_BUS_DATA read and write system bus data.
Additional Information
For a more powerful memory access API, see Memory Access in the Using the Debugger Engine API section of this documentation.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
WdbgExts Symbols
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
This topic provides a brief overview of how symbols can be manipulated using the WdbgExts API. For an overview of using symbols in the debugger engine, see Symbols in
the Debugger Engine Overview section of this documentation.
To evaluate a MASM or C++ expression, use the functions GetExpression or GetExpressionEx.
To read the value of a member in a structure, use the GetFieldData function or, if, the member contains a primitive value, GetFieldValue can be used. To determine the size
of an instance of a symbol in the target's memory, use the GetTypeSize function.
To locate the offset of a member in a structure, use the GetFieldOffset function.
To read multiple members in a structure, first use the InitTypeRead function to initialize the structure. Then, you can use the ReadField function to read the members with
size less than or equal to 8 bytes one at a time. For structure addresses in physical memory, use the InitTypeReadPhysical function instead of InitTypeRead.
There are two functions that you can use for iterating over linked lists. For doubly-linked lists that use the LIST_ENTRY32 or LIST_ENTRY64 structures, the function
ReadListEntry can be used to find the next and previous entries. The function ListType will iterate over all the entries in a linked list and call a callback function for each
entry.
To locate a symbol near a specified address in the target's memory, use the GetSymbol function.
To delete all the symbol information from the debugger engine's cache, use the ReloadSymbols function. To read or change the symbol path, which is used to search for
symbol files, use the GetSetSympath function.
Almost all symbol operations provided by the debugger engine can be executed using the Ioctl operation IG_DUMP_SYMBOL_INFO. However, while being a very
flexible function, it is advanced and we recommend that you use the above simpler functions where applicable.
Additional Information
For a more powerful symbols API, see Using Symbols in the Using the Debugger Engine API section of this documentation.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
The WDK has several different build environment windows. Each of these has a corresponding shortcut placed in the Start menu when the WDK is installed. To build
a debugger extension, you must use the latest Windows build environment, regardless of what platform you will be running the extension on.
The Build utility is usually not able to compile code that is located in a directory path that contains spaces. Your extension code should be located in a directory whose
full path contains no spaces. (In particular, this means that if you install Debugging Tools for Windows to the default location Program Files\Debugging Tools for
Windows you will not be able to build the sample extensions.)
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
WinDbgExtensionDllInit
The WinDbgExtensionDllInit callback function is used to load and initialize the extension module.
VOID
WinDbgExtensionDllInit(
PWINDBG_EXTENSION_APIS64
USHORT MajorVersion
USHORT MinorVersion
lpExtensionApis
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
);
Parameters
lpExtensionApis
Receives a pointer to a WINDBG_EXTENSION_APIS64 structure. This structure contains the callbacks to functions that you can use to do standard operations. Save the
pointer in a global variable named ExtensionApis.
MajorVersion
Specifies the Microsoft Windows build type. A value of 0xC indicates the checked build of Windows; a value of 0xF indicates the free build of Windows. Save this value
in a global variable named SavedMajorVersion.
MinorVersion
Specifies the Windows build number of the target system. For example, 2600. Save this value in a global variable named SavedMinorVersion.
Return Value
None
Headers
You must define this function in your code using the prototype above. Include wdbgext.h.
Comments
WinDbgExtensionDllInit is called by the debugger when the extension DLL is loaded.
It is recommended that you always use 64-bit pointers in your code, since the debugger will automatically resize these pointers when necessary. See 32-Bit Pointers and 64Bit Pointers for details. However, if you choose to use 32-bit pointers, the first parameter of WinDbgExtensionDllInit will have the type PWINDBG_EXTENSION_APIS
instead of PWINDBG_EXTENSION_APIS64.
Additional Information
For more details, see Using WdbgExts Extension Callbacks.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ExtensionApiVersion
The ExtensionApiVersion callback function returns version information about the extension DLL.
LPEXT_API_VERSION
ExtensionApiVersion(
VOID
);
Parameters
None
Return Value
This function must return a pointer to an API_VERSION structure.
Headers
You must define this function in your code using the prototype above. Include wdbgext.h.
Comments
ExtensionApiVersion is called by the debugger when the extension DLL is loaded.
The debugger uses the MajorVersion and MinorVersion fields of the returned API_VERSION structure when executing commands like .chain and version that display the
extension version number. The debugger does not perform any "version checking" the extension DLL will be loaded regardless of what version numbers are present in
these fields.
The Revision field of the returned API_VERSION structure should be EXT_API_VERSION_NUMBER64 if you are using 64-bit pointers in your code, or
EXT_API_VERSION_NUMBER32 if you are using 32-bit pointers. It is recommended that you always use 64-bit pointers in your code, since the debugger will
automatically resize these pointers when necessary. See 32-Bit Pointers and 64-Bit Pointers for details.
Additional Information
For more details, see Using WdbgExts Extension Callbacks.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
CheckVersion
The CheckVersion callback function verifies that the extension module version matches the debugger version, and outputs an warning message if there is a mismatch.
VOID
CheckVersion(
VOID
);
Parameters
None
Return Value
None
Headers
You must define this function in your code using the prototype above. Include wdbgext.h.
Comments
CheckVersion is an optional callback function. If it exists, it will be called by the debugger the first time an extension function exported by the extension DLL is used.
The purpose of this function is to allow you to print out a version mismatch warning when the extension DLL is used. This is an optional feature, which should not be
confused with the version number used by ExtensionApiVersion.
If the .noversion command is used, version checking is disabled and the debugger will not call CheckVersion.
Additional Information
For more details, see Using WdbgExts Extension Callbacks.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
WdbgExts Functions
The wdbgexts.h header file contains prototypes for the following functions. These functions use the same prototype for both 32-bit and 64-bit extensions:
GetContext
SetContext
CheckControlC
GetCurrentProcessAddr
GetCurrentProcessHandle
GetCurrentThreadAddr
GetDebuggerCacheSize
GetDebuggerData
Disasm
dprintf
GetExpression
GetExpressionEx
GetInputLine
Ioctl
GetKdContext
ReadMemory
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
SearchMemory
WriteMemory
ReadMsr
WriteMsr
GetPebAddress
ReadPhysical
ReadPhysicalWithFlags
WritePhysical
WritePhysicalWithFlags
GetTebAddress
StackTrace
GetSymbol
ReloadSymbols
GetSetSympath
TranslateVirtualToPhysical
The wdbgexts.h header file contains prototypes for the following functions. These functions have different prototypes for 32-bit and 64-bit extensions:
ReadControlSpace
ReadControlSpace64
ReadTypedControlSpace32
ReadTypedControlSpace64
WriteControlSpace
ReadIoSpace
ReadIoSpace64
ReadIoSpaceEx
ReadIoSpaceEx64
WriteIoSpace
WriteIoSpace64
WriteIoSpaceEx
WriteIoSpaceEx64
SetThreadForOperation
SetThreadForOperation64
The wdbgexts.h header file contains prototypes for the following functions. These functions can be used only in 64-bit extensions:
GetFieldData
GetFieldOffset
GetFieldValue
GetShortField
ReadField
ReadListEntry
ReadPointer
WritePointer
IsPtr64
ReadPtr
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetTypeSize
InitTypeRead
InitTypeReadPhysical
ListType
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetContext
The GetContext function is similar to the Microsoft Win32 GetThreadContext routine. It returns the context of the process being debugged.
ULONG
GetContext (
ULONG Target,
PCONTEXT lpContext,
ULONG cbSizeOfContext
);
Parameters
Target
User mode: Specifies the thread ID of the thread being debugged.
Kernel Mode: Specifies the processor number of the processor being debugged.
lpContext
Points to the address of a context structure that receives the appropriate context of the process being debugged. The context structure is highly machine-specific.
cbSizeOfContext
Specifies the size of the context structure.
Return Value
If the routine succeeds, the return value is TRUE; otherwise, it is FALSE.
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SetContext
The SetContext function is similar to the Win32 SetThreadContext routine. It sets the context of the process being debugged.
ULONG
SetContext (
ULONG Target,
PCONTEXT lpContext,
ULONG cbSizeOfContext
);
Parameters
Target
User mode: Specifies the thread ID of the thread being debugged.
Kernel Mode: Specifies the processor number of the processor being debugged.
lpContext
Points to the address of a context structure that contains the context to be set for the process being debugged. The context structure is highly machine-specific.
cbSizeOfContext
Specifies the size of the context structure.
Return Value
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
CheckControlC
The CheckControlC function checks to see if the user pressed CTRL+C. Use CheckControlC in all loops to allow the user to press CTRL+C to end long processes.
ULONG
CheckControlC (
VOID
);
Parameters
None.
Return Value
If the user has pressed CTRL+C, the return value is TRUE; otherwise, it is FALSE.
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetCurrentProcessAddr
The GetCurrentProcessAddr function returns the location of the system data that describes the current process.
VOID
GetCurrentProcessAddr(
DWORD Processor,
ULONG64 CurrentThread,
PULONG64 Address
);
Parameters
Processor
Specifies the index of the processor or virtual thread that was running the current thread when the last event occurred. Processor is only used in kernel-mode debugging;
and, only if CurrentThread is NULL.
CurrentThread
Specifies the location of the system data for the current thread. This is the location returned by GetCurrentThreadAddr.
In kernel-mode debugging, CurrentThread can be NULL, in which case Processor is used instead.
Address
Receives the location of the system data that describes the current process.
Return Value
None
Comments
In user-mode debugging, GetCurrentProcessAddr returns the location of the process's Process Environment Block (PEB). This is the same location that GetPebAddress
returns.
In kernel-mode debugging, GetCurrentProcessAddr returns the location of the KPROCESS structure of the current process.
For details on the KPROCESS and PEB structures, see Microsoft Windows Internals by David Solomon and Mark Russinovich.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
See Also
GetCurrentThreadAddr, GetPebAddress
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetCurrentProcessHandle
The GetCurrentProcessHandle function returns the system handle for the current process.
VOID
GetCurrentProcessHandle(
PHANDLE hp
);
Parameters
hp
Receives the system handle for the current process.
Return Value
None
Comments
In kernel-mode debugging, the only process in the target is the virtual process created for the kernel. In this case, an artificial handle is created. The artificial handle can only
be used with the debugger.
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetCurrentThreadAddr
The GetCurrentThreadAddr function returns the location of the system data that describes the current thread.
VOID
GetCurrentThreadAddr(
DWORD Processor,
PULONG64 Address
);
Parameters
Processor
Specifies the index of the thread whose system data will be returned.
In kernel-mode debugging, this is the index of a virtual thread, which is the index of a processor on the target computer.
Address
Receives the location of the system data for the thread.
Return Value
None
Comments
In user-mode debugging, GetCurrentThreadAddr returns the location of the thread's Thread Environment Block (TEB). This is the same location that GetTebAddress
returns.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
In kernel-mode debugging, GetCurrentThreadAddr returns the location of the KTHREAD structure of the operating system thread that was executing on the processor
when the last event occurred.
For details on the KTHREAD and TEB structures, see Microsoft Windows Internals by David Solomon and Mark Russinovich.
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
See Also
GetTebAddress
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetDebuggerCacheSize
The GetDebuggerCacheSize function returns the size of the cache that is used by the debugger to hold data that was obtained from the target.
BOOL
GetDebuggerCacheSize(
OUT PULONG64 CacheSize
);
Parameters
CacheSize
Receives the size of the debugger's cache.
Return Value
If the function succeeds, the return value is TRUE; otherwise, it is FALSE.
Comments
The size of the cache can be set and retrieved by using the .cache command.
Each target process has its own cache. The returned size is the size of the cache for the current target.
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
See Also
.cache (Set Cache Size)
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetDebuggerData
The GetDebuggerData function retrieves information stored in a data block.
ULONG
GetDebuggerData (
ULONG Tag,
PVOID Buf,
ULONG Size
);
Parameters
Tag
This should be set equal to KDBG_TAG. (This value is specified in wdbgexts.h.)
Buf
Points to the debugger data block.
Size
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Disasm
The Disasm function disassembles the instruction pointed to by lpOffset and places the printable string into lpBuffer.
ULONG
Disasm (
PULONG lpOffset,
PCSTR lpBuffer,
ULONG fShowEffectiveAddress
);
Parameters
lpOffset
Points to the instruction to be disassembled.
lpBuffer
Receives the disassembled instruction.
fShowEffectiveAddress
Specifies whether or not to print the effective address.
Return Value
If the routine succeeds, the return value is TRUE; otherwise, it is FALSE.
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
dprintf
The dprintf function prints a formatted string to the Debugger Command window. It works like the C-language routine printf.
VOID
dprintf (
PCSTR format
. . . . [arguments]
);
Parameters
format
Specifies the format string, as in printf. In general, conversion characters work exactly as in C. For the floating-point conversion characters the 64-bit argument is
interpreted as a 32-bit floating-point number unless the l modifier is used.
The %p conversion character is supported, but it represents a pointer in the target's virtual address space. It may not have any modifiers and it uses the debugger's
internal address formatting. The following additional conversion characters are supported:
Character
Argument Type
%p
ULONG64
%N
DWORD_PTR (32 or 64 bits,
Argument
Pointer in the target's virtual address space
Pointer in the host's virtual address space
Text printed
The value of the pointer.
The value of the pointer. (This is equivalent to the standard C %p
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
%I
%ma
ULONG64
%mu
ULONG64
%msa
ULONG64
%msu
ULONG64
%y
ULONG64
%ly
ULONG64
character.)
The specified value. If this is greater than 0xFFFFFFFF it is
printed as a 64-bit address, otherwise it is printed as a 32-bit
address.
The specified string.
The specified string.
The specified string.
The specified string.
String containing the name of the specified symbol (and
displacement, if any).
String containing the name of the specified symbol (and
displacement, if any), as well as any available source line
information.
arguments
Specifies arguments for the format string, as in printf. The number of arguments specified should match the number of conversion characters in FormatString. Each
argument is an expression that will be evaluated by the default expression evaluator (MASM or C++). For details, see Numerical Expression Syntax.
Return Value
None
Comments
When generating very large output strings, it is possible the limits of the debugger engine or operating system may be reached. For example, some versions of the debugger
engine have a 16K character limit for a single piece of output. If you find that very large output is getting truncated, you may need to split your output into multiple requests.
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetExpression
The GetExpression function returns the value of expression. The expression is evaluated using the current expression evaluator, and can contain aliases.
ULONG
GetExpression (
PCSTR expression
);
Parameters
expression
Specifies the expression to evaluate.
Return Value
The value of the expression passed to GetExpression.
Comments
The expression is evaluated by the current expression evaluator (either the MASM or C++ expression evaluator); see Numerical Expression Syntax for details. Aliases will be
properly understood; see Using Aliases for details.
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetExpressionEx
The GetExpressionEx function evaluates an expression. The expression is evaluated using the MASM evaluator, and can contain aliases.
BOOL
GetExpressionEx(
PCSTR Expression,
ULONG64 * Value,
PCSTR * Remainder
);
Parameters
Expression
Specifies the expression to evaluate. The expression uses the MASM syntax. For details of this syntax, see MASM Numbers and Operators.
Value
Receives the value of the expression.
Remainder
Receives a pointer to the first character in the expression Expression that was not used in the evaluation of the expression.
Return Value
GetExpressionEx returns one of the following values:
TRUE
The expression was evaluated successfully.
FALSE
An error occurred while attempting to evaluate the expression.
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
See Also
GetExpression
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetInputLine
The GetInputLine function requests an input string from the debugger.
ULONG
GetInputLine(
PCSTR Prompt,
PSTR Buffer,
ULONG BufferSize
);
Parameters
Prompt
Specifies a prompt to indicate what input is being requested. The prompt is printed to the debugger's output before the input is gathered. If Prompt is NULL, no prompt is
printed.
Buffer
Specifies the buffer to receive the input.
BufferSize
Specifies the size, in characters, of the buffer Buffer.
Return Value
GetInputLine returns the size, in characters, of the input returned to the Buffer buffer, or zero, if no input was returned.
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Ioctl
The Ioctl function performs a variety of different operations. Much of its functionality mirrors the functionality of other functions in wdbgexts.h.
ULONG
Ioctl (
USHORT IoctlType,
PVOID lpvData,
ULONG cbSizeOfContext
);
Parameters
IoctlType
Specifies which Ioctl operation to perform. For a list of possible IoctlType values, see the Comments section.
lpvData
Points to the address of a data structure. The type of structure that is required depends on the value of IoctlType.
cbSizeOfContext
Specifies the size of the structure that lpvData points to.
Return Value
The meaning of return value depends on IoctlType. See the page for the corresponding Ioctl operation for the meaning of the return value.
Comments
The Ioctl function is the entry point for many of the functionalities supplied for WdbgExts extensions. Many of the other functions in wdbgexts.h are simply wrappers for calls
to Ioctl.
The following table lists the possible IoctlType values. If the IoctlType corresponds to another function, that function is provided; otherwise, a link to the page describing the
Ioctl operation is provided.
IoctlType constant
IG_KD_CONTEXT
IG_READ_CONTROL_SPACE
Equivalent function
GetKdContext
ReadControlSpace
ReadControlSpace64
IG_WRITE_CONTROL_SPACE
IG_READ_IO_SPACE
WriteControlSpace
ReadIoSpace
ReadIoSpace64
IG_WRITE_IO_SPACE
WriteIoSpace
WriteIoSpace64
IG_READ_PHYSICAL
IG_WRITE_PHYSICAL
IG_READ_IO_SPACE_EX
ReadPhysical
WritePhysical
ReadIoSpaceEx
ReadIoSpaceEx64
IG_WRITE_IO_SPACE_EX
WriteIoSpaceEx
WriteIoSpaceEx64
IG_SET_THREAD
SetThreadForOperation
SetThreadForOperation64
IG_READ_MSR
IG_WRITE_MSR
IG_GET_DEBUGGER_DATA
IG_GET_KERNEL_VERSION
IG_RELOAD_SYMBOLS
IG_GET_SET_SYMPATH
IG_GET_EXCEPTION_RECORD
IG_IS_PTR64
IG_GET_BUS_DATA
IG_SET_BUS_DATA
IG_DUMP_SYMBOL_INFO
IG_LOWMEM_CHECK
IG_SEARCH_MEMORY
ReadMsr
WriteMsr
GetDebuggerData
ReloadSymbols
GetSetSympath
IsPtr64
SearchMemory
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
IG_GET_CURRENT_THREAD
GetCurrentThreadAddr
IG_GET_CURRENT_PROCESS
GetCurrentProcessAddr
IG_GET_TYPE_SIZE
GetTypeSize
IG_GET_CURRENT_PROCESS_HANDLE
GetCurrentProcessHandle
IG_GET_INPUT_LINE
GetInputLine
IG_GET_EXPRESSION_EX
GetExpressionEx
IG_TRANSLATE_VIRTUAL_TO_PHYSICAL TranslateVirtualToPhysical
IG_GET_CACHE_SIZE
GetDebuggerCacheSize
IG_READ_PHYSICAL_WITH_FLAGS
ReadPhysicalWithFlags
IG_WRITE_PHYSICAL_WITH_FLAGS
WritePhysicalWithFlags
IG_POINTER_SEARCH_PHYSICAL
IG_GET_THREAD_OS_INFO
IG_GET_CLR_DATA_INTERFACE
IG_GET_TEB_ADDRESS
GetTebAddress
IG_GET_PEB_ADDRESS
GetPebAddress
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
IG_DUMP_SYMBOL_INFO
The IG_DUMP_SYMBOL_INFO Ioctl operation provides information about the type of a symbol. When calling Ioctl with IoctlType set to IG_DUMP_SYMBOL_INFO,
IpvData should contain an instance of the SYM_DUMP_PARAM structure.
typedef struct _SYM_DUMP_PARAM {
ULONG size;
PUCHAR sName;
ULONG Options;
ULONG64 addr;
PFIELD_INFO listLink;
union {
PVOID Context;
PVOID pBuffer;
};
PSYM_DUMP_FIELD_CALLBACK CallbackRoutine;
ULONG nFields;
PFIELD_INFO Fields;
ULONG64 ModBase;
ULONG TypeId;
ULONG TypeSize;
ULONG BufferSize;
ULONG fPointer:2;
ULONG fArray:1;
ULONG
fStruct:1;
ULONG fConstant:1;
ULONG Reserved:27;
} SYM_DUMP_PARAM, *PSYM_DUMP_PARAM;
Members
size
Specifies the size, in bytes, of this structure. It should be set to sizeof(SYM_DUMP_PARAM).
sName
Specifies the name of the symbol to lookup.
Options
Specifies the flags that determine the behavior of this Ioctl operation. For a description of these flags, see DBG_DUMP_XXX.
addr
Specifies the address of the symbol.
listLink
Specifies the field that contains the next item in a linked list. If the symbol is an entry in a linked list, this Ioctl operation can iterate over the items in the list using the
field specified here as the pointer to the next item in the list. The type of this structure is FIELD_INFO.
The callback function specified in the fieldCallBack member of this structure is called, during this Ioctl operation, for each item in the list. When it is called, it is passed
this linkList structure with the members filled in for the list entry along with the contents of the Context member.
DBG_DUMP_LIST should be set in Options to tell this Ioctl to iterate over the list.
Context
Specifies a pointer that is passed to the callback function in the CallbackRoutine member and to the callback functions in the fieldCallBack member of the linkList and
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Fields members.
pBuffer
Specifies a buffer that receives information about the symbol. This buffer is only used if the DBG_DUMP_COPY_TYPE_DATA flag is set in Options. The size of this
buffer is specified in BufferSize.
CallbackRoutine
Specifies a callback function that is called by the engine. The engine provides the callback function with information about the symbol and its members.
nFields
Specifies the number of entries in the Fields array.
Fields
Specifies an array of FIELD_INFO structures that control the behavior of this operation for individual members of the specified symbol. See FIELD_INFO for details.
ModBase
Receives the location in the target's memory of the start of the module that contains the symbol.
TypeId
Receives the type ID of the symbol.
TypeSize
Receives the size, in bytes, of the symbol in the target's memory.
BufferSize
Specifies the size, in bytes, of the pBuffer buffer.
fPointer
Receives a Boolean value that indicates whether the symbol is a pointer. fPointer is FALSE if the symbol is not a pointer. It is 1 if the symbol is a 32-bit pointer and 3 if
the symbol is a 64-bit pointer.
fArray
Receives a Boolean value that indicates whether the symbol is an array. fArray is FALSE if the symbol is not an array and TRUE if it is.
fStruct
Receives a Boolean value that indicates whether the symbol is a structure. fStruct is FALSE if the symbol is not a structure and TRUE if it is.
fConstant
Receives a Boolean value that indicates whether the symbol is a constant. fConstant is FALSE if the symbol is not a constant and TRUE if it is.
Return Value
If this Ioctl operation succeeds, the return value from Ioctl is zero; otherwise, it is an IG_DUMP_SYMBOL_INFO error code.
Comments
The parameters for the IG_DUMP_SYMBOL_INFO Ioctl operation are the members of the SYM_DUMP_PARAM structure.
This Ioctl operation looks up the module information for the symbol, loading module symbols if possible.
If nFields is zero and DBG_DUMP_CALL_FOR_EACH is set in Options, the callback function specified in CallbackRoutine is called for every field in the symbol.
If nFields is non-zero and DBG_DUMP_CALL_FOR_EACH is set in Options, callbacks are only made for those fields matching the fName member of one of the Fields
elements. If a field matches a fName member and the fieldCallBack member is not NULL, the callback function in fieldCallBack is called; if it is NULL, the callback
function in CallbackRoutine is called instead.
Requirements
Headers: Declared in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that uses this Ioctl operation, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
See Also
Ioctl, IG_DUMP_SYMBOL_INFO Error Codes, DBG_DUMP_XXX, FIELD_INFO
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
DBG_DUMP_XXX
The DBG_DUMP_XXX bit flags are used by the Options member of the SYM_DUMP_PARAM structure to control the behavior of the IG_DUMP_SYMBOL_INFO Ioctl
operation.
The following flags can be present.
Flag
DBG_DUMP_NO_INDENT
DBG_DUMP_NO_OFFSET
DBG_DUMP_VERBOSE
DBG_DUMP_CALL_FOR_EACH
DBG_DUMP_LIST
Effect
Members are not indented in the output.
Offsets are not printed.
Verbose output.
A callback function is called for each member.
The symbol is an entry in a linked list and the IG_DUMP_SYMBOL_INFO Ioctl operation will iterate over this list. The description
of the member that points to the next item in the list is specified by the linkList member of the SYM_DUMP_PARAM structure.
DBG_DUMP_NO_PRINT
Nothing is printed (only callback functions are called and data copies are performed).
DBG_DUMP_GET_SIZE_ONLY
The Ioctl operation returns the size of the symbol only; it will not print member information or call callback functions.
DBG_DUMP_COMPACT_OUT
Newlines are not printed after each member.
DBG_DUMP_ARRAY
The symbol is an array. The number of elements in the array is specified by the member listLink->size of the
SYM_DUMP_PARAM structure.
DBG_DUMP_ADDRESS_OF_FIELD The value of addr is actually the address of the member listLink->fName of the SYM_DUMP_PARAM structure and not the
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
In addition, the result of the macro DBG_DUMP_RECUR_LEVEL(Level) can be added to the bit-set to specify how deep into structures to recurse. Level can be a number
between 0 and 15.
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that uses these constants, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
See Also
IG_DUMP_SYMBOL_INFO, Ioctl
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
FIELD_INFO
The FIELD_INFO structure is used by the IG_DUMP_SYMBOL_INFO Ioctl operation to provide information about a member in a structure.
typedef struct _FIELD_INFO {
PUCHAR fName;
PUCHAR printName;
ULONG size;
ULONG fOptions;
ULONG64 address;
union {
PVOID fieldCallBack;
PVOID pBuffer;
};
ULONG TypeId;
ULONG FieldOffset;
ULONG BufferSize;
struct _BitField {
USHORT Position;
USHORT Size;
} BitField;
ULONG fPointer:2;
ULONG fArray:1;
ULONG fStruct:1;
ULONG fConstant:1;
ULONG Reserved:27;
} FIELD_INFO, *PFIELD_INFO;
Members
fName
Specifies the name of the symbol's member to which this structure applies. Submembers can be specified using the delimiters "." and "->". Unless
DBG_DUMP_FIELD_FULL_NAME is set in fOptions, fName is considered to be the beginning of the member name.
printName
Specifies an alternative name to use when printing the name of the member. If printName is NULL, the actual name of the member is used when printing the name of
the member.
size
Receives the size in the target's memory, in bytes, of the member that is specified by fName.
If the member is an array, size specifies the number of elements in the array.
fOptions
Specifies the flags that determine the behavior of the IG_DUMP_SYMBOL_INFO Ioctl operation. For a description of these flags, see DBG_DUMP_FIELD_XXX.
address
Receives the address in the target's memory of the member that is specified by fName. If no address is supplied for the symbol type in SYM_DUMP_PARAM.addr,
address receives the offset of the member relative to the beginning of an instance of the type. For more information about SYM_DUMP_PARAM, see
IG_DUMP_SYMBOL_INFO.
fieldCallBack
Specifies a PSYM_DUMP_FIELD_CALLBACK callback function to be called with the information about the member that is specified by fName. The callback function
is passed a structure with the field information and the value of SYM_DUMP_PARAM.context.
No callback function is called if DBG_DUMP_FIELD_NO_CALLBACK_REQ is set in fOptions, fieldCallBack is NULL, or the Options member of the
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
SYM_DUMP_PARAM structure passed to Ioctl does not have DBG_DUMP_CALL_FOR_EACH set. If DBG_DUMP_FIELD_COPY_FIELD_DATA is set in
fOptions, fieldCallBack is not used.
pBuffer
Specifies a buffer to receive the value of the member specified by fName. This member is only used if DBG_DUMP_FIELD_COPY_FIELD_DATA is set in fOptions.
TypeId
Receives the identifier for the type of the member that is specified by fName.
FieldOffset
Receives the offset of the member within the structure.
BufferSize
Specifies the size, in bytes, of the pBuffer buffer.
BitField
Receives information about bit fields in a structure.
Position
Receives the start position of the bit field. This is the number of bits from to the beginning of the structure to the bit field.
Size
Receives the size, in bits, of the bit field.
fPointer
Receives a Boolean value that indicates whether the member is a pointer. fPointer is FALSE if the member is not a pointer. It is 1 if the member is a 32-bit pointer and 3
if the member is a 64-bit pointer.
fArray
Receives a Boolean value that indicates whether the member is an array. fArray is FALSE if the field is not an array and TRUE if it is.
fStruct
Receives a Boolean value that indicates whether the member is a structure. fStruct is FALSE if the member is not a structure and TRUE if it is.
fConstant
Receives a Boolean value that indicates whether the member is a constant. fConstant is FALSE if the member is not a constant and TRUE if it is.
Comments
When calling the IG_DUMP_SYMBOL_INFO Ioctl operation, the fName member of this structure should be set to the name of the symbol's member to which this structure
applies and the fOptions member should reflect the desired functionality of the operation. The other members are either optional, or are filled in by Ioctl.
See Also
IG_DUMP_SYMBOL_INFO, Ioctl, DBG_DUMP_FIELD_XXX, PSYM_DUMP_FIELD_CALLBACK
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
DBG_DUMP_FIELD_XXX
The DBG_DUMP_FIELD_XXX bit flags are used by the fOptions member of the FIELD_INFO structure to control the behavior of the IG_DUMP_SYMBOL_INFO Ioctl
operation.
The following flags can be present.
Flag
DBG_DUMP_FIELD_CALL_BEFORE_PRINT
DBG_DUMP_FIELD_NO_CALLBACK_REQ
DBG_DUMP_FIELD_RECUR_ON_THIS
DBG_DUMP_FIELD_FULL_NAME
DBG_DUMP_FIELD_ARRAY
DBG_DUMP_FIELD_COPY_FIELD_DATA
DBG_DUMP_FIELD_RETURN_ADDRESS
Effect
The callback function is called before printing the member.
No callback function is called.
Submembers of the member are processed.
fName must match completely, as opposed to just having a matching
prefix, for the member to be processed.
Print array elements of an array member.
The value of the member is copied into pBuffer.
During a callback or when Ioctl returns, the FIELD_INFO.address
member contains the address of the symbol's member.
If no address is supplied for the type, FIELD_INFO.address contains
total offset of the member from the beginning of the type.
DBG_DUMP_FIELD_SIZE_IN_BITS
DBG_DUMP_FIELD_NO_PRINT
DBG_DUMP_FIELD_DEFAULT_STRING DBG_DUMP_FIELD_WCHAR_STRING
DBG_DUMP_FIELD_MULTI_STRING DBG_DUMP_FIELD_GUID_STRING
For a bit field, return the offset and size in bits instead of bytes.
Do not print this member (only callback function are called and data
copies are performed).
If the member is a pointer, it is printed as a string, ANSI string ,
WCHAR string, MULTI string, or GUID.
In addition, the result of the macro DBG_DUMP_RECUR_LEVEL(Level) can be added to the bit-set to specify how deep into structures to recurse. Level can be a number
between 0 and 15.
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that uses these constants, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
See Also
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
PSYM_DUMP_FIELD_CALLBACK
The PSYM_DUMP_FIELD_CALLBACK callback function is called by the debugger engine during the IG_DUMP_SYMBOL_INFO Ioctl operation with information about
a member in the specified symbol.
typedef
ULONG
(WDBGAPI * PSYM_DUMP_FIELD_CALLBACK)(
struct _FIELD_INFO * pField,
PVOID UserContext
);
Parameters
pField
Specifies the field for which this callback function is being called. The debugger engine fills in the contents of this parameter before making the call. See FIELD_INFO
for details about the members of this parameter.
UserContext
Specifies the user context object passed to the Ioctl operation in the Context member of the SYM_DUMP_PARAM structure.
Return Value
If the function is successful, it should return STATUS_SUCCESS. Otherwise, it should return an appropriate error code.
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that uses this function prototype,
include wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details). STATUS_SUCCESS and other status and error codes are defined in ntstatus.h.
See Also
IG_DUMP_SYMBOL_INFO, Ioctl, FIELD_INFO
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
IG_GET_BUS_DATA
The IG_GET_BUS_DATA Ioctl operation reads data from a system bus and the IG_SET_BUS_DATA Ioctl operation writes data to a system bus. When calling Ioctl with
IoctlType set to IG_GET_BUS_DATA or IG_SET_BUS_DATA, IpvData should contain an instance of the BUSDATA structure.
typedef struct _GETSETBUSDATA {
ULONG BusDataType;
ULONG BusNumber;
ULONG SlotNumber;
PVOID Buffer;
ULONG Offset;
ULONG Length;
} BUSDATA, *PBUSDATA;
Members
BusDataType
Specifies the bus data type to use. For details of allowed values, see the documentation for the BUS_DATA_TYPE enumeration in the Platform SDK.
BusNumber
Specifies the system-assigned number of the bus. This is usually zero, unless the system has more than one bus of the same bus data type.
SlotNumber
Specifies the logical slot number on the bus.
Buffer
Specifies the buffer that contains the memory to write to the bus, or to receive the memory that is read from the bus.
The size of Buffer must be at least the value of Length.
Offset
Specifies the offset in the bus data to start reading from or writing to.
Length
Specifies the number of bytes to read from or write to the bus when the Ioctl operation is called. Upon returning, Length is set to the number of bytes actually read or
written.
Return Value
If this Ioctl operation succeeds, the return value from Ioctl is TRUE; otherwise, it is FALSE.
Comments
The parameters for the IG_GET_BUS_DATA and IG_SET_BUS_DATA Ioctl operations are the members of the BUSDATA structure.
This operation is only available in kernel-mode debugging.
The properties of the data in the bus depends on the system, bus, and slot.
Requirements
Headers: Declared in wdbgexts.h. If you are writing a DbgEng extension that uses this Ioctl operation, include wdbgexts.h before dbgeng.h (see Writing DbgEng Extension
Code for details).
See Also
Ioctl
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
IG_GET_KERNEL_VERSION
The IG_GET_KERNEL_VERSION Ioctl operation receives information related to the operating system version of the target. When calling Ioctl with IoctlType set to
IG_GET_KERNEL_VERSION, IpvData should contain an instance of the DBGKD_GET_VERSION64 structure.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Headers: Declared in wdbgexts.h. If you are writing a DbgEng extension that uses this Ioctl operation, include wdbgexts.h before dbgeng.h (see Writing DbgEng Extension
Code for details).
See Also
Ioctl, GetDebuggerData
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
IG_GET_THREAD_OS_INFO
The IG_GET_THREAD_OS_INFO Ioctl operation returns information about an operating system thread in the target. When calling Ioctl with IoctlType set to
IG_GET_THREAD_OS_INFO, IpvData should contain an instance of the WDBGEXTS_THREAD_OS_INFO structure.
typedef struct _WDBGEXTS_THREAD_OS_INFO {
ULONG ThreadId;
ULONG ExitStatus;
ULONG PriorityClass;
ULONG Priority;
ULONG64 CreateTime;
ULONG64 ExitTime;
ULONG64 KernelTime;
ULONG64 UserTime;
ULONG64 StartOffset;
ULONG64 Affinity;
} WDBGEXTS_THREAD_OS_INFO, *PWDBGEXTS_THREAD_OS_INFO;
Members
ThreadId
Specifies the operating system thread ID (within the current process) for the thread whose information is being requested.
ExitStatus
Receives the exit code of the thread. If the thread is still running or the exit code is not known, ExitStatus will be set to STILL_ACTIVE.
PriorityClass
Receives the priority class of the thread. The priority classes are defined by the constants XXX_PRIORITY_CLASS in WinBase.h. See the Platform SDK for more
information about thread priority classes. If the priority class is not know, PriorityClass will be set to zero.
Priority
Receives the priority of the thread relative to the priority class. Some thread priorities are defined by the constants THREAD_PRIORITY_XXX in WinBase.h. See the
Platform SDK for more information about thread priorities. If the priority is not known, Priority will be set to THREAD_PRIORITY_NORMAL.
CreateTime
Receives the creation time of the thread.
ExitTime
Receives the exit time of the thread. If the thread has not exited, ExitTime is undefined.
KernelTime
Receives the amount of time that the thread has executed in kernel mode.
UserTime
Receives the amount of time that the thread has executed in user-mode.
StartOffset
Receives the starting address of the thread. If the starting address is not known, StartOffset will be set to zero.
Affinity
Receives the thread affinity mask for the thread in a symmetric multiprocessor (SMP) computer. See the Platform SDK for more information about the thread affinity
mask. If the affinity mask is not known, Affinity is set to zero.
Return Value
If the a thread with the given thread ID is found, the return value is TRUE; otherwise, it is FALSE.
Comments
The parameters for the IG_GET_THREAD_OS_INFO Ioctl operation are the members of the WDBGEXTS_THREAD_OS_INFO structure.
Requirements
Headers: Declared in wdbgexts.h. If you are writing a DbgEng extension that uses this Ioctl operation, include wdbgexts.h before dbgeng.h (see Writing DbgEng Extension
Code for details).
See Also
Ioctl
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
IG_LOWMEM_CHECK
The IG_LOWMEM_CHECK Ioctl operation looks for memory corruption in the low 4 GB of memory.
This Ioctl operation does not take any parameters and the lpvData and cbSizeOfContext parameters should be set to NULL and zero respectively.
Return Value
If no corrupt memory was found, the return value is TRUE; otherwise, it is FALSE.
Comments
This operation is only available in kernel-mode debugging, and is only useful when the kernel was started using the /nolowmem option.
When the kernel is started with the /nolowmem option, the kernel, drivers, operating system, and applications are loaded in memory above 4 GB, while the low 4 GB of
memory is filled with a unique pattern. The IG_LOWMEM_CHECK Ioctl operation checks this pattern for corruption.
This can be used to verify that a driver works correctly when using physical addresses greater than 32 bits in length. See Physical Address Extension (PAE), /pae,
and /nolowmem in the Windows Driver Kit.
Requirements
Headers: Declared in wdbgexts.h. If you are writing a DbgEng extension that uses this Ioctl operation, include wdbgexts.h before dbgeng.h (see Writing DbgEng Extension
Code for details).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
IG_POINTER_SEARCH_PHYSICAL
The IG_POINTER_SEARCH_PHYSICAL Ioctl operation searches the target's physical memory for pointers lying within a specified range. When calling Ioctl with
IoctlType set to IG_POINTER_SEARCH_PHYSICAL, IpvData should contain an instance of the POINTER_SEARCH_PHYSICAL structure.
typedef struct _POINTER_SEARCH_PHYSICAL {
IN ULONG64 Offset;
IN ULONG64 Length;
IN ULONG64 PointerMin;
IN ULONG64 PointerMax;
IN ULONG Flags;
OUT PULONG64 MatchOffsets;
IN ULONG MatchOffsetsSize;
OUT ULONG MatchOffsetsCount;
} POINTER_SEARCH_PHYSICAL, *PPOINTER_SEARCH_PHYSICAL;
Members
Offset
Specifies the address in the target's physical memory to start searching from.
Length
Specifies the amount of the target's physical memory to search.
PointerMin
Specifies the lower limit of the range of pointers to search for.
PointerMax
Specifies the upper limit of the range of pointers to search for.
Flags
Specifies bit flags that alter the behavior of this Ioctl operation. The following flags can be included.
Flag
Behavior when set
PTR_SEARCH_PHYS_ALL_HITS
Return all pointers in the specified range. If this flag is not set, only one pointer per page is returned.
PTR_SEARCH_PHYS_PTE
The memory is searched for a page table entry (PTE) that matches the Page Frame Number specified in PointerMin.
PTR_SEARCH_PHYS_RANGE_CHECK_ONLY
PTR_SEARCH_NO_SYMBOL_CHECK
Do not check that the symbols used for the kernel are correct.
MatchOffsets
Receives the addresses of all the pointers that match the search criteria. MatchOffsets is an array that contains MatchOffsetsSize elements.
MatchOffsetsSize
Specifies the number of entries in the array MatchOffsets.
MatchOffsetsCount
Receives the number of pointers found that match the search criteria.
Return Value
If this Ioctl operation was successful, the return value is TRUE; otherwise, it is FALSE.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Comments
The parameters for the IG_POINTER_SEARCH_PHYSICAL Ioctl operation are the members of the POINTER_SEARCH_PHYSICAL structure.
Requirements
Headers: Declared in wdbgexts.h. If you are writing a DbgEng extension that uses this Ioctl operation, include wdbgexts.h before dbgeng.h (see Writing DbgEng Extension
Code for details).
See Also
Ioctl
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetKdContext
The GetKdContext function returns the total number of processors and the number of the current processor in the structure ppi points to.
ULONG
GetKdContext (
PPROCESSORINFO ppi
);
Parameters
ppi
Points to the following structure:
typedef struct _tagPROCESSORINFO {
USHORT Processor;
// current processor
USHORT NumberProcessors;
// total number of processors
} PROCESSORINFO, *PPROCESSORINFO;
Return Value
The total number of processors.
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ReadMemory
The ReadMemory function works like the Win32 ReadProcessMemory function. It reads memory from the process being debugged. The entire area to be read must be
accessible, or the operation fails.
ULONG
ReadMemory (
ULONG_PTR offset,
PVOID lpBuffer,
ULONG cb,
PULONG lpcbBytesRead
);
Parameters
offset
Specifies the base address of the memory to be read in the process that is being debugged.
lpBuffer
Points to the buffer to receive the memory read.
cb
Specifies the number of bytes that you want ReadMemory to read.
lpcbBytesRead
Receives the actual number of bytes that ReadMemory transferred into the buffer. This parameter is optional; if it is NULL, it is ignored.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Return Value
If the routine succeeds, the return value is TRUE; otherwise, it is FALSE.
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SearchMemory
The SearchMemory function searches the target's virtual memory for a specified pattern of bytes.
VOID
SearchMemory(
ULONG64 SearchAddress,
ULONG64 SearchLength,
ULONG PatternLength,
PVOID Pattern,
PULONG64 FoundAddress
);
Parameters
SearchAddress
Specifies the address in the target's virtual memory from which to start the search.
SearchLength
Specifies the size, in bytes, of the memory to search. For a successful match, the pattern must be found before SearchLength bytes have been examined.
PatternLength
Specifies the size, in bytes, of the pattern to search for.
Pattern
Specifies the pattern to search for.
FoundAddress
Receives the location of the pattern, found in the target's virtual memory. If the pattern was not found, the value in FoundAddress is unchanged by this function.
Return Value
None
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
WriteMemory
The WriteMemory function works like the Win32 WriteProcessMemory routine. It writes memory to the process being debugged. The entire area to be written must be
accessible, or the operation fails.
ULONG
WriteMemory (
ULONG_PTR offset,
LPCVOID lpbuffer,
ULONG cb,
PULONG lpcbBytesWritten
);
Parameters
offset
Specifies the base address of the memory to be written in the process that is being debugged.
lpbuffer
Points to the buffer that contains the data to be written.
cb
Specifies the number of bytes that WriteMemory should write.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
lpcbBytesWritten
Receives the actual number of bytes that WriteMemory transferred from the buffer. This parameter is optional; if it is NULL, it is ignored.
Return Value
If the routine succeeds, the return value is TRUE; otherwise, it is FALSE.
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ReadMsr
The ReadMsr function reads the contents of a Model-Specific Register (MSR).
VOID
ReadMsr (
ULONG MsrReg,
ULONGLONG *MsrValue,
);
Parameters
MsrReg
Specifies the ID number of the MSR.
MsrValue
Receives the value of the MSR.
Return Value
None
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
WriteMsr
The WriteMsr function writes to a Model-Specific Register (MSR).
VOID
WriteMsr (
ULONG MsrReg,
ULONGLONG MsrValue
);
Parameters
MsrReg
Specifies the ID number of the MSR.
MsrValue
Specifies the new value of the MSR.
Return Value
None
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetPebAddress
The GetPebAddress function returns the address of the process environment block (PEB) for a system process.
VOID
GetPebAddress(
ULONG64 CurrentThread,
PULONGLONG Address
);
Parameters
CurrentThread
Specifies an operating system thread whose PEB's address will be returned.
In kernel-mode debugging, this is the location of the KTHREAD structure, which is returned by GetCurrentThreadAddr. If CurrentThread is NULL, the PEB for the
current process is returned.
In user-mode debugging, CurrentThread is ignored.
Address
Receives the address of the PEB for the current operating system process or, in kernel-mode debugging, when CurrentThread is not NULL, for the system process that
contains the thread that is specified by CurrentThread.
Return Value
None
Comments
In user-mode debugging, the PEB for the current thread is returned.
In kernel-mode debugging, if CurrentThread is NULL, the PEB for the operating system process in which the last event occurred is returned.
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
See Also
GetCurrentThreadAddr, GetTebAddress
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ReadPhysical
The ReadPhysical function reads from physical memory.
VOID
ReadPhysical (
LARGE_INTEGER address,
PVOID buf,
ULONG size,
PULONG sizer
);
Parameters
address
Specifies the physical address to read.
buf
Specifies the address of an array of bytes to hold the data that is read.
size
Specifies the number of bytes to read.
sizer
Receives the number of bytes actually read.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Return Value
None
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ReadPhysicalWithFlags
The ReadPhysicalWithFlags function reads from physical memory.
VOID
ReadPhysicalWithFlags(
ULONG64 address,
PVOID buf,
ULONG size,
ULONG flags,
PULONG sizer
);
Parameters
address
Specifies the physical address to read.
buf
Specifies the address of an array of bytes to hold the data that is read.
size
Specifies the number of bytes to read.
flags
Specifies the properties of the physical memory to be read. This must match the way the physical memory was advertised to the operating system on the target. Possible
values are listed in the following table.
Value
Description
PHYS_FLAG_DEFAULT
Use the default memory caching.
PHYS_FLAG_CACHED
The physical memory is cached.
PHYS_FLAG_UNCACHED
The physical memory is uncached.
PHYS_FLAG_WRITE_COMBINED The physical memory is write-combined.
sizer
Receives the number of bytes actually read.
Return Value
None
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
See Also
ReadPhysical, WritePhysicalWithFlags
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
WritePhysical
The WritePhysical function writes to physical memory.
VOID
WritePhysical (
LARGE_INTEGER address,
PVOID buf,
ULONG size,
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
PULONG sizew
);
Parameters
address
Specifies the physical address to write.
buf
Specifies the address of an array of bytes to hold the data that is written.
size
Specifies the number of bytes to write.
sizew
Receives the number of bytes actually written.
Return Value
None
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
WritePhysicalWithFlags
The WritePhysicalWithFlags function writes to physical memory.
VOID
WritePhysicalWithFlags(
ULONG64 address,
PVOID buf,
ULONG size,
ULONG flags,
PULONG sizew
);
Parameters
address
Specifies the physical address to write.
buf
Specifies the address of an array of bytes to hold the data that is written.
size
Specifies the number of bytes to write.
flags
Specifies the properties of the physical memory to be written to. This must match the way the physical memory was advertised to the operating system on the target.
Possible values are listed in the following table.
Value
Description
PHYS_FLAG_DEFAULT
Use the default memory caching.
PHYS_FLAG_CACHED
The physical memory is cached.
PHYS_FLAG_UNCACHED
The physical memory is uncached.
PHYS_FLAG_WRITE_COMBINED The physical memory is write-combined.
sizew
Receives the number of bytes actually written.
Return Value
None
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
See Also
WritePhysical, ReadPhysicalWithFlags
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetTebAddress
The GetTebAddress function returns the address of the thread environment block (TEB) for the current operating system thread.
VOID
GetTebAddress(
PULONGLONG Address
);
Parameters
Address
Receives the address of the TEB for the current operating system thread.
Return Value
None
Comments
In user-mode debugging, the TEB for the current thread is returned. In kernel-mode debugging, the TEB for the operating system thread that was running on the current
processor when the last event occurred is returned.
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
See Also
GetPebAddress
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
StackTrace
The StackTrace function retrieves a stack trace for the process being debugged. Returns the number of frames read into the buffer pointed to by StackFrames.
ULONG
StackTrace (
ULONG FramePointer,
ULONG StackPointer,
ULONG ProgramCounter,
PEXTSTACKTRACE StackFrames,
ULONG Frames
);
Parameters
FramePointer
Specifies the frame pointer. If no specific value is desired, this should simply be set to zero.
StackPointer
Specifies the stack pointer. If no specific value is desired, this should simply be set to zero.
ProgramCounter
Specifies the instruction pointer. If no specific value is desired, this should simply be set to zero.
StackFrames
Receives the stack information. StackFrames must be a pointer to a buffer that is large enough to hold the number of stack frames specified by Frames. The stack frames
are stored in the following data structure:
typedef struct _tagEXTSTACKTRACE {
ULONG
FramePointer;
ULONG
ProgramCounter;
ULONG
ReturnAddress;
ULONG
Args[4];
} EXTSTACKTRACE, *PEXTSTACKTRACE;
Frames
Specifies the maximum number of frames that will fit into the buffer.
Return Value
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetSymbol
The GetSymbol function locates the symbol nearest to address.
VOID
GetSymbol (
PVOID offset,
PUCHAR pchBuffer,
PULONG pDisplacement
);
Parameters
offset
Specifies an address near the symbol you want located.
pchBuffer
Receives the name of the symbol found.
pDisplacement
Specifies the displacement from the beginning of the symbol.
Return Value
None
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ReloadSymbols
The ReloadSymbols function deletes symbol information from the debugger so that it can be reloaded as needed. This function behaves the same way as the debugger
command .reload.
VOID
ReloadSymbols(
IN OPTIONAL PSTR
);
Arg
Parameters
Arg
Specifies the arguments for the debugger command .reload. For example, setting Arg to /u ntdll.dll has the same effect as the command .reload /u ntdll.dll.
Return Value
None
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
See Also
.reload (Reload Module)
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
GetSetSympath
The GetSetSympath function can be used to either get or set the symbol search path.
VOID
GetSetSympath (
IN PSTR Arg,
OUT PSTR Result OPTIONAL,
IN int Length
);
Parameters
Arg
Specifies the new search path. If this argument is NULL or the string is empty, the search path is not set and the current setting is returned in Result.
Result
Optional. If Arg is NULL, GetSetSympath stores the current search path in the buffer pointed to by Result.
Length
Specifies the size of the buffer for storing the result.
Return Value
None
Comments
When the symbol path is changed, a call to ReloadSymbols is made implicitly.
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
TranslateVirtualToPhysical
The TranslateVirtualToPhysical function translates a virtual memory address into a physical memory address.
BOOL
TranslateVirtualToPhysical(
ULONG64 Virtual,
ULONG64 * Physical
);
Parameters
Virtual
Specifies the virtual memory address to translate.
Physical
Receives the physical memory address.
Return Value
If the function succeeds, the return value is TRUE; otherwise, it is FALSE.
Comments
This function is only available in kernel-mode debugging.
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
2009 Microsoft Corporation
Send feedback on this topic
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
ReadControlSpace
The ReadControlSpace function reads the processor-specific control space into the array pointed to by buf.
VOID
ReadControlSpace (
USHORT processor,
ULONG address,
PVOID buf,
ULONG size
);
Parameters
processor
Specifies the number of the processor whose control space is to be read.
address
Specifies the address of the control space.
buf
Specifies the address of an array of bytes to hold the control space data.
size
Specifies the number of bytes in the array pointed to by buf.
Return Value
None
Comments
If you are writing 64-bit code, you should use ReadControlSpace64 instead. See 32-Bit Pointers and 64-Bit Pointers for details.
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ReadControlSpace64
The ReadControlSpace64 function reads the processor-specific control space into the array pointed to by buf.
VOID
ReadControlSpace (
USHORT processor,
ULONG64 address,
PVOID buf,
ULONG size
);
Parameters
processor
Specifies the number of the processor whose control space is to be read.
address
Specifies the address of the control space.
buf
Specifies the address of an array of bytes to hold the control space data.
size
Specifies the number of bytes in the array pointed to by buf.
Return Value
None
Comments
If you are writing 32-bit code, you should use ReadControlSpace instead. See 32-Bit Pointers and 64-Bit Pointers for details.
Requirements
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ReadTypedControlSpace32
The ReadTypedControlSpace32 macro is a thin wrapper around the ReadControlSpace64 function. It is provided as a convenience for reading processor-specific control
space into a structure.
#define ReadTypedControlSpace32( _Proc, _Addr, _Buf ) \
ReadControlSpace64( (USHORT)(_Proc), (ULONG)(_Addr), (PVOID)&(_Buf), (ULONG)sizeof(_Buf) )
Parameters
_Proc
Specifies the number of the processor whose control space is to be read.
_Addr
Specifies the address of the control space.
_Buf
Specifies the object into which the control space data is read.
Comments
The parameters provided to this macro are the same as those provided to the ReadControlSpace64 function except that instead of providing a pointer to a structure and its
size, the structure can be provided directly.
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this macro, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
See Also
ReadControlSpace64, ReadTypedControlSpace64
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ReadTypedControlSpace64
The ReadTypedControlSpace64 macro is a thin wrapper around the ReadControlSpace64 function. It is provided as a convenience for reading processor-specific control
space into a structure.
#define ReadTypedControlSpace64( _Proc, _Addr, _Buf ) \
ReadControlSpace64( (USHORT)(_Proc), (ULONG64)(_Addr), (PVOID)&(_Buf), (ULONG)sizeof(_Buf) )
Parameters
_Proc
Specifies the number of the processor whose control space is to be read.
_Addr
Specifies the address of the control space.
_Buf
Specifies the object into which the control space data is read.
Comments
The parameters provided to this macro are the same as those provided to the ReadControlSpace64 function except that instead of providing a pointer to a structure and its
size, the structure can be provided directly.
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this macro, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
See Also
ReadControlSpace64, WriteControlSpace
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
WriteControlSpace
The WriteControlSpace function writes to the processor-specific control space of the current target.
VOID
WriteControlSpace(
USHORT processor,
ULONG address,
PVOID buf,
ULONG size
);
Parameters
processor
Specifies the index of the processor whose control space is to be written.
address
Specifies the address of the control space.
buf
Specifies the data to be written to the control space.
size
Specifies the number of bytes to be written. This is the number of bytes in the buf buffer.
Return Value
None
Comments
This function can only be called in kernel-mode debugging.
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
See Also
ReadControlSpace, ReadControlSpace64
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ReadIoSpace
The ReadIoSpace function reads from the system I/O locations.
VOID
ReadIoSpace (
ULONG address,
PULONG data,
PULONG size
);
Parameters
address
Specifies the I/O address to read from.
data
Specifies the address of a variable to hold the data read. This must be at least the number of bytes contained in size.
size
Specifies the address of a variable that contains the number of bytes to read (1, 2, or 4 only). After the data is read, size will contain the number of bytes actually read.
Return Value
None
Comments
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
If you are writing 64-bit code, you should use ReadIoSpace64 instead. See 32-Bit Pointers and 64-Bit Pointers for details.
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ReadIoSpace64
The ReadIoSpace64 function reads from the system I/O locations.
VOID
ReadIoSpace (
ULONG64 address,
PULONG data,
PULONG size
);
Parameters
address
Specifies the I/O address to read from.
data
Specifies the address of a variable to hold the data read. This must be at least the number of bytes contained in size.
size
Specifies the address of a variable that contains the number of bytes to read. Size must be 1, 2, or 4. After the data is read, size will contain the number of bytes actually
read.
Return Value
None
Comments
If you are writing 32-bit code, you should use ReadIoSpace instead. See 32-Bit Pointers and 64-Bit Pointers for details.
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ReadIoSpaceEx
The ReadIoSpaceEx function is an extended version of ReadIoSpace. It reads not only the system I/O locations, but also I/O locations on a bus. ReadIoSpace works like
ReadIoSpaceEx, except that it defaults interfacetype to ISA, busnumber to zero, and addressspace to 1.
VOID
ReadIoSpaceEx (
ULONG address,
PULONG data,
PULONG size,
ULONG interfacetype,
ULONG busnumber,
ULONG addressspace
);
Parameters
address
Specifies the I/O address to read from.
data
Specifies the address of a variable to hold the data read. This must be at least the number of bytes contained in size.
size
Specifies the address of a variable that contains the number of bytes to read. Size must be 1, 2, or 4. After the data is read, size will contain the number of bytes actually
read.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
interfacetype
Specifies the type of interface on which the extended I/O space exists. Possible values include ISA, EISA, and MCA. For more information, see ntddk.h, which is
available as part of Windows Driver Kit.
busnumber
Specifies the number of the bus on which the extended I/O space exists. This is typically zero, unless there is more than one bus of a given type.
addressspace
This is typically 1.
Return Value
None
Comments
If you are writing 64-bit code, you should use ReadIoSpaceEx64 instead. See 32-Bit Pointers and 64-Bit Pointers for details.
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ReadIoSpaceEx64
The ReadIoSpaceEx64 function is an extended version of ReadIoSpace64. It reads not only the system I/O locations, but also I/O locations on a bus. ReadIoSpace64 works
like ReadIoSpaceEx64, except that it defaults interfacetype to ISA, busnumber to zero, and addressspace to 1.
VOID
ReadIoSpaceEx (
ULONG64 address,
PULONG data,
PULONG size,
ULONG interfacetype,
ULONG busnumber,
ULONG addressspace
);
Parameters
address
Specifies the I/O address to read from.
data
Specifies the address of a variable to hold the data read. This must be at least the number of bytes contained in size.
size
Specifies the address of a variable that contains the number of bytes to read. Size must be 1, 2, or 4. After the data is read, size will contain the number of bytes actually
read.
interfacetype
Specifies the type of interface on which the extended I/O space exists. Possible values include ISA, EISA, and MCA. For more information, see ntddk.h, which is
available as part of Windows Driver Kit.
busnumber
Specifies the number of the bus on which the extended I/O space exists. This is typically zero, unless there is more than one bus of a given type.
addressspace
This is typically 1.
Return Value
None
Comments
If you are writing 32-bit code, you should use ReadIoSpaceEx instead. See 32-Bit Pointers and 64-Bit Pointers for details.
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
WriteIoSpace
The WriteIoSpace function writes to the system I/O locations.
VOID
WriteIoSpace (
ULONG address,
ULONG data,
PULONG size
);
Parameters
address
Specifies the I/O address to write to.
data
Specifies the address of a variable that holds the data to write. This must be at least the number of bytes contained in size.
size
Specifies the address of a variable that contains the number of bytes to write. Size must be 1, 2, or 4. After the data is written, size will contain the number of bytes
actually written.
Return Value
None
Comments
If you are writing 64-bit code, you should use WriteIoSpace64 instead. See 32-Bit Pointers and 64-Bit Pointers for details.
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
WriteIoSpace64
The WriteIoSpace64 function writes to the system I/O locations.
VOID
WriteIoSpace (
ULONG64 address,
ULONG data,
PULONG size
);
Parameters
address
Specifies the I/O address to write to.
data
Specifies the address of a variable that holds the data to write. This must be at least the number of bytes contained in size.
size
Specifies the address of a variable that contains the number of bytes to write. Size must be 1, 2, or 4. After the data is written, size will contain the number of bytes
actually written.
Return Value
None
Comments
If you are writing 32-bit code, you should use WriteIoSpace instead. See 32-Bit Pointers and 64-Bit Pointers for details.
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
WriteIoSpaceEx
The WriteIoSpaceEx function is an extended version of WriteIoSpace. It can write to either a system I/O location or an I/O location on a bus. WriteIoSpace works like
WriteIoSpaceEx, except that it defaults interfacetype to ISA, busnumber to zero, and addressspace to 1.
VOID
WriteIoSpaceEx (
ULONG address,
ULONG data,
PULONG size,
ULONG interfacetype,
ULONG busnumber,
ULONG addressspace
);
Parameters
address
Specifies the I/O address to write to.
data
Specifies the address of a variable that holds the data to write. This must be at least the number of bytes contained in size.
size
Specifies the address of a variable that contains the number of bytes to write. Size must be 1, 2, or 4. After the data is written, size will contain the number of bytes
actually written.
interfacetype
Specifies the type of interface on which the extended I/O space exists. Possible values include ISA, EISA, and MCA. For more information, see ntddk.h, which is
available as part of the Windows Driver Kit.
busnumber
Specifies the number of the bus on which the extended I/O space exists. This is typically zero, unless there is more than one bus of a given type.
addressspace
This is typically 1.
Return Value
None
Comments
If you are writing 64-bit code, you should use WriteIoSpaceEx64 instead. See 32-Bit Pointers and 64-Bit Pointers for details.
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
WriteIoSpaceEx64
The WriteIoSpaceEx64 function is an extended version of WriteIoSpace64. It can write to either a system I/O location or an I/O location on a bus. WriteIoSpace64 works
like WriteIoSpaceEx64, except that it defaults interfacetype to ISA, busnumber to zero, and addressspace to 1.
VOID
WriteIoSpaceEx (
ULONG64 address,
ULONG data,
PULONG size,
ULONG interfacetype,
ULONG busnumber,
ULONG addressspace
);
Parameters
address
Specifies the I/O address to write to.
data
Specifies the address of a variable that holds the data to write. This must be at least the number of bytes contained in size.
size
Specifies the address of a variable that contains the number of bytes to write. Size must be 1, 2, or 4. After the data is written, size will contain the number of bytes
actually written.
interfacetype
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Specifies the type of interface on which the extended I/O space exists. Possible values include ISA, EISA, and MCA. For more information, see ntddk.h, which is
available as part of the Windows Driver Kit.
busnumber
Specifies the number of the bus on which the extended I/O space exists. This is typically zero, unless there is more than one bus of a given type.
addressspace
This is typically 1.
Return Value
None
Comments
If you are writing 32-bit code, you should use WriteIoSpaceEx instead. See 32-Bit Pointers and 64-Bit Pointers for details.
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SetThreadForOperation
The SetThreadForOperation function sets the thread to use for the next StackTrace call.
VOID
SetThreadForOperation (
ULONG_PTR * Thread
);
Parameters
Thread
Points to a thread object to be used for the next stack trace.
Return Value
None
Comments
If you are writing 64-bit code, you should use SetThreadForOperation64 instead. See 32-Bit Pointers and 64-Bit Pointers for details.
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
SetThreadForOperation64
The SetThreadForOperation64 function sets the thread to use for the next StackTrace call.
VOID
SetThreadForOperation (
ULONG64 Thread
);
Parameters
Thread
Points to the thread object to be used for the next stack trace.
Return Value
None
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Comments
If you are writing 32-bit code, you should use SetThreadForOperation instead. See 32-Bit Pointers and 64-Bit Pointers for details.
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetFieldData
The GetFieldData function returns the value of a member in a structure.
ULONG
GetFieldData (
IN ULONG64 TypeAddress,
IN LPCSTR Type,
IN LPCSTR Field,
IN ULONG OutSize,
OUT PVOID pOutValue
);
Parameters
TypeAddress
Specifies the address of the structure in the target's memory.
Type
Specifies the name of the type of the structure. This can be qualified with a module name, for example, mymodule!mystruct.
Field
Specifies the name of the member in the structure whose value will be returned. Submembers can be specified by using a period-separated path, for example,
"myfield.mysubfield".
If the size of the structure pointed to by TypeAddress is less than 8 bytes, Field can be NULL; in this case, the entire structure is copied to pOutValue.
OutSize
Specifies the size, in bytes, of the buffer pOutValue.
pOutValue
Receives the value of the member. Or, the value of the type, if Field is NULL.
Return Value
If the function succeeds, the return value is zero. Otherwise, the return value is an IG_DUMP_SYMBOL_INFO error code.
If OutSize is smaller than the value returned, an error message is printed and an exception is raised; if the exception is handled or ignored the return value is zero. In this case,
the data past the end of pOutValue might be overwritten.
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetFieldOffset
The GetFieldOffset function returns the offset of a member from the beginning of a structure.
ULONG
GetFieldOffset (
IN LPCSTR Type,
IN LPCSTR Field,
OUT PULONG pOffset
);
Parameters
Type
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Specifies the name of the type of the structure. This can be qualified with a module name, for example, mymodule!mystruct.
Field
Specifies the name of the member in the structure. Submembers can be specified by using a period-separated path, for example, "myfield.mysubfield".
pOffset
Receives the offset of the member from the beginning of an instance of the structure.
Return Value
If the function succeeds, the return value is zero. Otherwise, the return value is an IG_DUMP_SYMBOL_INFO error code.
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetFieldValue
The GetFieldValue macro is a thin wrapper around the GetFieldData function. It is provided as a convenience for reading the value of a member in a structure.
#define GetFieldValue(Addr, Type, Field, OutValue) \
GetFieldData(Addr, Type, Field, sizeof(OutValue), (PVOID) &(OutValue))
Parameters
Addr
Specifies the address of the structure in the target's memory.
Type
Specifies the name of the type of the structure. This can be qualified with a module name, for example, mymodule!mystruct.
Field
Specifies the name of the member in the structure. Submembers can be specified by using a period-separated path, for example, "myfield.mysubfield".
OutValue
Specifies the object into which the member's value is read.
Return Value
If the function succeeds, the return value is zero. Otherwise, the return value is an IG_DUMP_SYMBOL_INFO error code.
Comments
The parameters provided to this macro are the same as those provided to the GetFieldData function except that instead of providing a pointer to a buffer and its size, the
variable to hold the returned value can be provided directly.
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this macro, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
See Also
GetFieldData
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetShortField
The GetShortField function reads the value of a member in a structure if its size is less than or equal to 8 bytes, or initializes a structure so it can be read later. This function
is not intended to be used directly; InitTypeRead or InitTypeReadPhysical and ReadField should be used instead.
ULONG64
GetShortField (
IN ULONG64 TypeAddress,
IN LPCSTR Name,
IN USHORT StoreAddress
);
Parameters
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
TypeAddress
The meaning of this parameter depends on the value of StoreAddress.
If StoreAddress is non-zero:
Specifies the address of the structure in the target's memory. This address is used for subsequent calls when StoreAddress is zero.
If StoreAddress is zero:
TypeAddress is ignored. The value of TypeAddress from the last call when StoreAddress was non-zero is used to specify the address of the structure in the target's
memory.
Name
The meaning of this parameter depends on the value of StoreAddress.
If StoreAddress is non-zero:
Specifies the name of the type of the structure at TypeAddress.
If StoreAddress is zero:
Specifies the name of the member in the structure to read. The address and type of the structure are remembered from a previous call to this function with
StoreAddress not equal to zero. Submembers can be specified by using a period-separated path, for example, "myfield.mysubfield".
StoreAddress
Specifies the mode of this function.
If StoreAddress is non-zero:
Causes this function to initialize a structure for reading its members. The address and type name for the structure is remembered.
If the bit value 0x2 is set in StoreAddress, the address TypeAddress is considered a physical address; otherwise, it is considered a virtual address.
If StoreAddress is zero:
Causes this function to read a member from a previously initialized structure.
Return Value
If StoreAddress is non-zero:
If the function succeeds, it returns the value zero. If the function fails because the caller passed a zero value as TypeAddress, it returns the value
MEMORY_READ_ERROR (defined in Wdbgexts.h). If the function fails for any other reason, it returns an IG_DUMP_SYMBOL_INFO error code.
If StoreAddress is zero:
If the function succeeds, it returns the value of the specified field in the previously initialized structure. The structure is the one initialized in a previous call to
GetShortField. The field is the one specified by the Name parameter of the current call to GetShortField. The return value is cast to ULONG64. If the function fails, it
returns the value zero.
Comments
When GetShortField is called with a nonzero StoreAddress value, it initializes the structure located at the address specified by TypeAddress. Only one structure can be
initialized at a time. If GetShortField is called more than once with a nonzero StoreAddress value, only the structure specified in the most recent call is initialized. When
GetShortField is called with StoreAddress equal to zero, it accesses the most recently initialized structure, reads in that structure the field specified by Name, and returns the
value of that field.
This function does not need to be called directly. The macros InitTypeRead and InitTypeReadPhysical call this function with StoreAddress non-zero to prepare a structure
for reading its members. The macro ReadField calls this function with StoreAddress (and TypeAddress) equal to zero, to read members from the structure.
Note because this function stores the TypeAddress and Name by using static local variables, and because this function is defined in WdbgExts.h, the C pre-processor will
create a new instance of this function for each DLL, and TypeAddress and Name will only be available within a single source file. In other words, the structure must be
initialized in the same source file from which the members are read.
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
See Also
InitTypeRead, InitTypeReadPhysical, ReadField
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ReadField
The ReadField and ReadFieldStr macros read a field whose size is less than 8 bytes from a structure initialized with InitTypeRead or InitTypeReadPhysical.
#define ReadField(Field) \
GetShortField(0, #Field, 0)
#define ReadFieldStr(FieldStr) \
GetShortField(0, FieldStr, 0)
Parameters
Field
Specifies the name of the field. The C-preprocessor will turn Field into a string.
FieldStr
Specifies the name of the field. FieldStr is expected to be an ASCII string.
Return Value
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
If this macro succeeds, it returns the value of the specified field in the previously initialized structure. The structure is the one initialized in a previous call to InitTypeRead,
InitTypeStrRead, InitTypeReadPhysical, InitTypeStrReadPhysical, or GetShortField. The field is the one specified by the Field or FieldStr parameter of ReadField.
The return value is cast to ULONG64. If the function fails, it returns the value zero.
Comments
The parameter Field is the name of the member. For ReadField, the C pre-processor will turn the parameter into a string. For ReadFieldStr, Field is expected to already be
an ASCII string. For example, the following two commands are identical and read the same member from a previously initialized structure:
ReadField( myField );
ReadFieldStr( "myField" );
Submembers can be read by using a period-separated path, for example, "myField.mySubfield".
Note Because these macros use the GetShortField function, they must be called from the same source code file as the macros that initialize the structure for reading. For
more details, see GetShortField.
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that uses this macro, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
See Also
InitTypeRead, InitTypeReadPhysical, GetShortField
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ReadListEntry
The ReadListEntry function reads a doubly-linked list entry from the target's memory.
ULONG
ReadListEntry(
ULONG64 Address,
PLIST_ENTRY64 List
);
Parameters
Address
Specifies the address of the list entry in the target. If the target uses 32-bit pointers, this should be the address of a LIST_ENTRY32 structure. If the target uses 64-bit
pointers, this should be the address of a LIST_ENTRY64 structure.
List
Receives a LIST_ENTRY64 structure that contains pointers to the previous and next entries in the list. If the target uses 32-bit pointers, they are sign-extended to 64 bits.
Return Value
If the function succeeds, the return value is TRUE; otherwise, it is FALSE.
Comments
For more information about the LIST_ENTRY structures, see the Windows Driver Kit (WDK) documentation.
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
LIST_ENTRY64 and LIST_ENTRY32 are defined in winnt.h.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ReadPointer
The ReadPointer function reads a pointer from the target.
ULONG
ReadPointer(
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
ULONG64 Address,
PULONG64 Pointer
);
Parameters
Address
Specifies the address of the pointer to read.
Pointer
Receives the value of the pointer. If the target uses 32-bit pointers, the pointer is sign-extended to 64 bits.
Return Value
If the function succeeds, the return value is TRUE; otherwise, it is FALSE.
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
See Also
WritePointer
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
WritePointer
The WritePointer function writes a pointer to the target.
ULONG
WritePointer(
ULONG64 Address,
ULONG64 Pointer
);
Parameters
Address
Specifies the address to write the pointer to.
Pointer
Specifies the value of the pointer. If the target uses 32-bit pointers, Pointer is a 32-bit value that has been sign-extended to 64-bits.
Return Value
If the function succeeds, the return value is TRUE; otherwise, it is FALSE.
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
See Also
ReadPointer
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
IsPtr64
The IsPtr64 function determines if the target uses 64-bit pointers.
ULONG
IsPtr64(
void
);
Parameters
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
None
Return Value
The function returns TRUE if the target uses 64-bit pointers; FALSE, otherwise.
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ReadPtr
The ReadPtr function reads a pointer from the target. ReadPointer should be used instead of this function as the return value of ReadPointer is more consistent with the rest
of the WdbgExts API.
ULONG
ReadPtr(
ULONG64 Addr,
PULONG64 pPointer
);
Parameters
Addr
Specifies the address of the pointer to read.
pPointer
Receives the value of the pointer. If the target uses 32-bit pointers, the pointer is sign-extended to 64 bits.
Return Value
If the function succeeds, the return value is FALSE; otherwise, it is TRUE.
Comments
This function is identical to ReadPointer, except the meaning of the return value is reversed.
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
See Also
ReadPointer
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
GetTypeSize
The GetTypeSize function returns the size in the target's memory of an instance of the specified type.
ULONG
GetTypeSize (
IN LPCSTR Type
);
Parameters
Type
Specifies the type to return the size of.
Return Value
This function returns the size of an instance of the specified type.
Requirements
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
InitTypeRead
The InitTypeRead and InitTypeStrRead macros initialize a structure so that its members can be read using ReadField.
#define InitTypeRead(Addr, Type) \
GetShortField(Addr, #Type, 1)
#define InitTypeStrRead(Addr, TypeStr) \
GetShortField(Addr, TypeStr, 1)
Parameters
Addr
Specifies the address of the structure in the target's virtual memory.
Type
Specifies the name of the type of the structure. The C pre-processor will turn Type into a string.
TypeStr
Specifies the name of the type of the structure. TypeStr is expected to be an ASCII string.
Return Value
If this macro succeeds, it returns the value zero. If it fails because the caller passed a zero value as Addr, it returns the value MEMORY_READ_ERROR (defined in
Wdbgexts.h). If it fails for any other reason, it returns an IG_DUMP_SYMBOL_INFO error code.
Comments
Note Because these macros use the GetShortField function, ReadField must be used in the same source code file as these macros. For more details, see GetShortField.
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that uses this macro, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
See Also
InitTypeReadPhysical, ReadField, GetShortField
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
InitTypeReadPhysical
The InitTypeReadPhysical and InitTypeStrReadPhysical macros initialize a structure in physical memory so that its members can be read using ReadField.
#define InitTypeReadPhysical(Addr, Type) \
GetShortField(Addr, #Type, 3)
#define InitTypeStrReadPhysical(Addr, TypeStr) \
GetShortField(Addr, TypeStr, 3)
Parameters
Addr
Specifies the address of the structure in the target's physical memory.
Type
Specifies the name of the type of the structure. The C pre-processor will turn Type into a string.
TypeStr
Specifies the name of the type of the structure. TypeStr is expected to be an ASCII string.
Return Value
If this macro succeeds, it returns the value zero. If it fails because the caller passed a zero value as Addr, it returns the value MEMORY_READ_ERROR (defined in
Wdbgexts.h). If it fails for any other reason, it returns an IG_DUMP_SYMBOL_INFO error code.
Comments
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Note Because these macros use the GetShortField function, ReadField must be used in the same source code file as these macros. For more details, see GetShortField.
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that uses this macro, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
See Also
InitTypeRead, ReadField, GetShortField
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
ListType
The ListType function calls a specified callback function for every element in a linked list.
ULONG
ListType (
IN LPCSTR Type,
IN ULONG64 Address,
IN USHORT ListByFieldAddress,
IN LPCSTR NextPointer,
IN PVOID Context,
IN PSYM_DUMP_FIELD_CALLBACK CallbackRoutine
);
Parameters
Type
Specifies the name of the type of each entry in the linked list.
Address
If ListByFieldAddress is zero:
Specifies the address in the target's memory of the first entry in the linked list.
If ListByFieldAddress is 1:
Specifies the address in the target's memory of the member of the first entry that points to the next entry.
ListByFieldAddress
Specifies whether Address contains the base address of the first entry, or if it contains the address of the member of the first entry that points to the next entry.
NextPointer
Specifies the name of the member in the structure of type Type that contains a pointer to the next entry in the linked list. NextPointer can be a period-separated path, for
example, if Type is "nt!_ETHREAD", NextPointer could be "Tcb.ThreadListEntry.Flink".
Context
Specifies a pointer that is passed to the callback function specified by CallbackRoutine each time the callback function is called.
CallbackRoutine
Specifies a function that is called for each entry in the linked list. The parameters passed to the function are the Context pointer and a FIELD_INFO structure; the address
of the entry is found in the address member of this structure.
Return Value
This function returns TRUE on success and FALSE on failure.
Requirements
Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include
wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
Glossary
This glossary contains terms and acronyms related to the Microsoft Debugging Tools for Windows.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
A
accessible
A debugging session is accessible if the current target is suspended.
actual processor type
The type of the physical processor in the target computer.
See also effective processor type, executing processor type.
For more information, see Target Information.
arbitrary exception filter
An exception filter that has been manually added to the engine's list of event filters.
See also specific exception filter.
For more information, see Event Filters.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
B
blue screen
The blue character-mode screen displayed after a bug check occurs.
boot.ini
A file used to set boot options, including debugging options. The boot.ini file is used on most x86 systems.
For more information, see Introduction to Boot Options.
BootCfg
A tool used to set boot options, including debugging options.
For more information, see Introduction to Boot Options.
breakpoint
A location in the target or a target operation which will cause an event when triggered.
For more information, see Using Breakpoints or Breakpoints.
breakpoint ID
The unique identifier for a breakpoint.
For more information, see Using Breakpoints or Breakpoints.
breakpoint type
The method used to implement the breakpoint. There are two types of breakpoints: processor breakpoints and software breakpoints.
break status
A setting that influences how the debugger engine proceeds after an event. The break status indicates whether the event should break into the debugger, have a
notification printed to the debugger console, or be ignored. The break status is part of an event filter.
See also handling status.
For more information, see the topics Controlling Exceptions and Events and Event Filters
bug check
When Windows encounters hardware problems, inconsistencies within data necessary for its operation, or other severe errors, it shuts down and displays error
information on a blue character-mode screen.
This shutdown is known variously as a bug check, kernel error, system crash, stop error, or, occasionally, trap. The screen display itself is referred to as a blue screen or
stop screen. The most important information shown on the screen is a message code which gives information about the crash; this is known as a bug check code or stop
code.
WinDbg or KD can configure the system so that a debugger is automatically contacted when such an error occurs. Alternatively, the system can be instructed to
automatically reboot in case of such an error.
For more information, see Bug Checks (Blue Screens).
bug check code
The hexadecimal code indicating a specific type of bug check .
2009 Microsoft Corporation
Send feedback on this topic
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
C
C++ expression
An expression that can be evaluated by the C++ expression evaluator.
For details of the syntax, see C++ Numbers and Operators.
C call stack
See call stack.
call stack
The set of stack frames for each thread containing representing the function calls made by the thread. Each time a function call is made a new stack frame is pushed onto
the top of the stack. When that function returns, the stack frame is popped off the stack.
Sometimes referred to as the C call stack or simply the stack.
callback object
See event callbacks, input callbacks, and output callbacks.
checked build
Two different builds of each NT-based operating system exist:
The free build (or retail build) of Windows is the end-user version of the operating system. For details, see free build.
The checked build (or debug build) of Windows serves as a testing and debugging aid in the developing of the operating system and kernel-mode drivers. The
checked build contains extra error checking, argument verification, and debugging information that is not available in the free build. , making it easier to trace the
cause of problems in system software. A checked system or driver can help isolate and track down driver problems that can cause unpredictable behavior, result in
memory leaks, or result in improper device configuration.
Although the checked build provides extra protection, it consumes more memory and disk space than the free build. System and driver performance is slower, because
additional code paths are executed due to parameter checking and output of diagnostic messages, and some alternate implementations of kernel functions are used.
The checked build of Windows should not be confused with a driver that has been built in one of the Checked Build Environments of the Windows Driver Kit (WDK).
For more information, see "Using the Checked Build of Windows" in the WDK.
child symbol
A symbol that is contained in another symbol. For example, the symbol for a member in a structure is a child of the symbol for that structure.
See also parent symbol.
For more information, see Scopes and Symbol Groups.
client
See client object.
client object
A client object is used for interaction with the debugger engine. It holds per-client state, and provides implementations for the top-level interfaces in the debugger engine
API.
For more information, see Client Objects.
client thread
The thread in which the client object was created. In general, a client's methods may be called only from this thread. The debugger engine uses this thread to make all
calls to the callback object registered with the client.
For more information, see Client Objects.
code breakpoint
See software breakpoint.
crash dump file
A file that contains a snapshot of certain memory regions and other data related to an application or operating system. A crash dump file can be stored and then used to
debug the application or operating system at a later time.
A user-mode crash dump file can be created by Windows when an application crashes, and a kernel-mode crash dump file can be created by special Windows routines
when Windows itself crashes. There are several different types of crash dump files.
For more information, see Crash Dump Files.
current process
The process that the debugger engine is currently controlling. When an event occurs, the current process is set to the event process.
See also current target and current thread.
For more information, see Threads and Processes.
current target
The target that the debugger engine is currently controlling. When an event occurs, the current target is set to the event target.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
D
data breakpoint
See processor breakpoint.
DbgEng extension
A debugger extension based on the prototypes in the dbgeng.h header file. These extensions use the debugger engine API to communicate with the debugger engine.
See also WdbgExts extension.
For more information, see Writing DbgEng Extensions.
debug build
See Checked Build.
debuggee
See target.
debugger
A debugger engine application that uses the full functionality of the debugger engine. For example, WinDbg, CDB, NTSD, and KD are debuggers.
debugger console
A fictional entity representing the source of the debugger engine input and the destination of its output. In reality, the debugger engine only uses input and output
callbacks and has no notion of what is being used to implement them.
Typically, input is received from the Debugger Command window and output is sent to the same window. However, the input and output callbacks can provide many
other sources of input and destinations for output, for example, remote connections, script files, and log files.
For more information, see Input and Output.
debugger engine
A library for manipulating debugging targets. Its interface is based on the prototypes in the dbgeng.h file. It is used by debuggers, extensions, and debugger engine
applications.
For more information, see Debugger Engine Overview.
debugger engine API
A powerful interface to control the behavior of the debugger engine. It may be used by debuggers, DbgEng extensions, and debugger engine applications. The prototypes
for this interface are found in the dbgeng.h header file.
For more information, see Using the Debugger Engine API.
debugger engine application
A stand-alone application that uses the debugger engine API to control the debugger engine.
debugger extension
An external function that can run inside the debugger. Each extension is exported from a module known as an debugger extension DLL. The debugger engine invokes the
debugger extension by calling its code within the DLL. Some debugger extensions ship with Debugging Tools for Windows. You can write your own extensions to
automate any number of debugger features or to customize the output of the information accessible to the debugger.
Also referred to as an extension command, or simply extension.
See also DbgEng extension, WdbgExts extension.
debugger extension DLL
A DLL containing debugger extensions. When the debugger engine loads the DLL these extensions become available for use within the debugger.
debugger extension library
See debugger extension DLL.
debugging client
An instance of the debugger engine acting as a proxy, sending debugger commands and I/O to the debugging server.
See also smart client.
For more information, see Remote Debugging or Debugging Server and Debugging Client.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
debugging server
An instance of the debugger engine acting as a host, listening for connections from debugging clients.
See also process server.
For more information, see Remote Debugging or Debugging Server and Debugging Client.
debugging session
The debugging session is the actual act of running a software debugging program, such as WinDbg, KD, or CDB, to debug a software component, system service,
application, or operating system. The debugging session can also be run against a memory dump file for analysis.
A debugging session starts when a debugger acquires a target and lasts until all targets have been discarded.
default exception filter
The event filter which applies to exception events that do not match any other exception filters. The default exception filter is a specific exception filter.
See also arbitrary exception filter.
For more information, see Event Filters.
dormant mode
A state in which a debugger program is running, but without a target or active session.
For more information, see Starting the Debugger.
downstream store
A cache of symbols created by a symbol server. Typically this cache is on your local machine, while the symbol store is located remotely. If you have a chain of symbol
servers, the downstream store can be located on any computer downstream from the symbol store.
For more information, see Using SymSrv.
dump file
See crash dump file.
dump target
A crash dump file that is being debugged.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
E
effective processor type
The processor type the debugger uses when dealing with the target computer. The effective processor type affects how the debugger sets breakpoints, accesses registers,
gets stack traces, and performs other processor-specific actions.
See also actual processor type, executing processor type.
For more information, see Target Information.
engine
See debugger engine.
event
The debugger engine monitors some of the events that occur in its targets. These include a breakpoint being triggered, an exception, thread and process creation, module
loading, and internal debugger engine changes.
See also event callbacks.
For more information, see the topics Controlling Exceptions and Events and Monitoring Events.
event filter
A collection of rules that influence how the debugger engine proceeds after an event has occurred in a target. There are three types of event filters: specific event filters,
specific exception filters, and arbitrary exception filters.
See also specific filters, exception filters, event callbacks.
For more information, see the topics Controlling Exceptions and Events and Event Filters
event callback objects
Instances of the IDebugEventCallbacks interface which have been registered with a client. The engine notifies the event callbacks whenever an event occurs.
For more information, see Controlling Exceptions and Events and Event Callbacks.
event callbacks
See event callback objects.
event process
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
F
free build
Two different builds of each NT-based operating system exist:
The free build (or retail build) of Windows is the end-user version of the operating system. The system and drivers are built with full optimization, debugging
asserts are disabled, and debugging information is stripped from the binaries. A free system and driver are smaller and faster, and it uses less memory.
The checked build (or debug build) of Windows serves as a testing and debugging aid. For details, see checked build.
Distribution media containing the free build of the operating system do not have any special labels in other words, the CD containing the free build will just be labeled
with the Windows version name, and no reference to the type of build.
first-chance exception
The first opportunity to handle an exception. If an exception is not handled by any handler on the first opportunity, the handlers are given a second chance.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
host
See host computer.
handling status
The handling status specifies whether the debugger engine should flag an exception event as handled or not. The handling status is part of an exception filter.
See also break status.
For more information, see the topics Controlling Exceptions and Events and Event Filters
host computer
The host computer is the computer that runs the debugging session. All debugger operationssuch as executing commands and extensions, and symbol loadingare
performed on the host computer.
In a typical two-system kernel debugging session, the debugger is running on the host computer, which is connected to the target computer being debugged.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
I
I/O Request Packet (IRP)
A data structure used to represent an I/O request and control its processing. An IRP structure consists of a header and one or more stack locations.
image
An executable, DLL, or driver that Windows has loaded as part of a user-mode process or the Windows kernel.
See also image file.
image file
The file from which an image was loaded.
implicit process
In kernel-mode debugging, the process used to determine which virtual address space to use when performing virtual to physical address translation. When an event
occurs, the implicit process is set to the event process.
See also implicit thread.
For more information, see Threads and Processes.
implicit thread
In kernel-mode debugging, the thread used to determine some of the target's registers, including frame offset and instruction offset. When an event occurs, the implicit
thread is set to the event thread.
See also implicit process.
For more information, see Threads and Processes.
inaccessible
A debugging session is inaccessible when all the targets are executing.
initial breakpoint
A breakpoint that automatically occurs near the beginning of a debugging session, after a reboot, or after a target application is restarted.
For more information, see Using Breakpoints.
input callback objects
Instances of the IDebugInputCallbacks interface which have been registered with a client. Whenever the debugger engine requires input it asks the input callbacks to
provide it.
See also output callbacks.
For more information, see Input Callbacks.
input callbacks
See input callback objects.
interrupt
A condition that disrupts normal command execution and transfers control to an interrupt handler. I/O devices requiring service from the processor usually initiate
interrupts.
Interrupt Request Level (IRQL)
The priority ranking of an interrupt. Each processor has an IRQL setting that threads can raise or lower. Interrupts that occur at or below the processor's IRQL setting are
masked and will not interfere with the current operation. Interrupts that occur above the processor's IRQL setting take precedence over the current operation.
2009 Microsoft Corporation
Send feedback on this topic
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
K
KD connection server
A proxy used during some forms of kernel-mode remote debugging. It listens for connections from smart client and performs memory, processor, or Windows operations
as requested by these remote clients. .
See also debugging server.
For more information, see KD Connection Servers (Kernel Mode).
kernel
The kernel is the portion of the Windows operating system that manages and controls access to hardware resources. It performs thread scheduling and dispatching,
interrupt and exception handling, and multiprocessor synchronization.
kernel error
See bug check.
kernel mode
Kernel-mode code has permission to access any part of the system, and is not restricted like user-mode code. It can gain access to any part of any other process running in
either user mode or kernel mode.
Performance-sensitive operating system components run in kernel mode. In this way they can interact with the hardware and with each other without the overhead of
context switch. All the kernel-mode components are fully protected from applications running in user mode. They can be grouped as follows:
Executive.
This contains the base operating system components such as memory management, process and thread management, security, I/O, interprocess communication.
Kernel.
This performs low-level functions such as thread scheduling, interrupt and exception dispatching, and multiprocessor synchronization. It also provides a set of
routines and basic objects used by the Executive to implement higher-level semantics.
When a process erroneously accesses a portion of memory that is in use by another application or by the system, the lack of restrictions on kernel-mode processes forces
Windows to stop the entire system. This is referred to as a bug check.
Malfunctioning hardware devices or device drivers, which reside in kernel mode, are often the culprits in bug checks.
kernel-mode target
See target computer.
kernel-mode debugging
A debugger session in which the target is running in kernel mode.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
L
live kernel-mode debugging
Kernel-mode debugging using live targets.
See also live user-mode debugging.
live target
A target application or target computer that is currently operational (as opposed to a dump target).
live user-mode debugging
User-mode debugging using live targets.
See also live kernel-mode debugging.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
local context
See scope.
local debugging
This refers to a debugging session in which the debugger and the application to be debugged reside on the same computer.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
M
module
An image in a target process.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
N
nonpaged pool
A portion of system memory that will not be paged to disk.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
O
output callback objects
Instances of the IDebugOutputCallbacks interface which have been registered with a client object. All output from the debugger engine is sent to the output callbacks.
For more information, see Output Callbacks.
output callbacks
See output callback objects.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
P
page table
A process-specific table that maps virtual memory addresses to physical memory addresses.
Page Table Entry (PTE)
An item in the page table.
paged pool
A portion of system memory that can be paged to disk.
Note that this term does not only refer to memory that actually has actually been paged out to the disk it includes any memory that the operating system is permitted to
page.
paging
A virtual memory operation in which the memory manager transfers pages from memory to disk when physical memory becomes full. A page fault occurs when a thread
accesses a page that is not in memory.
parent symbol
A symbol that is contains in other symbols, for example, a structure contains its member.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
R
remote debugging
Remote debugging is the practice of using a remote connection to perform debugging.
Since user-mode debugging is usually done on one machine, remote user-mode debugging typically uses two machines. In this scenario, one computer contains the target
application and a debugging server, while the other computer contains the debugging client. An alternate method is to have the target application and a process server on
one computer, and a smart client on the other.
Since kernel-mode debugging is usually done on two machines, remote kernel-mode debugging requires three machines. The target computer is the computer being
debugged. The server is attached to the target; it contains the kernel-mode debugger. The client is the computer which is controlling the session remotely. Typically, one
computer is the target computer being debugged, another contains the debugging server, and the third contains the debugging client.
In addition, there are other methods of remote debugging: using the Remote tool, using a KD connection server, or using a repeater. The method you should choose
depends on the configuration of the machines in question and the available connections.
For more information, see Remote Debugging.
register
A very fast temporary memory location in the CPU.
register context
The full processor state which includes all the processor's registers.
For more information, see Register Context.
retail build
See free build.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
S
scope
The context that defines the local variables. The scope has three components: a stack frame, a current instruction, and a register context.
Sometimes referred to as local context or lexical scope.
For more information, see the topics Changing Contexts and Scopes and Symbol Groups.
second-chance exception
The second opportunity to handle an exception. This opportunity is only provided if the exception was not handled on the first chance.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
smart client
An instance of the debugger engine acting as a host. The smart client is connected to a process server. or a KD connection server.
See also debugging client.
For more information, see Process Servers (User Mode), KD Connection Servers (Kernel Mode), and Process Server and Smart Client.
specific exception filter
An event filter for an exception for which the engine has a built-in filter. Most specific exception filters refer to specific types of exceptions (identified by exception
code), but the default exception filter also qualifies as a specific exception filter.
See also arbitrary exception filter, specific event filter, specific filter, exception filter.
For more information, see Event Filters.
specific event filter
An event filter for an event which is not an exception. The specific event filters are listed in DEBUG_FILTER_XXX.
See also specific exception filter, specific filter.
For more information, see Event Filters.
specific filter
An event filter for an event for which the engine has a built-in filter.
See also specific event filter, specific exception filter.
software breakpoint
A breakpoint that is implemented by the debugger engine temporarily modifying the target's executable code. The breakpoint is triggered when the code is executed. The
code modification is invisible to users of the debugger or the debugger engine API.
See also processor breakpoint.
For more information, see Using Breakpoints or Breakpoints.
stack
See call stack.
stack frame
The memory in the call stack containing the data for a single function call. This includes the return address, parameters passed to the function, and local variables.
stop code
See bug check code.
stop error
See bug check.
stop screen
See blue screen.
subregister
A register that is contained within another register. When the subregister changes, the portion of the register that contains the subregister also changes.
suspended
A target, process, or thread is suspended if it has been blocked it from executing.
symbol
A unit of debugging information which provides interpretive information about the target in a debugging session. Examples of symbols include variables (local and
global), functions, types and function entries. Information about symbols can include the name, type (if applicable), and the address or register where it is stored, as well
as any parent or child symbols. This information is stored in symbol files and is typically not available in the module itself.
The debugger engine can synthesize certain symbols when symbol files are not available (for example, exported symbols), but these symbols generally provide only
minimal information.
symbol file
A supplemental file created when an application, library, driver, or operating system is built. A symbol file contains data which is not actually needed when running the
binaries, but which is very useful in the debugging process.
For more information, see Symbol Files: Overview.
symbol group
A group of symbols, typically representing all the local variables in a scope.
For more information, see Scopes and Symbol Groups.
symbol type
Descriptive information about a symbols representation, such as its layout in memory. This is part of the information a compiler uses to generate code to manipulate the
symbol. It is also used by the debugger engine to manipulate symbols. The symbol type is distributed in symbol files.
synthetic module
A region of memory that the engine treats like a module. A synthetic module may contain synthetic symbols.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
T
target
A target application, target computer, or dump target.
Sometimes referred to as the debuggee.
target application
An application that is being debugged in user-mode.
target computer
A computer that is being debugged in kernel-mode.
target ID
The unique identifier for a target.
target process
In user-mode debugging, an operating system process that is part of the target application.
In kernel-mode debugging, the virtual process representing the kernel.
target thread
In user-mode debugging, an operating system thread in the target application.
In kernel-mode debugging, a virtual thread representing a processor.
thread context
The state preserved by Windows when switching threads. This is similar to the register context, except that there is some extra kernel-only processor state that is part of
the register context but not the thread context. This extra state is available as registers during kernel-mode debugging.
For more information, see Scopes and Symbol Groups.
transport layer
This controls communication between the host and target computers during remote debugging.
trap
See bug check.
type
See symbol type.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
U
user mode
Applications and subsystems run within Windows in user mode. Processes that run in user mode do so within their own virtual address spaces. They are restricted from
gaining direct access to many parts of the system, including system hardware, memory that was not allocated for their use, and other portions of the system that might
compromise system integrity. Because processes that run in user mode are effectively isolated from the system and other user-mode processes, they cannot interfere with
these resources.
User-mode processes can be grouped in the following categories:
System Processes.
These perform important functions and are integral part of the operating system. System processes include such items as the logon process and the session manager
process.
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010
Introduction
Server Processes.
These are operating system services such as the Event Log and the Scheduler. They can be configured to start automatically at boot time.
Environment Subsystems.
These are used to create a complete operating system environment for the applications. Windows provides the following three environments: Win32, POSIX, and
OS/2.
User Applications.
There are five types: Win32, Windows 3.1, Microsoft MS-DOS, POSIX, and OS/2.
user-mode debugging
A debugger session in which the target is running in user mode.
user-mode target
See target application.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
V
virtual process
In kernel-mode debugging the debugger engine creates a single virtual process to represent the target's kernel.
See also virtual thread.
virtual thread
In kernel-mode debugging the debugger engine creates a virtual thread for each processor in the target computer.
See also virtual process.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
Debugging Tools for Windows
W
WdbgExts API
An interface exposed by the debugger engine for extensions. It contains a subset of the functionality of the debugger engine API and can only be used by extensions.
WdbgExts extension
An extension based on the prototypes in the wdbgexts.h header file. These extensions use the WdbgExts API.
See also DbgEng extension.
For more information, see Writing WdbgExts Extensions.
WOW64
An emulation layer in 64-bit Windows that can run 32-bit Windows applications. When debugging a 32-bit application running on 64-bit Windows, it is important to
distinguish between the application itself and the WOW64 subsystem.
For more information on 32-bit and 64-bit debugging, see Choosing a 32-bit or 64-bit Debugger Package.
2009 Microsoft Corporation
Send feedback on this topic
Debugging Tools for Windows
December 09, 2009
file://C:\Users\joy.CAMSYS\AppData\Local\Temp\~hhCDEB.htm
9/18/2010