Permalink
Browse files

Rewire debugger infrastructure, add new simple debugger.

  • Loading branch information...
1 parent 7cff50f commit 6035068e5839c19c627fef8638ba5f86db4a9186 Evan Phoenix committed May 20, 2010
View
@@ -1,7 +1,9 @@
class Rubinius::VM
- def self.backtrace(frames_to_skip)
+ def self.backtrace(frames_to_skip, include_vars=false)
Ruby.primitive :vm_backtrace
- raise PrimitiveFailure, "Unable to create backtrace!"
+
+ # Add the + 1 to skip this frame
+ backtrace(Integer(frames_to_skip) + 1, include_vars)
end
def self.stats
@@ -144,7 +144,7 @@ def activate(recv, mod, args, locals = nil, &prc)
#
# @raise [ArgumentError]
# @param [Fixnum] ip where exactly to place the breakpoint
- def set_breakpoint(ip)
+ def set_breakpoint(ip, obj)
Ruby.primitive :compiledmethod_set_breakpoint
raise ArgumentError, "Unable to set breakpoint on #{inspect} at invalid bytecode address #{ip}"
end
View
@@ -6,6 +6,10 @@ class Location
attr_accessor :method
attr_accessor :name
+ attr_reader :ip
+ attr_reader :variables
+ attr_reader :static_scope
+
def inlined?
@name.nil?
end
@@ -46,11 +50,9 @@ def describe_method
# Current line being executed by the VM.
def line
return 0 unless @method
- # We subtract 1 because the ip is actually set to what it should do
- # next, not what it's currently doing (unless we are at the start of
- # a new context).
- ip = @ip - 1
+ ip = @ip
ip = 0 if @ip < 0
+
@method.line_from_ip(ip)
end
@@ -81,7 +83,7 @@ def position(relative_to=nil)
l = line()
if l == 0
- "#{file(relative_to)}+#{@ip-1}"
+ "#{file(relative_to)}+#{@ip}"
else
"#{file(relative_to)}:#{l}"
end
View
@@ -256,7 +256,17 @@ def debug_channel
raise "nope!"
end
- attr_reader :control_channel
+ def set_debugger_thread(thr)
+ raise TypeError, "Must be another Thread" unless thr.kind_of?(Thread)
+
+ @debugger_thread = thr
+ end
+
+ def setup_control!(chan=nil)
+ chan ||= Rubinius::Channel.new
+ @control_channel = chan
+ return chan
+ end
def self.main
@main_thread
Oops, something went wrong.

0 comments on commit 6035068

Please sign in to comment.