From: Chuck Ebbert <76306.1226@compuserve.com>
To: linux-kernel <linux-kernel@vger.kernel.org>
Cc: Andrew Morton <akpm@osdl.org>, Linus Torvalds <torvalds@osdl.org>,
Akinobu Mita <mita@miraclelinux.com>
Subject: [patch 2.6.15-current] i386: multi-column stack backtraces
Date: Tue, 17 Jan 2006 01:23:26 -0500 [thread overview]
Message-ID: <200601170126_MC3-1-B602-EFCB@compuserve.com> (raw)
Print stack backtraces in multiple columns, saving screen space.
Number of columns is configurable and defaults to one so
behavior is backwards-compatible.
Also removes the brackets around addresses when printing more
that one entry per line so they print as:
<address>
instead of:
[<address>]
This helps multiple entries fit better on one line.
Original idea by Dave Jones, taken from x86_64.
Signed-Off-By: Chuck Ebbert <76306.1226@compuserve.com>
arch/i386/Kconfig.debug | 9 +++++++++
arch/i386/kernel/traps.c | 32 +++++++++++++++++++++++++++-----
2 files changed, 36 insertions(+), 5 deletions(-)
--- 2.6.15a.orig/arch/i386/kernel/traps.c
+++ 2.6.15a/arch/i386/kernel/traps.c
@@ -112,12 +112,30 @@ static inline int valid_stack_ptr(struct
p < (void *)tinfo + THREAD_SIZE - 3;
}
-static inline void print_addr_and_symbol(unsigned long addr, char *log_lvl)
+/*
+ * Print CONFIG_STACK_BACKTRACE_COLS address/symbol entries per line.
+ */
+static inline int print_addr_and_symbol(unsigned long addr, char *log_lvl,
+ int printed)
{
- printk(log_lvl);
+ if (!printed)
+ printk(log_lvl);
+
+#if CONFIG_STACK_BACKTRACE_COLS == 1
printk(" [<%08lx>] ", addr);
+#else
+ printk(" <%08lx> ", addr);
+#endif
print_symbol("%s", addr);
- printk("\n");
+
+ printed = (printed + 1) % CONFIG_STACK_BACKTRACE_COLS;
+
+ if (printed)
+ printk(" ");
+ else
+ printk("\n");
+
+ return printed;
}
static inline unsigned long print_context_stack(struct thread_info *tinfo,
@@ -125,20 +143,24 @@ static inline unsigned long print_contex
char *log_lvl)
{
unsigned long addr;
+ int printed = 0; /* nr of entries already printed on current line */
#ifdef CONFIG_FRAME_POINTER
while (valid_stack_ptr(tinfo, (void *)ebp)) {
addr = *(unsigned long *)(ebp + 4);
- print_addr_and_symbol(addr, log_lvl);
+ printed = print_addr_and_symbol(addr, log_lvl, printed);
ebp = *(unsigned long *)ebp;
}
#else
while (valid_stack_ptr(tinfo, stack)) {
addr = *stack++;
if (__kernel_text_address(addr))
- print_addr_and_symbol(addr, log_lvl);
+ printed = print_addr_and_symbol(addr, log_lvl, printed);
}
#endif
+ if (printed)
+ printk("\n");
+
return ebp;
}
--- 2.6.15a.orig/arch/i386/Kconfig.debug
+++ 2.6.15a/arch/i386/Kconfig.debug
@@ -31,6 +31,15 @@ config DEBUG_STACK_USAGE
This option will slow down process creation somewhat.
+config STACK_BACKTRACE_COLS
+ int "Stack backtraces per line" if DEBUG_KERNEL
+ range 1 3
+ default 1
+ help
+ Selects how many stack backtrace entries per line to display.
+
+ This can save screen space when displaying traces.
+
comment "Page alloc debug is incompatible with Software Suspend on i386"
depends on DEBUG_KERNEL && SOFTWARE_SUSPEND
--
Chuck
Currently reading: _Einstein's Bridge_ by John Cramer
next reply other threads:[~2006-01-17 6:27 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-17 6:23 Chuck Ebbert [this message]
2006-01-17 6:39 ` [patch 2.6.15-current] i386: multi-column stack backtraces Dave Jones
2006-01-17 6:42 ` Andrew Morton
2006-01-17 7:58 ` Dave Jones
2006-01-17 8:20 ` Andrew Morton
2006-01-17 10:26 ` Keith Owens
2006-01-17 17:12 ` Jan Engelhardt
2006-01-18 5:23 ` Keith Owens
2006-01-17 10:22 ` Keith Owens
2006-01-17 18:14 ` Sam Ravnborg
2006-01-18 22:47 ` Pavel Machek
-- strict thread matches above, loose matches on Subject: below --
2006-01-18 3:05 Chuck Ebbert
2006-01-19 0:36 Chuck Ebbert
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=200601170126_MC3-1-B602-EFCB@compuserve.com \
--to=76306.1226@compuserve.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mita@miraclelinux.com \
--cc=torvalds@osdl.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