[ZeroBrane Studio] Re: Remote debugging: IDE project path vs. actual file path

  • From: Jan Drabner <jan@xxxxxxxxxxx>
  • To: zerobrane@xxxxxxxxxxxxx
  • Date: Thu, 23 Oct 2014 23:02:54 +0200


There may be couple of options, but before proposing something, I'd
like to get a bit more information. You reported output from printing
"debug.getinfo(1,"S").source" earlier as being
"@../../scripts/rogueassembly\init.lua". How does it look if you print
it from the file where you have "require('modebug').start()"? What do
you get when you add "print(debug.getinfo(1,"S").source)" right before
starting the debugger?
That was the output right before the mobdebug start.

As one quick thing you may try right now is after you start the
debugger server in the IDE (Project | Start Debugger Server should be
checked), you can run this command in the Local Console:

ide:GetDebugger().options = {basedir =
[[d:\whatever\gamedir\bin\release_win\..\..\scripts]]}

After you execute this command, start the debugging as you normally do
and you should see "Mapped remote request for ..." messages in the
Output window and the breakpoints may work.
Interesting. I will try that out and report.

Btw. I got it to work in the following way, but it is not really future proof.

In the gamedir (directly in it), I put a startdebug.lua file that does nothing but starting mobdebug. Then, I pick the gamedir (not the scripts folder within) as the project directory in ZBS. Start the debugger server and then the game. The game is set to execute this startdebug.lua via "dofile("../../startdebug.lua")". The debugger works right away, and I can set a breakpoint in any script in the scripts folder and it breaks on those points. I also get the "Mapped remote request for "../../"" message.

But I fear that this will only work for our own scripts, not for those inside user directories. Also, it ONLY works if the startdebug.lua file is open in ZBS and it MUST be the file currently viewed. Any other file and the debugger starts, but no breakpoints are working. Also, any other file (or rather, any file that is not in gamedir) does not yield the "Mapped..." message.

It is as if the currently opened and VIEWED file influences the debugger significantly, which is really weird. I get that the project dir has an influence, but the currently VIEWED file? Probably a bug?

Other related posts: