Class: Byebug::Context

Inherits:
Object
  • Object
show all
Defined in:
lib/byebug/context.rb

Instance Method Summary collapse

Instance Method Details

#at_breakpoint(brkpnt) ⇒ Object



46
47
48
# File 'lib/byebug/context.rb', line 46

def at_breakpoint(brkpnt)
  handler.at_breakpoint(self, brkpnt)
end

#at_catchpoint(excpt) ⇒ Object



50
51
52
# File 'lib/byebug/context.rb', line 50

def at_catchpoint(excpt)
  handler.at_catchpoint(self, excpt)
end

#at_line(file, line) ⇒ Object



58
59
60
# File 'lib/byebug/context.rb', line 58

def at_line(file, line)
  handler.at_line(self, file, line) unless IGNORED_FILES.include?(file)
end

#at_return(file, line) ⇒ Object



62
63
64
# File 'lib/byebug/context.rb', line 62

def at_return(file, line)
  handler.at_return(self, file, line) unless IGNORED_FILES.include?(file)
end

#at_tracing(file, line) ⇒ Object



54
55
56
# File 'lib/byebug/context.rb', line 54

def at_tracing(file, line)
  handler.at_tracing(self, file, line) unless IGNORED_FILES.include?(file)
end

#c_frame_args(frame_no) ⇒ Object



16
17
18
19
20
# File 'lib/byebug/context.rb', line 16

def c_frame_args frame_no
  myself = frame_self frame_no
  return [] unless myself.to_s != 'main'
  myself.send(:method, frame_method(frame_no)).parameters
end

#frame_args(frame_no = 0) ⇒ Object



33
34
35
36
37
38
39
40
# File 'lib/byebug/context.rb', line 33

def frame_args frame_no = 0
  bind = frame_binding frame_no
  if bind.nil?
    c_frame_args frame_no
  else
    ruby_frame_args bind
  end
end

#frame_locals(frame_no = 0) ⇒ Object



11
12
13
14
# File 'lib/byebug/context.rb', line 11

def frame_locals frame_no = 0
  bind = frame_binding frame_no
  eval "local_variables.inject({}){|h, v| h[v] = eval(v.to_s); h}", bind
end

#handlerObject



42
43
44
# File 'lib/byebug/context.rb', line 42

def handler
  Byebug.handler or raise 'No interface loaded'
end

#ruby_frame_args(bind) ⇒ Object



22
23
24
25
26
27
28
29
30
31
# File 'lib/byebug/context.rb', line 22

def ruby_frame_args bind
  return [] unless eval '__method__', bind
  begin
    eval "self.method(__method__).parameters", bind
  rescue NameError => e
    print "WARNING: Got exception #{e.class}: \"#{e.message}\" " \
          "while retreving parameters from frame\n"
    return []
  end
end