Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1323447

[PATCH 2/4] Add WARN_XX() debugging options

From Jeffrey Merkey <jeffmerkey@gmail.com>
Newsgroups linux.kernel
Subject [PATCH 2/4] Add WARN_XX() debugging options
Date 2016-02-01 21:10 +0100
Message-ID <qXsXo-85A-9@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


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.

Signed-off-by: Jeffrey Merkey <jeffmerkey@gmail.com>
---
 include/asm-generic/bug.h | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index 630dd23..ed86cd2 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -90,14 +90,26 @@ extern void warn_slowpath_null(const char *file, const int line);
 })
 #endif
 
+#ifdef CONFIG_DEBUG_WARN
 #ifndef WARN
-#define WARN(condition, format...) ({						\
+#define WARN(condition, format...) ({					\
 	int __ret_warn_on = !!(condition);				\
 	if (unlikely(__ret_warn_on))					\
 		__WARN_printf(format);					\
+	BUG();								\
 	unlikely(__ret_warn_on);					\
 })
 #endif
+#else
+#ifndef WARN
+#define WARN(condition, format...) ({					\
+	int __ret_warn_on = !!(condition);				\
+	if (unlikely(__ret_warn_on))					\
+		__WARN_printf(format);					\
+	unlikely(__ret_warn_on);					\
+})
+#endif
+#endif
 
 #define WARN_TAINT(condition, taint, format...) ({			\
 	int __ret_warn_on = !!(condition);				\
-- 
1.8.3.1

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH 2/4] Add WARN_XX() debugging options Jeffrey Merkey <jeffmerkey@gmail.com> - 2016-02-01 21:10 +0100

csiph-web