--- zzzz-none-000/linux-3.10.107/Documentation/DocBook/kgdb.tmpl 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/Documentation/DocBook/kgdb.tmpl 2021-02-04 17:41:59.000000000 +0000 @@ -75,7 +75,7 @@ a development machine and the other is the target machine. The kernel to be debugged runs on the target machine. The development machine runs an instance of gdb against the vmlinux file which - contains the symbols (not boot image such as bzImage, zImage, + contains the symbols (not a boot image such as bzImage, zImage, uImage...). In gdb the developer specifies the connection parameters and connects to kgdb. The type of connection a developer makes with gdb depends on the availability of kgdb I/O @@ -95,7 +95,7 @@ Kernel config options for kgdb To enable CONFIG_KGDB you should look under - "Kernel debugging" and select "KGDB: kernel debugger". + "Kernel hacking" / "Kernel debugging" and select "KGDB: kernel debugger". While it is not a hard requirement that you have symbols in your @@ -105,7 +105,7 @@ kernel with debug info" in the config menu. - It is advised, but not required that you turn on the + It is advised, but not required, that you turn on the CONFIG_FRAME_POINTER kernel option which is called "Compile the kernel with frame pointers" in the config menu. This option inserts code to into the compiled executable which saves the frame @@ -181,7 +181,7 @@ This section describes the various runtime kernel parameters that affect the configuration of the kernel debugger. The following chapter covers using kdb and kgdb as well as - provides some examples of the configuration parameters. + providing some examples of the configuration parameters. Kernel parameter: kgdboc The kgdboc driver was originally an abbreviation meant to @@ -197,6 +197,7 @@ may be configured as a kernel built-in or a kernel loadable module. You can only make use of kgdbwait and early debugging if you build kgdboc into the kernel as a built-in. + Optionally you can elect to activate kms (Kernel Mode Setting) integration. When you use kms with kgdboc and you have a video driver that has atomic mode setting hooks, it is possible to @@ -206,7 +207,6 @@ crashes or doing analysis of memory with kdb while allowing the full graphics console applications to run. - kgdboc arguments Usage: kgdboc=[kms][[,]kbd][[,]serial_device][,baud] @@ -219,8 +219,8 @@ kbd = Keyboard - You can configure kgdboc to use the keyboard, and or a serial - device depending on if you are using kdb and or kgdb, in one of the + You can configure kgdboc to use the keyboard, and/or a serial + device depending on if you are using kdb and/or kgdb, in one of the following scenarios. The order listed above must be observed if you use any of the optional configurations together. Using kms + only gdb is generally not a useful combination. @@ -261,11 +261,8 @@ More examples - You can configure kgdboc to use the keyboard, and or a serial - device depending on if you are using kdb and or kgdb, in one of the - following scenarios. - You can configure kgdboc to use the keyboard, and or a serial device - depending on if you are using kdb and or kgdb, in one of the + You can configure kgdboc to use the keyboard, and/or a serial device + depending on if you are using kdb and/or kgdb, in one of the following scenarios. kdb and kgdb over only a serial port @@ -287,7 +284,6 @@ - NOTE: Kgdboc does not support interrupting the target via the gdb remote protocol. You must manually send a sysrq-g unless you have a proxy that splits console output to a terminal program. @@ -308,6 +304,7 @@ as well as on the initial connect, or to use a debugger proxy that allows an unmodified gdb to do the debugging. + @@ -315,7 +312,7 @@ The Kernel command line option kgdbwait makes kgdb wait for a debugger connection during booting of a kernel. You - can only use this option you compiled a kgdb I/O driver into the + can only use this option if you compiled a kgdb I/O driver into the kernel and you specified the I/O driver configuration as a kernel command line option. The kgdbwait parameter should always follow the configuration parameter for the kgdb I/O driver in the kernel @@ -353,12 +350,12 @@ + IMPORTANT NOTE: You cannot use kgdboc + kgdbcon on a tty that is an - active system console. An example incorrect usage is console=ttyS0,115200 kgdboc=ttyS0 kgdbcon + active system console. An example of incorrect usage is console=ttyS0,115200 kgdboc=ttyS0 kgdbcon It is possible to use this option with kgdboc on a tty that is not a system console. - Run time parameter: kgdbreboot @@ -386,12 +383,12 @@ Quick start for kdb on a serial port This is a quick example of how to use kdb. - Boot kernel with arguments: + Configure kgdboc at boot using kernel parameters: console=ttyS0,115200 kgdboc=ttyS0,115200 OR - Configure kgdboc after the kernel booted; assuming you are using a serial port console: + Configure kgdboc after the kernel has booted; assuming you are using a serial port console: echo ttyS0 > /sys/module/kgdboc/parameters/kgdboc @@ -442,12 +439,12 @@ Quick start for kdb using a keyboard connected console This is a quick example of how to use kdb with a keyboard. - Boot kernel with arguments: + Configure kgdboc at boot using kernel parameters: kgdboc=kbd OR - Configure kgdboc after the kernel booted: + Configure kgdboc after the kernel has booted: echo kbd > /sys/module/kgdboc/parameters/kgdboc @@ -501,12 +498,12 @@ Connecting with gdb to a serial port Configure kgdboc - Boot kernel with arguments: + Configure kgdboc at boot using kernel parameters: kgdboc=ttyS0,115200 OR - Configure kgdboc after the kernel booted: + Configure kgdboc after the kernel has booted: echo ttyS0 > /sys/module/kgdboc/parameters/kgdboc @@ -536,7 +533,7 @@ - Connect from from gdb + Connect from gdb Example (using a directly connected port): @@ -584,7 +581,7 @@ There are two ways to switch from kgdb to kdb: you can use gdb to issue a maintenance packet, or you can blindly type the command $3#33. - Whenever kernel debugger stops in kgdb mode it will print the + Whenever the kernel debugger stops in kgdb mode it will print the message KGDB or $3#33 for KDB. It is important to note that you have to type the sequence correctly in one pass. You cannot type a backspace or delete because kgdb will interpret @@ -704,7 +701,7 @@ Registration and unregistration of architecture specific trap hooks Any special exception handling and cleanup NMI exception handling and cleanup - (optional)HW breakpoints + (optional) HW breakpoints @@ -760,7 +757,7 @@ a kgdb I/O driver for characters when it needs input. The I/O driver is expected to return immediately if there is no data available. Doing so allows for the future possibility to touch - watch dog hardware in such a way as to have a target system not + watchdog hardware in such a way as to have a target system not reset when these are enabled. @@ -779,21 +776,25 @@ their <asm/kgdb.h> file. These are: - - NUMREGBYTES: The size in bytes of all of the registers, so - that we can ensure they will all fit into a packet. - - - BUFMAX: The size in bytes of the buffer GDB will read into. - This must be larger than NUMREGBYTES. - - - CACHE_FLUSH_IS_SAFE: Set to 1 if it is always safe to call - flush_cache_range or flush_icache_range. On some architectures, - these functions may not be safe to call on SMP since we keep other - CPUs in a holding pattern. - - + + NUMREGBYTES: The size in bytes of all of the registers, so + that we can ensure they will all fit into a packet. + + + + + BUFMAX: The size in bytes of the buffer GDB will read into. + This must be larger than NUMREGBYTES. + + + + + CACHE_FLUSH_IS_SAFE: Set to 1 if it is always safe to call + flush_cache_range or flush_icache_range. On some architectures, + these functions may not be safe to call on SMP since we keep other + CPUs in a holding pattern. + + @@ -812,8 +813,8 @@ The kgdboc driver is actually a very thin driver that relies on the underlying low level to the hardware driver having "polling hooks" - which the to which the tty driver is attached. In the initial - implementation of kgdboc it the serial_core was changed to expose a + to which the tty driver is attached. In the initial + implementation of kgdboc the serial_core was changed to expose a low level UART hook for doing polled mode reading and writing of a single character while in an atomic context. When kgdb makes an I/O request to the debugger, kgdboc invokes a callback in the serial