debugger-xml 0.1.9 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: a332176aafda476ecc7dddaf06f1c632967b61b7
4
- data.tar.gz: 59e5b2092c4c652199a33f9c6a64ecf6f77ae036
5
- SHA512:
6
- metadata.gz: 076982a662177f29705925d1b69518456b91cc277acf679a4016f3c7d37e9d92023b2c4ffc81c207a113ab29e5614c2e62c7a9fa8f5adbdc7451434661f3cf3f
7
- data.tar.gz: 32049fad88610fb205b5821a5900662e8dd445321ec1c98a07a475a99f228c7f44984f2d8e2d6f6a060b689d0711e828baa67ef9f6db775e3a38b0b81fc39a99
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ OTZiODljZjRmYmUxMzk5NTEwMTMwNzlhMWM4NWY3MjhmMGQxOTk3Mw==
5
+ data.tar.gz: !binary |-
6
+ OTM4ZDY2YzJhYzJmMDZkOGU0ZDY4MjA3MDBkZjhmYjE4NWFhZDYxOA==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ ZTFlNGRkNTdlMzlmMDQyNWEyMDgyYzk4YzJiZTVhYjA3YTU2NDlmMTY3YmJj
10
+ Mzk4YTFkNDdlNDA1ZjI0Mzk5M2Q5ZmYxOTNjY2EzNjk2NzQyMDNkMmQzNmJl
11
+ YWVhNzlmMjMxN2FiMTdiMjUwZGExNDUwZmMwMzRiOTdjZDk3OTY=
12
+ data.tar.gz: !binary |-
13
+ YzhjZDIwZmU1YzA3ZGY1MWVlN2MxYjBmZmZiM2M0YWQ0N2JlNmMxNmFmM2I2
14
+ MjcwNDc1MzViOTM2MmZlMTBkODQ1YzQ5ZTFmMGVmNmNlOWRjMDQ1Nzc2OTNm
15
+ YTgzYzU5ZjMwNWZlYjgwMzE0MWZjZjNhMmM3YTQ1ZjJlMDAzY2E=
data/bin/rdebug-ide CHANGED
@@ -20,6 +20,11 @@ class RdebugIde
20
20
  Debugger.wait_connection = true
21
21
  Debugger.printer = Printers::Xml.new
22
22
  Debugger.const_set("PROG_SCRIPT", ARGV.shift)
23
+ Debugger::Xml.logger = if options.debug_mode
24
+ Debugger::Xml::Ide::Logger.new
25
+ else
26
+ Debugger::Xml::FakeLogger.new
27
+ end
23
28
  end
24
29
 
25
30
  def run
@@ -61,7 +66,10 @@ class RdebugIde
61
66
 
62
67
  def opts
63
68
  @opts ||= begin
64
- @options = OpenStruct.new(host: "127.0.0.1", port: 12345, stop: false, tracing: false, wait_for_start: true, int_handler: true)
69
+ @options = OpenStruct.new(
70
+ host: "127.0.0.1", port: 12345, stop: false, tracing: false, wait_for_start: true,
71
+ int_handler: true, debug_mode: false
72
+ )
65
73
  opts = OptionParser.new do |opts|
