byebug 9.1.0 → 10.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +24 -3
- data/CONTRIBUTING.md +39 -18
- data/GUIDE.md +16 -17
- data/README.md +64 -52
- data/exe/byebug +6 -0
- data/ext/byebug/breakpoint.c +1 -1
- data/ext/byebug/byebug.c +16 -16
- data/ext/byebug/byebug.h +40 -26
- data/ext/byebug/context.c +26 -26
- data/ext/byebug/extconf.rb +7 -5
- data/ext/byebug/threads.c +8 -8
- data/lib/byebug.rb +3 -1
- data/lib/byebug/attacher.rb +17 -3
- data/lib/byebug/breakpoint.rb +25 -3
- data/lib/byebug/command.rb +20 -14
- data/lib/byebug/command_list.rb +3 -1
- data/lib/byebug/commands.rb +39 -37
- data/lib/byebug/commands/break.rb +33 -15
- data/lib/byebug/commands/catch.rb +16 -14
- data/lib/byebug/commands/condition.rb +11 -9
- data/lib/byebug/commands/continue.rb +9 -7
- data/lib/byebug/commands/debug.rb +7 -5
- data/lib/byebug/commands/delete.rb +11 -9
- data/lib/byebug/commands/disable.rb +8 -6
- data/lib/byebug/commands/disable/breakpoints.rb +7 -5
- data/lib/byebug/commands/disable/display.rb +7 -5
- data/lib/byebug/commands/display.rb +11 -9
- data/lib/byebug/commands/down.rb +10 -8
- data/lib/byebug/commands/edit.rb +10 -8
- data/lib/byebug/commands/enable.rb +8 -6
- data/lib/byebug/commands/enable/breakpoints.rb +7 -5
- data/lib/byebug/commands/enable/display.rb +7 -5
- data/lib/byebug/commands/finish.rb +8 -6
- data/lib/byebug/commands/frame.rb +11 -9
- data/lib/byebug/commands/help.rb +7 -5
- data/lib/byebug/commands/history.rb +7 -5
- data/lib/byebug/commands/info.rb +11 -9
- data/lib/byebug/commands/info/breakpoints.rb +17 -11
- data/lib/byebug/commands/info/display.rb +16 -7
- data/lib/byebug/commands/info/file.rb +12 -10
- data/lib/byebug/commands/info/line.rb +5 -3
- data/lib/byebug/commands/info/program.rb +8 -6
- data/lib/byebug/commands/interrupt.rb +8 -4
- data/lib/byebug/commands/irb.rb +9 -7
- data/lib/byebug/commands/kill.rb +9 -7
- data/lib/byebug/commands/list.rb +41 -46
- data/lib/byebug/commands/method.rb +10 -8
- data/lib/byebug/commands/next.rb +8 -6
- data/lib/byebug/commands/pry.rb +10 -8
- data/lib/byebug/commands/quit.rb +7 -5
- data/lib/byebug/commands/restart.rb +13 -11
- data/lib/byebug/commands/save.rb +9 -7
- data/lib/byebug/commands/set.rb +12 -10
- data/lib/byebug/commands/show.rb +7 -5
- data/lib/byebug/commands/source.rb +7 -5
- data/lib/byebug/commands/step.rb +8 -6
- data/lib/byebug/commands/thread.rb +11 -9
- data/lib/byebug/commands/thread/current.rb +6 -4
- data/lib/byebug/commands/thread/list.rb +7 -5
- data/lib/byebug/commands/thread/resume.rb +7 -5
- data/lib/byebug/commands/thread/stop.rb +6 -4
- data/lib/byebug/commands/thread/switch.rb +6 -4
- data/lib/byebug/commands/tracevar.rb +10 -8
- data/lib/byebug/commands/undisplay.rb +10 -8
- data/lib/byebug/commands/untracevar.rb +8 -6
- data/lib/byebug/commands/up.rb +10 -8
- data/lib/byebug/commands/var.rb +12 -10
- data/lib/byebug/commands/var/all.rb +7 -5
- data/lib/byebug/commands/var/args.rb +6 -4
- data/lib/byebug/commands/var/const.rb +9 -7
- data/lib/byebug/commands/var/global.rb +5 -3
- data/lib/byebug/commands/var/instance.rb +6 -4
- data/lib/byebug/commands/var/local.rb +6 -4
- data/lib/byebug/commands/where.rb +9 -7
- data/lib/byebug/context.rb +7 -5
- data/lib/byebug/core.rb +25 -25
- data/lib/byebug/errors.rb +4 -2
- data/lib/byebug/frame.rb +16 -16
- data/lib/byebug/helpers/bin.rb +28 -7
- data/lib/byebug/helpers/eval.rb +8 -6
- data/lib/byebug/helpers/file.rb +4 -2
- data/lib/byebug/helpers/frame.rb +5 -3
- data/lib/byebug/helpers/parse.rb +5 -3
- data/lib/byebug/helpers/path.rb +7 -5
- data/lib/byebug/helpers/reflection.rb +2 -0
- data/lib/byebug/helpers/string.rb +4 -2
- data/lib/byebug/helpers/thread.rb +10 -8
- data/lib/byebug/helpers/toggle.rb +10 -8
- data/lib/byebug/helpers/var.rb +8 -6
- data/lib/byebug/history.rb +7 -5
- data/lib/byebug/interface.rb +13 -11
- data/lib/byebug/interfaces/local_interface.rb +4 -4
- data/lib/byebug/interfaces/remote_interface.rb +21 -9
- data/lib/byebug/interfaces/script_interface.rb +2 -0
- data/lib/byebug/interfaces/test_interface.rb +5 -3
- data/lib/byebug/option_setter.rb +14 -12
- data/lib/byebug/printers/base.rb +6 -6
- data/lib/byebug/printers/plain.rb +8 -6
- data/lib/byebug/printers/texts/base.yml +3 -3
- data/lib/byebug/processors/command_processor.rb +11 -12
- data/lib/byebug/processors/control_processor.rb +4 -6
- data/lib/byebug/processors/post_mortem_processor.rb +4 -2
- data/lib/byebug/processors/script_processor.rb +7 -3
- data/lib/byebug/remote.rb +45 -65
- data/lib/byebug/remote/client.rb +55 -0
- data/lib/byebug/remote/server.rb +47 -0
- data/lib/byebug/runner.rb +26 -19
- data/lib/byebug/setting.rb +10 -4
- data/lib/byebug/settings/autoirb.rb +5 -3
- data/lib/byebug/settings/autolist.rb +5 -3
- data/lib/byebug/settings/autopry.rb +5 -3
- data/lib/byebug/settings/autosave.rb +4 -2
- data/lib/byebug/settings/basename.rb +4 -2
- data/lib/byebug/settings/callstyle.rb +3 -3
- data/lib/byebug/settings/fullpath.rb +4 -2
- data/lib/byebug/settings/histfile.rb +5 -3
- data/lib/byebug/settings/histsize.rb +4 -2
- data/lib/byebug/settings/linetrace.rb +4 -2
- data/lib/byebug/settings/listsize.rb +4 -2
- data/lib/byebug/settings/post_mortem.rb +4 -2
- data/lib/byebug/settings/savefile.rb +4 -2
- data/lib/byebug/settings/stack_on_error.rb +4 -2
- data/lib/byebug/settings/width.rb +3 -1
- data/lib/byebug/source_file_formatter.rb +71 -0
- data/lib/byebug/subcommands.rb +6 -4
- data/lib/byebug/version.rb +1 -1
- metadata +8 -5
- data/bin/byebug +0 -9
data/lib/byebug/commands/save.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "byebug/command"
|
2
4
|
|
3
5
|
module Byebug
|
4
6
|
#
|
@@ -13,7 +15,7 @@ module Byebug
|
|
13
15
|
end
|
14
16
|
|
15
17
|
def self.description
|
16
|
-
<<-
|
18
|
+
<<-DESCRIPTION
|
17
19
|
save[ FILE]
|
18
20
|
|
19
21
|
#{short_description}
|
@@ -24,22 +26,22 @@ module Byebug
|
|
24
26
|
|
25
27
|
Use the "source" command in another debug session to restore the saved
|
26
28
|
file.
|
27
|
-
|
29
|
+
DESCRIPTION
|
28
30
|
end
|
29
31
|
|
30
32
|
def self.short_description
|
31
|
-
|
33
|
+
"Saves current byebug session to a file"
|
32
34
|
end
|
33
35
|
|
34
36
|
def execute
|
35
|
-
file = File.open(@match[1] || Setting[:savefile],
|
37
|
+
file = File.open(@match[1] || Setting[:savefile], "w")
|
36
38
|
|
37
39
|
save_breakpoints(file)
|
38
40
|
save_catchpoints(file)
|
39
41
|
save_displays(file)
|
40
42
|
save_settings(file)
|
41
43
|
|
42
|
-
print pr(
|
44
|
+
print pr("save.messages.done", path: file.path)
|
43
45
|
file.close
|
44
46
|
end
|
45
47
|
|
@@ -52,7 +54,7 @@ module Byebug
|
|
52
54
|
end
|
53
55
|
|
54
56
|
def save_catchpoints(file)
|
55
|
-
Byebug.catchpoints.
|
57
|
+
Byebug.catchpoints.each_key do |c|
|
56
58
|
file.puts "catch #{c}"
|
57
59
|
end
|
58
60
|
end
|
data/lib/byebug/commands/set.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "byebug/command"
|
4
|
+
require "byebug/helpers/parse"
|
3
5
|
|
4
6
|
module Byebug
|
5
7
|
#
|
@@ -16,7 +18,7 @@ module Byebug
|
|
16
18
|
end
|
17
19
|
|
18
20
|
def self.description
|
19
|
-
<<-
|
21
|
+
<<-DESCRIPTION
|
20
22
|
set <setting> <value>
|
21
23
|
|
22
24
|
#{short_description}
|
@@ -26,11 +28,11 @@ module Byebug
|
|
26
28
|
you can use "set no<setting>" to disable them.
|
27
29
|
|
28
30
|
You can see these environment settings with the "show" command.
|
29
|
-
|
31
|
+
DESCRIPTION
|
30
32
|
end
|
31
33
|
|
32
34
|
def self.short_description
|
33
|
-
|
35
|
+
"Modifies byebug settings"
|
34
36
|
end
|
35
37
|
|
36
38
|
def self.help
|
@@ -43,10 +45,10 @@ module Byebug
|
|
43
45
|
return puts(help) if key.nil? && value.nil?
|
44
46
|
|
45
47
|
setting = Setting.find(key)
|
46
|
-
return errmsg(pr(
|
48
|
+
return errmsg(pr("set.errors.unknown_setting", key: key)) unless setting
|
47
49
|
|
48
50
|
if !setting.boolean? && value.nil?
|
49
|
-
err = pr(
|
51
|
+
err = pr("set.errors.must_specify_value", key: key)
|
50
52
|
elsif setting.boolean?
|
51
53
|
value, err = get_onoff(value, key =~ /^no/ ? false : true)
|
52
54
|
elsif setting.integer?
|
@@ -65,12 +67,12 @@ module Byebug
|
|
65
67
|
return default if arg.nil?
|
66
68
|
|
67
69
|
case arg
|
68
|
-
when
|
70
|
+
when "1", "on", "true"
|
69
71
|
true
|
70
|
-
when
|
72
|
+
when "0", "off", "false"
|
71
73
|
false
|
72
74
|
else
|
73
|
-
[nil, pr(
|
75
|
+
[nil, pr("set.errors.on_off", arg: arg)]
|
74
76
|
end
|
75
77
|
end
|
76
78
|
end
|
data/lib/byebug/commands/show.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "byebug/command"
|
2
4
|
|
3
5
|
module Byebug
|
4
6
|
#
|
@@ -13,17 +15,17 @@ module Byebug
|
|
13
15
|
end
|
14
16
|
|
15
17
|
def self.description
|
16
|
-
<<-
|
18
|
+
<<-DESCRIPTION
|
17
19
|
show <setting> <value>
|
18
20
|
|
19
21
|
#{short_description}
|
20
22
|
|
21
23
|
You can change them with the "set" command.
|
22
|
-
|
24
|
+
DESCRIPTION
|
23
25
|
end
|
24
26
|
|
25
27
|
def self.short_description
|
26
|
-
|
28
|
+
"Shows byebug settings"
|
27
29
|
end
|
28
30
|
|
29
31
|
def self.help
|
@@ -35,7 +37,7 @@ module Byebug
|
|
35
37
|
return puts(help) unless key
|
36
38
|
|
37
39
|
setting = Setting.find(key)
|
38
|
-
return errmsg(pr(
|
40
|
+
return errmsg(pr("show.errors.unknown_setting", key: key)) unless setting
|
39
41
|
|
40
42
|
puts Setting.settings[setting.to_sym]
|
41
43
|
end
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "byebug/command"
|
2
4
|
|
3
5
|
module Byebug
|
4
6
|
#
|
@@ -15,15 +17,15 @@ module Byebug
|
|
15
17
|
end
|
16
18
|
|
17
19
|
def self.description
|
18
|
-
<<-
|
20
|
+
<<-DESCRIPTION
|
19
21
|
source <file>
|
20
22
|
|
21
23
|
#{short_description}
|
22
|
-
|
24
|
+
DESCRIPTION
|
23
25
|
end
|
24
26
|
|
25
27
|
def self.short_description
|
26
|
-
|
28
|
+
"Restores a previously saved byebug session"
|
27
29
|
end
|
28
30
|
|
29
31
|
def execute
|
@@ -31,7 +33,7 @@ module Byebug
|
|
31
33
|
|
32
34
|
file = File.expand_path(@match[1]).strip
|
33
35
|
unless File.exist?(file)
|
34
|
-
return errmsg(pr(
|
36
|
+
return errmsg(pr("source.errors.not_found", file: file))
|
35
37
|
end
|
36
38
|
|
37
39
|
processor.interface.read_file(file)
|
data/lib/byebug/commands/step.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "byebug/command"
|
4
|
+
require "byebug/helpers/parse"
|
3
5
|
|
4
6
|
module Byebug
|
5
7
|
#
|
@@ -16,19 +18,19 @@ module Byebug
|
|
16
18
|
end
|
17
19
|
|
18
20
|
def self.description
|
19
|
-
<<-
|
21
|
+
<<-DESCRIPTION
|
20
22
|
s[tep][ times]
|
21
23
|
|
22
24
|
#{short_description}
|
23
|
-
|
25
|
+
DESCRIPTION
|
24
26
|
end
|
25
27
|
|
26
28
|
def self.short_description
|
27
|
-
|
29
|
+
"Steps into blocks or methods one or more times"
|
28
30
|
end
|
29
31
|
|
30
32
|
def execute
|
31
|
-
steps, err = parse_steps(@match[1],
|
33
|
+
steps, err = parse_steps(@match[1], "Steps")
|
32
34
|
return errmsg(err) unless steps
|
33
35
|
|
34
36
|
context.step_into(steps, context.frame.pos)
|
@@ -1,10 +1,12 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
3
|
+
require "byebug/subcommands"
|
4
|
+
|
5
|
+
require "byebug/commands/thread/current"
|
6
|
+
require "byebug/commands/thread/list"
|
7
|
+
require "byebug/commands/thread/resume"
|
8
|
+
require "byebug/commands/thread/stop"
|
9
|
+
require "byebug/commands/thread/switch"
|
8
10
|
|
9
11
|
module Byebug
|
10
12
|
#
|
@@ -18,15 +20,15 @@ module Byebug
|
|
18
20
|
end
|
19
21
|
|
20
22
|
def self.description
|
21
|
-
<<-
|
23
|
+
<<-DESCRIPTION
|
22
24
|
th[read] <subcommand>
|
23
25
|
|
24
26
|
#{short_description}
|
25
|
-
|
27
|
+
DESCRIPTION
|
26
28
|
end
|
27
29
|
|
28
30
|
def self.short_description
|
29
|
-
|
31
|
+
"Commands to manipulate threads"
|
30
32
|
end
|
31
33
|
end
|
32
34
|
end
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "byebug/helpers/thread"
|
2
4
|
|
3
5
|
module Byebug
|
4
6
|
#
|
@@ -16,15 +18,15 @@ module Byebug
|
|
16
18
|
end
|
17
19
|
|
18
20
|
def self.description
|
19
|
-
<<-
|
21
|
+
<<-DESCRIPTION
|
20
22
|
th[read] c[urrent]
|
21
23
|
|
22
24
|
#{short_description}
|
23
|
-
|
25
|
+
DESCRIPTION
|
24
26
|
end
|
25
27
|
|
26
28
|
def self.short_description
|
27
|
-
|
29
|
+
"Shows current thread information"
|
28
30
|
end
|
29
31
|
|
30
32
|
def execute
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "byebug/helpers/thread"
|
2
4
|
|
3
5
|
module Byebug
|
4
6
|
#
|
@@ -16,21 +18,21 @@ module Byebug
|
|
16
18
|
end
|
17
19
|
|
18
20
|
def self.description
|
19
|
-
<<-
|
21
|
+
<<-DESCRIPTION
|
20
22
|
th[read] l[ist] <thnum>
|
21
23
|
|
22
24
|
#{short_description}
|
23
|
-
|
25
|
+
DESCRIPTION
|
24
26
|
end
|
25
27
|
|
26
28
|
def self.short_description
|
27
|
-
|
29
|
+
"Lists all threads"
|
28
30
|
end
|
29
31
|
|
30
32
|
def execute
|
31
33
|
contexts = Byebug.contexts.sort_by(&:thnum)
|
32
34
|
|
33
|
-
thread_list = prc(
|
35
|
+
thread_list = prc("thread.context", contexts) do |context, _|
|
34
36
|
thread_arguments(context)
|
35
37
|
end
|
36
38
|
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "byebug/helpers/thread"
|
2
4
|
|
3
5
|
module Byebug
|
4
6
|
#
|
@@ -16,15 +18,15 @@ module Byebug
|
|
16
18
|
end
|
17
19
|
|
18
20
|
def self.description
|
19
|
-
<<-
|
21
|
+
<<-DESCRIPTION
|
20
22
|
th[read] r[esume] <thnum>
|
21
23
|
|
22
24
|
#{short_description}
|
23
|
-
|
25
|
+
DESCRIPTION
|
24
26
|
end
|
25
27
|
|
26
28
|
def self.short_description
|
27
|
-
|
29
|
+
"Resumes execution of the specified thread"
|
28
30
|
end
|
29
31
|
|
30
32
|
def execute
|
@@ -34,7 +36,7 @@ module Byebug
|
|
34
36
|
return errmsg(err) if err
|
35
37
|
|
36
38
|
unless context.suspended?
|
37
|
-
return errmsg(pr(
|
39
|
+
return errmsg(pr("thread.errors.already_running"))
|
38
40
|
end
|
39
41
|
|
40
42
|
context.resume
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "byebug/helpers/thread"
|
2
4
|
|
3
5
|
module Byebug
|
4
6
|
#
|
@@ -16,15 +18,15 @@ module Byebug
|
|
16
18
|
end
|
17
19
|
|
18
20
|
def self.description
|
19
|
-
<<-
|
21
|
+
<<-DESCRIPTION
|
20
22
|
th[read] st[op] <thnum>
|
21
23
|
|
22
24
|
#{short_description}
|
23
|
-
|
25
|
+
DESCRIPTION
|
24
26
|
end
|
25
27
|
|
26
28
|
def self.short_description
|
27
|
-
|
29
|
+
"Stops the execution of the specified thread"
|
28
30
|
end
|
29
31
|
|
30
32
|
def execute
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "byebug/helpers/thread"
|
2
4
|
|
3
5
|
module Byebug
|
4
6
|
#
|
@@ -16,15 +18,15 @@ module Byebug
|
|
16
18
|
end
|
17
19
|
|
18
20
|
def self.description
|
19
|
-
<<-
|
21
|
+
<<-DESCRIPTION
|
20
22
|
th[read] sw[itch] <thnum>
|
21
23
|
|
22
24
|
#{short_description}
|
23
|
-
|
25
|
+
DESCRIPTION
|
24
26
|
end
|
25
27
|
|
26
28
|
def self.short_description
|
27
|
-
|
29
|
+
"Switches execution to the specified thread"
|
28
30
|
end
|
29
31
|
|
30
32
|
def execute
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "byebug/command"
|
2
4
|
|
3
5
|
module Byebug
|
4
6
|
#
|
@@ -12,7 +14,7 @@ module Byebug
|
|
12
14
|
end
|
13
15
|
|
14
16
|
def self.description
|
15
|
-
<<-
|
17
|
+
<<-DESCRIPTION
|
16
18
|
tr[acevar] <variable> [[no]stop]
|
17
19
|
|
18
20
|
#{short_description}
|
@@ -20,19 +22,19 @@ module Byebug
|
|
20
22
|
If "stop" is specified, execution will stop every time the variable
|
21
23
|
changes its value. If nothing or "nostop" is specified, execution won't
|
22
24
|
stop, changes will just be logged in byebug's output.
|
23
|
-
|
25
|
+
DESCRIPTION
|
24
26
|
end
|
25
27
|
|
26
28
|
def self.short_description
|
27
|
-
|
29
|
+
"Enables tracing of a global variable"
|
28
30
|
end
|
29
31
|
|
30
32
|
def execute
|
31
33
|
var = @match[1]
|
32
|
-
return errmsg(pr(
|
34
|
+
return errmsg(pr("trace.errors.needs_global_variable")) unless var
|
33
35
|
|
34
36
|
unless global_variables.include?(:"#{var}")
|
35
|
-
return errmsg(pr(
|
37
|
+
return errmsg(pr("trace.errors.var_is_not_global", name: var))
|
36
38
|
end
|
37
39
|
|
38
40
|
stop = @match[2] && @match[2] !~ /nostop/
|
@@ -41,13 +43,13 @@ module Byebug
|
|
41
43
|
trace_var(:"#{var}") { |val| on_change(var, val, stop) }
|
42
44
|
end
|
43
45
|
|
44
|
-
puts pr(
|
46
|
+
puts pr("trace.messages.success", var: var)
|
45
47
|
end
|
46
48
|
|
47
49
|
private
|
48
50
|
|
49
51
|
def on_change(name, value, stop)
|
50
|
-
puts pr(
|
52
|
+
puts pr("trace.messages.on_change", name: name, value: value)
|
51
53
|
|
52
54
|
context.step_out(1, false) if stop
|
53
55
|
end
|