none
VS2012 Kernel Debugging & Testing RRS feed

  • Question

  • I am trying to develop a KMDF driver for Windows 8 in VS2012. I have the VS2012 "Windows Kernel Mode Debugger" setup to connect to the target system. The driver is built, test signed and deployed to the target.

    Q1) When I select "Debug -> Attach to Process..." and connect the debugger to the target, all the other options in VS2012 are disabled, including the options to run Tests e.g. CHAOS Test on target system.  How do I leave the VS2012 debugger connected *AND* run Driver Tests on the target.

    Q2) Also when I do the following :

    1/ Enable the "Enable KDFiles Deployment" for the "Driver"

    2/ Disable the deployment in the "Driver Package"

    3/ Build a new version of the driver in VS20120

    4/ Disable/enable the device on the target

     The KDFiles transfer does not work. How do I get this to work ?  

    Monday, February 25, 2013 5:04 AM

Answers

  • Q1)

    You are right that this should be possible (sorry for misleading you initially, I was wrong). In fact, I just tried attaching to a remote computer with a kernel debugger (through VS, using the Attach to process menu) and I was able to run remote tests while being attached.

    If all other options in VS2012 are disabled, it might mean that the debugger is still trying to attach to the remote target. Do you get the connection confirmation (in the "Debugger Immediate Window") after attaching? It should look like this:

    <COMPUTER_NAME>\<USER> (npipe WinIDE_01CE13B35CA34C68) connected at Mon Feb 25 15:53:51 2013

    As for your follow up question: in theory, this is possible from Visual Studio, as long as you are able to attach to the remote machine. The old approach still works though.

    Q2)

    Yes, it seems like it gets unchecked automatically every time on my side too, this might be a bug on our side. I tried this and get the same message that you get, and no transfer to the target system. I will investigate this and get back to you as soon as I can.


    Max -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Tuesday, February 26, 2013 12:15 AM

All replies

  • Q1) I am pretty sure this is not currently possible with the Windows 8 WDK, as the debugger uses the same underlying infrastructure as what is used for running driver tests, so you currently can't use both at the same time.

    Q2)
    - After enabling KDFiles Deployment for the driver, have you tried going back in the your project property page to make sure that "Enable .kdfiles deployment" is still selected? I've seen cases where it gets unselected automatically.
    - Have you tried right-clicking on your driver project (in the solution explorer) and using the "Deploy" option? What happens when you do so?


    Max -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Monday, February 25, 2013 5:45 PM
  • Thanks for your response Maxime.

    Q1)

    I should have clarified, my target is a VM and the kernel debugger transport is a named pipe (i.e. serial). Can you elaborate what you mean by infrastructure? My understanding is that the tests use the network and kernel debugger (in this case) uses serial. So they should theoretically work simultaneously.

    A follow up question – if the system crashes while running any of the tests and I want to debug the crash, would I have to resort of running WinDBG/KD standalone (i.e. outside VS2012). So basically debug the target, the old fashioned way ?

    Q2)

    The “Enable .kdfiles deployment” checkbox does indeed get unchecked automatically every single time I open up the “Driver -> Properties -> Driver Install -> KDFiles” property page . So I made sure I checked it, clicked “Apply” and then clicked “Deploy” as you have mentioned.  The following shows up in the “Output” windows.

    1>------ Deploy started: Project: TestKMDFDriver, Configuration: Win8 Debug Win32 ------

    1>  Done Adding Additional Store

    1>  Successfully signed: C:\Project\TestKMDFDriver\Win8Debug\TestKMDFDriver.sys

    ========== Build: 0 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========

    ========== Deploy: 1 succeeded, 0 failed, 0 skipped ==========

    However the driver does not transfer on the target system. Disabling/Enabling the device does not help either. The version of driver loaded on the target system is still an old version.

    Also can you please explain what “Remote Computer:” means in the context of “.kdfiles” as shown in the property page.  Kdfiles should be using whatever transport the debugger is currently connected to the target system, to transfer the driver binary. So not sure why a “Remote Computer” is required? Can you please explain.

    Monday, February 25, 2013 11:45 PM
  • Q1)

    You are right that this should be possible (sorry for misleading you initially, I was wrong). In fact, I just tried attaching to a remote computer with a kernel debugger (through VS, using the Attach to process menu) and I was able to run remote tests while being attached.

    If all other options in VS2012 are disabled, it might mean that the debugger is still trying to attach to the remote target. Do you get the connection confirmation (in the "Debugger Immediate Window") after attaching? It should look like this:

    <COMPUTER_NAME>\<USER> (npipe WinIDE_01CE13B35CA34C68) connected at Mon Feb 25 15:53:51 2013

    As for your follow up question: in theory, this is possible from Visual Studio, as long as you are able to attach to the remote machine. The old approach still works though.

    Q2)

    Yes, it seems like it gets unchecked automatically every time on my side too, this might be a bug on our side. I tried this and get the same message that you get, and no transfer to the target system. I will investigate this and get back to you as soon as I can.


    Max -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Tuesday, February 26, 2013 12:15 AM
  • Q1) Your are right, it does indeed work. There is "Test" which is disabled and there is "Driver->Test->Run Test" which remains enabled during a active kernel debug session, my bad.

    Q2) Look forward to what you find on KDFILES, also please let us know why the "Remote Computer" is required ?

    Thanks again.

    Tuesday, February 26, 2013 2:02 PM
  • I talked to a bunch of people about Q2, and the consensus is that the kdfiles menu is broken (which is probably why it's not documented anywhere on MSDN). Moreover, as you pointed out, some options in the menu don't really make sense, especially considering that you should not have to specify a remote computer in there...

    I have opened a bug on our side to get that fixed. Thanks for bringing this to our attention!


    Max -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Thursday, February 28, 2013 6:21 PM