Class: Rubinius::SetTrace::Frame

Inherits:
Object
  • Object
show all
Defined in:
app/frame.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(debugger, number, vm_location) ⇒ Frame

Returns a new instance of Frame.



3
4
5
6
7
# File 'app/frame.rb', line 3

def initialize(debugger, number, vm_location)
  @debugger = debugger
  @number = number
  @vm_location = vm_location
end

Instance Attribute Details

#numberObject (readonly)

Returns the value of attribute number.



9
10
11
# File 'app/frame.rb', line 9

def number
  @number
end

#vm_locationObject (readonly)

Returns the value of attribute vm_location.



9
10
11
# File 'app/frame.rb', line 9

def vm_location
  @vm_location
end

Instance Method Details

#bindingObject



15
16
17
18
19
20
# File 'app/frame.rb', line 15

def binding
  @binding ||= Binding.setup(
                             @vm_location.variables,
                             @vm_location.method,
                             @vm_location.static_scope)
end

#describeObject



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'app/frame.rb', line 46

def describe
  if method.required_args > 0
    locals = []
    0.upto(method.required_args-1) do |arg|
      locals << method.local_names[arg].to_s
    end

    arg_str = locals.join(", ")
  else
    arg_str = ""
  end

  context = @vm_location

  if loc.is_block
    if arg_str.empty?
      recv = "{ } in #{context.describe_receiver}#{context.name}"
    else
      recv = "{|#{arg_str}| } in #{context.describe_receiver}#{context.name}"
    end
  else
    if arg_str.empty?
      recv = loc.describe
    else
      recv = "#{context.describe}(#{arg_str})"
    end
  end

  str = "#{recv} at #{context.method.active_path}:#{context.line} (@#{context.ip})"
end

#fileObject



30
31
32
# File 'app/frame.rb', line 30

def file
  @vm_location.file
end

#ipObject



34
35
36
# File 'app/frame.rb', line 34

def ip
  @vm_location.ip
end

#lineObject



26
27
28
# File 'app/frame.rb', line 26

def line
  @vm_location.line
end

#local_variablesObject



42
43
44
# File 'app/frame.rb', line 42

def local_variables
  method.local_names
end

#methodObject



22
23
24
# File 'app/frame.rb', line 22

def method
  @vm_location.method
end

#run(code) ⇒ Object



11
12
13
# File 'app/frame.rb', line 11

def run(code)
  eval(code, binding)
end

#variablesObject



38
39
40
# File 'app/frame.rb', line 38

def variables
  @vm_location.variables
end