luaa: dump backtrace on panic

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2009-11-09 12:44:19 +01:00
parent f219db48dc
commit 8966715b26
1 changed files with 6 additions and 1 deletions

7
luaa.c
View File

@ -43,6 +43,7 @@
#include "selection.h"
#include "common/xcursor.h"
#include "common/buffer.h"
#include "common/backtrace.h"
#ifdef WITH_DBUS
extern const struct luaL_reg awesome_dbus_lib[];
@ -656,8 +657,12 @@ luaA_awesome_emit_signal(lua_State *L)
static int
luaA_panic(lua_State *L)
{
warn("unprotected error in call to Lua API (%s), restarting awesome",
warn("unprotected error in call to Lua API (%s)",
lua_tostring(L, -1));
buffer_t buf;
backtrace_get(&buf);
warn("dumping backtrace\n%s", buf.s);
warn("restarting awesome");
awesome_restart();
return 0;
}