diff --git a/ext/debug/debug.c b/ext/debug/debug.c index fc4b4bb5a..81c960541 100644 --- a/ext/debug/debug.c +++ b/ext/debug/debug.c @@ -89,34 +89,6 @@ capture_frames(VALUE self, VALUE skip_path_prefix) return rb_debug_inspector_open(di_body, (void *)skip_path_prefix); } -#ifdef RB_PROFILE_FRAMES_HAS_C_FRAMES -#define BUFF_SIZE 4096 - -static VALUE -frame_depth(VALUE self) -{ - static VALUE buff[BUFF_SIZE]; - static int lines[BUFF_SIZE]; - - int size = rb_profile_frames(0, BUFF_SIZE, buff, lines); - - // If the buffer is full, there might be more frames. - // Fall back to rb_make_backtrace to get them all. - if (size >= BUFF_SIZE) { - VALUE bt = rb_make_backtrace(); - size = RARRAY_LEN(bt); - return INT2FIX(size); - } - - // rb_profile_frames will return one extra frame - // https://bugs.ruby-lang.org/issues/18907 - #ifdef RB_PROFILE_FRAMES_HAS_EXTRA_FRAME - return INT2FIX(size - 1); - #else - return INT2FIX(size); - #endif -} -#else static VALUE frame_depth(VALUE self) { @@ -124,7 +96,6 @@ frame_depth(VALUE self) VALUE bt = rb_make_backtrace(); return INT2FIX(RARRAY_LEN(bt)); } -#endif // iseq diff --git a/ext/debug/extconf.rb b/ext/debug/extconf.rb index c9d056b7e..b4e78fbe3 100644 --- a/ext/debug/extconf.rb +++ b/ext/debug/extconf.rb @@ -7,14 +7,6 @@ $defs << '-DHAVE_RB_ISEQ_PARAMETERS' $defs << '-DHAVE_RB_ISEQ_CODE_LOCATION' - if RUBY_VERSION >= '3.0.0' - $defs << '-DRB_PROFILE_FRAMES_HAS_C_FRAMES' - - if RUBY_VERSION < '3.2.0' - $defs << '-DRB_PROFILE_FRAMES_HAS_EXTRA_FRAME' - end - end - if RUBY_VERSION >= '3.1.0' $defs << '-DHAVE_RB_ISEQ_TYPE' end