Skip to content

Commit e93228c

Browse files
committed
do not stop at negative frames (fix #26)
1 parent 95cdac3 commit e93228c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

ext/debase_internals.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ print_debug(const char *message, ...)
3535
va_end(ap);
3636
}
3737

38+
inline int
39+
check_stop_frame(debug_context_t *context) {
40+
return context->calced_stack_size == context->stop_frame && context->calced_stack_size >= 0;
41+
}
42+
3843
static VALUE
3944
is_path_accepted(VALUE path) {
4045
VALUE filter;
@@ -358,7 +363,7 @@ process_line_event(VALUE trace_point, void *data)
358363
{
359364
context->stop_next = 0;
360365
}
361-
if(context->calced_stack_size == context->stop_frame)
366+
if(check_stop_frame(context))
362367
{
363368
context->stop_next = 0;
364369
context->stop_frame = -1;
@@ -394,7 +399,7 @@ process_return_event(VALUE trace_point, void *data)
394399
/* it is important to check stop_frame after stack size updated
395400
if the order will be changed change Context_stop_frame accordingly.
396401
*/
397-
if(context->calced_stack_size == context->stop_frame)
402+
if(check_stop_frame(context))
398403
{
399404
context->stop_next = 1;
400405
context->stop_frame = -1;

0 commit comments

Comments
 (0)