call luacov.runner.init directly and clean up dbg

develop
myk002 2021-02-27 21:55:17 -08:00
parent dc58d39c36
commit ba6a02eb59
No known key found for this signature in database
GPG Key ID: 8A39CA0FA0C16E78
2 changed files with 1 additions and 16 deletions

@ -1757,7 +1757,7 @@ lua_State *DFHack::Lua::Open(color_ostream &out, lua_State *state)
// reads config from .luacov or uses defaults if file doesn't exist.
// note that luacov overrides the debug hook installed by
// interrupt_init() above.
if (PushModulePublic(out, state, "luacov_helper", "init") &&
if (PushModulePublic(out, state, "luacov.runner", "init") &&
SafeCall(out, state, 0, 0))
{
out.print("Initialized luacov coverage monitoring\n");

@ -3,28 +3,13 @@
local runner = require('luacov.runner')
print('runner.debug_hook:', runner.debug_hook)
function init()
runner.init()
print('** initializing luacov')
print('** set debug hook to:', debug.gethook())
end
-- Called by LuaTools.cpp to set the debug hook for new threads. We could do
-- this in C++, but that's complicated and scary.
function with_luacov(f)
print('** wrapping function', f)
return function(...)
print('** setting debug hook')
print('** was:', debug.gethook())
debug.sethook(runner.debug_hook, "l")
print('** is now:', debug.gethook())
print('** running function:', f)
print('** params:', ...)
return f(...)
end
end
return _ENV