Add dump_stack function
At least ARM allows us to dump the stack, but we currently have no prototype for this. Add a dump_stack prototype and provide a static inline function for architectures without stack dump support. Also, call dump_stack() in panic() to provide more information in the case of a panic. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
641dfaa3a8
commit
79c2f03aee
|
@ -73,6 +73,11 @@ void show_regs (struct pt_regs *regs)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void dump_stack(void)
|
||||||
|
{
|
||||||
|
unwind_backtrace(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
static void __noreturn do_exception(struct pt_regs *pt_regs)
|
static void __noreturn do_exception(struct pt_regs *pt_regs)
|
||||||
{
|
{
|
||||||
show_regs(pt_regs);
|
show_regs(pt_regs);
|
||||||
|
|
|
@ -1,41 +1,8 @@
|
||||||
/*
|
|
||||||
* (C) Copyright 2002
|
|
||||||
* Sysgo Real-Time Solutions, GmbH <www.elinos.com>
|
|
||||||
* Marius Groeger <mgroeger@sysgo.de>
|
|
||||||
*
|
|
||||||
* (C) Copyright 2002
|
|
||||||
* Sysgo Real-Time Solutions, GmbH <www.elinos.com>
|
|
||||||
* Alex Zuepke <azu@sysgo.de>
|
|
||||||
*
|
|
||||||
* See file CREDITS for list of people who contributed to this
|
|
||||||
* project.
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License as
|
|
||||||
* published by the Free Software Foundation; either version 2 of
|
|
||||||
* the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
||||||
* MA 02111-1307 USA
|
|
||||||
*
|
|
||||||
********************************************************************
|
|
||||||
* NOTE: This header file defines an interface to barebox. Including
|
|
||||||
* this (unmodified) header file in another file is considered normal
|
|
||||||
* use of barebox, and does *not* fall under the heading of "derived
|
|
||||||
* work".
|
|
||||||
********************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _BAREBOX_H_
|
#ifndef _BAREBOX_H_
|
||||||
#define _BAREBOX_H_ 1
|
#define _BAREBOX_H_ 1
|
||||||
|
|
||||||
//typedef struct bd_info {} bd_t;
|
#ifdef CONFIG_ARM_UNWIND
|
||||||
|
#define ARCH_HAS_STACK_DUMP
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* _BAREBOX_H_ */
|
#endif /* _BAREBOX_H_ */
|
||||||
|
|
|
@ -119,6 +119,15 @@ uint32_t crc32_no_comp(uint32_t, const void*, unsigned int);
|
||||||
/* common/console.c */
|
/* common/console.c */
|
||||||
int ctrlc (void);
|
int ctrlc (void);
|
||||||
|
|
||||||
|
#ifdef ARCH_HAS_STACK_DUMP
|
||||||
|
void dump_stack(void);
|
||||||
|
#else
|
||||||
|
static inline void dump_stack(void)
|
||||||
|
{
|
||||||
|
printf("no stack data available\n");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#define MEMAREA_SIZE_SPECIFIED 1
|
#define MEMAREA_SIZE_SPECIFIED 1
|
||||||
|
|
||||||
struct memarea_info {
|
struct memarea_info {
|
||||||
|
|
|
@ -625,6 +625,8 @@ void __noreturn panic(const char *fmt, ...)
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
|
dump_stack();
|
||||||
|
|
||||||
led_trigger(LED_TRIGGER_PANIC, TRIGGER_ENABLE);
|
led_trigger(LED_TRIGGER_PANIC, TRIGGER_ENABLE);
|
||||||
|
|
||||||
#if defined (CONFIG_PANIC_HANG)
|
#if defined (CONFIG_PANIC_HANG)
|
||||||
|
|
Loading…
Reference in New Issue