Class: Trepanning::DeferredBreakpoint

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

Instance Method Summary collapse

Constructor Details

#initialize(debugger, frame, klass, which, name, line = nil, list = nil) ⇒ DeferredBreakpoint

Returns a new instance of DeferredBreakpoint.



162
163
164
165
166
167
168
169
170
# File 'app/breakpoint.rb', line 162

def initialize(debugger, frame, klass, which, name, line=nil, list=nil)
  @debugger = debugger
  @frame = frame
  @klass_name = klass
  @which = which
  @name = name
  @line = line
  @list = list
end

Instance Method Details

#delete!Object



204
205
206
207
208
# File 'app/breakpoint.rb', line 204

def delete!
  if @list
    @list.delete self
  end
end

#describeObject



200
201
202
# File 'app/breakpoint.rb', line 200

def describe
  "#{descriptor} - unknown location (deferred)"
end

#descriptorObject



172
173
174
# File 'app/breakpoint.rb', line 172

def descriptor
  "#{@klass_name}#{@which}#{@name}"
end

#resolve!Object



176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# File 'app/breakpoint.rb', line 176

def resolve!
  begin
    klass = @frame.run(@klass_name)
  rescue NameError
    return false
  end

  begin
    if @which == "#"
      meth = klass.instance_method(@name)
    else
      meth = klass.method(@name)
    end
  rescue NameError
    return false
  end

  @debugger.processor.msg "Resolved breakpoint for #{@klass_name}#{@which}#{@name}"

  @debugger.processor.set_breakpoint_method descriptor, meth, @line

  return true
end