[PATCH -mm] i386: print EIP/ESP last

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Randy Dunlap <[email protected]>

Print summary registers (EIP and SS:ESP only) as last death info.
This makes this important data visible in case it had scrolled
off the top of the display.
Similar to what x86_64 does.  Suggested by Andi Kleen.

Signed-off-by: Randy Dunlap <[email protected]>
---
 arch/i386/kernel/traps.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletion(-)

--- linux-2616-mm2.orig/arch/i386/kernel/traps.c
+++ linux-2616-mm2/arch/i386/kernel/traps.c
@@ -398,6 +398,9 @@ void die(const char * str, struct pt_reg
 
 	if (++die.lock_owner_depth < 3) {
 		int nl = 0;
+		unsigned long esp;
+		unsigned short ss;
+
 		handle_BUG(regs);
 		printk(KERN_EMERG "%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter);
 #ifdef CONFIG_PREEMPT
@@ -430,8 +433,19 @@ void die(const char * str, struct pt_reg
 	 	check_remote_debug(0,SIGTRAP,err,regs,)
 		if (notify_die(DIE_OOPS, str, regs, err,
 					current->thread.trap_no, SIGSEGV) !=
-				NOTIFY_STOP)
+				NOTIFY_STOP) {
 			show_registers(regs);
+			/* Executive summary in case the oops scrolled away */
+			esp = (unsigned long) (&regs->esp);
+			savesegment(ss, ss);
+			if (user_mode(regs)) {
+				esp = regs->esp;
+				ss = regs->xss & 0xffff;
+			}
+			printk(KERN_EMERG "EIP: [<%08lx>] ", addr);
+			print_symbol("%s", addr);
+			printk(" SS:ESP %04x:%08lx\n", ss, esp);
+		}
 		else
 			regs = NULL;
   	} else


---
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux