Introduce the

void backtrace(void);
function which will print a backtrace if DDB is in the kernel and an
explanation if not.

This is useful for recording backtraces in non-fatal circumstances and
does not require pollution with DDB #includes in the files where it
is used.

It would of course be nice to have a non-DDB dependent version too,
but since the meat of a backtrace is MD it is probably not worth it.
This commit is contained in:
Poul-Henning Kamp 2003-01-04 20:54:58 +00:00
parent 646e95fe69
commit 3c3871e5e6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=108682
2 changed files with 15 additions and 0 deletions

View File

@ -438,6 +438,20 @@ shutdown_reset(void *junk, int howto)
/* NOTREACHED */ /* assuming reset worked */
}
/*
* Print a backtrace if we can.
*/
void
backtrace(void)
{
#ifdef DDB
db_print_backtrace();
#else
printf("Sorry, need DDB option to print backtrace");
#endif
}
#ifdef SMP
static u_int panic_cpu = NOCPU;
#endif

View File

@ -135,6 +135,7 @@ void panic(const char *, ...) __printflike(1, 2);
void panic(const char *, ...) __dead2 __printflike(1, 2);
#endif
void backtrace(void);
void cpu_boot(int);
void cpu_rootconf(void);
extern uint32_t crc32_tab[];