Building Kernels when Symbols Are Missing
Kernel symbol files are special files that allow mapping code and data inside the kernel into meaningful variable names and source file locations. Without having those files VisualKernel will not be able to debug your kernel.
Some versions of Ubuntu do not ship the kernel symbols, or ship them with a delay. This makes it impossible to debug the stock kernels without rebuilding them. A typical “missing package” error looks this way:
This page provides instructions on building a kernel from source in order to get a new kernel image with the debugging symbols:
- Cancel the kernel module wizard and open the Custom Linux Kernel wizard:
- Select “Automatically download sources for the current kernel”, then select “do not import files to Solution Explorer” and “Install the kernel automatically”:
- Proceed with the default file transfer settings:
- If you are planning to debug kernel modules and not the kernel itself, you can simply press “finish” without filling the last page of the wizard:
- When your project is created, right-click on it in Solution Explorer, select VisualKernel Project Properties and enable parallel building according to the amount of CPU cores on your Linux machine:
- Close the project properties window and press Ctrl-Shift-B to build your project. The build typically takes around 25 minutes on a 6-core machine and can be slower if you have fewer cores:
- Restart your Linux machine to boot into the new kernel. Once the system starts up, open the Linux Kernel Module wizard:
- On the second page disable the “detect and install headers and symbols” checkbox:
- On the next page select “Debug a kernel built in VisualKernel project” and specify the path to the previously created kernel project:
- Proceed with the default source code access settings:
- Specify the debug settings that match your setup:
- When the module project is created, set a breakpoint on the initialization function and hit F5 to begin debugging. The debugging will now work normally: