Debugging Raspberry PI Kernel with VisualKernel

This tutorial shows how to debug a the Linux Kernel on Raspberry PI over JTAG using Visual Studio. Before you begin, follow the basic Raspberry PI Kernel Module tutorial to ensure that your debugging setup works.

  1. Start Visual Studio. Select File->New->Project->VisualKernel->Custom Linux Kernel Wizard:
  2. Specify the same target settings you used in the Kernel Module tutorial:
  3. Ensure that the cross-compilation settings are correct (they are detected from the GDB binary name):
  4. Specify "Copy sources locally" on the next page:
  5. VisualKernel will download the kernel sources to your Windows machine:
  6. On the Debug Settings page specify the same debug settings that you used in the Kernel Module Tutorial:
  7. Press Finish to generate the project. Press F5 to start debugging. VisualKernel will connect to the kernel and stop it at the code that is currently executed. Most likely this will be the cpu_v6_do_idle() function. Press Ctrl-B and create a breakpoint in the sys_open() function::
  8. Press F5 to resume the target. Go to the SSH session to your Raspberry PI and type 'ls' there. The breakpoint will hit:
  9. Press F11 until you step into do_sys_open(). Hover the mouse around various variables to see their values:
  10. Press F5 to stop debugging. You can now modify various files in your project and press Ctrl-Shift-B to rebuild the kernel. Note that you will need to deploy it manually as described in the kernel build tutorial: