mirror of
https://github.com/torvalds/linux.git
synced 2024-09-22 16:03:15 +00:00
CRIS: Use KALLSYMs if available in call stack dump
Also, print kernel version on oops. Signed-off-by: Jesper Nilsson <jesper.nilsson@axis.com>
This commit is contained in:
parent
ca36c1fadd
commit
421d085252
|
@ -14,6 +14,10 @@
|
||||||
|
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
|
#include <linux/utsname.h>
|
||||||
|
#ifdef CONFIG_KALLSYMS
|
||||||
|
#include <linux/kallsyms.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <asm/pgtable.h>
|
#include <asm/pgtable.h>
|
||||||
#include <asm/uaccess.h>
|
#include <asm/uaccess.h>
|
||||||
|
@ -34,25 +38,24 @@ static int kstack_depth_to_print = 24;
|
||||||
|
|
||||||
void (*nmi_handler)(struct pt_regs *);
|
void (*nmi_handler)(struct pt_regs *);
|
||||||
|
|
||||||
void
|
void show_trace(unsigned long *stack)
|
||||||
show_trace(unsigned long *stack)
|
|
||||||
{
|
{
|
||||||
unsigned long addr, module_start, module_end;
|
unsigned long addr, module_start, module_end;
|
||||||
extern char _stext, _etext;
|
extern char _stext, _etext;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
printk("\nCall Trace: ");
|
pr_err("\nCall Trace: ");
|
||||||
|
|
||||||
i = 1;
|
i = 1;
|
||||||
module_start = VMALLOC_START;
|
module_start = VMALLOC_START;
|
||||||
module_end = VMALLOC_END;
|
module_end = VMALLOC_END;
|
||||||
|
|
||||||
while (((long)stack & (THREAD_SIZE-1)) != 0) {
|
while (((long)stack & (THREAD_SIZE - 1)) != 0) {
|
||||||
if (__get_user(addr, stack)) {
|
if (__get_user(addr, stack)) {
|
||||||
/* This message matches "failing address" marked
|
/* This message matches "failing address" marked
|
||||||
s390 in ksymoops, so lines containing it will
|
s390 in ksymoops, so lines containing it will
|
||||||
not be filtered out by ksymoops. */
|
not be filtered out by ksymoops. */
|
||||||
printk("Failing address 0x%lx\n", (unsigned long)stack);
|
pr_err("Failing address 0x%lx\n", (unsigned long)stack);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
stack++;
|
stack++;
|
||||||
|
@ -68,10 +71,14 @@ show_trace(unsigned long *stack)
|
||||||
if (((addr >= (unsigned long)&_stext) &&
|
if (((addr >= (unsigned long)&_stext) &&
|
||||||
(addr <= (unsigned long)&_etext)) ||
|
(addr <= (unsigned long)&_etext)) ||
|
||||||
((addr >= module_start) && (addr <= module_end))) {
|
((addr >= module_start) && (addr <= module_end))) {
|
||||||
|
#ifdef CONFIG_KALLSYMS
|
||||||
|
print_ip_sym(addr);
|
||||||
|
#else
|
||||||
if (i && ((i % 8) == 0))
|
if (i && ((i % 8) == 0))
|
||||||
printk("\n ");
|
pr_err("\n ");
|
||||||
printk("[<%08lx>] ", addr);
|
pr_err("[<%08lx>] ", addr);
|
||||||
i++;
|
i++;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -111,21 +118,21 @@ show_stack(struct task_struct *task, unsigned long *sp)
|
||||||
|
|
||||||
stack = sp;
|
stack = sp;
|
||||||
|
|
||||||
printk("\nStack from %08lx:\n ", (unsigned long)stack);
|
pr_err("\nStack from %08lx:\n ", (unsigned long)stack);
|
||||||
for (i = 0; i < kstack_depth_to_print; i++) {
|
for (i = 0; i < kstack_depth_to_print; i++) {
|
||||||
if (((long)stack & (THREAD_SIZE-1)) == 0)
|
if (((long)stack & (THREAD_SIZE-1)) == 0)
|
||||||
break;
|
break;
|
||||||
if (i && ((i % 8) == 0))
|
if (i && ((i % 8) == 0))
|
||||||
printk("\n ");
|
pr_err("\n ");
|
||||||
if (__get_user(addr, stack)) {
|
if (__get_user(addr, stack)) {
|
||||||
/* This message matches "failing address" marked
|
/* This message matches "failing address" marked
|
||||||
s390 in ksymoops, so lines containing it will
|
s390 in ksymoops, so lines containing it will
|
||||||
not be filtered out by ksymoops. */
|
not be filtered out by ksymoops. */
|
||||||
printk("Failing address 0x%lx\n", (unsigned long)stack);
|
pr_err("Failing address 0x%lx\n", (unsigned long)stack);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
stack++;
|
stack++;
|
||||||
printk("%08lx ", addr);
|
pr_err("%08lx ", addr);
|
||||||
}
|
}
|
||||||
show_trace(sp);
|
show_trace(sp);
|
||||||
}
|
}
|
||||||
|
@ -139,33 +146,32 @@ show_stack(void)
|
||||||
unsigned long *sp = (unsigned long *)rdusp();
|
unsigned long *sp = (unsigned long *)rdusp();
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
printk("Stack dump [0x%08lx]:\n", (unsigned long)sp);
|
pr_err("Stack dump [0x%08lx]:\n", (unsigned long)sp);
|
||||||
for (i = 0; i < 16; i++)
|
for (i = 0; i < 16; i++)
|
||||||
printk("sp + %d: 0x%08lx\n", i*4, sp[i]);
|
pr_err("sp + %d: 0x%08lx\n", i*4, sp[i]);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void
|
void set_nmi_handler(void (*handler)(struct pt_regs *))
|
||||||
set_nmi_handler(void (*handler)(struct pt_regs *))
|
|
||||||
{
|
{
|
||||||
nmi_handler = handler;
|
nmi_handler = handler;
|
||||||
arch_enable_nmi();
|
arch_enable_nmi();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG_NMI_OOPS
|
#ifdef CONFIG_DEBUG_NMI_OOPS
|
||||||
void
|
void oops_nmi_handler(struct pt_regs *regs)
|
||||||
oops_nmi_handler(struct pt_regs *regs)
|
|
||||||
{
|
{
|
||||||
stop_watchdog();
|
stop_watchdog();
|
||||||
oops_in_progress = 1;
|
oops_in_progress = 1;
|
||||||
printk("NMI!\n");
|
pr_err("NMI!\n");
|
||||||
show_registers(regs);
|
show_registers(regs);
|
||||||
oops_in_progress = 0;
|
oops_in_progress = 0;
|
||||||
|
oops_exit();
|
||||||
|
pr_err("\n"); /* Flush mtdoops. */
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __init
|
static int __init oops_nmi_register(void)
|
||||||
oops_nmi_register(void)
|
|
||||||
{
|
{
|
||||||
set_nmi_handler(oops_nmi_handler);
|
set_nmi_handler(oops_nmi_handler);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -180,8 +186,7 @@ __initcall(oops_nmi_register);
|
||||||
* similar to an Oops dump, and if the kernel is configured to be a nice
|
* similar to an Oops dump, and if the kernel is configured to be a nice
|
||||||
* doggy, then halt instead of reboot.
|
* doggy, then halt instead of reboot.
|
||||||
*/
|
*/
|
||||||
void
|
void watchdog_bite_hook(struct pt_regs *regs)
|
||||||
watchdog_bite_hook(struct pt_regs *regs)
|
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_ETRAX_WATCHDOG_NICE_DOGGY
|
#ifdef CONFIG_ETRAX_WATCHDOG_NICE_DOGGY
|
||||||
local_irq_disable();
|
local_irq_disable();
|
||||||
|
@ -196,8 +201,7 @@ watchdog_bite_hook(struct pt_regs *regs)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is normally the Oops function. */
|
/* This is normally the Oops function. */
|
||||||
void
|
void die_if_kernel(const char *str, struct pt_regs *regs, long err)
|
||||||
die_if_kernel(const char *str, struct pt_regs *regs, long err)
|
|
||||||
{
|
{
|
||||||
if (user_mode(regs))
|
if (user_mode(regs))
|
||||||
return;
|
return;
|
||||||
|
@ -211,13 +215,17 @@ die_if_kernel(const char *str, struct pt_regs *regs, long err)
|
||||||
stop_watchdog();
|
stop_watchdog();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
oops_enter();
|
||||||
handle_BUG(regs);
|
handle_BUG(regs);
|
||||||
|
|
||||||
printk("%s: %04lx\n", str, err & 0xffff);
|
pr_err("Linux %s %s\n", utsname()->release, utsname()->version);
|
||||||
|
pr_err("%s: %04lx\n", str, err & 0xffff);
|
||||||
|
|
||||||
show_registers(regs);
|
show_registers(regs);
|
||||||
|
|
||||||
|
oops_exit();
|
||||||
oops_in_progress = 0;
|
oops_in_progress = 0;
|
||||||
|
pr_err("\n"); /* Flush mtdoops. */
|
||||||
|
|
||||||
#ifdef CONFIG_ETRAX_WATCHDOG_NICE_DOGGY
|
#ifdef CONFIG_ETRAX_WATCHDOG_NICE_DOGGY
|
||||||
reset_watchdog();
|
reset_watchdog();
|
||||||
|
@ -225,8 +233,7 @@ die_if_kernel(const char *str, struct pt_regs *regs, long err)
|
||||||
do_exit(SIGSEGV);
|
do_exit(SIGSEGV);
|
||||||
}
|
}
|
||||||
|
|
||||||
void __init
|
void __init trap_init(void)
|
||||||
trap_init(void)
|
|
||||||
{
|
{
|
||||||
/* Nothing needs to be done */
|
/* Nothing needs to be done */
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user