lib/pry-byebug/processor.rb in pry-byebug-1.1.2 vs lib/pry-byebug/processor.rb in pry-byebug-1.2.0
- old
+ new
@@ -31,19 +31,19 @@
# Movement when on the initial binding.pry line will have a frame
# inside Byebug. If we step normally, it'll stop inside this
# Processor. So jump out and stop at the above frame, then step/next
# from our callback.
@delayed[command[:action]] = times
- step_out 2
+ Byebug.current_context.step_out(2)
elsif :next == command[:action]
- step_over times
+ Byebug.current_context.step_over(times, 0)
elsif :step == command[:action]
- step_into times
+ Byebug.current_context.step_into(times)
elsif :finish == command[:action]
- step_out
+ Byebug.current_context.step_out(0)
end
else
stop
end
@@ -65,17 +65,17 @@
# --- Callbacks from byebug C extension ---
def at_line(context, file, line)
# If any delayed nexts/steps, do 'em.
if @delayed[:next] > 1
- step_over @delayed[:next] - 1
+ context.step_over(@delayed[:next] - 1, 0)
elsif @delayed[:step] > 1
- step_into @delayed[:step] - 1
+ context.step_into(@delayed[:step] - 1)
elsif @delayed[:finish] > 1
- step_out @delayed[:finish] - 1
+ context.step_out(@delayed[:finish] - 1)
# Otherwise, resume the pry session at the stopped line.
else
resume_pry context
end
@@ -100,33 +100,19 @@
# TODO
end
private
+ #
# Resume an existing Pry REPL at the paused point.
- # Binding extracted from Byebug::Context
+ #
def resume_pry(context)
new_binding = context.frame_binding(0)
Byebug.stop unless @always_enabled
run(false) do
@pry.repl new_binding
end
- end
-
- # Move execution forward.
- def step_into(times)
- Byebug.context.step_into times
- end
-
- # Move execution forward a number of lines in the same frame.
- def step_over(lines)
- Byebug.context.step_over lines, 0
- end
-
- # Execute until specified frame returns.
- def step_out(frame = 0)
- Byebug.context.step_out frame
end
# Cleanup when debugging is stopped and execution continues.
def stop
Byebug.stop if !@always_enabled && Byebug.started?