From: gotoken@... (GOTO Kentaro)
Date: 1999-07-10T03:20:23+09:00
Subject: [ruby-talk:00444] interactive ruby, debugger

Hi Michael,

In message "[ruby-talk:00443]"
    on 99/07/09, Michael Hohn <hohn@math.utah.edu> writes:

>o   What is the "standard" way to use ruby interactively, like a shell?   

A ruby program `irb' (interactive ruby) is known. 
irb is very easy to setup.  I asume you use ruby 1.3.x. 

0. get the latest tarball of irb from 
	ftp://ftp.netlab.co.jp/pub/lang/ruby/contrib/
1. extract archive
2. put the `irb/' directory into $: or your environment $RUBYLIB, which is 
   /usr/local/lib/ruby/1.3/site_ruby/ in default. 
3. make symbolic link of $RUBYLIB/irb/irb.rb in one of your $PATH
4. do `chmod' to be executable $RUBYLIB/irb/irb.rb
5. do `rehash' to tell your login shell about irb is appended
6. now, you can use `irb'

If `readline' extension module works with your interpreter, it powers
irb to be very helpful. 

>o   Why is the -debug flag special?  When writing/running a dynamically
>    typed interactive program (like a gui), I *expect* errors, and
>    getting a full, traversible stack trace with source file and line
>    number information is *critical* (to me, at least).  

Well, a user can obtain trace stack by the global variable $@. 

>                                                         Shouldn't
>    the debugger be part of the ruby core?

I think it is partially right. The debugger, indeed, is not part of a
ruby interpreter.  So, there exists degug.rb which is a gdb-like
debugger. 

% ruby -r debug yourcode.rb

In debug.rb prompt, The following is available command list. 

  b(reak)
  i(nfo)
  del(ete)
  c(ont)
  s(tep)
  n(ext)
  up
  down
  fin(ish)
  q(uit)
  where
  l(ist)
  p 

Please guess the meaning of each of them...

-- gotoken