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: ``kgdbwait``
280 The Kernel command line option ``kgdbwait`` makes kgdb wait for a
281 debugger connection during booting of a kernel. You can only use this
282 option if you compiled a kgdb I/O driver into the kernel and you
283 specified the I/O driver configuration as a kernel command line option.
285 for the kgdb I/O driver in the kernel command line else the I/O driver
286 will not be configured prior to asking the kernel to use it to wait.
288 The kernel will stop and wait as early as the I/O driver and
290 driver as a loadable kernel module kgdbwait will not do anything.
292 Kernel parameter: ``kgdbcon``
296 while gdb is connected to the kernel. Kdb does not make use of the kgdbcon
303 1. Activate with the kernel command line option::
351 Kernel parameter: ``nokaslr``
356 virtual address where the kernel image is mapped and confuse
357 gdb which resolve kernel symbol address from symbol table
368 1. Configure kgdboc at boot using kernel parameters::
374 Configure kgdboc after the kernel has booted; assuming you are using
379 2. Enter the kernel debugger manually or by waiting for an oops or
380 fault. There are several ways you can enter the kernel debugger
382 enabled ``CONFIG_MAGIC_SysRq=y`` in your kernel config.
407 ``lsmod`` Shows where kernel modules are loaded
410 ``summary`` Shows kernel version info and memory usage
412 ``dmesg`` View the kernel syslog buffer
417 or using the ``go`` command to resuming normal kernel execution. If you
418 have paused the kernel for a lengthy period of time, applications
421 consideration when using the kernel debugger.
428 1. Configure kgdboc at boot using kernel parameters::
434 Configure kgdboc after the kernel has booted::
438 2. Enter the kernel debugger manually or by waiting for an oops or
439 fault. There are several ways you can enter the kernel debugger
441 enabled ``CONFIG_MAGIC_SysRq=y`` in your kernel config.
472 continue kernel execution.
480 only actively hook up to the kernel trap hooks if a kgdb I/O driver is
482 unregister all the kernel hook points.
497 Configure kgdboc at boot using kernel parameters::
503 Configure kgdboc after the kernel has booted::
507 2. Stop kernel execution (break into the debugger)
509 In order to connect to gdb via kgdboc, the kernel must first be
510 stopped. There are several ways to stop the kernel which include
512 kernel until it takes an exception where it waits for the debugger to
547 Once connected, you can debug a kernel the way you would debug an
577 Whenever the kernel debugger stops in kgdb mode it will print the
621 breakpoint operations, because it can disrupt the state of the kernel
644 When kgdb is enabled in the kernel config you can also elect to enable
651 Linux kernel. The primary source of documentation would be to look in
655 core set of tests by setting the kernel config parameter
657 regression testing and does not require modifying the kernel boot config
659 specifying ``kgdbts=`` as a kernel boot argument.
661 Kernel Debugger Internals
667 The kernel debugger is organized into a number of components:
671 The debug core is found in ``kernel/debugger/debug_core.c``. It
690 - The structures and callback API for atomic kernel mode setting.
696 This implementation is generally found in ``arch/*/kernel/kgdb.c``. As
697 an example, ``arch/x86/kernel/kgdb.c`` contains the specifics to
718 The gdbstub is located in ``kernel/debug/gdbstub.c``. It contains:
725 The kdb core is located in kernel/debug/kdb. There are a number of
726 helper functions in some of the other kernel components to make it
727 possible for kdb to examine and report information about the kernel
728 without taking locks that could cause a kernel deadlock. The kdb core
739 ``kernel/trace/trace_kdb.c``
742 you can build the kdb_hello.ko kernel module from
744 ``CONFIG_SAMPLES=y`` and ``CONFIG_SAMPLE_KDB=m`` in your kernel
749 to I/O drivers, bypassing the kernel log.
801 ``kernel/kgdb.c``, that must be supplied by the architecture-specific
806 .. kernel-doc:: include/linux/kgdb.h
849 kernel when ``CONFIG_KDB_KEYBOARD=y`` is set in the kernel configuration.
863 kernel mode setting support.
865 Every time the kernel debugger is entered it calls
867 in the virtual console layer. On resuming kernel execution, the kernel
871 Any video driver that wants to be compatible with the kernel debugger
908 2. Tom Rini <trini@kernel.crashing.org>