使用内核模式驱动程序进行远程调试的问题

Problems with remote debugging with kernel mode driver

我在那里使用 windows7 主机 我安装了 Vusual Studio 2013 和 WDK 8.1 我还有 Windows 10 个使用 Virtual Box 的虚拟机。

我从模板创建新的 KMDF 驱动程序并尝试调试它。

我成功配置了目标机器(它是 win10 虚拟机),驱动程序成功部署,但调试器仍处于非活动状态。这是来自 Debugger Inmmediate Window:

的日志
-----------------------------------------------------------------------
-----------------------------------------------------------------------
                  Starting New Debugger Session         
-----------------------------------------------------------------------
-----------------------------------------------------------------------

Microsoft (R) Windows Debugger Version 6.3.9600.17336 AMD64
Copyright (c) Microsoft Corporation. All rights reserved.

SM72UC\User (npipe WinIDE_01D16A27752C70A4) connected at Thu Feb 18 11:36:27 2016

Microsoft (R) Windows Debugger Version 6.3.9600.17336 AMD64
Copyright (c) Microsoft Corporation. All rights reserved.

Opened \.\pipe\com1
Waiting to reconnect...
[11:36:28:242]: Removing any existing files from the remote driver folder
[11:36:28:771]: Removing any existing files from test execution folder

te.exe "%SystemDrive%\DriverTest\Run\DriverTestTasks.dll" /select:"@Name='DriverTestTasks::_DriverRemoval'" /p:"InfFile=KMDFTest.inf" /p:"Debug=1" /p:"ImportDriver=1" /p:"RemoveDriver=1" /p:"HardwareId=Root\KMDFTest" /p:"CertificateFile=KMDFTestPackage.cer" /p:"PackageGuid={A23BA0FC-7265-4E3C-B99F-1E7A04AD970D}" /rebootStateFile:%SystemDrive%\DriverTest\Logs\DriverTestReboot.xml /enableWttLogging /wttDeviceString:$LogFile:file="%SystemDrive%\DriverTest\Logs\Driver_Removal_(x64)_(possible_reboot)_00009.wtl",writemode=append,encoding=unicode,nofscache=true,EnableLvl="WexStartTest|WexEndTest|WexXml|WexProperty|WexCreateContext|WexCloseContext|*" /runas:Elevated
[11:36:52:104]: Result Summary: Total=1, Passed=1, Failed=0, Blocked=0, Warned=0, Skipped=0
[11:36:52:705]: Removing any existing files from test execution folder

te.exe "%SystemDrive%\DriverTest\Run\DriverTestTasks.dll" /select:"@Name='DriverTestTasks::_DriverPreparation'" /p:"InfFile=KMDFTest.inf" /p:"Debug=1" /p:"ImportDriver=1" /p:"RemoveDriver=1" /p:"HardwareId=Root\KMDFTest" /p:"CertificateFile=KMDFTestPackage.cer" /p:"PackageGuid={A23BA0FC-7265-4E3C-B99F-1E7A04AD970D}" /rebootStateFile:%SystemDrive%\DriverTest\Logs\DriverTestReboot.xml /enableWttLogging /wttDeviceString:$LogFile:file="%SystemDrive%\DriverTest\Logs\Driver_Preparation_(x64)_(possible_reboot)_00009.wtl",writemode=append,encoding=unicode,nofscache=true,EnableLvl="WexStartTest|WexEndTest|WexXml|WexProperty|WexCreateContext|WexCloseContext|*" /runas:Elevated
[11:36:58:137]: Result Summary: Total=1, Passed=1, Failed=0, Blocked=0, Warned=0, Skipped=0
[11:36:58:792]: Removing any existing files from test execution folder

te.exe "%SystemDrive%\DriverTest\Run\DriverTestTasks.dll" /select:"@Name='DriverTestTasks::_RunProcess'" /p:"BinaryPath=%SystemDrive%\DriverTest\devcon.exe" /p:"Arguments=-f install %SystemDrive%\DriverTest\Drivers\KMDFTest.inf Root\KMDFTest" /p:"ExitCodes=0" /p:"WorkingFolder=%SystemDrive%\DriverTest\Drivers" /p:"LogOutput=1" /rebootStateFile:%SystemDrive%\DriverTest\Logs\DriverTestReboot.xml /enableWttLogging /wttDeviceString:$LogFile:file="%SystemDrive%\DriverTest\Logs\Driver_Install_(x64)_(possible_reboot)_00003.wtl",writemode=append,encoding=unicode,nofscache=true,EnableLvl="WexStartTest|WexEndTest|WexXml|WexProperty|WexCreateContext|WexCloseContext|*" /runas:Elevated
[11:37:22:743]: Result Summary: Total=1, Passed=1, Failed=0, Blocked=0, Warned=0, Skipped=0
[11:37:23:235]: Removing any existing files from test execution folder

te.exe "%SystemDrive%\DriverTest\Run\DriverTestTasks.dll" /select:"@Name='DriverTestTasks::_DriverPostInstall'" /rebootStateFile:%SystemDrive%\DriverTest\Logs\DriverTestReboot.xml /enableWttLogging /wttDeviceString:$LogFile:file="%SystemDrive%\DriverTest\Logs\Driver_Post_Install_Actions_(x64)_(possible_reboot)_00009.wtl",writemode=append,encoding=unicode,nofscache=true,EnableLvl="WexStartTest|WexEndTest|WexXml|WexProperty|WexCreateContext|WexCloseContext|*" /runas:Elevated
[11:37:25:227]: Result Summary: Total=1, Passed=1, Failed=0, Blocked=0, Warned=0, Skipped=0
[11:37:25:775]: Driver Installation summary:
[11:37:25:781]:   Driver Removal (x64) (possible reboot): Pass
[11:37:25:784]:   Driver Preparation (x64) (possible reboot): Pass
[11:37:25:785]:   Driver Install (x64) (possible reboot): Pass
[11:37:25:787]:   Driver Post Install Actions (x64) (possible reboot): Pass

此调试器卡住后,控制台处于非活动状态并向我显示文本 "Debuggee is running..." 我没有到达 DriverEntry 函数的断点,没有看到来自内核和驱动程序的任何调试消息。

我也试过调试网络设置,但结果相同。

怎么了?

VirtualBox 有问题吗?或者这是因为我尝试在win10上调试win7驱动?

正在等待重新连接...意味着调试器正在等待目标机器对其作出答复。虽然目标机器 运行 没有任何反应。你需要打破它。在 WinDBG 中按 Ctrl+C,在 Visual Studio 中按 Break 图标。