Project

General

Profile

Actions

Bug #4931

closed

debug.rbでvarコマンドを実行するとTypeErrorで落ちる

Added by ktsj (Kazuki Tsujimoto) over 13 years ago. Updated over 13 years ago.

Status:
Closed
Target version:
ruby -v:
ruby 1.9.3dev (2011-06-26 trunk 32235) [x86_64-linux]
Backport:
[ruby-dev:43946]

Description

=begin
辻本です。

debug.rbをロードしてvarコマンドを実行すると例外を吐いて落ちます。

$ ./ruby -Ilib -rdebug -e '0'
Debug.rb
Emacs support available.

-e:1:0
(rdb:1) var g
/home/k_tsj/work/ruby-trunk/lib/debug.rb:150:in eval': can't convert Symbol into String (TypeError) from /home/k_tsj/work/ruby-trunk/lib/debug.rb:150:in block in var_list'
from /home/k_tsj/work/ruby-trunk/lib/debug.rb:149:in each' from /home/k_tsj/work/ruby-trunk/lib/debug.rb:149:in var_list'
from /home/k_tsj/work/ruby-trunk/lib/debug.rb:157:in debug_variable_info' from /home/k_tsj/work/ruby-trunk/lib/debug.rb:478:in block in debug_command'
from /home/k_tsj/work/ruby-trunk/lib/debug.rb:240:in catch' from /home/k_tsj/work/ruby-trunk/lib/debug.rb:240:in debug_command'
from /home/k_tsj/work/ruby-trunk/lib/debug.rb:691:in trace_func' from /home/k_tsj/work/ruby-trunk/lib/debug.rb:905:in block in class:DEBUGGER__'
from -e:1:in `'

1.9からKernel#global_variablesなどがシンボルの配列を返すようになったのに
debug.rbが対応できていないのが原因です。

パッチです。

diff --git a/lib/debug.rb b/lib/debug.rb
index 4fb9d50..87a1826 100644
--- a/lib/debug.rb
+++ b/lib/debug.rb
@@ -146,7 +146,7 @@ class DEBUGGER__

  def var_list(ary, binding)
    ary.sort!
  •  for v in ary
    
  •  for v in ary.map{|s| s.to_s}
       stdout.printf "  %s => %s\n", v, eval(v, binding).inspect
     end
    
    end
    =end
Actions

Also available in: Atom PDF

Like0
Like0Like0