Scott Lembcke wrote: > > In other words: use jit.off() or the C equivalent if you want to > > profile Lua code in the LuaJIT interpreter. > > Do I need to explicitly disable the JIT when setting a hook and > then reset it when I remove the hook? This is not sufficient. You need to turn it off at the start if you plan to receive reliable hook calls at any later point in time. > It would mildly nice if the presence of a hook automatically > suppressed the JIT, but whatever. This doesn't work if some piece of code has been compiled before you've set the hook. That code will not trigger any hook calls. I'm wary of introducing a change that only works 'sometimes'. As I've said before, the standard Lua debug functionality is not very well suited for a JIT compiler. It's in need of a complete redesign (real breakpoints, full VM profiling and so on). But that's a long-term plan. --Mike