Skip to content

k-tsj/dexc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Automatically start the REPL and show trace on an exception to debug.

  • Ruby 2.0.0 or later

  • Pry(optional)

$ gem install dexc
$ cat t.rb
def m(obj)
  obj.to_s + 1
end

m(0)

$ ruby -rdexc t.rb
 0:lib/dexc.rb:82>     tp.enable
   TracePoint#enable: false
 1:lib/dexc.rb:83>   end
   Dexc#start: false
 2:lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45>       return gem_original_require(path)
   Kernel#gem_original_require: true
 3:lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45>       return gem_original_require(path)
   Kernel#require: true
 4:t.rb:0>
   IO#set_encoding: #<File:t.rb (closed)>
 5:t.rb:0>
   IO#set_encoding: #<File:t.rb (closed)>
 6:t.rb:1> def m(obj)
   Module#method_added: nil
 7:t.rb:2>   obj.to_s + 1
   Fixnum#to_s: "0"
 8:t.rb:2>   obj.to_s + 1
   Exception#initialize: #<TypeError: no implicit conversion of Fixnum into String>
 9:t.rb:2>   obj.to_s + 1
   Class#new: #<TypeError: no implicit conversion of Fixnum into String>
10:t.rb:2>   obj.to_s + 1
   Exception#exception: #<TypeError: no implicit conversion of Fixnum into String>
11:t.rb:2>   obj.to_s + 1
   Exception#backtrace: nil

TypeError: no implicit conversion of Fixnum into String
        from t.rb:2:in `+'
        from t.rb:2:in `m'
        from t.rb:4:in `<main>'

From: t.rb @ line 2 Object#m:

    1: def m(obj)
 => 2:   obj.to_s + 1
    3: end

[1] pry(main)> obj
=> 0
[2] pry(main)> hist[7] # or dexc_hist[7]
=> "0"

About

A library that helps you to debug an exception in CRuby 2

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages