debug 1.0.0 → 1.2.2
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/.github/ISSUE_TEMPLATE/bug_report.md +24 -0
- data/.github/ISSUE_TEMPLATE/custom.md +10 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +14 -0
- data/README.md +17 -10
- data/Rakefile +10 -7
- data/TODO.md +2 -1
- data/debug.gemspec +1 -1
- data/ext/debug/debug.c +5 -0
- data/lib/debug/breakpoint.rb +14 -5
- data/lib/debug/color.rb +25 -3
- data/lib/debug/config.rb +18 -3
- data/lib/debug/console.rb +10 -2
- data/lib/debug/frame_info.rb +5 -5
- data/lib/debug/local.rb +21 -24
- data/lib/debug/server.rb +8 -7
- data/lib/debug/server_dap.rb +30 -19
- data/lib/debug/session.rb +244 -98
- data/lib/debug/thread_client.rb +22 -13
- data/lib/debug/tracer.rb +8 -3
- data/lib/debug/version.rb +1 -1
- data/misc/README.md.erb +10 -8
- metadata +11 -8
data/lib/debug/tracer.rb
CHANGED
|
@@ -14,7 +14,7 @@ module DEBUGGER__
|
|
|
14
14
|
end
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
attr_reader :type
|
|
17
|
+
attr_reader :type, :key
|
|
18
18
|
|
|
19
19
|
def initialize ui, pattern: nil, into: nil
|
|
20
20
|
if /\ADEBUGGER__::(([A-Z][a-z]+?)[A-Z][a-z]+)/ =~ self.class.name
|
|
@@ -37,6 +37,8 @@ module DEBUGGER__
|
|
|
37
37
|
@output = ui
|
|
38
38
|
end
|
|
39
39
|
|
|
40
|
+
@key = [@type, @pattern, @into].freeze
|
|
41
|
+
|
|
40
42
|
enable
|
|
41
43
|
end
|
|
42
44
|
|
|
@@ -95,6 +97,8 @@ module DEBUGGER__
|
|
|
95
97
|
end
|
|
96
98
|
|
|
97
99
|
def minfo tp
|
|
100
|
+
return "block{}" if tp.event == :b_call
|
|
101
|
+
|
|
98
102
|
klass = tp.defined_class
|
|
99
103
|
|
|
100
104
|
if klass.singleton_class?
|
|
@@ -172,6 +176,7 @@ module DEBUGGER__
|
|
|
172
176
|
@obj_id = obj_id
|
|
173
177
|
@obj_inspect = obj_inspect
|
|
174
178
|
super(ui, **kw)
|
|
179
|
+
@key = [@type, @obj_id, @pattern, @into].freeze
|
|
175
180
|
end
|
|
176
181
|
|
|
177
182
|
def description
|
|
@@ -201,7 +206,7 @@ module DEBUGGER__
|
|
|
201
206
|
end
|
|
202
207
|
|
|
203
208
|
out tp, " #{colorized_obj_inspect} receives #{colorize_blue(method_info)}"
|
|
204
|
-
|
|
209
|
+
elsif !tp.parameters.empty?
|
|
205
210
|
b = tp.binding
|
|
206
211
|
method_info = colorize_blue(minfo(tp))
|
|
207
212
|
|
|
@@ -216,7 +221,7 @@ module DEBUGGER__
|
|
|
216
221
|
out tp, " #{colorized_obj_inspect} is used as a parameter #{colorized_name} of #{method_info}"
|
|
217
222
|
end
|
|
218
223
|
when :rest
|
|
219
|
-
next name == :"*"
|
|
224
|
+
next if name == :"*"
|
|
220
225
|
|
|
221
226
|
ary = b.local_variable_get(name)
|
|
222
227
|
ary.each{|e|
|
data/lib/debug/version.rb
CHANGED
data/misc/README.md.erb
CHANGED
|
@@ -8,7 +8,7 @@ This debug.rb is replacement of traditional lib/debug.rb standard library which
|
|
|
8
8
|
New debug.rb has several advantages:
|
|
9
9
|
|
|
10
10
|
* Fast: No performance penalty on non-stepping mode and non-breakpoints.
|
|
11
|
-
* Remote debugging: Support remote debugging natively.
|
|
11
|
+
* [Remote debugging](#remote-debugging): Support remote debugging natively.
|
|
12
12
|
* UNIX domain socket
|
|
13
13
|
* TCP/IP
|
|
14
14
|
* VSCode/DAP integration ([VSCode rdbg Ruby Debugger - Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=KoichiSasada.vscode-rdbg))
|
|
@@ -44,22 +44,24 @@ To use a debugger, roughly you will do the following steps:
|
|
|
44
44
|
2. Run a program with the debugger.
|
|
45
45
|
3. At the breakpoint, enter the debugger console.
|
|
46
46
|
4. Use debug commands.
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
47
|
+
* [Evaluate Ruby expressions](#evaluate) (e.g. `p lvar` to see the local variable `lvar`).
|
|
48
|
+
* [Query the program status](#information) (e.g. `info` to see information about the current frame).
|
|
49
|
+
* [Control program flow](#control-flow) (e.g. move to the another line with `step`, to the next line with `next`).
|
|
50
|
+
* [Set another breakpoint](#breakpoint) (e.g. `catch Exception` to set a breakpoint that'll be triggered when `Exception` is raised).
|
|
51
|
+
* [Activate tracing in your program](#trace) (e.g. `trace call` to trace method calls).
|
|
52
|
+
* [Change the configuration](#configuration-1) (e.g. `config set no_color true` to disable coloring).
|
|
51
53
|
* Continue the program (`c` or `continue`) and goto 3.
|
|
52
54
|
|
|
53
55
|
## Invoke with the debugger
|
|
54
56
|
|
|
55
57
|
There are several options for (1) and (2). Please choose your favorite way.
|
|
56
58
|
|
|
57
|
-
### Modify source code
|
|
59
|
+
### Modify source code with [`binding.break`](#bindingbreak-method) (similar to `binding.pry` or `binding.irb`)
|
|
58
60
|
|
|
59
|
-
If you can modify the source code, you can use the debugger by adding `require 'debug'` line at the top of your program and putting `binding.break` method (`binding.b` for short) into lines where you want to stop as breakpoints like `binding.pry` and `binding.irb`.
|
|
61
|
+
If you can modify the source code, you can use the debugger by adding `require 'debug'` line at the top of your program and putting [`binding.break`](#bindingbreak-method) method (`binding.b` for short) into lines where you want to stop as breakpoints like `binding.pry` and `binding.irb`.
|
|
60
62
|
After that, you run the program as usual and you will enter the debug console at breakpoints you inserted.
|
|
61
63
|
|
|
62
|
-
The following example shows the demonstration of `binding.break
|
|
64
|
+
The following example shows the demonstration of [`binding.break`](#bindingbreak-method).
|
|
63
65
|
|
|
64
66
|
```shell
|
|
65
67
|
$ cat target.rb # Sample program
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: debug
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.2.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Koichi Sasada
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-
|
|
11
|
+
date: 2021-10-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: irb
|
|
@@ -16,14 +16,14 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version:
|
|
19
|
+
version: 1.3.6
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - ">="
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version:
|
|
26
|
+
version: 1.3.6
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: reline
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -48,6 +48,9 @@ extensions:
|
|
|
48
48
|
- ext/debug/extconf.rb
|
|
49
49
|
extra_rdoc_files: []
|
|
50
50
|
files:
|
|
51
|
+
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
|
52
|
+
- ".github/ISSUE_TEMPLATE/custom.md"
|
|
53
|
+
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
|
51
54
|
- ".github/workflows/ruby.yml"
|
|
52
55
|
- ".gitignore"
|
|
53
56
|
- CONTRIBUTING.md
|
|
@@ -91,7 +94,7 @@ licenses:
|
|
|
91
94
|
metadata:
|
|
92
95
|
homepage_uri: https://github.com/ruby/debug
|
|
93
96
|
source_code_uri: https://github.com/ruby/debug
|
|
94
|
-
post_install_message:
|
|
97
|
+
post_install_message:
|
|
95
98
|
rdoc_options: []
|
|
96
99
|
require_paths:
|
|
97
100
|
- lib
|
|
@@ -106,8 +109,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
106
109
|
- !ruby/object:Gem::Version
|
|
107
110
|
version: '0'
|
|
108
111
|
requirements: []
|
|
109
|
-
rubygems_version: 3.
|
|
110
|
-
signing_key:
|
|
112
|
+
rubygems_version: 3.2.15
|
|
113
|
+
signing_key:
|
|
111
114
|
specification_version: 4
|
|
112
115
|
summary: Debugging functionality for Ruby
|
|
113
116
|
test_files: []
|