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.
- Start Visual Studio and open the VisualKernel Module Wizard:
- Proceed with the default “Hello, World” project:Ensure the “Use Advanced Kernel Project Subsystem” checkbox is checked.
- 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”:
- VisualKernel will ask for a directory to use on the second Linux machine to store debug files. Proceed with the default option:
- VisualKernel will suggest storing the sources directly on the build machine and access them via SSH. Proceed with this option:
- Select a debug method that matches your target setup:
- 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:
- 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:
- 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:
- 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:
- 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: