ruby-debug-base 0.10.4 → 0.10.5.rc1

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.
data/AUTHORS CHANGED
@@ -1,7 +1,12 @@
1
1
  Author and maintainer:
2
2
  Kent Sibilev
3
3
 
4
+ JRuby Extension Authors:
5
+ Martin Krauskopf
6
+ Peter Brant
7
+
4
8
  Contributers:
5
9
  Markus Barchfeld
6
10
  R. Bernstein
7
11
  Anders Lindgren
12
+ Chris Nelson
data/CHANGES CHANGED
@@ -1,3 +1,20 @@
1
+ 0.10.5
2
+ 12/25/10
3
+ - Remove extraneous .RB files messing up Microsoft Windows
4
+ - Deprecate "set force". Use "set di[fferent].
5
+ - Moved to github.
6
+ - Merged JRuby extension.
7
+ - Moved ruby-debug-extra to a separate repository.
8
+ - JRuby: fixed race condition that was causing the debugger to hang:
9
+ http://youtrack.jetbrains.net/issue/RUBY-8123
10
+ https://github.com/ruby-debug/ruby-debug/issues/7
11
+ http://jira.codehaus.org/browse/JRUBY-6083
12
+ - JRuby: fixed stopping in wrong file with the same basename
13
+ - Use rake-compiler for building extensions
14
+ - Fix use of stale variables after restarting the debugger (#4)
15
+ - Use Travis for CI
16
+ - JRuby: Remove GPL'd linecache code (#3)
17
+
1
18
  0.10.4
2
19
  10/27/10
3
20
 
data/README CHANGED
@@ -112,3 +112,42 @@ your program can be minimized.
112
112
  == License
113
113
 
114
114
  See LICENSE for license information.
115
+
116
+
117
+
118
+ = ruby-debug-base for JRuby
119
+
120
+ == Overview
121
+
122
+ (j)ruby-debug-base provides the fast debugger extension for JRuby interpreter.
123
+ It is the same as ruby-debug-base native C extension from ruby-debug project
124
+ (http://rubyforge.org/projects/ruby-debug/), but for JRuby.
125
+
126
+ == Install
127
+
128
+ (j)ruby-debug-base is available as a RubyGem:
129
+
130
+ jruby -S gem install ruby-debug-base
131
+
132
+ == Usage
133
+
134
+ The usage is then the same as with native ruby-debugger, but you might need to
135
+ force JRuby which has to run in interpreted mode. Simplest usage is:
136
+
137
+ $ jruby --debug -S rdebug <your-script>
138
+
139
+ Or easier, you might create 'jruby-dm' ('dm' for 'debugger-mode'):
140
+
141
+ $ cat ~/bin/jruby-dm
142
+ #!/bin/bash
143
+ jruby --debug "$@"
144
+
145
+ Then you may run just as you used to:
146
+
147
+ $ jruby-dm -S rdebug <your-script>
148
+
149
+ For more information see: http://bashdb.sourceforge.net/ruby-debug.html
150
+
151
+ == License
152
+
153
+ See MIT-LICENSE for license information.
data/Rakefile CHANGED
@@ -1,34 +1,17 @@
1
1
  #!/usr/bin/env rake
2
2
  # -*- Ruby -*-
3
3
  require 'rubygems'
4
- require 'rake/gempackagetask'
5
- require 'rake/rdoctask'
4
+ require 'rubygems/package_task'
5
+ require 'rdoc/task'
6
6
  require 'rake/testtask'
7
+ require 'rake/extensiontask'
8
+ require 'rake/javaextensiontask'
9
+
10
+ $:.push File.expand_path("../lib", __FILE__)
11
+ require "ruby-debug-base/version"
7
12
 
8
13
  SO_NAME = "ruby_debug.so"
9
14
  ROOT_DIR = File.dirname(__FILE__)
10
- VERSION_FILE = ROOT_DIR + '/VERSION'
11
-
12
- def make_version_file
13
- ruby_debug_version = open("ext/ruby_debug.c").
14
- grep(/^#define DEBUG_VERSION/).first[/"(.+)"/,1]
15
- File.open(VERSION_FILE, 'w') do |f|
16
- f.write(
17
- "# This file was created automatically from data in ext/ruby_debug.c via:
18
- # rake :make_version_file.
19
- #{ruby_debug_version}
20
- ")
21
- end
22
- end
23
-
24
- make_version_file unless File.exist?(VERSION_FILE)
25
- ruby_debug_version = nil
26
- open(VERSION_FILE).each do |line|
27
- next if line =~ /^#/
28
- ruby_debug_version = line.chomp
29
- break
30
- end
31
-
32
15
 
33
16
  # ------- Default Package ----------
34
17
  COMMON_FILES = FileList[
@@ -36,7 +19,6 @@ COMMON_FILES = FileList[
36
19
  'CHANGES',
37
20
  'LICENSE',
38
21
  'README',
39
- 'VERSION',
40
22
  'Rakefile',
41
23
  ]
42
24
 
@@ -52,19 +34,14 @@ CLI_FILES = COMMON_FILES + FileList[
52
34
  'test/rdebug-save.1',
53
35
  'test/**/data/*.cmd',
54
36
  'test/**/data/*.right',
37
+ 'test/**/example/*.rb',
55
38
  'test/config.yaml',
56
39
  'test/**/*.rb',
57
40
  'rdbg.rb',
58
- 'runner.sh',
59
41
  CLI_TEST_FILE_LIST
60
42
  ]
61
43
 
62
- BASE_TEST_FILE_LIST = %w(
63
- test/base/base.rb
64
- test/base/binding.rb
65
- test/base/catchpoint.rb
66
- test/base/reload_bug.rb
67
- )
44
+ BASE_TEST_FILE_LIST = FileList['test/base/*.rb']
68
45
 
69
46
  BASE_FILES = COMMON_FILES + FileList[
70
47
  'ext/breakpoint.c',
@@ -72,54 +49,46 @@ BASE_FILES = COMMON_FILES + FileList[
72
49
  'ext/ruby_debug.c',
73
50
  'ext/ruby_debug.h',
74
51
  'ext/win32/*',
75
- 'lib/**/*',
52
+ 'lib/ruby-debug-base.rb',
53
+ 'lib/ruby-debug-base/version.rb',
76
54
  BASE_TEST_FILE_LIST,
77
55
  ]
78
56
 
79
- desc "Test everything."
80
57
  ext = File.join(ROOT_DIR, 'ext')
81
- test_and_args = File.exist?(ext) ? {:test => :test_base} : [:test]
82
- task test_and_args do
83
- Rake::TestTask.new(:test) do |t|
84
- t.libs += %W(#{ROOT_DIR}/lib #{ROOT_DIR}/cli)
85
- t.libs << ext if File.exist?(ext)
86
- t.test_files = CLI_TEST_FILE_LIST
87
- t.verbose = true
88
- end
89
- end
90
58
 
91
- desc "Test ruby-debug-base."
92
- task :test_base => :lib do
93
- Rake::TestTask.new(:test_base) do |t|
94
- t.libs += ['./ext', './lib']
95
- t.test_files = FileList[BASE_TEST_FILE_LIST]
96
- t.verbose = true
97
- end
59
+ desc "Test everything."
60
+ Rake::TestTask.new(:test) do |t|
61
+ t.libs += %W(#{ROOT_DIR}/lib #{ROOT_DIR}/cli)
62
+ t.libs << ext if File.exist?(ext)
63
+ t.test_files = CLI_TEST_FILE_LIST
64
+ t.options = '--verbose' if $VERBOSE
65
+ t.ruby_opts << "--debug" if defined?(JRUBY_VERSION)
98
66
  end
99
67
 
100
- desc "Test everything - same as test."
101
- task :check => :test
68
+ task :test => :test_base if File.exist?(ext)
102
69
 
103
- desc "Create the core ruby-debug shared library extension"
104
- task :lib do
105
- Dir.chdir("ext") do
106
- system("#{Gem.ruby} extconf.rb && make")
107
- end
70
+ desc "Test ruby-debug-base."
71
+ Rake::TestTask.new(:test_base) do |t|
72
+ t.libs += ['./ext', './lib']
73
+ t.test_files = FileList[BASE_TEST_FILE_LIST]
74
+ t.options = '--verbose' if $VERBOSE
75
+ t.ruby_opts << "--debug" if defined?(JRUBY_VERSION)
108
76
  end
109
77
 
110
- desc "Compile Emacs code"
111
- task :emacs => "emacs/rdebug.elc"
112
- file "emacs/rdebug.elc" => ["emacs/elisp-comp", "emacs/rdebug.el"] do
113
- Dir.chdir("emacs") do
114
- system("./elisp-comp ./rdebug.el")
115
- end
78
+ if defined?(JRUBY_VERSION)
79
+ task :test_base => 'jruby:compile:java'
80
+ else
81
+ task :test_base => :compile
116
82
  end
117
83
 
84
+ desc "Test everything - same as test."
85
+ task :check => :test
86
+
118
87
  desc "Create a GNU-style ChangeLog via svn2cl"
119
88
  task :ChangeLog do
120
- system('svn2cl --authors=svn2cl_usermap http://ruby-debug.rubyforge.org/svn/trunk')
121
- system("svn2cl --authors=svn2cl_usermap http://ruby-debug.rubyforge.org/svn/trunk/ext -o ext/ChangeLog")
122
- system("svn2cl --authors=svn2cl_usermap http://ruby-debug.rubyforge.org/svn/trunk/lib -o lib/ChangeLog")
89
+ system('git log --pretty --numstat --summary | git2cl > ChangeLog')
90
+ system('git log --pretty --numstat --summary ext | git2cl > ext/ChangeLog')
91
+ system('git log --pretty --numstat --summary lib | git2cl > lib/ChangeLog')
123
92
  end
124
93
 
125
94
  # Base GEM Specification
@@ -135,7 +104,7 @@ provides support that front-ends can build on. It provides breakpoint
135
104
  handling, bindings for stack frames among other things.
136
105
  EOF
137
106
 
138
- spec.version = ruby_debug_version
107
+ spec.version = Debugger::VERSION
139
108
 
140
109
  spec.author = "Kent Sibilev"
141
110
  spec.email = "ksibilev@yahoo.com"
@@ -148,7 +117,8 @@ EOF
148
117
  spec.date = Time.now
149
118
  spec.rubyforge_project = 'ruby-debug'
150
119
  spec.add_dependency('linecache', '>= 0.3')
151
-
120
+ spec.add_development_dependency('rake-compiler')
121
+
152
122
  spec.test_files = FileList[BASE_TEST_FILE_LIST]
153
123
 
154
124
  # rdoc
@@ -165,7 +135,7 @@ cli_spec = Gem::Specification.new do |spec|
165
135
  A generic command line interface for ruby-debug.
166
136
  EOF
167
137
 
168
- spec.version = ruby_debug_version
138
+ spec.version = Debugger::VERSION
169
139
 
170
140
  spec.author = "Kent Sibilev"
171
141
  spec.email = "ksibilev@yahoo.com"
@@ -179,7 +149,7 @@ EOF
179
149
  spec.date = Time.now
180
150
  spec.rubyforge_project = 'ruby-debug'
181
151
  spec.add_dependency('columnize', '>= 0.1')
182
- spec.add_dependency('ruby-debug-base', "~> #{ruby_debug_version}.0")
152
+ spec.add_dependency('ruby-debug-base', "~> #{Debugger::VERSION}.0")
183
153
 
184
154
  # FIXME: work out operational logistics for this
185
155
  # spec.test_files = FileList[CLI_TEST_FILE_LIST]
@@ -190,14 +160,18 @@ EOF
190
160
  end
191
161
 
192
162
  # Rake task to build the default package
193
- Rake::GemPackageTask.new(base_spec) do |pkg|
163
+ Gem::PackageTask.new(base_spec) do |pkg|
194
164
  pkg.need_tar = true
195
165
  end
196
- Rake::GemPackageTask.new(cli_spec) do |pkg|
166
+ Gem::PackageTask.new(cli_spec) do |pkg|
197
167
  pkg.need_tar = true
198
168
  end
199
169
 
200
- task :default => [:package]
170
+ Rake::ExtensionTask.new('ruby_debug', base_spec) do |t|
171
+ t.ext_dir = "ext"
172
+ end
173
+
174
+ task :default => :test
201
175
 
202
176
  # Windows specification
203
177
  win_spec = base_spec.clone
@@ -244,11 +218,12 @@ task :clean do
244
218
  derived_files = Dir.glob(".o") + Dir.glob("*.so")
245
219
  rm derived_files unless derived_files.empty?
246
220
  end
221
+ rm 'lib/ruby_debug.jar' if File.exists?("lib/ruby_debug.jar")
247
222
  end
248
223
 
249
224
  # --------- RDoc Documentation ------
250
225
  desc "Generate rdoc documentation"
251
- Rake::RDocTask.new("rdoc") do |rdoc|
226
+ RDoc::Task.new("rdoc") do |rdoc|
252
227
  rdoc.rdoc_dir = 'doc/rdoc'
253
228
  rdoc.title = "ruby-debug"
254
229
  # Show source inline with line numbers
@@ -284,9 +259,9 @@ task :rubyforge_upload do
284
259
  end
285
260
  end
286
261
 
287
- def install(spec, *opts)
262
+ def install_gem(spec, *opts)
288
263
  args = ['gem', 'install', "pkg/#{spec.name}-#{spec.version}.gem"] + opts
289
- args.unshift 'sudo' unless 0 == Process.uid
264
+ args.unshift 'sudo' unless 0 == Process.uid || ENV['rvm_path']
290
265
  system(*args)
291
266
  end
292
267
 
@@ -294,18 +269,28 @@ desc 'Install locally'
294
269
  task :install => :package do
295
270
  Dir.chdir(File::dirname(__FILE__)) do
296
271
  # ri and rdoc take lots of time
297
- install(base_spec, '--no-ri', '--no-rdoc')
298
- install(cli_spec, '--no-ri', '--no-rdoc')
272
+ install_gem(base_spec, '--no-ri', '--no-rdoc')
273
+ install_gem(cli_spec, '--no-ri', '--no-rdoc')
299
274
  end
300
275
  end
301
276
 
302
277
  task :install_full => :package do
303
278
  Dir.chdir(File::dirname(__FILE__)) do
304
- install(base_spec)
305
- install(cli_spec)
279
+ install_gem(base_spec)
280
+ install_gem(cli_spec)
306
281
  end
307
282
  end
308
283
 
309
- task :make_version_file do
310
- make_version_file
284
+ namespace :jruby do
285
+ jruby_spec = base_spec.clone
286
+ jruby_spec.platform = "java"
287
+ jruby_spec.files = jruby_spec.files.reject {|f| f =~ /^ext/ }
288
+ jruby_spec.files += ['lib/ruby_debug.jar']
289
+ jruby_spec.extensions = []
290
+
291
+ Gem::PackageTask.new(jruby_spec) {}
292
+
293
+ Rake::JavaExtensionTask.new('ruby_debug') do |t|
294
+ t.ext_dir = "src"
295
+ end
311
296
  end
@@ -1,20 +1,23 @@
1
1
  require "mkmf"
2
2
 
3
3
  if RUBY_VERSION >= "1.9"
4
- if RUBY_RELEASE_DATE < "2005-03-17"
5
- STDERR.print("Ruby version is too old\n")
6
- exit(1)
7
- end
4
+ STDERR.print("Ruby version #{RUBY_VERSION} is too new\n")
5
+ exit(1)
8
6
  elsif RUBY_VERSION >= "1.8"
9
7
  if RUBY_RELEASE_DATE < "2005-03-22"
10
- STDERR.print("Ruby version is too old\n")
8
+ STDERR.print("Ruby release date #{RUBY_RELEASE_DATE} is too old\n")
11
9
  exit(1)
12
10
  end
13
11
  else
14
- STDERR.print("Ruby version is too old\n")
12
+ STDERR.print("Ruby version is not compatible for this version.\n")
15
13
  exit(1)
16
14
  end
17
15
 
18
- # Temporary: to turn off optimization
19
- # $CFLAGS='-fno-strict-aliasing -g -fPIC'
16
+ # Allow use customization of compile options. For example, the
17
+ # following lines could be put in config_options to to turn off
18
+ # optimization:
19
+ # $CFLAGS='-fPIC -fno-strict-aliasing -g3 -ggdb -O2 -fPIC'
20
+ config_file = File.join(File.dirname(__FILE__), 'config_options.rb')
21
+ load config_file if File.exist?(config_file)
22
+
20
23
  create_makefile("ruby_debug")
@@ -6,8 +6,6 @@
6
6
  #include <st.h>
7
7
  #include <intern.h>
8
8
 
9
- #define DEBUG_VERSION "0.10.4"
10
-
11
9
  #ifdef _WIN32
12
10
  struct FRAME {
13
11
  VALUE self;
@@ -1061,6 +1059,9 @@ debug_stop(VALUE self)
1061
1059
  locker = Qnil;
1062
1060
  rdebug_breakpoints = Qnil;
1063
1061
  rdebug_threads_tbl = Qnil;
1062
+ last_thread = Qnil;
1063
+ last_context = Qnil;
1064
+ last_debug_context = NULL;
1064
1065
 
1065
1066
  return Qtrue;
1066
1067
  }
@@ -1415,15 +1416,12 @@ debug_debug_load(int argc, VALUE *argv, VALUE self)
1415
1416
  return errinfo;
1416
1417
  }
1417
1418
 
1418
- /* We should run all at_exit handler's in order to provide,
1419
- * for instance, a chance to run all defined test cases */
1420
- rb_exec_end_proc();
1421
-
1422
- /* We could have issued a Debugger.stop inside the debug
1423
- session. */
1424
- if (start_count > 0) {
1425
- debug_stop(self);
1426
- }
1419
+ /* We don't want to stop the debugger yet, because the
1420
+ * user may have set breakpoints in at_exit blocks that
1421
+ * should be hit. But we don't want to step out into debugger
1422
+ * code either, so we reset stepping stop points here.
1423
+ */
1424
+ reset_stepping_stop_points(debug_context);
1427
1425
 
1428
1426
  return Qnil;
1429
1427
  }
@@ -2262,7 +2260,6 @@ void
2262
2260
  Init_ruby_debug()
2263
2261
  {
2264
2262
  mDebugger = rb_define_module("Debugger");
2265
- rb_define_const(mDebugger, "VERSION", rb_str_new2(DEBUG_VERSION));
2266
2263
  rb_define_module_function(mDebugger, "start_", debug_start, 0);
2267
2264
  rb_define_module_function(mDebugger, "stop", debug_stop, 0);
2268
2265
  rb_define_module_function(mDebugger, "started?", debug_is_started, 0);
@@ -1,5 +1,5 @@
1
- require 'ruby_debug.so'
2
- require 'rubygems'
1
+ require 'ruby_debug'
2
+ require 'ruby-debug-base/version'
3
3
  require 'linecache'
4
4
 
5
5
  module Debugger
@@ -0,0 +1,3 @@
1
+ module Debugger
2
+ VERSION = "0.10.5.rc1"
3
+ end
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env ruby
2
- require 'test/unit'
2
+ require File.expand_path("../../helper", __FILE__)
3
3
 
4
4
  # Some tests of Debugger module in C extension ruby_debug
5
5
  class TestRubyDebug < Test::Unit::TestCase
6
- $:.unshift File.join(File.dirname(__FILE__), '..', '..', 'ext')
7
- require 'ruby_debug'
8
- $:.shift
6
+ def test_version
7
+ assert(defined?(Debugger::VERSION))
8
+ end
9
9
 
10
10
  # test current_context
11
11
  def test_current_context
@@ -26,6 +26,7 @@ class TestRubyDebug < Test::Unit::TestCase
26
26
  assert_equal(1, Debugger.current_context.stack_size)
27
27
  assert_equal(TestRubyDebug, Debugger.current_context.frame_class)
28
28
  assert_equal(false, Debugger.current_context.dead?, 'Not dead yet!')
29
+ ensure
29
30
  Debugger.stop
30
31
  assert_equal(false, Debugger.started?,
31
32
  'Debugger should no longer be started.')
@@ -47,6 +48,7 @@ class TestRubyDebug < Test::Unit::TestCase
47
48
  'There should only be one context.')
48
49
  assert_equal(Array, a.class,
49
50
  'Context should be an array.')
51
+ ensure
50
52
  Debugger.stop
51
53
  assert_equal(false, Debugger.started?,
52
54
  'debugger should no longer be started.')
@@ -68,6 +70,7 @@ class TestRubyDebug < Test::Unit::TestCase
68
70
  Debugger.remove_breakpoint(1)
69
71
  assert_equal(0, Debugger.breakpoints.size,
70
72
  'There should no longer be any breakpoints set.')
73
+ ensure
71
74
  Debugger.stop
72
75
  end
73
76
  end