Skip to content

Commit 72cd0ee

Browse files
committed
adjust for dummy frame
1 parent e83ba4f commit 72cd0ee

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

ext/debug/debug.c

Lines changed: 5 additions & 2 deletions
Original file line numberOriginal file lineDiff line numberDiff line change
@@ -104,9 +104,12 @@ frame_depth(VALUE self)
104
if (size >= BUFF_SIZE) {
104
if (size >= BUFF_SIZE) {
105
VALUE bt = rb_make_backtrace();
105
VALUE bt = rb_make_backtrace();
106
size = RARRAY_LEN(bt);
106
size = RARRAY_LEN(bt);
107+
return INT2FIX(size);
107
}
108
}
108-
109+
109-
return INT2FIX(size);
110+
// rb_profile_frames will return one extra frame
111+
// https://bugs.ruby-lang.org/issues/18907
112+
return INT2FIX(size - 1);
110
}
113
}
111

114

112
// iseq
115
// iseq

0 commit comments

Comments
 (0)