debugger 1.1.4 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 1.2.0
2
+ * Add the ability to query the command and control port when starting remote debugging
3
+
1
4
  ## 1.1.4
2
5
  * Bump ruby_core_source dependency
3
6
 
data/README.md CHANGED
@@ -113,13 +113,17 @@ Let's keep this working for the ruby community!
113
113
 
114
114
  ## Related projects
115
115
 
116
+ * [debugger-completion](https://github.com/cldwalker/debugger-completion) - autocompletion for
117
+ debugger commands and more
116
118
  * [debugger-pry](https://github.com/pry/debugger-pry) - using pry within debugger
117
119
  * [pry-debugger](https://github.com/nixme/pry-debugger) - using debugger within pry
120
+ * [ruby-debug-passenger](https://github.com/davejamesmiller/ruby-debug-passenger) - rake task to
121
+ restart Passenger with debugger connected
118
122
 
119
123
  ## Credits
120
124
 
121
125
  * Thanks to the original authors: Kent Sibilev and Mark Moseley
122
- * Contributors: ericpromislow, jnimety, adammck, hipe
126
+ * Contributors: ericpromislow, jnimety, adammck, hipe, FooBarWidget
123
127
  * Fork started on awesome @relevance fridays!
124
128
 
125
129
  ## TODO
data/Rakefile CHANGED
@@ -17,7 +17,8 @@ COMMON_FILES = FileList[
17
17
 
18
18
  CLI_TEST_FILE_LIST = FileList['test/lib/commands/unit/*.rb',
19
19
  'test/lib/commands/*_test.rb',
20
- 'test/lib/**/*_test.rb']
20
+ 'test/lib/**/*_test.rb',
21
+ 'test/test-remote.rb']
21
22
  # disabled until requires fixed and tests pass
22
23
  # 'test/test-*.rb']
23
24
  CLI_FILES = COMMON_FILES + FileList[
@@ -1,5 +1,5 @@
1
1
  module Debugger
2
2
  # TODO: remove version from C ext
3
3
  send :remove_const, :VERSION if const_defined? :VERSION
4
- VERSION = '1.1.4'
4
+ VERSION = '1.2.0'
5
5
  end
data/lib/ruby-debug.rb CHANGED
@@ -35,7 +35,7 @@ module Debugger
35
35
  # if the call stack is truncated.
36
36
  attr_accessor :start_sentinal
37
37
 
38
- attr_reader :thread, :control_thread
38
+ attr_reader :thread, :control_thread, :cmd_port, :ctrl_port
39
39
 
40
40
  def interface=(value) # :nodoc:
41
41
  handler.interface = value
@@ -56,15 +56,16 @@ module Debugger
56
56
  cmd_port, ctrl_port = port, port + 1
57
57
  end
58
58
 
59
- start_control(host, ctrl_port)
59
+ ctrl_port = start_control(host, ctrl_port)
60
60
 
61
61
  yield if block_given?
62
62
 
63
63
  mutex = Mutex.new
64
64
  proceed = ConditionVariable.new
65
65
 
66
+ server = TCPServer.new(host, cmd_port)
67
+ @cmd_port = cmd_port = server.addr[1]
66
68
  @thread = DebugThread.new do
67
- server = TCPServer.new(host, cmd_port)
68
69
  while (session = server.accept)
69
70
  self.interface = RemoteInterface.new(session)
70
71
  if wait_connection
@@ -83,15 +84,17 @@ module Debugger
83
84
  alias start_server start_remote
84
85
 
85
86
  def start_control(host = nil, ctrl_port = PORT + 1) # :nodoc:
86
- return if defined?(@control_thread) && @control_thread
87
+ return @ctrl_port if defined?(@control_thread) && @control_thread
88
+ server = TCPServer.new(host, ctrl_port)
89
+ @ctrl_port = server.addr[1]
87
90
  @control_thread = DebugThread.new do
88
- server = TCPServer.new(host, ctrl_port)
89
91
  while (session = server.accept)
90
92
  interface = RemoteInterface.new(session)
91
93
  processor = ControlCommandProcessor.new(interface)
92
94
  processor.process_commands
93
95
  end
94
96
  end
97
+ @ctrl_port
95
98
  end
96
99
 
97
100
  #
@@ -0,0 +1,14 @@
1
+ require 'test/unit'
2
+ require 'socket'
3
+ require 'ruby-debug'
4
+
5
+ # Test Debugger.start_remote, Debugger.cmd_port and Debugger.ctrl_port
6
+ class TestRemote < Test::Unit::TestCase
7
+ def test_remote
8
+ Debugger.start_remote('127.0.0.1', [0, 0])
9
+ assert_block { Debugger.ctrl_port > 0 }
10
+ assert_block { Debugger.cmd_port > 0 }
11
+ assert_nothing_raised { TCPSocket.new('127.0.0.1', Debugger.ctrl_port).close }
12
+ assert_nothing_raised { TCPSocket.new('127.0.0.1', Debugger.cmd_port).close }
13
+ end
14
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: debugger
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
4
+ version: 1.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2012-06-08 00:00:00.000000000 Z
14
+ date: 2012-07-19 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: columnize
@@ -366,6 +366,7 @@ files:
366
366
  - test/test-output.rb
367
367
  - test/test-quit.rb
368
368
  - test/test-raise.rb
369
+ - test/test-remote.rb
369
370
  - test/test-save.rb
370
371
  - test/test-scope-var.rb
371
372
  - test/test-setshow.rb