#include "ruby/ruby.h" #include "ruby/debug.h" #include "ruby/encoding.h" #include "debug_version.h" // static VALUE rb_mDebugger; // iseq typedef struct rb_iseq_struct rb_iseq_t; VALUE rb_iseq_realpath(const rb_iseq_t *iseq); static VALUE iseq_realpath(VALUE iseqw) { rb_iseq_t *iseq = DATA_PTR(iseqw); return rb_iseq_realpath(iseq); } static VALUE rb_cFrameInfo; static VALUE di_entry(VALUE loc, VALUE self, VALUE binding, VALUE iseq, VALUE klass, VALUE depth) { return rb_struct_new(rb_cFrameInfo, // :location, :self, :binding, :iseq, :class, :frame_depth, loc, self, binding, iseq, klass, depth, // :has_return_value, :return_value, Qnil, Qnil, // :has_raised_exception, :raised_exception, Qnil, Qnil, // :show_line, :local_variables Qnil, // :_local_variables, :_callee # for recorder Qnil, Qnil, // :dupped_binding Qnil ); } static int str_start_with(VALUE str, VALUE prefix) { StringValue(prefix); rb_enc_check(str, prefix); if (RSTRING_LEN(str) >= RSTRING_LEN(prefix) && memcmp(RSTRING_PTR(str), RSTRING_PTR(prefix), RSTRING_LEN(prefix)) == 0) { return 1; } else { return 0; } } static VALUE di_body(const rb_debug_inspector_t *dc, void *ptr) { VALUE skip_path_prefix = (VALUE)ptr; VALUE locs = rb_debug_inspector_backtrace_locations(dc); VALUE ary = rb_ary_new(); long len = RARRAY_LEN(locs); long i; for (i=1; i