[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Interests in a breakpoint hook/breakpoint op patch?
- From: liam mail <liam.list@...>
- Date: Fri, 20 Apr 2012 16:03:48 +0100
On 20 April 2012 15:58, liam mail <liam.list@googlemail.com> wrote:
> On 20 April 2012 15:52, Thomas Jericke <tjericke@indel.ch> wrote:
>> 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
>>
>>
>
> There was such a patch last year sometime from the LightRoom team IIRC.
> What I would like is for Rio Lua is to either include such an operator
> or maybe simply not falling through the vm loop on an unknown
> instruction and instead calling the debug hook if one is present.
>
> Liam
http://article.gmane.org/gmane.comp.lang.lua.general/69271/match=breakpoint