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
68 more accurately construct stack back traces while debugging the kernel.
70 If the architecture that you are using supports the kernel option
73 certain regions of the kernel's memory space as read-only. If kgdb
81 the kernel directly. Kgdb I/O driver configuration takes place via
82 kernel or module parameters which you can learn more about in the
92 Kernel config options for kdb
96 of the kernel's debug core. Kdb must implement a shell, and also adds
97 some helper functions in other parts of the kernel, responsible for
99 ``lsmod``, or ``ps``. In order to build kdb into the kernel you follow the
123 Kernel Debugger Boot Arguments
126 This section describes the various runtime kernel parameters that affect
127 the configuration of the kernel debugger. The following chapter covers
131 Kernel parameter: kgdboc
141 console as your primary console as well as using it to perform kernel
143 designated as a system console. Kgdboc may be configured as a kernel
144 built-in or a kernel loadable module. You can only make use of
145 ``kgdbwait`` and early debugging if you build kgdboc into the kernel as
148 Optionally you can elect to activate kms (Kernel Mode Setting)
151 on the graphics console. When the kernel execution is resumed, the
168 - kms = Kernel Mode Setting
181 1. As a kernel built-in:
183 Use the kernel boot argument::
187 2. As a kernel loadable module:
247 4. kdb with kernel mode setting::
251 5. kdb with kernel mode setting and kgdb over a serial port::
276 Kernel parameter: ``kgdboc_earlycon``
279 If you specify the kernel parameter ``kgdboc_earlycon`` and your serial
300 Kernel parameter: ``kgdbwait``
303 The Kernel command line option ``kgdbwait`` makes kgdb wait for a
304 debugger connection during booting of a kernel. You can only use this
305 option if you compiled a kgdb I/O driver into the kernel and you
306 specified the I/O driver configuration as a kernel command line option.
308 for the kgdb I/O driver in the kernel command line else the I/O driver
309 will not be configured prior to asking the kernel to use it to wait.
311 The kernel will stop and wait as early as the I/O driver and
313 driver as a loadable kernel module kgdbwait will not do anything.
315 Kernel parameter: ``kgdbcon``
319 while gdb is connected to the kernel. Kdb does not make use of the kgdbcon
326 1. Activate with the kernel command line option::
374 Kernel parameter: ``nokaslr``
379 virtual address where the kernel image is mapped and confuses
380 gdb which resolves addresses of kernel symbols from the symbol table
383 Kernel parameter: ``rodata``
388 you can pass ``rodata=off`` to the kernel in this case.
398 1. Configure kgdboc at boot using kernel parameters::
404 Configure kgdboc after the kernel has booted; assuming you are using
409 2. Enter the kernel debugger manually or by waiting for an oops or
410 fault. There are several ways you can enter the kernel debugger
412 enabled ``CONFIG_MAGIC_SYSRQ=y`` in your kernel config.
437 ``lsmod`` Shows where kernel modules are loaded
440 ``summary`` Shows kernel version info and memory usage
442 ``dmesg`` View the kernel syslog buffer
447 or using the ``go`` command to resuming normal kernel execution. If you
448 have paused the kernel for a lengthy period of time, applications
451 consideration when using the kernel debugger.
458 1. Configure kgdboc at boot using kernel parameters::
464 Configure kgdboc after the kernel has booted::
468 2. Enter the kernel debugger manually or by waiting for an oops or
469 fault. There are several ways you can enter the kernel debugger
471 enabled ``CONFIG_MAGIC_SYSRQ=y`` in your kernel config.
502 continue kernel execution.
510 only actively hook up to the kernel trap hooks if a kgdb I/O driver is
512 unregister all the kernel hook points.
527 Configure kgdboc at boot using kernel parameters::
533 Configure kgdboc after the kernel has booted::
537 2. Stop kernel execution (break into the debugger)
539 In order to connect to gdb via kgdboc, the kernel must first be
540 stopped. There are several ways to stop the kernel which include
542 kernel until it takes an exception where it waits for the debugger to
577 Once connected, you can debug a kernel the way you would debug an
607 Whenever the kernel debugger stops in kgdb mode it will print the
649 breakpoint operations, because it can disrupt the state of the kernel
672 When kgdb is enabled in the kernel config you can also elect to enable
679 Linux kernel. The primary source of documentation would be to look in
683 core set of tests by setting the kernel config parameter
685 regression testing and does not require modifying the kernel boot config
687 specifying ``kgdbts=`` as a kernel boot argument.
689 Kernel Debugger Internals
695 The kernel debugger is organized into a number of components:
699 The debug core is found in ``kernel/debug/debug_core.c``. It
718 - The structures and callback API for atomic kernel mode setting.
724 This implementation is generally found in ``arch/*/kernel/kgdb.c``. As
725 an example, ``arch/x86/kernel/kgdb.c`` contains the specifics to
746 The gdbstub is located in ``kernel/debug/gdbstub.c``. It contains:
753 The kdb core is located in kernel/debug/kdb. There are a number of
754 helper functions in some of the other kernel components to make it
755 possible for kdb to examine and report information about the kernel
756 without taking locks that could cause a kernel deadlock. The kdb core
767 ``kernel/trace/trace_kdb.c``
770 you can build the kdb_hello.ko kernel module from
772 ``CONFIG_SAMPLES=y`` and ``CONFIG_SAMPLE_KDB=m`` in your kernel
777 to I/O drivers, bypassing the kernel log.
829 ``kernel/kgdb.c``, that must be supplied by the architecture-specific
834 .. kernel-doc:: include/linux/kgdb.h
877 kernel when ``CONFIG_KDB_KEYBOARD=y`` is set in the kernel configuration.
880 ``kernel/debug/kdb/kdb_keyboard.c``. This driver is hooked into the debug core
891 kernel mode setting support.
893 Every time the kernel debugger is entered it calls
895 in the virtual console layer. On resuming kernel execution, the kernel
908 2. Tom Rini <trini@kernel.crashing.org>