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


Groups > linux.kernel > #1323627

[PATCH v4 4/4] pr_emerg add WARN_XX() debugger options

From Jeffrey Merkey <jeffmerkey@gmail.com>
Newsgroups linux.kernel
Subject [PATCH v4 4/4] pr_emerg add WARN_XX() debugger options
Date 2016-02-02 00:40 +0100
Message-ID <qXweC-1Qr-3@gated-at.bofh.it> (permalink)
References <qXweC-1Qr-5@gated-at.bofh.it>
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/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

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


Thread

[PATCH v4 4/4] pr_emerg add WARN_XX() debugger options Jeffrey Merkey <jeffmerkey@gmail.com> - 2016-02-02 00:40 +0100
  Re: [PATCH v4 4/4] pr_emerg add WARN_XX() debugger options Jeffrey Merkey <jeffmerkey@gmail.com> - 2016-02-02 03:10 +0100
    Re: [PATCH v4 4/4] pr_emerg add WARN_XX() debugger options "Maciej W. Rozycki" <macro@linux-mips.org> - 2016-02-02 20:50 +0100
      Re: [PATCH v4 4/4] pr_emerg add WARN_XX() debugger options Jeffrey Merkey <jeffmerkey@gmail.com> - 2016-02-02 23:20 +0100
  Re: [PATCH v4 4/4] pr_emerg add WARN_XX() debugger options Steven Rostedt <rostedt@goodmis.org> - 2016-02-02 03:10 +0100

csiph-web