debug 1.3.3 → 1.5.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/CONTRIBUTING.md +163 -6
- data/Gemfile +1 -0
- data/README.md +42 -15
- data/Rakefile +5 -5
- data/debug.gemspec +6 -4
- data/ext/debug/debug.c +88 -1
- data/ext/debug/extconf.rb +11 -0
- data/lib/debug/breakpoint.rb +75 -36
- data/lib/debug/client.rb +65 -18
- data/lib/debug/color.rb +29 -19
- data/lib/debug/config.rb +6 -3
- data/lib/debug/console.rb +50 -15
- data/lib/debug/frame_info.rb +14 -20
- data/lib/debug/local.rb +1 -1
- data/lib/debug/prelude.rb +2 -2
- data/lib/debug/server.rb +100 -94
- data/lib/debug/server_cdp.rb +878 -160
- data/lib/debug/server_dap.rb +277 -81
- data/lib/debug/session.rb +327 -154
- data/lib/debug/source_repository.rb +90 -52
- data/lib/debug/thread_client.rb +149 -78
- data/lib/debug/tracer.rb +4 -10
- data/lib/debug/version.rb +1 -1
- data/misc/README.md.erb +16 -8
- metadata +4 -12
- data/.github/ISSUE_TEMPLATE/bug_report.md +0 -24
- data/.github/ISSUE_TEMPLATE/custom.md +0 -10
- data/.github/ISSUE_TEMPLATE/feature_request.md +0 -14
- data/.github/workflows/ruby.yml +0 -34
- data/.gitignore +0 -12
- data/bin/console +0 -14
- data/bin/gentest +0 -22
- data/bin/setup +0 -8
data/misc/README.md.erb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
[](https://github.com/ruby/debug/actions/workflows/ruby.yml?query=branch%3Amaster)
|
1
|
+
[](https://github.com/ruby/debug/actions/workflows/ruby.yml?query=branch%3Amaster) [](https://github.com/ruby/debug/actions/workflows/protocol.yml)
|
2
2
|
|
3
3
|
# debug.rb
|
4
4
|
|
5
|
-
This library provides debugging functionality to Ruby.
|
5
|
+
This library provides debugging functionality to Ruby (MRI) 2.6 and later.
|
6
6
|
|
7
7
|
This debug.rb is replacement of traditional lib/debug.rb standard library which is implemented by `set_trace_func`.
|
8
8
|
New debug.rb has several advantages:
|
@@ -60,8 +60,14 @@ There are several options for (1) and (2). Please choose your favorite way.
|
|
60
60
|
|
61
61
|
### Modify source code with [`binding.break`](#bindingbreak-method) (similar to `binding.pry` or `binding.irb`)
|
62
62
|
|
63
|
-
If you can modify the source code, you can use the debugger by adding `require 'debug'`
|
64
|
-
|
63
|
+
If you can modify the source code, you can use the debugger by adding `require 'debug'` at the top of your program and putting [`binding.break`](#bindingbreak-method) method into lines where you want to stop as breakpoints like `binding.pry` and `binding.irb`.
|
64
|
+
|
65
|
+
You can also use its 2 aliases in the same way:
|
66
|
+
|
67
|
+
- `binding.b`
|
68
|
+
- `debugger`
|
69
|
+
|
70
|
+
After that, run the program as usual and you will enter the debug console at breakpoints you inserted.
|
65
71
|
|
66
72
|
The following example shows the demonstration of [`binding.break`](#bindingbreak-method).
|
67
73
|
|
@@ -107,7 +113,7 @@ d => nil
|
|
107
113
|
5| binding.break
|
108
114
|
6| c = 3
|
109
115
|
7| d = 4
|
110
|
-
=> 8| binding.break # Again the program stops
|
116
|
+
=> 8| binding.break # Again the program stops here
|
111
117
|
9| p [a, b, c, d]
|
112
118
|
10|
|
113
119
|
11| __END__
|
@@ -346,12 +352,14 @@ You can attach with external debugger frontend with VSCode and Chrome.
|
|
346
352
|
$ rdbg --open=[frontend] target.rb
|
347
353
|
```
|
348
354
|
|
349
|
-
will open a debug port and `[
|
355
|
+
will open a debug port and `[frontend]` can attach to the port.
|
350
356
|
|
351
357
|
Also `open` command allows opening the debug port.
|
352
358
|
|
353
359
|
#### VSCode integration
|
354
360
|
|
361
|
+
([vscode-rdbg v0.0.9](https://marketplace.visualstudio.com/items?itemName=KoichiSasada.vscode-rdbg) or later is required)
|
362
|
+
|
355
363
|
If you don't run a debuggee Ruby process on VSCode, you can attach with VSCode later with the following steps.
|
356
364
|
|
357
365
|
`rdbg --open=vscode` opens the debug port and tries to invoke the VSCode (`code` command).
|
@@ -411,7 +419,7 @@ Note that you can attach with `rdbg --attach` and continue REPL debugging.
|
|
411
419
|
|
412
420
|
#### Chrome DevTool integration
|
413
421
|
|
414
|
-
With `rdbg --open=chrome` command will
|
422
|
+
With `rdbg --open=chrome` command will show the following message.
|
415
423
|
|
416
424
|
```
|
417
425
|
$ rdbg target.rb --open=chrome
|
@@ -427,7 +435,7 @@ Type `devtools://devtools/bundled/inspector.html?ws=127.0.0.1:43633` in the addr
|
|
427
435
|
|
428
436
|
Also `open chrome` command works like `open vscode`.
|
429
437
|
|
430
|
-
For more information about how to use Chrome debugging, you might want to read [here](https://developer.chrome.com/docs/devtools/)
|
438
|
+
For more information about how to use Chrome debugging, you might want to read [here](https://developer.chrome.com/docs/devtools/).
|
431
439
|
|
432
440
|
## Configuration
|
433
441
|
|
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.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Koichi Sasada
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-03-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: irb
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.2.7
|
41
41
|
description: Debugging functionality for Ruby. This is completely rewritten debug.rb
|
42
|
-
which was contained by the
|
42
|
+
which was contained by the ancient Ruby versions.
|
43
43
|
email:
|
44
44
|
- ko1@atdot.net
|
45
45
|
executables:
|
@@ -48,20 +48,12 @@ 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"
|
54
|
-
- ".github/workflows/ruby.yml"
|
55
|
-
- ".gitignore"
|
56
51
|
- CONTRIBUTING.md
|
57
52
|
- Gemfile
|
58
53
|
- LICENSE.txt
|
59
54
|
- README.md
|
60
55
|
- Rakefile
|
61
56
|
- TODO.md
|
62
|
-
- bin/console
|
63
|
-
- bin/gentest
|
64
|
-
- bin/setup
|
65
57
|
- debug.gemspec
|
66
58
|
- exe/rdbg
|
67
59
|
- ext/debug/debug.c
|
@@ -111,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
111
103
|
- !ruby/object:Gem::Version
|
112
104
|
version: '0'
|
113
105
|
requirements: []
|
114
|
-
rubygems_version: 3.
|
106
|
+
rubygems_version: 3.4.0.dev
|
115
107
|
signing_key:
|
116
108
|
specification_version: 4
|
117
109
|
summary: Debugging functionality for Ruby
|
@@ -1,24 +0,0 @@
|
|
1
|
-
---
|
2
|
-
name: Bug report
|
3
|
-
about: Create a report to help us improve
|
4
|
-
title: ''
|
5
|
-
labels: ''
|
6
|
-
assignees: ''
|
7
|
-
|
8
|
-
---
|
9
|
-
|
10
|
-
**Your environment**
|
11
|
-
|
12
|
-
* `ruby -v`:
|
13
|
-
* `rdbg -v`:
|
14
|
-
|
15
|
-
**Describe the bug**
|
16
|
-
A clear and concise description of what the bug is.
|
17
|
-
|
18
|
-
**To Reproduce**
|
19
|
-
|
20
|
-
**Expected behavior**
|
21
|
-
A clear and concise description of what you expected to happen.
|
22
|
-
|
23
|
-
**Additional context**
|
24
|
-
Add any other context about the problem here.
|
@@ -1,14 +0,0 @@
|
|
1
|
-
---
|
2
|
-
name: Feature request
|
3
|
-
about: Suggest an idea for this project
|
4
|
-
title: ''
|
5
|
-
labels: ''
|
6
|
-
assignees: ''
|
7
|
-
|
8
|
-
---
|
9
|
-
|
10
|
-
**Your proposal**
|
11
|
-
What is your idea?
|
12
|
-
|
13
|
-
**Additional context**
|
14
|
-
Add any other context or screenshots about the feature request here.
|
data/.github/workflows/ruby.yml
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
# This workflow uses actions that are not certified by GitHub.
|
2
|
-
# They are provided by a third-party and are governed by
|
3
|
-
# separate terms of service, privacy policy, and support
|
4
|
-
# documentation.
|
5
|
-
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
6
|
-
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
7
|
-
|
8
|
-
name: Ruby
|
9
|
-
|
10
|
-
on:
|
11
|
-
push:
|
12
|
-
branches: [ master ]
|
13
|
-
pull_request:
|
14
|
-
branches: [ master ]
|
15
|
-
|
16
|
-
jobs:
|
17
|
-
test:
|
18
|
-
|
19
|
-
runs-on: ubuntu-latest
|
20
|
-
strategy:
|
21
|
-
matrix:
|
22
|
-
ruby-version: ['2.6', '2.7', '3.0', 'head', 'debug']
|
23
|
-
|
24
|
-
steps:
|
25
|
-
- uses: actions/checkout@v2
|
26
|
-
- name: Set up Ruby
|
27
|
-
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
28
|
-
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
29
|
-
uses: ruby/setup-ruby@v1
|
30
|
-
with:
|
31
|
-
ruby-version: ${{ matrix.ruby-version }}
|
32
|
-
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
33
|
-
- name: Run tests
|
34
|
-
run: bundle exec rake
|
data/.gitignore
DELETED
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "debug"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start(__FILE__)
|
data/bin/gentest
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'optparse'
|
4
|
-
|
5
|
-
require_relative '../test/tool/test_builder'
|
6
|
-
|
7
|
-
file_info = {}
|
8
|
-
|
9
|
-
OptionParser.new do |opt|
|
10
|
-
opt.banner = 'Usage: bin/gentest [file] [option]'
|
11
|
-
opt.on('-m METHOD', 'Method name in the test file') do |m|
|
12
|
-
file_info[:method] = m
|
13
|
-
end
|
14
|
-
opt.on('-c CLASS', 'Class name in the test file') do |c|
|
15
|
-
file_info[:class] = c
|
16
|
-
end
|
17
|
-
opt.parse!(ARGV)
|
18
|
-
end
|
19
|
-
|
20
|
-
exit if ARGV.empty?
|
21
|
-
|
22
|
-
DEBUGGER__::TestBuilder.new(ARGV, file_info[:method], file_info[:class]).start
|