26 if (!str)
return Qnil;
29 #define rb_id2str(id) id2str(id) 127 return loc->
body.
iseq.lineno.lineno;
134 rb_bug(
"location_lineno: unreachable");
164 rb_bug(
"location_label: unreachable");
213 rb_bug(
"location_base_label: unreachable");
243 rb_bug(
"location_path: unreachable");
276 rb_bug(
"location_absolute_path: unreachable");
325 lineno = loc->
body.
iseq.lineno.lineno;
330 file = loc->
body.
cfunc.prev_loc->body.iseq.iseq->body->location.path;
342 rb_bug(
"location_to_str: unreachable");
381 for (i=0; i<s; i++) {
425 void (*init)(
void *arg,
size_t size),
449 if (start_cfp < last_cfp) {
453 size = start_cfp - last_cfp + 1;
470 iter_cfunc(arg, cfp, mid);
542 rb_bug(
"backtrace_collect: unreachable");
699 (arg->
func)(arg->
data, file, lineno, name);
710 (arg->
func)(arg->
data, file, lineno, name);
719 fprintf(fp,
"\tfrom %s:%d:in unknown method\n",
723 fprintf(fp,
"\tfrom %s:%d:in `%s'\n",
734 arg.
data = (
void *)fp;
747 fprintf(stderr,
"-- Ruby level backtrace information " 748 "----------------------------------------\n");
752 fprintf(stderr,
"%s:%d:in unknown method\n", filename, line);
755 fprintf(stderr,
"%s:%d:in `%s'\n", filename, line,
RSTRING_PTR(method));
766 arg.
data = (
int *)&i;
802 arg.
data = (
void *)output;
829 if (argc == 2 &&
NIL_P(vn)) argc--;
833 lev = lev_default + lev_plus;
851 lev = beg + lev_plus;
1093 return RBASIC(klass)->klass;
1156 if (!
NIL_P(cfp_val)) {
1178 dbg_context.
th = th;
1179 dbg_context.
cfp = dbg_context.
th->
cfp;
1186 result = (*func)(&dbg_context, data);
1252 for (i=0; i<limit && cfp != end_cfp;) {
1253 if (cfp->
iseq && cfp->
pc) {
1262 buff[i] = (
VALUE)cme;
1301 rb_bug(
"frame2iseq: unreachable");
1359 if (klass && !
NIL_P(klass)) {
1361 klass =
RBASIC(klass)->klass;
1400 if (method_name !=
Qnil) {
1404 if (classpath !=
Qnil) {
1406 classpath, singleton_p ==
Qtrue ?
"." :
"#", method_name);
1424 if (
NIL_P(qualified_method_name) || base_label == qualified_method_name) {
1430 int prefix_len =
rb_long2int(label_length - base_label_length);
static VALUE location_inspect_m(VALUE self)
static VALUE thread_backtrace_to_ary(int argc, const VALUE *argv, VALUE thval, int to_str)
static VALUE location_create(rb_backtrace_location_t *srcloc, void *btobj)
static VALUE method_name(VALUE obj)
void rb_backtrace_print_to(VALUE output)
unsigned int rb_iseq_line_no(const rb_iseq_t *iseq, size_t pos)
VALUE rb_ary_entry(VALUE ary, long offset)
void rb_bug(const char *fmt,...)
#define RUBY_TYPED_FREE_IMMEDIATELY
static void oldbt_iter_iseq(void *ptr, const rb_control_frame_t *cfp)
int rb_vm_get_sourceline(const rb_control_frame_t *cfp)
static VALUE location_to_str_dmyarg(rb_backtrace_location_t *loc, void *dmy)
int rb_backtrace_p(VALUE obj)
VALUE rb_profile_frame_classpath(VALUE frame)
VALUE rb_iseq_method_name(const rb_iseq_t *iseq)
void rb_undef_alloc_func(VALUE)
#define RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp)
static rb_backtrace_location_t * location_ptr(VALUE locobj)
VALUE rb_iseqw_new(const rb_iseq_t *)
static int calc_lineno(const rb_iseq_t *iseq, const VALUE *pc)
struct rb_method_definition_struct *const def
const rb_callable_method_entry_t * rb_vm_frame_method_entry(const rb_control_frame_t *cfp)
static VALUE location_base_label_m(VALUE self)
VALUE rb_make_backtrace(void)
#define TH_JUMP_TAG(th, st)
struct rb_backtrace_location_struct::@187::@189 cfunc
VALUE rb_ary_push(VALUE ary, VALUE item)
VALUE rb_iseq_absolute_path(const rb_iseq_t *iseq)
SSL_METHOD *(* func)(void)
VALUE rb_profile_frame_first_lineno(VALUE frame)
VALUE rb_profile_frame_method_name(VALUE frame)
rb_encoding * rb_enc_compatible(VALUE str1, VALUE str2)
struct rb_iseq_constant_body * body
VALUE rb_backtrace_to_location_ary(VALUE self)
static VALUE location_label_m(VALUE self)
VALUE rb_iseq_label(const rb_iseq_t *iseq)
VALUE rb_define_class_under(VALUE outer, const char *name, VALUE super)
Defines a class under the namespace of outer.
void rb_raise(VALUE exc, const char *fmt,...)
static VALUE location_to_str(rb_backtrace_location_t *loc)
VALUE rb_ivar_get(VALUE, ID)
static void bt_iter_iseq(void *ptr, const rb_control_frame_t *cfp)
void rb_define_alloc_func(VALUE, rb_alloc_func_t)
static void oldbt_iter_cfunc(void *ptr, const rb_control_frame_t *cfp, ID mid)
void rb_gc_mark(VALUE ptr)
static VALUE collect_caller_bindings(rb_thread_t *th)
VALUE rb_range_beg_len(VALUE, long *, long *, long, int)
static int location_lineno(rb_backtrace_location_t *loc)
static VALUE id2str(ID id)
VALUE rb_io_write(VALUE, VALUE)
void rb_define_global_function(const char *name, VALUE(*func)(ANYARGS), int argc)
Defines a global function.
VALUE rb_profile_frame_singleton_method_p(VALUE frame)
static int VM_FRAME_RUBYFRAME_P(const rb_control_frame_t *cfp)
void rb_undef_method(VALUE klass, const char *name)
VALUE rb_debug_inspector_frame_self_get(const rb_debug_inspector_t *dc, long index)
VALUE rb_enc_sprintf(rb_encoding *enc, const char *format,...)
static VALUE rb_f_caller_locations(int argc, VALUE *argv)
VALUE rb_debug_inspector_frame_class_get(const rb_debug_inspector_t *dc, long index)
VALUE rb_debug_inspector_frame_iseq_get(const rb_debug_inspector_t *dc, long index)
const VALUE * iseq_encoded
static unsigned char * output
#define RB_TYPE_P(obj, type)
static VALUE location_absolute_path(rb_backtrace_location_t *loc)
int rb_vm_control_frame_id_and_class(const rb_control_frame_t *cfp, ID *idp, ID *called_idp, VALUE *klassp)
VALUE rb_profile_frame_absolute_path(VALUE frame)
static VALUE rb_cBacktraceLocation
VALUE rb_debug_inspector_backtrace_locations(const rb_debug_inspector_t *dc)
RUBY_EXTERN VALUE rb_cObject
VALUE rb_vm_backtrace_location_ary(rb_thread_t *th, long lev, long n)
static VALUE location_path_m(VALUE self)
int rb_typeddata_is_kind_of(VALUE obj, const rb_data_type_t *data_type)
VALUE rb_str_cat2(VALUE, const char *)
VALUE rb_profile_frame_full_label(VALUE frame)
rb_backtrace_location_t * loc
VALUE(* rb_debug_inspector_func_t)(const rb_debug_inspector_t *, void *)
static VALUE backtrace_object(rb_thread_t *th)
static void bt_init(void *ptr, size_t size)
VALUE rb_iseq_first_lineno(const rb_iseq_t *iseq)
static const rb_data_type_t location_data_type
static void collect_caller_bindings_iseq(void *arg, const rb_control_frame_t *cfp)
static void oldbt_init(void *ptr, size_t dmy)
void rb_ary_store(VALUE ary, long idx, VALUE val)
#define GetCoreDataFromValue(obj, type, ptr)
static void collect_caller_bindings_init(void *arg, size_t size)
static VALUE backtrace_to_location_ary(VALUE self, long lev, long n)
const VALUE defined_class
static void collect_caller_bindings_cfunc(void *arg, const rb_control_frame_t *cfp, ID mid)
VALUE rb_profile_frame_path(VALUE frame)
VALUE rb_debug_inspector_frame_binding_get(const rb_debug_inspector_t *dc, long index)
VALUE rb_debug_inspector_open(rb_debug_inspector_func_t func, void *data)
#define GC_GUARDED_PTR(p)
static VALUE backtrace_collect(rb_backtrace_t *bt, long lev, long n, VALUE(*func)(rb_backtrace_location_t *, void *arg), void *arg)
union rb_method_definition_struct::@144 body
rb_backtrace_location_t * backtrace
VALUE rb_sprintf(const char *format,...)
static VALUE location_format(VALUE file, int lineno, VALUE name)
VALUE rb_class_path(VALUE)
#define RUBY_SYMBOL_EXPORT_END
static VALUE backtrace_to_str_ary(VALUE self, long lev, long n)
int rb_scan_args(int argc, const VALUE *argv, const char *fmt,...)
void(* func)(void *data, VALUE file, int lineno, VALUE name)
#define RUBY_VM_NEXT_CONTROL_FRAME(cfp)
struct rb_backtrace_location_struct rb_backtrace_location_t
#define RUBYVM_CFUNC_FRAME_P(cfp)
VALUE rb_vm_make_binding(rb_thread_t *th, const rb_control_frame_t *src_cfp)
static void backtrace_each(rb_thread_t *th, void(*init)(void *arg, size_t size), void(*iter_iseq)(void *arg, const rb_control_frame_t *cfp), void(*iter_cfunc)(void *arg, const rb_control_frame_t *cfp, ID mid), void *arg)
RUBY_EXTERN VALUE rb_cThread
void rb_backtrace_print_as_bugreport(void)
int rb_profile_frames(int start, int limit, VALUE *buff, int *lines)
const char * rb_class2name(VALUE)
#define RUBY_SYMBOL_EXPORT_BEGIN
static void vm_backtrace_print(FILE *fp)
static VALUE rb_f_caller(int argc, VALUE *argv)
static VALUE location_lineno_m(VALUE self)
#define RUBY_VM_END_CONTROL_FRAME(th)
register unsigned int len
VALUE rb_vm_thread_backtrace(int argc, const VALUE *argv, VALUE thval)
enum rb_thread_status status
void * ruby_xmalloc(size_t size)
VALUE rb_profile_frame_qualified_method_name(VALUE frame)
static void location_mark(void *ptr)
static VALUE backtrace_load_data(VALUE self, VALUE str)
VALUE rb_backtrace_to_str_ary(VALUE self)
static void oldbt_bugreport(void *arg, VALUE file, int line, VALUE method)
static VALUE location_path(rb_backtrace_location_t *loc)
static VALUE location_to_str_m(VALUE self)
VALUE rb_vm_backtrace_str_ary(rb_thread_t *th, long lev, long n)
struct rb_backtrace_location_struct * prev_loc
VALUE rb_str_catf(VALUE str, const char *format,...)
void Init_vm_backtrace(void)
static void location_mark_entry(rb_backtrace_location_t *fi)
void rb_marshal_define_compat(VALUE newclass, VALUE oldclass, VALUE(*dumper)(VALUE), VALUE(*loader)(VALUE, VALUE))
VALUE rb_str_cat_cstr(VALUE, const char *)
#define TypedData_Make_Struct(klass, type, data_type, sval)
static void backtrace_free(void *ptr)
VALUE rb_str_inspect(VALUE)
VALUE rb_iseq_path(const rb_iseq_t *iseq)
static void bt_iter_cfunc(void *ptr, const rb_control_frame_t *cfp, ID mid)
#define GetThreadPtr(obj, ptr)
static VALUE location_base_label(rb_backtrace_location_t *loc)
VALUE rb_vm_backtrace_object(void)
VALUE rb_iseq_base_label(const rb_iseq_t *iseq)
enum rb_backtrace_location_struct::LOCATION_TYPE type
static VALUE backtrace_alloc(VALUE klass)
struct rb_backtrace_struct rb_backtrace_t
static const rb_iseq_t * frame2iseq(VALUE frame)
VALUE rb_ary_reverse(VALUE ary)
static VALUE location_absolute_path_m(VALUE self)
static void oldbt_print(void *data, VALUE file, int lineno, VALUE name)
#define GC_GUARDED_PTR_REF(p)
static VALUE frame_get(const rb_debug_inspector_t *dc, long index)
#define RUBY_TYPED_DEFAULT_FREE
const rb_iseq_t *const iseqptr
VALUE rb_vm_thread_backtrace_locations(int argc, const VALUE *argv, VALUE thval)
static VALUE get_klass(const rb_control_frame_t *cfp)
rb_backtrace_location_t * backtrace_base
static VALUE vm_backtrace_to_ary(rb_thread_t *th, int argc, const VALUE *argv, int lev_default, int lev_plus, int to_str)
static size_t location_memsize(const void *ptr)
rb_backtrace_location_t * prev_loc
static const rb_data_type_t backtrace_data_type
static VALUE backtrace_dump_data(VALUE self)
VALUE rb_profile_frame_base_label(VALUE frame)
static VALUE location_label(rb_backtrace_location_t *loc)
void rb_define_method(VALUE klass, const char *name, VALUE(*func)(ANYARGS), int argc)
static VALUE rb_cBacktrace
static VALUE frame2klass(VALUE frame)
VALUE rb_profile_frame_label(VALUE frame)
union rb_backtrace_location_struct::@187 body
static void oldbt_print_to(void *data, VALUE file, int lineno, VALUE name)
rb_iseq_location_t location
VALUE rb_obj_class(VALUE)
static size_t backtrace_memsize(const void *ptr)
static void backtrace_mark(void *ptr)