[ZeroBrane Studio] Re: Problems setting up debugging

  • From: Tim Mensch <tim-freelists@xxxxxxxxxxx>
  • To: zerobrane@xxxxxxxxxxxxx
  • Date: Fri, 28 Jun 2013 15:37:27 -0600

Hi Paul,

I'm not sending the file name in quotes, at least not anywhere I'm aware of.

I DO use luaL_loadbuffer() in my engine to actually load Lua code, and I give it the filename as its name. When I give it the name, though, there are no quotes. I haven't traced backwards through the debugger to figure out where the quotes are coming from. Presumably it's the result of a debug call?

If it's important I can trace it backwards to see where the quotes come from.

Tim

On 6/28/2013 3:21 PM, Paul K wrote:
Hi Tim,

I looked at the patch and I agree, it does make send to check for file
existence one more time after deserializing or stripping the quotes.

I'm still interested why you send the file name in quotes though...

Paul.

On Fri, Jun 28, 2013 at 2:18 PM, Paul K <paul@xxxxxxxxxxxxx> wrote:
Hi Tim,

It turns out that my path is being passed back as "lua/init.lua", including the quotes, 
and so when I hit Step, it would open up an untitled buffer with the text "lua/init.lua". 
It interpreted the text as a serialized Lua file, in other words, and not as a file name that 
needed a basedir.
Right; this is by design. You can either send back a file name or the
file content (this is for those engines that don't report file name,
like LuaJava, or when you don't have a filename, like loadstring("my
code here")).

Why is the path being passed back as "lua/init.lua" in your case? Is
this a feature of your engine? The debugger doesn't expect the file
name to be in quotes. if you *do* need it to be in quotes, then change
it to single quotes to bypass the check that I have.

Paul.

On Fri, Jun 28, 2013 at 2:08 PM, Tim Mensch <tim-freelists@xxxxxxxxxxx> wrote:
Hi Paul,

That helped, but wasn't QUITE enough to make it work. It was enough for me
to track down where to look for the problem, though.

It turns out that my path is being passed back as "lua/init.lua", including
the quotes, and so when I hit Step, it would open up an untitled buffer with
the text "lua/init.lua". It interpreted the text as a serialized Lua file,
in other words, and not as a file name that needed a basedir.

I was able to track down where the path was getting messed up in
debugger.lua. Looking at the code, basedir may have only worked if the
filename wasn't included in quotes. From there it was a simple matter of
checking to see if the file exists given basedir, and without the quotes.
I'm sending off a pull request (cherry picked and applied to a branch off of
master, as you asked) now.

Tim


On 6/27/2013 6:34 PM, Paul K wrote:
Hi Tim,

My internal paths are potentially a problem. I do all of my loading
through paths relative to the "assets" folder, but run the game with the
folder set to the executable folder. So ZeroBrane doesn't have a way to know
what file matches what path.
You are right; this is most likely the reason. In most cases, you can
fix it by setting project directory to whatever directory you load
your files relative to, but if you need to start your project in one
directory, but load files relative to some other directory, you need
to use another mechanism.

Any way I can give it a hint? Or is there likely some other problem?
Yes, if you are using your own interpreter, you can specify what
directory will be used as the base directory for debugging. You can
pass "basedir" parameter to DebuggerAttachDefault() method that will
instruct the debugger to ignore project directory and will set basedir
based on the value you pass. You can calculate it any way you need
based on you project structure. You can check lfw.lua and
marmalade.lua in interpreters/ folder for some examples.

Let me know if that helps.

Paul.

On Thu, Jun 27, 2013 at 5:21 PM, Tim Mensch <tim-freelists@xxxxxxxxxxx>
wrote:
Hi,

I just got mobdebug.lua to finally run happily in my engine, but it's not
actually ever stopping at a breakpoint. :|

If I disable "runonstart", it gets completely stuck. If I enable
"runonstart", it happily runs, but then never sees any breakpoints.

My internal paths are potentially a problem. I do all of my loading
through
paths relative to the "assets" folder, but run the game with the folder
set
to the executable folder. So ZeroBrane doesn't have a way to know what
file
matches what path. Any way I can give it a hint? Or is there likely some
other problem?

Thanks in advance,

Tim




Other related posts: