[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

debug doesn't work for me!

rayreeves

6/21/2006 6:41:00 PM


E:\Ruby\work>ruby -r debug fact.rb
Debug.rb
Emacs support available.

e:/ruby/lib/ruby/site_ruby/1.8/ubygems.rb:4:require 'rubygems'
(rdb:1) [1,4] in fact.rb
e:/ruby/lib/ruby/site_ruby/1.8/ubygems.rb:4:compile error
e:/ruby/lib/ruby/site_ruby/1.8/ubygems.rb:4: parse error, unexpected kIN,
expect
ing $
[1,4] in fact.rb
^

Set breakpoint has the same problem.

Notice there also seems to be a line missing before the (rdb:1) prompt.

Ray Reeves




7 Answers

senthil.nayagam@gmail.com

6/22/2006 2:01:00 AM

0

can you paste your fact.rb source



senthil

http://senthiln...

rayreeves wrote:
> E:\Ruby\work>ruby -r debug fact.rb
> Debug.rb
> Emacs support available.
>
> e:/ruby/lib/ruby/site_ruby/1.8/ubygems.rb:4:require 'rubygems'
> (rdb:1) [1,4] in fact.rb
> e:/ruby/lib/ruby/site_ruby/1.8/ubygems.rb:4:compile error
> e:/ruby/lib/ruby/site_ruby/1.8/ubygems.rb:4: parse error, unexpected kIN,
> expect
> ing $
> [1,4] in fact.rb
> ^
>
> Set breakpoint has the same problem.
>
> Notice there also seems to be a line missing before the (rdb:1) prompt.
>
> Ray Reeves

rayreeves

6/22/2006 1:46:00 PM

0

def fact(n)
if n <= 0
1
else
n * fact(n-1)
end
end

p fact(4)

"Senthilnayagam" <senthil.nayagam@gmail.com> wrote in message
news:1150941651.552295.27750@p79g2000cwp.googlegroups.com...
> can you paste your fact.rb source
>
>
>
> senthil
>
> http://senthiln...
>
> rayreeves wrote:
>> E:\Ruby\work>ruby -r debug fact.rb
>> Debug.rb
>> Emacs support available.
>>
>> e:/ruby/lib/ruby/site_ruby/1.8/ubygems.rb:4:require 'rubygems'
>> (rdb:1) [1,4] in fact.rb
>> e:/ruby/lib/ruby/site_ruby/1.8/ubygems.rb:4:compile error
>> e:/ruby/lib/ruby/site_ruby/1.8/ubygems.rb:4: parse error, unexpected kIN,
>> expect
>> ing $
>> [1,4] in fact.rb
>> ^
>>
>> Set breakpoint has the same problem.
>>
>> Notice there also seems to be a line missing before the (rdb:1) prompt.
>>
>> Ray Reeves
>


senthil.nayagam@gmail.com

6/22/2006 2:20:00 PM

0

C:\rails\ruby>ruby -rdebug fact.rb
Debug.rb
Emacs support available.

c:/ruby/lib/ruby/site_ruby/1.8/ubygems.rb:4:require 'rubygems'
(rdb:1) b 2
Set breakpoint 1 at c:/ruby/lib/ruby/site_ruby/1.8/ubygems.rb:2
(rdb:1) c
24


works perfectly for me

not sure why it did not work for you

regards
Senthil
http://senthiln...


rayreeves wrote:
> def fact(n)
> if n <= 0
> 1
> else
> n * fact(n-1)
> end
> end
>
> p fact(4)
>
> "Senthilnayagam" <senthil.nayagam@gmail.com> wrote in message
> news:1150941651.552295.27750@p79g2000cwp.googlegroups.com...
> > can you paste your fact.rb source
> >
> >
> >
> > senthil
> >
> > http://senthiln...
> >
> > rayreeves wrote:
> >> E:\Ruby\work>ruby -r debug fact.rb
> >> Debug.rb
> >> Emacs support available.
> >>
> >> e:/ruby/lib/ruby/site_ruby/1.8/ubygems.rb:4:require 'rubygems'
> >> (rdb:1) [1,4] in fact.rb
> >> e:/ruby/lib/ruby/site_ruby/1.8/ubygems.rb:4:compile error
> >> e:/ruby/lib/ruby/site_ruby/1.8/ubygems.rb:4: parse error, unexpected kIN,
> >> expect
> >> ing $
> >> [1,4] in fact.rb
> >> ^
> >>
> >> Set breakpoint has the same problem.
> >>
> >> Notice there also seems to be a line missing before the (rdb:1) prompt.
> >>
> >> Ray Reeves
> >

rayreeves

6/22/2006 3:38:00 PM

0

But it doesn't stop at line 2!
And this command from the manual doesn't parse:
[1,4] in fact.rb

Ray Reeves

"Senthilnayagam" <senthil.nayagam@gmail.com> wrote in message
news:1150985985.942215.301960@b68g2000cwa.googlegroups.com...
> C:\rails\ruby>ruby -rdebug fact.rb
> Debug.rb
> Emacs support available.
>
> c:/ruby/lib/ruby/site_ruby/1.8/ubygems.rb:4:require 'rubygems'
> (rdb:1) b 2
> Set breakpoint 1 at c:/ruby/lib/ruby/site_ruby/1.8/ubygems.rb:2
> (rdb:1) c
> 24
>
>
> works perfectly for me
>
> not sure why it did not work for you
>
> regards
> Senthil
> http://senthiln...
>


Tim Hoolihan

6/23/2006 1:36:00 PM

0

Try this:

(irb:1)break fact.rb:1
(irb:1)c

If you've been running this in windows, I think ruby includes a file in
order to work smoothly with the windows command line. Your breakpoints
were getting set in that code, not your code.

rayreeves wrote:
> But it doesn't stop at line 2!
> And this command from the manual doesn't parse:
> [1,4] in fact.rb
>
> Ray Reeves
>
> "Senthilnayagam" <senthil.nayagam@gmail.com> wrote in message
> news:1150985985.942215.301960@b68g2000cwa.googlegroups.com...
>> C:\rails\ruby>ruby -rdebug fact.rb
>> Debug.rb
>> Emacs support available.
>>
>> c:/ruby/lib/ruby/site_ruby/1.8/ubygems.rb:4:require 'rubygems'
>> (rdb:1) b 2
>> Set breakpoint 1 at c:/ruby/lib/ruby/site_ruby/1.8/ubygems.rb:2
>> (rdb:1) c
>> 24
>>
>>
>> works perfectly for me
>>
>> not sure why it did not work for you
>>
>> regards
>> Senthil
>> http://senthiln...
>>
>
>

rayreeves

6/23/2006 3:55:00 PM

0

"Tim Hoolihan" <tim@hoolihan.net> wrote in message
news:V6Smg.82841$P2.9720@tornado.ohiordc.rr.com...
> Try this:
>
> (irb:1)break fact.rb:1
> (irb:1)c
>
E:\Ruby\work>irb
irb(main):001:0> break fact.rb:1
SyntaxError: compile error
(irb):1: parse error, unexpected tINTEGER, expecting tSTRING_CONTENT or
tSTRING_
DBEG or tSTRING_DVAR or tSTRING_END
from (irb):1
> If you've been running this in windows, I think ruby includes a file in
> order to work smoothly with the windows command line. Your breakpoint
> were getting set in that code, not your code.
>

Well, that's no use!
Notice that Senthilnaya's code didn't work either
Could it be that Ruby debug simply doesn't work under XP?

Ray Reeves


Tim Hoolihan

6/23/2006 3:58:00 PM

0

I don't get it, because it works for me under XP. Here is my entire
console session:


C:\tools\scripts\test>type fact.rb
def fact(n)
if n <= 0
1
else
n * fact(n-1)
end
end

p fact(4)

C:\tools\scripts\test>ruby -d fact.rb
24

C:\tools\scripts\test>ruby -r debug fact.rb
Debug.rb
Emacs support available.

c:/program files/ruby/lib/ruby/site_ruby/1.8/ubygems.rb:4:require 'rubygems'
(rdb:1) break fact.rb:1
Set breakpoint 1 at fact.rb:1
(rdb:1) c
Breakpoint 1, toplevel at fact.rb:1
fact.rb:1:def fact(n)
(rdb:1) s
fact.rb:9:p fact(4)
(rdb:1) s
fact.rb:2: if n <= 0
(rdb:1) s
fact.rb:2: if n <= 0
(rdb:1) s
fact.rb:5: n * fact(n-1)
(rdb:1) c
24

C:\tools\scripts\test>