Class: Rubinius::Debugger::BreakPoint

Inherits:
Object
  • Object
show all
Defined in:
lib/rubinius/debugger/breakpoint.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(descriptor, method, ip, line, condition = nil) ⇒ BreakPoint

Returns a new instance of BreakPoint.



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/rubinius/debugger/breakpoint.rb', line 10

def initialize(descriptor, method, ip, line, condition=nil)
  @descriptor = descriptor
  @method = method
  @ip = ip
  @line = line
  @for_step = false
  @paired_bp = nil
  @temp = false
  @commands = nil
  @condition = condition

  @set = false
end

Instance Attribute Details

#commandsObject (readonly)

Returns the value of attribute commands.



24
25
26
# File 'lib/rubinius/debugger/breakpoint.rb', line 24

def commands
  @commands
end

#conditionObject (readonly)

Returns the value of attribute condition.



24
25
26
# File 'lib/rubinius/debugger/breakpoint.rb', line 24

def condition
  @condition
end

#descriptorObject (readonly)

Returns the value of attribute descriptor.



24
25
26
# File 'lib/rubinius/debugger/breakpoint.rb', line 24

def descriptor
  @descriptor
end

#ipObject (readonly)

Returns the value of attribute ip.



24
25
26
# File 'lib/rubinius/debugger/breakpoint.rb', line 24

def ip
  @ip
end

#lineObject (readonly)

Returns the value of attribute line.



24
25
26
# File 'lib/rubinius/debugger/breakpoint.rb', line 24

def line
  @line
end

#methodObject (readonly)

Returns the value of attribute method.



24
25
26
# File 'lib/rubinius/debugger/breakpoint.rb', line 24

def method
  @method
end

#paired_bpObject (readonly)

Returns the value of attribute paired_bp.



24
25
26
# File 'lib/rubinius/debugger/breakpoint.rb', line 24

def paired_bp
  @paired_bp
end

Class Method Details

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



4
5
6
7
8
# File 'lib/rubinius/debugger/breakpoint.rb', line 4

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

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

Instance Method Details

#activateObject



51
52
53
54
# File 'lib/rubinius/debugger/breakpoint.rb', line 51

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

#delete!Object



77
78
79
# File 'lib/rubinius/debugger/breakpoint.rb', line 77

def delete!
  remove!
end

#describeObject



30
31
32
# File 'lib/rubinius/debugger/breakpoint.rb', line 30

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

#for_step!(scope) ⇒ Object



34
35
36
37
# File 'lib/rubinius/debugger/breakpoint.rb', line 34

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

#for_step?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/rubinius/debugger/breakpoint.rb', line 43

def for_step?
  @for_step
end

#has_commands?Boolean

Returns:

  • (Boolean)


85
86
87
# File 'lib/rubinius/debugger/breakpoint.rb', line 85

def has_commands?
  !@commands.nil?
end

#has_condition?Boolean

Returns:

  • (Boolean)


93
94
95
# File 'lib/rubinius/debugger/breakpoint.rb', line 93

def has_condition?
  !@condition.nil?
end

#hit!(loc) ⇒ Object



63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/rubinius/debugger/breakpoint.rb', line 63

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

#locationObject



26
27
28
# File 'lib/rubinius/debugger/breakpoint.rb', line 26

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

#paired_with(bp) ⇒ Object



47
48
49
# File 'lib/rubinius/debugger/breakpoint.rb', line 47

def paired_with(bp)
  @paired_bp = bp
end

#remove!Object



56
57
58
59
60
61
# File 'lib/rubinius/debugger/breakpoint.rb', line 56

def remove!
  return unless @set

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

#set_commands(commands) ⇒ Object



81
82
83
# File 'lib/rubinius/debugger/breakpoint.rb', line 81

def set_commands(commands)
  @commands = commands
end

#set_condition(condition) ⇒ Object



89
90
91
# File 'lib/rubinius/debugger/breakpoint.rb', line 89

def set_condition(condition)
  @condition = condition
end

#set_temp!Object



39
40
41
# File 'lib/rubinius/debugger/breakpoint.rb', line 39

def set_temp!
  @temp = true
end