Skip to content

Commit 3e3f374

Browse files
committed
revert #746
fix #799
1 parent fe270d4 commit 3e3f374

File tree

2 files changed

+0
-37
lines changed

2 files changed

+0
-37
lines changed

ext/debug/debug.c

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -89,42 +89,13 @@ capture_frames(VALUE self, VALUE skip_path_prefix)
8989
return rb_debug_inspector_open(di_body, (void *)skip_path_prefix);
9090
}
9191

92-
#ifdef RB_PROFILE_FRAMES_HAS_C_FRAMES
93-
#define BUFF_SIZE 4096
94-
95-
static VALUE
96-
frame_depth(VALUE self)
97-
{
98-
static VALUE buff[BUFF_SIZE];
99-
static int lines[BUFF_SIZE];
100-
101-
int size = rb_profile_frames(0, BUFF_SIZE, buff, lines);
102-
103-
// If the buffer is full, there might be more frames.
104-
// Fall back to rb_make_backtrace to get them all.
105-
if (size >= BUFF_SIZE) {
106-
VALUE bt = rb_make_backtrace();
107-
size = RARRAY_LEN(bt);
108-
return INT2FIX(size);
109-
}
110-
111-
// rb_profile_frames will return one extra frame
112-
// https://bugs.ruby-lang.org/issues/18907
113-
#ifdef RB_PROFILE_FRAMES_HAS_EXTRA_FRAME
114-
return INT2FIX(size - 1);
115-
#else
116-
return INT2FIX(size);
117-
#endif
118-
}
119-
#else
12092
static VALUE
12193
frame_depth(VALUE self)
12294
{
12395
// TODO: more efficient API
12496
VALUE bt = rb_make_backtrace();
12597
return INT2FIX(RARRAY_LEN(bt));
12698
}
127-
#endif
12899

129100
// iseq
130101

ext/debug/extconf.rb

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,6 @@
77
$defs << '-DHAVE_RB_ISEQ_PARAMETERS'
88
$defs << '-DHAVE_RB_ISEQ_CODE_LOCATION'
99

10-
if RUBY_VERSION >= '3.0.0'
11-
$defs << '-DRB_PROFILE_FRAMES_HAS_C_FRAMES'
12-
13-
if RUBY_VERSION < '3.2.0'
14-
$defs << '-DRB_PROFILE_FRAMES_HAS_EXTRA_FRAME'
15-
end
16-
end
17-
1810
if RUBY_VERSION >= '3.1.0'
1911
$defs << '-DHAVE_RB_ISEQ_TYPE'
2012
end

0 commit comments

Comments
 (0)