linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Anton Blanchard <anton@samba.org>
To: benh@kernel.crashing.org, paulus@samba.org
Cc: linuxppc-dev@lists.ozlabs.org
Subject: [PATCH] powerpc: Print instruction when logging unhandled exceptions
Date: Fri, 7 Jun 2013 15:42:54 +1000	[thread overview]
Message-ID: <20130607154254.4b001093@kryten> (raw)


It is often useful to see the instruction that caused an unhandled
exception.

Signed-off-by: Anton Blanchard <anton@samba.org>
---

We print all ones if the get_user fails, do we want to go to
the added effort of printing XXXXXXXX like we do in the oops
code?

Index: b/arch/powerpc/kernel/traps.c
===================================================================
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -242,9 +242,9 @@ void _exception(int signr, struct pt_reg
 {
 	siginfo_t info;
 	const char fmt32[] = KERN_INFO "%s[%d]: unhandled signal %d " \
-			"at %08lx nip %08lx lr %08lx code %x\n";
+			"at %08lx nip %08lx lr %08lx code %x insn %08x\n";
 	const char fmt64[] = KERN_INFO "%s[%d]: unhandled signal %d " \
-			"at %016lx nip %016lx lr %016lx code %x\n";
+			"at %016lx nip %016lx lr %016lx code %x insn %08x\n";
 
 	if (!user_mode(regs)) {
 		die("Exception in kernel mode", regs, signr);
@@ -252,9 +252,14 @@ void _exception(int signr, struct pt_reg
 	}
 
 	if (show_unhandled_signals && unhandled_signal(current, signr)) {
+		u32 insn;
+
+		if (get_user(insn, (u32 __user *)(regs->nip)))
+			insn = 0xffffffff;
+
 		printk_ratelimited(regs->msr & MSR_64BIT ? fmt64 : fmt32,
 				   current->comm, current->pid, signr,
-				   addr, regs->nip, regs->link, code);
+				   addr, regs->nip, regs->link, code, insn);
 	}
 
 	if (arch_irqs_disabled() && !arch_irq_disabled_regs(regs))

             reply	other threads:[~2013-06-07  5:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-07  5:42 Anton Blanchard [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-09-25  5:05 [PATCH] powerpc: Print instruction when logging unhandled exceptions Anton Blanchard

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=20130607154254.4b001093@kryten \
    --to=anton@samba.org \
    --cc=benh@kernel.crashing.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=paulus@samba.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;
as well as URLs for NNTP newsgroup(s).