debug 1.9.2 → 1.10.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c242bce58b031f61da73507f6b42a26f1ed8322679d1f0b3460d8fbc8c4b7a23
4
- data.tar.gz: 543feb5e53a2c99ba04583edae4a13378667c97b13662f5a4d456dd6bacb17b5
3
+ metadata.gz: 0abb44ebe9baa650e6fe0b811044aa50a5d3f7cf0636579ae4991193cf1467ec
4
+ data.tar.gz: 5decf010f8c581a30fe2543f6118541d0a34768b0d4f83451a728c47eeb6321c
5
5
  SHA512:
6
- metadata.gz: b5f6c58f38114e3179c3d5c062294ac276b53533fc4a6543114a883198318b672a8506990064f1b40d9f9597d3e1a933cb7c2363ea4cdd4ba0e0571279a80c73
7
- data.tar.gz: 142a78dcdc449df6e0148857f992500aa88375707af067f36f1e3391fe2adb7ac8ff0f66623806c5488e94292167a369ca901084475e97b8dc38e32257ccbba0
6
+ metadata.gz: 1aad7e61ccedcb91f208a6edd92e0a255d8fb9e564b3b72dafceebbd88aff37b03500b63dc2e375874d27d7ad3767f174d70d3679cb3c47f31e29270952a5999
7
+ data.tar.gz: 87d2cf298f30052fb0b4f91abea28d5310d7a235173ef04deb3dd27a66c1b9016add6714a2ff29a6483670a5b3245b38091d0a437ede4db61a0a0d45ecfcb773
data/README.md CHANGED
@@ -244,16 +244,16 @@ It will help if you want to know what the program is doing.
244
244
 
245
245
  If you want to run a command written in Ruby like `rake`, `rails`, `bundle`, `rspec`, and so on, you can use `rdbg -c` option.
246
246
 
247
- * Without `-c` option, `rdbg <name>` means that `<name>` is Ruby script and invoke it like `ruby <name>` with the debugger.
248
- * With `-c` option, `rdbg -c <name>` means that `<name>` is a command in `PATH` and simply invokes it with the debugger.
247
+ * Without the `-c` option, `rdbg <name>` means that `<name>` is a Ruby script and invokes it like `ruby <name>` with the debugger.
248
+ * With the `-c` option, `rdbg -c <name>` means that `<name>` is a command in `PATH` and simply invokes it with the debugger.
249
249
 
250
250
  Examples:
251
251
  * `rdbg -c -- rails server`
252
252
  * `rdbg -c -- bundle exec ruby foo.rb`
253
253
  * `rdbg -c -- bundle exec rake test`
254
- * `rdbg -c -- ruby target.rb` is same as `rdbg target.rb`
254
+ * `rdbg -c -- ruby target.rb` is the same as `rdbg target.rb`
255
255
 
256
- NOTE: `--` is needed to separate the command line options for `rdbg` and invoking command. For example, `rdbg -c rake -T` is recognized like `rdbg -c -T -- rake`. It should be `rdbg -c -- rake -T`.
256
+ NOTE: `--` is needed to separate the command line options for `rdbg` and the invoking command. For example, `rdbg -c rake -T` is recognized like `rdbg -c -T -- rake`. It should be `rdbg -c -- rake -T`.
257
257
 
258
258
  NOTE: If you want to use bundler (`bundle` command), you need to write `gem debug` line in your `Gemfile`.
259
259
 
