Skip to contentSkip to conversation

Add BUG_XX() and WARN_XX() debugging options

PATCH Superseded Jeffrey Merkey 1 participant 1 message Feb 1, 2016 Library code

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 3/4 Add BUG_XX() and WARN_XX() debugging options

This patch series adds config options which can be set during compile to direct the compiler to output a breakpoint instruction anywhere a BUG() or WARN() macro has been placed in the kernel to trigger the system to enter a debugger if a bug is detected by the system. Use of this compile time option also allows conditional breakpoints to be set in the kernel with these currently used macros.

This addition is extremely useful for debugging hard and soft lockups real time and quickly from a console debugger, and other areas of the kernel.

---
 lib/Kconfig.debug | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
lib/Kconfig.debug +22 -0
index 041f995..81b58cd 100644
@@ -326,6 +326,28 @@ config SECTION_MISMATCH_WARN_ONLY
 # is preferred to always offer frame pointers as a config
 # option on the architecture (regardless of KERNEL_DEBUG):
 #
+config DEBUG_BUG
+	bool "Set Breakpoint for Kernel BUG() macros"
+	depends on DEBUG_KERNEL && !S390
+	help
+	  Say Y here to enable the kernel to emit a breakpoint instruction
+	  anywhere a BUG_XX() macro has been placed in the system kernel code
+	  intended to catch bugs.
+
+	  This option is used for triggering the OS to try enter a debugger
+	  if one is presently installed on the system.
+
+config DEBUG_WARN
+	bool "Set Breakpoint for Kernel WARN() macros"
+	depends on DEBUG_KERNEL && !S390 && DEBUG_BUG
+	help
+	  Say Y here to enable the kernel to emit a breakpoint instruction
+	  anywhere a WARN_XX() macro has been placed in the system kernel code
+	  intended to catch bugs.
+
+	  This option is used for triggering the OS to try enter a debugger
+	  if one is presently installed on the system.
+
 config ARCH_WANT_FRAME_POINTERS
 	bool
 	help
Signature · 1 line
1.8.3.1