Ruby
2.0.0p451(2014-02-24revision45167)
|
#include "ruby/ruby.h"
#include "ruby/debug.h"
#include "ruby/encoding.h"
#include "internal.h"
#include "vm_core.h"
#include "eval_intern.h"
Go to the source code of this file.
Data Structures | |
struct | rb_event_hook_struct |
struct | rb_tp_struct |
Macros | |
#define | MAX_EVENT_NUM 32 |
#define | C(name, NAME) case RUBY_EVENT_##NAME: CONST_ID(id, #name); return id; |
#define | C(name, NAME) CONST_ID(id, #name); if (sym == ID2SYM(id)) return RUBY_EVENT_##NAME |
Typedefs | |
typedef struct rb_event_hook_struct | rb_event_hook_t |
typedef void(* | rb_event_hook_raw_arg_func_t )(VALUE data, const rb_trace_arg_t *arg) |
typedef struct rb_tp_struct | rb_tp_t |
Variables | |
static int | ruby_event_flag_count [MAX_EVENT_NUM] = {0} |
static VALUE | rb_cTracePoint |
static const rb_data_type_t | tp_data_type |
Referenced by get_event_id(), and symbol2event_flag().
#define MAX_EVENT_NUM 32 |
Definition at line 44 of file vm_trace.c.
Referenced by recalc_add_ruby_vm_event_flags(), and recalc_remove_ruby_vm_event_flags().
typedef void(* rb_event_hook_raw_arg_func_t)(VALUE data, const rb_trace_arg_t *arg) |
Definition at line 42 of file vm_trace.c.
typedef struct rb_event_hook_struct rb_event_hook_t |
typedef struct rb_tp_struct rb_tp_t |
|
static |
Definition at line 102 of file vm_trace.c.
References ALLOC, rb_event_hook_struct::data, rb_event_hook_struct::events, rb_event_hook_struct::func, func, and rb_event_hook_struct::hook_flags.
Referenced by rb_add_event_hook(), rb_add_event_hook2(), and rb_threadptr_add_event_hook().
|
static |
Definition at line 564 of file vm_trace.c.
References argv, FL_SINGLETON, FL_TEST, get_event_name(), GET_THREAD(), ID2SYM, INT2FIX, Qnil, rb_binding_new(), rb_iv_get(), rb_proc_call_with_block(), rb_sourcefile, rb_sourceline(), rb_str_new2, rb_thread_method_id_and_class(), RB_TYPE_P, RBASIC, and T_ICLASS.
Referenced by set_trace_func(), thread_add_trace_func(), and thread_set_trace_func_m().
|
static |
Definition at line 224 of file vm_trace.c.
References rb_event_hook_struct::events, rb_hook_list_struct::events, rb_event_hook_struct::hook_flags, rb_hook_list_struct::hooks, rb_hook_list_struct::need_clean, rb_event_hook_struct::next, recalc_remove_ruby_vm_event_flags(), RUBY_EVENT_HOOK_FLAG_DELETED, and xfree.
Referenced by exec_hooks().
Definition at line 206 of file vm_trace.c.
References GetThreadPtr, Qundef, rb_threadptr_remove_event_hook(), and ST_CONTINUE.
Referenced by rb_clear_trace_func().
|
static |
Definition at line 113 of file vm_trace.c.
References rb_event_hook_struct::events, rb_hook_list_struct::events, rb_hook_list_struct::hooks, rb_event_hook_struct::next, and recalc_add_ruby_vm_event_flags().
Referenced by rb_add_event_hook(), rb_add_event_hook2(), and rb_threadptr_add_event_hook().
|
static |
Definition at line 245 of file vm_trace.c.
References clean_hooks(), rb_event_hook_struct::data, rb_trace_arg_struct::event, rb_event_hook_struct::events, rb_event_hook_struct::func, rb_event_hook_struct::hook_flags, rb_hook_list_struct::hooks, rb_trace_arg_struct::id, rb_trace_arg_struct::klass, LIKELY, rb_hook_list_struct::need_clean, rb_event_hook_struct::next, rb_threadptr_reset_raised(), rb_threadptr_set_raised(), RUBY_EVENT_HOOK_FLAG_DELETED, RUBY_EVENT_HOOK_FLAG_RAW_ARG, rb_trace_arg_struct::self, TH_EXEC_TAG, TH_POP_TAG, TH_PUSH_TAG, and UNLIKELY.
Referenced by rb_threadptr_exec_event_hooks_orig().
|
static |
Definition at line 729 of file vm_trace.c.
References rb_trace_arg_struct::cfp, rb_trace_arg_struct::id, rb_trace_arg_struct::klass, rb_trace_arg_struct::klass_solved, Qnil, RB_TYPE_P, rb_vm_control_frame_id_and_class(), RBASIC, and T_ICLASS.
Referenced by rb_tracearg_defined_class(), and rb_tracearg_method_id().
|
static |
Definition at line 699 of file vm_trace.c.
References rb_trace_arg_struct::cfp, rb_control_frame_struct::iseq, rb_trace_arg_struct::lineno, rb_iseq_struct::location, rb_iseq_location_struct::path, rb_trace_arg_struct::path, Qnil, Qundef, rb_vm_get_ruby_level_next_cfp(), rb_vm_get_sourceline(), and rb_trace_arg_struct::th.
Referenced by rb_tracearg_lineno(), and rb_tracearg_path().
|
static |
Definition at line 537 of file vm_trace.c.
References C, CALL, CONST_ID, END, id, RETURN, RUBY_EVENT_LINE, and RUBY_EVENT_SPECIFIED_LINE.
Referenced by rb_tracearg_event().
|
static |
Definition at line 520 of file vm_trace.c.
References RUBY_EVENT_C_CALL, RUBY_EVENT_C_RETURN, RUBY_EVENT_CALL, RUBY_EVENT_CLASS, RUBY_EVENT_END, RUBY_EVENT_LINE, RUBY_EVENT_RAISE, and RUBY_EVENT_RETURN.
Referenced by call_trace_func().
|
static |
Definition at line 677 of file vm_trace.c.
References GET_THREAD(), rb_eRuntimeError, rb_raise(), and rb_thread_struct::trace_arg.
Referenced by rb_tracearg_from_tracepoint(), tracepoint_attr_binding(), tracepoint_attr_defined_class(), tracepoint_attr_event(), tracepoint_attr_lineno(), tracepoint_attr_method_id(), tracepoint_attr_path(), tracepoint_attr_raised_exception(), tracepoint_attr_return_value(), and tracepoint_attr_self().
void Init_vm_trace | ( | void | ) |
Definition at line 1262 of file vm_trace.c.
References CLASS_OF, rb_cObject, rb_cThread, rb_define_class(), rb_define_global_function(), rb_define_method(), rb_define_singleton_method(), rb_tracepoint_enabled_p(), rb_undef_alloc_func(), rb_undef_method(), set_trace_func(), thread_add_trace_func_m(), thread_set_trace_func_m(), tracepoint_attr_binding(), tracepoint_attr_defined_class(), tracepoint_attr_event(), tracepoint_attr_lineno(), tracepoint_attr_method_id(), tracepoint_attr_path(), tracepoint_attr_raised_exception(), tracepoint_attr_return_value(), tracepoint_attr_self(), tracepoint_disable_m(), tracepoint_enable_m(), tracepoint_inspect(), tracepoint_new_s(), and tracepoint_trace_s().
void rb_add_event_hook | ( | rb_event_hook_func_t | func, |
rb_event_flag_t | events, | ||
VALUE | data | ||
) |
Definition at line 135 of file vm_trace.c.
References alloc_event_hook(), connect_event_hook(), GET_VM, and RUBY_EVENT_HOOK_FLAG_SAFE.
Referenced by ole_initialize(), rb_set_coverages(), and set_trace_func().
void rb_add_event_hook2 | ( | rb_event_hook_func_t | func, |
rb_event_flag_t | events, | ||
VALUE | data, | ||
rb_event_hook_flag_t | hook_flags | ||
) |
Definition at line 148 of file vm_trace.c.
References alloc_event_hook(), connect_event_hook(), and GET_VM.
Referenced by rb_tracepoint_enable().
void rb_clear_trace_func | ( | void | ) |
Definition at line 215 of file vm_trace.c.
References clear_trace_func_i(), GET_VM, rb_remove_event_hook(), and st_foreach().
Referenced by ruby_finalize_0(), and ruby_options().
int rb_remove_event_hook | ( | rb_event_hook_func_t | func | ) |
Definition at line 194 of file vm_trace.c.
References GET_VM, Qundef, and remove_event_hook().
Referenced by rb_clear_trace_func(), rb_reset_coverages(), and set_trace_func().
int rb_remove_event_hook_with_data | ( | rb_event_hook_func_t | func, |
VALUE | data | ||
) |
Definition at line 200 of file vm_trace.c.
References GET_VM, and remove_event_hook().
Referenced by rb_tracepoint_disable().
Definition at line 345 of file vm_trace.c.
References arg, GET_THREAD(), JUMP_TAG, Qnil, rb_threadptr_reset_raised(), rb_threadptr_set_raised(), result, rb_thread_struct::state, TH_EXEC_TAG, TH_POP_TAG, TH_PUSH_TAG, rb_thread_struct::trace_arg, rb_vm_struct::trace_running, and rb_thread_struct::vm.
Referenced by yycompile().
void rb_thread_add_event_hook | ( | VALUE | thval, |
rb_event_hook_func_t | func, | ||
rb_event_flag_t | events, | ||
VALUE | data | ||
) |
Definition at line 129 of file vm_trace.c.
References rb_threadptr_add_event_hook(), RUBY_EVENT_HOOK_FLAG_SAFE, and thval2thread_t().
void rb_thread_add_event_hook2 | ( | VALUE | thval, |
rb_event_hook_func_t | func, | ||
rb_event_flag_t | events, | ||
VALUE | data, | ||
rb_event_hook_flag_t | hook_flags | ||
) |
Definition at line 142 of file vm_trace.c.
References rb_threadptr_add_event_hook(), and thval2thread_t().
Referenced by rb_tracepoint_enable().
int rb_thread_remove_event_hook | ( | VALUE | thval, |
rb_event_hook_func_t | func | ||
) |
Definition at line 182 of file vm_trace.c.
References Qundef, rb_threadptr_remove_event_hook(), and thval2thread_t().
int rb_thread_remove_event_hook_with_data | ( | VALUE | thval, |
rb_event_hook_func_t | func, | ||
VALUE | data | ||
) |
Definition at line 188 of file vm_trace.c.
References rb_threadptr_remove_event_hook(), and thval2thread_t().
Referenced by rb_tracepoint_disable().
|
static |
Definition at line 122 of file vm_trace.c.
References alloc_event_hook(), connect_event_hook(), and rb_thread_struct::event_hooks.
Referenced by rb_thread_add_event_hook(), rb_thread_add_event_hook2(), and thread_add_trace_func().
void rb_threadptr_exec_event_hooks | ( | rb_trace_arg_t * | trace_arg | ) |
Definition at line 339 of file vm_trace.c.
References rb_threadptr_exec_event_hooks_orig().
void rb_threadptr_exec_event_hooks_and_pop_frame | ( | rb_trace_arg_t * | trace_arg | ) |
Definition at line 333 of file vm_trace.c.
References rb_threadptr_exec_event_hooks_orig().
|
static |
Definition at line 283 of file vm_trace.c.
References rb_thread_struct::cfp, rb_thread_struct::errinfo, rb_trace_arg_struct::event, rb_vm_struct::event_hooks, rb_thread_struct::event_hooks, rb_hook_list_struct::events, exec_hooks(), list, rb_vm_tag::prev, Qnil, rb_mRubyVMFrozenCore, RUBY_VM_PREVIOUS_CONTROL_FRAME, rb_trace_arg_struct::self, rb_thread_struct::state, rb_thread_struct::tag, rb_trace_arg_struct::th, TH_JUMP_TAG, rb_thread_struct::trace_arg, rb_vm_struct::trace_running, TRUE, rb_thread_struct::vm, and VM_FRAME_TYPE_FINISH_P.
Referenced by rb_threadptr_exec_event_hooks(), and rb_threadptr_exec_event_hooks_and_pop_frame().
|
static |
Definition at line 176 of file vm_trace.c.
References rb_thread_struct::event_hooks, and remove_event_hook().
Referenced by clear_trace_func_i(), rb_thread_remove_event_hook(), rb_thread_remove_event_hook_with_data(), and thread_set_trace_func_m().
VALUE rb_tracearg_binding | ( | rb_trace_arg_t * | trace_arg | ) |
Definition at line 764 of file vm_trace.c.
References rb_trace_arg_struct::cfp, Qnil, rb_binding_new_with_cfp(), rb_vm_get_binding_creatable_next_cfp(), and rb_trace_arg_struct::th.
Referenced by tracepoint_attr_binding().
VALUE rb_tracearg_defined_class | ( | rb_trace_arg_t * | trace_arg | ) |
Definition at line 757 of file vm_trace.c.
References fill_id_and_klass(), and rb_trace_arg_struct::klass.
Referenced by tracepoint_attr_defined_class().
VALUE rb_tracearg_event | ( | rb_trace_arg_t * | trace_arg | ) |
Definition at line 693 of file vm_trace.c.
References rb_trace_arg_struct::event, get_event_id(), and ID2SYM.
Referenced by tracepoint_attr_event(), and tracepoint_inspect().
struct rb_trace_arg_struct* rb_tracearg_from_tracepoint | ( | VALUE | tpval | ) |
Definition at line 687 of file vm_trace.c.
References get_trace_arg().
VALUE rb_tracearg_lineno | ( | rb_trace_arg_t * | trace_arg | ) |
Definition at line 716 of file vm_trace.c.
References fill_path_and_lineno(), INT2FIX, and rb_trace_arg_struct::lineno.
Referenced by tracepoint_attr_lineno(), and tracepoint_inspect().
VALUE rb_tracearg_method_id | ( | rb_trace_arg_t * | trace_arg | ) |
Definition at line 750 of file vm_trace.c.
References fill_id_and_klass(), rb_trace_arg_struct::id, ID2SYM, and Qnil.
Referenced by tracepoint_attr_method_id(), and tracepoint_inspect().
VALUE rb_tracearg_path | ( | rb_trace_arg_t * | trace_arg | ) |
Definition at line 722 of file vm_trace.c.
References fill_path_and_lineno(), and rb_trace_arg_struct::path.
Referenced by tracepoint_attr_path(), and tracepoint_inspect().
VALUE rb_tracearg_raised_exception | ( | rb_trace_arg_t * | trace_arg | ) |
Definition at line 799 of file vm_trace.c.
References rb_trace_arg_struct::data, rb_trace_arg_struct::event, Qundef, rb_bug(), rb_eRuntimeError, rb_raise(), and RUBY_EVENT_RAISE.
Referenced by tracepoint_attr_raised_exception().
VALUE rb_tracearg_return_value | ( | rb_trace_arg_t * | trace_arg | ) |
Definition at line 784 of file vm_trace.c.
References rb_trace_arg_struct::data, rb_trace_arg_struct::event, Qundef, rb_bug(), rb_eRuntimeError, rb_raise(), RUBY_EVENT_B_RETURN, RUBY_EVENT_C_RETURN, and RUBY_EVENT_RETURN.
Referenced by tracepoint_attr_return_value().
VALUE rb_tracearg_self | ( | rb_trace_arg_t * | trace_arg | ) |
Definition at line 778 of file vm_trace.c.
References rb_trace_arg_struct::self.
Referenced by tracepoint_attr_self(), and tracepoint_inspect().
Definition at line 964 of file vm_trace.c.
References Qundef, rb_remove_event_hook_with_data(), rb_secure(), rb_thread_remove_event_hook_with_data(), rb_thread_struct::self, rb_tp_struct::target_th, tp_call_trace(), tpptr(), and rb_tp_struct::tracing.
Referenced by tracepoint_disable_m(), and tracepoint_enable_m().
Definition at line 944 of file vm_trace.c.
References rb_tp_struct::events, Qundef, rb_add_event_hook2(), rb_secure(), rb_thread_add_event_hook2(), RUBY_EVENT_HOOK_FLAG_RAW_ARG, RUBY_EVENT_HOOK_FLAG_SAFE, rb_thread_struct::self, rb_tp_struct::target_th, tp_call_trace(), tpptr(), and rb_tp_struct::tracing.
Referenced by tracepoint_disable_m(), tracepoint_enable_m(), and tracepoint_trace_s().
Definition at line 1093 of file vm_trace.c.
References Qfalse, Qtrue, tpptr(), and rb_tp_struct::tracing.
Referenced by Init_vm_trace().
VALUE rb_tracepoint_new | ( | VALUE | target_thval, |
rb_event_flag_t | events, | ||
void(*)(VALUE, void *) | func, | ||
void * | data | ||
) |
Definition at line 1116 of file vm_trace.c.
References func, GetThreadPtr, Qundef, RTEST, and tracepoint_new().
|
static |
Definition at line 64 of file vm_trace.c.
References i, MAX_EVENT_NUM, ruby_event_flag_count, and ruby_vm_event_flags.
Referenced by connect_event_hook().
|
static |
Definition at line 78 of file vm_trace.c.
References i, MAX_EVENT_NUM, ruby_event_flag_count, and ruby_vm_event_flags.
Referenced by clean_hooks().
|
static |
Definition at line 156 of file vm_trace.c.
References rb_event_hook_struct::data, rb_event_hook_struct::func, rb_event_hook_struct::hook_flags, rb_hook_list_struct::hooks, rb_hook_list_struct::need_clean, rb_event_hook_struct::next, Qundef, and RUBY_EVENT_HOOK_FLAG_DELETED.
Referenced by rb_remove_event_hook(), rb_remove_event_hook_with_data(), and rb_threadptr_remove_event_hook().
Definition at line 445 of file vm_trace.c.
References call_trace_func(), NIL_P, Qnil, rb_add_event_hook(), rb_eTypeError, rb_obj_is_proc(), rb_raise(), rb_remove_event_hook(), rb_secure(), and RUBY_EVENT_ALL.
Referenced by Init_vm_trace().
|
static |
Definition at line 645 of file vm_trace.c.
References C, CALL, END, id, rb_convert_type(), rb_eArgError, rb_id2name(), rb_raise(), RETURN, sym, SYM2ID, and T_SYMBOL.
Referenced by tracepoint_new_s().
|
static |
Definition at line 464 of file vm_trace.c.
References call_trace_func(), rb_eTypeError, rb_obj_is_proc(), rb_raise(), rb_threadptr_add_event_hook(), RUBY_EVENT_ALL, and RUBY_EVENT_HOOK_FLAG_SAFE.
Referenced by thread_add_trace_func_m(), and thread_set_trace_func_m().
Definition at line 482 of file vm_trace.c.
References GetThreadPtr, rb_secure(), and thread_add_trace_func().
Referenced by Init_vm_trace().
Definition at line 503 of file vm_trace.c.
References call_trace_func(), GetThreadPtr, NIL_P, Qnil, Qundef, rb_secure(), rb_threadptr_remove_event_hook(), and thread_add_trace_func().
Referenced by Init_vm_trace().
|
static |
Definition at line 94 of file vm_trace.c.
References GetThreadPtr.
Referenced by rb_thread_add_event_hook(), rb_thread_add_event_hook2(), rb_thread_remove_event_hook(), and rb_thread_remove_event_hook_with_data().
Definition at line 638 of file vm_trace.c.
References TypedData_Make_Struct.
Referenced by tracepoint_new().
|
static |
Definition at line 931 of file vm_trace.c.
References rb_tp_struct::data, rb_tp_struct::func, rb_tp_struct::proc, Qnil, rb_proc_call_with_block(), and tpptr().
Referenced by rb_tracepoint_disable(), and rb_tracepoint_enable().
|
static |
Definition at line 621 of file vm_trace.c.
|
static |
Definition at line 611 of file vm_trace.c.
References rb_tp_struct::proc, rb_gc_mark(), rb_thread_struct::self, and rb_tp_struct::target_th.
|
static |
Definition at line 627 of file vm_trace.c.
Definition at line 669 of file vm_trace.c.
References TypedData_Get_Struct.
Referenced by rb_tracepoint_disable(), rb_tracepoint_enable(), rb_tracepoint_enabled_p(), tp_call_trace(), tracepoint_disable_m(), tracepoint_enable_m(), and tracepoint_inspect().
Definition at line 895 of file vm_trace.c.
References get_trace_arg(), and rb_tracearg_binding().
Referenced by Init_vm_trace().
Definition at line 886 of file vm_trace.c.
References get_trace_arg(), and rb_tracearg_defined_class().
Referenced by Init_vm_trace().
Definition at line 819 of file vm_trace.c.
References get_trace_arg(), and rb_tracearg_event().
Referenced by Init_vm_trace().
Definition at line 828 of file vm_trace.c.
References get_trace_arg(), and rb_tracearg_lineno().
Referenced by Init_vm_trace().
Definition at line 846 of file vm_trace.c.
References get_trace_arg(), and rb_tracearg_method_id().
Referenced by Init_vm_trace().
Definition at line 837 of file vm_trace.c.
References get_trace_arg(), and rb_tracearg_path().
Referenced by Init_vm_trace().
Definition at line 925 of file vm_trace.c.
References get_trace_arg(), and rb_tracearg_raised_exception().
Referenced by Init_vm_trace().
Definition at line 916 of file vm_trace.c.
References get_trace_arg(), and rb_tracearg_return_value().
Referenced by Init_vm_trace().
Definition at line 907 of file vm_trace.c.
References get_trace_arg(), and rb_tracearg_self().
Referenced by Init_vm_trace().
Definition at line 1070 of file vm_trace.c.
References Qfalse, Qnil, Qtrue, rb_block_given_p(), rb_ensure(), rb_tracepoint_disable(), rb_tracepoint_enable(), rb_yield(), tpptr(), and rb_tp_struct::tracing.
Referenced by Init_vm_trace().
Definition at line 1019 of file vm_trace.c.
References Qfalse, Qnil, Qtrue, rb_block_given_p(), rb_ensure(), rb_tracepoint_disable(), rb_tracepoint_enable(), rb_yield(), tpptr(), and rb_tp_struct::tracing.
Referenced by Init_vm_trace().
Definition at line 1214 of file vm_trace.c.
References default_inspect(), rb_trace_arg_struct::event, FIX2INT, GET_THREAD(), NIL_P, PRIsVALUE, rb_sprintf(), rb_tracearg_event(), rb_tracearg_lineno(), rb_tracearg_method_id(), rb_tracearg_path(), rb_tracearg_self(), RUBY_EVENT_C_CALL, RUBY_EVENT_C_RETURN, RUBY_EVENT_CALL, RUBY_EVENT_LINE, RUBY_EVENT_RETURN, RUBY_EVENT_SPECIFIED_LINE, RUBY_EVENT_THREAD_BEGIN, RUBY_EVENT_THREAD_END, sym, tpptr(), rb_thread_struct::trace_arg, and rb_tp_struct::tracing.
Referenced by Init_vm_trace().
|
static |
Definition at line 1100 of file vm_trace.c.
References rb_tp_struct::data, rb_trace_arg_struct::data, rb_tp_struct::events, func, rb_tp_struct::func, rb_tp_struct::proc, rb_tp_struct::self, tp_alloc(), and TypedData_Get_Struct.
Referenced by rb_tracepoint_new(), and tracepoint_new_s().
Definition at line 1176 of file vm_trace.c.
References argc, i, rb_block_given_p(), rb_block_proc(), rb_eThreadError, rb_raise(), RUBY_EVENT_TRACEPOINT_ALL, symbol2event_flag(), and tracepoint_new().
Referenced by Init_vm_trace(), and tracepoint_trace_s().
Definition at line 1198 of file vm_trace.c.
References rb_tracepoint_enable(), and tracepoint_new_s().
Referenced by Init_vm_trace().
void vm_trace_mark_event_hooks | ( | rb_hook_list_t * | hooks | ) |
Definition at line 51 of file vm_trace.c.
References rb_event_hook_struct::data, rb_hook_list_struct::hooks, rb_event_hook_struct::next, and rb_gc_mark().
Referenced by rb_thread_mark(), and rb_vm_mark().
|
static |
Definition at line 598 of file vm_trace.c.
|
static |
Definition at line 46 of file vm_trace.c.
Referenced by recalc_add_ruby_vm_event_flags(), and recalc_remove_ruby_vm_event_flags().
|
static |
Definition at line 632 of file vm_trace.c.