* [PATCH v2 2/4] Add WARN_XX() debugging options
@ 2016-02-01 20:45 Jeffrey Merkey
0 siblings, 0 replies; only message in thread
From: Jeffrey Merkey @ 2016-02-01 20:45 UTC (permalink / raw)
To: arnd, linux-arch, linux-kernel
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2016-02-01 20:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-01 20:45 [PATCH v2 2/4] Add WARN_XX() debugging options Jeffrey Merkey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).