module Byebug::FrameFunctions

def adjust_frame(frame_pos, absolute, context=@state.context)

def adjust_frame(frame_pos, absolute, context=@state.context)
  @state.frame_pos = 0 if context != @state.context
  if absolute
    if frame_pos < 0
      abs_frame_pos = context.stack_size + frame_pos
    else
      abs_frame_pos = frame_pos
    end
  else
    abs_frame_pos = @state.frame_pos + frame_pos
  end
  if abs_frame_pos >= context.stack_size then
    errmsg "Adjusting would put us beyond the oldest (initial) frame.\n"
    return
  elsif abs_frame_pos < 0 then
    errmsg "Adjusting would put us beyond the newest (innermost) frame.\n"
    return
  end
  if @state.frame_pos != abs_frame_pos then
    @state.previous_line = nil
    @state.frame_pos = abs_frame_pos
  end
  @state.file = context.frame_file(@state.frame_pos)
  @state.line = context.frame_line(@state.frame_pos)
  print_frame(@state.frame_pos, true)
end