Skip to content

Commit 1a1e317

Browse files
committed
attempt to run dbg when entery a given function
1 parent e8c95bd commit 1a1e317

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/madl_dbg.lua

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ end
497497
dbg = setmetatable({}, {
498498
__call = function(_, condition, top_offset, source)
499499
if condition then return end
500-
500+
501501
top_offset = (top_offset or 0)
502502
stack_inspect_offset = top_offset
503503
stack_top = top_offset
@@ -675,6 +675,20 @@ else
675675
dbg_writeln("Please send me feedback!")
676676
end
677677

678+
-- mad extension (doesn't work with dbg) ---------------------------------------
679+
680+
local function dbgfun (fun, typ_)
681+
local function hook (event)
682+
local info = debug.getinfo(2,'n')
683+
if info.name == fun then
684+
io.write("dbgfun-", event, ": ", info.name, "\n")
685+
return debug.debug()
686+
-- return dbg()
687+
end
688+
end
689+
debug.sethook(hook, typ_ or "call")
690+
end
691+
678692
-- end -------------------------------------------------------------------------
679693
return { dbg = dbg } -- MAD: replace debugger.lua by dbg
680694

0 commit comments

Comments
 (0)