byebug 9.0.5 → 11.1.3
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 +5 -5
- data/CHANGELOG.md +399 -264
- data/CONTRIBUTING.md +12 -19
- data/GUIDE.md +40 -26
- data/LICENSE +18 -18
- data/README.md +103 -74
- data/exe/byebug +6 -0
- data/ext/byebug/breakpoint.c +2 -2
- data/ext/byebug/byebug.c +26 -31
- data/ext/byebug/byebug.h +44 -28
- data/ext/byebug/context.c +45 -32
- data/ext/byebug/extconf.rb +7 -5
- data/ext/byebug/locker.c +4 -4
- data/ext/byebug/threads.c +12 -12
- data/lib/byebug/attacher.rb +18 -4
- data/lib/byebug/breakpoint.rb +26 -6
- data/lib/byebug/command.rb +20 -14
- data/lib/byebug/command_list.rb +3 -1
- data/lib/byebug/commands/break.rb +36 -22
- data/lib/byebug/commands/catch.rb +16 -18
- data/lib/byebug/commands/condition.rb +11 -11
- data/lib/byebug/commands/continue.rb +32 -12
- data/lib/byebug/commands/debug.rb +7 -5
- data/lib/byebug/commands/delete.rb +13 -11
- data/lib/byebug/commands/disable/breakpoints.rb +7 -5
- data/lib/byebug/commands/disable/display.rb +7 -5
- data/lib/byebug/commands/disable.rb +8 -6
- data/lib/byebug/commands/display.rb +11 -9
- data/lib/byebug/commands/down.rb +10 -8
- data/lib/byebug/commands/edit.rb +11 -8
- data/lib/byebug/commands/enable/breakpoints.rb +7 -5
- data/lib/byebug/commands/enable/display.rb +7 -5
- data/lib/byebug/commands/enable.rb +8 -6
- data/lib/byebug/commands/finish.rb +9 -7
- 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/breakpoints.rb +18 -14
- data/lib/byebug/commands/info/display.rb +16 -9
- data/lib/byebug/commands/info/file.rb +13 -14
- data/lib/byebug/commands/info/line.rb +5 -3
- data/lib/byebug/commands/info/program.rb +8 -6
- data/lib/byebug/commands/info.rb +11 -9
- data/lib/byebug/commands/interrupt.rb +8 -4
- data/lib/byebug/commands/irb.rb +13 -12
- data/lib/byebug/commands/kill.rb +11 -11
- 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 -10
- data/lib/byebug/commands/quit.rb +10 -8
- data/lib/byebug/commands/restart.rb +30 -11
- data/lib/byebug/commands/save.rb +10 -8
- data/lib/byebug/commands/set.rb +13 -11
- data/lib/byebug/commands/show.rb +7 -5
- data/lib/byebug/commands/skip.rb +85 -0
- data/lib/byebug/commands/source.rb +7 -7
- data/lib/byebug/commands/step.rb +8 -6
- 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 -7
- data/lib/byebug/commands/thread/stop.rb +6 -4
- data/lib/byebug/commands/thread/switch.rb +6 -4
- data/lib/byebug/commands/thread.rb +11 -9
- data/lib/byebug/commands/tracevar.rb +10 -11
- data/lib/byebug/commands/undisplay.rb +12 -11
- data/lib/byebug/commands/untracevar.rb +8 -6
- data/lib/byebug/commands/up.rb +10 -8
- 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 -9
- 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/var.rb +12 -10
- data/lib/byebug/commands/where.rb +9 -7
- data/lib/byebug/commands.rb +40 -37
- data/lib/byebug/context.rb +7 -5
- data/lib/byebug/core.rb +26 -25
- data/lib/byebug/errors.rb +4 -2
- data/lib/byebug/frame.rb +19 -22
- data/lib/byebug/helpers/bin.rb +47 -0
- data/lib/byebug/helpers/eval.rb +15 -13
- data/lib/byebug/helpers/file.rb +6 -4
- data/lib/byebug/helpers/frame.rb +7 -5
- data/lib/byebug/helpers/parse.rb +5 -5
- data/lib/byebug/helpers/path.rb +9 -11
- data/lib/byebug/helpers/reflection.rb +2 -0
- data/lib/byebug/helpers/string.rb +11 -2
- data/lib/byebug/helpers/thread.rb +10 -8
- data/lib/byebug/helpers/toggle.rb +28 -27
- data/lib/byebug/helpers/var.rb +9 -7
- data/lib/byebug/history.rb +20 -11
- data/lib/byebug/interface.rb +13 -11
- data/lib/byebug/interfaces/local_interface.rb +25 -7
- data/lib/byebug/interfaces/remote_interface.rb +21 -9
- data/lib/byebug/interfaces/script_interface.rb +4 -1
- data/lib/byebug/interfaces/test_interface.rb +5 -3
- data/lib/byebug/option_setter.rb +14 -12
- data/lib/byebug/printers/base.rb +10 -10
- data/lib/byebug/printers/plain.rb +9 -8
- data/lib/byebug/printers/texts/base.yml +7 -3
- data/lib/byebug/printers/texts/plain.yml +1 -1
- 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/client.rb +57 -0
- data/lib/byebug/remote/server.rb +47 -0
- data/lib/byebug/remote.rb +46 -66
- data/lib/byebug/runner.rb +43 -49
- data/lib/byebug/setting.rb +11 -5
- data/lib/byebug/settings/autoirb.rb +7 -5
- data/lib/byebug/settings/autolist.rb +7 -5
- data/lib/byebug/settings/autopry.rb +7 -5
- data/lib/byebug/settings/autosave.rb +4 -2
- data/lib/byebug/settings/basename.rb +4 -2
- data/lib/byebug/settings/callstyle.rb +4 -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 +6 -4
- data/lib/byebug/settings/listsize.rb +4 -2
- data/lib/byebug/settings/post_mortem.rb +6 -4
- 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 +2 -1
- data/lib/byebug.rb +3 -1
- metadata +22 -20
- data/bin/byebug +0 -7
@@ -1,12 +1,18 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../command"
|
4
|
+
require_relative "../helpers/bin"
|
5
|
+
require_relative "../helpers/path"
|
6
|
+
require "shellwords"
|
7
|
+
require "English"
|
8
|
+
require "rbconfig"
|
4
9
|
|
5
10
|
module Byebug
|
6
11
|
#
|
7
12
|
# Restart debugged program from within byebug.
|
8
13
|
#
|
9
14
|
class RestartCommand < Command
|
15
|
+
include Helpers::BinHelper
|
10
16
|
include Helpers::PathHelper
|
11
17
|
|
12
18
|
self.allow_in_control = true
|
@@ -17,29 +23,42 @@ module Byebug
|
|
17
23
|
end
|
18
24
|
|
19
25
|
def self.description
|
20
|
-
<<-
|
26
|
+
<<-DESCRIPTION
|
21
27
|
restart [args]
|
22
28
|
|
23
29
|
#{short_description}
|
24
30
|
|
25
31
|
This is a re-exec - all byebug state is lost. If command arguments are
|
26
32
|
passed those are used.
|
27
|
-
|
33
|
+
DESCRIPTION
|
28
34
|
end
|
29
35
|
|
30
36
|
def self.short_description
|
31
|
-
|
37
|
+
"Restarts the debugged program"
|
32
38
|
end
|
33
39
|
|
34
40
|
def execute
|
35
|
-
|
41
|
+
cmd = [$PROGRAM_NAME]
|
42
|
+
|
43
|
+
cmd = prepend_byebug_bin(cmd)
|
44
|
+
cmd = prepend_ruby_bin(cmd)
|
45
|
+
|
46
|
+
cmd += (@match[:args] ? @match[:args].shellsplit : $ARGV)
|
36
47
|
|
37
|
-
|
48
|
+
puts pr("restart.success", cmd: cmd.shelljoin)
|
49
|
+
Kernel.exec(*cmd)
|
50
|
+
end
|
51
|
+
|
52
|
+
private
|
38
53
|
|
39
|
-
|
54
|
+
def prepend_byebug_bin(cmd)
|
55
|
+
cmd.unshift(bin_file) if Byebug.mode == :standalone
|
56
|
+
cmd
|
57
|
+
end
|
40
58
|
|
41
|
-
|
42
|
-
|
59
|
+
def prepend_ruby_bin(cmd)
|
60
|
+
cmd.unshift(RbConfig.ruby) if which("ruby") != which(cmd.first)
|
61
|
+
cmd
|
43
62
|
end
|
44
63
|
end
|
45
64
|
end
|
data/lib/byebug/commands/save.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../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
|
@@ -62,7 +64,7 @@ module Byebug
|
|
62
64
|
end
|
63
65
|
|
64
66
|
def save_settings(file)
|
65
|
-
%w
|
67
|
+
%w[autoirb autolist basename].each do |setting|
|
66
68
|
file.puts "set #{setting} #{Setting[setting.to_sym]}"
|
67
69
|
end
|
68
70
|
end
|
data/lib/byebug/commands/set.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../command"
|
4
|
+
require_relative "../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,12 +45,12 @@ 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
|
-
value, err = get_onoff(value,
|
53
|
+
value, err = get_onoff(value, /^no/.match?(key) ? false : true)
|
52
54
|
elsif setting.integer?
|
53
55
|
value, err = get_int(value, setting.to_sym, 1)
|
54
56
|
end
|
@@ -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_relative "../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
|
@@ -0,0 +1,85 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../command"
|
4
|
+
require_relative "../helpers/parse"
|
5
|
+
|
6
|
+
module Byebug
|
7
|
+
#
|
8
|
+
# Allows the user to continue execution until the next breakpoint, as
|
9
|
+
# long as it is different from the current one
|
10
|
+
#
|
11
|
+
class SkipCommand < Command
|
12
|
+
include Helpers::ParseHelper
|
13
|
+
|
14
|
+
class << self
|
15
|
+
attr_writer :file_line, :file_path
|
16
|
+
attr_reader :previous_autolist
|
17
|
+
|
18
|
+
def file_line
|
19
|
+
@file_line ||= 0
|
20
|
+
end
|
21
|
+
|
22
|
+
def file_path
|
23
|
+
@file_path ||= ""
|
24
|
+
end
|
25
|
+
|
26
|
+
def setup_autolist(value)
|
27
|
+
@previous_autolist = ListCommand.always_run
|
28
|
+
ListCommand.always_run = value
|
29
|
+
end
|
30
|
+
|
31
|
+
def restore_autolist
|
32
|
+
ListCommand.always_run = @previous_autolist
|
33
|
+
@previous_autolist = nil
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.regexp
|
38
|
+
/^\s* sk(?:ip)? \s*$/x
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.description
|
42
|
+
<<-DESCRIPTION
|
43
|
+
sk[ip]
|
44
|
+
|
45
|
+
#{short_description}
|
46
|
+
DESCRIPTION
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.short_description
|
50
|
+
"Runs until the next breakpoint as long as it is different from the current one"
|
51
|
+
end
|
52
|
+
|
53
|
+
def initialize_attributes
|
54
|
+
self.class.always_run = 2
|
55
|
+
self.class.setup_autolist(0)
|
56
|
+
self.class.file_path = frame.file
|
57
|
+
self.class.file_line = frame.line
|
58
|
+
end
|
59
|
+
|
60
|
+
def keep_execution
|
61
|
+
[self.class.file_path, self.class.file_line] == [frame.file, frame.line]
|
62
|
+
end
|
63
|
+
|
64
|
+
def reset_attributes
|
65
|
+
self.class.always_run = 0
|
66
|
+
ListCommand.new(processor).execute if self.class.previous_autolist == 1
|
67
|
+
self.class.restore_autolist
|
68
|
+
end
|
69
|
+
|
70
|
+
def auto_run
|
71
|
+
return false unless self.class.always_run == 2
|
72
|
+
|
73
|
+
keep_execution ? processor.proceed! : reset_attributes
|
74
|
+
true
|
75
|
+
end
|
76
|
+
|
77
|
+
def execute
|
78
|
+
return if auto_run
|
79
|
+
|
80
|
+
initialize_attributes
|
81
|
+
processor.proceed!
|
82
|
+
Byebug.stop if Byebug.stoppable?
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../command"
|
2
4
|
|
3
5
|
module Byebug
|
4
6
|
#
|
@@ -15,24 +17,22 @@ 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
|
30
32
|
return puts(help) unless @match[1]
|
31
33
|
|
32
34
|
file = File.expand_path(@match[1]).strip
|
33
|
-
unless File.exist?(file)
|
34
|
-
return errmsg(pr('source.errors.not_found', file: file))
|
35
|
-
end
|
35
|
+
return errmsg(pr("source.errors.not_found", file: file)) unless File.exist?(file)
|
36
36
|
|
37
37
|
processor.interface.read_file(file)
|
38
38
|
end
|
data/lib/byebug/commands/step.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../command"
|
4
|
+
require_relative "../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,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../../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_relative "../../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_relative "../../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
|
@@ -33,9 +35,7 @@ module Byebug
|
|
33
35
|
context, err = context_from_thread(@match[1])
|
34
36
|
return errmsg(err) if err
|
35
37
|
|
36
|
-
unless context.suspended?
|
37
|
-
return errmsg(pr('thread.errors.already_running'))
|
38
|
-
end
|
38
|
+
return errmsg(pr("thread.errors.already_running")) unless context.suspended?
|
39
39
|
|
40
40
|
context.resume
|
41
41
|
display_context(context)
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../../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_relative "../../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,10 +1,12 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
require_relative "../subcommands"
|
4
|
+
|
5
|
+
require_relative "../commands/thread/current"
|
6
|
+
require_relative "../commands/thread/list"
|
7
|
+
require_relative "../commands/thread/resume"
|
8
|
+
require_relative "../commands/thread/stop"
|
9
|
+
require_relative "../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_relative "../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,20 +22,17 @@ 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(
|
33
|
-
|
34
|
-
unless global_variables.include?(:"#{var}")
|
35
|
-
return errmsg(pr('trace.errors.var_is_not_global', name: var))
|
36
|
-
end
|
34
|
+
return errmsg(pr("trace.errors.needs_global_variable")) unless var
|
35
|
+
return errmsg(pr("trace.errors.var_is_not_global", name: var)) unless global_variables.include?(:"#{var}")
|
37
36
|
|
38
37
|
stop = @match[2] && @match[2] !~ /nostop/
|
39
38
|
|
@@ -41,13 +40,13 @@ module Byebug
|
|
41
40
|
trace_var(:"#{var}") { |val| on_change(var, val, stop) }
|
42
41
|
end
|
43
42
|
|
44
|
-
puts pr(
|
43
|
+
puts pr("trace.messages.success", var: var)
|
45
44
|
end
|
46
45
|
|
47
46
|
private
|
48
47
|
|
49
48
|
def on_change(name, value, stop)
|
50
|
-
puts pr(
|
49
|
+
puts pr("trace.messages.on_change", name: name, value: value)
|
51
50
|
|
52
51
|
context.step_out(1, false) if stop
|
53
52
|
end
|