Forums | Admin

Discussion Forums: open-discussion

Start New Thread Start New Thread

 

By: Rocky Bernstein
RE: Ruby-Debug Fails when debugging Ramaze Ap [ reply ]  
2008-03-24 21:42
Glad you found your problem have a work around.

Changing $0 by is in SVN right now and is part of 0.10.1. http://rubyforge.org/tracker/index.php?func=detail&aid=16038&group_id=1900&atid=7438

By: David Langston
RE: Ruby-Debug Fails when debugging Ramaze Ap [ reply ]  
2008-03-24 21:35
Rocky,

I really appreciate your quick reply and I ??think?? that I have uncovered the issue. I was trying to get script logs of running the Ramaze app in both ruby-debug and the old 'ruby -rdebug' debugging mode. During that I noticed that the flow was different before the 'failure' that I reported. After digging in further it seems there is an important difference between running in the ruby-debug environment and the old debugger or std ruby environment.

That difference is that the $0 global variable is loaded with the 'ruby-ide' program path/name when the ruby-debug'er is run but normally has the actual script file path/name in it when you run in regular ruby or the old debugger. Since Ramaze is using that to test for a specific condition, it causes a flow change that caused the reported behavior.

I can hack a fix in Ramaze to allow me to debug using ruby-debug, but I would recommend that you change ruby-debug to load the $0 variable with the actual script name to prevent similar future issues. If you would like, I can file another bug in tracker.

thx,
Dave L

By: Rocky Bernstein
RE: Ruby-Debug Fails when debugging Ramaze Ap [ reply ]  
2008-03-24 17:59
Here's something to try. Before the continue command ("c") issue "set linetrace on".

Then when you step, you'll see all the lines the debugger has an opportunity to stop at. If the line you issued in the breakpoint command doesn't appear, then there's that's why there is no stop. If it does appear, but in the trace line the filename is a little bit different (e.g. ramaze/global/globalstruct.rb versus /usr/lib/...) then that's also why.

By: David Langston
Ruby-Debug Fails when debugging Ramaze App [ reply ]  
2008-03-24 17:33
I have posted the bug to the Tracker, but repeated here for visitors to the forum...

If you attempt to debug a Ramaze application (a new lightweight Ruby web framework), ruby-debug will simply fail and
return to shell (e.g. bash) at a specific point in the application flow. This is confirmed to do the same on both windows
(Windows XP, ruby-debug 0.10.0 and 0.9.3) and linux (Fedora 8, ruby-debug 0.10.0). If you debug using the older ruby
debugger (ruby -rdebug) it works successfully (but is slooowwww). To recreate the problem:

1) install the Ramaze gem and its dependencies (both Ramaze 0.3.6 and 0.3.9 have been tested and have same issue)

2) create a Ramaze app
> ramaze -create tmpapp

3) cd into that app
> cd tmpapp

4) run ruby-debug on app
> rdebug start.rb

5) set breakpoint a couple of lines before failure and continue
(assuming ruby gems are in /usr/lib/ruby/gems/....)
(rdb:1) b /usr/lib/ruby/gems/1.8/gems/ramaze-0.3.6/lib/ramaze/global/globalstruct.rb:55
(rdb:1) c

6) step 3 or 4 times and the debugger simply fails and returns to the bash shell


Note: do the same thing with the old ruby debugger (ruby -rdebug start.rb) and it works fine

Dave L.