module Byebug::FrameFunctions

Mixin to assist command parsing

Public Instance Methods

adjust_frame(frame, absolute) click to toggle source
# File lib/byebug/commands/frame.rb, line 33
def adjust_frame(frame, absolute)
  if absolute
    abs_frame = switch_to_frame(frame)
    return errmsg(pr('frame.errors.c_frame')) if @state.c_frame?(abs_frame)
  else
    abs_frame = navigate_to_frame(frame)
  end

  if abs_frame >= @state.context.stack_size
    return errmsg(pr('frame.errors.too_low'))
  elsif abs_frame < 0
    return errmsg(pr('frame.errors.too_high'))
  end

  @state.frame = abs_frame
  @state.file = @state.context.frame_file(@state.frame)
  @state.line = @state.context.frame_line(@state.frame)
  @state.prev_line = nil

  ListCommand.new(@state).execute if Setting[:autolist]
end
get_pr_arguments(frame_no) click to toggle source
# File lib/byebug/commands/frame.rb, line 55
def get_pr_arguments(frame_no)
  file = @state.frame_file(frame_no)
  line = @state.frame_line(frame_no)
  call = @state.frame_call(frame_no)
  mark = @state.frame_mark(frame_no)
  pos = @state.frame_pos(frame_no)

  { mark: mark, pos: pos, call: call, file: file, line: line }
end
navigate_to_frame(jump_no) click to toggle source
switch_to_frame(frame_no) click to toggle source
# File lib/byebug/commands/frame.rb, line 12
def switch_to_frame(frame_no)
  frame_no >= 0 ? frame_no : @state.context.stack_size + frame_no
end