From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Andi Kleen <ak@muc.de>, Andrew Morton <akpm@osdl.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH] Put the BUG __FILE__ and __LINE__ info out of line
Date: Wed, 27 Sep 2006 23:00:03 -0700 [thread overview]
Message-ID: <451B64E3.9020900@goop.org> (raw)
When CONFIG_DEBUG_BUGVERBOSE is enabled, the embedded file and line
information makes a disassembler very unhappy, because it tries to
parse them as instructions (it probably makes the CPU's instruction
decoder a little unhappy too).
This patch moves them out of line, and calls the ud2 from the code -
the call makes sure the original %eip is available on the top of the
stack. The result is a happy disassembler, with no loss of debugging
information.
Signed-off-by: Jeremy Fitzhardinge <jeremy@goop.org>
--
arch/i386/kernel/vmlinux.lds.S | 2 ++
include/asm-i386/bug.h | 13 ++++++++-----
2 files changed, 10 insertions(+), 5 deletions(-)
diff -r 1d29394927f3 arch/i386/kernel/vmlinux.lds.S
--- a/arch/i386/kernel/vmlinux.lds.S Tue Sep 26 01:20:38 2006 -0700
+++ b/arch/i386/kernel/vmlinux.lds.S Wed Sep 27 22:18:23 2006 -0700
@@ -27,6 +27,8 @@ SECTIONS
_text = .; /* Text and read-only data */
.text : AT(ADDR(.text) - LOAD_OFFSET) {
*(.text)
+ __bugs = .;
+ *(.text.bugs)
SCHED_TEXT
LOCK_TEXT
KPROBES_TEXT
diff -r 1d29394927f3 include/asm-i386/bug.h
--- a/include/asm-i386/bug.h Tue Sep 26 01:20:38 2006 -0700
+++ b/include/asm-i386/bug.h Wed Sep 27 18:59:41 2006 -0700
@@ -11,11 +11,14 @@
#ifdef CONFIG_BUG
#define HAVE_ARCH_BUG
#ifdef CONFIG_DEBUG_BUGVERBOSE
-#define BUG() \
- __asm__ __volatile__( "ud2\n" \
- "\t.word %c0\n" \
- "\t.long %c1\n" \
- : : "i" (__LINE__), "i" (__FILE__))
+#define BUG() \
+ __asm__ __volatile__("call 1f\n" \
+ ".section .text.bugs\n" \
+ "1:\tud2\n" \
+ "\t.word %c0\n" \
+ "\t.long %c1\n" \
+ ".previous\n" \
+ : : "i" (__LINE__), "i" (__FILE__))
#else
#define BUG() __asm__ __volatile__("ud2\n")
#endif
next reply other threads:[~2006-09-28 5:59 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-28 6:00 Jeremy Fitzhardinge [this message]
2006-09-28 6:35 ` [PATCH] Put the BUG __FILE__ and __LINE__ info out of line Andrew Morton
2006-09-28 6:49 ` Jeremy Fitzhardinge
2006-09-28 7:00 ` Andrew Morton
2006-09-28 7:17 ` Andi Kleen
2006-09-28 7:26 ` Andrew Morton
2006-09-28 10:15 ` Andi Kleen
2006-09-28 10:30 ` Jeremy Fitzhardinge
2006-09-28 10:38 ` Andi Kleen
2006-09-28 15:30 ` Hugh Dickins
2006-09-28 19:44 ` Andi Kleen
2006-09-28 10:27 ` Jeremy Fitzhardinge
2006-09-28 16:18 ` Andrew Morton
2006-09-28 16:32 ` Jeremy Fitzhardinge
2006-09-28 7:16 ` Andi Kleen
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=451B64E3.9020900@goop.org \
--to=jeremy@goop.org \
--cc=ak@muc.de \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.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