lua-users home
lua-l archive

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

On Fri, Oct 18, 2019 at 12:29 PM Russell Haley <> wrote:

On Wed, May 30, 2018 at 1:28 PM Dan Tull <> wrote:
> > So the answer I picked _was_ to do more of it in Lua and OP_HALT was what made that viable...
> Interesting.  Though I'll admit, I'm having a hard time reading between the lines here to figure out
> just what you did to implement this "manual instrumentation" method. 
The breakpoints we set (via OP_HALT) call into our debugging mechanism when hit, but they can have a Lua callback associated with them which determines whether to stop (to support conditional breakpoints) and can run arbitrary code (to log, take measurements, etc). We already had debugger UI for configuring these kinds of breakpoints, so I just used that instead of defining a new low level breakpoint type.

The truly manual way to do this is basically "printf profiling" where actual code is inserted. Using code/conditional/logging breakpoints also it to be done more dynamically, but still provides full manual control over the nature of the instrumentation.

> In my own (far less sophisticated) experiments with instrumentation, I've quickly come to similar
> high-level conclusion.  What one seems to need are multiple, complimentary tools ...
> ...both techniques have their drawbacks, but, they're also synergistic.
Yeah, definitely sounds like we arrived at a similar perspective.

> Thanks again for your replies Dan, it's been fascinating to learn a bit about how these issues played out in the context of a bigger project.
Sure thing. Happy to share.


I would like to test the OP_HALT patch on Lua 5.3.5 and attempt to port it over to 5.4.  Has there been any more updates to the OP_HALT patches above? I had a quick search on the interweb and found a github repo that seems to have *some* of the patches but not all of them:


For the curious, DevCat has their VS Code debugger on the Visual Studio Market Place: They have the OP_HALT patch listed on this site.

I applied the patch to 5.3.5 without issue, but 5.4 was a mess.