85 case LOCATION_TYPE_ISEQ:
86 case LOCATION_TYPE_ISEQ_CALCED:
89 case LOCATION_TYPE_CFUNC:
90 case LOCATION_TYPE_IFUNC:
130 case LOCATION_TYPE_ISEQ:
131 loc->
type = LOCATION_TYPE_ISEQ_CALCED;
133 case LOCATION_TYPE_ISEQ_CALCED:
134 return loc->
body.
iseq.lineno.lineno;
135 case LOCATION_TYPE_CFUNC:
141 rb_bug(
"location_lineno: unreachable");
164 case LOCATION_TYPE_ISEQ:
165 case LOCATION_TYPE_ISEQ_CALCED:
167 case LOCATION_TYPE_CFUNC:
169 case LOCATION_TYPE_IFUNC:
171 rb_bug(
"location_label: unreachable");
213 case LOCATION_TYPE_ISEQ:
214 case LOCATION_TYPE_ISEQ_CALCED:
216 case LOCATION_TYPE_CFUNC:
218 case LOCATION_TYPE_IFUNC:
220 rb_bug(
"location_base_label: unreachable");
240 case LOCATION_TYPE_ISEQ:
241 case LOCATION_TYPE_ISEQ_CALCED:
243 case LOCATION_TYPE_CFUNC:
248 case LOCATION_TYPE_IFUNC:
250 rb_bug(
"location_path: unreachable");
273 case LOCATION_TYPE_ISEQ:
274 case LOCATION_TYPE_ISEQ_CALCED:
276 case LOCATION_TYPE_CFUNC:
281 case LOCATION_TYPE_IFUNC:
283 rb_bug(
"location_absolute_path: unreachable");
319 case LOCATION_TYPE_ISEQ:
324 loc->
type = LOCATION_TYPE_ISEQ_CALCED;
326 case LOCATION_TYPE_ISEQ_CALCED:
328 lineno = loc->
body.
iseq.lineno.lineno;
331 case LOCATION_TYPE_CFUNC:
333 file = loc->
body.
cfunc.prev_loc->body.iseq.iseq->location.path;
343 case LOCATION_TYPE_IFUNC:
345 rb_bug(
"location_to_str: unreachable");
385 for (i=0; i<
s; i++) {
432 void (*init)(
void *
arg,
size_t size),
456 if (start_cfp < last_cfp) {
460 size = start_cfp - last_cfp + 1;
474 ID mid = cfp->me->def ? cfp->me->def->original_id : cfp->me->called_id;
476 iter_cfunc(arg, cfp, mid);
504 loc->
type = LOCATION_TYPE_ISEQ;
515 loc->
type = LOCATION_TYPE_CFUNC;
548 rb_bug(
"backtrace_collect: unreachable");
705 (arg->
func)(arg->
data, file, lineno, name);
716 (arg->
func)(arg->
data, file, lineno, name);
725 fprintf(fp,
"\tfrom %s:%d:in unknown method\n",
729 fprintf(fp,
"\tfrom %s:%d:in `%s'\n",
740 arg.
data = (
void *)fp;
753 fprintf(stderr,
"-- Ruby level backtrace information "
754 "----------------------------------------\n");
758 fprintf(stderr,
"%s:%d:in unknown method\n", filename, line);
761 fprintf(stderr,
"%s:%d:in `%s'\n", filename, line,
RSTRING_PTR(method));
772 arg.
data = (
int *)&i;
808 arg.
data = (
void *)output;
835 if (argc == 2 &&
NIL_P(vn)) argc--;
839 lev = lev_default + lev_plus;
857 lev = beg + lev_plus;
1099 return RBASIC(klass)->klass;
1162 if (!
NIL_P(cfp_val)) {
1184 dbg_context.
th =
th;
1185 dbg_context.
cfp = dbg_context.
th->
cfp;
1255 for (i=0; i<limit && cfp != end_cfp;) {
1256 if (cfp->
iseq && cfp->
pc) {
1273 #define frame2iseq(frame) frame
1310 if (klass && !
NIL_P(klass)) {
1312 klass =
RBASIC(klass)->klass;
1348 if (method_name !=
Qnil) {
1352 if (classpath !=
Qnil) {
1354 classpath, singleton_p ==
Qtrue ?
"." :
"#", method_name);
1372 if (
NIL_P(qualified_method_name) || base_label == qualified_method_name) {
static VALUE location_inspect_m(VALUE self)
static VALUE location_create(rb_backtrace_location_t *srcloc, void *btobj)
#define RB_TYPE_P(obj, type)
static VALUE method_name(VALUE obj)
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,...)
void rb_backtrace_print_as_bugreport(void)
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)
#define RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp)
void Init_vm_backtrace(void)
union rb_backtrace_location_struct::@182 body
#define RUBY_VM_NORMAL_ISEQ_P(ptr)
void rb_backtrace_print_to(VALUE output)
static rb_backtrace_location_t * location_ptr(VALUE locobj)
static int calc_lineno(const rb_iseq_t *iseq, const VALUE *pc)
SSL_METHOD *(* func)(void)
VALUE(* rb_debug_inspector_func_t)(const rb_debug_inspector_t *, void *)
static VALUE location_base_label_m(VALUE self)
void rb_define_alloc_func(VALUE, rb_alloc_func_t)
VALUE rb_iseq_method_name(VALUE self)
VALUE rb_debug_inspector_frame_class_get(const rb_debug_inspector_t *dc, long index)
VALUE rb_ary_push(VALUE ary, VALUE item)
rb_encoding * rb_enc_compatible(VALUE str1, VALUE str2)
static VALUE location_label_m(VALUE self)
VALUE rb_profile_frame_label(VALUE frame)
VALUE rb_iseq_first_lineno(VALUE iseqval)
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,...)
VALUE rb_profile_frame_path(VALUE frame)
static VALUE location_to_str(rb_backtrace_location_t *loc)
VALUE rb_obj_class(VALUE)
static void bt_iter_iseq(void *ptr, const rb_control_frame_t *cfp)
VALUE rb_backtrace_to_str_ary(VALUE obj)
static void oldbt_iter_cfunc(void *ptr, const rb_control_frame_t *cfp, ID mid)
VALUE rb_vm_thread_backtrace(int argc, VALUE *argv, VALUE thval)
static VALUE collect_caller_bindings(rb_thread_t *th)
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.
VALUE rb_iseq_absolute_path(VALUE iseqval)
VALUE rb_class_path(VALUE)
void rb_undef_method(VALUE klass, const char *name)
VALUE rb_profile_frame_method_name(VALUE frame)
VALUE rb_ivar_get(VALUE, ID)
VALUE rb_enc_sprintf(rb_encoding *enc, const char *format,...)
static VALUE rb_f_caller_locations(int argc, VALUE *argv)
static unsigned char * output
int rb_vm_control_frame_id_and_class(const rb_control_frame_t *cfp, ID *idp, VALUE *klassp)
VALUE rb_iseq_base_label(VALUE iseqval)
static VALUE location_absolute_path(rb_backtrace_location_t *loc)
VALUE rb_iseq_klass(VALUE iseqval)
static VALUE rb_cBacktraceLocation
RUBY_SYMBOL_EXPORT_BEGIN int rb_profile_frames(int start, int limit, VALUE *buff, int *lines)
VALUE rb_vm_backtrace_location_ary(rb_thread_t *th, long lev, long n)
VALUE rb_profile_frame_first_lineno(VALUE frame)
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)
static VALUE backtrace_object(rb_thread_t *th)
static void bt_init(void *ptr, size_t size)
VALUE rb_str_cat2(VALUE, const char *)
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)
struct rb_backtrace_location_struct::@182::@184 cfunc
#define GC_GUARDED_PTR(p)
VALUE rb_profile_frame_classpath(VALUE frame)
VALUE rb_debug_inspector_frame_self_get(const rb_debug_inspector_t *dc, long index)
static VALUE backtrace_collect(rb_backtrace_t *bt, long lev, long n, VALUE(*func)(rb_backtrace_location_t *, void *arg), void *arg)
VALUE rb_iseq_label(VALUE iseqval)
rb_backtrace_location_t * backtrace
VALUE rb_sprintf(const char *format,...)
static VALUE location_format(VALUE file, int lineno, VALUE name)
VALUE rb_profile_frame_base_label(VALUE frame)
#define RUBY_TYPED_FREE_IMMEDIATELY
#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,...)
#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_backtrace_object(void)
VALUE rb_str_inspect(VALUE)
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)
#define UNINITIALIZED_VAR(x)
#define RUBY_SYMBOL_EXPORT_BEGIN
void rb_undef_alloc_func(VALUE)
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)
void rb_marshal_define_compat(VALUE newclass, VALUE oldclass, VALUE(*dumper)(VALUE), VALUE(*loader)(VALUE, VALUE))
enum rb_thread_status status
void * ruby_xmalloc(size_t size)
const char * rb_class2name(VALUE)
static void location_mark(void *ptr)
static VALUE backtrace_load_data(VALUE self, VALUE str)
VALUE rb_debug_inspector_frame_binding_get(const rb_debug_inspector_t *dc, long index)
static void oldbt_bugreport(void *arg, VALUE file, int line, VALUE method)
static VALUE location_path(rb_backtrace_location_t *loc)
VALUE rb_profile_frame_singleton_method_p(VALUE frame)
static VALUE location_to_str_m(VALUE self)
VALUE rb_profile_frame_qualified_method_name(VALUE frame)
VALUE rb_vm_backtrace_str_ary(rb_thread_t *th, long lev, long n)
struct rb_backtrace_location_struct * prev_loc
#define TypedData_Make_Struct(klass, type, data_type, sval)
VALUE rb_str_catf(VALUE str, const char *format,...)
RUBY_EXTERN VALUE rb_cObject
static void location_mark_entry(rb_backtrace_location_t *fi)
void(* func)(void *data, VALUE file, int lineno, VALUE name)
VALUE rb_make_backtrace(void)
static void backtrace_free(void *ptr)
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_profile_frame_absolute_path(VALUE frame)
int rb_backtrace_p(VALUE obj)
enum rb_backtrace_location_struct::LOCATION_TYPE type
VALUE rb_range_beg_len(VALUE, long *, long *, long, int)
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)
VALUE rb_debug_inspector_backtrace_locations(const rb_debug_inspector_t *dc)
#define frame2iseq(frame)
static void oldbt_print(void *data, VALUE file, int lineno, VALUE name)
VALUE rb_backtrace_to_location_ary(VALUE obj)
#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
VALUE rb_debug_inspector_open(rb_debug_inspector_func_t func, void *data)
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)
VALUE rb_profile_frame_full_label(VALUE frame)
VALUE rb_iseq_path(VALUE iseqval)
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
VALUE rb_vm_thread_backtrace_locations(int argc, VALUE *argv, VALUE thval)
RUBY_EXTERN VALUE rb_cThread
VALUE rb_debug_inspector_frame_iseq_get(const rb_debug_inspector_t *dc, long index)
static void oldbt_print_to(void *data, VALUE file, int lineno, VALUE name)
VALUE rb_io_write(VALUE, VALUE)
static size_t backtrace_memsize(const void *ptr)
static void backtrace_mark(void *ptr)