[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: debug library
- From: Seppl Vorderhörer <Seppl.Vorderhoerer@...>
- Date: Sat, 22 Sep 2012 20:39:15 +0200
Well, probably I was not precise enough:
I would like to write/get/reuse a debugger for my program which uses Lua
embedded in the program.
What I do is the usual stuff: Linking a number of C functions to Lua,
then calling a (ore more) Lua script(s).
This works perfectly (I was really surprised how easily and good Lua can
be embedded and how powerful and fast it is, thank you for it by the
way, it's really great stuff).
What I lack is the ability to debug the Lua code - it got already way
more complex than I ever thought as I saw that the C part can be kept
small as many tasks can be done in Lua as well instead of having
specialised C code - so some sort of introspective and/or debugging
feature would come quite handy.
There is the debug interface, but from what I saw it allows me "only" to
monitor the execution of code. If the code is executed I can monitor
everything along the execution using the debug function.
What I would like to have/realize is something like a usual debug
interface where I can actually monitor the Lua execution from the "very
beginning" which would be at "program start" (which would be
luaL_loadfile in my case or any other of the load functions). The
logical approach to me would be to find out after the call to
luaL_loadfile which lua scripts have been loaded and to represent them
to the user in a debugger view so that she/he can place breakpoints,
even view the underlying bytecode etc.
As there are a number of debuggers available I guess this must be
possible. But my starting point was the official documentation and there
I found the debug API, gave it some thought and simply was not able to
find out how I can do what I want to do.
So my question is: Is it possible and I'm just thinking in the wrong
direction? Which of the projects realizing debug functions or which
source of documentation would be a good starting point?
I will definitely take a look at your bytecode inspector, thanks for that.
I understand, that there is no official documenation about the
underlying bytecode and the VM?! Or is there?
Am 22.09.2012 19:34, schrieb Luiz Henrique de Figueiredo:
I miss stuff like "get a list of all functions for a loaded chunk",
This does not make much sense because function definition is actually
an assignment.
maybe even "get insight into the compiled code in some way" etc.
You can try lbci, my bytecode inspector library:
http://www.tecgraf.puc-rio.br/~lhf/ftp/lua/#lbci
If there is interest, I can update it to support Lua 5.2.