lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi,

Currently `debug.getinfo(func, "L").activelines` is a set
of activelines of function `func`, that is, of lines
that can trigger debug hooks. However, activelines
of nested functions defined in `func` are not present in
this set.

Getting all lines that can trigger debug hooks
is useful for debuggers and coverage analysis.

There was another thread about this problem [1],
without a clear solution.
I wrote a module[2] that uses internal Lua and LuaJIT
definitions to solve it. It gets all activelines of
a function and its nested functions recursively, and works
for Lua 5.1 - 5.3.3 and LuaJIT 2.0.0 - LuaJIT 2.1.0-beta2.

While my module works, it's a bit of a hack. I'd like to propose
making it a feature of debug.getinfo. Given that the module works
with LuaJIT it's likely it'll reproduce the feature. There are now some
questions left:

1. Which letter should be passed to getinfo to get "deep" activelines? "A"? "D"?
2. Which key in the table returned by getinfo should correspond to
"deep" activelines?
3. Is this feature even worth being added to Lua?

Regards,

-- Peter

[1] http://lua-users.org/lists/lua-l/2015-02/msg00186.html
[2] https://github.com/mpeterv/deepactivelines