Create backtrace location array directly
This commit is contained in:
parent
0b5268afbc
commit
f3b1b645ed
Notes:
git
2019-12-13 20:47:33 +09:00
@ -1980,6 +1980,7 @@ error.$(OBJEXT): {$(VPATH)}config.h
|
|||||||
error.$(OBJEXT): {$(VPATH)}defines.h
|
error.$(OBJEXT): {$(VPATH)}defines.h
|
||||||
error.$(OBJEXT): {$(VPATH)}encoding.h
|
error.$(OBJEXT): {$(VPATH)}encoding.h
|
||||||
error.$(OBJEXT): {$(VPATH)}error.c
|
error.$(OBJEXT): {$(VPATH)}error.c
|
||||||
|
error.$(OBJEXT): {$(VPATH)}eval_intern.h
|
||||||
error.$(OBJEXT): {$(VPATH)}id.h
|
error.$(OBJEXT): {$(VPATH)}id.h
|
||||||
error.$(OBJEXT): {$(VPATH)}intern.h
|
error.$(OBJEXT): {$(VPATH)}intern.h
|
||||||
error.$(OBJEXT): {$(VPATH)}internal.h
|
error.$(OBJEXT): {$(VPATH)}internal.h
|
||||||
|
6
error.c
6
error.c
@ -292,6 +292,7 @@ warning_write(int argc, VALUE *argv, VALUE buf)
|
|||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VALUE rb_ec_backtrace_location_ary(rb_execution_context_t *ec, long lev, long n);
|
||||||
static VALUE
|
static VALUE
|
||||||
rb_warn_m(rb_execution_context_t *ec, VALUE exc, VALUE msgs, VALUE uplevel)
|
rb_warn_m(rb_execution_context_t *ec, VALUE exc, VALUE msgs, VALUE uplevel)
|
||||||
{
|
{
|
||||||
@ -302,14 +303,11 @@ rb_warn_m(rb_execution_context_t *ec, VALUE exc, VALUE msgs, VALUE uplevel)
|
|||||||
if (!NIL_P(ruby_verbose) && argc > 0) {
|
if (!NIL_P(ruby_verbose) && argc > 0) {
|
||||||
VALUE str = argv[0];
|
VALUE str = argv[0];
|
||||||
if (!NIL_P(uplevel)) {
|
if (!NIL_P(uplevel)) {
|
||||||
VALUE args[2];
|
|
||||||
long lev = NUM2LONG(uplevel);
|
long lev = NUM2LONG(uplevel);
|
||||||
if (lev < 0) {
|
if (lev < 0) {
|
||||||
rb_raise(rb_eArgError, "negative level (%ld)", lev);
|
rb_raise(rb_eArgError, "negative level (%ld)", lev);
|
||||||
}
|
}
|
||||||
args[0] = LONG2NUM(lev + 1);
|
location = rb_ec_backtrace_location_ary(ec, lev + 1, 1);
|
||||||
args[1] = INT2FIX(1);
|
|
||||||
location = rb_vm_thread_backtrace_locations(2, args, GET_THREAD()->self);
|
|
||||||
if (!NIL_P(location)) {
|
if (!NIL_P(location)) {
|
||||||
location = rb_ary_entry(location, 0);
|
location = rb_ary_entry(location, 0);
|
||||||
}
|
}
|
||||||
|
@ -287,6 +287,7 @@ VALUE rb_vm_cbase(void);
|
|||||||
/* vm_backtrace.c */
|
/* vm_backtrace.c */
|
||||||
VALUE rb_ec_backtrace_object(const rb_execution_context_t *ec);
|
VALUE rb_ec_backtrace_object(const rb_execution_context_t *ec);
|
||||||
VALUE rb_ec_backtrace_str_ary(const rb_execution_context_t *ec, long lev, long n);
|
VALUE rb_ec_backtrace_str_ary(const rb_execution_context_t *ec, long lev, long n);
|
||||||
|
VALUE rb_ec_backtrace_location_ary(const rb_execution_context_t *ec, long lev, long n);
|
||||||
|
|
||||||
#ifndef CharNext /* defined as CharNext[AW] on Windows. */
|
#ifndef CharNext /* defined as CharNext[AW] on Windows. */
|
||||||
# ifdef HAVE_MBLEN
|
# ifdef HAVE_MBLEN
|
||||||
|
@ -716,8 +716,8 @@ rb_ec_backtrace_str_ary(const rb_execution_context_t *ec, long lev, long n)
|
|||||||
return backtrace_to_str_ary(rb_ec_backtrace_object(ec), lev, n);
|
return backtrace_to_str_ary(rb_ec_backtrace_object(ec), lev, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
VALUE
|
||||||
ec_backtrace_location_ary(const rb_execution_context_t *ec, long lev, long n)
|
rb_ec_backtrace_location_ary(const rb_execution_context_t *ec, long lev, long n)
|
||||||
{
|
{
|
||||||
return backtrace_to_location_ary(rb_ec_backtrace_object(ec), lev, n);
|
return backtrace_to_location_ary(rb_ec_backtrace_object(ec), lev, n);
|
||||||
}
|
}
|
||||||
@ -1240,7 +1240,7 @@ rb_debug_inspector_open(rb_debug_inspector_func_t func, void *data)
|
|||||||
|
|
||||||
dbg_context.ec = ec;
|
dbg_context.ec = ec;
|
||||||
dbg_context.cfp = dbg_context.ec->cfp;
|
dbg_context.cfp = dbg_context.ec->cfp;
|
||||||
dbg_context.backtrace = ec_backtrace_location_ary(ec, 0, 0);
|
dbg_context.backtrace = rb_ec_backtrace_location_ary(ec, 0, 0);
|
||||||
dbg_context.backtrace_size = RARRAY_LEN(dbg_context.backtrace);
|
dbg_context.backtrace_size = RARRAY_LEN(dbg_context.backtrace);
|
||||||
dbg_context.contexts = collect_caller_bindings(ec);
|
dbg_context.contexts = collect_caller_bindings(ec);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user