Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →
class method · added in Ruby 3.2
Thread.each_caller_location
() { (::Thread::Backtrace::Location) -> void } -> nil
Thread.each_caller_location(...) { |loc| ... } → nil
vm_backtrace.c
View on GitHub ↗
static VALUE
each_caller_location(int argc, VALUE *argv, VALUE _)
{
rb_execution_context_t *ec = GET_EC();
long n, lev = ec_backtrace_range(ec, argc, argv, 1, 1, &n);
if (lev >= 0 && n != 0) {
rb_ec_partial_backtrace_object(ec, lev, n, NULL, FALSE, TRUE);
}
return Qnil;
}
Yields each frame of the current execution stack as a backtrace location object.
Ruby version changes
-
3.2
-
Thread.each_caller_locationis added. [Feature #16663]
-