Permalink
Browse files

Remove all XML stuff, gonna move it to a separate gem

  • Loading branch information...
1 parent 8ff7a58 commit 2d608535e60b1ba2796e9eff60426422afd9408e @astashov astashov committed Mar 4, 2013
Showing with 266 additions and 1,925 deletions.
  1. +0 −90 bin/rdebug-ide
  2. +0 −1 debugger.gemspec
  3. +5 −1 lib/debugger/test.rb
  4. +0 −23 lib/ruby-debug.rb
  5. +0 −1 lib/ruby-debug/commands/edit.rb
  6. +5 −9 lib/ruby-debug/commands/frame.rb
  7. +0 −1 lib/ruby-debug/commands/help.rb
  8. +0 −1 lib/ruby-debug/commands/info.rb
  9. +0 −1 lib/ruby-debug/commands/irb.rb
  10. +0 −1 lib/ruby-debug/commands/kill.rb
  11. +0 −1 lib/ruby-debug/commands/tmate.rb
  12. +0 −1 lib/ruby-debug/commands/trace.rb
  13. +17 −16 lib/ruby-debug/commands/variables.rb
  14. +0 −147 lib/ruby-debug/ide_processor.rb
  15. +0 −63 lib/ruby-debug/interface.rb
  16. +0 −121 lib/ruby-debug/printers/texts/xml.yml
  17. +0 −195 lib/ruby-debug/printers/xml.rb
  18. +11 −10 lib/ruby-debug/processor.rb
  19. +84 −294 test/breakpoints_test.rb
  20. +12 −52 test/conditions_test.rb
  21. +4 −14 test/continue_test.rb
  22. +8 −31 test/display_test.rb
  23. +0 −9 test/edit_test.rb
  24. +16 −38 test/eval_test.rb
  25. +12 −39 test/frame_test.rb
  26. +0 −8 test/help_test.rb
  27. +0 −9 test/info_test.rb
  28. +0 −8 test/irb_test.rb
  29. +8 −28 test/jump_test.rb
  30. +0 −8 test/kill_test.rb
  31. +14 −49 test/method_test.rb
  32. +0 −31 test/new/examples/variables_xml.rb
  33. +0 −62 test/new/ide_control_command_processor_test.rb
  34. +0 −118 test/new/ide_processor_test.rb
  35. +0 −193 test/new/printers/xml_test.rb
  36. +4 −14 test/reload_test.rb
  37. +9 −36 test/restart_test.rb
  38. +4 −14 test/set_test.rb
  39. +0 −8 test/stepping_test.rb
  40. +9 −31 test/thread_test.rb
  41. +0 −8 test/tmate_test.rb
  42. +0 −8 test/trace_test.rb
  43. +44 −132 test/variables_test.rb
