85 case LOCATION_TYPE_ISEQ:
86 case LOCATION_TYPE_ISEQ_CALCED:
89 case LOCATION_TYPE_CFUNC:
90 case LOCATION_TYPE_IFUNC:
129 case LOCATION_TYPE_ISEQ:
130 loc->
type = LOCATION_TYPE_ISEQ_CALCED;
132 case LOCATION_TYPE_ISEQ_CALCED:
133 return loc->
body.
iseq.lineno.lineno;
134 case LOCATION_TYPE_CFUNC:
140 rb_bug(
"location_lineno: unreachable");
163 case LOCATION_TYPE_ISEQ:
164 case LOCATION_TYPE_ISEQ_CALCED:
166 case LOCATION_TYPE_CFUNC:
168 case LOCATION_TYPE_IFUNC:
170 rb_bug(
"location_label: unreachable");
212 case LOCATION_TYPE_ISEQ:
213 case LOCATION_TYPE_ISEQ_CALCED:
215 case LOCATION_TYPE_CFUNC:
217 case LOCATION_TYPE_IFUNC:
219 rb_bug(
"location_base_label: unreachable");
239 case LOCATION_TYPE_ISEQ:
240 case LOCATION_TYPE_ISEQ_CALCED:
242 case LOCATION_TYPE_CFUNC:
247 case LOCATION_TYPE_IFUNC:
249 rb_bug(
"location_path: unreachable");
272 case LOCATION_TYPE_ISEQ:
273 case LOCATION_TYPE_ISEQ_CALCED:
275 case LOCATION_TYPE_CFUNC:
280 case LOCATION_TYPE_IFUNC:
282 rb_bug(
"location_absolute_path: unreachable");
318 case LOCATION_TYPE_ISEQ:
323 loc->
type = LOCATION_TYPE_ISEQ_CALCED;
325 case LOCATION_TYPE_ISEQ_CALCED:
327 lineno = loc->
body.
iseq.lineno.lineno;
330 case LOCATION_TYPE_CFUNC:
332 file = loc->
body.
cfunc.prev_loc->body.iseq.iseq->location.path;
342 case LOCATION_TYPE_IFUNC:
344 rb_bug(
"location_to_str: unreachable");
383 for (i=0; i<s; i++) {
428 void (*init)(
void *arg,
size_t size),
452 if (start_cfp < last_cfp) {
456 size = start_cfp - last_cfp + 1;
470 ID mid = cfp->me->def ? cfp->me->def->original_id : cfp->me->called_id;
472 iter_cfunc(arg, cfp, mid);
500 loc->
type = LOCATION_TYPE_ISEQ;
511 loc->
type = LOCATION_TYPE_CFUNC;
544 rb_bug(
"backtrace_collect: unreachable");
689 (arg->
func)(arg->
data, file, lineno, name);
700 (arg->
func)(arg->
data, file, lineno, name);
709 fprintf(fp,
"\tfrom %s:%d:in unknown method\n",
713 fprintf(fp,
"\tfrom %s:%d:in `%s'\n",
724 arg.
data = (
void *)fp;
737 fprintf(stderr,
"-- Ruby level backtrace information "
738 "----------------------------------------\n");
742 fprintf(stderr,
"%s:%d:in unknown method\n", filename, line);
745 fprintf(stderr,
"%s:%d:in `%s'\n", filename, line,
RSTRING_PTR(method));
756 arg.
data = (
int *)&i;
790 if (argc == 2 &&
NIL_P(vn)) argc--;
794 lev = lev_default + lev_plus;
812 lev = beg + lev_plus;
1018 #if defined __GNUC__ && __GNUC__ >= 4
1019 #pragma GCC visibility push(default)
1022 #if defined __GNUC__ && __GNUC__ >= 4
1023 #pragma GCC visibility pop
1058 return RBASIC(klass)->klass;
1121 if (!
NIL_P(cfp_val)) {
1143 dbg_context.
th = th;
1144 dbg_context.
cfp = dbg_context.
th->
cfp;
1151 result = (*func)(&dbg_context, data);
static VALUE location_inspect_m(VALUE self)
static VALUE location_create(rb_backtrace_location_t *srcloc, void *btobj)
unsigned int rb_iseq_line_no(const rb_iseq_t *iseq, size_t pos)
VALUE rb_ary_entry(VALUE ary, long offset)
static VALUE vm_backtrace_to_ary(rb_thread_t *th, int argc, VALUE *argv, int lev_default, int lev_plus, int to_str)
void rb_bug(const char *fmt,...)
VALUE vm_backtrace_location_ary(rb_thread_t *th, long lev, long n)
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)
void rb_undef_alloc_func(VALUE)
#define RUBY_VM_NORMAL_ISEQ_P(ptr)
static rb_backtrace_location_t * location_ptr(VALUE locobj)
static int calc_lineno(const rb_iseq_t *iseq, const VALUE *pc)
static VALUE location_base_label_m(VALUE self)
VALUE rb_make_backtrace(void)
VALUE rb_ary_push(VALUE ary, VALUE item)
SSL_METHOD *(* func)(void)
rb_encoding * rb_enc_compatible(VALUE str1, VALUE str2)
static VALUE location_label_m(VALUE self)
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)
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)
void rb_define_global_function(const char *name, VALUE(*func)(ANYARGS), int argc)
Defines a global function.
struct rb_backtrace_location_struct::@123::@125 cfunc
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)
VALUE vm_thread_backtrace(int argc, VALUE *argv, VALUE thval)
int rb_vm_control_frame_id_and_class(const rb_control_frame_t *cfp, ID *idp, VALUE *klassp)
#define RB_TYPE_P(obj, type)
static VALUE location_absolute_path(rb_backtrace_location_t *loc)
static VALUE rb_cBacktraceLocation
VALUE rb_debug_inspector_backtrace_locations(const rb_debug_inspector_t *dc)
RUBY_EXTERN VALUE rb_cObject
static VALUE location_path_m(VALUE self)
static VALUE thread_backtrace_to_ary(int argc, VALUE *argv, VALUE thval, int to_str)
int rb_typeddata_is_kind_of(VALUE obj, const rb_data_type_t *data_type)
rb_backtrace_location_t * loc
VALUE rb_binding_new_with_cfp(rb_thread_t *th, const rb_control_frame_t *src_cfp)
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)
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)
static void collect_caller_bindings_cfunc(void *arg, const rb_control_frame_t *cfp, ID mid)
union rb_backtrace_location_struct::@123 body
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)
VALUE vm_backtrace_str_ary(rb_thread_t *th, long lev, long n)
#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)
rb_backtrace_location_t * backtrace
static VALUE location_format(VALUE file, int lineno, VALUE name)
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)
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
VALUE vm_thread_backtrace_locations(int argc, VALUE *argv, VALUE thval)
#define UNINITIALIZED_VAR(x)
void rb_backtrace_print_as_bugreport(void)
static void vm_backtrace_print(FILE *fp)
rb_iseq_location_t location
static VALUE rb_f_caller(int argc, VALUE *argv)
static VALUE location_lineno_m(VALUE self)
#define RUBY_VM_END_CONTROL_FRAME(th)
enum rb_thread_status status
void * ruby_xmalloc(size_t size)
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)
struct rb_backtrace_location_struct * prev_loc
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))
#define TypedData_Make_Struct(klass, type, data_type, sval)
static void backtrace_free(void *ptr)
VALUE rb_str_inspect(VALUE)
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_ary_new2(long capa)
enum rb_backtrace_location_struct::LOCATION_TYPE type
static VALUE backtrace_alloc(VALUE klass)
struct rb_backtrace_struct rb_backtrace_t
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)
static VALUE get_klass(const rb_control_frame_t *cfp)
rb_backtrace_location_t * backtrace_base
static size_t location_memsize(const void *ptr)
rb_backtrace_location_t * prev_loc
static void location_free(void *ptr)
static const rb_data_type_t backtrace_data_type
static VALUE backtrace_dump_data(VALUE self)
static VALUE location_label(rb_backtrace_location_t *loc)
static rb_thread_t * GET_THREAD(void)
void rb_define_method(VALUE klass, const char *name, VALUE(*func)(ANYARGS), int argc)
static VALUE rb_cBacktrace
static size_t backtrace_memsize(const void *ptr)
static void backtrace_mark(void *ptr)