lua-users home
lua-l archive

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

I think I have found a bug in the debugging interface to Lua.  I'm writing
an embedded debugger and am having troubles getting everything to work as
the documents say they should.

Section 7.3 of the reference manual says:

"This ar can then be used in calls to lua_getinfo, lua_getlocal, and
lua_setlocal to get more information about the function and to manipulate
its local variables."


"Again, you can use this ar in other calls to the debug API." 

In the call/return hook, this activation record appears to be usable.
Calling lua_getstack within the call hook returns a similar stucture
(event isn't the same).  In the line hook, however, the ar is NOT the same
as what is returned by lua_getstack.  The _func value is consistently off
by 8 (16 if I use doubles instead of floats for the LUA_NUM_TYPE).
Calling lua_getlocal does not return any local variables.

If I call lua_getstack first (which is my work-around for now) then
everything works how I expect.  My debugger can list the local variables,
call stack, function info, etc...  The documents clearly state that I
don't have to do that though.