View
@@ -1,90 +0,0 @@
-#!/usr/bin/env ruby
-#
-$LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
-require 'optparse'
-require 'ostruct'
-require 'debugger'
-require 'ruby-debug/ide_processor'
-
-$stdout.sync = true
-
-class RdebugIde
-
- def initialize
- check_argv!
- Debugger.const_set("ARGV", ARGV.clone)
- Debugger.const_set("RDEBUG_SCRIPT", rdebug_path)
- install_interruption_hander
- Debugger.tracing = options.tracing
- Debugger.wait_for_start = options.wait_for_start
- Debugger.wait_connection = true
- Debugger.printer = Printers::Xml.new
- Debugger.const_set("PROG_SCRIPT", ARGV.shift)
- end
-
- def run
- Debugger.start_remote_ide(options.host, options.port)
- bt = Debugger.debug_load(Debugger::PROG_SCRIPT, false, false)
- if bt
- print bt.backtrace.map{|l| "\t#{l}"}.join("\n"), "\n"
- print "Uncaught exception: #{bt}\n"
- end
- end
-
- private
-
- def check_argv!
- if ARGV.empty?
- puts opts
- puts
- puts "Must specify a script to run"
- exit(1)
- end
- end
-
- def install_interruption_hander
- trap('INT') { Debugger.interrupt_last }
- end
-
- def rdebug_path
- File.expand_path($0).tap do |path|
- if RUBY_PLATFORM =~ /mswin/
- rdebug_path << ".cmd" unless rdebug_path =~ /\.cmd$/i
- end
- end
- end
-
- def options
- opts
- @options
- end
-
- def opts
- @opts ||= begin
- @options = OpenStruct.new(host: "127.0.0.1", port: 12345, stop: false, tracing: false, wait_for_start: true)
- opts = OptionParser.new do |opts|
- opts.banner = %{
- Using rdebug-ide
- Usage: rdebug-ide is supposed to be called from RDT, NetBeans, RubyMine or
- vim-ruby-debugger. The command line interface to 'debugger' is rdebug.
- }.gsub(/^\s*/, '')
- opts.separator ""
- opts.separator "Options:"
- opts.on("-h", "--host HOST", "Host name used for remote debugging") { |host| @options.host = host }
- opts.on("--cport PORT", Integer, "Port used for control commands") { |cport| @options.cport = cport }
- opts.on("-p", "--port PORT", Integer, "Port used for remote debugging") { |port| @options.port = port }
- opts.on("--wait", String, "Wait for 'start' command") do |bool|
- @options.wait_for_start = (bool == "false" ? false : true)
- end
- opts.on('--stop', 'stop when the script is loaded') { @options.stop = true }
- opts.on("-x", "--trace", "turn on line tracing") { @options.tracing = true }
- opts.on("-I", "--include PATH", String, "Add PATH to $LOAD_PATH") { |path| $LOAD_PATH.unshift(path) }
- end
- opts.parse!
- opts
- end
- end
-
-end
-
-RdebugIde.new.run
View
@@ -22,7 +22,6 @@ handling, bindings for stack frames among other things.
s.add_dependency "columnize", ">= 0.3.1"
s.add_dependency "debugger-ruby_core_source", '~> 1.2.0'
s.add_dependency "debugger-linecache", '~> 1.1.1'
- s.add_dependency 'builder', '>= 2.0.0'
s.add_development_dependency 'rake', '~> 0.9.2.2'
s.add_development_dependency 'rake-compiler', '~> 0.8.0'
s.add_development_dependency 'minitest', '~> 2.12.1'
@@ -1,2 +1,6 @@
-Dir.glob(File.expand_path("../test/*.rb", __FILE__)).each { |f| require f }
+require 'mocha/setup'
+require 'pathname'
+Debugger::Command.settings[:debuggertesting] = true
+# $debugger_test_dir must be specified, it should point to the test/ directory
+Dir.glob(File.expand_path("../test/*.rb", __FILE__)).each { |f| require f }
View
@@ -31,7 +31,6 @@ class << self
# in remote mode, wait for the remote connection
attr_accessor :wait_connection
- attr_accessor :wait_for_start
# If set, a string to look for in caller() and is used to see
# if the call stack is truncated.
@@ -45,23 +44,6 @@ def interface=(value) # :nodoc:
handler.interface = value
end
- def start_remote_ide(host, port)
- return if @control_thread
- @mutex = Mutex.new
- @proceed = ConditionVariable.new
- start
- @control_thread = DebugThread.new do
- server = TCPServer.new(host, port)
- while (session = server.accept)
- interface = IdeInterface.new(session)
- processor = IdeControlCommandProcessor.new(interface)
- self.handler = IdeProcessor.new(interface)
- processor.process_commands
- end
- end
- @mutex.synchronize { @proceed.wait(@mutex) } if wait_for_start
- end
-
# Starts a remote debugger.
#
def start_remote(host = nil, port = PORT)
@@ -161,11 +143,6 @@ def run_init_script(out = handler.interface)
cwd_script_file != home_script_file
end
- def proceed
- return unless @mutex
- @mutex.synchronize { @proceed.signal }
- end
-
#
# Runs a script file
#
@@ -6,7 +6,6 @@ def regexp
end
def execute
- errmsg(pr("general.errors.unsupported", cmd: 'edit')) && return if Debugger.printer.type == "xml"
if not @match[1] or @match[1].strip.empty?
unless @state.context
errmsg pr("edit.errors.state")
@@ -90,16 +90,12 @@ def print_frame(mark, pos, adjust = false, context = @state.context)
def get_pr_arguments(mark, pos, context)
if print_frame?(context, pos)
- mark = if Debugger.printer.type == "xml"
- (!!mark).to_s
+ mark = if mark == true
+ "--> "
+ elsif mark == false
+ " "
else
- if mark == true
- "--> "
- elsif mark == false
- " "
- else
- mark
- end
+ mark
end
line = context.frame_line(pos)
@@ -9,7 +9,6 @@ def regexp
end
def execute
- errmsg(pr("general.errors.unsupported", cmd: 'help')) && return if Debugger.printer.type == "xml"
if @match[1]
args = @match[1].split
cmds = @state.commands.select do |cmd|
@@ -91,7 +91,6 @@ def regexp
end
def execute
- errmsg(pr("general.errors.unsupported", cmd: 'info')) && return if Debugger.printer.type == "xml"
if !@match[1]
errmsg "\"info\" must be followed by the name of an info command:\n"
print "List of info subcommands:\n\n"
@@ -63,7 +63,6 @@ def regexp
end
def execute
- errmsg(pr("general.errors.unsupported", cmd: 'irb')) && return if Debugger.printer.type == "xml"
unless @state.interface.kind_of?(LocalInterface)
print "Command is available only in local mode.\n"
throw :debug_error
@@ -13,7 +13,6 @@ def regexp
end
def execute
- errmsg(pr("general.errors.unsupported", cmd: 'kill')) && return if Debugger.printer.type == "xml"
if @match[1]
signame = @match[1]
unless Signal.list.member?(signame)
@@ -6,7 +6,6 @@ def regexp
end
def execute
- errmsg(pr("general.errors.unsupported", cmd: 'tmate')) && return if Debugger.printer.type == "xml"
if @match[1]
frm_n = @match[1].to_i
if frm_n > @state.context.stack_size || frm_n == 0
@@ -8,7 +8,6 @@ def regexp
end
def execute
- errmsg(pr("general.errors.unsupported", cmd: 'trace')) && return if Debugger.printer.type == "xml"
if @match[1] =~ /on|off/
onoff = 'on' == @match[1]
if @match[2]
@@ -114,22 +114,8 @@ def regexp
end
def execute
- obj = if @match[1]
- begin
- ObjectSpace._id2ref(@match[1].hex)
- rescue RangeError
- errmsg "Unknown object id : %s" % @match[1]
- nil
- end
- else
- debug_eval(@match.post_match.empty? ? 'self' : @match.post_match)
- end
-
- if Debugger.printer.type == "xml"
- print Debugger.printer.print_instance_variables(obj)
- else
- var_list(obj.instance_variables, obj.instance_eval{binding()})
- end
+ obj = get_obj(@match)
+ var_list(obj.instance_variables, obj.instance_eval{binding()})
end
class << self
@@ -143,6 +129,21 @@ def help(cmd)
}
end
end
+
+ private
+
+ def get_obj(match)
+ obj = if match[1]
+ begin
+ ObjectSpace._id2ref(match[1].hex)
+ rescue RangeError
+ errmsg "Unknown object id : %s" % match[1]
+ nil
+ end
+ else
+ debug_eval(match.post_match.empty? ? 'self' : match.post_match)
+ end
+ end
end
# Implements the debugger 'var local' command.
Oops, something went wrong.

0 comments on commit 2d60853

Please sign in to comment.