Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
ruby / usr / share / ri / 2.2.0 / system / DEBUGGER__ / cdesc-DEBUGGER__.ri
Size: Mime:
U:RDoc::NormalClass[iI"DEBUGGER__:ET@I"Object;To:RDoc::Markup::Document:@parts[o;;[Do:RDoc::Markup::Paragraph;[I";This library provides debugging functionality to Ruby.;To:RDoc::Markup::BlankLineo;	;[I"HTo add a debugger to your code, start by requiring +debug+ in your ;TI"
program:;T@o:RDoc::Markup::Verbatim;[	I"def say(word)
;TI"  require 'debug'
;TI"  puts word
;TI"	end
;T:@format0o;	;[I"RThis will cause Ruby to interrupt execution and show a prompt when the +say+ ;TI"method is run.;T@o;	;[I"IOnce you're inside the prompt, you can start debugging your program.;T@o;;[I"(rdb:1) p word
;TI"
"hello"
;T;0S:RDoc::Markup::Heading:
leveli:	textI"Getting help;T@o;	;[I"2You can get help at any time by pressing +h+.;T@o;;[-I"(rdb:1) h
;TI"Debugger help v.-0.002b
;TI"Commands
;TI"+  b[reak] [file:|class:]<line|method>
;TI"%  b[reak] [class.]<line|method>
;TI"B                             set breakpoint to some position
;TI"D  wat[ch] <expression>       set watchpoint to some expression
;TI"A  cat[ch] (<exception>|off)  set catchpoint to an exception
;TI"3  b[reak]                    list breakpoints
;TI"2  cat[ch]                    show catchpoint
;TI"A  del[ete][ nnn]             delete some or all breakpoints
;TI"N  disp[lay] <expression>     add expression into display expression list
;TI"S  undisp[lay][ nnn]          delete one particular or all display expressions
;TI"K  c[ont]                     run until program ends or hit breakpoint
;TI"P  s[tep][ nnn]               step (into methods) one line or till line nnn
;TI"D  n[ext][ nnn]               go over one line or till line nnn
;TI"1  w[here]                    display frames
;TI"2  f[rame]                    alias for where
;TI"B  l[ist][ (-|nn-mm)]         list program, - lists backwards
;TI":                             nn-mm lists given lines
;TI"7  up[ nn]                    move to higher frame
;TI"6  down[ nn]                  move to lower frame
;TI"8  fin[ish]                   return to outer frame
;TI"C  tr[ace] (on|off)           set trace mode of current thread
;TI"@  tr[ace] (on|off) all       set trace mode of all threads
;TI"5  q[uit]                     exit from debugger
;TI"8  v[ar] g[lobal]             show global variables
;TI"7  v[ar] l[ocal]              show local variables
;TI"D  v[ar] i[nstance] <object>  show instance variables of object
;TI";  v[ar] c[onst] <object>     show constants of object
;TI"9  m[ethod] i[nstance] <obj>  show methods of object
;TI"K  m[ethod] <class|module>    show instance methods of class or module
;TI"3  th[read] l[ist]            list all threads
;TI"6  th[read] c[ur[rent]]       show current thread
;TI"?  th[read] [sw[itch]] <nnn>  switch thread context to nnn
;TI"2  th[read] stop <nnn>        stop thread nnn
;TI"4  th[read] resume <nnn>      resume thread nnn
;TI"J  p expression               evaluate expression and print its value
;TI"2  h[elp]                     print this help
;TI"+  <everything else>          evaluate
;T;0S;
;i;I"
Usage;T@o;	;[I"IThe following is a list of common functionalities that the debugger ;TI"provides.;T@S;
;i;I"!Navigating through your code;T@o;	;[I"HIn general, a debugger is used to find bugs in your program, which ;TI"Joften means pausing execution and inspecting variables at some point ;TI"
in time.;T@o;	;[I"Let's look at an example:;T@o;;[
I"def my_method(foo)
;TI"  require 'debug'
;TI"!  foo = get_foo if foo.nil?
;TI"  raise if foo.nil?
;TI"	end
;T;0o;	;[I"JWhen you run this program, the debugger will kick in just before the ;TI"+foo+ assignment.;T@o;;[I"(rdb:1) p foo
;TI"	nil
;T;0o;	;[I"GIn this example, it'd be interesting to move to the next line and ;TI"Ginspect the value of +foo+ again. You can do that by pressing +n+:;T@o;;[I"#(rdb:1) n # goes to next line
;TI"(rdb:1) p foo
;TI"	nil
;T;0o;	;[I"HYou now know that the original value of +foo+ was nil, and that it ;TI"+still was nil after calling +get_foo+.;T@o;	;[I"@Other useful commands for navigating through your code are:;T@o:RDoc::Markup::List:
@type:	NOTE:@items[	o:RDoc::Markup::ListItem:@label[I"+c+;T;[o;	;[I"ORuns the program until it either exists or encounters another breakpoint. ;TI"LYou usually press +c+ when you are finished debugging your program and ;TI""want to resume its execution.;To;;[I"+s+;T;[o;	;[I"OSteps into method definition. In the previous example, +s+ would take you ;TI"/inside the method definition of +get_foo+.;To;;[I"+r+;T;[o;	;[I"Restart the program.;To;;[I"+q+;T;[o;	;[I"Quit the program.;T@S;
;i;I"Inspecting variables;T@o;	;[I"QYou can use the debugger to easily inspect both local and global variables. ;TI"6We've seen how to inspect local variables before:;T@o;;[I"(rdb:1) p my_arg
;TI"42
;T;0o;	;[I"FYou can also pretty print the result of variables or expressions:;T@o;;[I"A(rdb:1) pp %w{a very long long array containing many words}
;TI"["a",
;TI" "very",
;TI" "long",
;TI"
 ...
;TI"]
;T;0o;	;[I"1You can list all local variables with +v l+:;T@o;;[I"(rdb:1) v l
;TI"  foo => "hello"
;T;0o;	;[I"=Similarly, you can show all global variables with +v g+:;T@o;;[I"(rdb:1) v g
;TI"  all global variables
;T;0o;	;[I"LFinally, you can omit +p+ if you simply want to evaluate a variable or ;TI"expression;T@o;;[I"(rdb:1) 5**2
;TI"25
;T;0S;
;i;I"Going beyond basics;T@o;	;[I"FRuby Debug provides more advanced functionalities like switching ;TI"Kbetween threads, setting breakpoints and watch expressions, and more. ;TI"HThe full list of commands is available at any time by pressing +h+.;T@S;
;i;I"Staying out of trouble;T@o;	;[I"EMake sure you remove every instance of +require 'debug'+ before ;TI"Eshipping your code. Failing to do so may result in your program ;TI"hanging unpredictably.;T@o;	;[I")Debug is not available in safe mode.;T:
@fileI"lib/debug.rb;T:0@omit_headings_from_table_of_contents_below0;0;0[[[[[I"
class;T[[:public[[I"break_points;FI"lib/debug.rb;T[I"context;F@è[I"debug_thread_info;F@è[I"display;F@è[I"get_thread;F@è[I"interrupt;F@è[I"make_thread_list;F@è[I"resume;F@è[I"set_last_thread;F@è[I"set_trace;F@è[I"stdout;F@è[I"stdout=;F@è[I"suspend;F@è[I"thread_list;F@è[I"thread_list_all;F@è[I"waiting;F@è[:protected[[:private[[I"
instance;T[[;[[;[[;[[[U:RDoc::Context::Section[i0o;;[;0;0[@Ü@ÜcRDoc::TopLevel