lua-users home
lua-l archive

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


Hi Joshua,

> Is there an example of hooking up the remote debugger into your own
> application?

You can start the debugger using require('mobdebug').start() or
require('mobdebug').loop() commands. When  you use start(), the
debugger will start debugging of the current script. When you use
loop(), the controller can push any lua script to the client to debug;
this is useful for those cases when you want to run in an environment
(mobile, embedded, etc.) where you want to be able to easily change
the scripts to work with. In this case you can also reload the script
during debugging (this is how live coding functionality is implemented
in ZeroBraneStudio). I have some detailed notes and examples in the
README (https://github.com/pkulchenko/MobDebug/blob/master/examples/README).

> Tilde uses a .vcproj file to describe a project folder hierarchy. That
> project folder hierarchy is used directly by the remote debugger to resolve
> the location of the file.  For instance, if the file on disk is

MobDebug does something similar, but a bit simpler. It doesn't have
filename mapping, but it provides "baseline" command that can be used
to point to the project folder.

> Tilde only supports debugging one master Lua state and all of its associated
> coroutines.  Does ZeroBrane Studio support debugging more than one master
> Lua state?

I think it depends on what you mean by "more than one master state".
It the question is about whether it can debug coroutines, then yes.
There is require('mobdebug').coro() method you can call in your code
to enable debugging for coroutines. You can then set breakpoints and
step through yield/resume calls.

If you mean debugging applications that use more than one lua state
(using multiple VM instances?), then you need to enable debugging for
each of those instances independently. You can then point them to two
different debug servers (using different port numbers in the start()
call); you probably won't be able to debug different VM states using
the same backend (at least not without changing the current backend).

The debugger is Lua only, so it can do everything you can do with
debug hook in Lua. It has been tested on various versions of Windows,
OSX, and Linux, but it should probably work anywhere as long as you
have Lua 5.1. It can probably work with 5.2 using David's compat_env
module [1], but I haven't tested it yet.

Paul.

[1] https://raw.github.com/davidm/lua-compat-env/master/lua/compat_env.lua

On Mon, Sep 10, 2012 at 8:23 AM, Joshua Jensen <josh.jjensen@gmail.com> wrote:
> ----- Original Message -----
> From: Paul K
> Date: 9/3/2012 7:47 PM
>>
>> ZeroBrane Studio is a lightweight Lua IDE with code completion, syntax
>> highlighting, live coding, remote debugger, code analyzer, and
>> hypertext/markdown formatting support for integrating learning
>> materials (examples and demos provided).
>
> Is there an example of hooking up the remote debugger into your own
> application?
>
> I currently use the Tilde Lua debugger, but I am interested in a
> multi-platform solution (Windows and OS X).  Hooking Tilde into my
> application is a matter of doing the following:
>
>     #include "tilde/LuaHostWindows.h"
>
>     tilde::LuaHostWindows* host = new tilde::LuaHostWindows();
>     host->RegisterState("State", globalL);
>     host->WaitForDebuggerConnection();  // Optional... call host->Poll() if
> you want to accept a connection at any time.
>
> Tilde uses a .vcproj file to describe a project folder hierarchy. That
> project folder hierarchy is used directly by the remote debugger to resolve
> the location of the file.  For instance, if the file on disk is
> c:\folderA\folderB\frontend.lua (obviously dependent on the host file
> system), the .vcproj may describe the folder hierarchy as
> UI/FrontEnd/frontend.lua.  The application sends across the string
> "ui/frontend/frontend.lua", and Tilde uses that to resolve the file to
> c:\folderA\folderB\frontend.lua.
>
> Tilde only supports debugging one master Lua state and all of its associated
> coroutines.  Does ZeroBrane Studio support debugging more than one master
> Lua state?
>
> Thanks!
>
> Josh
>
>
>