rubinius-debugger 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,27 @@
1
+ class Rubinius::Debugger
2
+ module Display
3
+ def info(str)
4
+ puts "| #{str}"
5
+ end
6
+
7
+ def display(str)
8
+ puts "=> #{str}"
9
+ end
10
+
11
+ def crit(str)
12
+ puts "[CRITICAL] #{str}"
13
+ end
14
+
15
+ def error(str)
16
+ puts "* #{str}"
17
+ end
18
+
19
+ def section(str)
20
+ puts "==== #{str} ===="
21
+ end
22
+
23
+ def ask(str)
24
+ Readline.readline("| #{str}")
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,78 @@
1
+ class Rubinius::Debugger
2
+ class Frame
3
+ def initialize(debugger, number, loc)
4
+ @debugger = debugger
5
+ @number = number
6
+ @location = loc
7
+ end
8
+
9
+ attr_reader :number, :location
10
+
11
+ def run(code)
12
+ eval(code, binding)
13
+ end
14
+
15
+ def binding
16
+ @binding ||= Binding.setup(
17
+ @location.variables,
18
+ @location.method,
19
+ @location.constant_scope)
20
+ end
21
+
22
+ def method
23
+ @location.method
24
+ end
25
+
26
+ def line
27
+ @location.line
28
+ end
29
+
30
+ def ip
31
+ @location.ip
32
+ end
33
+
34
+ def variables
35
+ @location.variables
36
+ end
37
+
38
+ def local_variables
39
+ method.local_names
40
+ end
41
+
42
+ def describe
43
+ if method.required_args > 0
44
+ locals = []
45
+ 0.upto(method.required_args-1) do |arg|
46
+ locals << method.local_names[arg].to_s
47
+ end
48
+
49
+ arg_str = locals.join(", ")
50
+ else
51
+ arg_str = ""
52
+ end
53
+
54
+ loc = @location
55
+
56
+ if loc.is_block
57
+ if arg_str.empty?
58
+ recv = "{ } in #{loc.describe_receiver}#{loc.name}"
59
+ else
60
+ recv = "{|#{arg_str}| } in #{loc.describe_receiver}#{loc.name}"
61
+ end
62
+ else
63
+ if arg_str.empty?
64
+ recv = loc.describe
65
+ else
66
+ recv = "#{loc.describe}(#{arg_str})"
67
+ end
68
+ end
69
+
70
+ str = "#{recv} at #{loc.method.active_path}:#{loc.line} (#{loc.ip})"
71
+ if @debugger.variables[:show_ip]
72
+ str << " (+#{loc.ip})"
73
+ end
74
+
75
+ str
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,5 @@
1
+ module Rubinius
2
+ module Debugger
3
+ VERSION = "2.0.0"
4
+ end
5
+ end
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ require './lib/rubinius/debugger/version'
3
+
4
+ Gem::Specification.new do |spec|
5
+ spec.name = "rubinius-debugger"
6
+ spec.version = Rubinius::Debugger::VERSION
7
+ spec.authors = ["Brian Shirai"]
8
+ spec.email = ["brixen@gmail.com"]
9
+ spec.description = %q{Rubinius debugger.}
10
+ spec.summary = %q{Rubinius debugger.}
11
+ spec.homepage = "https://github.com/rubinius/rubinius-debugger"
12
+ spec.license = "BSD"
13
+
14
+ spec.files = `git ls-files`.split($/)
15
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
16
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
17
+ spec.require_paths = ["lib"]
18
+
19
+ spec.required_ruby_version = "~> 2.0"
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ end
metadata ADDED
@@ -0,0 +1,85 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rubinius-debugger
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Brian Shirai
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-09-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description: Rubinius debugger.
42
+ email:
43
+ - brixen@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - .gitignore
49
+ - Gemfile
50
+ - LICENSE
51
+ - README.md
52
+ - Rakefile
53
+ - lib/rubinius/debugger.rb
54
+ - lib/rubinius/debugger/breakpoint.rb
55
+ - lib/rubinius/debugger/commands.rb
56
+ - lib/rubinius/debugger/display.rb
57
+ - lib/rubinius/debugger/frame.rb
58
+ - lib/rubinius/debugger/version.rb
59
+ - rubinius-debugger.gemspec
60
+ homepage: https://github.com/rubinius/rubinius-debugger
61
+ licenses:
62
+ - BSD
63
+ metadata: {}
64
+ post_install_message:
65
+ rdoc_options: []
66
+ require_paths:
67
+ - lib
68
+ required_ruby_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - ~>
71
+ - !ruby/object:Gem::Version
72
+ version: '2.0'
73
+ required_rubygems_version: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ requirements: []
79
+ rubyforge_project:
80
+ rubygems_version: 2.0.7
81
+ signing_key:
82
+ specification_version: 4
83
+ summary: Rubinius debugger.
84
+ test_files: []
85
+ has_rdoc: