-
My idea was to have singlestep = false as default, and when suspending on a breakpoint, if the user of the debugger then chooses to step I will call lua_singlestep(true) before continuing execution. But this does not seem to come into effect immediately, its only after a bunch of instructions that the step hook will be called. If I run with singlestep = true all the time, the hook will be called for the line right after the breakpoint. I suspect the singlestep value is cached for a run of vm, and only refreshed at some point. This might be due to how I suspend the lua execution -- the way I did it in the lua-5.1/luajit days I just infinite loop with a thread sleep to halt lua execution. And this works fine except for this single step issue. So right now upon breaking the suspend loop I set lua_singlestep(true) if the user wants to step. But maybe there is a better way? I tried lua_break and lua_yield to suspend execution without knowing what I'm doing, but these complained about crossing c-boundary. Or maybe I simply need to run singlestep = true all the time? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
You definitely shouldn't run with singlestep=true all the time if performance is important. The way our debugger does this is that a breakpoint suspension yields the thread (via |
Beta Was this translation helpful? Give feedback.
You definitely shouldn't run with singlestep=true all the time if performance is important. The way our debugger does this is that a breakpoint suspension yields the thread (via
lua_break
), and sets it to single-step before resuming when the user decides to step. We disable single step when the user resumes execution (instead of using step in/out).