[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1454365688-15676-1-git-send-email-jeffmerkey@gmail.com>
Date: Mon, 1 Feb 2016 15:28:08 -0700
From: Jeffrey Merkey <jeffmerkey@...il.com>
To: Jason@...c4.com, aconole@...hat.com, akpm@...ux-foundation.org,
andriy.shevchenko@...ux.intel.com, jeffmerkey@...il.com,
linus.walleij@...aro.org, linux-kernel@...r.kernel.org,
nicolas.iooss_linux@....org, pmladek@...e.com, rostedt@...dmis.org,
tj@...nel.org
Subject: [PATCH v3 4/4] pr_emerg add WARN_XX() debugger 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.
Signed-off-by: Jeffrey Merkey <jeffmerkey@...il.com>
---
include/linux/printk.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/include/linux/printk.h b/include/linux/printk.h
index 51dd6b8..dcfb270 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -252,8 +252,16 @@ extern asmlinkage void dump_stack(void) __cold;
* and other debug macros are compiled out unless either DEBUG is defined
* or CONFIG_DYNAMIC_DEBUG is set.
*/
+#ifdef CONFIG_DEBUG_WARN
+#define pr_emerg(fmt, ...) \
+({ \
+ printk(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__); \
+ BUG(); \
+})
+#else
#define pr_emerg(fmt, ...) \
printk(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__)
+#endif
#define pr_alert(fmt, ...) \
printk(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__)
#define pr_crit(fmt, ...) \
--
1.8.3.1
Powered by blists - more mailing lists