18c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0-only 28c2ecf20Sopenharmony_ci 38c2ecf20Sopenharmony_ciconfig HAVE_ARCH_KGDB 48c2ecf20Sopenharmony_ci bool 58c2ecf20Sopenharmony_ci 68c2ecf20Sopenharmony_ci# set if architecture has the its kgdb_arch_handle_qxfer_pkt 78c2ecf20Sopenharmony_ci# function to enable gdb stub to address XML packet sent from GDB. 88c2ecf20Sopenharmony_ciconfig HAVE_ARCH_KGDB_QXFER_PKT 98c2ecf20Sopenharmony_ci bool 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_cimenuconfig KGDB 128c2ecf20Sopenharmony_ci bool "KGDB: kernel debugger" 138c2ecf20Sopenharmony_ci depends on HAVE_ARCH_KGDB 148c2ecf20Sopenharmony_ci depends on DEBUG_KERNEL 158c2ecf20Sopenharmony_ci help 168c2ecf20Sopenharmony_ci If you say Y here, it will be possible to remotely debug the 178c2ecf20Sopenharmony_ci kernel using gdb. It is recommended but not required, that 188c2ecf20Sopenharmony_ci you also turn on the kernel config option 198c2ecf20Sopenharmony_ci CONFIG_FRAME_POINTER to aid in producing more reliable stack 208c2ecf20Sopenharmony_ci backtraces in the external debugger. Documentation of 218c2ecf20Sopenharmony_ci kernel debugger is available at http://kgdb.sourceforge.net 228c2ecf20Sopenharmony_ci as well as in Documentation/dev-tools/kgdb.rst. If 238c2ecf20Sopenharmony_ci unsure, say N. 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ciif KGDB 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ciconfig KGDB_HONOUR_BLOCKLIST 288c2ecf20Sopenharmony_ci bool "KGDB: use kprobe blocklist to prohibit unsafe breakpoints" 298c2ecf20Sopenharmony_ci depends on HAVE_KPROBES 308c2ecf20Sopenharmony_ci depends on MODULES 318c2ecf20Sopenharmony_ci select KPROBES 328c2ecf20Sopenharmony_ci default y 338c2ecf20Sopenharmony_ci help 348c2ecf20Sopenharmony_ci If set to Y the debug core will use the kprobe blocklist to 358c2ecf20Sopenharmony_ci identify symbols where it is unsafe to set breakpoints. 368c2ecf20Sopenharmony_ci In particular this disallows instrumentation of functions 378c2ecf20Sopenharmony_ci called during debug trap handling and thus makes it very 388c2ecf20Sopenharmony_ci difficult to inadvertently provoke recursive trap handling. 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ci If unsure, say Y. 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ciconfig KGDB_SERIAL_CONSOLE 438c2ecf20Sopenharmony_ci tristate "KGDB: use kgdb over the serial console" 448c2ecf20Sopenharmony_ci select CONSOLE_POLL 458c2ecf20Sopenharmony_ci select MAGIC_SYSRQ 468c2ecf20Sopenharmony_ci depends on TTY && HW_CONSOLE 478c2ecf20Sopenharmony_ci default y 488c2ecf20Sopenharmony_ci help 498c2ecf20Sopenharmony_ci Share a serial console with kgdb. Sysrq-g must be used 508c2ecf20Sopenharmony_ci to break in initially. 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ciconfig KGDB_TESTS 538c2ecf20Sopenharmony_ci bool "KGDB: internal test suite" 548c2ecf20Sopenharmony_ci default n 558c2ecf20Sopenharmony_ci help 568c2ecf20Sopenharmony_ci This is a kgdb I/O module specifically designed to test 578c2ecf20Sopenharmony_ci kgdb's internal functions. This kgdb I/O module is 588c2ecf20Sopenharmony_ci intended to for the development of new kgdb stubs 598c2ecf20Sopenharmony_ci as well as regression testing the kgdb internals. 608c2ecf20Sopenharmony_ci See the drivers/misc/kgdbts.c for the details about 618c2ecf20Sopenharmony_ci the tests. The most basic of this I/O module is to boot 628c2ecf20Sopenharmony_ci a kernel boot arguments "kgdbwait kgdbts=V1F100" 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ciconfig KGDB_TESTS_ON_BOOT 658c2ecf20Sopenharmony_ci bool "KGDB: Run tests on boot" 668c2ecf20Sopenharmony_ci depends on KGDB_TESTS 678c2ecf20Sopenharmony_ci default n 688c2ecf20Sopenharmony_ci help 698c2ecf20Sopenharmony_ci Run the kgdb tests on boot up automatically without the need 708c2ecf20Sopenharmony_ci to pass in a kernel parameter 718c2ecf20Sopenharmony_ci 728c2ecf20Sopenharmony_ciconfig KGDB_TESTS_BOOT_STRING 738c2ecf20Sopenharmony_ci string "KGDB: which internal kgdb tests to run" 748c2ecf20Sopenharmony_ci depends on KGDB_TESTS_ON_BOOT 758c2ecf20Sopenharmony_ci default "V1F100" 768c2ecf20Sopenharmony_ci help 778c2ecf20Sopenharmony_ci This is the command string to send the kgdb test suite on 788c2ecf20Sopenharmony_ci boot. See the drivers/misc/kgdbts.c for detailed 798c2ecf20Sopenharmony_ci information about other strings you could use beyond the 808c2ecf20Sopenharmony_ci default of V1F100. 818c2ecf20Sopenharmony_ci 828c2ecf20Sopenharmony_ciconfig KGDB_LOW_LEVEL_TRAP 838c2ecf20Sopenharmony_ci bool "KGDB: Allow debugging with traps in notifiers" 848c2ecf20Sopenharmony_ci depends on X86 || MIPS 858c2ecf20Sopenharmony_ci default n 868c2ecf20Sopenharmony_ci help 878c2ecf20Sopenharmony_ci This will add an extra call back to kgdb for the breakpoint 888c2ecf20Sopenharmony_ci exception handler which will allow kgdb to step through a 898c2ecf20Sopenharmony_ci notify handler. 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_ciconfig KGDB_KDB 928c2ecf20Sopenharmony_ci bool "KGDB_KDB: include kdb frontend for kgdb" 938c2ecf20Sopenharmony_ci default n 948c2ecf20Sopenharmony_ci help 958c2ecf20Sopenharmony_ci KDB frontend for kernel 968c2ecf20Sopenharmony_ci 978c2ecf20Sopenharmony_ciconfig KDB_DEFAULT_ENABLE 988c2ecf20Sopenharmony_ci hex "KDB: Select kdb command functions to be enabled by default" 998c2ecf20Sopenharmony_ci depends on KGDB_KDB 1008c2ecf20Sopenharmony_ci default 0x1 1018c2ecf20Sopenharmony_ci help 1028c2ecf20Sopenharmony_ci Specifiers which kdb commands are enabled by default. This may 1038c2ecf20Sopenharmony_ci be set to 1 or 0 to enable all commands or disable almost all 1048c2ecf20Sopenharmony_ci commands. 1058c2ecf20Sopenharmony_ci 1068c2ecf20Sopenharmony_ci Alternatively the following bitmask applies: 1078c2ecf20Sopenharmony_ci 1088c2ecf20Sopenharmony_ci 0x0002 - allow arbitrary reads from memory and symbol lookup 1098c2ecf20Sopenharmony_ci 0x0004 - allow arbitrary writes to memory 1108c2ecf20Sopenharmony_ci 0x0008 - allow current register state to be inspected 1118c2ecf20Sopenharmony_ci 0x0010 - allow current register state to be modified 1128c2ecf20Sopenharmony_ci 0x0020 - allow passive inspection (backtrace, process list, lsmod) 1138c2ecf20Sopenharmony_ci 0x0040 - allow flow control management (breakpoint, single step) 1148c2ecf20Sopenharmony_ci 0x0080 - enable signalling of processes 1158c2ecf20Sopenharmony_ci 0x0100 - allow machine to be rebooted 1168c2ecf20Sopenharmony_ci 1178c2ecf20Sopenharmony_ci The config option merely sets the default at boot time. Both 1188c2ecf20Sopenharmony_ci issuing 'echo X > /sys/module/kdb/parameters/cmd_enable' or 1198c2ecf20Sopenharmony_ci setting with kdb.cmd_enable=X kernel command line option will 1208c2ecf20Sopenharmony_ci override the default settings. 1218c2ecf20Sopenharmony_ci 1228c2ecf20Sopenharmony_ciconfig KDB_KEYBOARD 1238c2ecf20Sopenharmony_ci bool "KGDB_KDB: keyboard as input device" 1248c2ecf20Sopenharmony_ci depends on VT && KGDB_KDB 1258c2ecf20Sopenharmony_ci default n 1268c2ecf20Sopenharmony_ci help 1278c2ecf20Sopenharmony_ci KDB can use a PS/2 type keyboard for an input device 1288c2ecf20Sopenharmony_ci 1298c2ecf20Sopenharmony_ciconfig KDB_CONTINUE_CATASTROPHIC 1308c2ecf20Sopenharmony_ci int "KDB: continue after catastrophic errors" 1318c2ecf20Sopenharmony_ci depends on KGDB_KDB 1328c2ecf20Sopenharmony_ci default "0" 1338c2ecf20Sopenharmony_ci help 1348c2ecf20Sopenharmony_ci This integer controls the behaviour of kdb when the kernel gets a 1358c2ecf20Sopenharmony_ci catastrophic error, i.e. for a panic or oops. 1368c2ecf20Sopenharmony_ci When KDB is active and a catastrophic error occurs, nothing extra 1378c2ecf20Sopenharmony_ci will happen until you type 'go'. 1388c2ecf20Sopenharmony_ci CONFIG_KDB_CONTINUE_CATASTROPHIC == 0 (default). The first time 1398c2ecf20Sopenharmony_ci you type 'go', you will be warned by kdb. The secend time you type 1408c2ecf20Sopenharmony_ci 'go', KDB tries to continue. No guarantees that the 1418c2ecf20Sopenharmony_ci kernel is still usable in this situation. 1428c2ecf20Sopenharmony_ci CONFIG_KDB_CONTINUE_CATASTROPHIC == 1. KDB tries to continue. 1438c2ecf20Sopenharmony_ci No guarantees that the kernel is still usable in this situation. 1448c2ecf20Sopenharmony_ci CONFIG_KDB_CONTINUE_CATASTROPHIC == 2. KDB forces a reboot. 1458c2ecf20Sopenharmony_ci If you are not sure, say 0. 1468c2ecf20Sopenharmony_ci 1478c2ecf20Sopenharmony_ciconfig ARCH_HAS_EARLY_DEBUG 1488c2ecf20Sopenharmony_ci bool 1498c2ecf20Sopenharmony_ci default n 1508c2ecf20Sopenharmony_ci help 1518c2ecf20Sopenharmony_ci If an architecture can definitely handle entering the debugger 1528c2ecf20Sopenharmony_ci when early_param's are parsed then it select this config. 1538c2ecf20Sopenharmony_ci Otherwise, if "kgdbwait" is passed on the kernel command line it 1548c2ecf20Sopenharmony_ci won't actually be processed until dbg_late_init() just after the 1558c2ecf20Sopenharmony_ci call to kgdb_arch_late() is made. 1568c2ecf20Sopenharmony_ci 1578c2ecf20Sopenharmony_ci NOTE: Even if this isn't selected by an architecture we will 1588c2ecf20Sopenharmony_ci still try to register kgdb to handle breakpoints and crashes 1598c2ecf20Sopenharmony_ci when early_param's are parsed, we just won't act on the 1608c2ecf20Sopenharmony_ci "kgdbwait" parameter until dbg_late_init(). If you get a 1618c2ecf20Sopenharmony_ci crash and try to drop into kgdb somewhere between these two 1628c2ecf20Sopenharmony_ci places you might or might not end up being able to use kgdb 1638c2ecf20Sopenharmony_ci depending on exactly how far along the architecture has initted. 1648c2ecf20Sopenharmony_ci 1658c2ecf20Sopenharmony_ciendif # KGDB 166