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

  • From: Paul K <paul@xxxxxxxxxxxxx>
  • To: "zerobrane@xxxxxxxxxxxxx" <zerobrane@xxxxxxxxxxxxx>
  • Date: Wed, 22 Oct 2014 23:22:51 -0700

Hi Jan,

> Alright, thanks to your help, I got the debugging server running and it
> detects the starting of the program correctly. Almost there!

Good! Thank you for the update.

> Now, in ZBS, I have set the scripts folder as the project directory. So ZBS 
> expects rogueassembly/init.lua (I guess).

Correct. The simplest solution is to run the script from the same
folder that you set as Project folder in the IDE. Is there any reason
why you can not run it from scripts/ folder (or whatever folder your
Project folder is set to)?

> My guess is I would need some way to specify a custom file naming scheme so 
> that ZBS knows files can be prefixed with something and may (or may not, for 
> example on Linux) contain \ instead of /. However, neither in the FAQ nor in 
> the remote debugging help, I found any clue in how I could solve this little 
> problem.

You can mix \ and / separators and ZBS should handle that just fine;
in fact, you can run your script on Linux and debug it from ZBS
running on Windows as long as the project structure is the same (but
the projects may be in completely different folders on two systems).

If you do need to run it from the folder with the executable, can you
make sure that you are loading your script that includes
"require('mobdebug').start()" call using relative instead of an
absolute path? For example, instead of "myapp.exe
d:\gamedir\scripts\main.lua" use "myapp.exe ..\..\scripts\main.lua".
ZBS will attempt to remap the remote path and the project path in the
IDE and you may see a message "Mapped remote request for '...' to
'...'." in the Output window.

Paul.

On Wed, Oct 22, 2014 at 5:17 AM,  <jan@xxxxxxxxxxx> wrote:
> Alright, thanks to your help, I got the debugging server running and it
> detects the starting of the program correctly.
>
> Almost there!
>
> However, no breakpoints are working. I had a look at the FAQ and it seems
> that this is the problem:
> "You may be using your own Lua engine that doesn’t report file names
> relative to the project directory (as set in the IDE). For example, you set
> the project directory pointing to scripts folder (with common subfolder) and
> the engine reports the file name as myfile.lua instead of common/myfile.lua;
> the IDE will be looking for scripts/myfile.lua instead of
> scripts/common/myfile.lua and the file will not be activated and the
> breakpoints won’t work. You may also be using inconsistent path separators
> in the file names; for example, common/myfile.lua in one case and
> common\myfile.lua in another."
>
> While this helped me figure out the problem, I have not the slightest idea
> about how to solve it. It might be a good idea to add that to the FAQ ;)
>
> In my case, the folder structure is like this:
>
> - gamedir
>   - scripts    // This is where all scripts are
>   - bin
>     - release_win (or another platform) // This is where the executable
> lies, it is also the working directory
>
> So, with this in mind, here is what print(debug.getinfo(1,"S").source)
> shows:
> @../../scripts/rogueassembly\init.lua
> It goes up two folders from the working dir, then into the scripts folder,
> etc. Looking fine, I would say (except that / and \ mix, which I don't know
> where it comes from, probably Windows).
>
> Now, in ZBS, I have set the scripts folder as the project directory. So ZBS
> expects rogueassembly/init.lua (I guess).
>
> My guess is I would need some way to specify a custom file naming scheme so
> that ZBS knows files can be prefixed with something and may (or may not, for
> example on Linux) contain \ instead of /. However, neither in the FAQ nor in
> the remote debugging help, I found any clue in how I could solve this little
> problem.
>
>

Other related posts: