byebug 5.0.0 → 6.0.0
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/CHANGELOG.md +26 -1
- data/CONTRIBUTING.md +35 -13
- data/GUIDE.md +256 -198
- data/README.md +5 -11
- data/ext/byebug/byebug.c +5 -43
- data/ext/byebug/byebug.h +6 -1
- data/ext/byebug/context.c +4 -5
- data/lib/byebug/command.rb +64 -64
- data/lib/byebug/command_list.rb +32 -0
- data/lib/byebug/commands.rb +37 -0
- data/lib/byebug/commands/break.rb +45 -37
- data/lib/byebug/commands/catch.rb +52 -28
- data/lib/byebug/commands/condition.rb +19 -13
- data/lib/byebug/commands/continue.rb +15 -11
- data/lib/byebug/commands/delete.rb +18 -12
- data/lib/byebug/commands/disable.rb +9 -10
- data/lib/byebug/commands/disable/breakpoints.rb +13 -11
- data/lib/byebug/commands/disable/display.rb +13 -11
- data/lib/byebug/commands/display.rb +32 -24
- data/lib/byebug/commands/down.rb +18 -14
- data/lib/byebug/commands/edit.rb +42 -26
- data/lib/byebug/commands/enable.rb +9 -3
- data/lib/byebug/commands/enable/breakpoints.rb +13 -11
- data/lib/byebug/commands/enable/display.rb +13 -11
- data/lib/byebug/commands/finish.rb +23 -14
- data/lib/byebug/commands/frame.rb +21 -18
- data/lib/byebug/commands/help.rb +39 -16
- data/lib/byebug/commands/history.rb +16 -10
- data/lib/byebug/commands/info.rb +8 -5
- data/lib/byebug/commands/info/breakpoints.rb +16 -14
- data/lib/byebug/commands/info/display.rb +18 -18
- data/lib/byebug/commands/info/file.rb +22 -22
- data/lib/byebug/commands/info/line.rb +13 -11
- data/lib/byebug/commands/info/program.rb +13 -17
- data/lib/byebug/commands/interrupt.rb +13 -11
- data/lib/byebug/commands/irb.rb +16 -10
- data/lib/byebug/commands/kill.rb +19 -13
- data/lib/byebug/commands/list.rb +35 -24
- data/lib/byebug/commands/method.rb +25 -15
- data/lib/byebug/commands/next.rb +15 -13
- data/lib/byebug/commands/pry.rb +18 -11
- data/lib/byebug/commands/ps.rb +21 -23
- data/lib/byebug/commands/quit.rb +17 -11
- data/lib/byebug/commands/restart.rb +28 -24
- data/lib/byebug/commands/save.rb +23 -15
- data/lib/byebug/commands/set.rb +26 -19
- data/lib/byebug/commands/show.rb +20 -14
- data/lib/byebug/commands/source.rb +15 -14
- data/lib/byebug/commands/step.rb +15 -13
- data/lib/byebug/commands/thread.rb +8 -4
- data/lib/byebug/commands/thread/current.rb +11 -11
- data/lib/byebug/commands/thread/list.rb +14 -14
- data/lib/byebug/commands/thread/resume.rb +14 -14
- data/lib/byebug/commands/thread/stop.rb +14 -14
- data/lib/byebug/commands/thread/switch.rb +15 -14
- data/lib/byebug/commands/tracevar.rb +20 -16
- data/lib/byebug/commands/undisplay.rb +22 -18
- data/lib/byebug/commands/untracevar.rb +13 -11
- data/lib/byebug/commands/up.rb +18 -14
- data/lib/byebug/commands/var.rb +10 -3
- data/lib/byebug/commands/var/all.rb +15 -13
- data/lib/byebug/commands/var/args.rb +37 -0
- data/lib/byebug/commands/var/const.rb +25 -14
- data/lib/byebug/commands/var/global.rb +13 -11
- data/lib/byebug/commands/var/instance.rb +13 -11
- data/lib/byebug/commands/var/local.rb +13 -11
- data/lib/byebug/commands/where.rb +15 -11
- data/lib/byebug/context.rb +71 -73
- data/lib/byebug/core.rb +45 -26
- data/lib/byebug/errors.rb +27 -0
- data/lib/byebug/frame.rb +181 -0
- data/lib/byebug/helpers/eval.rb +67 -26
- data/lib/byebug/helpers/file.rb +18 -3
- data/lib/byebug/helpers/frame.rb +36 -39
- data/lib/byebug/helpers/parse.rb +15 -13
- data/lib/byebug/helpers/path.rb +21 -0
- data/lib/byebug/helpers/reflection.rb +17 -0
- data/lib/byebug/helpers/thread.rb +20 -14
- data/lib/byebug/helpers/toggle.rb +10 -5
- data/lib/byebug/helpers/var.rb +36 -15
- data/lib/byebug/interface.rb +27 -9
- data/lib/byebug/option_setter.rb +93 -0
- data/lib/byebug/printers/base.rb +3 -0
- data/lib/byebug/printers/plain.rb +4 -14
- data/lib/byebug/printers/texts/base.yml +2 -7
- data/lib/byebug/processors/command_processor.rb +101 -102
- data/lib/byebug/processors/control_processor.rb +20 -0
- data/lib/byebug/processors/post_mortem_processor.rb +16 -0
- data/lib/byebug/processors/script_processor.rb +49 -0
- data/lib/byebug/remote.rb +13 -7
- data/lib/byebug/runner.rb +39 -65
- data/lib/byebug/setting.rb +4 -1
- data/lib/byebug/settings/post_mortem.rb +0 -16
- data/lib/byebug/settings/savefile.rb +1 -4
- data/lib/byebug/subcommands.rb +27 -29
- data/lib/byebug/version.rb +4 -1
- metadata +14 -29
- data/lib/byebug/commands/eval.rb +0 -43
- data/lib/byebug/commands/info/args.rb +0 -39
- data/lib/byebug/commands/info/catch.rb +0 -39
- data/lib/byebug/commands/pp.rb +0 -41
- data/lib/byebug/commands/putl.rb +0 -43
- data/lib/byebug/processor.rb +0 -43
- data/lib/byebug/processors/control_command_processor.rb +0 -48
- data/lib/byebug/settings/verbose.rb +0 -20
- data/lib/byebug/state.rb +0 -12
- data/lib/byebug/states/control_state.rb +0 -26
- data/lib/byebug/states/regular_state.rb +0 -187
- data/lib/byebug/subcommand_list.rb +0 -33
@@ -8,12 +8,26 @@ module Byebug
|
|
8
8
|
class HistoryCommand < Command
|
9
9
|
include Helpers::ParseHelper
|
10
10
|
|
11
|
-
|
11
|
+
self.allow_in_post_mortem = true
|
12
|
+
|
13
|
+
def self.regexp
|
12
14
|
/^\s* hist(?:ory)? (?:\s+(?<num_cmds>.+))? \s*$/x
|
13
15
|
end
|
14
16
|
|
17
|
+
def self.description
|
18
|
+
<<-EOD
|
19
|
+
hist[ory] [num_cmds]
|
20
|
+
|
21
|
+
#{short_description}
|
22
|
+
EOD
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.short_description
|
26
|
+
"Shows byebug's history of commands"
|
27
|
+
end
|
28
|
+
|
15
29
|
def execute
|
16
|
-
history =
|
30
|
+
history = processor.interface.history
|
17
31
|
|
18
32
|
if @match[:num_cmds]
|
19
33
|
size, = get_int(@match[:num_cmds], 'history', 1, history.size)
|
@@ -22,13 +36,5 @@ module Byebug
|
|
22
36
|
|
23
37
|
puts history.to_s(size)
|
24
38
|
end
|
25
|
-
|
26
|
-
def description
|
27
|
-
<<-EOD
|
28
|
-
hist[ory] [num_cmds]
|
29
|
-
|
30
|
-
Show byebug's command history.
|
31
|
-
EOD
|
32
|
-
end
|
33
39
|
end
|
34
40
|
end
|
data/lib/byebug/commands/info.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
require 'byebug/subcommands'
|
2
2
|
|
3
|
-
require 'byebug/commands/info/args'
|
4
3
|
require 'byebug/commands/info/breakpoints'
|
5
|
-
require 'byebug/commands/info/catch'
|
6
4
|
require 'byebug/commands/info/display'
|
7
5
|
require 'byebug/commands/info/file'
|
8
6
|
require 'byebug/commands/info/line'
|
@@ -16,17 +14,22 @@ module Byebug
|
|
16
14
|
include Subcommands
|
17
15
|
|
18
16
|
self.allow_in_control = true
|
17
|
+
self.allow_in_post_mortem = true
|
19
18
|
|
20
|
-
def regexp
|
19
|
+
def self.regexp
|
21
20
|
/^\s* i(?:nfo)? (?:\s+ (.+))? \s*$/x
|
22
21
|
end
|
23
22
|
|
24
|
-
def description
|
23
|
+
def self.description
|
25
24
|
<<-EOD
|
26
25
|
info[ subcommand]
|
27
26
|
|
28
|
-
|
27
|
+
#{short_description}
|
29
28
|
EOD
|
30
29
|
end
|
30
|
+
|
31
|
+
def self.short_description
|
32
|
+
'Shows several informations about the program being debugged'
|
33
|
+
end
|
31
34
|
end
|
32
35
|
end
|
@@ -6,11 +6,25 @@ module Byebug
|
|
6
6
|
#
|
7
7
|
# Information about current breakpoints
|
8
8
|
#
|
9
|
-
class
|
10
|
-
|
9
|
+
class BreakpointsCommand < Command
|
10
|
+
self.allow_in_post_mortem = true
|
11
|
+
|
12
|
+
def self.regexp
|
11
13
|
/^\s* b(?:reakpoints)? (?:\s+ (.+))? \s*$/x
|
12
14
|
end
|
13
15
|
|
16
|
+
def self.description
|
17
|
+
<<-EOD
|
18
|
+
inf[o] b[reakpoints]
|
19
|
+
|
20
|
+
#{short_description}
|
21
|
+
EOD
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.short_description
|
25
|
+
'Status of user settable breakpoints'
|
26
|
+
end
|
27
|
+
|
14
28
|
def execute
|
15
29
|
return puts('No breakpoints.') if Byebug.breakpoints.empty?
|
16
30
|
|
@@ -28,18 +42,6 @@ module Byebug
|
|
28
42
|
breakpoints.each { |b| info_breakpoint(b) }
|
29
43
|
end
|
30
44
|
|
31
|
-
def short_description
|
32
|
-
'Status of user settable breakpoints.'
|
33
|
-
end
|
34
|
-
|
35
|
-
def description
|
36
|
-
<<-EOD
|
37
|
-
inf[o] b[reakpoints]
|
38
|
-
|
39
|
-
#{short_description}
|
40
|
-
EOD
|
41
|
-
end
|
42
|
-
|
43
45
|
private
|
44
46
|
|
45
47
|
def info_breakpoint(brkpt)
|
@@ -6,37 +6,37 @@ module Byebug
|
|
6
6
|
#
|
7
7
|
# Information about display expressions
|
8
8
|
#
|
9
|
-
class
|
10
|
-
|
9
|
+
class DisplayCommand < Command
|
10
|
+
self.allow_in_post_mortem = true
|
11
|
+
|
12
|
+
def self.regexp
|
11
13
|
/^\s* d(?:isplay)? \s*$/x
|
12
14
|
end
|
13
15
|
|
14
|
-
def
|
15
|
-
|
16
|
+
def self.description
|
17
|
+
<<-EOD
|
18
|
+
inf[o] d[display]
|
19
|
+
|
20
|
+
#{short_description}
|
21
|
+
EOD
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.short_description
|
25
|
+
'List of expressions to display when program stops'
|
26
|
+
end
|
16
27
|
|
17
|
-
|
28
|
+
def execute
|
29
|
+
unless Byebug.displays.find { |d| d[0] }
|
18
30
|
return puts('There are no auto-display expressions now.')
|
19
31
|
end
|
20
32
|
|
21
33
|
puts 'Auto-display expressions now in effect:'
|
22
34
|
puts 'Num Enb Expression'
|
23
35
|
|
24
|
-
|
36
|
+
Byebug.displays.each_with_index do |d, i|
|
25
37
|
puts(format('%3d: %s %s', i + 1, d[0] ? 'y' : 'n', d[1]))
|
26
38
|
end
|
27
39
|
end
|
28
|
-
|
29
|
-
def short_description
|
30
|
-
'List of expressions to display when program stops'
|
31
|
-
end
|
32
|
-
|
33
|
-
def description
|
34
|
-
<<-EOD
|
35
|
-
inf[o] d[display]
|
36
|
-
|
37
|
-
#{short_description}
|
38
|
-
EOD
|
39
|
-
end
|
40
40
|
end
|
41
41
|
end
|
42
42
|
end
|
@@ -8,15 +8,32 @@ module Byebug
|
|
8
8
|
#
|
9
9
|
# Information about a particular source file
|
10
10
|
#
|
11
|
-
class
|
11
|
+
class FileCommand < Command
|
12
12
|
include Helpers::FileHelper
|
13
13
|
|
14
|
-
|
14
|
+
self.allow_in_post_mortem = true
|
15
|
+
|
16
|
+
def self.regexp
|
15
17
|
/^\s* f(?:ile)? (?:\s+ (\S+))? \s*$/x
|
16
18
|
end
|
17
19
|
|
20
|
+
def self.description
|
21
|
+
<<-EOD
|
22
|
+
inf[o] f[ile]
|
23
|
+
|
24
|
+
#{short_description}
|
25
|
+
|
26
|
+
It informs about file name, number of lines, possible breakpoints in
|
27
|
+
the file, last modification time and sha1 digest.
|
28
|
+
EOD
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.short_description
|
32
|
+
'Information about a particular source file.'
|
33
|
+
end
|
34
|
+
|
18
35
|
def execute
|
19
|
-
file = @match[1] ||
|
36
|
+
file = @match[1] || frame.file
|
20
37
|
unless File.exist?(file)
|
21
38
|
return errmsg(pr('info.errors.undefined_file', file: file))
|
22
39
|
end
|
@@ -25,8 +42,7 @@ module Byebug
|
|
25
42
|
|
26
43
|
File #{info_file_basic(file)}
|
27
44
|
|
28
|
-
Breakpoint line numbers:
|
29
|
-
#{info_file_breakpoints(file)}
|
45
|
+
Breakpoint line numbers: #{info_file_breakpoints(file)}
|
30
46
|
|
31
47
|
Modification time: #{info_file_mtime(file)}
|
32
48
|
|
@@ -35,21 +51,6 @@ module Byebug
|
|
35
51
|
EOC
|
36
52
|
end
|
37
53
|
|
38
|
-
def short_description
|
39
|
-
'Information about a particular source file.'
|
40
|
-
end
|
41
|
-
|
42
|
-
def description
|
43
|
-
<<-EOD
|
44
|
-
inf[o] f[ile]
|
45
|
-
|
46
|
-
#{short_description}
|
47
|
-
|
48
|
-
It informs about file name, number of lines, possible breakpoints in
|
49
|
-
the file, last modification time and sha1 digest.
|
50
|
-
EOD
|
51
|
-
end
|
52
|
-
|
53
54
|
private
|
54
55
|
|
55
56
|
def info_file_basic(file)
|
@@ -64,8 +65,7 @@ module Byebug
|
|
64
65
|
breakpoints = Breakpoint.potential_lines(file)
|
65
66
|
return unless breakpoints
|
66
67
|
|
67
|
-
breakpoints.to_a.sort.
|
68
|
-
displaywidth: Setting[:width])
|
68
|
+
breakpoints.to_a.sort.join(' ')
|
69
69
|
end
|
70
70
|
|
71
71
|
def info_file_mtime(file)
|
@@ -6,26 +6,28 @@ module Byebug
|
|
6
6
|
#
|
7
7
|
# Information about current location
|
8
8
|
#
|
9
|
-
class
|
10
|
-
|
11
|
-
/^\s* l(?:ine)? \s*$/x
|
12
|
-
end
|
9
|
+
class LineCommand < Command
|
10
|
+
self.allow_in_post_mortem = true
|
13
11
|
|
14
|
-
def
|
15
|
-
|
16
|
-
end
|
17
|
-
|
18
|
-
def short_description
|
19
|
-
'Line number and file name of current position in source file.'
|
12
|
+
def self.regexp
|
13
|
+
/^\s* l(?:ine)? \s*$/x
|
20
14
|
end
|
21
15
|
|
22
|
-
def description
|
16
|
+
def self.description
|
23
17
|
<<-EOD
|
24
18
|
inf[o] l[ine]
|
25
19
|
|
26
20
|
#{short_description}
|
27
21
|
EOD
|
28
22
|
end
|
23
|
+
|
24
|
+
def self.short_description
|
25
|
+
'Line number and file name of current position in source file.'
|
26
|
+
end
|
27
|
+
|
28
|
+
def execute
|
29
|
+
puts "Line #{frame.line} of \"#{frame.file}\""
|
30
|
+
end
|
29
31
|
end
|
30
32
|
end
|
31
33
|
end
|
@@ -6,32 +6,28 @@ module Byebug
|
|
6
6
|
#
|
7
7
|
# Information about arguments of the current method/block
|
8
8
|
#
|
9
|
-
class
|
10
|
-
|
9
|
+
class ProgramCommand < Command
|
10
|
+
self.allow_in_post_mortem = true
|
11
|
+
|
12
|
+
def self.regexp
|
11
13
|
/^\s* p(?:rogram)? \s*$/x
|
12
14
|
end
|
13
15
|
|
14
|
-
def
|
15
|
-
|
16
|
-
|
17
|
-
excpt = Byebug.last_exception
|
18
|
-
return puts("Exception: #{excpt.inspect}") if excpt
|
19
|
-
end
|
16
|
+
def self.description
|
17
|
+
<<-EOD
|
18
|
+
inf[o] p[rogram]
|
20
19
|
|
21
|
-
|
22
|
-
|
20
|
+
#{short_description}
|
21
|
+
EOD
|
23
22
|
end
|
24
23
|
|
25
|
-
def short_description
|
24
|
+
def self.short_description
|
26
25
|
'Information about the current status of the debugged program.'
|
27
26
|
end
|
28
27
|
|
29
|
-
def
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
#{short_description}
|
34
|
-
EOD
|
28
|
+
def execute
|
29
|
+
puts 'Program stopped. '
|
30
|
+
format_stop_reason context.stop_reason
|
35
31
|
end
|
36
32
|
|
37
33
|
private
|
@@ -6,23 +6,25 @@ module Byebug
|
|
6
6
|
#
|
7
7
|
class InterruptCommand < Command
|
8
8
|
self.allow_in_control = true
|
9
|
-
self.allow_in_post_mortem = false
|
10
9
|
|
11
|
-
def regexp
|
12
|
-
/^\s*
|
10
|
+
def self.regexp
|
11
|
+
/^\s*int(?:errupt)?\s*$/
|
13
12
|
end
|
14
13
|
|
15
|
-
def
|
16
|
-
context = Byebug.thread_context(Thread.main)
|
17
|
-
context.interrupt
|
18
|
-
end
|
19
|
-
|
20
|
-
def description
|
14
|
+
def self.description
|
21
15
|
<<-EOD
|
22
|
-
|
16
|
+
int[errupt]
|
23
17
|
|
24
|
-
|
18
|
+
#{short_description}
|
25
19
|
EOD
|
26
20
|
end
|
21
|
+
|
22
|
+
def self.short_description
|
23
|
+
'Interrupts the program'
|
24
|
+
end
|
25
|
+
|
26
|
+
def execute
|
27
|
+
Byebug.thread_context(Thread.main).interrupt
|
28
|
+
end
|
27
29
|
end
|
28
30
|
end
|
data/lib/byebug/commands/irb.rb
CHANGED
@@ -6,24 +6,30 @@ module Byebug
|
|
6
6
|
# Enter IRB from byebug's prompt
|
7
7
|
#
|
8
8
|
class IrbCommand < Command
|
9
|
-
|
9
|
+
self.allow_in_post_mortem = true
|
10
|
+
|
11
|
+
def self.regexp
|
10
12
|
/^\s* irb \s*$/x
|
11
13
|
end
|
12
14
|
|
15
|
+
def self.description
|
16
|
+
<<-EOD
|
17
|
+
irb
|
18
|
+
|
19
|
+
#{short_description}
|
20
|
+
EOD
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.short_description
|
24
|
+
'Starts an IRB session'
|
25
|
+
end
|
26
|
+
|
13
27
|
def execute
|
14
|
-
unless
|
28
|
+
unless processor.interface.is_a?(LocalInterface)
|
15
29
|
return errmsg(pr('base.errors.only_local'))
|
16
30
|
end
|
17
31
|
|
18
32
|
IRB.start(__FILE__)
|
19
33
|
end
|
20
|
-
|
21
|
-
def description
|
22
|
-
<<-EOD
|
23
|
-
irb
|
24
|
-
|
25
|
-
Starts an Interactive Ruby (IRB) session.
|
26
|
-
EOD
|
27
|
-
end
|
28
34
|
end
|
29
35
|
end
|
data/lib/byebug/commands/kill.rb
CHANGED
@@ -7,33 +7,39 @@ module Byebug
|
|
7
7
|
class KillCommand < Command
|
8
8
|
self.allow_in_control = true
|
9
9
|
|
10
|
-
def regexp
|
10
|
+
def self.regexp
|
11
11
|
/^\s* (?:kill) \s* (?:\s+(\S+))? \s*$/x
|
12
12
|
end
|
13
13
|
|
14
|
+
def self.description
|
15
|
+
<<-EOD
|
16
|
+
kill[ signal]
|
17
|
+
|
18
|
+
#{short_description}
|
19
|
+
|
20
|
+
Equivalent of Process.kill(Process.pid)
|
21
|
+
EOD
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.short_description
|
25
|
+
'Sends a signal to the current process'
|
26
|
+
end
|
27
|
+
|
14
28
|
def execute
|
15
29
|
if @match[1]
|
16
30
|
signame = @match[1]
|
31
|
+
|
17
32
|
unless Signal.list.member?(signame)
|
18
|
-
errmsg("signal name #{signame} is not a signal I know about\n")
|
19
|
-
return false
|
33
|
+
return errmsg("signal name #{signame} is not a signal I know about\n")
|
20
34
|
end
|
21
|
-
@state.interface.close if 'KILL' == signame
|
22
35
|
else
|
23
36
|
return unless confirm('Really kill? (y/n) ')
|
37
|
+
|
24
38
|
signame = 'KILL'
|
25
39
|
end
|
26
40
|
|
41
|
+
processor.interface.close if 'KILL' == signame
|
27
42
|
Process.kill(signame, Process.pid)
|
28
43
|
end
|
29
|
-
|
30
|
-
def description
|
31
|
-
<<-EOD
|
32
|
-
kill[ signal]
|
33
|
-
|
34
|
-
Send [signal] to Process.pid
|
35
|
-
Equivalent of Process.kill(Process.pid)
|
36
|
-
EOD
|
37
|
-
end
|
38
44
|
end
|
39
45
|
end
|