pry-byebug 3.3.0 → 3.9.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 +5 -5
- data/CHANGELOG.md +141 -71
- data/LICENSE +2 -2
- data/README.md +67 -31
- data/lib/byebug/processors/pry_processor.rb +22 -6
- data/lib/pry/byebug/breakpoints.rb +9 -6
- data/lib/pry-byebug/base.rb +13 -9
- data/lib/pry-byebug/cli.rb +6 -3
- data/lib/pry-byebug/commands/backtrace.rb +31 -0
- data/lib/pry-byebug/commands/breakpoint.rb +24 -20
- data/lib/pry-byebug/commands/continue.rb +9 -5
- data/lib/pry-byebug/commands/down.rb +6 -4
- data/lib/pry-byebug/commands/exit_all.rb +4 -0
- data/lib/pry-byebug/commands/finish.rb +6 -4
- data/lib/pry-byebug/commands/frame.rb +7 -5
- data/lib/pry-byebug/commands/next.rb +7 -5
- data/lib/pry-byebug/commands/step.rb +7 -5
- data/lib/pry-byebug/commands/up.rb +6 -4
- data/lib/pry-byebug/commands.rb +12 -9
- data/lib/pry-byebug/control_d_handler.rb +4 -2
- data/lib/pry-byebug/helpers/breakpoints.rb +23 -25
- data/lib/pry-byebug/helpers/location.rb +24 -0
- data/lib/pry-byebug/helpers/multiline.rb +2 -0
- data/lib/pry-byebug/helpers/navigation.rb +4 -2
- data/lib/pry-byebug/pry_ext.rb +6 -4
- data/lib/pry-byebug/pry_remote_ext.rb +7 -5
- data/lib/pry-byebug/version.rb +3 -1
- data/lib/pry-byebug.rb +4 -5
- metadata +12 -11
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 5a9be5ab97e10c1247774626e9dee655956d904dfcbdb0e601af7eabcee668a4
|
|
4
|
+
data.tar.gz: a151143361a89b102f85102c95c7b86a4743413822e69fefcf67087a93cd29cf
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 75a234974314f675ba12d4c435897541c40e63b67807f03239665c31f6ecef9b06a3456ba9d577b9d255e0b59efd55b9486280884c788519a63e783920226a7d
|
|
7
|
+
data.tar.gz: bc5e1fcc9a82f7ed703d9b9e6272e8f8026300398e4f9265f3e72e9d84d066fa861492ee2e7a6a35c91345444160bdf39bab957c6b638d9b33ab735059b722c9
|
data/CHANGELOG.md
CHANGED
|
@@ -1,144 +1,214 @@
|
|
|
1
|
-
|
|
1
|
+
# CHANGELOG
|
|
2
|
+
|
|
3
|
+
## Master (Unreleased)
|
|
4
|
+
|
|
5
|
+
## 3.9.0 (2020-03-21)
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
* Dependency on pry being too loose. Now breaking minor releases of pry won't affect pry-byebug users (#289).
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
* Support for pry 0.13.0 (#266).
|
|
14
|
+
|
|
15
|
+
### Removed
|
|
16
|
+
|
|
17
|
+
* Support for pry older than 0.13.0 (#289).
|
|
18
|
+
|
|
19
|
+
## 3.8.0 (2020-01-22)
|
|
20
|
+
|
|
21
|
+
### Fixed
|
|
22
|
+
|
|
23
|
+
* Use `Binding#source_location` instead of evaluating `__FILE__` to avoid
|
|
24
|
+
warnings on Ruby 2.7 and on Ruby 2.6 in verbose mode (#221).
|
|
25
|
+
|
|
26
|
+
### Removed
|
|
27
|
+
|
|
28
|
+
* Support for Ruby 2.3. Pry-byebug no longer installs on this platform.
|
|
29
|
+
|
|
30
|
+
## 3.7.0 (2019-02-21)
|
|
31
|
+
|
|
32
|
+
* Byebug 11 compatibility, with ruby 2.6 support.
|
|
33
|
+
|
|
34
|
+
## 3.6.0 (2018-02-07)
|
|
35
|
+
|
|
36
|
+
### Added
|
|
37
|
+
|
|
38
|
+
* Byebug 10 compatibility, with ruby 2.5 support.
|
|
39
|
+
|
|
40
|
+
## 3.5.1 (2017-11-27)
|
|
41
|
+
|
|
42
|
+
### Fixed
|
|
43
|
+
|
|
44
|
+
* Allow other threads like Pry (#142).
|
|
45
|
+
|
|
46
|
+
## 3.5.0 (2017-08-23)
|
|
47
|
+
|
|
48
|
+
### Added
|
|
49
|
+
|
|
50
|
+
* Byebug 9.1 support. As a result, Ruby 2.0 & Ruby 2.1 support has been dropped.
|
|
51
|
+
Pry-byebug no longer installs on these platforms.
|
|
2
52
|
|
|
3
|
-
-
|
|
4
|
-
* Up to date dependencies, including byebug 8.0 series.
|
|
5
|
-
* Faster debugger thanks to @k0kubun (#80).
|
|
53
|
+
## 3.4.3 (2017-08-22)
|
|
6
54
|
|
|
7
|
-
|
|
8
|
-
* Fix encoding error in gemspec file (#70).
|
|
55
|
+
### Fixed
|
|
9
56
|
|
|
57
|
+
* Installation on old rubies after byebug dropping support for them.
|
|
58
|
+
|
|
59
|
+
## 3.4.2 (2016-12-06)
|
|
60
|
+
|
|
61
|
+
### Fixed
|
|
62
|
+
|
|
63
|
+
* Byebug doesn't start after `disable-pry` command.
|
|
64
|
+
|
|
65
|
+
## 3.4.1 (2016-11-22)
|
|
66
|
+
|
|
67
|
+
### Fixed
|
|
68
|
+
|
|
69
|
+
* control_d handler not being required properly when `pry-byebug` loaded
|
|
70
|
+
as a `pry` plugin and not through explicit require.
|
|
71
|
+
|
|
72
|
+
## 3.4.0 (2016-05-15)
|
|
73
|
+
|
|
74
|
+
### Fixed
|
|
75
|
+
|
|
76
|
+
* Byebug 9 compatibility.
|
|
77
|
+
|
|
78
|
+
### Added
|
|
79
|
+
|
|
80
|
+
* A new `backtrace` command.
|
|
81
|
+
|
|
82
|
+
## 3.3.0 (2015-11-05)
|
|
83
|
+
|
|
84
|
+
### Fixed
|
|
85
|
+
|
|
86
|
+
* Byebug 8 compatibility.
|
|
87
|
+
* Fix encoding error in gemspec file (#70).
|
|
88
|
+
* Debugger being too slow (#80, thanks @k0kubun).
|
|
10
89
|
|
|
11
90
|
## 3.2.0 (2015-07-18)
|
|
12
91
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
* Up to date dependencies.
|
|
92
|
+
### Added
|
|
93
|
+
|
|
94
|
+
* `continue` can now receive a line number argument (#56).
|
|
17
95
|
|
|
18
|
-
|
|
19
|
-
* Don't conflict with `break` and `next` Ruby keywords inside multiline
|
|
20
|
-
statements (#44).
|
|
96
|
+
### Fixed
|
|
21
97
|
|
|
22
|
-
|
|
23
|
-
|
|
98
|
+
* Conflicts with `break` and `next` Ruby keywords inside multiline statements
|
|
99
|
+
(#44).
|
|
24
100
|
|
|
101
|
+
### Removed
|
|
102
|
+
|
|
103
|
+
* `breaks` command. It was broken anyways (#47).
|
|
25
104
|
|
|
26
105
|
## 3.1.0 (2015-04-14)
|
|
27
106
|
|
|
28
|
-
|
|
29
|
-
* Add frame nav commands up, down and frame.
|
|
107
|
+
### Added
|
|
30
108
|
|
|
109
|
+
* Frame navigation commands `up`, `down` and `frame`.
|
|
31
110
|
|
|
32
111
|
## 3.0.1 (2015-04-02)
|
|
33
112
|
|
|
34
|
-
|
|
35
|
-
* Fix several formatting and alignment issues.
|
|
113
|
+
### Fixed
|
|
36
114
|
|
|
115
|
+
* Several formatting and alignment issues.
|
|
37
116
|
|
|
38
117
|
## 3.0.0 (2015-02-02)
|
|
39
118
|
|
|
40
|
-
|
|
41
|
-
* Adds RuboCop to enforce a consistent code style.
|
|
42
|
-
* Several refactorings to keep code simpler.
|
|
119
|
+
### Fixed
|
|
43
120
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
line of a method/block.
|
|
121
|
+
* `binding.pry` would not stop at the correct place when called at the last
|
|
122
|
+
line of a method/block.
|
|
47
123
|
|
|
48
|
-
|
|
49
|
-
* Stepping aliases for `next` (`n`), `step` (`s`), `finish` (`f`) and
|
|
50
|
-
`continue` (`c`). See #34.
|
|
124
|
+
### Removed
|
|
51
125
|
|
|
126
|
+
* Stepping aliases for `next` (`n`), `step` (`s`), `finish` (`f`) and `continue`
|
|
127
|
+
(`c`). See #34.
|
|
52
128
|
|
|
53
129
|
## 2.0.0 (2014-01-09)
|
|
54
130
|
|
|
55
|
-
|
|
56
|
-
* Compatibility with byebug 3
|
|
57
|
-
* Now pry starts at the first line after binding.pry, not at binding.pry
|
|
58
|
-
- Bugfixes:
|
|
59
|
-
* 'continue' doesn't finish pry instance (issue #13)
|
|
131
|
+
### Fixed
|
|
60
132
|
|
|
133
|
+
* Byebug 3 compatibility.
|
|
134
|
+
* Pry not starting at the first line after `binding.pry` but at `binding.pry`.
|
|
135
|
+
* `continue` not finishing pry instance (#13).
|
|
61
136
|
|
|
62
137
|
## 1.3.3 (2014-25-06)
|
|
63
138
|
|
|
64
|
-
|
|
65
|
-
level releases.
|
|
139
|
+
### Fixed
|
|
66
140
|
|
|
141
|
+
* Pry 0.10 series and further minor version level releases compatibility.
|
|
67
142
|
|
|
68
143
|
## 1.3.2 (2014-24-02)
|
|
69
144
|
|
|
70
|
-
|
|
145
|
+
### Fixed
|
|
71
146
|
|
|
147
|
+
* Bug inherited from `byebug`.
|
|
72
148
|
|
|
73
149
|
## 1.3.1 (2014-08-02)
|
|
74
150
|
|
|
75
|
-
|
|
151
|
+
### Fixed
|
|
76
152
|
|
|
153
|
+
* Bug #22 (thanks @andreychernih).
|
|
77
154
|
|
|
78
155
|
## 1.3.0 (2014-05-02)
|
|
79
156
|
|
|
80
|
-
|
|
81
|
-
|
|
157
|
+
### Added
|
|
158
|
+
|
|
159
|
+
* Breakpoints on method names (thanks @andreychernih & @palkan).
|
|
160
|
+
|
|
161
|
+
### Fixed
|
|
82
162
|
|
|
163
|
+
* "Undefined method `interface`" error (huge thanks to @andreychernih).
|
|
83
164
|
|
|
84
165
|
## 1.2.1 (2013-30-12)
|
|
85
166
|
|
|
86
|
-
|
|
167
|
+
### Fixed
|
|
87
168
|
|
|
169
|
+
* "Uncaught throw :breakout_nav" error (thanks @lukebergen).
|
|
88
170
|
|
|
89
171
|
## 1.2.0 (2013-24-09)
|
|
90
172
|
|
|
91
|
-
|
|
173
|
+
### Fixed
|
|
92
174
|
|
|
175
|
+
* Compatibility with byebug's 2.x series
|
|
93
176
|
|
|
94
177
|
## 1.1.2 (2013-11-07)
|
|
95
178
|
|
|
96
|
-
|
|
179
|
+
### Fixed
|
|
97
180
|
|
|
181
|
+
* Compatibility with backwards compatible byebug versions.
|
|
98
182
|
|
|
99
183
|
## 1.1.1 (2013-02-07)
|
|
100
184
|
|
|
101
|
-
|
|
102
|
-
* Fixes bug when doing "step n" or "next n" where n > 1 right after binding.pry
|
|
185
|
+
### Fixed
|
|
103
186
|
|
|
187
|
+
* Bug when doing `step n` or `next n` where n > 1 right after `binding.pry`.
|
|
104
188
|
|
|
105
189
|
## 1.1.0 (2013-06-06)
|
|
106
190
|
|
|
107
|
-
|
|
108
|
-
* Uses byebug ~> 1.4.0
|
|
109
|
-
* Uses s, n, f and c aliases by default (thanks @jgakos!)
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
## 1.0.0, 1.0.1 (2013-05-07)
|
|
113
|
-
|
|
114
|
-
* Forked from [pry-debugger](https://github.com/nixme/pry-debugger) to support
|
|
115
|
-
byebug
|
|
116
|
-
* Dropped pry-remote support
|
|
117
|
-
|
|
191
|
+
### Added
|
|
118
192
|
|
|
119
|
-
|
|
193
|
+
* `s`, `n`, `f` and `c` aliases (thanks @jgakos!).
|
|
120
194
|
|
|
121
|
-
|
|
195
|
+
## 1.0.1 (2013-05-07)
|
|
122
196
|
|
|
197
|
+
### Fixed
|
|
123
198
|
|
|
124
|
-
|
|
199
|
+
* Unwanted debugging printf.
|
|
125
200
|
|
|
126
|
-
|
|
127
|
-
* Fix support for specifying breakpoints by *file:line_number*. (@nviennot)
|
|
128
|
-
* Validate breakpoint conditionals are real Ruby expressions.
|
|
129
|
-
* Support for debugger ~> 1.2.0. (@jshou)
|
|
130
|
-
* Safer `alias_method_chain`-style patching of `Pry.start` and
|
|
131
|
-
`PryRemote::Server#teardown`. (@benizi)
|
|
201
|
+
## 1.0.0 (2013-05-07)
|
|
132
202
|
|
|
203
|
+
### Added
|
|
133
204
|
|
|
134
|
-
|
|
205
|
+
* Initial release forked from
|
|
206
|
+
[pry-debugger](https://github.com/nixme/pry-debugger) to support byebug.
|
|
135
207
|
|
|
136
|
-
|
|
137
|
-
* **finish** command
|
|
138
|
-
* Internal cleanup and bug fixes
|
|
208
|
+
### Removed
|
|
139
209
|
|
|
210
|
+
* pry-remote support.
|
|
140
211
|
|
|
141
|
-
##
|
|
212
|
+
## Older releases
|
|
142
213
|
|
|
143
|
-
*
|
|
144
|
-
[pry-remote 0.1.4][pry-remote] support.
|
|
214
|
+
* Check [pry-debugger](https://github.com/nixme/pry-debugger)'s CHANGELOG.
|
data/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
MIT
|
|
1
|
+
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) David Rodríguez <deivid.rodriguez@
|
|
3
|
+
Copyright (c) 2018 David Rodríguez <deivid.rodriguez@riseup.net>
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
6
|
this software and associated documentation files (the "Software"), to deal in
|
data/README.md
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
# pry-byebug
|
|
2
|
+
|
|
2
3
|
[![Version][VersionBadge]][VersionURL]
|
|
3
|
-
[![Build][
|
|
4
|
+
[![Build][CIBadge]][CIURL]
|
|
4
5
|
[![Inline docs][InchCIBadge]][InchCIURL]
|
|
5
|
-
[![Gittip][GittipBadge]][GittipURL]
|
|
6
6
|
[![Coverage][CoverageBadge]][CoverageURL]
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
Adds **step**, **next**, **finish** and **continue** commands and
|
|
11
|
-
**breakpoints** to [Pry][pry] using [byebug][byebug].
|
|
8
|
+
Adds step-by-step debugging and stack navigation capabilities to [pry] using
|
|
9
|
+
[byebug].
|
|
12
10
|
|
|
13
11
|
To use, invoke pry normally. No need to start your script or app differently.
|
|
14
12
|
Execution will stop in the first statement after your `binding.pry`.
|
|
@@ -23,34 +21,32 @@ some_method # Execution will stop here.
|
|
|
23
21
|
puts 'Goodbye World' # Run 'next' in the console to move here.
|
|
24
22
|
```
|
|
25
23
|
|
|
26
|
-
|
|
27
24
|
## Requirements
|
|
28
25
|
|
|
29
|
-
|
|
30
|
-
[pry-debugger][].
|
|
31
|
-
|
|
32
|
-
* Recommended:
|
|
33
|
-
- MRI 2.1.7 or higher.
|
|
34
|
-
- MRI 2.2.3 or higher.
|
|
35
|
-
|
|
26
|
+
MRI 2.4.0 or higher.
|
|
36
27
|
|
|
37
28
|
## Installation
|
|
38
29
|
|
|
39
|
-
|
|
30
|
+
Add
|
|
40
31
|
|
|
41
32
|
```ruby
|
|
42
33
|
gem 'pry-byebug'
|
|
43
34
|
```
|
|
44
35
|
|
|
45
|
-
|
|
36
|
+
to your Gemfile and run
|
|
37
|
+
|
|
38
|
+
```console
|
|
39
|
+
bundle install
|
|
40
|
+
```
|
|
46
41
|
|
|
47
|
-
|
|
42
|
+
Make sure you include the gem globally or inside the `:test` group if you plan
|
|
43
|
+
to use it to debug your tests!
|
|
48
44
|
|
|
49
|
-
|
|
50
|
-
to use it to debug your tests!_
|
|
45
|
+
## Commands
|
|
51
46
|
|
|
47
|
+
### Step-by-step debugging
|
|
52
48
|
|
|
53
|
-
|
|
49
|
+
**break:** Manage breakpoints.
|
|
54
50
|
|
|
55
51
|
**step:** Step execution into the next line or method. Takes an optional numeric
|
|
56
52
|
argument to step multiple times.
|
|
@@ -62,6 +58,11 @@ optional numeric argument to step multiple lines.
|
|
|
62
58
|
|
|
63
59
|
**continue:** Continue program execution and end the Pry session.
|
|
64
60
|
|
|
61
|
+
### Callstack navigation
|
|
62
|
+
|
|
63
|
+
**backtrace:** Shows the current stack. You can use the numbers on the left
|
|
64
|
+
side with the `frame` command to navigate the stack.
|
|
65
|
+
|
|
65
66
|
**up:** Moves the stack frame up. Takes an optional numeric argument to move
|
|
66
67
|
multiple frames.
|
|
67
68
|
|
|
@@ -99,7 +100,6 @@ Pry::Commands.command /^$/, "repeat last command" do
|
|
|
99
100
|
end
|
|
100
101
|
```
|
|
101
102
|
|
|
102
|
-
|
|
103
103
|
## Breakpoints
|
|
104
104
|
|
|
105
105
|
You can set and adjust breakpoints directly from a Pry session using the
|
|
@@ -129,28 +129,64 @@ break --show 2 # Show details about breakpoint #2.
|
|
|
129
129
|
|
|
130
130
|
Type `break --help` from a Pry session to see all available options.
|
|
131
131
|
|
|
132
|
+
## Alternatives
|
|
133
|
+
|
|
134
|
+
Note that all of the alternatives here are incompatible with pry-byebug. If
|
|
135
|
+
your platform is supported by pry-byebug, you should remove any of the gems
|
|
136
|
+
mentioned here if they are present in your Gemfile.
|
|
137
|
+
|
|
138
|
+
* [pry-debugger]: Provides step-by-step debugging for MRI 1.9.3 or older
|
|
139
|
+
rubies. If you're still using those and need a step-by-step debugger to help
|
|
140
|
+
with the upgrade, pry-debugger can be handy.
|
|
141
|
+
|
|
142
|
+
* [pry-stack_explorer]: Provides stack navigation capabilities for MRI 1.9.3 or
|
|
143
|
+
older rubies. If you're still using those and need to navigate your stack to
|
|
144
|
+
help with the upgrade, pry-stack_explorer can be handy.
|
|
145
|
+
|
|
146
|
+
* [pry-nav]: Provides step-by-step debugging for JRuby.
|
|
147
|
+
|
|
148
|
+
## Contribute
|
|
149
|
+
|
|
150
|
+
See [Getting Started with Development](CONTRIBUTING.md).
|
|
151
|
+
|
|
152
|
+
## Funding
|
|
153
|
+
|
|
154
|
+
Subscribe to [Tidelift] to ensure pry-byebug stays actively maintained, and at
|
|
155
|
+
the same time get licensing assurances and timely security notifications for
|
|
156
|
+
your open source dependencies.
|
|
157
|
+
|
|
158
|
+
You can also help `pry-byebug` by leaving a small (or big) tip through [Liberapay].
|
|
159
|
+
|
|
160
|
+
[Tidelift]: https://tidelift.com/subscription/pkg/rubygems-pry-byebug?utm_source=rubygems-pry-byebug&utm_medium=referral&utm_campaign=readme
|
|
161
|
+
[Liberapay]: https://liberapay.com/pry-byebug/donate
|
|
162
|
+
|
|
163
|
+
## Security contact information
|
|
164
|
+
|
|
165
|
+
Please use the Tidelift security contact to [report a security vulnerability].
|
|
166
|
+
Tidelift will coordinate the fix and disclosure.
|
|
167
|
+
|
|
168
|
+
[report a security vulnerability]: https://tidelift.com/security
|
|
132
169
|
|
|
133
170
|
## Credits
|
|
134
171
|
|
|
135
|
-
* Gopal Patel (@nixme), creator of [pry-debugger]
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
* John Mair (@banister), creator of [pry]
|
|
172
|
+
* Gopal Patel (@nixme), creator of [pry-debugger], and everybody who contributed
|
|
173
|
+
to it. pry-byebug is a fork of pry-debugger so it wouldn't exist as it is
|
|
174
|
+
without those contributions.
|
|
175
|
+
* John Mair (@banister), creator of [pry].
|
|
139
176
|
|
|
140
177
|
Patches and bug reports are welcome.
|
|
141
178
|
|
|
142
179
|
[pry]: http://pry.github.com
|
|
143
180
|
[byebug]: https://github.com/deivid-rodriguez/byebug
|
|
144
181
|
[pry-debugger]: https://github.com/nixme/pry-debugger
|
|
182
|
+
[pry-nav]: https://github.com/nixme/pry-nav
|
|
145
183
|
[pry-stack_explorer]: https://github.com/pry/pry-stack_explorer
|
|
146
184
|
|
|
147
185
|
[VersionBadge]: https://badge.fury.io/rb/pry-byebug.svg
|
|
148
186
|
[VersionURL]: http://badge.fury.io/rb/pry-byebug
|
|
149
|
-
[
|
|
150
|
-
[
|
|
187
|
+
[CIBadge]: https://github.com/deivid-rodriguez/pry-byebug/workflows/ubuntu/badge.svg?branch=master
|
|
188
|
+
[CIURL]: https://github.com/deivid-rodriguez/pry-byebug/actions?query=workflow%3Aubuntu
|
|
151
189
|
[InchCIBadge]: http://inch-ci.org/github/deivid-rodriguez/pry-byebug.svg?branch=master
|
|
152
190
|
[InchCIURL]: http://inch-ci.org/github/deivid-rodriguez/pry-byebug
|
|
153
|
-
[
|
|
154
|
-
[
|
|
155
|
-
[CoverageBadge]: https://img.shields.io/codeclimate/coverage/github/deivid-rodriguez/pry-byebug.svg
|
|
156
|
-
[CoverageURL]: https://codeclimate.com/github/deivid-rodriguez/pry-byebug
|
|
191
|
+
[CoverageBadge]: https://api.codeclimate.com/v1/badges/a88e27809329c03af017/test_coverage
|
|
192
|
+
[CoverageURL]: https://codeclimate.com/github/deivid-rodriguez/pry-byebug/test_coverage
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "byebug/core"
|
|
2
4
|
|
|
3
5
|
module Byebug
|
|
4
6
|
#
|
|
@@ -25,7 +27,7 @@ module Byebug
|
|
|
25
27
|
return_value = nil
|
|
26
28
|
|
|
27
29
|
command = catch(:breakout_nav) do # Throws from PryByebug::Commands
|
|
28
|
-
return_value = yield
|
|
30
|
+
return_value = allowing_other_threads { yield }
|
|
29
31
|
{} # Nothing thrown == no navigational command
|
|
30
32
|
end
|
|
31
33
|
|
|
@@ -41,7 +43,15 @@ module Byebug
|
|
|
41
43
|
# Set up a number of navigational commands to be performed by Byebug.
|
|
42
44
|
#
|
|
43
45
|
def perform(action, options = {})
|
|
44
|
-
return unless %i
|
|
46
|
+
return unless %i[
|
|
47
|
+
backtrace
|
|
48
|
+
down
|
|
49
|
+
finish
|
|
50
|
+
frame
|
|
51
|
+
next
|
|
52
|
+
step
|
|
53
|
+
up
|
|
54
|
+
].include?(action)
|
|
45
55
|
|
|
46
56
|
send("perform_#{action}", options)
|
|
47
57
|
end
|
|
@@ -83,7 +93,7 @@ module Byebug
|
|
|
83
93
|
expr = breakpoint.expr
|
|
84
94
|
return unless expr
|
|
85
95
|
|
|
86
|
-
output.puts bold(
|
|
96
|
+
output.puts bold("Condition: ") + expr
|
|
87
97
|
end
|
|
88
98
|
|
|
89
99
|
private
|
|
@@ -91,7 +101,7 @@ module Byebug
|
|
|
91
101
|
def n_hits(breakpoint)
|
|
92
102
|
n_hits = breakpoint.hit_count
|
|
93
103
|
|
|
94
|
-
n_hits == 1 ?
|
|
104
|
+
n_hits == 1 ? "First hit" : "Hit #{n_hits} times."
|
|
95
105
|
end
|
|
96
106
|
|
|
97
107
|
#
|
|
@@ -109,6 +119,12 @@ module Byebug
|
|
|
109
119
|
end
|
|
110
120
|
end
|
|
111
121
|
|
|
122
|
+
def perform_backtrace(_options)
|
|
123
|
+
Byebug::WhereCommand.new(self, "backtrace").execute
|
|
124
|
+
|
|
125
|
+
resume_pry
|
|
126
|
+
end
|
|
127
|
+
|
|
112
128
|
def perform_next(options)
|
|
113
129
|
lines = (options[:lines] || 1).to_i
|
|
114
130
|
context.step_over(lines, frame.pos)
|
|
@@ -140,7 +156,7 @@ module Byebug
|
|
|
140
156
|
end
|
|
141
157
|
|
|
142
158
|
def perform_frame(options)
|
|
143
|
-
index = options[:index] ? options[:index].to_i :
|
|
159
|
+
index = options[:index] ? options[:index].to_i : ""
|
|
144
160
|
|
|
145
161
|
Byebug::FrameCommand.new(self, "frame #{index}").execute
|
|
146
162
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
class Pry
|
|
2
4
|
module Byebug
|
|
3
5
|
#
|
|
@@ -60,7 +62,8 @@ class Pry
|
|
|
60
62
|
#
|
|
61
63
|
def add_file(file, line, expression = nil)
|
|
62
64
|
real_file = (file != Pry.eval_path)
|
|
63
|
-
|
|
65
|
+
raise(ArgumentError, "Invalid file!") if real_file && !File.exist?(file)
|
|
66
|
+
|
|
64
67
|
validate_expression expression
|
|
65
68
|
|
|
66
69
|
path = (real_file ? File.expand_path(file) : file)
|
|
@@ -85,11 +88,10 @@ class Pry
|
|
|
85
88
|
#
|
|
86
89
|
def delete(id)
|
|
87
90
|
deleted =
|
|
88
|
-
::Byebug.started? &&
|
|
89
91
|
::Byebug::Breakpoint.remove(id) &&
|
|
90
92
|
breakpoints.delete(find_by_id(id))
|
|
91
93
|
|
|
92
|
-
|
|
94
|
+
raise(ArgumentError, "No breakpoint ##{id}") unless deleted
|
|
93
95
|
end
|
|
94
96
|
|
|
95
97
|
#
|
|
@@ -97,7 +99,7 @@ class Pry
|
|
|
97
99
|
#
|
|
98
100
|
def delete_all
|
|
99
101
|
@breakpoints = []
|
|
100
|
-
::Byebug.breakpoints.clear
|
|
102
|
+
::Byebug.breakpoints.clear
|
|
101
103
|
end
|
|
102
104
|
|
|
103
105
|
#
|
|
@@ -141,7 +143,8 @@ class Pry
|
|
|
141
143
|
|
|
142
144
|
def find_by_id(id)
|
|
143
145
|
breakpoint = find { |b| b.id == id }
|
|
144
|
-
|
|
146
|
+
raise(ArgumentError, "No breakpoint ##{id}!") unless breakpoint
|
|
147
|
+
|
|
145
148
|
breakpoint
|
|
146
149
|
end
|
|
147
150
|
|
|
@@ -157,7 +160,7 @@ class Pry
|
|
|
157
160
|
valid = exp && (exp.empty? || !Pry::Code.complete_expression?(exp))
|
|
158
161
|
return unless valid
|
|
159
162
|
|
|
160
|
-
|
|
163
|
+
raise("Invalid breakpoint conditional: #{expression}")
|
|
161
164
|
end
|
|
162
165
|
end
|
|
163
166
|
end
|
data/lib/pry-byebug/base.rb
CHANGED
|
@@ -1,25 +1,29 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "pry-byebug/helpers/location"
|
|
4
|
+
|
|
1
5
|
#
|
|
2
6
|
# Main container module for Pry-Byebug functionality
|
|
3
7
|
#
|
|
4
8
|
module PryByebug
|
|
9
|
+
# Reference to currently running pry-remote server. Used by the processor.
|
|
10
|
+
attr_accessor :current_remote_server
|
|
11
|
+
|
|
12
|
+
module_function
|
|
13
|
+
|
|
5
14
|
#
|
|
6
15
|
# Checks that a target binding is in a local file context.
|
|
7
16
|
#
|
|
8
17
|
def file_context?(target)
|
|
9
|
-
file =
|
|
18
|
+
file = Helpers::Location.current_file(target)
|
|
10
19
|
file == Pry.eval_path || !Pry::Helpers::BaseHelpers.not_a_real_file?(file)
|
|
11
20
|
end
|
|
12
|
-
module_function :file_context?
|
|
13
21
|
|
|
14
22
|
#
|
|
15
23
|
# Ensures that a command is executed in a local file context.
|
|
16
24
|
#
|
|
17
|
-
def check_file_context(target,
|
|
18
|
-
|
|
19
|
-
|
|
25
|
+
def check_file_context(target, msg = nil)
|
|
26
|
+
msg ||= "Cannot find local context. Did you use `binding.pry`?"
|
|
27
|
+
raise(Pry::CommandError, msg) unless file_context?(target)
|
|
20
28
|
end
|
|
21
|
-
module_function :check_file_context
|
|
22
|
-
|
|
23
|
-
# Reference to currently running pry-remote server. Used by the processor.
|
|
24
|
-
attr_accessor :current_remote_server
|
|
25
29
|
end
|
data/lib/pry-byebug/cli.rb
CHANGED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "pry-byebug/helpers/navigation"
|
|
4
|
+
|
|
5
|
+
module PryByebug
|
|
6
|
+
#
|
|
7
|
+
# Display the current stack
|
|
8
|
+
#
|
|
9
|
+
class BacktraceCommand < Pry::ClassCommand
|
|
10
|
+
include Helpers::Navigation
|
|
11
|
+
|
|
12
|
+
match "backtrace"
|
|
13
|
+
group "Byebug"
|
|
14
|
+
|
|
15
|
+
description "Display the current stack."
|
|
16
|
+
|
|
17
|
+
banner <<-BANNER
|
|
18
|
+
Usage: backtrace
|
|
19
|
+
|
|
20
|
+
Display the current stack.
|
|
21
|
+
BANNER
|
|
22
|
+
|
|
23
|
+
def process
|
|
24
|
+
PryByebug.check_file_context(target)
|
|
25
|
+
|
|
26
|
+
breakout_navigation :backtrace
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
Pry::Commands.add_command(PryByebug::BacktraceCommand)
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
require
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "pry/byebug/breakpoints"
|
|
4
|
+
require "pry-byebug/helpers/breakpoints"
|
|
5
|
+
require "pry-byebug/helpers/location"
|
|
6
|
+
require "pry-byebug/helpers/multiline"
|
|
4
7
|
|
|
5
8
|
module PryByebug
|
|
6
9
|
#
|
|
@@ -8,11 +11,12 @@ module PryByebug
|
|
|
8
11
|
#
|
|
9
12
|
class BreakCommand < Pry::ClassCommand
|
|
10
13
|
include Helpers::Breakpoints
|
|
14
|
+
include Helpers::Location
|
|
11
15
|
include Helpers::Multiline
|
|
12
16
|
|
|
13
|
-
match
|
|
14
|
-
group
|
|
15
|
-
description
|
|
17
|
+
match "break"
|
|
18
|
+
group "Byebug"
|
|
19
|
+
description "Set or edit a breakpoint."
|
|
16
20
|
|
|
17
21
|
banner <<-BANNER
|
|
18
22
|
Usage: break <METHOD | FILE:LINE | LINE> [if CONDITION]
|
|
@@ -46,13 +50,13 @@ module PryByebug
|
|
|
46
50
|
def options(opt)
|
|
47
51
|
defaults = { argument: true, as: Integer }
|
|
48
52
|
|
|
49
|
-
opt.on :c, :condition,
|
|
50
|
-
opt.on :s, :show,
|
|
51
|
-
opt.on :D, :delete,
|
|
52
|
-
opt.on :d, :disable,
|
|
53
|
-
opt.on :e, :enable,
|
|
54
|
-
opt.on :'disable-all',
|
|
55
|
-
opt.on :'delete-all',
|
|
53
|
+
opt.on :c, :condition, "Change condition of a breakpoint.", defaults
|
|
54
|
+
opt.on :s, :show, "Show breakpoint details and source.", defaults
|
|
55
|
+
opt.on :D, :delete, "Delete a breakpoint.", defaults
|
|
56
|
+
opt.on :d, :disable, "Disable a breakpoint.", defaults
|
|
57
|
+
opt.on :e, :enable, "Enable a disabled breakpoint.", defaults
|
|
58
|
+
opt.on :'disable-all', "Disable all breakpoints."
|
|
59
|
+
opt.on :'delete-all', "Delete all breakpoints."
|
|
56
60
|
end
|
|
57
61
|
|
|
58
62
|
def process
|
|
@@ -70,7 +74,7 @@ module PryByebug
|
|
|
70
74
|
|
|
71
75
|
private
|
|
72
76
|
|
|
73
|
-
%w
|
|
77
|
+
%w[delete disable enable disable_all delete_all].each do |command|
|
|
74
78
|
define_method(:"process_#{command}") do
|
|
75
79
|
breakpoints.send(*[command, opts[command]].compact)
|
|
76
80
|
print_all
|
|
@@ -82,13 +86,13 @@ module PryByebug
|
|
|
82
86
|
end
|
|
83
87
|
|
|
84
88
|
def process_condition
|
|
85
|
-
expr = args.empty? ? nil : args.join(
|
|
89
|
+
expr = args.empty? ? nil : args.join(" ")
|
|
86
90
|
breakpoints.change(opts[:condition], expr)
|
|
87
91
|
end
|
|
88
92
|
|
|
89
93
|
def new_breakpoint
|
|
90
94
|
place = args.shift
|
|
91
|
-
condition = args.join(
|
|
95
|
+
condition = args.join(" ") if args.shift == "if"
|
|
92
96
|
|
|
93
97
|
bp = add_breakpoint(place, condition)
|
|
94
98
|
|
|
@@ -107,7 +111,7 @@ module PryByebug
|
|
|
107
111
|
def add_breakpoint(place, condition)
|
|
108
112
|
case place
|
|
109
113
|
when /^(\d+)$/
|
|
110
|
-
errmsg =
|
|
114
|
+
errmsg = "Line number declaration valid only in a file context."
|
|
111
115
|
PryByebug.check_file_context(target, errmsg)
|
|
112
116
|
|
|
113
117
|
lineno = Regexp.last_match[1].to_i
|
|
@@ -118,13 +122,13 @@ module PryByebug
|
|
|
118
122
|
breakpoints.add_file(file, lineno, condition)
|
|
119
123
|
when /^(.*)[.#].+$/ # Method or class name
|
|
120
124
|
if Regexp.last_match[1].strip.empty?
|
|
121
|
-
errmsg =
|
|
125
|
+
errmsg = "Method name declaration valid only in a file context."
|
|
122
126
|
PryByebug.check_file_context(target, errmsg)
|
|
123
|
-
place = target.eval(
|
|
127
|
+
place = target.eval("self.class.to_s") + place
|
|
124
128
|
end
|
|
125
129
|
breakpoints.add_method(place, condition)
|
|
126
130
|
else
|
|
127
|
-
|
|
131
|
+
raise(ArgumentError, "Cannot identify arguments as breakpoint")
|
|
128
132
|
end
|
|
129
133
|
end
|
|
130
134
|
end
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "pry-byebug/helpers/navigation"
|
|
4
|
+
require "pry-byebug/helpers/breakpoints"
|
|
5
|
+
require "pry-byebug/helpers/location"
|
|
3
6
|
|
|
4
7
|
module PryByebug
|
|
5
8
|
#
|
|
@@ -8,10 +11,11 @@ module PryByebug
|
|
|
8
11
|
class ContinueCommand < Pry::ClassCommand
|
|
9
12
|
include Helpers::Navigation
|
|
10
13
|
include Helpers::Breakpoints
|
|
14
|
+
include Helpers::Location
|
|
11
15
|
|
|
12
|
-
match
|
|
13
|
-
group
|
|
14
|
-
description
|
|
16
|
+
match "continue"
|
|
17
|
+
group "Byebug"
|
|
18
|
+
description "Continue program execution and end the Pry session."
|
|
15
19
|
|
|
16
20
|
banner <<-BANNER
|
|
17
21
|
Usage: continue [LINE]
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "pry-byebug/helpers/navigation"
|
|
2
4
|
|
|
3
5
|
module PryByebug
|
|
4
6
|
#
|
|
@@ -7,10 +9,10 @@ module PryByebug
|
|
|
7
9
|
class DownCommand < Pry::ClassCommand
|
|
8
10
|
include Helpers::Navigation
|
|
9
11
|
|
|
10
|
-
match
|
|
11
|
-
group
|
|
12
|
+
match "down"
|
|
13
|
+
group "Byebug"
|
|
12
14
|
|
|
13
|
-
description
|
|
15
|
+
description "Move current frame down."
|
|
14
16
|
|
|
15
17
|
banner <<-BANNER
|
|
16
18
|
Usage: down [TIMES]
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "pry-byebug/helpers/navigation"
|
|
2
4
|
|
|
3
5
|
module PryByebug
|
|
4
6
|
#
|
|
@@ -7,9 +9,9 @@ module PryByebug
|
|
|
7
9
|
class FinishCommand < Pry::ClassCommand
|
|
8
10
|
include PryByebug::Helpers::Navigation
|
|
9
11
|
|
|
10
|
-
match
|
|
11
|
-
group
|
|
12
|
-
description
|
|
12
|
+
match "finish"
|
|
13
|
+
group "Byebug"
|
|
14
|
+
description "Execute until current stack frame returns."
|
|
13
15
|
|
|
14
16
|
banner <<-BANNER
|
|
15
17
|
Usage: finish
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "pry-byebug/helpers/navigation"
|
|
2
4
|
|
|
3
5
|
module PryByebug
|
|
4
6
|
#
|
|
@@ -7,10 +9,10 @@ module PryByebug
|
|
|
7
9
|
class FrameCommand < Pry::ClassCommand
|
|
8
10
|
include Helpers::Navigation
|
|
9
11
|
|
|
10
|
-
match
|
|
11
|
-
group
|
|
12
|
+
match "frame"
|
|
13
|
+
group "Byebug"
|
|
12
14
|
|
|
13
|
-
description
|
|
15
|
+
description "Move to specified frame #."
|
|
14
16
|
|
|
15
17
|
banner <<-BANNER
|
|
16
18
|
Usage: frame [TIMES]
|
|
@@ -20,7 +22,7 @@ module PryByebug
|
|
|
20
22
|
Examples:
|
|
21
23
|
frame #=> Show current frame #.
|
|
22
24
|
frame 5 #=> Move to frame 5.
|
|
23
|
-
|
|
25
|
+
BANNER
|
|
24
26
|
|
|
25
27
|
def process
|
|
26
28
|
PryByebug.check_file_context(target)
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "pry-byebug/helpers/navigation"
|
|
4
|
+
require "pry-byebug/helpers/multiline"
|
|
3
5
|
|
|
4
6
|
module PryByebug
|
|
5
7
|
#
|
|
@@ -9,9 +11,9 @@ module PryByebug
|
|
|
9
11
|
include Helpers::Navigation
|
|
10
12
|
include Helpers::Multiline
|
|
11
13
|
|
|
12
|
-
match
|
|
13
|
-
group
|
|
14
|
-
description
|
|
14
|
+
match "next"
|
|
15
|
+
group "Byebug"
|
|
16
|
+
description "Execute the next line within the current stack frame."
|
|
15
17
|
|
|
16
18
|
banner <<-BANNER
|
|
17
19
|
Usage: next [LINES]
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "pry-byebug/helpers/navigation"
|
|
2
4
|
|
|
3
5
|
module PryByebug
|
|
4
6
|
#
|
|
@@ -7,9 +9,9 @@ module PryByebug
|
|
|
7
9
|
class StepCommand < Pry::ClassCommand
|
|
8
10
|
include Helpers::Navigation
|
|
9
11
|
|
|
10
|
-
match
|
|
11
|
-
group
|
|
12
|
-
description
|
|
12
|
+
match "step"
|
|
13
|
+
group "Byebug"
|
|
14
|
+
description "Step execution into the next line or method."
|
|
13
15
|
|
|
14
16
|
banner <<-BANNER
|
|
15
17
|
Usage: step [TIMES]
|
|
@@ -19,7 +21,7 @@ module PryByebug
|
|
|
19
21
|
Examples:
|
|
20
22
|
step #=> Move a single step forward.
|
|
21
23
|
step 5 #=> Execute the next 5 steps.
|
|
22
|
-
|
|
24
|
+
BANNER
|
|
23
25
|
|
|
24
26
|
def process
|
|
25
27
|
PryByebug.check_file_context(target)
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "pry-byebug/helpers/navigation"
|
|
2
4
|
|
|
3
5
|
module PryByebug
|
|
4
6
|
#
|
|
@@ -7,10 +9,10 @@ module PryByebug
|
|
|
7
9
|
class UpCommand < Pry::ClassCommand
|
|
8
10
|
include Helpers::Navigation
|
|
9
11
|
|
|
10
|
-
match
|
|
11
|
-
group
|
|
12
|
+
match "up"
|
|
13
|
+
group "Byebug"
|
|
12
14
|
|
|
13
|
-
description
|
|
15
|
+
description "Move current frame up."
|
|
14
16
|
|
|
15
17
|
banner <<-BANNER
|
|
16
18
|
Usage: up [TIMES]
|
data/lib/pry-byebug/commands.rb
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
require
|
|
4
|
-
require
|
|
5
|
-
require
|
|
6
|
-
require
|
|
7
|
-
require
|
|
8
|
-
require
|
|
9
|
-
require
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "pry-byebug/commands/backtrace"
|
|
4
|
+
require "pry-byebug/commands/next"
|
|
5
|
+
require "pry-byebug/commands/step"
|
|
6
|
+
require "pry-byebug/commands/continue"
|
|
7
|
+
require "pry-byebug/commands/finish"
|
|
8
|
+
require "pry-byebug/commands/up"
|
|
9
|
+
require "pry-byebug/commands/down"
|
|
10
|
+
require "pry-byebug/commands/frame"
|
|
11
|
+
require "pry-byebug/commands/breakpoint"
|
|
12
|
+
require "pry-byebug/commands/exit_all"
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
original_handler = Pry.config.control_d_handler
|
|
2
4
|
|
|
3
|
-
Pry.config.control_d_handler = proc do |
|
|
5
|
+
Pry.config.control_d_handler = proc do |pry_instance|
|
|
4
6
|
Byebug.stop if Byebug.stoppable?
|
|
5
7
|
|
|
6
|
-
original_handler.call(
|
|
8
|
+
original_handler.call(pry_instance)
|
|
7
9
|
end
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "byebug"
|
|
2
4
|
|
|
3
5
|
module PryByebug
|
|
4
6
|
module Helpers
|
|
@@ -13,19 +15,11 @@ module PryByebug
|
|
|
13
15
|
Pry::Byebug::Breakpoints
|
|
14
16
|
end
|
|
15
17
|
|
|
16
|
-
#
|
|
17
|
-
# Current file in the target binding. Used as the default breakpoint
|
|
18
|
-
# location.
|
|
19
|
-
#
|
|
20
|
-
def current_file
|
|
21
|
-
target.eval('__FILE__')
|
|
22
|
-
end
|
|
23
|
-
|
|
24
18
|
#
|
|
25
19
|
# Prints a message with bold font.
|
|
26
20
|
#
|
|
27
21
|
def bold_puts(msg)
|
|
28
|
-
output.puts(
|
|
22
|
+
output.puts(bold(msg))
|
|
29
23
|
end
|
|
30
24
|
|
|
31
25
|
#
|
|
@@ -33,28 +27,32 @@ module PryByebug
|
|
|
33
27
|
#
|
|
34
28
|
# Includes surrounding code at that point.
|
|
35
29
|
#
|
|
36
|
-
def print_full_breakpoint(
|
|
37
|
-
header = "Breakpoint #{
|
|
38
|
-
status =
|
|
39
|
-
code =
|
|
40
|
-
condition =
|
|
30
|
+
def print_full_breakpoint(breakpoint)
|
|
31
|
+
header = "Breakpoint #{breakpoint.id}:"
|
|
32
|
+
status = breakpoint.enabled? ? "Enabled" : "Disabled"
|
|
33
|
+
code = breakpoint.source_code.with_line_numbers.to_s
|
|
34
|
+
condition = if breakpoint.expr
|
|
35
|
+
"#{bold('Condition:')} #{breakpoint.expr}\n"
|
|
36
|
+
else
|
|
37
|
+
""
|
|
38
|
+
end
|
|
41
39
|
|
|
42
|
-
output.puts <<-
|
|
40
|
+
output.puts <<-BREAKPOINT.gsub(/ {8}/, "")
|
|
43
41
|
|
|
44
|
-
#{
|
|
42
|
+
#{bold(header)} #{breakpoint} (#{status}) #{condition}
|
|
45
43
|
|
|
46
44
|
#{code}
|
|
47
45
|
|
|
48
|
-
|
|
46
|
+
BREAKPOINT
|
|
49
47
|
end
|
|
50
48
|
|
|
51
49
|
#
|
|
52
50
|
# Print out concise information about a breakpoint.
|
|
53
51
|
#
|
|
54
52
|
def print_short_breakpoint(breakpoint)
|
|
55
|
-
id = format(
|
|
56
|
-
status = breakpoint.enabled? ?
|
|
57
|
-
expr = breakpoint.expr ? " #{breakpoint.expr} " :
|
|
53
|
+
id = format("%*d", max_width, breakpoint.id)
|
|
54
|
+
status = breakpoint.enabled? ? "Yes" : "No "
|
|
55
|
+
expr = breakpoint.expr ? " #{breakpoint.expr} " : ""
|
|
58
56
|
|
|
59
57
|
output.puts(" #{id} #{status} #{breakpoint}#{expr}")
|
|
60
58
|
end
|
|
@@ -65,12 +63,12 @@ module PryByebug
|
|
|
65
63
|
def print_breakpoints_header
|
|
66
64
|
header = "#{' ' * (max_width - 1)}# Enabled At "
|
|
67
65
|
|
|
68
|
-
output.puts <<-
|
|
66
|
+
output.puts <<-BREAKPOINTS.gsub(/ {8}/, "")
|
|
69
67
|
|
|
70
|
-
#{
|
|
71
|
-
#{
|
|
68
|
+
#{bold(header)}
|
|
69
|
+
#{bold('-' * header.size)}
|
|
72
70
|
|
|
73
|
-
|
|
71
|
+
BREAKPOINTS
|
|
74
72
|
end
|
|
75
73
|
|
|
76
74
|
#
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module PryByebug
|
|
4
|
+
module Helpers
|
|
5
|
+
#
|
|
6
|
+
# Compatibility helper to handle source location
|
|
7
|
+
#
|
|
8
|
+
module Location
|
|
9
|
+
module_function
|
|
10
|
+
|
|
11
|
+
#
|
|
12
|
+
# Current file in the target binding. Used as the default breakpoint
|
|
13
|
+
# location.
|
|
14
|
+
#
|
|
15
|
+
def current_file(source = target)
|
|
16
|
+
# Guard clause for Ruby >= 2.6 providing now Binding#source_location ...
|
|
17
|
+
return source.source_location[0] if source.respond_to?(:source_location)
|
|
18
|
+
|
|
19
|
+
# ... to avoid warning: 'eval may not return location in binding'
|
|
20
|
+
source.eval("__FILE__")
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module PryByebug
|
|
2
4
|
module Helpers
|
|
3
5
|
#
|
|
@@ -8,9 +10,9 @@ module PryByebug
|
|
|
8
10
|
# Breaks out of the REPL loop and signals tracer
|
|
9
11
|
#
|
|
10
12
|
def breakout_navigation(action, options = {})
|
|
11
|
-
|
|
13
|
+
pry_instance.binding_stack.clear
|
|
12
14
|
|
|
13
|
-
throw :breakout_nav, action: action, options: options, pry:
|
|
15
|
+
throw :breakout_nav, action: action, options: options, pry: pry_instance
|
|
14
16
|
end
|
|
15
17
|
end
|
|
16
18
|
end
|
data/lib/pry-byebug/pry_ext.rb
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "byebug/processors/pry_processor"
|
|
2
4
|
|
|
3
5
|
class << Pry
|
|
4
|
-
|
|
6
|
+
alias start_without_pry_byebug start
|
|
5
7
|
|
|
6
8
|
def start_with_pry_byebug(target = TOPLEVEL_BINDING, options = {})
|
|
7
9
|
if target.is_a?(Binding) && PryByebug.file_context?(target)
|
|
8
|
-
Byebug::PryProcessor.start
|
|
10
|
+
Byebug::PryProcessor.start unless ENV["DISABLE_PRY"]
|
|
9
11
|
else
|
|
10
12
|
# No need for the tracer unless we have a file context to step through
|
|
11
13
|
start_without_pry_byebug(target, options)
|
|
12
14
|
end
|
|
13
15
|
end
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
alias start start_with_pry_byebug
|
|
16
18
|
end
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "pry-remote"
|
|
2
4
|
|
|
3
5
|
module PryRemote
|
|
4
6
|
#
|
|
@@ -10,7 +12,7 @@ module PryRemote
|
|
|
10
12
|
# teardown the server right after Pry.start finishes.
|
|
11
13
|
#
|
|
12
14
|
def run
|
|
13
|
-
|
|
15
|
+
raise("Already running a pry-remote session!") if
|
|
14
16
|
PryByebug.current_remote_server
|
|
15
17
|
|
|
16
18
|
PryByebug.current_remote_server = self
|
|
@@ -22,7 +24,7 @@ module PryRemote
|
|
|
22
24
|
#
|
|
23
25
|
# Override to reset our saved global current server session.
|
|
24
26
|
#
|
|
25
|
-
|
|
27
|
+
alias teardown_without_pry_byebug teardown
|
|
26
28
|
def teardown_with_pry_byebug
|
|
27
29
|
return if @torn
|
|
28
30
|
|
|
@@ -30,7 +32,7 @@ module PryRemote
|
|
|
30
32
|
PryByebug.current_remote_server = nil
|
|
31
33
|
@torn = true
|
|
32
34
|
end
|
|
33
|
-
|
|
35
|
+
alias teardown teardown_with_pry_byebug
|
|
34
36
|
end
|
|
35
37
|
end
|
|
36
38
|
|
|
@@ -38,5 +40,5 @@ end
|
|
|
38
40
|
# 'next' on the last line of a program won't hit Byebug::PryProcessor#run,
|
|
39
41
|
# which normally handles cleanup.
|
|
40
42
|
at_exit do
|
|
41
|
-
PryByebug.current_remote_server
|
|
43
|
+
PryByebug.current_remote_server&.teardown
|
|
42
44
|
end
|
data/lib/pry-byebug/version.rb
CHANGED
data/lib/pry-byebug.rb
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
require
|
|
4
|
-
require
|
|
5
|
-
require 'pry-byebug/control_d_handler'
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "pry"
|
|
4
|
+
require "pry-byebug/cli"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pry-byebug
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.9.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Rodríguez
|
|
@@ -9,36 +9,36 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 2020-03-21 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
|
-
name:
|
|
15
|
+
name: byebug
|
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
|
17
17
|
requirements:
|
|
18
18
|
- - "~>"
|
|
19
19
|
- !ruby/object:Gem::Version
|
|
20
|
-
version: '0
|
|
20
|
+
version: '11.0'
|
|
21
21
|
type: :runtime
|
|
22
22
|
prerelease: false
|
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
|
24
24
|
requirements:
|
|
25
25
|
- - "~>"
|
|
26
26
|
- !ruby/object:Gem::Version
|
|
27
|
-
version: '0
|
|
27
|
+
version: '11.0'
|
|
28
28
|
- !ruby/object:Gem::Dependency
|
|
29
|
-
name:
|
|
29
|
+
name: pry
|
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
|
31
31
|
requirements:
|
|
32
32
|
- - "~>"
|
|
33
33
|
- !ruby/object:Gem::Version
|
|
34
|
-
version:
|
|
34
|
+
version: 0.13.0
|
|
35
35
|
type: :runtime
|
|
36
36
|
prerelease: false
|
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
|
38
38
|
requirements:
|
|
39
39
|
- - "~>"
|
|
40
40
|
- !ruby/object:Gem::Version
|
|
41
|
-
version:
|
|
41
|
+
version: 0.13.0
|
|
42
42
|
description: |-
|
|
43
43
|
Combine 'pry' with 'byebug'. Adds 'step', 'next', 'finish',
|
|
44
44
|
'continue' and 'break' commands to control execution.
|
|
@@ -57,6 +57,7 @@ files:
|
|
|
57
57
|
- lib/pry-byebug/base.rb
|
|
58
58
|
- lib/pry-byebug/cli.rb
|
|
59
59
|
- lib/pry-byebug/commands.rb
|
|
60
|
+
- lib/pry-byebug/commands/backtrace.rb
|
|
60
61
|
- lib/pry-byebug/commands/breakpoint.rb
|
|
61
62
|
- lib/pry-byebug/commands/continue.rb
|
|
62
63
|
- lib/pry-byebug/commands/down.rb
|
|
@@ -68,6 +69,7 @@ files:
|
|
|
68
69
|
- lib/pry-byebug/commands/up.rb
|
|
69
70
|
- lib/pry-byebug/control_d_handler.rb
|
|
70
71
|
- lib/pry-byebug/helpers/breakpoints.rb
|
|
72
|
+
- lib/pry-byebug/helpers/location.rb
|
|
71
73
|
- lib/pry-byebug/helpers/multiline.rb
|
|
72
74
|
- lib/pry-byebug/helpers/navigation.rb
|
|
73
75
|
- lib/pry-byebug/pry_ext.rb
|
|
@@ -86,15 +88,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
86
88
|
requirements:
|
|
87
89
|
- - ">="
|
|
88
90
|
- !ruby/object:Gem::Version
|
|
89
|
-
version: 2.
|
|
91
|
+
version: 2.4.0
|
|
90
92
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
91
93
|
requirements:
|
|
92
94
|
- - ">="
|
|
93
95
|
- !ruby/object:Gem::Version
|
|
94
96
|
version: '0'
|
|
95
97
|
requirements: []
|
|
96
|
-
|
|
97
|
-
rubygems_version: 2.4.5.1
|
|
98
|
+
rubygems_version: 3.2.0.pre1
|
|
98
99
|
signing_key:
|
|
99
100
|
specification_version: 4
|
|
100
101
|
summary: Fast debugging with Pry.
|