Configuring VisualKernel to access source code directly via SSH

This tutorial shows how to configure VisualKernel to access the Linux kernel and module source code directly over SSH instead of downloading it to the Windows machine. This allows viewing/editing files with reserved names (e.g. aux.h) and names that are the same except for capitalization (e.g. ipt_ecn.h vs ipt_ECN.h).

Before you begin, install VisualKernel 3.0 or later.

  1. Start Visual Studio and open the VisualKernel Module Wizard:
  2. Proceed with the default “Hello, World” project:Ensure the “Use Advanced Kernel Project Subsystem” checkbox is checked.
  3. Select the target machine you want to debug. As stopping at a kernel breakpoint would suspend all SSH communication until the target is resumed, direct SSH access is only supported if you use a second Linux machine for building/debugging your kernel. Select it in the “build the module on” field and press “Next”:
  4. VisualKernel will ask for a directory to use on the second Linux machine to store debug files. Proceed with the default option:
  5. VisualKernel will suggest storing the sources directly on the build machine and access them via SSH. Proceed with this option:
  6. Select a debug method that matches your target setup:
  7. Press “Finish” to create the project. Note how the full path of the source files starts with the vkrnl-ssh:// prefix indicating files directly accessed over SSH:
  8. The Advanced Linux Kernel projects use the Advanced Clang-based IntelliSense engine that is capable of accessing remote files automatically. Hence you can reference headers on the Linux machine without caching any files/directories on the Windows side and IntelliSense will find them instantly:
  9. Set a breakpoint in the init() function and press F5 to start debugging. Once the breakpoint is hit, use the Call Stack window to walk the stack. VisualKernel will automatically open the Kernel sources cached on the build machine:
  10. If you want VisualKernel to index the kernel sources in order to quickly find function definitions, references and use Code Map, double-click on the “Referenced Kernel” item in Solution Explorer. VisualKernel will query the exact build commands from the KBuild system and will create an optimized code database:
  11. Once the database is created, you can use Solution Explorer to browse through the kernel sources as if it was a regular project. VisualGDB kernel projects are optimized for the huge size of the kernel codebase, so they will load much faster than the regular VC++ projects of the same size, and they will fully support reserved and case-sensitive names: