pry-moves 0.1.8 → 0.1.9
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/Gemfile.lock +17 -18
- data/README.md +6 -1
- data/lib/pry-moves/backtrace.rb +1 -1
- data/lib/pry-moves/commands.rb +1 -0
- data/lib/pry-moves/pry_ext.rb +2 -1
- data/lib/pry-moves/pry_wrapper.rb +0 -1
- data/lib/pry-moves/trace_commands.rb +15 -10
- data/lib/pry-moves/tracer.rb +7 -2
- data/lib/pry-moves/version.rb +1 -1
- data/lib/pry-moves.rb +7 -6
- data/playground/Gemfile.lock +1 -1
- data/playground/sand.rb +11 -72
- data/pry-moves.gemspec +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5c8495d3cd82bfbcb6772aa7c5ba21c06aa5528a5fe9bc064589b5291ddaf2e1
|
4
|
+
data.tar.gz: afe2e3ff6c378e2ea61c7bb21ea6814f68f64b31216f576868808ad6c41a6da2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7ecf92cbc18b7c6e8c1c245d10b9112c264b44a4c7617aa928bcc9a8b2f36f8b61728806b9483e65c2aa8fc5f9d1f13374c4614d92a360a9cec52102ab80166
|
7
|
+
data.tar.gz: 7da0796248828d36db8fcd305e95a28f7d3e1a517178d2e587785b9998fb42d33058f62a1e7d5fa890da965deaaab6a1c21af92366fbb673809100c28f4985c2
|
data/Gemfile.lock
CHANGED
@@ -1,39 +1,38 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
pry-moves (0.1.
|
4
|
+
pry-moves (0.1.8)
|
5
5
|
binding_of_caller (~> 0.7)
|
6
|
-
pry (>= 0.9.10, < 0.
|
6
|
+
pry (>= 0.9.10, < 0.12.0)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
11
|
binding_of_caller (0.8.0)
|
12
12
|
debug_inspector (>= 0.0.1)
|
13
|
-
coderay (1.1.
|
13
|
+
coderay (1.1.2)
|
14
14
|
debug_inspector (0.0.3)
|
15
15
|
diff-lcs (1.3)
|
16
|
-
method_source (0.
|
17
|
-
pry (0.
|
16
|
+
method_source (0.9.0)
|
17
|
+
pry (0.11.3)
|
18
18
|
coderay (~> 1.1.0)
|
19
|
-
method_source (~> 0.
|
20
|
-
slop (~> 3.4)
|
19
|
+
method_source (~> 0.9.0)
|
21
20
|
pry-remote (0.1.8)
|
22
21
|
pry (~> 0.9)
|
23
22
|
slop (~> 3.0)
|
24
|
-
rspec (3.
|
25
|
-
rspec-core (~> 3.
|
26
|
-
rspec-expectations (~> 3.
|
27
|
-
rspec-mocks (~> 3.
|
28
|
-
rspec-core (3.
|
29
|
-
rspec-support (~> 3.
|
30
|
-
rspec-expectations (3.
|
23
|
+
rspec (3.8.0)
|
24
|
+
rspec-core (~> 3.8.0)
|
25
|
+
rspec-expectations (~> 3.8.0)
|
26
|
+
rspec-mocks (~> 3.8.0)
|
27
|
+
rspec-core (3.8.0)
|
28
|
+
rspec-support (~> 3.8.0)
|
29
|
+
rspec-expectations (3.8.1)
|
31
30
|
diff-lcs (>= 1.2.0, < 2.0)
|
32
|
-
rspec-support (~> 3.
|
33
|
-
rspec-mocks (3.
|
31
|
+
rspec-support (~> 3.8.0)
|
32
|
+
rspec-mocks (3.8.0)
|
34
33
|
diff-lcs (>= 1.2.0, < 2.0)
|
35
|
-
rspec-support (~> 3.
|
36
|
-
rspec-support (3.
|
34
|
+
rspec-support (~> 3.8.0)
|
35
|
+
rspec-support (3.8.0)
|
37
36
|
slop (3.6.0)
|
38
37
|
|
39
38
|
PLATFORMS
|
data/README.md
CHANGED
@@ -19,7 +19,8 @@ _An execution control add-on for [Pry][pry]._
|
|
19
19
|
* `c` - **continue**
|
20
20
|
* `bt` - show latest 5 lines from backtrace
|
21
21
|
* `bt 10` - latest 10 lines
|
22
|
-
* `bt
|
22
|
+
* `bt full` - full backtrace
|
23
|
+
* `bt +` - full backtrace with hidden frames. Aliases: `bt hidden` `bt vapid` `bt all`
|
23
24
|
* `bt > foo` - write backtrace to file `log/backtrace_foo.log`
|
24
25
|
* `up`/`down`/`top`/`bottom` - move over call stack
|
25
26
|
* `up +` - move up, including vapid frames (block callers, hidden frames)
|
@@ -111,6 +112,10 @@ Please note that debugging functionality is implemented through
|
|
111
112
|
bundle exec rspec
|
112
113
|
```
|
113
114
|
|
115
|
+
## ToDo
|
116
|
+
|
117
|
+
* `iterate` - steps in into child sub-block - should skip
|
118
|
+
|
114
119
|
## Contributors
|
115
120
|
|
116
121
|
* Gopal Patel ([@nixme](https://github.com/nixme))
|
data/lib/pry-moves/backtrace.rb
CHANGED
@@ -44,7 +44,7 @@ class PryMoves::Backtrace
|
|
44
44
|
|
45
45
|
def build
|
46
46
|
result = []
|
47
|
-
show_vapid = @lines_count
|
47
|
+
show_vapid = %w(+ all hidden vapid).include? @lines_count
|
48
48
|
stack = stack_bindings(show_vapid)
|
49
49
|
.reverse.reject do |binding|
|
50
50
|
binding.eval('__FILE__').match self.class::filter
|
data/lib/pry-moves/commands.rb
CHANGED
data/lib/pry-moves/pry_ext.rb
CHANGED
@@ -2,7 +2,7 @@ module PryMoves::TraceCommands
|
|
2
2
|
|
3
3
|
private
|
4
4
|
|
5
|
-
def trace_step(event, file, line, binding_)
|
5
|
+
def trace_step(event, file, line, method, binding_)
|
6
6
|
return unless event == 'line'
|
7
7
|
|
8
8
|
if @step_in_everywhere
|
@@ -33,7 +33,7 @@ module PryMoves::TraceCommands
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
def trace_next(event, file, line, binding_)
|
36
|
+
def trace_next(event, file, line, method, binding_)
|
37
37
|
traced_method_exit = (@recursion_level < 0 and %w(line call).include? event)
|
38
38
|
if traced_method_exit
|
39
39
|
# Set new traced method, because we left previous one
|
@@ -45,17 +45,22 @@ module PryMoves::TraceCommands
|
|
45
45
|
within_current_method?(file, line)
|
46
46
|
|
47
47
|
if event == 'line'
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
48
|
+
if @stay_at_frame
|
49
|
+
return (
|
50
|
+
@stay_at_frame == frame_digest(binding_.of_caller(3)) or
|
51
|
+
@c_stack_level < 0
|
52
|
+
)
|
53
|
+
else
|
54
|
+
return true
|
55
|
+
end
|
52
56
|
end
|
53
57
|
|
54
|
-
|
58
|
+
exit_from_method if event == 'return' and
|
59
|
+
method != :to_s and before_end?(line)
|
55
60
|
end
|
56
61
|
end
|
57
62
|
|
58
|
-
def trace_finish(event, file, line, binding_)
|
63
|
+
def trace_finish(event, file, line, method, binding_)
|
59
64
|
return unless event == 'line'
|
60
65
|
if @recursion_level < 0 or @method_to_finish != @method
|
61
66
|
if redirect_step_into?(binding_)
|
@@ -73,7 +78,7 @@ module PryMoves::TraceCommands
|
|
73
78
|
end
|
74
79
|
end
|
75
80
|
|
76
|
-
def trace_debug(event, file, line, binding_)
|
81
|
+
def trace_debug(event, file, line, method, binding_)
|
77
82
|
return unless event == 'line'
|
78
83
|
if @first_line_skipped
|
79
84
|
true
|
@@ -83,7 +88,7 @@ module PryMoves::TraceCommands
|
|
83
88
|
end
|
84
89
|
end
|
85
90
|
|
86
|
-
def trace_iterate(event, file, line, binding_)
|
91
|
+
def trace_iterate(event, file, line, method, binding_)
|
87
92
|
return exit_from_method if event == 'return' and
|
88
93
|
within_current_method?(file, line)
|
89
94
|
|
data/lib/pry-moves/tracer.rb
CHANGED
@@ -71,6 +71,8 @@ class Tracer
|
|
71
71
|
|
72
72
|
def set_traced_method(binding)
|
73
73
|
@recursion_level = 0
|
74
|
+
@c_stack_level = 0
|
75
|
+
@stay_at_frame = nil # reset tracked digest
|
74
76
|
|
75
77
|
method = binding.eval 'method(__method__) if __method__'
|
76
78
|
if method
|
@@ -97,13 +99,13 @@ class Tracer
|
|
97
99
|
end
|
98
100
|
|
99
101
|
def tracing_func(event, file, line, id, binding_, klass)
|
100
|
-
#printf "
|
102
|
+
#printf ": %8s %s:%-2d %10s %8s rec:#{@recursion_level} st:#{@c_stack_level}\n", event, file, line, id, klass
|
101
103
|
|
102
104
|
# Ignore traces inside pry-moves code
|
103
105
|
return if file && TRACE_IGNORE_FILES.include?(File.expand_path(file))
|
104
106
|
|
105
107
|
catch (:skip) do
|
106
|
-
if send "trace_#{@action}", event, file, line, binding_
|
108
|
+
if send "trace_#{@action}", event, file, line, id, binding_
|
107
109
|
stop_tracing
|
108
110
|
Pry.start(binding_, @pry_start_options)
|
109
111
|
|
@@ -113,6 +115,9 @@ class Tracer
|
|
113
115
|
delta = event == 'call' ? 1 : -1
|
114
116
|
#puts "recursion #{event}: #{delta}; changed: #{@recursion_level} => #{@recursion_level + delta}"
|
115
117
|
@recursion_level += delta
|
118
|
+
elsif %w(c-call c-return).include?(event)
|
119
|
+
delta = event == 'c-call' ? 1 : -1
|
120
|
+
@c_stack_level += delta
|
116
121
|
end
|
117
122
|
end
|
118
123
|
end
|
data/lib/pry-moves/version.rb
CHANGED
data/lib/pry-moves.rb
CHANGED
@@ -34,6 +34,10 @@ module PryMoves
|
|
34
34
|
@semaphore ||= Mutex.new
|
35
35
|
end
|
36
36
|
|
37
|
+
def locked?
|
38
|
+
semaphore.locked?
|
39
|
+
end
|
40
|
+
|
37
41
|
def lock
|
38
42
|
semaphore.lock unless semaphore.locked?
|
39
43
|
end
|
@@ -47,13 +51,10 @@ module PryMoves
|
|
47
51
|
end
|
48
52
|
|
49
53
|
def synchronize_threads
|
50
|
-
return if Thread.current[:pry_moves_debug]
|
54
|
+
return true if Thread.current[:pry_moves_debug]
|
51
55
|
|
52
|
-
semaphore.synchronize {}
|
53
|
-
|
54
|
-
puts e.backtrace.reverse
|
55
|
-
puts e
|
56
|
-
raise e
|
56
|
+
semaphore.synchronize {} rescue return
|
57
|
+
true
|
57
58
|
end
|
58
59
|
|
59
60
|
# Reference to currently running pry-remote server. Used by the tracer.
|
data/playground/Gemfile.lock
CHANGED
data/playground/sand.rb
CHANGED
@@ -1,84 +1,23 @@
|
|
1
1
|
require 'pry-moves'
|
2
2
|
require './tracer.rb'
|
3
|
+
require './playground.rb'
|
3
4
|
|
4
|
-
|
5
|
-
|
6
|
-
a = 2 + 1
|
7
|
-
puts param
|
5
|
+
def debug?(something)
|
6
|
+
puts something
|
8
7
|
end
|
9
8
|
|
10
|
-
|
11
|
-
|
12
|
-
def initialize
|
13
|
-
puts :xuilo
|
14
|
-
end
|
15
|
-
|
16
|
-
def aa
|
17
|
-
puts 'aa: step 1'
|
18
|
-
puts 'aa: step 2'
|
19
|
-
end
|
20
|
-
|
21
|
-
def bb
|
22
|
-
debug_redirect = :aa
|
23
|
-
hide_from_stack = true
|
24
|
-
puts 'bb: step 1'
|
25
|
-
puts 'bb: step 2'
|
26
|
-
aa
|
27
|
-
end
|
28
|
-
|
29
|
-
def cc
|
30
|
-
koko = :love
|
31
|
-
binding.pry
|
32
|
-
bb
|
33
|
-
(2..4).each do |i|
|
34
|
-
puts i
|
35
|
-
end
|
36
|
-
puts :two
|
37
|
-
end
|
38
|
-
alias cc_al cc
|
39
|
-
|
9
|
+
def sentence
|
10
|
+
:opa
|
40
11
|
end
|
41
12
|
|
42
|
-
def fff
|
43
|
-
binding.pry # stop in native_block
|
44
|
-
#2.times do |i|
|
45
|
-
iterator do |i|
|
46
|
-
dummy = 1 # inside block
|
47
|
-
return
|
48
|
-
dummy = 2
|
49
|
-
end
|
50
|
-
puts :ss
|
51
|
-
:after_block # after block
|
52
|
-
end
|
53
13
|
|
54
|
-
def
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
end
|
60
|
-
end
|
14
|
+
def aaa
|
15
|
+
puts :ok
|
16
|
+
"rule#{1}"
|
17
|
+
binding.pry if debug? "rule#{1}"
|
18
|
+
puts :ok
|
61
19
|
|
62
|
-
def ff
|
63
|
-
fff
|
64
|
-
puts :aaa
|
65
20
|
end
|
66
21
|
|
67
|
-
ff
|
68
|
-
|
69
|
-
puts :prepare
|
70
|
-
|
71
|
-
A.new.cc_al
|
72
|
-
A.new.cc_al
|
73
|
-
|
74
|
-
|
75
|
-
bb = 1
|
76
|
-
|
77
|
-
exit
|
78
|
-
|
79
|
-
pp = 123 if debucher?
|
80
|
-
binding.pry if debucher?
|
81
|
-
|
82
22
|
binding.pry
|
83
|
-
|
84
|
-
puts :ok
|
23
|
+
aaa
|
data/pry-moves.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |gem|
|
|
19
19
|
|
20
20
|
# Dependencies
|
21
21
|
gem.required_ruby_version = '>= 1.8.7'
|
22
|
-
gem.add_runtime_dependency 'pry', '>= 0.
|
22
|
+
gem.add_runtime_dependency 'pry', '>= 0.10.4', '< 0.12.0'
|
23
23
|
gem.add_runtime_dependency 'binding_of_caller', '~> 0.7'
|
24
24
|
gem.add_development_dependency 'pry-remote', '~> 0.1.6'
|
25
25
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pry-moves
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- garmoshka-mo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -16,20 +16,20 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.10.4
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.
|
22
|
+
version: 0.12.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.
|
29
|
+
version: 0.10.4
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 0.
|
32
|
+
version: 0.12.0
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: binding_of_caller
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -126,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
126
|
version: '0'
|
127
127
|
requirements: []
|
128
128
|
rubyforge_project:
|
129
|
-
rubygems_version: 2.
|
129
|
+
rubygems_version: 2.7.7
|
130
130
|
signing_key:
|
131
131
|
specification_version: 4
|
132
132
|
summary: Debugger for ruby
|