byebug 1.4.1 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +5 -0
- data/CHANGELOG.md +10 -0
- data/GUIDE.md +235 -9
- data/bin/byebug +12 -16
- data/byebug.gemspec +0 -1
- data/ext/byebug/byebug.c +5 -6
- data/lib/byebug.rb +17 -8
- data/lib/byebug/command.rb +12 -21
- data/lib/byebug/commands/breakpoints.rb +5 -9
- data/lib/byebug/commands/catchpoint.rb +2 -4
- data/lib/byebug/commands/condition.rb +4 -6
- data/lib/byebug/commands/continue.rb +2 -4
- data/lib/byebug/commands/control.rb +2 -4
- data/lib/byebug/commands/display.rb +4 -10
- data/lib/byebug/commands/edit.rb +2 -4
- data/lib/byebug/commands/enable.rb +6 -10
- data/lib/byebug/commands/eval.rb +12 -13
- data/lib/byebug/commands/finish.rb +2 -4
- data/lib/byebug/commands/frame.rb +6 -15
- data/lib/byebug/commands/help.rb +2 -3
- data/lib/byebug/commands/info.rb +5 -7
- data/lib/byebug/commands/jump.rb +2 -4
- data/lib/byebug/commands/kill.rb +2 -4
- data/lib/byebug/commands/list.rb +2 -4
- data/lib/byebug/commands/method.rb +4 -10
- data/lib/byebug/commands/quit.rb +2 -4
- data/lib/byebug/commands/reload.rb +1 -3
- data/lib/byebug/commands/repl.rb +3 -7
- data/lib/byebug/commands/save.rb +2 -4
- data/lib/byebug/commands/set.rb +4 -8
- data/lib/byebug/commands/show.rb +2 -4
- data/lib/byebug/commands/skip.rb +2 -4
- data/lib/byebug/commands/source.rb +1 -3
- data/lib/byebug/commands/stepping.rb +2 -4
- data/lib/byebug/commands/trace.rb +2 -4
- data/lib/byebug/commands/variables.rb +6 -18
- data/lib/byebug/version.rb +1 -1
- data/old_doc/byebug.texi +1 -9
- data/test/breakpoints_test.rb +1 -2
- data/test/examples/info.rb +5 -5
- data/test/examples/list.rb +21 -21
- data/test/examples/reload.rb +5 -5
- data/test/examples/repl.rb +6 -0
- data/test/examples/save.rb +2 -2
- data/test/examples/set.rb +2 -2
- data/test/examples/source.rb +2 -2
- data/test/finish_test.rb +1 -1
- data/test/help_test.rb +31 -15
- data/test/list_test.rb +27 -25
- data/test/reload_test.rb +3 -3
- data/test/repl_test.rb +8 -8
- data/test/set_test.rb +2 -12
- data/test/support/test_dsl.rb +25 -39
- data/test/variables_test.rb +0 -2
- metadata +4 -18
- data/test/examples/irb.rb +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 929419c640bdf958d5322f770be797f1d8bfd0c0
|
4
|
+
data.tar.gz: 6697013f9ff97a9e453cf777041f4108c3274c65
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62ad75b1a082c60a1cfe65c13fd654c538006cfcb0c02fc751658994a838b8e365ce659428e3381a4a4393feab58f62dec9268afd040bf1c4ebcc21f46a41f56
|
7
|
+
data.tar.gz: 21a6754ad1fa31fda1564c44fb1786c55de5d2f30e13c82fe8a8319ec70b62df8ec43499df3d1e95fd126a4c00aacb597e555c6ff488b711471ad1cd2f39c12c
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,16 @@
|
|
1
|
+
## 1.4.2
|
2
|
+
|
3
|
+
* Fixes crash when using "help command subcommand"
|
4
|
+
* Byebug now works with Rails Console debugging flag
|
5
|
+
* Fix post-mortem mode when running byebug from the outset
|
6
|
+
* Fix --no-quit flag when running byebug from the outset
|
7
|
+
|
8
|
+
|
1
9
|
## 1.4.1
|
2
10
|
|
3
11
|
* Fixes crash when printing some filenames in backtraces
|
12
|
+
* Allows byebug developers to easily use compilers different from gcc (thanks
|
13
|
+
@GarthSnyder!)
|
4
14
|
|
5
15
|
|
6
16
|
## 1.4.0
|
data/GUIDE.md
CHANGED
@@ -669,9 +669,9 @@ Options:
|
|
669
669
|
-d, --debug Set $DEBUG=true
|
670
670
|
-I, --include PATH Add PATH (single or multiple:path:list) to $LOAD_PATH
|
671
671
|
--no-quit Do not quit when script finishes
|
672
|
-
--no-rewrite-program Don't set $0 to the program debugged
|
673
672
|
--no-stop Do not stop when script is loaded
|
674
|
-
|
673
|
+
--nx Don't run any byebug initialization files
|
674
|
+
--post-mortem Enable post-mortem mode for uncaught exceptions
|
675
675
|
-r, --require SCRIPT Require library before script
|
676
676
|
--restart-script FILE Name of the script file to run. Erased after read
|
677
677
|
--script FILE Name of the script file to run
|
@@ -697,13 +697,10 @@ information without having to poll for it.
|
|
697
697
|
* **-d | --debug**. Set `$DEBUG` to `true`. Compatible with Ruby's.
|
698
698
|
* **-I | --include <path>**. Add `path` to load path. `path` can be a single
|
699
699
|
path ar a colon separated path list.
|
700
|
-
*
|
701
|
-
|
700
|
+
* **--post-mortem**. If your program raises an exception that isn't caught you
|
701
|
+
can enter byebug for inspection of what went wrong. You may also want to use
|
702
702
|
this option in conjunction with `--no-stop`. See also [Post-Mortem Debugging]().
|
703
703
|
* **--no-quit**. Restart `byebug` when your program terminates normally.
|
704
|
-
* **--no-rewrite-program**. Normally `byebug` will reset the program's name `$0`
|
705
|
-
from its name to the debugged program, and set the name in variable
|
706
|
-
`$BYEBUG_SCRIPT`. In the unlikely event you don't want to use this option.
|
707
704
|
* **--no-stop**. Normally `byebug` stops before executing the first statement.
|
708
705
|
If instead you want it to start running initially and perhaps break it later in
|
709
706
|
the execution, use this option.
|
@@ -753,6 +750,235 @@ puts "rocky's byebugrc run"
|
|
753
750
|
Here are the default values in `options`
|
754
751
|
|
755
752
|
```ruby
|
756
|
-
#<OpenStruct annotate=nil,
|
757
|
-
|
753
|
+
#<OpenStruct annotate=nil, nx=false, quit=true, restart_script=nil, script=nil,
|
754
|
+
stop=true, tracing=false, verbose_long=false>
|
755
|
+
```
|
756
|
+
|
757
|
+
## Command Files
|
758
|
+
|
759
|
+
A command file is a file of lines that are `byebug` commands. Comments (lines
|
760
|
+
starting with `#`) may also be included. An empty line in a command file does
|
761
|
+
nothing; it does not mean to repeat the last command, as it would from the
|
762
|
+
terminal.
|
763
|
+
|
764
|
+
When you start `byebug`, it automatically executes commands from its
|
765
|
+
_init file_, called `.byebugrc`. During startup, `byebug` does the following:
|
766
|
+
|
767
|
+
* __Processes command line options and operands.__ Reads the init file in your
|
768
|
+
current directory, if any, and then checks your home directory. The home
|
769
|
+
directory is the directory named in the `$HOME` or `$HOMEPATH` environment
|
770
|
+
variable. Thus, you can have more than one init file, one generic in your home
|
771
|
+
directory, and another, specific to the program you are debugging, in the
|
772
|
+
directory where you invoke `byebug`.
|
773
|
+
|
774
|
+
* __Reads command files specified by the `--script` option.__
|
775
|
+
|
776
|
+
You can also request the execution of a command file with the `source` command
|
777
|
+
(see [Source]()).
|
778
|
+
|
779
|
+
## Quitting byebug
|
780
|
+
|
781
|
+
Inside a byebug interpreter, use `quit` command to finish execution. Another way
|
782
|
+
to terminate byebug is to use the `kill` command. This does the more forceful
|
783
|
+
`kill -9`. It can be used in cases where `quit` doesn't work (I haven't seen it
|
784
|
+
yet).
|
785
|
+
|
786
|
+
## Calling byebug from inside your program
|
787
|
+
|
788
|
+
Running a program from byebug adds a bit of overhead and slows it down a little.
|
789
|
+
Furthermore, by necessity, debuggers change the operation of the program they
|
790
|
+
are debugging. And this can lead to unexpected and unwanted differences. It has
|
791
|
+
happened so often that the term
|
792
|
+
[Heisenbugs](http://en.wikipedia.org/wiki/Heisenbug}) was coined to describe the
|
793
|
+
situation where using a debugger (among other possibilities) changes the
|
794
|
+
behavior of the program so that the bug doesn't manifest itself anymore.
|
795
|
+
|
796
|
+
There is another way to get into byebug which adds no overhead or slowdown until
|
797
|
+
you reach the point at which you want to start debugging. However here you must
|
798
|
+
change the script and make an explicit call to byebug. Because byebug isn't
|
799
|
+
involved before the first call, there is no overhead and the script will run
|
800
|
+
at the same speed as if there were no byebug.
|
801
|
+
|
802
|
+
There are three parts to calling byebug from inside the script, ``requiring''
|
803
|
+
the gem, telling byebug to start tracking things and then making an explicit
|
804
|
+
breakpoints.
|
805
|
+
|
806
|
+
Unless you're using bundler, do this to get byebug class accessible from your
|
807
|
+
Ruby program
|
808
|
+
|
809
|
+
```ruby
|
810
|
+
require 'byebug'
|
811
|
+
```
|
812
|
+
|
813
|
+
To tell byebug to start tracking things, do
|
814
|
+
|
815
|
+
```ruby
|
816
|
+
Byebug.start
|
817
|
+
```
|
818
|
+
|
819
|
+
There is also a `Byebug.stop` to turn off byebug tracking. If speed is crucial,
|
820
|
+
you may want to start and stop this around certain sections of code.
|
821
|
+
Alternatively, instead of issuing an explicit `Byebug.stop` you can add a block
|
822
|
+
to the `Byebug.start` and debugging is turned on for that block. If the block of
|
823
|
+
code raises an uncaught exception that would cause the block to terminate, the
|
824
|
+
`stop` will occur. See [here](Byebug.start with a block).
|
825
|
+
|
826
|
+
And finally to enter byebug
|
827
|
+
|
828
|
+
```ruby
|
829
|
+
byebug
|
830
|
+
```
|
831
|
+
|
832
|
+
When `byebug`is run, `.byebugrc` is read.
|
833
|
+
|
834
|
+
You may want to enter byebug at several points in the program where there is a
|
835
|
+
problem you want to investigate. And since `byebug` is just a method call it's
|
836
|
+
possible to enclose it in a conditional expression, for example
|
837
|
+
|
838
|
+
```ruby
|
839
|
+
byebug if 'bar' == foo and 20 == iter_count
|
840
|
+
```
|
841
|
+
|
842
|
+
## Byebug Command Reference
|
843
|
+
|
844
|
+
## Command Syntax
|
845
|
+
Usually a command is put on a single line. There is no limit on how long it can be.
|
846
|
+
It starts with a command name, which is followed by arguments whose meaning depends
|
847
|
+
on the command name. For example, the command `step` accepts an argument which is the
|
848
|
+
number of times to step, as in `step 5`. You can also use the `step` command with no
|
849
|
+
arguments. Some commands do not allow any arguments.
|
850
|
+
|
851
|
+
Multiple commands can be put on a line by separating each with a semicolon `;`. You
|
852
|
+
can disable the meaning of a semicolon to separate commands by escaping it with a
|
853
|
+
backslash.
|
854
|
+
|
855
|
+
For example, if you have [autoeval]() set, which is the default, you might want to
|
856
|
+
enter the following code to compute the 5th Fibonacci number.
|
857
|
+
|
858
|
+
```
|
859
|
+
(byebug) fib1=0; fib2=1; 5.times {|temp| temp=fib1; fib1=fib2; fib2 += temp }
|
860
|
+
0
|
861
|
+
1
|
862
|
+
SyntaxError Exception: /home/davidr/Proyectos/sample_app/trace.rb:1: syntax
|
863
|
+
error, unexpected end-of-input, expecting '}'
|
864
|
+
5.times { |temp| temp=fib1
|
865
|
+
^
|
866
|
+
nil
|
867
|
+
1
|
868
|
+
SyntaxError Exception: /home/davidr/Proyectos/sample_app/trace.rb:1: syntax
|
869
|
+
error, unexpected tSTRING_DEND, expecting end-of-input
|
870
|
+
fib2 += temp }
|
871
|
+
^
|
872
|
+
nil
|
873
|
+
(byebug) fib1=0\; fib2=1\; 5.times {|temp| temp=fib1\; fib1=fib2\; fib2 += temp }
|
874
|
+
5
|
875
|
+
(byebug) fib2
|
876
|
+
8
|
877
|
+
```
|
878
|
+
|
879
|
+
You might also consider using the [irb]() or [pry]() commands and then you won't have
|
880
|
+
to escape semicolons.
|
881
|
+
|
882
|
+
A blank line as input (typing just `<RET>`) means to repeat the previous command.
|
883
|
+
|
884
|
+
Byebug uses readline, which handles line editing and retrieval of previous commands.
|
885
|
+
Up arrow, for example, moves to the previous byebug command; down arrow moves to the
|
886
|
+
next more recent command (provided you are not already at the last command). Command
|
887
|
+
history is saved in file `.byebug_hist`. A limit is put on the history size. You
|
888
|
+
can see this with the `show history size` command. See [history]() for history
|
889
|
+
parameters.
|
890
|
+
|
891
|
+
### Command Output
|
892
|
+
In the command-line interface, when `byebug` is waiting for input it presents a
|
893
|
+
prompt of the form `(byebug)`. If the program has terminated normally the prompt will
|
894
|
+
be `(byebug:ctrl)` and in post-mortem debugging it will be
|
895
|
+
`(byebug:post-mortem)`.
|
896
|
+
|
897
|
+
Whenever `byebug` gives an error message such as for an invalid command or an invalid
|
898
|
+
location position, it will generally preface the message with `***`. However if
|
899
|
+
annotation mode is on then the message is put in a `begin-error` annotation and no
|
900
|
+
`***` appears.
|
901
|
+
|
902
|
+
### Help
|
903
|
+
Once inside `byebug` you can always ask it for information on its commands using the
|
904
|
+
`help` command. You can use `help` (abbreviated `h`) with no arguments to display a
|
905
|
+
short list of named classes of commands
|
906
|
+
|
907
|
+
```
|
908
|
+
(byebug) `help`
|
909
|
+
Type "help <command-name>" for help on a specific command
|
910
|
+
|
911
|
+
Available commands:
|
912
|
+
backtrace catch continue disable down enable exit frame
|
913
|
+
info jump list next pp putl reload save
|
914
|
+
show source trace up where break condition delete
|
915
|
+
display edit eval finish help irb kill method
|
916
|
+
p ps quit restart set skip step undisplay
|
917
|
+
var
|
918
|
+
```
|
919
|
+
|
920
|
+
With a command name as `help` argument, `byebug` displays short information on how to
|
921
|
+
use that command.
|
922
|
+
|
923
|
+
```
|
924
|
+
(byebug) help list
|
925
|
+
l[ist] list forward
|
926
|
+
l[ist] - list backward
|
927
|
+
l[ist] = list current line
|
928
|
+
l[ist] nn-mm list given lines
|
929
|
+
* NOTE - to turn on autolist, use 'set autolist'
|
930
|
+
(byebug)
|
931
|
+
```
|
932
|
+
|
933
|
+
A number of commands, namely `info`, `set`, `show`, `enable` and `disable`, have many
|
934
|
+
sub-parameters or _subcommands_. When you ask for help for one of these commands, you
|
935
|
+
will get help for all of the subcommands that command offers. Sometimes you may want
|
936
|
+
help only on a subcommand and to do this just follow the command with its subcommand
|
937
|
+
name. For example `help set annotate` will just give help about the annotate command.
|
938
|
+
Furthermore it will give longer help than the summary information that appears when
|
939
|
+
you ask for help. You don't need to list the full subcommand name, just enough
|
940
|
+
letters to make that subcommand distinct from others will do. For example,
|
941
|
+
`help set an` is the same as `help set annotate`.
|
942
|
+
|
943
|
+
Some examples follow.
|
944
|
+
|
945
|
+
```
|
946
|
+
(byebug) help info
|
947
|
+
info[ subcommand]
|
948
|
+
|
949
|
+
Generic command for showing things about the program being debugged.
|
950
|
+
|
951
|
+
--
|
952
|
+
List of "info" subcommands:
|
953
|
+
--
|
954
|
+
info args -- Argument variables of current stack frame
|
955
|
+
info breakpoints -- Status of user-settable breakpoints
|
956
|
+
info catch -- Exceptions that can be caught in the current stack
|
957
|
+
frame
|
958
|
+
info display -- Expressions to display when program stops
|
959
|
+
info file -- Info about a particular file read in
|
960
|
+
info files -- File names and timestamps of files read in
|
961
|
+
info global_variables -- Global variables
|
962
|
+
info instance_variables -- Instance variables of the current stack frame
|
963
|
+
info line -- Line number and file name of current position in
|
964
|
+
source file
|
965
|
+
info locals -- Local variables of the current stack frame
|
966
|
+
info program -- Execution status of the program
|
967
|
+
info stack -- Backtrace of the stack
|
968
|
+
info variables -- Local and instance variables of the current stack
|
969
|
+
frame
|
970
|
+
```
|
971
|
+
|
972
|
+
```
|
973
|
+
(byebug) help info breakpoints
|
974
|
+
Status of user-settable breakpoints.
|
975
|
+
Without argument, list info about all breakpoints.
|
976
|
+
With an integer argument, list info on that breakpoint.
|
977
|
+
```
|
978
|
+
|
979
|
+
```
|
980
|
+
(byebug) help info br
|
981
|
+
Status of user-settable breakpoints.
|
982
|
+
Without argument, list info about all breakpoints.
|
983
|
+
With an integer argument, list info on that breakpoint.
|
758
984
|
```
|
data/bin/byebug
CHANGED
@@ -28,7 +28,7 @@
|
|
28
28
|
# Add <i>path</i> to <tt>$LOAD_PATH</tt>. Like the <tt>ruby -I</tt> command,
|
29
29
|
# it supports multiple load paths separated by colons.
|
30
30
|
#
|
31
|
-
#<tt
|
31
|
+
#<tt>--post-mortem</tt>::
|
32
32
|
# Activate post-mortem mode.
|
33
33
|
#
|
34
34
|
#<tt>--no-quit</tt>::
|
@@ -77,10 +77,9 @@ def debug_program(options)
|
|
77
77
|
print "\032\032starting\n" if Byebug.annotate and Byebug.annotate > 2
|
78
78
|
|
79
79
|
# Record where we are we can know if the call stack has been truncated or not.
|
80
|
-
Byebug.start_sentinal=caller
|
80
|
+
Byebug.start_sentinal = caller[0]
|
81
81
|
|
82
|
-
bt = Byebug.debug_load(Byebug::PROG_SCRIPT, options.stop)
|
83
|
-
if bt
|
82
|
+
if bt = Byebug.debug_load(Byebug::PROG_SCRIPT, options.stop)
|
84
83
|
print bt.backtrace.map{|l| "\t#{l}"}.join("\n"), "\n"
|
85
84
|
print "Uncaught exception: #{bt}\n"
|
86
85
|
end
|
@@ -103,8 +102,8 @@ end
|
|
103
102
|
|
104
103
|
options = OpenStruct.new(
|
105
104
|
'annotate' => Byebug.annotate,
|
106
|
-
'no_rewrite_program' => false,
|
107
105
|
'nx' => false,
|
106
|
+
'post_mortem' => false,
|
108
107
|
'quit' => true,
|
109
108
|
'restart_script' => nil,
|
110
109
|
'script' => nil,
|
@@ -132,12 +131,12 @@ EOB
|
|
132
131
|
|path| $LOAD_PATH.unshift(*path.split(':')) }
|
133
132
|
opts.on('--no-quit', 'Do not quit when script finishes') {
|
134
133
|
options.quit = false }
|
135
|
-
opts.on('--no-rewrite-program', 'Don\'t set $0 to the program debugged') {
|
136
|
-
options.no_rewrite_program = true }
|
137
134
|
opts.on('--no-stop', 'Do not stop when script is loaded') {
|
138
135
|
options.stop = false }
|
139
136
|
opts.on('-nx', 'Don\'t run any byebug initialization files') {
|
140
137
|
options.nx = true }
|
138
|
+
opts.on('--post-mortem', 'Run byebug in post-mortem mode') {
|
139
|
+
options.post_mortem = true }
|
141
140
|
opts.on('-r', '--require SCRIPT', String, 'Require library before script') {
|
142
141
|
|name| if name == 'debug'
|
143
142
|
puts 'byebug not compatible with Ruby\'s \'debug\' lib, option ignored'
|
@@ -227,7 +226,7 @@ prog_script = whence_file(prog_script) unless File.exist?(prog_script)
|
|
227
226
|
Byebug::PROG_SCRIPT = File.expand_path prog_script
|
228
227
|
|
229
228
|
# Set up trace hook for byebug
|
230
|
-
Byebug.start
|
229
|
+
Byebug.start post_mortem: options.post_mortem
|
231
230
|
|
232
231
|
# load initrc script (e.g. .byebugrc)
|
233
232
|
Byebug.run_init_script(StringIO.new) unless options.nx
|
@@ -247,10 +246,7 @@ end
|
|
247
246
|
options.stop = false if options.tracing
|
248
247
|
Byebug.tracing = options.tracing
|
249
248
|
|
250
|
-
|
251
|
-
if Byebug.started?
|
252
|
-
until Byebug.stop do end
|
253
|
-
end
|
249
|
+
loop do
|
254
250
|
begin
|
255
251
|
debug_program(options)
|
256
252
|
rescue SyntaxError
|
@@ -260,13 +256,13 @@ if !options.quit
|
|
260
256
|
print $!.backtrace.map{|l| "\t#{l}"}.join("\n"), "\n"
|
261
257
|
print "Uncaught exception: #{$!}\n"
|
262
258
|
end
|
263
|
-
print "The program finished.\n" unless
|
264
|
-
|
259
|
+
print "The program finished.\n" unless Byebug.annotate.to_i > 1
|
260
|
+
|
261
|
+
break if options.quit
|
262
|
+
|
265
263
|
interface = Byebug::LocalInterface.new
|
266
264
|
# Not sure if ControlCommandProcessor is really the right
|
267
265
|
# thing to use. CommandProcessor requires a state.
|
268
266
|
processor = Byebug::ControlCommandProcessor.new(interface)
|
269
267
|
processor.process_commands
|
270
|
-
else
|
271
|
-
debug_program(options)
|
272
268
|
end
|
data/byebug.gemspec
CHANGED
data/ext/byebug/byebug.c
CHANGED
@@ -449,11 +449,12 @@ Byebug_load(int argc, VALUE *argv, VALUE self)
|
|
449
449
|
{
|
450
450
|
VALUE file, stop, context_obj;
|
451
451
|
debug_context_t *dc;
|
452
|
+
VALUE status = Qnil;
|
452
453
|
int state = 0;
|
453
454
|
|
454
455
|
if (rb_scan_args(argc, argv, "11", &file, &stop) == 1)
|
455
456
|
{
|
456
|
-
|
457
|
+
stop = Qfalse;
|
457
458
|
}
|
458
459
|
|
459
460
|
Byebug_start(self);
|
@@ -470,17 +471,15 @@ Byebug_load(int argc, VALUE *argv, VALUE self)
|
|
470
471
|
rb_load_protect(file, 0, &state);
|
471
472
|
if (0 != state)
|
472
473
|
{
|
473
|
-
|
474
|
-
|
475
|
-
rb_set_errinfo(Qnil);
|
476
|
-
return errinfo;
|
474
|
+
status = rb_errinfo();
|
475
|
+
reset_stepping_stop_points(dc);
|
477
476
|
}
|
478
477
|
|
479
478
|
/* We should run all at_exit handler's in order to provide, for instance, a
|
480
479
|
* chance to run all defined test cases */
|
481
480
|
rb_exec_end_proc();
|
482
481
|
|
483
|
-
return
|
482
|
+
return status;
|
484
483
|
}
|
485
484
|
|
486
485
|
static VALUE
|
data/lib/byebug.rb
CHANGED
@@ -111,15 +111,13 @@ module Byebug
|
|
111
111
|
Byebug.const_set('INITIAL_DIR', Dir.pwd) unless defined? Byebug::INITIAL_DIR
|
112
112
|
end
|
113
113
|
Byebug.tracing = options[:tracing] unless options[:tracing].nil?
|
114
|
-
Byebug.start_sentinal=caller
|
114
|
+
Byebug.start_sentinal = caller[0]
|
115
115
|
if Byebug.started?
|
116
116
|
retval = block && block.call(self)
|
117
117
|
else
|
118
118
|
retval = Byebug._start(&block)
|
119
119
|
end
|
120
|
-
if options[:post_mortem]
|
121
|
-
post_mortem
|
122
|
-
end
|
120
|
+
post_mortem if options[:post_mortem]
|
123
121
|
return retval
|
124
122
|
end
|
125
123
|
|
@@ -189,7 +187,7 @@ module Byebug
|
|
189
187
|
return if self.post_mortem?
|
190
188
|
self.post_mortem = true
|
191
189
|
debug_at_exit do
|
192
|
-
handle_post_mortem($!) if
|
190
|
+
handle_post_mortem($!) if post_mortem?
|
193
191
|
end
|
194
192
|
end
|
195
193
|
end
|
@@ -286,9 +284,9 @@ module Rails
|
|
286
284
|
::Byebug.start
|
287
285
|
puts "=> Byebug enabled"
|
288
286
|
rescue LoadError
|
289
|
-
puts "You're missing the 'byebug' gem. Add it to your Gemfile,
|
290
|
-
"it and try again."
|
291
|
-
exit
|
287
|
+
puts "You're missing the 'byebug' gem. Add it to your Gemfile, " \
|
288
|
+
"bundle it and try again."
|
289
|
+
exit
|
292
290
|
end
|
293
291
|
|
294
292
|
def call(env)
|
@@ -296,4 +294,15 @@ module Rails
|
|
296
294
|
end
|
297
295
|
end
|
298
296
|
end
|
297
|
+
|
298
|
+
class Console
|
299
|
+
def require_debugger
|
300
|
+
require 'byebug'
|
301
|
+
puts "=> Byebug enabled"
|
302
|
+
rescue LoadError
|
303
|
+
puts "You're missing the 'byebug' gem. Add it to your Gemfile, bundle, " \
|
304
|
+
"it and try again."
|
305
|
+
exit
|
306
|
+
end
|
307
|
+
end
|
299
308
|
end
|