lua-users home
lua-l archive

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

Hey everyone,

I've had a bunch of situations where it was useful to get the current
instruction number (not just the current line number) from debug.getinfo
/ lua_getinfo. (More fine-grained instruction-level profiling,
single-stepping when debugging, visualizing what Lua does, stuff like that.)

While this is easy to add on your own, it changes the ABI by introducing
an extra field in the lua_Debug struct – which means (if you also keep
the vanilla version around) you'll have to keep a separate set of
headers, library, interpreter (and potentially a separate library
directory & environment variables, in case you have to re-compile some C

I'd therefore like to ask:

(1) Is there anyone else who'd find that useful / is already patching
their local Lua to add that?

(2) and if so, could this be added to Lua itself?  It's a pretty small

 *  add `int currentpc` to `lua_Debug`
 *  let `lua_getinfo` set that on option "l" as well (or add e.g. "i")
    (currentpc is already used internally for determining currentline,
    it would only have to store it now)
 *  make `db_getinfo`/`debug.getinfo` aware of the new field

…and it would make debugging / profiling a little bit nicer.

Thoughts / opinions?

Kind regards & happy Festivus!
-- nobody