-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hi list,

recently I found my "unprotected error"-crash bug which I debugged via adding a
backtrace output to luaA_panic(). Today I noticed that I had this stuff still
laying around and thought that I could submit it. :)

Cheers,
Uli
- --
"Do you know that books smell like nutmeg or some spice from a foreign land?"
                                                  -- Faber in Fahrenheit 451
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iQEcBAEBCAAGBQJK/tuvAAoJECLkKOvLj8sGET8H/2n/CTyrjR8YoebskEazndCd
x9fpdbcJvlsZWsEexX19Ec6fCiIMih6v9LdDZhfVIclttVzkzPm9fMLInnaSNwmv
cprKb0UWLOeTt18fpQWSk4AmBbp9M+rMgvmzWyAFRC72PqmCp2oDLuwQwWmSfAUg
88AjdpqGnBOSHc4H+13FIgcNJ0LKavjrJ8B4kFmB7NIZvj6S3v1IODjEmfQoR62o
Nen6Z5bemEbSqmi7ukqdMgpHcYG/3WILQVvxuhnJ9kq1nMtrE6pt4baE6kL8SqcE
2QQNRcCEZjj/Hq3wbbIu4514RSxzVYJLJTYUGQhQsON3E1KKrYaDQncua2eaCjo=
=ShXK
-----END PGP SIGNATURE-----
>From 83f694bc549eed546342d55f88d359f81ca2f511 Mon Sep 17 00:00:00 2001
From: Uli Schlachter <[email protected]>
Date: Sat, 14 Nov 2009 17:18:39 +0100
Subject: [PATCH] luaA_panic(): Print a backtrace

This should simplify debugging bugs with unprotected lua errors.

Signed-off-by: Uli Schlachter <[email protected]>
---
 luaa.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/luaa.c b/luaa.c
index 7c0f9c1..8e4a7ae 100644
--- a/luaa.c
+++ b/luaa.c
@@ -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,11 @@ luaA_awesome_emit_signal(lua_State *L)
 static int
 luaA_panic(lua_State *L)
 {
+    buffer_t buf;
     warn("unprotected error in call to Lua API (%s), restarting awesome",
          lua_tostring(L, -1));
+    backtrace_get(&buf);
+    warn("backtrace:\n%s", buf.s);
     awesome_restart();
     return 0;
 }
-- 
1.6.5

Reply via email to