public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/4] Add BUG() debugger entry points x86
@ 2016-01-29 18:19 Jeffrey Merkey
  2016-01-29 18:35 ` kbuild test robot
  0 siblings, 1 reply; 2+ messages in thread
From: Jeffrey Merkey @ 2016-01-29 18:19 UTC (permalink / raw)
  To: hpa, jeffmerkey, linux-kernel, mingo, tglx, x86

This patch series adds a config option which can be set during compile to
direct the compiler to output a breakpoint instruction anywhere a BUG()
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 anywhere in the
kernel.

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>
---
 arch/x86/include/asm/bug.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/x86/include/asm/bug.h b/arch/x86/include/asm/bug.h
index ba38ebb..6319f3e0 100644
--- a/arch/x86/include/asm/bug.h
+++ b/arch/x86/include/asm/bug.h
@@ -27,7 +27,11 @@ do {								\
 #else
 #define BUG()							\
 do {								\
+#ifdef CONFIG_DEBUG_BREAK
+	asm volatile("int3");					\
+#else
 	asm volatile("ud2");					\
+#endif
 	unreachable();						\
 } while (0)
 #endif
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-01-29 18:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-29 18:19 [PATCH 2/4] Add BUG() debugger entry points x86 Jeffrey Merkey
2016-01-29 18:35 ` kbuild test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox