ruby-debug-ide 0.3.3 → 0.3.4

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.
@@ -0,0 +1,24 @@
1
+ The file lib/classic-debug.rb is based on the debug.rb file from Ruby
2
+ project.
3
+
4
+ Copyright (c) 2007-2008, debug-commons team
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining
7
+ a copy of this software and associated documentation files (the
8
+ "Software"), to deal in the Software without restriction, including
9
+ without limitation the rights to use, copy, modify, merge, publish,
10
+ distribute, sublicense, and/or sell copies of the Software, and to
11
+ permit persons to whom the Software is furnished to do so, subject to
12
+ the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be
15
+ included in all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
+
@@ -0,0 +1,110 @@
1
+ require 'rubygems'
2
+
3
+ require 'rake/gempackagetask'
4
+ require 'rake/rdoctask'
5
+ require 'rake/testtask'
6
+ require 'date'
7
+
8
+ desc 'Default: run unit tests.'
9
+ task :default => [:test]
10
+
11
+ # ------- Default Package ----------
12
+ RUBY_DEBUG_BASE_VERSION = "0.10.3"
13
+ RUBY_DEBUG_IDE_VERSION = "0.3.4"
14
+
15
+ FILES = FileList[
16
+ 'CHANGES',
17
+ 'ChangeLog',
18
+ 'ChangeLog.archive',
19
+ 'MIT-LICENSE',
20
+ 'Rakefile',
21
+ 'bin/*',
22
+ 'lib/**/*',
23
+ 'test/**/*'
24
+ ]
25
+
26
+ ide_spec = Gem::Specification.new do |spec|
27
+ spec.name = "ruby-debug-ide"
28
+
29
+ spec.homepage = "http://rubyforge.org/projects/debug-commons/"
30
+ spec.summary = "IDE interface for ruby-debug."
31
+ spec.description = <<-EOF
32
+ An interface which glues ruby-debug to IDEs like Eclipse (RDT) and NetBeans.
33
+ EOF
34
+
35
+ spec.version = RUBY_DEBUG_IDE_VERSION
36
+
37
+ spec.author = "Markus Barchfeld, Martin Krauskopf"
38
+ spec.email = "rubyeclipse-dev-list@sourceforge.net"
39
+ spec.platform = Gem::Platform::RUBY
40
+ spec.require_path = "lib"
41
+ spec.bindir = "bin"
42
+ spec.executables = ["rdebug-ide"]
43
+ spec.autorequire = "ruby-debug-base"
44
+ spec.files = FILES.to_a
45
+
46
+ spec.required_ruby_version = '>= 1.8.2'
47
+ spec.date = DateTime.now
48
+ spec.rubyforge_project = 'debug-commons'
49
+ spec.add_dependency('ruby-debug-base', "~> #{RUBY_DEBUG_BASE_VERSION}.0")
50
+
51
+ # rdoc
52
+ spec.has_rdoc = false
53
+ end
54
+
55
+ # Rake task to build the default package
56
+ Rake::GemPackageTask.new(ide_spec) do |pkg|
57
+ pkg.need_tar = true
58
+ end
59
+
60
+ # Unit tests
61
+ Rake::TestTask.new do |t|
62
+ t.libs << "test"
63
+ t.libs << "test-base"
64
+ t.pattern = 'test/*_test.rb'
65
+ t.verbose = true
66
+ t.warning = false
67
+ end
68
+
69
+
70
+ desc "Create a GNU-style ChangeLog via svn2cl"
71
+ task :ChangeLog do
72
+ system("svn2cl --authors=svn2cl_usermap svn://rubyforge.org/var/svn/debug-commons/ruby-debug-ide/branches/ruby-debug-ide-0.3.x -o ChangeLog")
73
+ end
74
+
75
+ #desc "Publish ruby-debug to RubyForge."
76
+ #task :publish do
77
+ # require 'rake/contrib/sshpublisher'
78
+ #
79
+ # # Get ruby-debug path
80
+ # ruby_debug_path = File.expand_path(File.dirname(__FILE__))
81
+ #
82
+ # publisher = Rake::SshDirPublisher.new("kent@rubyforge.org",
83
+ # "/var/www/gforge-projects/ruby-debug", ruby_debug_path)
84
+ #end
85
+ #
86
+ #desc "Clear temp files"
87
+ #task :clean do
88
+ # cd "ext" do
89
+ # if File.exists?("Makefile")
90
+ # sh "make clean"
91
+ # rm "Makefile"
92
+ # end
93
+ # end
94
+ #end
95
+ #
96
+ ## --------- RDoc Documentation ------
97
+ #desc "Generate rdoc documentation"
98
+ #Rake::RDocTask.new("rdoc") do |rdoc|
99
+ # rdoc.rdoc_dir = 'doc'
100
+ # rdoc.title = "ruby-debug"
101
+ # # Show source inline with line numbers
102
+ # rdoc.options << "--inline-source" << "--line-numbers"
103
+ # # Make the readme file the start page for the generated html
104
+ # rdoc.options << '--main' << 'README'
105
+ # rdoc.rdoc_files.include('bin/**/*',
106
+ # 'lib/**/*.rb',
107
+ # 'ext/**/ruby_debug.c',
108
+ # 'README',
109
+ # 'LICENSE')
110
+ #end
@@ -19,7 +19,7 @@ module Debugger
19
19
  end
20
20
  end
21
21
  end
22
-
22
+
23
23
  class Context
24
24
  def interrupt
25
25
  self.stop_next = 1
@@ -93,7 +93,11 @@ module Debugger
93
93
  @proceed.wait(@mutex)
94
94
  end
95
95
 
96
- debug_load(Debugger::PROG_SCRIPT, false, load_mode)
96
+ bt = debug_load(Debugger::PROG_SCRIPT, false, load_mode)
97
+ if bt
98
+ $stderr.print bt.backtrace.map{|l| "\t#{l}"}.join("\n"), "\n"
99
+ $stderr.print "Uncaught exception: #{bt}\n"
100
+ end
97
101
  end
98
102
 
99
103
  def run_prog_script
@@ -106,20 +110,26 @@ module Debugger
106
110
  raise "Debugger is not started" unless started?
107
111
  return if @control_thread
108
112
  @control_thread = DebugThread.new do
109
- unless RUBY_PLATFORM =~ /darwin/i # Mac OS X seems to have problem with 'localhost'
110
- host ||= 'localhost' # nil does not seem to work for IPv6, localhost does
111
- end
112
- Debugger.print_debug("Waiting for connection on '#{host}:#{port}'")
113
- $stderr.puts "Fast Debugger (ruby-debug-ide 0.3.3) listens on #{host}:#{port}"
114
- server = TCPServer.new(host, port)
115
- while (session = server.accept)
116
- begin
117
- interface = RemoteInterface.new(session)
118
- @event_processor = EventProcessor.new(interface)
119
- ControlCommandProcessor.new(interface).process_commands
120
- rescue StandardError, ScriptError => ex
121
- puts ex
113
+ begin
114
+ unless RUBY_PLATFORM =~ /darwin/i # Mac OS X seems to have problem with 'localhost'
115
+ host ||= 'localhost' # nil does not seem to work for IPv6, localhost does
116
+ end
117
+ Debugger.print_debug("Waiting for connection on '#{host}:#{port}'")
118
+ $stderr.printf "Fast Debugger (ruby-debug-ide 0.3.4) listens on #{host}:#{port}\n"
119
+ server = TCPServer.new(host, port)
120
+ while (session = server.accept)
121
+ begin
122
+ interface = RemoteInterface.new(session)
123
+ @event_processor = EventProcessor.new(interface)
124
+ ControlCommandProcessor.new(interface).process_commands
125
+ rescue StandardError, ScriptError => ex
126
+ $stderr.printf "Exception in DebugThread loop: #{ex}\n"
127
+ exit 1
128
+ end
122
129
  end
130
+ rescue
131
+ $stderr.printf "Exception in DebugThread: #$!\n"
132
+ exit 2
123
133
  end
124
134
  end
125
135
  end
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'basic_test'
4
+ require 'rd_test_base'
5
+
6
+ class RDSteppingAndBreakpointsTest < RDTestBase
7
+
8
+ include BasicTest
9
+
10
+ end
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rd_test_base'
4
+
5
+ class RDCatchpointTest < RDTestBase
6
+
7
+ def test_catchpoint_basics
8
+ create_socket ['sleep 0.01', '5/0', 'sleep 0.01']
9
+ run_to_line(1)
10
+ send_next
11
+ assert_suspension(@test_path, 2, 1)
12
+ send_ruby('catch ZeroDivisionError')
13
+ assert_catchpoint_set('ZeroDivisionError')
14
+ send_next
15
+ assert_exception(@test_path, 2, 'ZeroDivisionError')
16
+ send_next
17
+ end
18
+
19
+ end
20
+
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rd_test_base'
4
+ require 'condition_test'
5
+
6
+ class RDConditionTest < RDTestBase
7
+
8
+ include ConditionTest
9
+
10
+ end
11
+
@@ -0,0 +1,43 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rd_test_base'
4
+
5
+ class RDEnableDisableTest < RDTestBase
6
+
7
+ def test_enable_disable_basics
8
+ create_socket ['1.upto(10) do', 'sleep 0.01', 'sleep 0.01', 'end']
9
+
10
+ send_test_breakpoint(2)
11
+ assert_breakpoint_added_no(1)
12
+ send_test_breakpoint(3)
13
+ assert_breakpoint_added_no(2)
14
+
15
+ start_debugger
16
+ assert_test_breakpoint(2)
17
+ send_cont
18
+ assert_test_breakpoint(3)
19
+ send_cont
20
+ assert_test_breakpoint(2)
21
+ send_ruby('disable 2')
22
+ assert_breakpoint_disabled(2)
23
+ send_cont
24
+ assert_test_breakpoint(2)
25
+ send_cont
26
+ assert_test_breakpoint(2)
27
+ send_ruby('enable 2')
28
+ assert_breakpoint_enabled(2)
29
+ send_cont
30
+ assert_test_breakpoint(3)
31
+ send_cont
32
+ assert_test_breakpoint(2)
33
+ send_cont
34
+ assert_test_breakpoint(3)
35
+ send_ruby('disable 1')
36
+ assert_breakpoint_disabled(1)
37
+ send_ruby('disable 2')
38
+ assert_breakpoint_disabled(2)
39
+ send_cont
40
+ end
41
+
42
+ end
43
+
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rd_test_base'
4
+ require 'inspect_test'
5
+
6
+ class RDInspectTest < RDTestBase
7
+
8
+ include InspectTest
9
+
10
+ end
11
+
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rd_test_base'
4
+ require 'stepping_breakpoints_test'
5
+
6
+ class RDSteppingAndBreakpointsTest < RDTestBase
7
+
8
+ include SteppingAndBreakpointsTest
9
+
10
+ def test_hit_breakpoint_while_stepping_over
11
+ create_test2 ["class Test2", "def print", "puts 'XX'", "puts 'XX'", "end", "end"]
12
+ create_socket ["require 'test2.rb'", "Test2.new.print", "puts 'a'"]
13
+ send_ruby("b #{@test2_name}:4")
14
+ assert_breakpoint_added_no(1)
15
+ run_to_line(2)
16
+ send_next
17
+ assert_breakpoint(@test2_name, 4)
18
+ send_cont
19
+ end
20
+
21
+ def test_breakpoint_and_continue_from_other_file
22
+ create_test2 ["class Test2", "def print12", "puts 'one'","puts 'two'", "end", "end"]
23
+ create_socket ["require 'test2.rb'", "Test2.new.print12", "puts 'three'"]
24
+ send_test_breakpoint(2)
25
+ assert_breakpoint_added_no(1)
26
+ send_ruby("b #{@test2_name}:4")
27
+ assert_breakpoint_added_no(2)
28
+ start_debugger
29
+ assert_test_breakpoint(2)
30
+ send_next # test:1 -> test2:4
31
+ assert_breakpoint(@test2_name, 4)
32
+ send_cont # test2:4 -> test:3
33
+ end
34
+
35
+ end
36
+
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $:.unshift File.join(File.dirname(__FILE__), "..", "test-base")
4
+ $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
5
+
6
+ require 'test_base'
7
+
8
+ class RDTestBase < TestBase
9
+
10
+ def setup
11
+ super
12
+ @rdebug_ide = config_load('rdebug_ide', true) || find_rdebug_ide
13
+ unless @rdebug_ide and File.exist?(@rdebug_ide)
14
+ @fast_fail = true
15
+ assert_not_nil(@rdebug_ide, "Cannot find rdebug-ide executable. " +
16
+ "Neither set in the config(.private).yaml nor found on the PATH")
17
+ assert(false, "#{@rdebug_ide} exist")
18
+ end
19
+ end
20
+
21
+ def debug_command(script, port)
22
+ cmd = "#{interpreter}"
23
+ cmd << " --debug" if jruby?
24
+ cmd << " -J-Xdebug -J-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y" if jruby? and debug_jruby?
25
+ cmd << " -I '#{File.dirname(script)}' #{@rdebug_ide} _0.3.4_" +
26
+ (@verbose_server ? " -d" : "") +
27
+ " -p #{port} -- '#{script}'"
28
+ end
29
+
30
+ def start_debugger
31
+ send_ruby("start")
32
+ end
33
+
34
+ private
35
+
36
+ def find_rdebug_ide
37
+ ENV['PATH'].split(File::PATH_SEPARATOR).each do |dir|
38
+ rdebug_ide = File.join(dir, 'rdebug-ide')
39
+ return rdebug_ide if File.exists?(rdebug_ide)
40
+ end
41
+ nil
42
+ end
43
+
44
+ end
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rd_test_base'
4
+ require 'threads_and_frames_test'
5
+
6
+ class RDThreadsAndFrames < RDTestBase
7
+
8
+ include ThreadsAndFrames
9
+
10
+ end
11
+
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rd_test_base'
4
+ require 'variables_test'
5
+
6
+ class RDVariablesTest < RDTestBase
7
+
8
+ include VariablesTest
9
+
10
+ end
11
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-debug-ide
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Markus Barchfeld, Martin Krauskopf
@@ -9,7 +9,7 @@ autorequire: ruby-debug-base
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-12-19 00:00:00 +01:00
12
+ date: 2009-01-13 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -31,6 +31,11 @@ extensions: []
31
31
  extra_rdoc_files: []
32
32
 
33
33
  files:
34
+ - CHANGES
35
+ - ChangeLog
36
+ - ChangeLog.archive
37
+ - MIT-LICENSE
38
+ - Rakefile
34
39
  - bin/rdebug-ide
35
40
  - lib/ruby-debug
36
41
  - lib/ruby-debug/xml_printer.rb
@@ -54,6 +59,15 @@ files:
54
59
  - lib/ruby-debug/helper.rb
55
60
  - lib/ruby-debug/event_processor.rb
56
61
  - lib/ruby-debug.rb
62
+ - test/rd_basic_test.rb
63
+ - test/rd_test_base.rb
64
+ - test/rd_inspect_test.rb
65
+ - test/rd_catchpoint_test.rb
66
+ - test/rd_enable_disable_test.rb
67
+ - test/rd_threads_and_frames_test.rb
68
+ - test/rd_condition_test.rb
69
+ - test/rd_stepping_breakpoints_test.rb
70
+ - test/rd_variables_test.rb
57
71
  has_rdoc: false
58
72
  homepage: http://rubyforge.org/projects/debug-commons/
59
73
  post_install_message:
@@ -76,9 +90,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
76
90
  requirements: []
77
91
 
78
92
  rubyforge_project: debug-commons
79
- rubygems_version: 1.3.1.1939
93
+ rubygems_version: 1.3.1.1988
80
94
  signing_key:
81
- specification_version: 2
95
+ specification_version: 3
82
96
  summary: IDE interface for ruby-debug.
83
97
  test_files: []
84
98