Class: Rubinius::SetTrace::BreakPoint

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(descriptor, method, ip, line, event = 'line') ⇒ BreakPoint

Returns a new instance of BreakPoint.



10
11
12
13
14
15
16
17
18
19
20
# File 'app/breakpoint.rb', line 10

def initialize(descriptor, method, ip, line, event='line')
  @descriptor = descriptor
  @method = method
  @ip = ip
  @line = line
  @for_step = false
  @paired_bp = nil
  @temp = false
  @event = event
  @set = false
end

Instance Attribute Details

#descriptorObject (readonly)

Returns the value of attribute descriptor.



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

def descriptor
  @descriptor
end

#eventObject (readonly)

Returns the value of attribute event.



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

def event
  @event
end

#ipObject (readonly)

Returns the value of attribute ip.



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

def ip
  @ip
end

#lineObject (readonly)

Returns the value of attribute line.



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

def line
  @line
end

#methodObject (readonly)

Returns the value of attribute method.



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

def method
  @method
end

#paired_bpObject (readonly)

Returns the value of attribute paired_bp.



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

def paired_bp
  @paired_bp
end

Class Method Details

.for_ip(exec, ip, name = :anon, event = 'line') ⇒ Object



4
5
6
7
8
# File 'app/breakpoint.rb', line 4

def self.for_ip(exec, ip, name=:anon, event='line')
  line = exec.line_from_ip(ip)

  BreakPoint.new(name, exec, ip, line, event)
end

Instance Method Details

#activateObject



49
50
51
52
# File 'app/breakpoint.rb', line 49

def activate
  @set = true
  @method.set_breakpoint @ip, self
end

#delete!Object



75
76
77
# File 'app/breakpoint.rb', line 75

def delete!
  remove!
end

#describeObject



28
29
30
# File 'app/breakpoint.rb', line 28

def describe
  "#{descriptor} - #{vm_location}"
end

#for_step!(scope) ⇒ Object



32
33
34
35
# File 'app/breakpoint.rb', line 32

def for_step!(scope)
  @temp = true
  @for_step = scope
end

#for_step?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'app/breakpoint.rb', line 41

def for_step?
  @for_step
end

#hit!(loc) ⇒ Object



61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'app/breakpoint.rb', line 61

def hit!(loc)
  return true unless @temp

  if @for_step
    return false unless loc.variables == @for_step
  end

  remove!

  @paired_bp.remove! if @paired_bp

  return true
end

#paired_with(bp) ⇒ Object



45
46
47
# File 'app/breakpoint.rb', line 45

def paired_with(bp)
  @paired_bp = bp
end

#remove!Object



54
55
56
57
58
59
# File 'app/breakpoint.rb', line 54

def remove!
  return unless @set

  @set = false
  @method.clear_breakpoint(@ip)
end

#set_temp!Object



37
38
39
# File 'app/breakpoint.rb', line 37

def set_temp!
  @temp = true
end

#vm_locationObject



24
25
26
# File 'app/breakpoint.rb', line 24

def vm_location
  "#{@method.active_path}:#{@line} (+#{ip})"
end