mirror of
https://github.com/bjc/prosody.git
synced 2025-04-05 06:07:37 +03:00
util.debug: Further fix to display locals in extended tracebacks
This commit is contained in:
parent
51549fe050
commit
6cd5b48d8f
1 changed files with 6 additions and 4 deletions
|
@ -24,11 +24,13 @@ do
|
||||||
end
|
end
|
||||||
module("debugx", package.seeall);
|
module("debugx", package.seeall);
|
||||||
|
|
||||||
function get_locals_table(level)
|
function get_locals_table(thread, level)
|
||||||
|
if not thread then
|
||||||
level = level + 1; -- Skip this function itself
|
level = level + 1; -- Skip this function itself
|
||||||
|
end
|
||||||
local locals = {};
|
local locals = {};
|
||||||
for local_num = 1, math.huge do
|
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
|
if not name then break; end
|
||||||
table.insert(locals, { name = name, value = value });
|
table.insert(locals, { name = name, value = value });
|
||||||
end
|
end
|
||||||
|
@ -97,7 +99,7 @@ function get_traceback_table(thread, start_level)
|
||||||
levels[(level-start_level)+1] = {
|
levels[(level-start_level)+1] = {
|
||||||
level = level;
|
level = level;
|
||||||
info = info;
|
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);
|
upvalues = get_upvalues_table(info.func);
|
||||||
};
|
};
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue