【问题标题】:I can't break when attaching to target machine in kernel debug mode在内核调试模式下连接到目标机器时无法中断
【发布时间】:2013-11-11 10:23:21
【问题描述】:

我正在开始一个包含 Windows 微过滤器的原型。 我已经设置了我的环境:

  • 目标虚拟机(实际上是 3:Windows 7、8 和 8.1)
  • 主机开发机器(托管 Visual Studio 2013 和 HyperV VM)

我终于设法将测试微过滤器部署到目标机器,但我的问题是:

我无法破坏目标机器中的内核。

当我进行构建并从 Visual Studio 调试器启动时,结果如下:

    -----------------------------------------------------------------------
-----------------------------------------------------------------------
                  Starting New Debugger Session         
-----------------------------------------------------------------------
-----------------------------------------------------------------------

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

MONTLUC\pascal (npipe WinIDE_01CED6303D19BD92) connected at Thu Oct 31 12:56:31 2013

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

Waiting for pipe \\montlucw81x64\pipe\dbg
Waiting to reconnect...
[12:56:32:860]: Removing any existing files from the remote driver folder
[12:56:33:121]: Removing any existing files from test execution folder

te.exe "%SystemDrive%\DriverTest\Run\DriverTestTasks.dll" /select:"@Name='DriverTestTasks::_DriverRemoval'" /p:"InfFile=passThrough.inf" /p:"Debug=1" /p:"ImportDriver=1" /p:"RemoveDriver=1" /p:"CertificateFile=package.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)_00060.wtl",writemode=append,encoding=unicode,nofscache=true,EnableLvl="WexStartTest|WexEndTest|WexXml|WexProperty|WexCreateContext|WexCloseContext|*" /runas:Elevated
[12:56:56:926]: Result Summary: Total=1, Passed=1, Failed=0, Blocked=0, Warned=0, Skipped=0
[12:56:57:457]: Removing any existing files from test execution folder

te.exe "%SystemDrive%\DriverTest\Run\DriverTestTasks.dll" /select:"@Name='DriverTestTasks::_DriverPreparation'" /p:"InfFile=passThrough.inf" /p:"Debug=1" /p:"ImportDriver=1" /p:"RemoveDriver=1" /p:"CertificateFile=package.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)_00060.wtl",writemode=append,encoding=unicode,nofscache=true,EnableLvl="WexStartTest|WexEndTest|WexXml|WexProperty|WexCreateContext|WexCloseContext|*" /runas:Elevated
[12:57:00:437]: Result Summary: Total=1, Passed=1, Failed=0, Blocked=0, Warned=0, Skipped=0
[12:57:00:893]: Removing any existing files from test execution folder

te.exe "%SystemDrive%\DriverTest\Run\DriverTestTasks.dll" /select:"@Name='DriverTestTasks::_RunProcess'" /p:"BinaryPath=rundll32" /p:"Arguments=setupapi,InstallHinfSection DefaultInstall 132 C:\DriverTest\Drivers\passthrough.inf" /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)_00025.wtl",writemode=append,encoding=unicode,nofscache=true,EnableLvl="WexStartTest|WexEndTest|WexXml|WexProperty|WexCreateContext|WexCloseContext|*" /runas:Elevated
[12:57:03:916]: Result Summary: Total=1, Passed=1, Failed=0, Blocked=0, Warned=0, Skipped=0
[12:57:04:418]: 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)_00060.wtl",writemode=append,encoding=unicode,nofscache=true,EnableLvl="WexStartTest|WexEndTest|WexXml|WexProperty|WexCreateContext|WexCloseContext|*" /runas:Elevated
[12:57:06:139]: Result Summary: Total=1, Passed=1, Failed=0, Blocked=0, Warned=0, Skipped=0
[12:57:06:564]: Driver Installation summary:
[12:57:06:566]:   Driver Removal (x64) (possible reboot): Pass
[12:57:06:571]:   Driver Preparation (x64) (possible reboot): Pass
[12:57:06:578]:   Driver Install (x64) (possible reboot): Pass
[12:57:06:586]:   Driver Post Install Actions (x64) (possible reboot): Pass

当我试图打破时,什么也没有发生。

当我直接附加到内核时(使用 VS 菜单“调试”->“附加到进程”->“内核调试”->“附加”,我得到这个:

-----------------------------------------------------------------------
-----------------------------------------------------------------------
                  Starting New Debugger Session         
-----------------------------------------------------------------------
-----------------------------------------------------------------------

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

MONTLUC\pascal (npipe WinIDE_01CED630A522D2F5) connected at Thu Oct 31 12:59:26 2013

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

Waiting for pipe \\montlucw81x64\pipe\dbg
Waiting to reconnect...

但同样,不可能打破。

我试过了:

  • 所有目标主机(Windows 7、8 和 8.1)并得到相同的结果(是的,它们都已正确配置用于内核调试)
  • 使用网络而不是命名管道
  • 使用 WinDBG 而不是 Visual Studio

但我总是得到相同的结果:不可能打破这个!@#内核!

Google 不是我的朋友,我找不到任何类似的问题。

所以现在我想知道:

  • 我是否真的没有连接到目标机器,尽管调试器说了什么(但部署工作)?
  • HyperV 和内核调试会不会有问题?

欢迎任何想法!


编辑:我用真实的目标机器而不是虚拟机器做了测试,我也遇到了同样的问题,所以这与 Hyper-V 无关。

【问题讨论】:

    标签: windows debugging kernel minifilter


    【解决方案1】:

    我解决了我的问题(我很烂,所以我在)

    简而言之,这就是两台机器必须如何配置才能进行内核调试。

    A.目标机器(Hyper-V VM)

    • 在串行 COM1 上配置内核调试(使用 msconfig 是最简单的方法)
    • 将 Hyper-V 机器配置为通过管道将 COM1 传输到命名管道(例如 \.\pipe\debug)

    B.源计算机(托管目标的 Hyper-V 主机)

    • 在管理员模式下运行 WinDBG 或 VS(这是我的第一个错误)
    • 连接到具有完全相同名称 (\.\pipe\debug) 的命名管道(这是我的第二个错误,我认为机器名称必须是实际目标名称)

    它工作得很好,在 Visual Studio 2013 下有很好的集成。 感谢所有回答的人(没有人)......以及所有阅读的人:)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-09-22
      • 2018-08-15
      • 1970-01-01
      • 2015-01-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多