libsys: panic hook feature

. vfs: use it to dump threads stacks

Change-Id: I7ae3521fc153a407505f11049629e6d4142cf7c7
This commit is contained in:
Ben Gras 2013-05-07 12:36:59 +00:00
parent 80846c4a79
commit 4ebb889e7a
2 changed files with 18 additions and 0 deletions

View file

@ -6,6 +6,15 @@
#include "syslib.h"
void panic_hook(void);
__weak_alias(panic_hook, __panic_hook);
void __panic_hook(void)
{
;
}
/*===========================================================================*
* panic *
*===========================================================================*/
@ -38,6 +47,8 @@ void panic(const char *fmt, ...)
printf("syslib:panic.c: stacktrace: ");
util_stacktrace();
panic_hook();
/* Try exit */
_exit(1);

View file

@ -761,3 +761,10 @@ ds_event(void *arg)
thread_cleanup(NULL);
return(NULL);
}
/* A function to be called on panic(). */
void panic_hook(void)
{
printf("VFS mthread stacktraces:\n");
mthread_stacktraces();
}