mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mike Travis <travis@sgi.com>
To: Jason Wessel <jason.wessel@windriver.com>
Cc: Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	kgdb-bugreport@lists.sourceforge.net, x86@kernel.org,
	linux-kernel@vger.kernel.org, Tim Bird <tim.bird@am.sony.com>
Subject: [PATCH 02/15] KDB: fix errant character in KDB show regs
Date: Mon, 25 Mar 2013 13:50:09 -0500	[thread overview]
Message-ID: <20130325185007.634432020@gulag1.americas.sgi.com> (raw)
In-Reply-To: <20130325185007.321022858@gulag1.americas.sgi.com>

[-- Attachment #1: kdb-fix-show-regs.patch --]
[-- Type: text/plain, Size: 2290 bytes --]

When KDB prints the process regs and backtrace, every line is preceeded
with the character 'd'.  This is the level argument to printk which
is not interpreted when KDB is printing.  Skip over this possible
printk level in the outgoing string to fix this.

Here is a small sample:

dRIP: 0010:[<ffffffff814e96ca>]  [<ffffffff814e96ca>] poll_idle+0x4a/0x90
dRSP: 0018:ffff88081d5eddd8  EFLAGS: 00000246
dRAX: 0000000400000000 RBX: 00000216ae7fbf5d RCX: 0000021658a8e600
dRDX: ffff88081d5ec010 RSI: ffffffff819a7d20 RDI: ffffffff8193c140

Cc: Tim Bird <tim.bird@am.sony.com>
Reviewed-by: Dimitri Sivanich <sivanich@sgi.com>
Signed-off-by: Mike Travis <travis@sgi.com>
---
 kernel/debug/kdb/kdb_io.c |   16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

--- linux.orig/kernel/debug/kdb/kdb_io.c
+++ linux/kernel/debug/kdb/kdb_io.c
@@ -559,6 +559,7 @@ int vkdb_printf(const char *fmt, va_list
 	int retlen = 0;
 	int fnd, len;
 	char *cp, *cp2, *cphold = NULL, replaced_byte = ' ';
+	const char *ostring;
 	char *moreprompt = "more> ";
 	struct console *c = console_drivers;
 	static DEFINE_SPINLOCK(kdb_printf_lock);
@@ -690,20 +691,21 @@ kdb_printit:
 	/*
 	 * Write to all consoles.
 	 */
-	retlen = strlen(kdb_buffer);
+	ostring = printk_skip_level(kdb_buffer);
+	retlen = strlen(ostring);
 	if (!dbg_kdb_mode && kgdb_connected) {
-		gdbstub_msg_write(kdb_buffer, retlen);
+		gdbstub_msg_write(ostring, retlen);
 	} else {
 		if (dbg_io_ops && !dbg_io_ops->is_console) {
 			len = retlen;
-			cp = kdb_buffer;
+			cp = (char *)ostring;
 			while (len--) {
 				dbg_io_ops->write_char(*cp);
 				cp++;
 			}
 		}
 		while (c) {
-			c->write(c, kdb_buffer, retlen);
+			c->write(c, ostring, retlen);
 			touch_nmi_watchdog();
 			c = c->next;
 		}
@@ -711,7 +713,7 @@ kdb_printit:
 	if (logging) {
 		saved_loglevel = console_loglevel;
 		console_loglevel = 0;
-		printk(KERN_INFO "%s", kdb_buffer);
+		pr_info("%s", ostring);
 	}
 
 	if (KDB_STATE(PAGER)) {
@@ -723,10 +725,10 @@ kdb_printit:
 		int got = 0;
 		len = retlen;
 		while (len--) {
-			if (kdb_buffer[len] == '\n') {
+			if (ostring[len] == '\n') {
 				kdb_nextline++;
 				got = 0;
-			} else if (kdb_buffer[len] == '\r') {
+			} else if (ostring[len] == '\r') {
 				got = 0;
 			} else {
 				got++;

-- 

  parent reply	other threads:[~2013-03-25 18:50 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-25 18:50 [PATCH 00/15] x86/UV/KDB/NMI: Updates for NMI/KDB handler for SGI UV Mike Travis
2013-03-25 18:50 ` [PATCH 01/15] KDB: fix the interrupt of the KDB btc command Mike Travis
2013-03-25 21:11   ` Jason Wessel
2013-03-25 18:50 ` Mike Travis [this message]
2013-03-25 18:50 ` [PATCH 03/15] KDB: up the default LINES value Mike Travis
2013-03-25 21:22   ` Jason Wessel
2013-03-25 21:31     ` Mike Travis
2013-03-25 18:50 ` [PATCH 04/15] KDB: allow KDB modules to be external modules Mike Travis
2013-03-25 18:50 ` [PATCH 05/15] KDB: add more exports for supporting KDB modules v2 Mike Travis
2013-03-26  2:38   ` Eric W. Biederman
2013-03-26  4:19     ` Mike Travis
2013-03-25 18:50 ` [PATCH 06/15] KDB: consolidate KDB grep code Mike Travis
2013-03-25 18:50 ` [PATCH 07/15] KDB: clean up KDB grep code, add some options Mike Travis
2013-03-25 18:50 ` [PATCH 08/15] KDB: Restore call to kdump from KDB Mike Travis
2013-03-25 18:50 ` [PATCH 09/15] KDB: Add pshelp command Mike Travis
2013-03-25 18:50 ` [PATCH 10/15] KGDB/KDB: add support for external NMI handler to call KGDB/KDB Mike Travis
2013-03-25 18:50 ` [PATCH 11/15] KDB: add new system NMI entry code to KDB Mike Travis
2013-03-25 18:50 ` [PATCH 12/15] x86/UV: Move NMI support Mike Travis
2013-03-25 18:50 ` [PATCH 13/15] x86/UV: Add uvtrace support Mike Travis
2013-03-25 18:50 ` [PATCH 14/15] x86/UV: Update UV support for external NMI signals Mike Travis
2013-03-25 18:50 ` [PATCH 15/15] x86/UV: Add call to KGDB/KDB from NMI handler Mike Travis

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=20130325185007.634432020@gulag1.americas.sgi.com \
    --to=travis@sgi.com \
    --cc=akpm@linux-foundation.org \
    --cc=hpa@zytor.com \
    --cc=jason.wessel@windriver.com \
    --cc=kgdb-bugreport@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=tim.bird@am.sony.com \
    --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

all inboxes | Powered by JetHome®