lua-users home
lua-l archive

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



> -----Original Message-----
> From: Nick Trout [mailto:Nick.Trout@warthog.co.uk]
> Sent: jeudi 11 juillet 2002 12:21
> To: Multiple recipients of list
> Subject: RE: LUA debugger and conditional breakpoints
> 
> 
> 
> 
> > My implementation of breakpoints is as follows: a table in 
> > the registry
> > contains strings of lua code of the form "return exp" indexed by the
> 
> Nice idea.

Well, ldb's implemetation might be smarter, because the lua code is compiled
only once at breakpoint creation and generates a function bytecode that can
be ref'ed and used when testing the condition. But this will do for now :-)

> The manual says that you get can local variables using the 
> debug library:
> 
> .../...
>
> or through the debug interface:
> 
> .../...

I suspect that getting this information compares efficency-wise to ldb's
(and titmouse's, and probably others too) method (and is more complex to
implement):
take all locals, if they mask a global, store the global somewhere, and make
the global take the local's value. If the local does not mask any global,
create a global, but remember it's name so that you can destroy it when you
are done.
Then evaluate your expression (all references will be globals then, so there
is no context solving problem).
Then restore overwritten globals, and destroy those that did not exist
beforehand.
After all, I do this only when a breakpoint is to be tested, and I can
probably have a property of my breakpoint that says if this whole thing is
necessary or not: unconditional breakpoints don't need this (well, they
don't even need an actual return statement :-)


> Regards,
> Nick
> 
> 
> 
> 
> 
> 
>