byebug 8.2.2 → 8.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -1
- data/GUIDE.md +6 -6
- data/README.md +18 -5
- data/bin/byebug +2 -0
- data/ext/byebug/breakpoint.c +1 -1
- data/ext/byebug/byebug.c +1 -1
- data/ext/byebug/byebug.h +38 -36
- data/ext/byebug/context.c +1 -1
- data/ext/byebug/extconf.rb +0 -11
- data/ext/byebug/locker.c +1 -1
- data/ext/byebug/threads.c +1 -1
- data/lib/byebug/commands/break.rb +3 -3
- data/lib/byebug/commands/help.rb +1 -1
- data/lib/byebug/commands/irb.rb +14 -1
- data/lib/byebug/commands/list.rb +4 -4
- data/lib/byebug/helpers/eval.rb +1 -1
- data/lib/byebug/history.rb +1 -1
- data/lib/byebug/interface.rb +1 -0
- data/lib/byebug/interfaces/local_interface.rb +24 -7
- data/lib/byebug/interfaces/remote_interface.rb +1 -1
- data/lib/byebug/option_setter.rb +1 -1
- data/lib/byebug/printers/base.rb +2 -2
- data/lib/byebug/runner.rb +14 -3
- data/lib/byebug/subcommands.rb +1 -1
- data/lib/byebug/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3de52e0debad720f122829e148b9b492a2acba4d
|
4
|
+
data.tar.gz: ded3f66ec7d142c98f96448e140bf4084cd26c74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8b995f94420f0a6ea19f7adcabd403ab987e2fe0bb5b416eeae799c795faf59d4d93fea0b9e04016690d103e17f27ab4e6f4fc1e2c8b07d6b94448c00f213ef
|
7
|
+
data.tar.gz: 7c3f70142d4f637bc2d40a4564d5b894d0bcee68f96eb655f1c63cce015f5dd10af6fed4bb1fcb10fdbe235f1648292720c6843ee4aaf256efa427c7e007b5cf
|
data/CHANGELOG.md
CHANGED
@@ -2,7 +2,17 @@
|
|
2
2
|
|
3
3
|
## Master (Unreleased)
|
4
4
|
|
5
|
-
## 8.2.
|
5
|
+
## 8.2.3 - 2016-04-07
|
6
|
+
|
7
|
+
### Fixed
|
8
|
+
|
9
|
+
* Better interaction with utilities like RSpec when hitting Ctrl-C.
|
10
|
+
* `irb` command when original program modified ARGV (#197, thanks @josephks).
|
11
|
+
* Unusable debugger when stdin redirected (#211,thanks @sethk).
|
12
|
+
* RC file loading when no explicit flag included (#223).
|
13
|
+
* Installation on some Windows systems (#175, #226).
|
14
|
+
|
15
|
+
## 8.2.2 - 2016-02-01
|
6
16
|
|
7
17
|
### Fixed
|
8
18
|
|
data/GUIDE.md
CHANGED
@@ -84,7 +84,7 @@ Now let us step through the program.
|
|
84
84
|
8:
|
85
85
|
9: tri
|
86
86
|
10: end
|
87
|
-
(byebug)
|
87
|
+
(byebug) eval tri
|
88
88
|
nil
|
89
89
|
(byebug) step
|
90
90
|
|
@@ -99,7 +99,7 @@ nil
|
|
99
99
|
9: tri
|
100
100
|
10: end
|
101
101
|
11:
|
102
|
-
(byebug)
|
102
|
+
(byebug) eval tri
|
103
103
|
0
|
104
104
|
```
|
105
105
|
|
@@ -107,7 +107,7 @@ The first `step` command runs the script one executable unit. The second command
|
|
107
107
|
we entered was just hitting the return key: `byebug` remembers the last command
|
108
108
|
you entered was `step` and runs it again.
|
109
109
|
|
110
|
-
One way to print the values of variables is `
|
110
|
+
One way to print the values of variables is `eval` (there are other ways). When we
|
111
111
|
look at the value of `tri` the first time, we see it is `nil`. Again we are
|
112
112
|
stopped _before_ the assignment on line 5, and this variable hadn't been set
|
113
113
|
previously. However after issuing another `step` command we see that the value
|
@@ -447,7 +447,7 @@ NameError Exception: undefined local variable or method `n_args' for main:Object
|
|
447
447
|
=> 28: hanoi(n, :a, :b, :c)
|
448
448
|
(byebug) n_args
|
449
449
|
0
|
450
|
-
(byebug)
|
450
|
+
(byebug) eval n
|
451
451
|
3
|
452
452
|
(byebug) down 2
|
453
453
|
|
@@ -462,12 +462,12 @@ NameError Exception: undefined local variable or method `n_args' for main:Object
|
|
462
462
|
8:
|
463
463
|
9: hanoi(n - 1, c, b, a) if n - 1 > 0
|
464
464
|
10: end
|
465
|
-
(byebug)
|
465
|
+
(byebug) eval n
|
466
466
|
2
|
467
467
|
```
|
468
468
|
|
469
469
|
Notice in the above to get the value of variable `n` we had to use a print
|
470
|
-
command like `
|
470
|
+
command like `eval n`. If we entered just `n`, that would be taken to mean byebug
|
471
471
|
command `next`. In the current scope, variable `n_args` is not defined. However
|
472
472
|
I can change to the top-most frame by using the `frame 2` command. Notice that
|
473
473
|
inside frame #2, the value of `n_args` can be shown. Also note that the value of
|
data/README.md
CHANGED
@@ -9,13 +9,13 @@
|
|
9
9
|
[gem]: https://img.shields.io/gem/v/byebug.svg
|
10
10
|
[gpa]: https://img.shields.io/codeclimate/github/deivid-rodriguez/byebug.svg
|
11
11
|
[cov]: https://img.shields.io/codeclimate/coverage/github/deivid-rodriguez/byebug.svg
|
12
|
-
[tip]: https://img.shields.io/gittip/
|
12
|
+
[tip]: https://img.shields.io/gittip/byebug.svg
|
13
13
|
[irc]: https://img.shields.io/badge/IRC%20(gitter)-devs%20%26%20users-brightgreen.svg
|
14
14
|
|
15
15
|
[gem_url]: https://rubygems.org/gems/byebug
|
16
16
|
[gpa_url]: https://codeclimate.com/github/deivid-rodriguez/byebug
|
17
17
|
[cov_url]: https://codeclimate.com/github/deivid-rodriguez/byebug
|
18
|
-
[tip_url]: https://gratipay.com
|
18
|
+
[tip_url]: https://gratipay.com/byebug
|
19
19
|
[irc_url]: https://gitter.im/deivid-rodriguez/byebug
|
20
20
|
|
21
21
|
Byebug is a simple to use, feature rich debugger for Ruby 2. It uses the new
|
@@ -67,9 +67,22 @@ Simply drop
|
|
67
67
|
|
68
68
|
byebug
|
69
69
|
|
70
|
-
wherever you want to start debugging and the execution will stop there.
|
71
|
-
|
72
|
-
|
70
|
+
wherever you want to start debugging and the execution will stop there.
|
71
|
+
If you were debugging Rails, for example, you would add `byebug` to your code.
|
72
|
+
|
73
|
+
```ruby
|
74
|
+
def index
|
75
|
+
byebug
|
76
|
+
@articles = Article.find_recent
|
77
|
+
```
|
78
|
+
|
79
|
+
And then start a Rails server.
|
80
|
+
|
81
|
+
```shell
|
82
|
+
bin/rails s
|
83
|
+
```
|
84
|
+
|
85
|
+
Once the execution gets to your `byebug` command you will get a debugging prompt.
|
73
86
|
|
74
87
|
## Byebug's commands
|
75
88
|
|
data/bin/byebug
CHANGED
data/ext/byebug/breakpoint.c
CHANGED
data/ext/byebug/byebug.c
CHANGED
data/ext/byebug/byebug.h
CHANGED
@@ -8,13 +8,13 @@
|
|
8
8
|
#define UNUSED(x) (void)(x)
|
9
9
|
|
10
10
|
/* flags */
|
11
|
-
#define CTX_FL_DEAD (1<<1)
|
12
|
-
#define CTX_FL_IGNORE (1<<2)
|
13
|
-
#define CTX_FL_SUSPEND (1<<3)
|
14
|
-
#define CTX_FL_TRACING (1<<4)
|
15
|
-
#define CTX_FL_WAS_RUNNING (1<<5)
|
16
|
-
#define CTX_FL_STOP_ON_RET (1<<6)
|
17
|
-
#define CTX_FL_IGNORE_STEPS (1<<7)
|
11
|
+
#define CTX_FL_DEAD (1<<1) /* this context belonged to a dead thread */
|
12
|
+
#define CTX_FL_IGNORE (1<<2) /* this context belongs to ignored thread */
|
13
|
+
#define CTX_FL_SUSPEND (1<<3) /* thread currently suspended */
|
14
|
+
#define CTX_FL_TRACING (1<<4) /* call at_tracing method */
|
15
|
+
#define CTX_FL_WAS_RUNNING (1<<5) /* thread was previously running */
|
16
|
+
#define CTX_FL_STOP_ON_RET (1<<6) /* can stop on method 'end' */
|
17
|
+
#define CTX_FL_IGNORE_STEPS (1<<7) /* doesn't countdown steps to break */
|
18
18
|
|
19
19
|
/* macro functions */
|
20
20
|
#define CTX_FL_TEST(c,f) ((c)->flags & (f))
|
@@ -22,14 +22,16 @@
|
|
22
22
|
#define CTX_FL_UNSET(c,f) do { (c)->flags &= ~(f); } while (0)
|
23
23
|
|
24
24
|
/* types */
|
25
|
-
typedef enum
|
25
|
+
typedef enum
|
26
|
+
{
|
26
27
|
CTX_STOP_NONE,
|
27
28
|
CTX_STOP_STEP,
|
28
29
|
CTX_STOP_BREAKPOINT,
|
29
30
|
CTX_STOP_CATCHPOINT
|
30
31
|
} ctx_stop_reason;
|
31
32
|
|
32
|
-
typedef struct
|
33
|
+
typedef struct
|
34
|
+
{
|
33
35
|
int calced_stack_size;
|
34
36
|
int flags;
|
35
37
|
ctx_stop_reason stop_reason;
|
@@ -37,22 +39,24 @@ typedef struct {
|
|
37
39
|
VALUE thread;
|
38
40
|
int thnum;
|
39
41
|
|
40
|
-
int dest_frame;
|
41
|
-
int lines;
|
42
|
-
int steps;
|
43
|
-
int steps_out;
|
42
|
+
int dest_frame; /* next stop's frame if stopped by next */
|
43
|
+
int lines; /* # of lines in dest_frame before stopping */
|
44
|
+
int steps; /* # of steps before stopping */
|
45
|
+
int steps_out; /* # of returns before stopping */
|
44
46
|
|
45
|
-
VALUE backtrace;
|
47
|
+
VALUE backtrace; /* [[loc, self, klass, binding], ...] */
|
46
48
|
} debug_context_t;
|
47
49
|
|
48
|
-
typedef enum
|
50
|
+
typedef enum
|
51
|
+
{
|
49
52
|
LOCATION,
|
50
53
|
SELF,
|
51
54
|
CLASS,
|
52
55
|
BINDING
|
53
56
|
} frame_part;
|
54
57
|
|
55
|
-
struct call_with_inspection_data
|
58
|
+
struct call_with_inspection_data
|
59
|
+
{
|
56
60
|
debug_context_t *dc;
|
57
61
|
VALUE ctx;
|
58
62
|
ID id;
|
@@ -60,15 +64,19 @@ struct call_with_inspection_data {
|
|
60
64
|
VALUE *argv;
|
61
65
|
};
|
62
66
|
|
63
|
-
typedef struct
|
67
|
+
typedef struct
|
68
|
+
{
|
64
69
|
st_table *tbl;
|
65
70
|
} threads_table_t;
|
66
71
|
|
67
|
-
enum bp_type
|
72
|
+
enum bp_type
|
73
|
+
{ BP_POS_TYPE, BP_METHOD_TYPE };
|
68
74
|
|
69
|
-
enum hit_condition
|
75
|
+
enum hit_condition
|
76
|
+
{ HIT_COND_NONE, HIT_COND_GE, HIT_COND_EQ, HIT_COND_MOD };
|
70
77
|
|
71
|
-
typedef struct
|
78
|
+
typedef struct
|
79
|
+
{
|
72
80
|
int id;
|
73
81
|
enum bp_type type;
|
74
82
|
VALUE source;
|
@@ -93,9 +101,9 @@ extern void remove_from_locked(VALUE thread);
|
|
93
101
|
/* functions from threads.c */
|
94
102
|
extern void Init_threads_table(VALUE mByebug);
|
95
103
|
extern VALUE create_threads_table(void);
|
96
|
-
extern void thread_context_lookup(VALUE thread, VALUE *context);
|
104
|
+
extern void thread_context_lookup(VALUE thread, VALUE * context);
|
97
105
|
extern int is_living_thread(VALUE thread);
|
98
|
-
extern void acquire_lock(debug_context_t *dc);
|
106
|
+
extern void acquire_lock(debug_context_t * dc);
|
99
107
|
extern void release_lock(void);
|
100
108
|
|
101
109
|
/* global variables */
|
@@ -105,27 +113,21 @@ extern VALUE next_thread;
|
|
105
113
|
/* functions from context.c */
|
106
114
|
extern void Init_context(VALUE mByebug);
|
107
115
|
extern VALUE context_create(VALUE thread);
|
108
|
-
extern VALUE context_dup(debug_context_t *context);
|
109
|
-
extern void reset_stepping_stop_points(debug_context_t *context);
|
116
|
+
extern VALUE context_dup(debug_context_t * context);
|
117
|
+
extern void reset_stepping_stop_points(debug_context_t * context);
|
110
118
|
extern VALUE call_with_debug_inspector(struct call_with_inspection_data *data);
|
111
|
-
extern VALUE context_backtrace_set(const rb_debug_inspector_t *inspector,
|
119
|
+
extern VALUE context_backtrace_set(const rb_debug_inspector_t * inspector,
|
112
120
|
void *data);
|
113
121
|
|
114
122
|
/* functions from breakpoint.c */
|
115
123
|
extern void Init_breakpoint(VALUE mByebug);
|
116
|
-
extern VALUE catchpoint_hit_count(VALUE catchpoints,
|
117
|
-
VALUE
|
118
|
-
VALUE *exception_name);
|
124
|
+
extern VALUE catchpoint_hit_count(VALUE catchpoints, VALUE exception,
|
125
|
+
VALUE * exception_name);
|
119
126
|
|
120
|
-
extern VALUE find_breakpoint_by_pos(VALUE breakpoints,
|
121
|
-
VALUE source,
|
122
|
-
VALUE pos,
|
127
|
+
extern VALUE find_breakpoint_by_pos(VALUE breakpoints, VALUE source, VALUE pos,
|
123
128
|
VALUE bind);
|
124
129
|
|
125
|
-
extern VALUE find_breakpoint_by_method(VALUE breakpoints,
|
126
|
-
VALUE
|
127
|
-
VALUE mid,
|
128
|
-
VALUE bind,
|
129
|
-
VALUE self);
|
130
|
+
extern VALUE find_breakpoint_by_method(VALUE breakpoints, VALUE klass,
|
131
|
+
VALUE mid, VALUE bind, VALUE self);
|
130
132
|
|
131
133
|
#endif
|
data/ext/byebug/context.c
CHANGED
data/ext/byebug/extconf.rb
CHANGED
@@ -1,21 +1,10 @@
|
|
1
|
-
if RUBY_VERSION < '2.0'
|
2
|
-
STDERR.print("Ruby version is too old\n")
|
3
|
-
exit(1)
|
4
|
-
end
|
5
|
-
|
6
1
|
require 'mkmf'
|
7
2
|
|
8
3
|
makefile_config = RbConfig::MAKEFILE_CONFIG
|
9
4
|
|
10
5
|
makefile_config['CC'] = ENV['CC'] if ENV['CC']
|
11
6
|
|
12
|
-
makefile_config['CFLAGS'] << ' -Wall -Werror'
|
13
7
|
makefile_config['CFLAGS'] << ' -gdwarf-2 -g3 -O0' if ENV['debug']
|
14
8
|
|
15
|
-
if makefile_config['CC'] =~ /clang/
|
16
|
-
makefile_config['CFLAGS'] << ' -Wno-unknown-warning-option'
|
17
|
-
makefile_config['CFLAGS'] << ' -Wno-ignored-attributes'
|
18
|
-
end
|
19
|
-
|
20
9
|
dir_config('ruby')
|
21
10
|
with_cflags(makefile_config['CFLAGS']) { create_makefile('byebug/byebug') }
|
data/ext/byebug/locker.c
CHANGED
data/ext/byebug/threads.c
CHANGED
@@ -80,16 +80,16 @@ module Byebug
|
|
80
80
|
end
|
81
81
|
|
82
82
|
def add_line_breakpoint(file, line)
|
83
|
-
|
83
|
+
raise(pr('break.errors.source', file: file)) unless File.exist?(file)
|
84
84
|
|
85
85
|
fullpath = File.realpath(file)
|
86
86
|
|
87
87
|
if line > n_lines(file)
|
88
|
-
|
88
|
+
raise(pr('break.errors.far_line', lines: n_lines(file), file: fullpath))
|
89
89
|
end
|
90
90
|
|
91
91
|
unless Breakpoint.potential_line?(fullpath, line)
|
92
|
-
|
92
|
+
raise(pr('break.errors.line', file: fullpath, line: line))
|
93
93
|
end
|
94
94
|
|
95
95
|
Breakpoint.add(fullpath, line, @match[2])
|
data/lib/byebug/commands/help.rb
CHANGED
data/lib/byebug/commands/irb.rb
CHANGED
@@ -29,7 +29,20 @@ module Byebug
|
|
29
29
|
return errmsg(pr('base.errors.only_local'))
|
30
30
|
end
|
31
31
|
|
32
|
-
IRB.
|
32
|
+
# IRB tries to parse ARGV so we must clear it. See issue 197
|
33
|
+
with_clean_argv { IRB.start(__FILE__) }
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def with_clean_argv
|
39
|
+
saved_argv = ARGV.dup
|
40
|
+
ARGV.clear
|
41
|
+
begin
|
42
|
+
yield
|
43
|
+
ensure
|
44
|
+
ARGV.concat(saved_argv)
|
45
|
+
end
|
33
46
|
end
|
34
47
|
end
|
35
48
|
end
|
data/lib/byebug/commands/list.rb
CHANGED
@@ -36,11 +36,11 @@ module Byebug
|
|
36
36
|
|
37
37
|
def execute
|
38
38
|
msg = "No sourcefile available for #{frame.file}"
|
39
|
-
|
39
|
+
raise(msg) unless File.exist?(frame.file)
|
40
40
|
|
41
41
|
max_lines = n_lines(frame.file)
|
42
42
|
b, e = range(@match[2], max_lines)
|
43
|
-
|
43
|
+
raise('Invalid line range') unless valid_range?(b, e, max_lines)
|
44
44
|
|
45
45
|
display_lines(b, e)
|
46
46
|
|
@@ -85,11 +85,11 @@ module Byebug
|
|
85
85
|
|
86
86
|
def parse_range(input, size, max_line)
|
87
87
|
first, err = get_int(lower_bound(input), 'List', 1, max_line)
|
88
|
-
|
88
|
+
raise(err) unless first
|
89
89
|
|
90
90
|
if upper_bound(input)
|
91
91
|
last, err = get_int(upper_bound(input), 'List', 1, max_line)
|
92
|
-
|
92
|
+
raise(err) unless last
|
93
93
|
|
94
94
|
last = amend(last, max_line)
|
95
95
|
else
|
data/lib/byebug/helpers/eval.rb
CHANGED
data/lib/byebug/history.rb
CHANGED
data/lib/byebug/interface.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
require 'io/console'
|
3
|
+
|
2
4
|
module Byebug
|
3
5
|
#
|
4
6
|
# Interface class for standard byebug use.
|
@@ -8,23 +10,38 @@ module Byebug
|
|
8
10
|
|
9
11
|
def initialize
|
10
12
|
super()
|
11
|
-
@input =
|
12
|
-
|
13
|
-
|
13
|
+
@input = @output = @error = IO.console
|
14
|
+
Readline.input = @input
|
15
|
+
Readline.output = @output
|
14
16
|
end
|
15
17
|
|
16
18
|
#
|
17
|
-
# Reads a single line of input using Readline. If Ctrl-
|
18
|
-
#
|
19
|
-
# again. If Ctrl-D is pressed, it returns "continue".
|
19
|
+
# Reads a single line of input using Readline. If Ctrl-D is pressed, it
|
20
|
+
# returns "continue", meaning that program's execution will go on.
|
20
21
|
#
|
21
22
|
# @param prompt Prompt to be displayed.
|
22
23
|
#
|
23
24
|
def readline(prompt)
|
24
|
-
|
25
|
+
with_repl_like_sigint do
|
26
|
+
Readline.readline(prompt, false) || EOF_ALIAS
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
#
|
31
|
+
# Yields the block handling Ctrl-C the following way: if pressed while
|
32
|
+
# waiting for input, the line is reset to only the prompt and we ask for
|
33
|
+
# input again.
|
34
|
+
#
|
35
|
+
# @note Any external 'INT' traps are overriden during this method.
|
36
|
+
#
|
37
|
+
def with_repl_like_sigint
|
38
|
+
orig_handler = trap('INT') { raise Interrupt }
|
39
|
+
yield
|
25
40
|
rescue Interrupt
|
26
41
|
puts('^C')
|
27
42
|
retry
|
43
|
+
ensure
|
44
|
+
trap('INT', orig_handler)
|
28
45
|
end
|
29
46
|
end
|
30
47
|
end
|
data/lib/byebug/option_setter.rb
CHANGED
data/lib/byebug/printers/base.rb
CHANGED
@@ -26,7 +26,7 @@ module Byebug
|
|
26
26
|
end
|
27
27
|
break if result
|
28
28
|
end
|
29
|
-
|
29
|
+
raise MissedPath, "Can't find part path '#{path}'" unless result
|
30
30
|
result
|
31
31
|
end
|
32
32
|
|
@@ -35,7 +35,7 @@ module Byebug
|
|
35
35
|
string.gsub(/\|\w+$/, '').gsub(/([^#]?){([^}]*)}/) do
|
36
36
|
key = Regexp.last_match[2].to_s
|
37
37
|
unless args.key?(key.to_sym)
|
38
|
-
|
38
|
+
raise MissedArgument, "Missed argument #{key} for '#{string}'"
|
39
39
|
end
|
40
40
|
|
41
41
|
"#{Regexp.last_match[1]}#{args[key.to_sym]}"
|
data/lib/byebug/runner.rb
CHANGED
@@ -43,6 +43,11 @@ module Byebug
|
|
43
43
|
#
|
44
44
|
attr_accessor :stop
|
45
45
|
|
46
|
+
#
|
47
|
+
# Signals that we should run rc scripts before program starts
|
48
|
+
#
|
49
|
+
attr_writer :init_script
|
50
|
+
|
46
51
|
#
|
47
52
|
# @param stop [Boolean] Whether the runner should stop right before
|
48
53
|
# starting the program.
|
@@ -71,6 +76,10 @@ module Byebug
|
|
71
76
|
@remote ||= Byebug.parse_host_and_port(host_and_port)
|
72
77
|
end
|
73
78
|
|
79
|
+
def init_script
|
80
|
+
defined?(@init_script) ? @init_script : true
|
81
|
+
end
|
82
|
+
|
74
83
|
#
|
75
84
|
# Usage banner.
|
76
85
|
#
|
@@ -96,6 +105,8 @@ module Byebug
|
|
96
105
|
return
|
97
106
|
end
|
98
107
|
|
108
|
+
Byebug.run_init_script if init_script
|
109
|
+
|
99
110
|
setup_cmd_line_args
|
100
111
|
|
101
112
|
loop do
|
@@ -130,11 +141,11 @@ module Byebug
|
|
130
141
|
def setup_cmd_line_args
|
131
142
|
Byebug.mode = :standalone
|
132
143
|
|
133
|
-
|
144
|
+
raise(NoScript, 'You must specify a program to debug...') if $ARGV.empty?
|
134
145
|
|
135
146
|
program = which($ARGV.shift)
|
136
147
|
program = which($ARGV.shift) if program == which('ruby')
|
137
|
-
|
148
|
+
raise(NonExistentScript, "The script doesn't exist") unless program
|
138
149
|
|
139
150
|
$PROGRAM_NAME = program
|
140
151
|
end
|
@@ -144,7 +155,7 @@ module Byebug
|
|
144
155
|
#
|
145
156
|
def debug_program
|
146
157
|
ok = syntax_valid?(File.read($PROGRAM_NAME))
|
147
|
-
|
158
|
+
raise(InvalidScript, 'The script has incorrect syntax') unless ok
|
148
159
|
|
149
160
|
error = Byebug.debug_load($PROGRAM_NAME, stop)
|
150
161
|
puts "#{error}\n#{error.backtrace}" if error
|
data/lib/byebug/subcommands.rb
CHANGED
@@ -23,7 +23,7 @@ module Byebug
|
|
23
23
|
return puts(help) unless subcmd_name
|
24
24
|
|
25
25
|
subcmd = subcommand_list.match(subcmd_name)
|
26
|
-
|
26
|
+
raise CommandNotFound.new(subcmd_name, self.class) unless subcmd
|
27
27
|
|
28
28
|
subcmd.new(processor, arguments).execute
|
29
29
|
end
|
data/lib/byebug/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: byebug
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 8.2.
|
4
|
+
version: 8.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Rodriguez
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-
|
13
|
+
date: 2016-04-07 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -189,7 +189,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
189
189
|
version: '0'
|
190
190
|
requirements: []
|
191
191
|
rubyforge_project:
|
192
|
-
rubygems_version: 2.
|
192
|
+
rubygems_version: 2.6.0
|
193
193
|
signing_key:
|
194
194
|
specification_version: 4
|
195
195
|
summary: Ruby 2.0 fast debugger - base + CLI
|