• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Ruby Debug
 

Ruby Debug

on

  • 1,829 views

 

Statistics

Views

Total Views
1,829
Views on SlideShare
1,617
Embed Views
212

Actions

Likes
1
Downloads
8
Comments
0

7 Embeds 212

http://www.notch8.com 86
http://notch8.com 81
http://localhost 35
http://new.notch8.com 5
http://li165-184.members.linode.com 2
http://shielded-forest-1514.herokuapp.com 2
http://webcache.googleusercontent.com 1
More...

Accessibility

Categories

Upload Details

Uploaded via as OpenOffice

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Ruby Debug Ruby Debug Presentation Transcript

    • Notch8.com Slide No. 1 by Rob Kaufman rob@notch8.com http://notch8.com http://www.slideshare.net/notch8 http://speakerrate.com/notch8 @orangewolf
    • Notch8.com Ruby Debugger Slide No. 2 Ruby Debugger: Beyond “puts”
    • Notch8.com Ruby Debugger Slide No. 3 Installation Ruby 1.8 gem install ruby-debug Ruby 1.9.2 gem install ruby-debug19 Ruby 1.9.3 see http://blog.wyeworks.com/2011/11/1/ruby-1-9-3-and- ruby-debug
    • Notch8.com Ruby Debugger Slide No. 4 Bundler group :test, :development do gem "ruby-debug", :platform => :ruby_18 gem "ruby-debug19", :platform => :ruby_19 end
    • Notch8.com Ruby Debugger Slide No. 5 Basic Usage Starting a program in the debugger rdebug my_file.rb Starting with a running program debugger statement Starting the Rails server rails server --debugger
    • Notch8.com Ruby Debugger Slide No. 6 Debugger Commandsbacktrace putl finishdelete set jumpenable tmate phelp where reloadlist catch sourceps display undisplaysave exit continuethread irb editvar next framebreak quit killdisable show ppeval trace restartinfo condition stepmethod down up
    • Notch8.com Ruby Debugger Slide No. 7 Most Important h[elp] Displays the help message for an item or the list of commands (rdb:1) help delete del[ete][ nnn...] delete some or all breakpoints (rdb:1) help Available commands: backtrace delete enable help list ps save thread var break disable eval info method putl set tmate where catch display exit irb next quit show trace condition down finish jump p reload source undisplay continue edit frame kill pp restart step up
    • Notch8.com Ruby Debugger Slide No. 8 Seeing disp[lay] expression Displays value of expression undisp[lay] [ n] Removes display of n p expression Evaluates the expression m[ethod] i[instance] object Displays instance methods of object m[ethod] class| module Displays instance methods of the class or module
    • Notch8.com Ruby Debugger Slide No. 9 Seeing v[ar] g[lobal] Displays global variables v[ar] l[ocal] Displays local variables v[ar] i[instance] object Displays instance variables of object v[ar] c[onst] object Displays constants of object
    • Notch8.com Ruby Debugger Slide No. 10 Moving c[ont] Continues execution s[tep] [ n] Executes next n lines stepping into methods n[ext] [ n] Executes next n lines stepping over methods fin[ish] Finishes execution of the current method q[uit] Exits debugger
    • Notch8.com Ruby Debugger Slide No. 11 Where am I? w[here] Displays stack frame l[ist][<-| n- m>] Displays source lines from n to m up [ n] Moves up n levels in the stack frame down [ n] Moves down n levels in the stack frame
    • Notch8.com Ruby Debugger Slide No. 12 There are others:Setting and clearing breakpoints and watchpointsThread manipulation
    • Notch8.com Ruby Debugger Slide No. 13 What if Im in Passenger Rack-debug https://github.com/ddollar/rack-debug Add “rack-debug” to Gemfile for development In config/environments/development.rb require rack/debug # for rails 2.3.x config.middleware.use Rack::Debug # for rails 3.0.x config.middleware.use Rack::Debug Add “require rack-debug/tasks” to Rakefile Restart passenger Run the listener “rake debug”
    • Notch8.com Ruby Debugger Slide No. 14 What if Im Using an IDE? Ruby-debug-ide integrates with Emacs, Vim, Rubymine, etc
    • Notch8.com Ruby Debugger Slide No. 15 Next Steps The Rails Guide http://guides.rubyonrails.org/debugging_rails_applications.html Checkout Pry http://pry.github.com/
    • Notch8.com Slide No. 16 by Rob Kaufman rob@notch8.com http://notch8.com http://www.slideshare.net/notch8 http://speakerrate.com/notch8 @orangewolf