Method: Kernel#caller_locations

Defined in:
vm_backtrace.c

#caller_locations(start = 1, length = nil) ⇒ Object #caller_locations(range) ⇒ Object

Returns the current execution stack—an array containing backtrace location objects.

See Thread::Backtrace::Location for more information.

The optional start parameter determines the number of initial stack entries to omit from the top of the stack.

A second optional length parameter can be used to limit how many entries are returned from the stack.

Returns nil if start is greater than the size of current execution stack.

Optionally you can pass a range, which will return an array containing the entries within the specified range.



1387
1388
1389
1390
1391
# File 'vm_backtrace.c', line 1387

static VALUE
rb_f_caller_locations(int argc, VALUE *argv, VALUE _)
{
    return ec_backtrace_to_ary(GET_EC(), argc, argv, 1, 1, 0);
}