Lines Matching full:kernel
2 Using kgdb, kdb and the kernel debugger internals
10 The kernel has two different debugger front ends (kdb and kgdb) which
13 configure the kernel properly at compile and runtime.
19 you can set breakpoints and execute some basic kernel run control. Kdb
21 diagnosing kernel problems. You can access some symbols by name in
22 kernel built-ins or in kernel modules if the code was built with
26 kernel. It is used along with gdb to debug a Linux kernel. The
27 expectation is that gdb can be used to "break in" to the kernel to
30 application. It is possible to place breakpoints in kernel code and
34 development machine and the other is the target machine. The kernel to
40 kgdb I/O modules compiled as built-ins or loadable kernel modules in the
41 test machine's kernel.
43 Compiling a kernel
51 Kernel config options for kgdb
55 :menuselection:`Kernel hacking --> Kernel debugging` and select
56 :menuselection:`KGDB: kernel debugger`.
61 :menuselection:`Compile the kernel with debug info` in the config menu.
64 ``CONFIG_FRAME_POINTER`` kernel option which is called :menuselection:`Compile
65 the kernel with frame pointers` in the config menu. This option inserts code
69 debugging the kernel.
71 If the architecture that you are using supports the kernel option
74 certain regions of the kernel's memory space as read-only. If kgdb
82 the kernel directly. Kgdb I/O driver configuration takes place via
83 kernel or module parameters which you can learn more about in the in the
93 Kernel config options for kdb
97 of the kernel's debug core. Kdb must implement a shell, and also adds
98 some helper functions in other parts of the kernel, responsible for
100 ``lsmod``, or ``ps``. In order to build kdb into the kernel you follow the
124 Kernel Debugger Boot Arguments
127 This section describes the various runtime kernel parameters that affect
128 the configuration of the kernel debugger. The following chapter covers
132 Kernel parameter: kgdboc
142 console as your primary console as well as using it to perform kernel
144 designated as a system console. Kgdboc may be configured as a kernel
145 built-in or a kernel loadable module. You can only make use of
146 ``kgdbwait`` and early debugging if you build kgdboc into the kernel as
149 Optionally you can elect to activate kms (Kernel Mode Setting)
152 on the graphics console. When the kernel execution is resumed, the
169 - kms = Kernel Mode Setting
182 1. As a kernel built-in:
184 Use the kernel boot argument::
188 2. As a kernel loadable module:
248 4. kdb with kernel mode setting::
252 5. kdb with kernel mode setting and kgdb over a serial port::
277 Kernel parameter: ``kgdboc_earlycon``
280 If you specify the kernel parameter ``kgdboc_earlycon`` and your serial
301 Kernel parameter: ``kgdbwait``
304 The Kernel command line option ``kgdbwait`` makes kgdb wait for a
305 debugger connection during booting of a kernel. You can only use this
306 option if you compiled a kgdb I/O driver into the kernel and you
307 specified the I/O driver configuration as a kernel command line option.
309 for the kgdb I/O driver in the kernel command line else the I/O driver
310 will not be configured prior to asking the kernel to use it to wait.
312 The kernel will stop and wait as early as the I/O driver and
314 driver as a loadable kernel module kgdbwait will not do anything.
316 Kernel parameter: ``kgdbcon``
320 while gdb is connected to the kernel. Kdb does not make use of the kgdbcon
327 1. Activate with the kernel command line option::
375 Kernel parameter: ``nokaslr``
380 virtual address where the kernel image is mapped and confuse
381 gdb which resolve kernel symbol address from symbol table
392 1. Configure kgdboc at boot using kernel parameters::
398 Configure kgdboc after the kernel has booted; assuming you are using
403 2. Enter the kernel debugger manually or by waiting for an oops or
404 fault. There are several ways you can enter the kernel debugger
406 enabled ``CONFIG_MAGIC_SysRq=y`` in your kernel config.
431 ``lsmod`` Shows where kernel modules are loaded
434 ``summary`` Shows kernel version info and memory usage
436 ``dmesg`` View the kernel syslog buffer
441 or using the ``go`` command to resuming normal kernel execution. If you
442 have paused the kernel for a lengthy period of time, applications
445 consideration when using the kernel debugger.
452 1. Configure kgdboc at boot using kernel parameters::
458 Configure kgdboc after the kernel has booted::
462 2. Enter the kernel debugger manually or by waiting for an oops or
463 fault. There are several ways you can enter the kernel debugger
465 enabled ``CONFIG_MAGIC_SysRq=y`` in your kernel config.
496 continue kernel execution.
504 only actively hook up to the kernel trap hooks if a kgdb I/O driver is
506 unregister all the kernel hook points.
521 Configure kgdboc at boot using kernel parameters::
527 Configure kgdboc after the kernel has booted::
531 2. Stop kernel execution (break into the debugger)
533 In order to connect to gdb via kgdboc, the kernel must first be
534 stopped. There are several ways to stop the kernel which include
536 kernel until it takes an exception where it waits for the debugger to
571 Once connected, you can debug a kernel the way you would debug an
601 Whenever the kernel debugger stops in kgdb mode it will print the
645 breakpoint operations, because it can disrupt the state of the kernel
668 When kgdb is enabled in the kernel config you can also elect to enable
675 Linux kernel. The primary source of documentation would be to look in
679 core set of tests by setting the kernel config parameter
681 regression testing and does not require modifying the kernel boot config
683 specifying ``kgdbts=`` as a kernel boot argument.
685 Kernel Debugger Internals
691 The kernel debugger is organized into a number of components:
695 The debug core is found in ``kernel/debugger/debug_core.c``. It
714 - The structures and callback API for atomic kernel mode setting.
720 This implementation is generally found in ``arch/*/kernel/kgdb.c``. As
721 an example, ``arch/x86/kernel/kgdb.c`` contains the specifics to
742 The gdbstub is located in ``kernel/debug/gdbstub.c``. It contains:
749 The kdb core is located in kernel/debug/kdb. There are a number of
750 helper functions in some of the other kernel components to make it
751 possible for kdb to examine and report information about the kernel
752 without taking locks that could cause a kernel deadlock. The kdb core
763 ``kernel/trace/trace_kdb.c``
766 you can build the kdb_hello.ko kernel module from
768 ``CONFIG_SAMPLES=y`` and ``CONFIG_SAMPLE_KDB=m`` in your kernel
773 to I/O drivers, bypassing the kernel log.
825 ``kernel/kgdb.c``, that must be supplied by the architecture-specific
830 .. kernel-doc:: include/linux/kgdb.h
873 kernel when ``CONFIG_KDB_KEYBOARD=y`` is set in the kernel configuration.
887 kernel mode setting support.
889 Every time the kernel debugger is entered it calls
891 in the virtual console layer. On resuming kernel execution, the kernel
895 Any video driver that wants to be compatible with the kernel debugger
932 2. Tom Rini <trini@kernel.crashing.org>