0001 # SPDX-License-Identifier: GPL-2.0-only
0002
0003 config HAVE_ARCH_KGDB
0004 bool
0005
0006 # set if architecture has the its kgdb_arch_handle_qxfer_pkt
0007 # function to enable gdb stub to address XML packet sent from GDB.
0008 config HAVE_ARCH_KGDB_QXFER_PKT
0009 bool
0010
0011 menuconfig KGDB
0012 bool "KGDB: kernel debugger"
0013 depends on HAVE_ARCH_KGDB
0014 depends on DEBUG_KERNEL
0015 help
0016 If you say Y here, it will be possible to remotely debug the
0017 kernel using gdb. It is recommended but not required, that
0018 you also turn on the kernel config option
0019 CONFIG_FRAME_POINTER to aid in producing more reliable stack
0020 backtraces in the external debugger. Documentation of
0021 kernel debugger is available at http://kgdb.sourceforge.net
0022 as well as in Documentation/dev-tools/kgdb.rst. If
0023 unsure, say N.
0024
0025 if KGDB
0026
0027 config KGDB_HONOUR_BLOCKLIST
0028 bool "KGDB: use kprobe blocklist to prohibit unsafe breakpoints"
0029 depends on HAVE_KPROBES
0030 depends on MODULES
0031 select KPROBES
0032 default y
0033 help
0034 If set to Y the debug core will use the kprobe blocklist to
0035 identify symbols where it is unsafe to set breakpoints.
0036 In particular this disallows instrumentation of functions
0037 called during debug trap handling and thus makes it very
0038 difficult to inadvertently provoke recursive trap handling.
0039
0040 If unsure, say Y.
0041
0042 config KGDB_SERIAL_CONSOLE
0043 tristate "KGDB: use kgdb over the serial console"
0044 select CONSOLE_POLL
0045 select MAGIC_SYSRQ
0046 depends on TTY && HW_CONSOLE
0047 default y
0048 help
0049 Share a serial console with kgdb. Sysrq-g must be used
0050 to break in initially.
0051
0052 config KGDB_TESTS
0053 bool "KGDB: internal test suite"
0054 default n
0055 help
0056 This is a kgdb I/O module specifically designed to test
0057 kgdb's internal functions. This kgdb I/O module is
0058 intended to for the development of new kgdb stubs
0059 as well as regression testing the kgdb internals.
0060 See the drivers/misc/kgdbts.c for the details about
0061 the tests. The most basic of this I/O module is to boot
0062 a kernel boot arguments "kgdbwait kgdbts=V1F100"
0063
0064 config KGDB_TESTS_ON_BOOT
0065 bool "KGDB: Run tests on boot"
0066 depends on KGDB_TESTS
0067 default n
0068 help
0069 Run the kgdb tests on boot up automatically without the need
0070 to pass in a kernel parameter
0071
0072 config KGDB_TESTS_BOOT_STRING
0073 string "KGDB: which internal kgdb tests to run"
0074 depends on KGDB_TESTS_ON_BOOT
0075 default "V1F100"
0076 help
0077 This is the command string to send the kgdb test suite on
0078 boot. See the drivers/misc/kgdbts.c for detailed
0079 information about other strings you could use beyond the
0080 default of V1F100.
0081
0082 config KGDB_LOW_LEVEL_TRAP
0083 bool "KGDB: Allow debugging with traps in notifiers"
0084 depends on X86 || MIPS
0085 default n
0086 help
0087 This will add an extra call back to kgdb for the breakpoint
0088 exception handler which will allow kgdb to step through a
0089 notify handler.
0090
0091 config KGDB_KDB
0092 bool "KGDB_KDB: include kdb frontend for kgdb"
0093 default n
0094 help
0095 KDB frontend for kernel
0096
0097 config KDB_DEFAULT_ENABLE
0098 hex "KDB: Select kdb command functions to be enabled by default"
0099 depends on KGDB_KDB
0100 default 0x1
0101 help
0102 Specifiers which kdb commands are enabled by default. This may
0103 be set to 1 or 0 to enable all commands or disable almost all
0104 commands.
0105
0106 Alternatively the following bitmask applies:
0107
0108 0x0002 - allow arbitrary reads from memory and symbol lookup
0109 0x0004 - allow arbitrary writes to memory
0110 0x0008 - allow current register state to be inspected
0111 0x0010 - allow current register state to be modified
0112 0x0020 - allow passive inspection (backtrace, process list, lsmod)
0113 0x0040 - allow flow control management (breakpoint, single step)
0114 0x0080 - enable signalling of processes
0115 0x0100 - allow machine to be rebooted
0116
0117 The config option merely sets the default at boot time. Both
0118 issuing 'echo X > /sys/module/kdb/parameters/cmd_enable' or
0119 setting with kdb.cmd_enable=X kernel command line option will
0120 override the default settings.
0121
0122 config KDB_KEYBOARD
0123 bool "KGDB_KDB: keyboard as input device"
0124 depends on VT && KGDB_KDB
0125 default n
0126 help
0127 KDB can use a PS/2 type keyboard for an input device
0128
0129 config KDB_CONTINUE_CATASTROPHIC
0130 int "KDB: continue after catastrophic errors"
0131 depends on KGDB_KDB
0132 default "0"
0133 help
0134 This integer controls the behaviour of kdb when the kernel gets a
0135 catastrophic error, i.e. for a panic or oops.
0136 When KDB is active and a catastrophic error occurs, nothing extra
0137 will happen until you type 'go'.
0138 CONFIG_KDB_CONTINUE_CATASTROPHIC == 0 (default). The first time
0139 you type 'go', you will be warned by kdb. The secend time you type
0140 'go', KDB tries to continue. No guarantees that the
0141 kernel is still usable in this situation.
0142 CONFIG_KDB_CONTINUE_CATASTROPHIC == 1. KDB tries to continue.
0143 No guarantees that the kernel is still usable in this situation.
0144 CONFIG_KDB_CONTINUE_CATASTROPHIC == 2. KDB forces a reboot.
0145 If you are not sure, say 0.
0146
0147 config ARCH_HAS_EARLY_DEBUG
0148 bool
0149 default n
0150 help
0151 If an architecture can definitely handle entering the debugger
0152 when early_param's are parsed then it select this config.
0153 Otherwise, if "kgdbwait" is passed on the kernel command line it
0154 won't actually be processed until dbg_late_init() just after the
0155 call to kgdb_arch_late() is made.
0156
0157 NOTE: Even if this isn't selected by an architecture we will
0158 still try to register kgdb to handle breakpoints and crashes
0159 when early_param's are parsed, we just won't act on the
0160 "kgdbwait" parameter until dbg_late_init(). If you get a
0161 crash and try to drop into kgdb somewhere between these two
0162 places you might or might not end up being able to use kgdb
0163 depending on exactly how far along the architecture has initted.
0164
0165 endif # KGDB