aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2013-08-10 20:40:45 +0100
committerMatthew Wild <mwild1@gmail.com>2013-08-10 20:40:45 +0100
commit8cb1b88d435aa8e4710c2544c00a58ebb87d757b (patch)
tree50c489292e34b1692cd604325df26f48efeea307
parent5fbfda38e7a981c616085bc7c8bec1de5fb74f57 (diff)
downloadprosody-8cb1b88d435aa8e4710c2544c00a58ebb87d757b.tar.gz
prosody-8cb1b88d435aa8e4710c2544c00a58ebb87d757b.zip
util.debug: Further fix to display locals in extended tracebacks
-rw-r--r--util/debug.lua10
1 files changed, 6 insertions, 4 deletions
diff --git a/util/debug.lua b/util/debug.lua
index 52ba52d0..417359f8 100644
--- a/util/debug.lua
+++ b/util/debug.lua
@@ -24,11 +24,13 @@ do
end
module("debugx", package.seeall);
-function get_locals_table(level)
- level = level + 1; -- Skip this function itself
+function get_locals_table(thread, level)
+ if not thread then
+ level = level + 1; -- Skip this function itself
+ end
local locals = {};
for local_num = 1, math.huge do
- local name, value = debug.getlocal(level, local_num);
+ local name, value = debug.getlocal(thread, level, local_num);
if not name then break; end
table.insert(locals, { name = name, value = value });
end
@@ -97,7 +99,7 @@ function get_traceback_table(thread, start_level)
levels[(level-start_level)+1] = {
level = level;
info = info;
- locals = not thread and get_locals_table(level+1);
+ locals = get_locals_table(thread, level+(thread and 0 or 1));
upvalues = get_upvalues_table(info.func);
};
end