@@ -330,7 +330,9 @@ When `rdbg --attach` connects to the debuggee, you can use any debug commands (s
330
330
 
331
331
  NOTE: If you use the `quit` command, only the remote console exits and the debuggee program continues to run (and you can connect it again). If you want to exit the debuggee program, use `kill` command.
332
332
 
333
- If you want to use TCP/IP for the remote debugging, you need to specify the port and host with `--port` like `rdbg --open --port 12345` and it binds to `localhost:12345`.
333
+ If you want to use TCP/IP for the remote debugging, you need to specify the port and host with `--port` like `rdbg --open --port 12345` and it binds to `localhost:12345`. You can add an optional `--port_range` option to try multiple ports in a reliable way. For example, `rdbg --open --port 12345 --port_range 10` will try to bind to 12345, 12346, 12347, ... until it finds an available port.
334
+
335
+ ```shell
334
336
 
335
337
  To connect to the debuggee, you need to specify the port.
336
338
 
@@ -499,6 +501,7 @@ config set no_color true
499
501
  * REMOTE
500
502
  * `RUBY_DEBUG_OPEN` (`open`): Open remote port (same as `rdbg --open` option)
501
503
  * `RUBY_DEBUG_PORT` (`port`): TCP/IP remote debugging: port
504
+ * `RUBY_DEBUG_PORT_RANGE` (`port_range`): TCP/IP remote debugging: length of port range
502
505
  * `RUBY_DEBUG_HOST` (`host`): TCP/IP remote debugging: host (default: 127.0.0.1)
503
506
  * `RUBY_DEBUG_SOCK_PATH` (`sock_path`): UNIX Domain Socket remote debugging: socket path
504
507
  * `RUBY_DEBUG_SOCK_DIR` (`sock_dir`): UNIX Domain Socket remote debugging: socket directory
@@ -907,6 +910,7 @@ Debug console mode:
907
910
  Now rdbg, vscode and chrome is supported.
908
911
  --sock-path=SOCK_PATH UNIX Domain socket path
909
912
  --port=PORT Listening TCP/IP port
913
+ --port-range=PORT_RANGE Number of ports to try to connect to
910
914
  --host=HOST Listening TCP/IP host
911
915
  --cookie=COOKIE Set a cookie for connection
912
916
  --session-name=NAME Session name
data/debug.gemspec CHANGED
@@ -14,6 +14,7 @@ Gem::Specification.new do |spec|
14
14
 
15
15
  spec.metadata["homepage_uri"] = spec.homepage
16
16
  spec.metadata["source_code_uri"] = spec.homepage
17
+ spec.metadata["changelog_uri"] = "#{spec.homepage}/releases/tag/v#{spec.version}"
17
18
 
18
19
  # Specify which files should be added to the gem when it is released.
19
20
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
data/lib/debug/config.rb CHANGED
@@ -44,6 +44,7 @@ module DEBUGGER__
44
44
  # remote setting
45
45
  open: ['RUBY_DEBUG_OPEN', "REMOTE: Open remote port (same as `rdbg --open` option)"],
46
46
  port: ['RUBY_DEBUG_PORT', "REMOTE: TCP/IP remote debugging: port"],
47
+ port_range: ['RUBY_DEBUG_PORT_RANGE', "REMOTE: TCP/IP remote debugging: length of port range"],
47
48
  host: ['RUBY_DEBUG_HOST', "REMOTE: TCP/IP remote debugging: host", :string, "127.0.0.1"],
48
49
  sock_path: ['RUBY_DEBUG_SOCK_PATH', "REMOTE: UNIX Domain Socket remote debugging: socket path"],
49
50
  sock_dir: ['RUBY_DEBUG_SOCK_DIR', "REMOTE: UNIX Domain Socket remote debugging: socket directory"],
@@ -352,6 +353,9 @@ module DEBUGGER__
352
353
  o.on('--port=PORT', 'Listening TCP/IP port') do |port|
353
354
  config[:port] = port
354
355
  end
356
+ o.on('--port-range=PORT_RANGE', 'Number of ports to try to connect to') do |port_range|
357
+ config[:port_range] = port_range
358
+ end
355
359
  o.on('--host=HOST', 'Listening TCP/IP host') do |host|
356
360
  config[:host] = host
357
361
  end
data/lib/debug/server.rb CHANGED
@@ -399,6 +399,13 @@ module DEBUGGER__
399
399
  raise "Specify digits for port number"
400
400
  end
401
401
  end
402
+ @port_range = if @port.zero?
403
+ 0
404
+ else
405
+ port_range_str = (CONFIG[:port_range] || "0").to_s
406
+ raise "Specify a positive integer <=16 for port range" unless port_range_str.match?(/\A\d+\z/) && port_range_str.to_i <= 16
407
+ port_range_str.to_i
408
+ end
402
409
  @uuid = nil # for CDP
403
410
 
404
411
  super()
@@ -452,7 +459,9 @@ module DEBUGGER__
452
459
  end
453
460
  end
454
461
  rescue Errno::EADDRINUSE
455
- if retry_cnt < 10
462
+ number_of_retries = @port_range.zero? ? 10 : @port_range
463
+ if retry_cnt < number_of_retries
464
+ @port += 1 unless @port_range.zero?
456
465
  retry_cnt += 1
457
466
  sleep 0.1
458
467
  retry
@@ -688,7 +688,7 @@ module DEBUGGER__
688
688
  yield $stderr
689
689
  end
690
690
 
691
- def puts result=''
691
+ def puts result = ""
692
692
  # STDERR.puts "puts: #{result}"
693
693
  # send_event 'output', category: 'stderr', output: "PUTS!!: " + result.to_s
694
694
  end
@@ -501,7 +501,7 @@ module DEBUGGER__
501
501
  send_response(req, **res)
502
502
  end
503
503
 
504
- def puts result
504
+ def puts result = ""
505
505
  # STDERR.puts "puts: #{result}"
506
506
  send_event 'output', category: 'console', output: "#{result&.chomp}\n"
507
507
  end
@@ -44,7 +44,7 @@ module DEBUGGER__
44
44
  end
45
45
 
46
46
  module GlobalVariablesHelper
47
- SKIP_GLOBAL_LIST = %i[$= $KCODE $-K $SAFE].freeze
47
+ SKIP_GLOBAL_LIST = %i[$= $KCODE $-K $SAFE $FILENAME].freeze
48
48
  def safe_global_variables
49
49
  global_variables.reject{|name| SKIP_GLOBAL_LIST.include? name }
50
50
  end
data/lib/debug/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DEBUGGER__
4
- VERSION = "1.9.2"
4
+ VERSION = "1.10.0"
5
5
  end
data/misc/README.md.erb CHANGED
@@ -244,16 +244,16 @@ It will help if you want to know what the program is doing.
244
244
 
245
245
  If you want to run a command written in Ruby like `rake`, `rails`, `bundle`, `rspec`, and so on, you can use `rdbg -c` option.
246
246
 
247
- * Without `-c` option, `rdbg <name>` means that `<name>` is Ruby script and invoke it like `ruby <name>` with the debugger.
248
- * With `-c` option, `rdbg -c <name>` means that `<name>` is a command in `PATH` and simply invokes it with the debugger.
247
+ * Without the `-c` option, `rdbg <name>` means that `<name>` is a Ruby script and invokes it like `ruby <name>` with the debugger.
248
+ * With the `-c` option, `rdbg -c <name>` means that `<name>` is a command in `PATH` and simply invokes it with the debugger.
249
249
 
250
250
  Examples:
251
251
  * `rdbg -c -- rails server`
252
252
  * `rdbg -c -- bundle exec ruby foo.rb`
253
253
  * `rdbg -c -- bundle exec rake test`
254
- * `rdbg -c -- ruby target.rb` is same as `rdbg target.rb`
254
+ * `rdbg -c -- ruby target.rb` is the same as `rdbg target.rb`
255
255
 
256
- NOTE: `--` is needed to separate the command line options for `rdbg` and invoking command. For example, `rdbg -c rake -T` is recognized like `rdbg -c -T -- rake`. It should be `rdbg -c -- rake -T`.
256
+ NOTE: `--` is needed to separate the command line options for `rdbg` and the invoking command. For example, `rdbg -c rake -T` is recognized like `rdbg -c -T -- rake`. It should be `rdbg -c -- rake -T`.
257
257
 
258
258
  NOTE: If you want to use bundler (`bundle` command), you need to write `gem debug` line in your `Gemfile`.
259
259
 
@@ -330,7 +330,9 @@ When `rdbg --attach` connects to the debuggee, you can use any debug commands (s
330
330
 
331
331
  NOTE: If you use the `quit` command, only the remote console exits and the debuggee program continues to run (and you can connect it again). If you want to exit the debuggee program, use `kill` command.
332
332
 
333
- If you want to use TCP/IP for the remote debugging, you need to specify the port and host with `--port` like `rdbg --open --port 12345` and it binds to `localhost:12345`.
333
+ If you want to use TCP/IP for the remote debugging, you need to specify the port and host with `--port` like `rdbg --open --port 12345` and it binds to `localhost:12345`. You can add an optional `--port_range` option to try multiple ports in a reliable way. For example, `rdbg --open --port 12345 --port_range 10` will try to bind to 12345, 12346, 12347, ... until it finds an available port.
334
+
335
+ ```shell
334
336
 
335
337
  To connect to the debuggee, you need to specify the port.
336
338
 
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: debug
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.2
4
+ version: 1.10.0
5
5
  platform: ruby
6
+ original_platform: ''
6
7
  authors:
7
8
  - Koichi Sasada
8
9
  bindir: exe
9
10
  cert_chain: []
10
- date: 2024-03-29 00:00:00.000000000 Z
11
+ date: 2024-12-18 00:00:00.000000000 Z
11
12
  dependencies:
12
13
  - !ruby/object:Gem::Dependency
13
14
  name: irb
@@ -89,6 +90,7 @@ licenses:
89
90
  metadata:
90
91
  homepage_uri: https://github.com/ruby/debug
91
92
  source_code_uri: https://github.com/ruby/debug
93
+ changelog_uri: https://github.com/ruby/debug/releases/tag/v1.10.0
92
94
  rdoc_options: []
93
95
  require_paths:
94
96
  - lib