Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Quick demo of Gideros debugging with ZeroBrane Studio — Gideros Forum

Quick demo of Gideros debugging with ZeroBrane Studio

paulclingerpaulclinger Member
edited October 2012 in General questions
@bowerandy, @atilim, @nascode, @keszegh, I've recorded a short demo that shows various aspects of debugging a Gideros application using ZeroBrane Studio Lua IDE (http://studio.zerobrane.com/): http://notebook.kulchenko.com/zerobrane/gideros-debugging-with-zerobrane-studio-ide. The post also includes instructions on how to enable Gideros integration in the IDE. To get Gideros debugging and auto-complete, you will need to get the latest version from the Github repository (I will be packaging a new version with all these features in a few days). This is tested with Gideros 2012.08.4. Please let me know if you run into any issues.

Paul.
Tagged:
+1 -1 (+5 / -0 )Share on Facebook
«13

Comments

  • evsevs Member
    Hello,

    Fantastic stuff!!!


    cheers

    evs
  • @Paul, using it on the Mac, the latest version 0.32 does not have any in-built Gideros integration (at least not as easy as the video makes it look), @Andy's instructions get it working to an extent, is there a zero configuration method for it to work on the mac osx?
    twitter: @ozapps | http://www.oz-apps.com | http://howto.oz-apps.com | http://reviewme.oz-apps.com
    Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
    Cool Vizify Profile at https://www.vizify.com/oz-apps
  • @ozapps: yes, you need to get the latest version from github repo. The packaged version (0.32) doesn't yet have that functionality. After you clone the repository, you can run ZeroBrane Studio with "./zbstudio.sh".
  • @paulclinger, and everyone else. I can confirm that, as far as I'm concerned, ZeroBrane Studio is the missing piece in the puzzle for Gideros development.

    Actually, I quite like the Gideros IDE (I think I'm in the minority, perhaps) because it quick, simple and has a rather interesting autocomplete scheme that's a bit quirky but generally gets the job done. The one thing that's missing is the debugger.

    I've tried several other debugging solutions for Gideros but in general they require huge IDEs that need you to adopt their own way of working (no, I don't want to use Eclipse) and one thing in particular: as far as I know they don't allow you to do debugging on an ACTUAL DEVICE.

    ZeroBrane Studio does this. It's also free, it's lightweight, and there's no installation process. Oh, and I almost forgot: it's got a cool logo. There's also the rather interesting live coding feature, but more on that in another post...

    Best regards
    +1 -1 (+4 / -0 )Share on Facebook
  • Will surely give it a try^_^
  • gorkemgorkem Maintainer
    If license/Paul (community) allows (wants) us to bundle Gideros Studio, that would be a big asset and a win, in my opinion.

    Paul: what are your thoughts and long term plans with your IDE? :) whats your take on bundling?
  • bernardbernard Member
    edited October 2012
    @paulclinger

    I d/l the github version and selected Gideros as the Lua Intepreter.

    I loaded the "Sleeping Bodies" sample and tried to run it.

    I get this error in the window below:

    Can't find gideros executable in any of the folders in PATH: C:\Program Files\NVIDIA Corporation\PhysX\Common, C:\Program Files\Common Files\Microsoft Shared\Windows Live, C:\WINDOWS\system32, C:\WINDOWS, C:\WINDOWS\system32\WBEM, C:\WINDOWS\system32\WindowsPowerShell\v1.0, C:\Program Files\Microsoft SQL Server\100\Tools\Binn\, C:\Program Files\Microsoft SQL Server\100\DTS\Binn\, C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\, C:\Program Files\Common Files\Roxio Shared\DLLShared\, C:\Program Files\Gideros, D:\Program Files\Gideros

    I have installed Gideros in "D:\DEV\A1New\Gideros" so obviously the IDE is not finding it.

    After doing a search I found a file called gideros.lua in the ZeroBrane\interpreters\ folder:
    local gideros
    local win = ide.osname == "Windows"
    local mac = ide.osname == "Macintosh"
     
    return {
      name = "Gideros",
      description = "Gideros mobile platform",
      api = {"baselib", "gideros"},
      frun = function(self,wfilename,rundebug)
        gideros = gideros or ide.config.path.gideros -- check if the path is configured
        if not gideros then
          local sep = win and ';' or ':'
          local default =
               win and ([[C:\Program Files\Gideros]]..sep..[[D:\Program Files\Gideros]]..sep..[[D:\DEV\A1New\Gideros]]..sep)  
     
     -- I changed this above to include my path
     
            or mac and ('/Applications/Gideros Studio/Gideros Player.app/Contents/MacOS'..sep)
            or ''
          local path = (os.getenv('PATH') or '')..sep
                     ..default
                     ..(os.getenv('HOME') and os.getenv('HOME') .. '/bin' or '')
          local paths = {}
          for p in path:gmatch("[^"..sep.."]+") do
            gideros = gideros or GetFullPathIfExists(p, win and 'GiderosPlayer.exe' or 'Gideros Player')
            table.insert(paths, p)
          end
          if not gideros then
            DisplayOutput("Can't find gideros executable in any of the folders in PATH: "
              ..table.concat(paths, ", ").."\n")
            return
          end
        end
    ....
    ....
    Now the project runs in the player from ZeroBrane after I added the line

    require('mobdebug').start()

    Obviously there is an issue with finding the path in ZeroBrane and this can easily be fixed so the user can set any path to Gideros manually instead of looking at the PATH variable. Better still use the path value stored in the Registry at:

    [HKEY_CURRENT_USER\Software\Gideros]

    Update

    I shd RTFM

    I added a file in the cfg\user.lua with the line
    path.gideros = 'D:/DEV/A1New/Gideros/GiderosPlayer.exe'
    and now it works just fine.
  • @bernard: right, setting path.gideros is the easiest way if you install gideros in a non-default, non-PATH location.
  • @bowerandy, thank you for the exciting feedback.
  • @atilim, has anything related to handling global variables changed in Gideros 2012.09? @nascode is reporting in his comment to the blogpost (http://notebook.kulchenko.com/zerobrane/gideros-debugging-with-zerobrane-studio-ide#comment-100) that he gets a run-time error in mobdebug.lua on a line that references a global variable that is undefined (this is by design). I haven't had a chance to test with 2012.09 yet, but it's been working with several 2012.08.* versions I used.
  • @gorkem, thank you for the offer. This is an interesting idea; let me think about it. I don't plan to slow down much and have a long list of interesting features to add to the IDE (while still keeping it simple and lightweight). For example, one of the recent commits added syntax-aware indentation that several users were interested in.

    The two aspects I want to think about are: (1) the IDE is in an active development stage with almost daily changes, which means that some of the APIs may change (and a bundled version may require an update anyway), and (2) I'm exploring making the project a donationware to make it more sustainable long-term. I'll let you know what I come up with.
  • atilimatilim Maintainer
    @paulclinger no, I haven't changed that kind of behavior. Also I've run ZeroBrane Studio with 2012.09 before releasing that version.
  • @atilim: indeed, I just tested with the most recent 2012.09.1 and everything works as expected. Thanks for checking.

    @nascode, what platform are you on? I just tested on Windows and the debugging works with the most recent version of Gideros.
  • atilimatilim Maintainer
    @nascode are you using strict.lua? maybe this is the problem?
  • @atilim, good guess; this does look like a message from strict.lua: 'error("variable '"..n.."' is not declared", 2)'

    I'll probably add a check when strict.lua is present and register those variables to avoid this issue.
  • @atilim, is there an easy way to print values from the player to standard output? Still trying to make the debugger work with strict.lua...
  • atilimatilim Maintainer
    edited October 2012
    @paulclinger using a plugin can be a way. I've attached the plugin. You should copy log.dll to [Gideros Installation Directory]/Plugins and that's all. It defines a global function "log" which works exactly same as "print" but writes to stdout.

    If you want, you can also change global print as:
    print = log
     
    -- or
     
    local _print = print
    function print(...)
        _print(...)
        log(...)
    end
    Hope this helps

    Edit: You're on windows, right? If you want, I can build the plugin for Mac.
    zip
    zip
    log.zip
    21K
    log.zip 21.2K
  • @atilim; got it working; thank you.
  • @paulclinger @atilim ah yes i am using strict.lua to help avoid messiness :)

    Likes: atilim

    have fun with our games~
    http://www.nightspade.com
    +1 -1 (+1 / -0 )Share on Facebook
  • @nascode, you can disable strict.lua for now, but I came up with a fix to the debugger that will allow you to continue using strict.lua. Will push shortly.
  • @nascode, btw, ZeroBrane Studio includes static analyzer you can use for the same purpose as strict.lua, only at compile time. It can also find potentially more issues as it covers the entire code, not just the branches you visit at run-time.
  • @paulclinger ah yes, i will try ZeroBrane's static analyzer. Thank you for your great tool :)
    have fun with our games~
    http://www.nightspade.com
  • @nascode, I pushed an updated version with a strict.lua-friendly debugger. You should be able to debug without disabling strict.lua. Let me know if you run into any issues with it.
  • I had a quick fiddle with ZeroBrane as it looks good but I couldn't get it working. I think I followed the instructions but when I try and run a project, the Gideros player opens for a while and then shuts and I get an alert box saying:
    Failed to kill process xxxx (error 5: access is denied)
    where xxxx is a different 4 digit number each time. The output in ZeroBrane reads:
    Program starting as '"C:\Program Files (x86)\Gideros\GiderosPlayer.exe"'.
    Program 'GiderosPlayer.exe' started in 'D:\gideros\Examples\Box2D_basic' (pid: 988).
    Starting the player and waiting for the bridge to connect at 'C:\Program Files (x86)\Gideros\Tools\gdrbridge.exe'.
    Couldn't connect to the player. Try again or check starting the player and the bridge manually.
    I assume that it's not connecting properly but don't know how to sort it. How do I start the bridge manually if that is what is needed? Any help appreciated!
    Thanks
    Pete
  • paulclingerpaulclinger Member
    edited October 2012
    @petec, if you have a running instance of Gideros player, you may want to close it before starting the debugging from ZBS.

    You can also try starting the player from the command line to see if it's working. Try running the player and the bridge with the following commands:

    1. start "player" "C:\Program Files (x86)\Gideros\GiderosPlayer.exe"
    2. "C:\Program Files (x86)\Gideros\Tools\gdrbridge.exe" isconnected
    This should show something like
    * daemon started successfully *
    0

    3. "C:\Program Files (x86)\Gideros\Tools\gdrbridge.exe" play "D:\gideros\Examples\Box2D_basic\Box2d_basic.gproj"

    This should open your project in the player (you may need to adjust your .gproj file name. If it all works, you can shutdown the player and try again in ZBS.

    If it still works when running the player directly, but doesn't work from ZBS for some reason, you can try the following:

    1. Start ZBS and start the debugger server by going to Project | Start Debugger Server
    2. Add "require('mobdebug').start()" to your main.lua script
    3. Create a batch (player.bat) file with the following to start the player (change ZBS path to match yours):

    set ZBS=D:\ZeroBraneStudio\
    set LUA_PATH=%ZBS%lualibs/?/?.lua;%ZBS%lualibs/?.lua
    start "Player" "C:\Program Files (x86)\Gideros\GiderosPlayer.exe"

    4. Run the batch file and then run gdrbridge.exe command to start your project. This should start the debugging in the IDE.
  • @bernard: right, setting path.gideros is the easiest way if you install gideros in a non-default, non-PATH location.
    Thanks Paul. Please let us know here when any update to ZeroBrane is made.
  • keszeghkeszegh Member
    edited October 2012
    Thanks paulclinger for all your work, i'm glad that i could be the first advocate of zerobrane for gideros, it looks to be able to bring a big change in the way one can program in gideros. I'm also looking forward for the first official version with gideros support.
  • @paulclinger Thanks for the detailed instructions. I'm having mixed results. Starting with your first method commands 1 and 2 do what you say but command 3 doesn't run the project.

    I then tried the batch file method and by running the gridge.exe commond to start the project twice, the project started. But then, in debugging mode, I can't edit the project (I guess that's how it is?) but stopping debugging mode closed the player. If I tried starting debugging again from ZBS then I got my same old 'Failed to kill process xxxx (error 5: access is denied)' pop up so I had to go through the whole batch file etc to get it going again.

    I'm not much good when I'm having to do stuff like this and haven't got enough time at the moment to fiddle. ZeroBrane does look good so I will give it another go soon when I've got more spare time.

    Thanks for all your help, Pete
  • @keszegh, thanks for bringing this topic up on the forum; this is indeed how I noticed the interest and decided to take a closer look at integrating Gideros.

    @petec, yes, the project can't be edited while the debugging is on. If you are looking for live changes (something like @bowerandy showed in his demo), then *after* starting debugging from the player, you need to select Project | Run As scratchpad, which should enable live coding. Keep in mind that you may need to structure your code in a specific way to work better with live coding. You may look at Andy's demo and code at http://bowerhaus.eu/blog/files/live_coding.html
Sign In or Register to comment.