Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
Gideros Studio Debugger — Gideros Forum

Gideros Studio Debugger

n1cken1cke Maintainer
edited September 2015 in Roadmap
Hello. I am thinking about debugger based on mobdebug.lua from ZeroBraneStudio. I already played with lua console as QProcess inside Gideros Studio and tried mobdebug on Gideros projects. Mobdebug worked nice except one thing — I can't figure out how to pause app without breakpoints yet.
What do you guys think about it? Do we need integrated debugger?

Likes: simwhi, keszegh, hgy29, pie

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

Comments

  • I think many would be interested indeed.

    About pausing app, do you mean you don't know how to pause a running player (which could be something like pausing a player process, or if needed we could implement pausing mechanism in player's main loop)

    Or you mean you don't know how to implement breakpoints in studio's editor?
  • john26john26 Maintainer
    A real debugger with breakpoints in the Lua code and step through would be great, but I huge amount of work I suppose.

    One thing that occurred to me and would be easier. When my Lua program has an error and Gideros stops and tells me the line number, it would be good to be able to double click on the error and it opens the file and goes to the line number in question. Having used Visual Studio recently that seems like an obvious feature.
  • @john26 this functionality is already in Gideros Stdio, you click on error line and it puts the cursor on the same line where error happened.

    Likes: SinisterSoft

    +1 -1 (+1 / -0 )Share on Facebook
  • Basically the line should start with

    main.lua:20: some value

    for it to jump to main.lua file's 20th line on click

    Likes: SinisterSoft

    +1 -1 (+1 / -0 )Share on Facebook
  • > I can't figure out how to pause app without breakpoints yet.

    @n1cke, mobdebug supports "async" breakpoints, which allows the controller (an IDE for example) to set them while the app is running. You just send SETB command and if the app is not "suspended" in the debugger, you don't read the response.

    Another way to pause the app is to send "SUSPEND" command, which will pause the app on the next Lua command. It doesn't have any response either, but the earlier command (the one that was executing, like "run") may still return the result, so it needs to be read.

    > What do you guys think about it? Do we need integrated debugger?

    Isn't that what ZeroBrane Studio provides? (and more ;))

    Likes: n1cke

    +1 -1 (+1 / -0 )Share on Facebook
  • n1cken1cke Maintainer
    >Isn't that what ZeroBrane Studio provides? (and more
    @paulclinger, ZBS is the masterpiece, for sure, and I'd love to use it for pure Lua tests, but the thing is, I can't improve Gideros code for gdrbridge, but I can try to add ZBS functionality to Gideros Studio. I can't get noncompilation error messages from ZBS in any mode and any output while nondebug run for Gideros. I have very time-consuming operations in my code, so I must constantly switch here and there to get some results faster (10x). And this is only one of many reasons.
    Maybe one day someone will fix gdrbridge and will add all necessary tools from Gideros Studio to ZBS. But I want good tools right now:)

    @ar2rsawseen, @paulclinger, I think I must clarify my plan:
    1) When Gideros Studio starts it runs QProcess lua.exe (the interpreater) from the Tools folder. We can send and get standard input and output from lua interpreater, this is easy part :) In such a way we will have simple lua console. We can connect it to the output widget, for example, and make the widget text writable.
    2) To simplify things I will make "Debug" button. This button will add require("mobdebug").start() to the top of a code before sending to the Player and will send "require("mobdebug").listen() to lua console with a set of breakpoints from QScintilla. Lua console will be the server. After that we can set/edit breakpoints, watchexpressions, etc., by sending thoose commands to lua console and reading the output afterwards. Of course, we can process any io from lua console to make buttons for the stepping, and additional panel for watchexpressions, for example.

    >mobdebug supports "async" breakpoints, which allows the controller (an IDE for example) to set them while the app is running. You just send SETB command and if the app is not "suspended" in the debugger, you don't read the response.
    @paulclinger, sorry, I don't get it. If the app is running without breakpoints then I can't input any commands to lua console.
  • > I can't get noncompilation error messages from ZBS in any mode and any output while nondebug run for Gideros. I have very time-consuming operations in my code, so I must constantly switch here and there to get some results faster (10x).

    @n1cke, both of these shouldn't be difficult to address. If you call require('mobdebug').off() right after .start(), you'll get the "normal" speed, but "print" will still be redirected back to ZBS, which allows you to see the output from your application.

    You can then call mdb.on() (assuming you do "local mdb = require('mobdebug')") and mdb.off() around the fragment you want to debug and it will enable all debugging functions for that fragment. As the result you get no performance penalty for all the other code and still can debug the fragment you are interested in.

    > And this is only one of many reasons.

    I'd like to hear more as I'm regularly working on enhancements and fixes.

    > If the app is running without breakpoints then I can't input any commands to lua console.

    yes, console is not available at that time, but you can "pause/suspend" the application as I described above, which will give you access to all debugging functionality.

    Paul.
  • n1cken1cke Maintainer
    >I'd like to hear more as I'm regularly working on enhancements and fixes.
    I meant specific Gideros tasks like "Export Project", "Files Order", "Auto Detection of Players" and "Project Properties".
  • > I meant specific Gideros tasks like "Export Project", "Files Order", "Auto Detection of Players" and "Project Properties".

    @n1cke, agree, these are Gideros specific features and if someone can contribute them, it would be great! ;) Having said that, for projects that have more or stable structure, it's usually not an issue (or the project file can be edited manually, even inside ZBS, since it's just an XML file).
  • n1cken1cke Maintainer
    This idea doesn't work. It seems like QProcess inside Gideros Studio can't read any data after luasocket activated from mobdebug, print() ceases to work usual way after this. It accepts input and does work but no output available. Can see the output from mobdebug only after closeWriteChannel(). Buffer problems maybe, I don't know.
Sign In or Register to comment.