class Rubinius::Debugger::Command::NextInstruction

Public Instance Methods

is_a_goto(exec, ip) click to toggle source
# File lib/rubinius/debugger/commands.rb, line 399
def is_a_goto(exec, ip)
  goto = Rubinius::InstructionSet.opcodes_map[:goto]
  git  = Rubinius::InstructionSet.opcodes_map[:goto_if_true]
  gif  = Rubinius::InstructionSet.opcodes_map[:goto_if_false]

  i = exec.iseq[ip]

  case i
  when goto, git, gif
    return true
  end

  return false
end
run(args) click to toggle source
# File lib/rubinius/debugger/commands.rb, line 372
def run(args)
  if args and !args.empty?
    step = args.to_i
  else
    step = 1
  end

  exec = current_method
  insn = Rubinius::InstructionSet[exec.iseq[current_frame.ip]]

  next_ip = current_frame.ip + insn.width

  if next_ip >= exec.iseq.size
    step_to_parent
  elsif is_a_goto(exec, current_frame.ip)
    set_breakpoints_between(exec, current_frame.ip, next_ip)
  else
    line = exec.line_from_ip(next_ip)

    bp = BreakPoint.for_ip(exec, next_ip)
    bp.for_step!(current_frame.variables)
    bp.activate
  end

  listen
end