News : The level of daily SPAM has reached insane proportions, all registrations are now manual. I ask you to send me an e-mail (john (at) murga (dot) org), to confirm that you want me to create an account for you.


Post Reply  Post Thread 
Debugging with murgaLua - Tutorial
Author Message
jpjacobs
Member
***


Posts: 113
Group: Registered
Joined: Jul 2007
Status: Offline
Reputation: 0
Post: #1
RE: Debugging with murgaLua - Tutorial

This really is cool. It enables really easy debugging, without mixing actual program output and debugging output! great Smile.

There is however one thing I can't get right: I'm having problems setting breakpoints. I tried setting the basedir before, and I tried all variations of:

  • setb test.lua 22
  • setb "test.lua" 22
  • setb /home/.../murgaLua/test/debug/test.lua 22
  • setb "/home/.../murgaLua/test/debug/test.lua" 22
When I enter the run command, it just runs the program all the way through, without breaking at the desired point. listb however lists the breakpoint.

Any idea what I'm doing wrong?

Edit: After fiddling a bit with strange setups (using the debugger to debug itself), I figured out what has happened: Apparently the standard controller hasn't got the brains to use a local path, or look in the local dir by default. If you give a basedir with basedir, then give it a local dir (so not starting with /) with respect to / (while in my opinion, it should be the current dir). I'll try to write up a patch for controller.lua to make it behave as expected.

Here's a patch: It works (at least for Linux) as I would expect:

Code:
34c33
< local basedir = ""
---
> local basedir = (lfs.currentdir() or ""):gsub("^/+",""):gsub("/+$","/") -- remove any leading / and add a trailing one.
203c202
<     local _, _, dir = string.find(line, "^[a-z]+%s+(.+)$")
---
>     local _, _, dir = string.find(line, "^[/a-z]+%s+(.+)$")
205,206c204,209
<       if not string.find(dir, "/$") then dir = dir .. "/" end
<       basedir = dir
---
>       if dir:match("^/+") then
>         dir = dir:gsub("^/+","")
>       else
>         dir = (lfs.currentdir() or ""):gsub("^/+","")..'/'..dir
>       end
>       basedir = dir:gsub("/+$","/")


Thanks,
Jan-Pieter

This post was last modified: 01-29-2011 08:23 AM by jpjacobs.

01-29-2011 07:07 AM
Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

Messages In This Thread
RE: Debugging with murgaLua - Tutorial - jpjacobs - 01-29-2011 07:07 AM

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump: