Windows kits 10 debugger

Getting Started with WinDbg (Kernel-Mode)

WinDbg is a kernel-mode and user-mode debugger that is included in Debugging Tools for Windows. Here we provide hands-on exercises that will help you get started using WinDbg as a kernel-mode debugger.

For information about how to get Debugging Tools for Windows, see Debugging Tools for Windows (WinDbg, KD, CDB, NTSD). After you have installed the debugging tools, locate the installation directories for 64-bit (x64) and 32-bit (x86) versions of the tools. For example:

  • C:\Program Files (x86)\Windows Kits\10\Debuggers\x64
  • C:\Program Files (x86)\Windows Kits\10\Debuggers\x86

Set up a kernel-mode debugging

A kernel-mode debugging environment typically has two computers: the host computer and the target computer. The debugger runs on the host computer, and the code being debugged runs on the target computer. The host and target are connected by a debug cable.

The Windows debuggers support these types of cables for debugging:

  • Ethernet
  • USB 2.0 / USB 3.0
  • Serial (also called null modem)

For speed and reliablity, using Ethernet with a local network hub, is recommended. This diagram illustrates a host and target computer connected for debugging over Ethernet cable.

Another option for older versions of Windows is to use a direct cable such as USB or serial cable.

For details about how to set up the host and target computers, see Setting Up Kernel-Mode Debugging Manually.

Virtual Machine — VMs

For information on connecting a debugger to a Hyper-V virtual machine, see Setting Up Network Debugging of a Virtual Machine — KDNET.

Establish a kernel-mode debugging session

After you have set up your host and target computer and connected them with a debug cable, you can establish a kernel-mode debugging session by following the instructions in the same topic that you used for getting set up. For example, if you decided to set up your host and target computers for debugging over Ethernet, you can find instructions for establishing a kernel-mode debugging session is this topic:

Get started using WinDbg

On the host computer, open WinDbg and establish a kernel-mode debugging session with the target computer.

In WinDbg, choose Contents from the Help menu. This opens the debugger documentation CHM file. The debugger documentation is also available on line in Debugging Tools for Windows.

When you establish a kernel-mode debugging session, WinDbg might break in to the target computer automatically. If WinDbg has not already broken in, choose Break from the Debug menu.

Near the bottom of the WinDbg window, in the command line, enter this command:

The output is similar to this:

The symbol search path tells WinDbg where to look for symbol (PDB) files. The debugger needs symbol files to obtain information about code modules (function names, variable names, and the like).

Enter this command, which tells WinDbg to do its initial finding and loading of symbol files:

To see a list of loaded modules, enter this command:

The output is similar to this:

To start target computer running, enter this command:

To break in again, choose Break from the Debug menu.

Enter this command to examine the _FILE_OBJECT data type in the nt module:

The output is similar to this:

Enter this command to examine some of the symbols in the nt module:

Читайте также:  Disabling apps windows 10

The output is similar to this:

Enter this command to put a breakpoint at MmCreateProcessAddressSpace:

To verify that the breakpoint is set, enter this command:

The output is similar to this:

Enter g to let the target computer run.

If the target computer doesn’t break in to the debugger immediately, perform a few actions on the target computer (for example, open Notepad). The target computer will break in to the debugger when MmCreateProcessAddressSpace is called. To see the stack trace, enter these commands:

The output is similar to this:

On the View menu, choose Disassembly.

On the Debug menu, choose Step Over (or press F10). Enter step commands a few more times as you watch the Disassembly window.

Clear your breakpoint by entering this command:

Enter g to let the target computer run. Break in again by choosing Break from the Debug menu or pressing CTRL-Break.

To see a list of all processes, enter this command:

The output is similar to this:

Copy the address of one process, and enter this command:

For example: !process ffffe00000d5290 2

The output shows the threads in the process.

Copy the address of one thread, and enter this command:

For example: !thread ffffe00000e6d080

The output shows information about the individual thread.

To see all the device nodes in the Plug and Play device tree, enter this command:

To see the device nodes along with their hardware resources, enter this command:

To see a device node that has a service name of disk, enter this command:

The output of !devnode 0 1 displays the address of the physical device object (PDO) for the node. Copy the address of a physical device object (PDO), and enter this command:

For example: PdoAddress!devstack 0xffffe00001159610

To get information about the driver disk.sys, enter this command:

The output of !drvobj displays addresses of dispatch routines: for example, CLASSPNP!ClassGlobalDispatch. To set and verify a breakpoint at ClassGlobalDispatch, enter these commands:

Enter g to let the target computer run.

If the target computer doesn’t break in to the debugger immediately, perform a few actions on the target computer (for example, open Notepad and save a file). The target computer will break in to the debugger when ClassGlobalDispatch is called. To see the stack trace, enter these commands:

The output is similar to this:

To end your debugging session, enter this command:

Отладчик Windows (WinDbg) Windows Debugger (WinDbg)

Отладка устройства Windows 10 IoT базовая с помощью мощного отладчика Windows, WinDbg. Debug your Windows 10 IoT Core device using the powerful Windows debugger, WinDbg.

В следующих разделах описывается, как успешно подключиться с WinDbg к устройству Windows 10 IoT базовая для отладки. The following sections describe how to successfully connect with WinDbg to a Windows 10 IoT Core device for debugging purposes. Сюда входит описание необходимых параметров программного обеспечения на устройстве, а также физические подключения оборудования. This includes a description of the necessary software settings on the device as well as the physical hardware connections.

WinDbg — очень мощный отладчик, с которым знакомы большинство разработчиков Windows. WinDbg is a very powerful debugger that most Windows developers are familiar with. Однако если вы только приступите к работе и хотите узнать больше о WinDbg, перейдите по следующим ссылкам: However, if you are just getting started and would like to learn more about WinDbg, please visit the following links:

MinnowBoard Max (МИКРОТЕСТОВ) MinnowBoard Max (MBM)

Вы можете подключить WinDbg к устройству MinnowBoard Max с помощью сетевого подключения. You can connect WinDbg to the MinnowBoard Max device using a network connection.

Настройка сетевого подключения Setup network connection

Чтобы включить отладку ядра с помощью WinDbg по сети, убедитесь, что: In order to enable kernel debugging with WinDbg over a network, ensure that:

Читайте также:  Что такое условные обозначения windows

Кабель Ethernet подключен к сети MinnowBoard Max Device. An Ethernet cable is connected to MinnowBoard Max device to your network

MinnowBoard Max Device имеет допустимый IP-адрес в вашей сети. The MinnowBoard Max device has a valid IP address in your network

Активное подключение к устройству MinnowBoard Max с помощью PowerShell An active connection to the MinnowBoard Max device via PowerShell

Используя активное подключение PowerShell, выполните следующие команды в параметре MinnowBoard Max, чтобы включить отладку по сети. Using the active PowerShell connection, execute the following commands on the MinnowBoard Max to enable debugging over the network.

bcdedit -dbgsettings net hostip: port:

Эта команда включает отладку по сети. This command enables debugging over the network. Кроме того, он указывает IP-адрес компьютера, на котором будет выполняться WinDbg (DEV_PC_IP_ADDRESS), номер сетевого порта, используемого для подключения (PORT_NUM), и уникальный ключ, который будет использоваться для различения нескольких подключений (ключ). Additionally, it specifies the IP address of the PC where WinDbg will be running (DEV_PC_IP_ADDRESS), the network port number to use for the connection (PORT_NUM), and a unique key to be used to differentiate multiple connections (KEY)

Для PORT_NUM и ключа можно использовать следующие значения в качестве примеров: 50045 и 1.2.3.4 соответственно, хотя вы можете изменить их по своему усмотрению. For PORT_NUM and KEY, you can use the following values as examples: 50045 and 1.2.3.4 respectively, although you are free to change them as you see fit

bcdedit -debug on

  • Эта команда включает отладку на устройстве This command turns on debugging on the device

На компьютере разработчика запустите WinDbg с PORT_NUM и КЛЮЧЕВЫМи значениями, приведенными в предыдущих шагах, как показано ниже. «c:\Program Files (x86)\Debugging Tools for Windows (x86)\windbg.exe» -k net:port=

,key= On the developer PC, start WinDbg with the PORT_NUM and the KEY values provided in the previous steps as follows: «c:\Program Files (x86)\Debugging Tools for Windows (x86)\windbg.exe» -k net:port=

Если вы установили любой из установленных комплектов Windows, вы можете найти WinDbg в разделе C:\Program Files (x86)\Windows Kits\10\Debuggers\x86\WinDbg.exe If you have any of the Windows kits installed, you may find WinDbg under C:\Program Files (x86)\Windows Kits\10\Debuggers\x86\WinDbg.exe

  • Перезагрузка устройства Иоткоре для повторного подключения к отладчику Reboot the IoTCore device to reconnect to the debugger

Raspberry Pi 2 или 3 (RPi2 или RPi3) Raspberry Pi 2 or 3 (RPi2 or RPi3)

Вы можете подключить WinDbg к Raspberry Pi 2 или 3 с помощью последовательного подключения. You can connect WinDbg to the Raspberry Pi 2 or 3 using a serial connection.

Настройка последовательного подключения Setup serial connection

Чтобы включить отладку ядра с помощью WinDbg через последовательное подключение, убедитесь, что: In order to enable kernel debugging with WinDbg over a serial connection, ensure that:

У вас есть отладочный кабель, такой как последовательный кабель от USB до TTL от Adafruit или фтди. You have a debug cable such as the USB-to-TTL Serial Cable from Adafruit or FTDI.

Кабель Ethernet или активный WiFi, соединяющий устройство Raspberry Pi 2 или 3 с вашей сетью (для IP-подключений, таких как SSH или PowerShell). An Ethernet cable or active WiFi connecting your Raspberry Pi 2 or 3 device to your network (for IP connections like SSH or PowerShell)

Устройство Raspberry Pi 2 или 3 имеет допустимый IP-адрес в сети The Raspberry Pi 2 or 3 device has a valid IP address in your network

Активное подключение к устройству Raspberry Pi 2 или 3 с помощью PowerShell или SSH An active connection to the Raspberry Pi 2 or 3 device via PowerShell or SSH

UART0 будет использоваться на устройстве Raspberry Pi 2 или 3 для подключения отладки ядра. UART0 will be used on the Raspberry Pi 2 or 3 device for the kernel debugging connection. Ниже показаны сопоставления ПИН-кода для Raspberry Pi 2 или 3, а также последовательных кабелей: The following shows the pin mappings for the Raspberry Pi 2 or 3 as well as the serial cables:

Читайте также:  Disk image tools windows

Основная идея для создания правильных последовательных подключений заключается в том, что хотя одно устройство использует его для передачи данных, другое устройство использует RX для получения данных. The basic idea for making the correct serial connections is to remember that while one device uses its TX to transmit data, the other device uses its RX to receive the data. Ниже перечислены рекомендуемые подключения. Recommended connections are listed below:

Соединение ЕФИЕСП больше не создается. The EFIESP junction is no longer created. Его необходимо подключить самостоятельно. для получения идентификатора GUID можно использовать команду mountvol. You’ll have to mount it yourself,you can use mountvol command to get the GUID. mkdir C:\EFIESP mountvol C:\EFIESP \?\Volume

Используя активное подключение PowerShell, выполните следующие команды на устройстве Raspberry Pi 2 или 3, чтобы включить отладку по последовательному подключению. Using the active PowerShell connection, execute the following commands on the Raspberry Pi 2 or 3 device to enable debugging over the serial connection.

bcdedit /store c:\EFIESP\EFI\Microsoft\Boot\BCD -dbgsettings serial

  • Приведенная выше команда включает последовательное подключение для отладки. The above command enables the serial connection for debugging
  • Скорость передачи для Raspberry Pi 2 или 3 жестко запрограммирована на 921600, поэтому вам не нужно указывать его. The baud-rate for the Raspberry Pi 2 or 3 is hard-coded to 921600, so you don’t have to specify it

bcdedit /store c:\EFIESP\EFI\Microsoft\Boot\BCD -debug on

  • Эта команда включает отладку на устройстве This command turns on debugging on the device

На компьютере разработчика получите порт номера порта COM, назначенный в системе для кабеля USB – TTL. On the developer PC, get the COM port number PORT assigned in the system for the USB-to-TTL cable. Он будет доступен в Device Manager в разделе «порты (COM & LPT)». This will be available in Device Manager under «Ports (COM & LPT)».

«C:\Program Files (x86)\Debugging Tools for Windows (x86)\windbg.exe» -k com:port=

  • Запуск WinDbg с номером порта Start WinDbg with the PORT number

Если вы установили любой из установленных комплектов Windows, вы можете найти WinDbg в разделе C:\Program Files (x86)\Windows Kits\10\Debuggers\x86\WinDbg.exe If you have any of the Windows kits installed, you may find WinDbg under C:\Program Files (x86)\Windows Kits\10\Debuggers\x86\WinDbg.exe

  • Перезагрузка устройства Иоткоре для повторного подключения к отладчику Reboot the IoTCore device to reconnect to the debugger

Драгонбоард (DB) DragonBoard (DB)

Вы можете подключить WinDbg к Драгонбоард с помощью последовательного или USB-подключения. You can connect WinDbg to the DragonBoard using a serial or USB connection.

Используя активное подключение PowerShell или SSH к Драгонбоард, выполните следующие команды, чтобы включить отладку. Using the active PowerShell or SSH connection to your DragonBoard, execute the following commands to enable debugging.

  • bcdedit /store c:\EFIESP\EFI\Microsoft\Boot\BCD /debug ON
    • Включает отладчик Enables the debugger

Настройка USB-подключения Setup USB connection

По умолчанию параметры отладчика USB настраиваются в тестовых образах. By default the USB debugger settings are configured in the test images.

Когда отладчик ядра USB включен, порты USB на устройстве Драгонбоард могут не работать (например, клавиатура, USB-порт Ethernet может не работать). Once USB kernel debugger is on, USB ports on the DragonBoard device might not work (i.e. keyboard, usb ethernet might not work).

Настройка последовательного подключения Setup serial connection

bcdedit /store c:\EFIESP\EFI\Microsoft\Boot\BCD /dbgsettings Serial debugport:1 baudrate:115200

  • Настраивает последовательный порт Configures the serial port

Перезагрузка устройства Иоткоре для повторного подключения к отладчику Reboot the IoTCore device to reconnect to the debugger

Оцените статью