ruby-debug 0.1.2

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.
Files changed (9) hide show
  1. data/CHANGES +4 -0
  2. data/LICENSE +23 -0
  3. data/README +63 -0
  4. data/Rakefile +70 -0
  5. data/bin/rdebug +13 -0
  6. data/ext/extconf.rb +18 -0
  7. data/ext/ruby_debug.c +922 -0
  8. data/lib/ruby-debug.rb +610 -0
  9. metadata +53 -0
data/CHANGES ADDED
@@ -0,0 +1,4 @@
1
+ 0.1 (2006-06-16)
2
+ ========================
3
+
4
+ Initial release.
data/LICENSE ADDED
@@ -0,0 +1,23 @@
1
+ Copyright (C) 2005 Kent Sibilev <ksibilev@yahoo.com>
2
+ All rights reserved.
3
+ *
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions
6
+ are met:
7
+ 1. Redistributions of source code must retain the above copyright
8
+ notice, this list of conditions and the following disclaimer.
9
+ 2. Redistributions in binary form must reproduce the above copyright
10
+ notice, this list of conditions and the following disclaimer in the
11
+ documentation and/or other materials provided with the distribution.
12
+ *
13
+ THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
14
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16
+ ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
17
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19
+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22
+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23
+ SUCH DAMAGE.
data/README ADDED
@@ -0,0 +1,63 @@
1
+ = ruby-debug
2
+
3
+ == Overview
4
+
5
+ ruby-debug is a fast implementation of the standard debugger debug.rb.
6
+ The faster execution speed is achieved by utilizing a new hook Ruby C API.
7
+
8
+ == Requirements
9
+
10
+ ruby-debug requires Ruby 1.8.4 or higher.
11
+
12
+ If you are running Linux or Unix you'll need a C compiler so the extension
13
+ can be compiled when it is installed.
14
+
15
+
16
+ == Install
17
+
18
+ ruby-debug is provided as a RubyGem. To install:
19
+
20
+ <tt>gem install ruby-debug</tt>
21
+
22
+ == Usage
23
+
24
+ There are two ways of running ruby-debug.
25
+
26
+ === rdebug executable:
27
+
28
+ $ rdebug <your-script>
29
+
30
+ When you start your script this way, the debugger will stop at
31
+ the first line of code in the script file. So you will be able
32
+ to set up your breakpoints.
33
+
34
+ === ruby-debug API
35
+
36
+ The second way is to use the ruby-debug API to interrupt your
37
+ code execution at runtime.
38
+
39
+ require 'ruby-debug'
40
+ ...
41
+ def your_method
42
+ ...
43
+ debugger
44
+ ...
45
+ end
46
+
47
+ When Kernel#debugger method is executed, the debugger is activated
48
+ and you will be able to inspect and step through your code.
49
+
50
+ == Performance
51
+
52
+ The debug.rb script that comes with the standard library uses
53
+ Kernel#set_trace_func API. This way it is possible to implement
54
+ the debugger in pure Ruby, but has a negative effect on the speed
55
+ of your program execution. For each trace call Ruby interpreter
56
+ creates a Binding object, even though it is not being used most
57
+ of the time. ruby-debug library moves most of the functionality
58
+ of debug.rb to a native extension, this way significantly improving
59
+ the execution of your program.
60
+
61
+ == License
62
+
63
+ See LICENSE for license information.
data/Rakefile ADDED
@@ -0,0 +1,70 @@
1
+ require 'rubygems'
2
+ require 'rake/gempackagetask'
3
+ require 'rake/rdoctask'
4
+
5
+ SO_NAME = "ruby_debug.so"
6
+
7
+ # ------- Default Package ----------
8
+ RUBY_DEBUG_VERSION = "0.1.2"
9
+
10
+ FILES = FileList[
11
+ 'Rakefile',
12
+ 'README',
13
+ 'LICENSE',
14
+ 'CHANGES',
15
+ 'lib/**/*',
16
+ 'ext/*',
17
+ 'bin/*'
18
+ ]
19
+
20
+ # Default GEM Specification
21
+ default_spec = Gem::Specification.new do |spec|
22
+ spec.name = "ruby-debug"
23
+
24
+ spec.homepage = "http://rubyforge.org/projects/ruby-debug/"
25
+ spec.summary = "Fast Ruby debugger"
26
+ spec.description = <<-EOF
27
+ ruby-debug is a fast implementation of the standard Ruby debugger debug.rb.
28
+ It's implemented by utilizing a new hook Ruby C API.
29
+ EOF
30
+
31
+ spec.version = RUBY_DEBUG_VERSION
32
+
33
+ spec.author = "Kent Sibilev"
34
+ spec.email = "ksibilev@yahoo.com"
35
+ spec.platform = Gem::Platform::RUBY
36
+ spec.require_path = "lib"
37
+ spec.bindir = "bin"
38
+ spec.executables = ["rdebug"]
39
+ spec.extensions = ["ext/extconf.rb"]
40
+ spec.autorequire = "ruby-debug"
41
+ spec.files = FILES.to_a
42
+
43
+ spec.required_ruby_version = '>= 1.8.2'
44
+ spec.date = DateTime.now
45
+ spec.rubyforge_project = 'ruby-debug'
46
+
47
+ # rdoc
48
+ spec.has_rdoc = false
49
+ end
50
+
51
+
52
+ # Rake task to build the default package
53
+ Rake::GemPackageTask.new(default_spec) do |pkg|
54
+ pkg.need_tar = true
55
+ pkg.need_tar = true
56
+ end
57
+
58
+ task :default => :package
59
+
60
+ # --------- Publish to RubyForge ----------------
61
+ desc "Publish ruby-debug to RubyForge."
62
+ task :publish do
63
+ require 'rake/contrib/sshpublisher'
64
+
65
+ # Get ruby-debug path
66
+ ruby_debug_path = File.expand_path(File.dirname(__FILE__))
67
+
68
+ publisher = Rake::SshDirPublisher.new("kent@rubyforge.org",
69
+ "/var/www/gforge-projects/ruby-debug", ruby_debug_path)
70
+ end
data/bin/rdebug ADDED
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ if ARGV.empty?
4
+ puts "Usage: #{__FILE__} <script>"
5
+ exit(1)
6
+ end
7
+
8
+ require 'rubygems'
9
+ require 'ruby-debug'
10
+ trap('INT') { Debugger.interrupt_last }
11
+
12
+ debugger 2
13
+ load ARGV.shift
data/ext/extconf.rb ADDED
@@ -0,0 +1,18 @@
1
+ require "mkmf"
2
+
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
8
+ elsif RUBY_VERSION >= "1.8"
9
+ if RUBY_RELEASE_DATE < "2005-03-22"
10
+ STDERR.print("Ruby version is too old\n")
11
+ exit(1)
12
+ end
13
+ else
14
+ STDERR.print("Ruby version is too old\n")
15
+ exit(1)
16
+ end
17
+
18
+ create_makefile("ruby_debug")