[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Interests in a breakpoint hook/breakpoint op patch?
- From: Thomas Jericke <tjericke@...>
- Date: Fri, 20 Apr 2012 16:52:41 +0200
For our project I have modified the Lua interpreter to support a new
hook type (breakpoint hook) which is called every time the interpreter
hits a breakpoint op.
I could turn my modifications into a patch but I still need some work to
do to have a general solution. My current solution is very adapted to my
own needs. And as it is, the implementation should be improved as well.
Basically I added another type of hooks that can be used with
lua_sethook. Additionally I added a function to add a breakpoint at a
source and linenumber. This function searches for the proto of the
according source code and linenumber and then replaces the op_code at
the first bytecode to op_breakpoint. Once the pc runs to such a
op_breakpoint the hook is called (if it is installed) after the hook
returns, the original op is executed.
The reason for this patch is performance only. We tried the current Lua
debuggers which use the line hook and it wasn't performing fast enough
to use it with our system. With the breakpoint hook the impact on the
runtime is close to zero as long as you don't hit a breakpoint. There is
a quite big overhead when you install a breakpoint but this is not such
a big problem as usually the user doesn't change his breakpoints all the
time.
Now as I said, I would need to do some work before I can release such a
patch, so I would only do that if someone is actually interested in
using it.
--
Thomas