Skip to content

Commit fc4b31b

Browse files
committed
RUBY-14471: let's use calced_stack_size for step-out
to avoid problems with stepping out of the first call in a call chain
1 parent dd46a58 commit fc4b31b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

ext/context.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,12 +333,12 @@ Context_stop_frame(VALUE self, VALUE frame)
333333
debug_context_t *debug_context;
334334

335335
Data_Get_Struct(self, debug_context_t, debug_context);
336-
if(FIX2INT(frame) < 0 && FIX2INT(frame) >= debug_context->stack_size)
336+
if(FIX2INT(frame) < 0 && FIX2INT(frame) >= debug_context->calced_stack_size)
337337
rb_raise(rb_eRuntimeError, "Stop frame is out of range.");
338338
/* we decrease stack size by frame and 1 because we use stop_frame after
339339
updating stack size. If that code will be changed this should be changed accordingly.
340340
*/
341-
debug_context->stop_frame = debug_context->stack_size - FIX2INT(frame) - 1;
341+
debug_context->stop_frame = debug_context->calced_stack_size - FIX2INT(frame) - 1;
342342

343343
return frame;
344344
}

ext/debase_internals.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ process_return_event(VALUE trace_point, void *data)
298298
/* it is important to check stop_frame after stack size updated
299299
if the order will be changed change Context_stop_frame accordingly.
300300
*/
301-
if(context->stack_size == context->stop_frame)
301+
if(context->calced_stack_size == context->stop_frame)
302302
{
303303
context->stop_next = 1;
304304
context->stop_frame = -1;

0 commit comments

Comments
 (0)