xref: /linux/lib/Kconfig.kgdb (revision 36ec807b627b4c0a0a382f0ae48eac7187d14b2b)
1ec8f24b7SThomas Gleixner# SPDX-License-Identifier: GPL-2.0-only
2dc7d5527SJason Wessel
3e024cbd2SJan Engelhardtconfig HAVE_ARCH_KGDB
4e024cbd2SJan Engelhardt	bool
5e024cbd2SJan Engelhardt
68c080d3aSVincent Chen# set if architecture has the its kgdb_arch_handle_qxfer_pkt
78c080d3aSVincent Chen# function to enable gdb stub to address XML packet sent from GDB.
88c080d3aSVincent Chenconfig HAVE_ARCH_KGDB_QXFER_PKT
98c080d3aSVincent Chen	bool
108c080d3aSVincent Chen
11dc7d5527SJason Wesselmenuconfig KGDB
12dcc78711SJason Wessel	bool "KGDB: kernel debugger"
13dc7d5527SJason Wessel	depends on HAVE_ARCH_KGDB
14525c1f92SKees Cook	depends on DEBUG_KERNEL
15dc7d5527SJason Wessel	help
16dc7d5527SJason Wessel	  If you say Y here, it will be possible to remotely debug the
175f5ddfb3SJason Wessel	  kernel using gdb.  It is recommended but not required, that
185f5ddfb3SJason Wessel	  you also turn on the kernel config option
195f5ddfb3SJason Wessel	  CONFIG_FRAME_POINTER to aid in producing more reliable stack
205f5ddfb3SJason Wessel	  backtraces in the external debugger.  Documentation of
215f5ddfb3SJason Wessel	  kernel debugger is available at http://kgdb.sourceforge.net
2208c76a2fSMauro Carvalho Chehab	  as well as in Documentation/dev-tools/kgdb.rst.  If
235f5ddfb3SJason Wessel	  unsure, say N.
24dc7d5527SJason Wessel
25e024cbd2SJan Engelhardtif KGDB
26dc7d5527SJason Wessel
27f2d10ff4SDaniel Thompsonconfig KGDB_HONOUR_BLOCKLIST
28f2d10ff4SDaniel Thompson	bool "KGDB: use kprobe blocklist to prohibit unsafe breakpoints"
29f2d10ff4SDaniel Thompson	depends on HAVE_KPROBES
30f2d10ff4SDaniel Thompson	depends on MODULES
31f2d10ff4SDaniel Thompson	select KPROBES
32f2d10ff4SDaniel Thompson	default y
33f2d10ff4SDaniel Thompson	help
34f2d10ff4SDaniel Thompson	  If set to Y the debug core will use the kprobe blocklist to
35f2d10ff4SDaniel Thompson	  identify symbols where it is unsafe to set breakpoints.
36f2d10ff4SDaniel Thompson	  In particular this disallows instrumentation of functions
37f2d10ff4SDaniel Thompson	  called during debug trap handling and thus makes it very
38f2d10ff4SDaniel Thompson	  difficult to inadvertently provoke recursive trap handling.
39f2d10ff4SDaniel Thompson
40f2d10ff4SDaniel Thompson	  If unsure, say Y.
41f2d10ff4SDaniel Thompson
42dc7d5527SJason Wesselconfig KGDB_SERIAL_CONSOLE
43dc7d5527SJason Wessel	tristate "KGDB: use kgdb over the serial console"
44dc7d5527SJason Wessel	select CONSOLE_POLL
45dc7d5527SJason Wessel	select MAGIC_SYSRQ
465c49b6a4SLukas Bulwahn	depends on TTY && VT
47dc7d5527SJason Wessel	default y
48dc7d5527SJason Wessel	help
49dc7d5527SJason Wessel	  Share a serial console with kgdb. Sysrq-g must be used
50dc7d5527SJason Wessel	  to break in initially.
51e8d31c20SJason Wessel
52e8d31c20SJason Wesselconfig KGDB_TESTS
53e8d31c20SJason Wessel	bool "KGDB: internal test suite"
54e8d31c20SJason Wessel	default n
55e8d31c20SJason Wessel	help
56e8d31c20SJason Wessel	  This is a kgdb I/O module specifically designed to test
57e8d31c20SJason Wessel	  kgdb's internal functions.  This kgdb I/O module is
58e8d31c20SJason Wessel	  intended to for the development of new kgdb stubs
59e8d31c20SJason Wessel	  as well as regression testing the kgdb internals.
60e8d31c20SJason Wessel	  See the drivers/misc/kgdbts.c for the details about
61e8d31c20SJason Wessel	  the tests.  The most basic of this I/O module is to boot
62e8d31c20SJason Wessel	  a kernel boot arguments "kgdbwait kgdbts=V1F100"
63974460c5SJason Wessel
64974460c5SJason Wesselconfig KGDB_TESTS_ON_BOOT
65974460c5SJason Wessel	bool "KGDB: Run tests on boot"
66974460c5SJason Wessel	depends on KGDB_TESTS
67974460c5SJason Wessel	default n
68974460c5SJason Wessel	help
69974460c5SJason Wessel	  Run the kgdb tests on boot up automatically without the need
70974460c5SJason Wessel	  to pass in a kernel parameter
71974460c5SJason Wessel
72974460c5SJason Wesselconfig KGDB_TESTS_BOOT_STRING
73974460c5SJason Wessel	string "KGDB: which internal kgdb tests to run"
74974460c5SJason Wessel	depends on KGDB_TESTS_ON_BOOT
75974460c5SJason Wessel	default "V1F100"
76974460c5SJason Wessel	help
77974460c5SJason Wessel	  This is the command string to send the kgdb test suite on
78974460c5SJason Wessel	  boot.  See the drivers/misc/kgdbts.c for detailed
79974460c5SJason Wessel	  information about other strings you could use beyond the
80974460c5SJason Wessel	  default of V1F100.
81e024cbd2SJan Engelhardt
82f503b5aeSJason Wesselconfig KGDB_LOW_LEVEL_TRAP
83f503b5aeSJason Wessel       bool "KGDB: Allow debugging with traps in notifiers"
845dd11d5dSJason Wessel       depends on X86 || MIPS
85f503b5aeSJason Wessel       default n
86f503b5aeSJason Wessel       help
87f503b5aeSJason Wessel	 This will add an extra call back to kgdb for the breakpoint
88278cee05SMasanari Iida	 exception handler which will allow kgdb to step through a
89278cee05SMasanari Iida	 notify handler.
90f503b5aeSJason Wessel
91dcc78711SJason Wesselconfig KGDB_KDB
92dcc78711SJason Wessel	bool "KGDB_KDB: include kdb frontend for kgdb"
93dcc78711SJason Wessel	default n
94dcc78711SJason Wessel	help
95dcc78711SJason Wessel	  KDB frontend for kernel
96dcc78711SJason Wessel
97b8017177SDaniel Thompsonconfig KDB_DEFAULT_ENABLE
98b8017177SDaniel Thompson	hex "KDB: Select kdb command functions to be enabled by default"
99b8017177SDaniel Thompson	depends on KGDB_KDB
100b8017177SDaniel Thompson	default 0x1
101b8017177SDaniel Thompson	help
102b8017177SDaniel Thompson	  Specifiers which kdb commands are enabled by default. This may
103b8017177SDaniel Thompson	  be set to 1 or 0 to enable all commands or disable almost all
104b8017177SDaniel Thompson	  commands.
105b8017177SDaniel Thompson
106b8017177SDaniel Thompson	  Alternatively the following bitmask applies:
107b8017177SDaniel Thompson
108b8017177SDaniel Thompson	    0x0002 - allow arbitrary reads from memory and symbol lookup
109b8017177SDaniel Thompson	    0x0004 - allow arbitrary writes to memory
110b8017177SDaniel Thompson	    0x0008 - allow current register state to be inspected
111b8017177SDaniel Thompson	    0x0010 - allow current register state to be modified
112b8017177SDaniel Thompson	    0x0020 - allow passive inspection (backtrace, process list, lsmod)
113b8017177SDaniel Thompson	    0x0040 - allow flow control management (breakpoint, single step)
114b8017177SDaniel Thompson	    0x0080 - enable signalling of processes
115b8017177SDaniel Thompson	    0x0100 - allow machine to be rebooted
116b8017177SDaniel Thompson
117b8017177SDaniel Thompson	  The config option merely sets the default at boot time. Both
118b8017177SDaniel Thompson	  issuing 'echo X > /sys/module/kdb/parameters/cmd_enable' or
119b8017177SDaniel Thompson	  setting with kdb.cmd_enable=X kernel command line option will
120b8017177SDaniel Thompson	  override the default settings.
121b8017177SDaniel Thompson
122ada64e4cSJason Wesselconfig KDB_KEYBOARD
123ada64e4cSJason Wessel	bool "KGDB_KDB: keyboard as input device"
124027c3d34SHelge Deller	depends on VT && KGDB_KDB && !PARISC
125*b157f0e9SNiklas Schnelle	depends on HAS_IOPORT
126ada64e4cSJason Wessel	default n
127ada64e4cSJason Wessel	help
128ada64e4cSJason Wessel	  KDB can use a PS/2 type keyboard for an input device
129ada64e4cSJason Wessel
1303b0eb71eSRobert Obermeierconfig KDB_CONTINUE_CATASTROPHIC
1313b0eb71eSRobert Obermeier	int "KDB: continue after catastrophic errors"
1323b0eb71eSRobert Obermeier	depends on KGDB_KDB
1333b0eb71eSRobert Obermeier	default "0"
1343b0eb71eSRobert Obermeier	help
1353b0eb71eSRobert Obermeier	  This integer controls the behaviour of kdb when the kernel gets a
1363b0eb71eSRobert Obermeier	  catastrophic error, i.e. for a panic or oops.
1373b0eb71eSRobert Obermeier	  When KDB is active and a catastrophic error occurs, nothing extra
1383b0eb71eSRobert Obermeier	  will happen until you type 'go'.
1393b0eb71eSRobert Obermeier	  CONFIG_KDB_CONTINUE_CATASTROPHIC == 0 (default). The first time
1403b0eb71eSRobert Obermeier	  you type 'go', you will be warned by kdb. The secend time you type
1413b0eb71eSRobert Obermeier	  'go', KDB tries to continue. No guarantees that the
1423b0eb71eSRobert Obermeier	  kernel is still usable in this situation.
1433b0eb71eSRobert Obermeier	  CONFIG_KDB_CONTINUE_CATASTROPHIC == 1. KDB tries to continue.
1443b0eb71eSRobert Obermeier	  No guarantees that the kernel is still usable in this situation.
1453b0eb71eSRobert Obermeier	  CONFIG_KDB_CONTINUE_CATASTROPHIC == 2. KDB forces a reboot.
1463b0eb71eSRobert Obermeier	  If you are not sure, say 0.
1473b0eb71eSRobert Obermeier
148b1a57bbfSDouglas Andersonconfig ARCH_HAS_EARLY_DEBUG
149b1a57bbfSDouglas Anderson	bool
150b1a57bbfSDouglas Anderson	default n
151b1a57bbfSDouglas Anderson	help
152b1a57bbfSDouglas Anderson	  If an architecture can definitely handle entering the debugger
153b1a57bbfSDouglas Anderson	  when early_param's are parsed then it select this config.
154b1a57bbfSDouglas Anderson	  Otherwise, if "kgdbwait" is passed on the kernel command line it
155b1a57bbfSDouglas Anderson	  won't actually be processed until dbg_late_init() just after the
156b1a57bbfSDouglas Anderson	  call to kgdb_arch_late() is made.
157b1a57bbfSDouglas Anderson
158b1a57bbfSDouglas Anderson	  NOTE: Even if this isn't selected by an architecture we will
159b1a57bbfSDouglas Anderson	  still try to register kgdb to handle breakpoints and crashes
160b1a57bbfSDouglas Anderson	  when early_param's are parsed, we just won't act on the
161b1a57bbfSDouglas Anderson	  "kgdbwait" parameter until dbg_late_init().  If you get a
162b1a57bbfSDouglas Anderson	  crash and try to drop into kgdb somewhere between these two
163b1a57bbfSDouglas Anderson	  places you might or might not end up being able to use kgdb
164b1a57bbfSDouglas Anderson	  depending on exactly how far along the architecture has initted.
165b1a57bbfSDouglas Anderson
166e024cbd2SJan Engelhardtendif # KGDB
167