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:

  1. Cancel the kernel module wizard and open the Custom Linux Kernel wizard:
  2. Select “Automatically download sources for the current kernel”, then select “do not import files to Solution Explorer” and “Install the kernel automatically”:
  3. Proceed with the default file transfer settings:
  4. 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:
  5. 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:
  6. 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:
  7. Restart your Linux machine to boot into the new kernel. Once the system starts up, open the Linux Kernel Module wizard:
  8. On the second page disable the “detect and install headers and symbols” checkbox:
  9. On the next page select “Debug a kernel built in VisualKernel project” and specify the path to the previously created kernel project:
  10. Proceed with the default source code access settings:
  11. Specify the debug settings that match your setup:
  12. 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: