xref: /OK3568_Linux_fs/kernel/lib/Kconfig.kgdb (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun# SPDX-License-Identifier: GPL-2.0-only
2*4882a593Smuzhiyun
3*4882a593Smuzhiyunconfig HAVE_ARCH_KGDB
4*4882a593Smuzhiyun	bool
5*4882a593Smuzhiyun
6*4882a593Smuzhiyun# set if architecture has the its kgdb_arch_handle_qxfer_pkt
7*4882a593Smuzhiyun# function to enable gdb stub to address XML packet sent from GDB.
8*4882a593Smuzhiyunconfig HAVE_ARCH_KGDB_QXFER_PKT
9*4882a593Smuzhiyun	bool
10*4882a593Smuzhiyun
11*4882a593Smuzhiyunmenuconfig KGDB
12*4882a593Smuzhiyun	bool "KGDB: kernel debugger"
13*4882a593Smuzhiyun	depends on HAVE_ARCH_KGDB
14*4882a593Smuzhiyun	depends on DEBUG_KERNEL
15*4882a593Smuzhiyun	help
16*4882a593Smuzhiyun	  If you say Y here, it will be possible to remotely debug the
17*4882a593Smuzhiyun	  kernel using gdb.  It is recommended but not required, that
18*4882a593Smuzhiyun	  you also turn on the kernel config option
19*4882a593Smuzhiyun	  CONFIG_FRAME_POINTER to aid in producing more reliable stack
20*4882a593Smuzhiyun	  backtraces in the external debugger.  Documentation of
21*4882a593Smuzhiyun	  kernel debugger is available at http://kgdb.sourceforge.net
22*4882a593Smuzhiyun	  as well as in Documentation/dev-tools/kgdb.rst.  If
23*4882a593Smuzhiyun	  unsure, say N.
24*4882a593Smuzhiyun
25*4882a593Smuzhiyunif KGDB
26*4882a593Smuzhiyun
27*4882a593Smuzhiyunconfig KGDB_HONOUR_BLOCKLIST
28*4882a593Smuzhiyun	bool "KGDB: use kprobe blocklist to prohibit unsafe breakpoints"
29*4882a593Smuzhiyun	depends on HAVE_KPROBES
30*4882a593Smuzhiyun	depends on MODULES
31*4882a593Smuzhiyun	select KPROBES
32*4882a593Smuzhiyun	default y
33*4882a593Smuzhiyun	help
34*4882a593Smuzhiyun	  If set to Y the debug core will use the kprobe blocklist to
35*4882a593Smuzhiyun	  identify symbols where it is unsafe to set breakpoints.
36*4882a593Smuzhiyun	  In particular this disallows instrumentation of functions
37*4882a593Smuzhiyun	  called during debug trap handling and thus makes it very
38*4882a593Smuzhiyun	  difficult to inadvertently provoke recursive trap handling.
39*4882a593Smuzhiyun
40*4882a593Smuzhiyun	  If unsure, say Y.
41*4882a593Smuzhiyun
42*4882a593Smuzhiyunconfig KGDB_SERIAL_CONSOLE
43*4882a593Smuzhiyun	tristate "KGDB: use kgdb over the serial console"
44*4882a593Smuzhiyun	select CONSOLE_POLL
45*4882a593Smuzhiyun	select MAGIC_SYSRQ
46*4882a593Smuzhiyun	depends on TTY && HW_CONSOLE
47*4882a593Smuzhiyun	default y
48*4882a593Smuzhiyun	help
49*4882a593Smuzhiyun	  Share a serial console with kgdb. Sysrq-g must be used
50*4882a593Smuzhiyun	  to break in initially.
51*4882a593Smuzhiyun
52*4882a593Smuzhiyunconfig KGDB_TESTS
53*4882a593Smuzhiyun	bool "KGDB: internal test suite"
54*4882a593Smuzhiyun	default n
55*4882a593Smuzhiyun	help
56*4882a593Smuzhiyun	  This is a kgdb I/O module specifically designed to test
57*4882a593Smuzhiyun	  kgdb's internal functions.  This kgdb I/O module is
58*4882a593Smuzhiyun	  intended to for the development of new kgdb stubs
59*4882a593Smuzhiyun	  as well as regression testing the kgdb internals.
60*4882a593Smuzhiyun	  See the drivers/misc/kgdbts.c for the details about
61*4882a593Smuzhiyun	  the tests.  The most basic of this I/O module is to boot
62*4882a593Smuzhiyun	  a kernel boot arguments "kgdbwait kgdbts=V1F100"
63*4882a593Smuzhiyun
64*4882a593Smuzhiyunconfig KGDB_TESTS_ON_BOOT
65*4882a593Smuzhiyun	bool "KGDB: Run tests on boot"
66*4882a593Smuzhiyun	depends on KGDB_TESTS
67*4882a593Smuzhiyun	default n
68*4882a593Smuzhiyun	help
69*4882a593Smuzhiyun	  Run the kgdb tests on boot up automatically without the need
70*4882a593Smuzhiyun	  to pass in a kernel parameter
71*4882a593Smuzhiyun
72*4882a593Smuzhiyunconfig KGDB_TESTS_BOOT_STRING
73*4882a593Smuzhiyun	string "KGDB: which internal kgdb tests to run"
74*4882a593Smuzhiyun	depends on KGDB_TESTS_ON_BOOT
75*4882a593Smuzhiyun	default "V1F100"
76*4882a593Smuzhiyun	help
77*4882a593Smuzhiyun	  This is the command string to send the kgdb test suite on
78*4882a593Smuzhiyun	  boot.  See the drivers/misc/kgdbts.c for detailed
79*4882a593Smuzhiyun	  information about other strings you could use beyond the
80*4882a593Smuzhiyun	  default of V1F100.
81*4882a593Smuzhiyun
82*4882a593Smuzhiyunconfig KGDB_LOW_LEVEL_TRAP
83*4882a593Smuzhiyun       bool "KGDB: Allow debugging with traps in notifiers"
84*4882a593Smuzhiyun       depends on X86 || MIPS
85*4882a593Smuzhiyun       default n
86*4882a593Smuzhiyun       help
87*4882a593Smuzhiyun	 This will add an extra call back to kgdb for the breakpoint
88*4882a593Smuzhiyun	 exception handler which will allow kgdb to step through a
89*4882a593Smuzhiyun	 notify handler.
90*4882a593Smuzhiyun
91*4882a593Smuzhiyunconfig KGDB_KDB
92*4882a593Smuzhiyun	bool "KGDB_KDB: include kdb frontend for kgdb"
93*4882a593Smuzhiyun	default n
94*4882a593Smuzhiyun	help
95*4882a593Smuzhiyun	  KDB frontend for kernel
96*4882a593Smuzhiyun
97*4882a593Smuzhiyunconfig KDB_DEFAULT_ENABLE
98*4882a593Smuzhiyun	hex "KDB: Select kdb command functions to be enabled by default"
99*4882a593Smuzhiyun	depends on KGDB_KDB
100*4882a593Smuzhiyun	default 0x1
101*4882a593Smuzhiyun	help
102*4882a593Smuzhiyun	  Specifiers which kdb commands are enabled by default. This may
103*4882a593Smuzhiyun	  be set to 1 or 0 to enable all commands or disable almost all
104*4882a593Smuzhiyun	  commands.
105*4882a593Smuzhiyun
106*4882a593Smuzhiyun	  Alternatively the following bitmask applies:
107*4882a593Smuzhiyun
108*4882a593Smuzhiyun	    0x0002 - allow arbitrary reads from memory and symbol lookup
109*4882a593Smuzhiyun	    0x0004 - allow arbitrary writes to memory
110*4882a593Smuzhiyun	    0x0008 - allow current register state to be inspected
111*4882a593Smuzhiyun	    0x0010 - allow current register state to be modified
112*4882a593Smuzhiyun	    0x0020 - allow passive inspection (backtrace, process list, lsmod)
113*4882a593Smuzhiyun	    0x0040 - allow flow control management (breakpoint, single step)
114*4882a593Smuzhiyun	    0x0080 - enable signalling of processes
115*4882a593Smuzhiyun	    0x0100 - allow machine to be rebooted
116*4882a593Smuzhiyun
117*4882a593Smuzhiyun	  The config option merely sets the default at boot time. Both
118*4882a593Smuzhiyun	  issuing 'echo X > /sys/module/kdb/parameters/cmd_enable' or
119*4882a593Smuzhiyun	  setting with kdb.cmd_enable=X kernel command line option will
120*4882a593Smuzhiyun	  override the default settings.
121*4882a593Smuzhiyun
122*4882a593Smuzhiyunconfig KDB_KEYBOARD
123*4882a593Smuzhiyun	bool "KGDB_KDB: keyboard as input device"
124*4882a593Smuzhiyun	depends on VT && KGDB_KDB
125*4882a593Smuzhiyun	default n
126*4882a593Smuzhiyun	help
127*4882a593Smuzhiyun	  KDB can use a PS/2 type keyboard for an input device
128*4882a593Smuzhiyun
129*4882a593Smuzhiyunconfig KDB_CONTINUE_CATASTROPHIC
130*4882a593Smuzhiyun	int "KDB: continue after catastrophic errors"
131*4882a593Smuzhiyun	depends on KGDB_KDB
132*4882a593Smuzhiyun	default "0"
133*4882a593Smuzhiyun	help
134*4882a593Smuzhiyun	  This integer controls the behaviour of kdb when the kernel gets a
135*4882a593Smuzhiyun	  catastrophic error, i.e. for a panic or oops.
136*4882a593Smuzhiyun	  When KDB is active and a catastrophic error occurs, nothing extra
137*4882a593Smuzhiyun	  will happen until you type 'go'.
138*4882a593Smuzhiyun	  CONFIG_KDB_CONTINUE_CATASTROPHIC == 0 (default). The first time
139*4882a593Smuzhiyun	  you type 'go', you will be warned by kdb. The secend time you type
140*4882a593Smuzhiyun	  'go', KDB tries to continue. No guarantees that the
141*4882a593Smuzhiyun	  kernel is still usable in this situation.
142*4882a593Smuzhiyun	  CONFIG_KDB_CONTINUE_CATASTROPHIC == 1. KDB tries to continue.
143*4882a593Smuzhiyun	  No guarantees that the kernel is still usable in this situation.
144*4882a593Smuzhiyun	  CONFIG_KDB_CONTINUE_CATASTROPHIC == 2. KDB forces a reboot.
145*4882a593Smuzhiyun	  If you are not sure, say 0.
146*4882a593Smuzhiyun
147*4882a593Smuzhiyunconfig ARCH_HAS_EARLY_DEBUG
148*4882a593Smuzhiyun	bool
149*4882a593Smuzhiyun	default n
150*4882a593Smuzhiyun	help
151*4882a593Smuzhiyun	  If an architecture can definitely handle entering the debugger
152*4882a593Smuzhiyun	  when early_param's are parsed then it select this config.
153*4882a593Smuzhiyun	  Otherwise, if "kgdbwait" is passed on the kernel command line it
154*4882a593Smuzhiyun	  won't actually be processed until dbg_late_init() just after the
155*4882a593Smuzhiyun	  call to kgdb_arch_late() is made.
156*4882a593Smuzhiyun
157*4882a593Smuzhiyun	  NOTE: Even if this isn't selected by an architecture we will
158*4882a593Smuzhiyun	  still try to register kgdb to handle breakpoints and crashes
159*4882a593Smuzhiyun	  when early_param's are parsed, we just won't act on the
160*4882a593Smuzhiyun	  "kgdbwait" parameter until dbg_late_init().  If you get a
161*4882a593Smuzhiyun	  crash and try to drop into kgdb somewhere between these two
162*4882a593Smuzhiyun	  places you might or might not end up being able to use kgdb
163*4882a593Smuzhiyun	  depending on exactly how far along the architecture has initted.
164*4882a593Smuzhiyun
165*4882a593Smuzhiyunendif # KGDB
166