From: Ben Gras Date: Tue, 7 May 2013 12:36:59 +0000 (+0000) Subject: libsys: panic hook feature X-Git-Tag: v3.3.0~994 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zlib_tech.html?a=commitdiff_plain;h=refs%2Fchanges%2F39%2F539%2F2;p=minix.git libsys: panic hook feature . vfs: use it to dump threads stacks Change-Id: I7ae3521fc153a407505f11049629e6d4142cf7c7 --- diff --git a/lib/libsys/panic.c b/lib/libsys/panic.c index 79c47bce2..630a17643 100644 --- a/lib/libsys/panic.c +++ b/lib/libsys/panic.c @@ -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); diff --git a/servers/vfs/misc.c b/servers/vfs/misc.c index 754bdb0ef..44d9d53b7 100644 --- a/servers/vfs/misc.c +++ b/servers/vfs/misc.c @@ -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(); +}