Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
Can't get zerobrane debugger to work — Gideros Forum

Can't get zerobrane debugger to work

CitizenKCitizenK Member
edited January 2014 in General questions
I'm new to Gideros and trying to get started with zerobrane, but I can't get the debugger to work.

Running my code without the line "require('mobdebug').start()" works fine, local as well as remote. But adding this line will result in just nothing happening in the simulator at all. I don't get any error message either.

After running with mobdebug enabled, I have to kill the gdrdeamon process in the task manager or it won't work without mobdebug either anymore.

Sometimes it seems to work locally with mobdebug enabled, even though I have no idea why, but "Start Debugging" won't start any debugger in this case either, it just runs the project like a normal "Run". Remotely I try to use "require('mobdebug').start('192.168.5.110)" (which is my local PCs IP) but this never works. Without the mobdebug line running remote on the device works.

The path is set to:
LUA_CPATH=D:\Program Files\ZeroBrane\bin/?.dll;D:\Program Files\ZeroBrane\bin/clibs/?.dll
LUA_PATH=D:\Program Files\ZeroBrane\lualibs/?/?.lua;D:\Program Files\ZeroBrane\lualibs/?.lua

Any help would be greatly appreciated.

Likes: wbowling

+1 -1 (+1 / -0 )Share on Facebook

Comments

  • @CitizenK, what you are describing should work. Please make sure that Gideros Studio is closed when you run debugging from ZBS as they may conflict for gdrbridge process.

    You don't need to set LUA_CPATH and LUA_PATH as ZeroBrane Studio does this for you when you run Gideros projects from ZBS.

    Make sure that you set the project directory to the folder with .gproj file for your project. You may try on a simple example that comes with ZBS (myprograms/gideros-samples/live-coding-simple/).

    If you still can't get it to work, please post the messages you get in the Output window for ZeroBrane Studio when you start debugging.

    I suggest you try on-device debugging when you get the local debugging working. This @bowerandy's post may be helpful: http://www.giderosmobile.com/forum/discussion/comment/20903#Comment_20903

    Paul.
  • Seems it works locally now (was probably caused by the remote testing). But I still can't get the debugger to work with a remote device.

    I tried a very simple example:

    192.168.5.110 is my local PC (named "i7")
    192.168.5.220 is a remote Moto G (Android), connected by Wifi to an Access Point (192.168.5.200) inside of the local network

    I entered

    ide.config.gideros = {remote ="192.168.5.220"}

    into the local console of ZeroBrane.

    main.lua of a simple project is:

    require("mobdebug").start('192.168.5.110')
    print "Test Start"
    local textfield = TextField.new(nil, "Hello World!")
    textfield:setX(10)
    textfield:setY(100)
    textfield:setScale(8)
    stage:addChild(textfield)
    print "Test End"

    When I start it with debug line enabled, I get this from Zerobane:

    Debugger server started at i7:8172.
    Configuring remote player at 192.168.5.220.
    Starting the player and waiting for the bridge to connect at 'D:\Program Files (x86)\Gideros\Tools\gdrbridge.exe'.
    Starting project file 'D:\_Projects\_lua\Gideros\Test01\Test01.gproj'.

    ("Debugger server started at i7:8172." only happens on the first run)

    But nothing else happens. No output on the phone and no print output.

    When I comment the debug line out, I get this from Zerobrane:

    Configuring remote player at 192.168.5.220.
    Starting the player and waiting for the bridge to connect at 'D:\Program Files (x86)\Gideros\Tools\gdrbridge.exe'.
    Starting project file 'D:\_Projects\_lua\Gideros\Test01\Test01.gproj'.

    There is still no print output, but the phone correctly displays "Hello World!".

    If I cause a runtime error on purpose by changing:

    stage:addChild(null)

    I don't get any output in either case, nor do I get any information about a runtime error. It's the same output from Zerobrane as before. But now I have to open Task Manger sometimes and kill the gdrdeamon.exe process or it won't work even after correcting the "null".

    The Gideros IDE works fine and will report the runtime error correctly, and also output the print texts. Local simulator works fine in Zerobrane too.

    .gproj is in the same folder and Gideros IDE is not running - I even tried complete reboot to make sure nothing is still running. I'm using the latest versions of Gideros and Zerobrane.
  • @CitizenK, everything looks correct in your setup in terms of IP addresses and the sequence of steps (I assume 192.168.5.110 is the address of the computer running ZBS). The only thing I can think of is that you probably don't include mobdebug.lua and socket.lua in your project. They need to be present on the device (as part of your project) for the debugging to work. See the discussion in the other topic I linked above.
  • CitizenKCitizenK Member
    edited January 2014
    Ah, thank you, I did indeed not include them in the project. In case anyone else will find this thread with similar issues:

    Copy mobdebug.lua and socket.lua from zerobrane\lualibs to the project directory. Then right click on the directory in Gideros IDE and "add existing files" to add both files to the project. After that, close Gideros IDE and get back to zerobrane.

    Remote debugger works fine now. But what I still don't see are runtime errors. If I cause a runtime error on purpose, as described above, it just stops without reporting any error message:

    Debugger server started at i7:8172.
    Configuring remote player at 192.168.5.220.
    Starting the player and waiting for the bridge to connect at 'D:\Program Files (x86)\Gideros\Tools\gdrbridge.exe'.
    Starting project file 'D:\_Projects\_lua\Gideros\Test01\Test01.gproj'.
    Debugging session started in 'D:\_Projects\_lua\Gideros\Test01\'.
    "Test Start"
    Debugging session completed (traced 0 instructions).

    Am I still missing something?
  • @CitizenK, glad you got it working!

    > But what I still don't see are runtime errors. If I cause a runtime error on purpose, as described above, it just stops without reporting any error message:

    This seems to be a feature of Gideros as I don't get those errors in the IDE either even with debugging of Gideros apps running on the same computer. I get an error window popup with the error message, but it's not reported to the application, so the debugger doesn't get it.

    Maybe @atilim can make it reportable both in the popup and using "normal" lua mechanisms? Can the error be "printed" to stdout as an option? ZBS also intercepts debug.traceback to report run-time errors like this, but Gideros dosn't seem to be using that mechanism either.
Sign In or Register to comment.