66
74
  opts.banner = %{
67
75
  Using rdebug-ide
@@ -71,6 +79,7 @@ class RdebugIde
71
79
  opts.separator ""
72
80
  opts.separator "Options:"
73
81
  opts.on("-h", "--host HOST", "Host name used for remote debugging") { |host| @options.host = host }
82
+ opts.on("-d", "--debug", "Enable debug mode") { |host| @options.debug_mode = true }
74
83
  opts.on("--cport PORT", Integer, "Port used for control commands") { |cport| @options.cport = cport }
75
84
  opts.on("-p", "--port PORT", Integer, "Port used for remote debugging") { |port| @options.port = port }
76
85
  opts.on("--wait", String, "Wait for 'start' command") do |bool|
data/bin/rdebug-vim CHANGED
@@ -16,6 +16,11 @@ class RdebugVim
16
16
  Debugger.wait_for_start = true
17
17
  Debugger.printer = Printers::Xml.new
18
18
  Debugger.const_set("PROG_SCRIPT", options.script)
19
+ Debugger::Xml.logger = if options.debug_mode
20
+ Debugger::Xml::Vim::Logger.new(options.logger_file)
21
+ else
22
+ Debugger::Xml::FakeLogger.new
23
+ end
19
24
  end
20
25
 
21
26
  def run
data/lib/debugger/xml.rb CHANGED
@@ -1,3 +1,11 @@
1
1
  require "debugger"
2
2
  require "debugger/printers/xml"
3
3
  Dir.glob(File.expand_path("../**/*.rb", __FILE__)).each { |f| require f }
4
+
5
+ module Debugger
6
+ module Xml
7
+ class << self
8
+ attr_accessor :logger
9
+ end
10
+ end
11
+ end
@@ -5,29 +5,37 @@ module Debugger
5
5
 
6
6
  def start_for_vim(options)
7
7
  return if @control_thread
8
+ Xml.logger.puts("Going to daemonize");
8
9
  daemonize!
10
+ Xml.logger.puts("Successfully daemonized");
9
11
  $stdout.reopen(options.output_file, 'w')
10
12
  $stdout.sync
11
13
  $stderr.reopen($stdout)
14
+ Xml.logger.puts("Redirected stderr");
12
15
  @mutex = Mutex.new
13
16
  @proceed = ConditionVariable.new
14
17
  start
18
+ Xml.logger.puts("Started debugger");
15
19
  File.unlink(options.socket) if File.exist?(options.socket)
16
20
  server = UNIXServer.new(options.socket)
17
21
  Xml::Vim::Notification.new("establish_connection", options).send
22
+ Xml.logger.puts("Sent 'established_connection' command");
18
23
  @control_thread = DebugThread.new do
19
24
  begin
20
25
  while (session = server.accept)
26
+ Xml.logger.puts("Accepted connection");
21
27
  interface = Xml::Vim::Interface.new(session, options)
22
28
  processor = Xml::Vim::ControlCommandProcessor.new(interface)
23
29
  self.handler = Xml::Vim::Processor.new(interface)
30
+ Xml.logger.puts("Going to process commands");
24
31
  processor.process_commands
25
32
  end
26
33
  rescue Exception => e
27
- puts "INTERNAL ERROR!!! #{$!}" rescue nil
28
- puts $!.backtrace.map{|l| "\t#{l}"}.join("\n") rescue nil
34
+ Xml.logger.puts("INTERNAL ERROR!!! #{$!}") rescue nil
35
+ Xml.logger.puts($!.backtrace.map{|l| "\t#{l}"}.join("\n")) rescue nil
29
36
  raise e
30
37
  ensure
38
+ Xml.logger.puts("Closing server");
31
39
  server.close
32
40
  end
33
41
  end
@@ -0,0 +1,11 @@
1
+ module Debugger
2
+ module Xml
3
+ class FakeLogger
4
+ def initialize(*args)
5
+ end
6
+
7
+ def puts(*args)
8
+ end
9
+ end
10
+ end
11
+ end
@@ -50,7 +50,9 @@ module Debugger
50
50
  def read_command(*args)
51
51
  result = non_blocking_gets
52
52
  raise IOError unless result
53
- result.chomp
53
+ result.chomp.tap do |r|
54
+ Xml.logger.puts("Read command: #{r}")
55
+ end
54
56
  end
55
57
 
56
58
  def readline_support?
@@ -58,7 +60,10 @@ module Debugger
58
60
  end
59
61
 
60
62
  def print(*args)
61
- @socket.printf(*escape_input(args))
63
+ escaped_args = escape_input(args)
64
+ value = escaped_args.first % escaped_args[1..-1]
65
+ Xml.logger.puts("Going to print: #{value}")
66
+ @socket.printf(value)
62
67
  end
63
68
 
64
69
  end
@@ -0,0 +1,11 @@
1
+ module Debugger
2
+ module Xml
3
+ module Ide
4
+ class Logger
5
+ def puts(string)
6
+ $stderr.puts(string)
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -1,5 +1,5 @@
1
1
  module Debugger
2
2
  module Xml
3
- VERSION = "0.1.9"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
@@ -11,7 +11,10 @@ module Debugger
11
11
  end
12
12
 
13
13
  def print(*args)
14
- @output << sprintf(*escape_input(args))
14
+ escaped_args = escape_input(args)
15
+ value = escaped_args.first % escaped_args[1..-1]
16
+ Xml.logger.puts("Going to print: #{value}")
17
+ @output << sprintf(value)
15
18
  end
16
19
 
17
20
  def send_response
@@ -0,0 +1,18 @@
1
+ module Debugger
2
+ module Xml
3
+ module Vim
4
+ class Logger
5
+ def initialize(logger_file)
6
+ @logger_file = logger_file
7
+ end
8
+
9
+ def puts(string)
10
+ File.open(@logger_file, 'a') do |f|
11
+ # match vim redir style new lines, rather than trailing
12
+ f << "\ndebugger-xml, #{Time.now.strftime("%H:%M:%S")} : #{string.chomp}"
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
data/test/test_helper.rb CHANGED
@@ -4,3 +4,4 @@ require 'debugger/xml'
4
4
  require 'debugger/test'
5
5
 
6
6
  $debugger_test_dir = File.expand_path("..", __FILE__)
7
+ Debugger::Xml.logger = Debugger::Xml::FakeLogger.new
metadata CHANGED
@@ -1,41 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: debugger-xml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton Astashov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-11 00:00:00.000000000 Z
11
+ date: 2013-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: debugger
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ! '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: 1.6.2
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
26
  version: 1.6.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: builder
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ! '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: 2.0.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ! '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: 2.0.0
41
41
  - !ruby/object:Gem::Dependency
@@ -114,12 +114,15 @@ files:
114
114
  - lib/debugger/xml/extensions/ide_server.rb
115
115
  - lib/debugger/xml/extensions/processor.rb
116
116
  - lib/debugger/xml/extensions/vim_server.rb
117
+ - lib/debugger/xml/fake_logger.rb
117
118
  - lib/debugger/xml/ide/control_command_processor.rb
118
119
  - lib/debugger/xml/ide/interface.rb
120
+ - lib/debugger/xml/ide/logger.rb
119
121
  - lib/debugger/xml/ide/processor.rb
120
122
  - lib/debugger/xml/version.rb
121
123
  - lib/debugger/xml/vim/control_command_processor.rb
122
124
  - lib/debugger/xml/vim/interface.rb
125
+ - lib/debugger/xml/vim/logger.rb
123
126
  - lib/debugger/xml/vim/notification.rb
124
127
  - lib/debugger/xml/vim/processor.rb
125
128
  - test/breakpoints_test.rb
@@ -185,17 +188,17 @@ require_paths:
185
188
  - lib
186
189
  required_ruby_version: !ruby/object:Gem::Requirement
187
190
  requirements:
188
- - - '>='
191
+ - - ! '>='
189
192
  - !ruby/object:Gem::Version
190
193
  version: '0'
191
194
  required_rubygems_version: !ruby/object:Gem::Requirement
192
195
  requirements:
193
- - - '>='
196
+ - - ! '>='
194
197
  - !ruby/object:Gem::Version
195
198
  version: '0'
196
199
  requirements: []
197
200
  rubyforge_project:
198
- rubygems_version: 2.0.2
201
+ rubygems_version: 2.0.7
199
202
  signing_key:
200
203
  specification_version: 4
201
204
  summary: Implements XML interface for the 'debugger' gem, compatible with ruby-debug-ide