问题
I am starting a prototype including a Windows minifilter. I have set up my environment:
- a target Virtual Machine (actually 3: a Windows 7, 8 and 8.1)
- a host development machine (which hosts Visual Studio 2013 and HyperV VMs)
I finally managed to deploy the test minifilter to the target machine, but my problem is:
I can not break the kernel in the target machine.
When I make a build and start from Visual Studio Debugger, here is the result:
-----------------------------------------------------------------------
-----------------------------------------------------------------------
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
And when I try to break, nothing happens.
When I attach directly to the kernel (using VS menu "Debug" -> "Attach to process" -> "Kernel debugging" -> "Attach", I get this:
-----------------------------------------------------------------------
-----------------------------------------------------------------------
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...
But again, impossible to break.
I tried :
- all target hosts (Windows 7, 8 and 8.1) and got the same result (and yes, all of them are correctly configured for kernel debugging)
- using network instead of named pipes
- using WinDBG instead of Visual Studio
But I always get the same result: impossible to break this !@# kernel!
Google isn't my friend, I couldn't find any similar problem.
So now I am wondering:
- Could I be actually not connected to the target machine, despite what the debugger says (but deployment works)?
- Could there be a problem with HyperV and kernel debugging?
Any idea welcome!
Edit: I did a test with a real target machine instead of a virtual one, and I have the same problem, so this is not related to Hyper-V.
回答1:
I solved my problem (I suck, therefore I am)
In a nutshell, here is how the two machines must be configured for kernel debugging.
A. Target machine (Hyper-V VM)
- Configure for kernel debugging (using msconfig is the easiest way) on serial COM1
- Configure Hyper-V machine to pipe COM1 to a named pipe (\.\pipe\debug for example)
B. Source machine (Hyper-V host hosting the target)
- Run WinDBG or VS in admin mode (that was my first mistake)
- Connect to named pipe with exactly the same name (\.\pipe\debug) (that was my second mistake, I thought the machine name had to be actual target name)
It works just fine, with a nice integration under Visual Studio 2013. Thanks to all those who answered (nobody)... And all others who read :)
来源:https://stackoverflow.com/questions/19706077/i-cant-break-when-attaching-to-target-machine-in-kernel-debug-mode