diff options
author | Lauri Leukkunen <lle@rahina.org> | 2007-12-12 01:12:20 +0200 |
---|---|---|
committer | Lauri Leukkunen <lle@rahina.org> | 2007-12-12 01:12:20 +0200 |
commit | eccd41bf4f27cd35f90df6eb2aca4eceb948dd73 (patch) | |
tree | bd48e4f7331a90503201c565552ad69eecc93bca /luaif | |
parent | c828cfd67a476766d7853e3236f74240a43fd208 (diff) |
Add backtrace() using debug output, not compiled in by default
Very handy for totally understanding wtf is going on.
Signed-off-by: Lauri Leukkunen <lle@rahina.org>
Diffstat (limited to 'luaif')
-rw-r--r-- | luaif/paths.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/luaif/paths.c b/luaif/paths.c index bd16b79..8421c73 100644 --- a/luaif/paths.c +++ b/luaif/paths.c @@ -36,6 +36,10 @@ #include <mapping.h> #include <sb2.h> +#ifdef EXTREME_DEBUGGING +#include <execinfo.h> +#endif + extern int lua_engine_state; struct path_entry { @@ -171,6 +175,18 @@ char *scratchbox_path2(const char *binary_name, char pidlink[17]; /* /proc/2^8/exe */ struct lua_instance *luaif; +#ifdef EXTREME_DEBUGGING + #define SIZE 100 + void *buffer[SIZE]; + char **strings; + int i, nptrs; + + nptrs = backtrace(buffer, SIZE); + strings = backtrace_symbols(buffer, nptrs); + for (i = 0; i < nptrs; i++) + SB_LOG(SB_LOGLEVEL_DEBUG, "%s\n", strings[i]); +#endif + switch (lua_engine_state) { case LES_NOT_INITIALIZED: sb2_lua_init(); |