About debugging a Linux kernel

DS-5 supports source level debugging of a Linux kernel. The Linux kernel (and associated device drivers) can be debugged in the same way as a standard ELF format executable. For example, you can set breakpoints in the kernel code, step through the source, inspect the call stack, and watch variables.

To debug the kernel:

  1. Compile the kernel source using the following options:

    • CONFIG_DEBUG_KERNEL=y

    • CONFIG_DEBUG_INFO=y

    • Other options might be required depending on the type of debugging you want to perform.

    Compiling the kernel source generates a Linux kernel image and symbol files containing debug information.

    Note

    Be aware that a Linux kernel is always compiled with full optimizations and inlining enabled, therefore:

    • stepping through code might not work as expected due to the possible reordering of some instructions

    • some variables might be optimized out by the compiler and therefore not be available for the debugger.

  2. Load the Linux kernel on to the target

  3. Load kernel debug information into the debugger

  4. Debug the kernel as required.

Show/hideSee also

Copyright © 2010, 2011 ARM. All rights reserved.ARM DUI 0446F
Non-ConfidentialID071411