From 9644ad51b4a63d8db46d7918ec5e89a547236c56 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Tue, 23 May 2017 23:41:12 +0900 Subject: Simplify backtrace mechanism; fix #3633 #3634 #3644 Instead of preserving a backtrace in `mrb_state`, `mrb_exc_set` keeps packed backtrace in an exception object. `#backtrace` unpacks it to an array of strings. --- include/mruby.h | 14 +------------- include/mruby/error.h | 1 - 2 files changed, 1 insertion(+), 14 deletions(-) (limited to 'include') diff --git a/include/mruby.h b/include/mruby.h index 4e2e4ae41..29e8ddc79 100644 --- a/include/mruby.h +++ b/include/mruby.h @@ -152,12 +152,6 @@ struct mrb_context { struct mrb_jmpbuf; -typedef struct { - const char *filename; - int lineno; - mrb_sym method_id; -} mrb_backtrace_entry; - typedef void (*mrb_atexit_func)(struct mrb_state*); #define MRB_STATE_NO_REGEXP 1 @@ -172,15 +166,9 @@ typedef struct mrb_state { struct mrb_context *c; struct mrb_context *root_c; + struct iv_tbl *globals; /* global variable table */ struct RObject *exc; /* exception */ - struct { - struct RObject *exc; - int n; - int n_allocated; - mrb_backtrace_entry *entries; - } backtrace; - struct iv_tbl *globals; /* global variable table */ struct RObject *top_self; struct RClass *object_class; /* Object class */ diff --git a/include/mruby/error.h b/include/mruby/error.h index bb67e7bd8..4f8743b35 100644 --- a/include/mruby/error.h +++ b/include/mruby/error.h @@ -25,7 +25,6 @@ MRB_API void mrb_sys_fail(mrb_state *mrb, const char *mesg); MRB_API mrb_value mrb_exc_new_str(mrb_state *mrb, struct RClass* c, mrb_value str); #define mrb_exc_new_str_lit(mrb, c, lit) mrb_exc_new_str(mrb, c, mrb_str_new_lit(mrb, lit)) MRB_API mrb_value mrb_make_exception(mrb_state *mrb, int argc, const mrb_value *argv); -MRB_API mrb_value mrb_exc_backtrace(mrb_state *mrb, mrb_value exc); MRB_API mrb_value mrb_get_backtrace(mrb_state *mrb); MRB_API mrb_noreturn void mrb_no_method_error(mrb_state *mrb, mrb_sym id, mrb_value args, const char *fmt, ...); -- cgit v1.2.3