public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeffrey Merkey <jeffmerkey@gmail.com>
To: hpa@zytor.com, jeffmerkey@gmail.com,
	linux-kernel@vger.kernel.org, mingo@redhat.com,
	tglx@linutronix.de, x86@kernel.org
Subject: [PATCH 2/4] Add BUG() debugger entry points x86
Date: Fri, 29 Jan 2016 11:19:04 -0700	[thread overview]
Message-ID: <1454091544-12733-1-git-send-email-jeffmerkey@gmail.com> (raw)

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

             reply	other threads:[~2016-01-29 18:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-29 18:19 Jeffrey Merkey [this message]
2016-01-29 18:35 ` [PATCH 2/4] Add BUG() debugger entry points x86 kbuild test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1454091544-12733-1-git-send-email-jeffmerkey@gmail.com \
    --to=jeffmerkey@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox