Debugging question

I run this one gem with the command "foo ". I’d like to try
to run it off the foo.rb file so that I can debug it. However, when I
do "ruby path/to/foo.rb " it doesn’t behave in the same way
as "foo ". How do I need to run this program in order to
debug it?

maybe first
require ‘rubygems’
then require the file,
maybe run it from within that directory.
maybe do Dir.chdir to it, first, then require.

eggman2001 wrote:

I run this one gem with the command "foo ". I’d like to try
to run it off the foo.rb file so that I can debug it. However, when I
do "ruby path/to/foo.rb " it doesn’t behave in the same way
as "foo ". How do I need to run this program in order to
debug it?

Specifics would be nice, as I don’t quite understand what you’re trying
to do. “run a gem”?

so I installed the gem rdig. You run rdig with "rdig " and
I’d like to debug it.

eggman2001 wrote:

so I installed the gem rdig. You run rdig with "rdig " and
I’d like to debug it.

gem install ruby-debug
rdebug rdig (maybe)
gl

I tried that, but it doesn’t work.

Here’s the error that I’m getting…
C:\InstantRails\ruby_progs\rdig_testing>rdeb
s\rdig_testing\config.rb
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/
6:in initialize': Bad file descriptor - con from C:/InstantRails/ruby/lib/ruby/g by-debug.rb:86:innew’
from C:/InstantRails/ruby/lib/ruby/g
by-debug.rb:86:in `start_client’
from C:/InstantRails/ruby/lib/ruby/g
ebug:87
from C:/InstantRails/ruby/bin/rdebug
from C:/InstantRails/ruby/bin/rdebug

C:\InstantRails\ruby_progs\rdig_testing>

checkout the topmost file line.
Maybe you’re trying to run something on a port in use?

eggman2001 wrote:

I tried that, but it doesn’t work.

Here’s the error that I’m getting…
C:\InstantRails\ruby_progs\rdig_testing>rdeb
s\rdig_testing\config.rb
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/
6:in initialize': Bad file descriptor - con from C:/InstantRails/ruby/lib/ruby/g by-debug.rb:86:innew’
from C:/InstantRails/ruby/lib/ruby/g
by-debug.rb:86:in `start_client’
from C:/InstantRails/ruby/lib/ruby/g
ebug:87
from C:/InstantRails/ruby/bin/rdebug
from C:/InstantRails/ruby/bin/rdebug

C:\InstantRails\ruby_progs\rdig_testing>

eggman2001 wrote:

Not quite sure what you mean - sorry. I know very little about the
role that ports play in these situations.

go into the rdig file (find it), then add
require ‘ruby-debug’
debugger

and it should open a breakpoint for you there (run it normal).
GL!
-Roger

That worked! Thanks so much :slight_smile:

Not quite sure what you mean - sorry. I know very little about the
role that ports play in these situations.