Debugging kernel and modules via gdb. The kernel debugger kgdb, hypervisors like QEMU or JTAG-based hardware interfaces allow to debug the Linux kernel and its modules during runtime using gdb. Gdb comes with a powerful scripting interface for python. The kernel provides a collection of helper scripts that can simplify typical kernel debugging www.doorway.ruted Reading Time: 4 mins. · drgn (pronounced “dragon”) is a debugger that exposes the types and variables in a program for easy, expressive scripting in Python. The Linux kernel team at Meta originally built drgn to make it easier to investigate the kinds of difficult Linux kernel bugs that the team encounters at Meta. kgdb is a patch that allows the full use of the gdb debugger on the Linux kernel, but only on x86 systems. It works by hooking into the system to be debugged via a serial line, with gdbrunning on the far end.
enable kernel config: CONFIG_DEBUG_KMEMLEAK; setup: mount -t debugfs nodev /sys/kernel/debug; trigger a memory scan: echo scan /sys/kernel/debug/kmemleak; show memory leaks: cat /sys/kernel/debug/kmemleak; clear all possible leaks: echo clear /sys/kernel/debug/kmemleak; As an example, lets look at the following simple module. Debugging Techniques - Linux Device Drivers, 3rd Edition [Book] Chapter 4. Debugging Techniques. Kernel programming brings its own, unique debugging challenges. Kernel code cannot be easily executed under a debugger, nor can it be easily traced, because it is a set of functionalities not related to a specific process. drgn (pronounced “dragon”) is a debugger that exposes the types and variables in a program for easy, expressive scripting in Python. The Linux kernel team at Meta originally built drgn to make it easier to investigate the kinds of difficult Linux kernel bugs that the team encounters at Meta.
Debugging an external Linux kernel module requires some specific actions, especially because the symbols for this module are not part of the main vmlinux symbol. The kernel debugger kgdb, hypervisors like QEMU or JTAG-based hardware interfaces allow to debug the Linux kernel and its modules during runtime using gdb. For kernel modules that are not already loaded, you can add their names to the module list. You can then debug them as if they were loaded.
0コメント