[Ruby 1.9 - Bug #4931][Open] debug.rbでvarコマンドを実行するとTypeErrorで落ちる

Issue #4931 has been reported by Kazuki Tsujimoto.


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

Author: Kazuki Tsujimoto
Status: Open
Priority: Normal
Assignee:
Category: lib
Target version:
ruby -v: ruby 1.9.3dev (2011-06-26 trunk 32235) [x86_64-linux]

=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

Issue #4931 has been updated by Hiroshi NAKAMURA.

Status changed from Open to Assigned
Assignee set to Hiroshi NAKAMURA
Target version set to 1.9.3


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

Author: Kazuki Tsujimoto
Status: Assigned
Priority: Normal
Assignee: Hiroshi NAKAMURA
Category: lib
Target version: 1.9.3
ruby -v: ruby 1.9.3dev (2011-06-26 trunk 32235) [x86_64-linux]

=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

Issue #4931 has been updated by Hiroshi N…

Status changed from Assigned to Closed

ありがとうございました。r32271で修正しました。なんと、1.9以後誰もつかってなかったんですねvarコマンド。。。orz

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

Author: Kazuki Tsujimoto
Status: Closed
Priority: Normal
Assignee: Hiroshi N.
Category: lib
Target version: 1.9.3
ruby -v: ruby 1.9.3dev (2011-06-26 trunk 32235) [x86_64-linux]

=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