lua-users home
lua-l archive

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


On Fri, Sep 17, 2010 at 6:38 PM, Dan Tull <dtull@adobe.com> wrote:
> > We are using a modified Lua 5.1.2 at this point. If there is some
> > interest in the details, I could probably map them into a patch for the
> > changes based on a stock 5.1.4 version of Lua.

On September 20, 2010 5:49 AM, steve donovan [steve.j.donovan@gmail.com] wrote:
> Very interesting; it's done exactly how debuggers work with native code.
> I would definitely be interested in a patch against 5.1.4...

Sorry for the delay in responding. I made a home for the patch file here:
http://lua-users.org/files/wiki_insecure/power_patches/5.1/lua-halt-5.1.4.patch

I'm not sure what the default behavior is for licensing, but I got the ok to release 
this under the same open MIT license as Lua itself.

I did not yet add a section in the power patches Wiki page for it, but could go ahead
and add a short entry for it there.

Note that even when this patch is applied that removing the line added to luaconf.h 
that defines LUA_HALT_OP and it should switch the changes back off.

Unlike the get/set hook calls, the only API for providing a specific function to call in
the event of a halt is native. There's currently no wrapper for invoking an arbitrary
closure passed from Lua code, though it's easy to imagine ways of enabling that kind 
of capability.

In our usage, our internal debugger code calls the native routines to pass a pointer
to one of its own routines for blocking the caller. It also uses another (very simple)
change to expose a hook used to maintain a list of all the "live" Proto instances in
a given Lua state so they can be located by source and line numbers (even if there
is currently no closure for that Proto) in order to make breakpoints in functions even
without a prior reference to the function where the breakpoint is to be set.

DT