vm_trace.c File Reference

#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
struct  rb_postponed_job_struct

Defines

#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
#define MAX_POSTPONED_JOB   1000
#define MAX_POSTPONED_JOB_SPECIAL_ADDITION   24

Typedefs

typedef 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 rb_tp_struct rb_tp_t
typedef rb_postponed_job_struct rb_postponed_job_t

Enumerations

enum  postponed_job_register_result { PJRR_SUCESS = 0, PJRR_FULL = 1, PJRR_INTERRUPTED = 2 }

Functions

void rb_vm_trace_mark_event_hooks (rb_hook_list_t *hooks)
static void recalc_add_ruby_vm_event_flags (rb_event_flag_t events)
static void recalc_remove_ruby_vm_event_flags (rb_event_flag_t events)
static rb_thread_tthval2thread_t (VALUE thval)
static rb_event_hook_talloc_event_hook (rb_event_hook_func_t func, rb_event_flag_t events, VALUE data, rb_event_hook_flag_t hook_flags)
static void connect_event_hook (rb_hook_list_t *list, rb_event_hook_t *hook)
static void rb_threadptr_add_event_hook (rb_thread_t *th, rb_event_hook_func_t func, rb_event_flag_t events, VALUE data, rb_event_hook_flag_t hook_flags)
void rb_thread_add_event_hook (VALUE thval, rb_event_hook_func_t func, rb_event_flag_t events, VALUE data)
void rb_add_event_hook (rb_event_hook_func_t func, rb_event_flag_t events, VALUE data)
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)
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)
static int remove_event_hook (rb_hook_list_t *list, rb_event_hook_func_t func, VALUE data)
static int rb_threadptr_remove_event_hook (rb_thread_t *th, rb_event_hook_func_t func, VALUE data)
int rb_thread_remove_event_hook (VALUE thval, rb_event_hook_func_t func)
int rb_thread_remove_event_hook_with_data (VALUE thval, rb_event_hook_func_t func, VALUE data)
int rb_remove_event_hook (rb_event_hook_func_t func)
int rb_remove_event_hook_with_data (rb_event_hook_func_t func, VALUE data)
static int clear_trace_func_i (st_data_t key, st_data_t val, st_data_t flag)
void rb_clear_trace_func (void)
static void clean_hooks (rb_hook_list_t *list)
static void exec_hooks_body (rb_thread_t *th, rb_hook_list_t *list, const rb_trace_arg_t *trace_arg)
static int exec_hooks_precheck (rb_thread_t *th, rb_hook_list_t *list, const rb_trace_arg_t *trace_arg)
static void exec_hooks_unprotected (rb_thread_t *th, rb_hook_list_t *list, const rb_trace_arg_t *trace_arg)
static int exec_hooks_protected (rb_thread_t *th, rb_hook_list_t *list, const rb_trace_arg_t *trace_arg)
static void rb_threadptr_exec_event_hooks_orig (rb_trace_arg_t *trace_arg, int pop_p)
void rb_threadptr_exec_event_hooks_and_pop_frame (rb_trace_arg_t *trace_arg)
void rb_threadptr_exec_event_hooks (rb_trace_arg_t *trace_arg)
VALUE rb_suppress_tracing (VALUE(*func)(VALUE), VALUE arg)
static void call_trace_func (rb_event_flag_t, VALUE data, VALUE self, ID id, VALUE klass)
static VALUE set_trace_func (VALUE obj, VALUE trace)
static void thread_add_trace_func (rb_thread_t *th, VALUE trace)
static VALUE thread_add_trace_func_m (VALUE obj, VALUE trace)
static VALUE thread_set_trace_func_m (VALUE obj, VALUE trace)
static const char * get_event_name (rb_event_flag_t event)
static ID get_event_id (rb_event_flag_t event)
static void tp_mark (void *ptr)
static size_t tp_memsize (const void *ptr)
static VALUE tp_alloc (VALUE klass)
static rb_event_flag_t symbol2event_flag (VALUE v)
static rb_tp_ttpptr (VALUE tpval)
static rb_trace_arg_tget_trace_arg (void)
rb_trace_arg_structrb_tracearg_from_tracepoint (VALUE tpval)
rb_event_flag_t rb_tracearg_event_flag (rb_trace_arg_t *trace_arg)
VALUE rb_tracearg_event (rb_trace_arg_t *trace_arg)
static void fill_path_and_lineno (rb_trace_arg_t *trace_arg)
VALUE rb_tracearg_lineno (rb_trace_arg_t *trace_arg)
VALUE rb_tracearg_path (rb_trace_arg_t *trace_arg)
static void fill_id_and_klass (rb_trace_arg_t *trace_arg)
VALUE rb_tracearg_method_id (rb_trace_arg_t *trace_arg)
VALUE rb_tracearg_defined_class (rb_trace_arg_t *trace_arg)
VALUE rb_tracearg_binding (rb_trace_arg_t *trace_arg)
VALUE rb_tracearg_self (rb_trace_arg_t *trace_arg)
VALUE rb_tracearg_return_value (rb_trace_arg_t *trace_arg)
VALUE rb_tracearg_raised_exception (rb_trace_arg_t *trace_arg)
VALUE rb_tracearg_object (rb_trace_arg_t *trace_arg)
static VALUE tracepoint_attr_event (VALUE tpval)
static VALUE tracepoint_attr_lineno (VALUE tpval)
static VALUE tracepoint_attr_path (VALUE tpval)
static VALUE tracepoint_attr_method_id (VALUE tpval)
static VALUE tracepoint_attr_defined_class (VALUE tpval)
static VALUE tracepoint_attr_binding (VALUE tpval)
static VALUE tracepoint_attr_self (VALUE tpval)
static VALUE tracepoint_attr_return_value (VALUE tpval)
static VALUE tracepoint_attr_raised_exception (VALUE tpval)
static void tp_call_trace (VALUE tpval, rb_trace_arg_t *trace_arg)
VALUE rb_tracepoint_enable (VALUE tpval)
VALUE rb_tracepoint_disable (VALUE tpval)
static VALUE tracepoint_enable_m (VALUE tpval)
static VALUE tracepoint_disable_m (VALUE tpval)
VALUE rb_tracepoint_enabled_p (VALUE tpval)
static VALUE tracepoint_new (VALUE klass, rb_thread_t *target_th, rb_event_flag_t events, void(func)(VALUE, void *), void *data, VALUE proc)
VALUE rb_tracepoint_new (VALUE target_thval, rb_event_flag_t events, void(*func)(VALUE, void *), void *data)
static VALUE tracepoint_new_s (int argc, VALUE *argv, VALUE self)
static VALUE tracepoint_trace_s (int argc, VALUE *argv, VALUE self)
static VALUE tracepoint_inspect (VALUE self)
static void Init_postponed_job (void)
void Init_vm_trace (void)
static enum postponed_job_register_result postponed_job_register (rb_thread_t *th, rb_vm_t *vm, unsigned int flags, rb_postponed_job_func_t func, void *data, int max, int expected_index)
int rb_postponed_job_register (unsigned int flags, rb_postponed_job_func_t func, void *data)
int rb_postponed_job_register_one (unsigned int flags, rb_postponed_job_func_t func, void *data)
void rb_postponed_job_flush (rb_vm_t *vm)

Variables

static int ruby_event_flag_count [MAX_EVENT_NUM] = {0}
static VALUE rb_cTracePoint
static const rb_data_type_t tp_data_type


Define Documentation

#define C ( name,
NAME   )     CONST_ID(id, #name); if (sym == ID2SYM(id)) return RUBY_EVENT_##NAME

#define C ( name,
NAME   )     case RUBY_EVENT_##NAME: CONST_ID(id, #name); return id;

#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().

#define MAX_POSTPONED_JOB   1000

Definition at line 1426 of file vm_trace.c.

Referenced by Init_postponed_job(), and rb_postponed_job_register().

#define MAX_POSTPONED_JOB_SPECIAL_ADDITION   24

Definition at line 1427 of file vm_trace.c.


Typedef Documentation

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_postponed_job_struct rb_postponed_job_t

typedef struct rb_tp_struct rb_tp_t


Enumeration Type Documentation

enum postponed_job_register_result

Enumerator:
PJRR_SUCESS 
PJRR_FULL 
PJRR_INTERRUPTED 

Definition at line 1437 of file vm_trace.c.


Function Documentation

static rb_event_hook_t* alloc_event_hook ( rb_event_hook_func_t  func,
rb_event_flag_t  events,
VALUE  data,
rb_event_hook_flag_t  hook_flags 
) [static]

Definition at line 106 of file vm_trace.c.

References ALLOC, rb_event_hook_struct::data, rb_event_hook_struct::events, rb_event_hook_struct::func, rb_event_hook_struct::hook_flags, rb_eTypeError, rb_raise(), and RUBY_INTERNAL_EVENT_MASK.

Referenced by rb_add_event_hook(), rb_add_event_hook2(), and rb_threadptr_add_event_hook().

static void call_trace_func ( rb_event_flag_t  ,
VALUE  data,
VALUE  self,
ID  id,
VALUE  klass 
) [static]

Definition at line 609 of file vm_trace.c.

References argv, FL_SINGLETON, FL_TEST, get_event_name(), GET_THREAD(), ID2SYM, INT2FIX, Qnil, rb_binding_new(), rb_ivar_get(), rb_proc_call_with_block(), rb_sourcefile, rb_sourceline(), rb_str_new2, rb_thread_method_id_and_class(), RB_TYPE_P, RBASIC, T_ICLASS, and VALUE.

Referenced by set_trace_func(), thread_add_trace_func(), and thread_set_trace_func_m().

static void clean_hooks ( rb_hook_list_t list  )  [static]

Definition at line 234 of file vm_trace.c.

References rb_event_hook_struct::events, rb_event_hook_struct::hook_flags, list, rb_event_hook_struct::next, recalc_remove_ruby_vm_event_flags(), RUBY_EVENT_HOOK_FLAG_DELETED, and xfree.

Referenced by exec_hooks_precheck().

static int clear_trace_func_i ( st_data_t  key,
st_data_t  val,
st_data_t  flag 
) [static]

Definition at line 216 of file vm_trace.c.

References GetThreadPtr, Qundef, rb_threadptr_remove_event_hook(), ST_CONTINUE, and VALUE.

Referenced by rb_clear_trace_func().

static void connect_event_hook ( rb_hook_list_t list,
rb_event_hook_t hook 
) [static]

Definition at line 123 of file vm_trace.c.

References rb_event_hook_struct::events, list, 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 void exec_hooks_body ( rb_thread_t th,
rb_hook_list_t list,
const rb_trace_arg_t trace_arg 
) [static]

Definition at line 255 of file vm_trace.c.

References 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_trace_arg_struct::id, rb_trace_arg_struct::klass, list, rb_event_hook_struct::next, RUBY_EVENT_HOOK_FLAG_DELETED, RUBY_EVENT_HOOK_FLAG_RAW_ARG, and rb_trace_arg_struct::self.

Referenced by exec_hooks_protected(), and exec_hooks_unprotected().

static int exec_hooks_precheck ( rb_thread_t th,
rb_hook_list_t list,
const rb_trace_arg_t trace_arg 
) [static]

Definition at line 272 of file vm_trace.c.

References clean_hooks(), rb_trace_arg_struct::event, list, rb_vm_struct::trace_running, UNLIKELY, and rb_thread_struct::vm.

Referenced by exec_hooks_protected(), and exec_hooks_unprotected().

static int exec_hooks_protected ( rb_thread_t th,
rb_hook_list_t list,
const rb_trace_arg_t trace_arg 
) [static]

Definition at line 292 of file vm_trace.c.

References exec_hooks_body(), exec_hooks_precheck(), list, rb_threadptr_reset_raised(), rb_threadptr_set_raised(), TH_EXEC_TAG, TH_POP_TAG, and TH_PUSH_TAG.

Referenced by rb_threadptr_exec_event_hooks_orig().

static void exec_hooks_unprotected ( rb_thread_t th,
rb_hook_list_t list,
const rb_trace_arg_t trace_arg 
) [static]

Definition at line 285 of file vm_trace.c.

References exec_hooks_body(), exec_hooks_precheck(), and list.

Referenced by rb_threadptr_exec_event_hooks_orig().

static void fill_id_and_klass ( rb_trace_arg_t trace_arg  )  [static]

Definition at line 777 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 void fill_path_and_lineno ( rb_trace_arg_t trace_arg  )  [static]

Definition at line 747 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 ID get_event_id ( rb_event_flag_t  event  )  [static]

Definition at line 582 of file vm_trace.c.

References C, CALL, CLASS, CONST_ID, END, id, RETURN, RUBY_EVENT_LINE, and RUBY_EVENT_SPECIFIED_LINE.

Referenced by rb_tracearg_event().

static const char* get_event_name ( rb_event_flag_t  event  )  [static]

Definition at line 565 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 rb_trace_arg_t* get_trace_arg ( void   )  [static]

Definition at line 719 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().

static void Init_postponed_job ( void   )  [static]

Definition at line 1430 of file vm_trace.c.

References ALLOC_N, GET_VM, MAX_POSTPONED_JOB, rb_vm_struct::postponed_job_buffer, rb_vm_struct::postponed_job_index, and rb_thread_struct::vm.

Referenced by Init_vm_trace().

void Init_vm_trace ( void   ) 

Definition at line 1325 of file vm_trace.c.

References CLASS_OF, Init_postponed_job(), 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().

static enum postponed_job_register_result postponed_job_register ( rb_thread_t th,
rb_vm_t vm,
unsigned int  flags,
rb_postponed_job_func_t  func,
void *  data,
int  max,
int  expected_index 
) [static]

Definition at line 1444 of file vm_trace.c.

References ATOMIC_CAS, rb_postponed_job_struct::data, rb_postponed_job_struct::flags, rb_postponed_job_struct::func, PJRR_FULL, PJRR_INTERRUPTED, PJRR_SUCESS, rb_vm_struct::postponed_job_buffer, rb_vm_struct::postponed_job_index, RUBY_VM_SET_POSTPONED_JOB_INTERRUPT, rb_postponed_job_struct::th, and rb_thread_struct::vm.

Referenced by rb_postponed_job_register().

void rb_add_event_hook ( rb_event_hook_func_t  func,
rb_event_flag_t  events,
VALUE  data 
)

Definition at line 145 of file vm_trace.c.

References alloc_event_hook(), connect_event_hook(), GET_VM, and RUBY_EVENT_HOOK_FLAG_SAFE.

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 158 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 225 of file vm_trace.c.

References clear_trace_func_i(), GET_VM, rb_remove_event_hook(), st_data_t, and st_foreach().

Referenced by ruby_finalize_0(), and ruby_options().

void rb_postponed_job_flush ( rb_vm_t vm  ) 

Definition at line 1512 of file vm_trace.c.

References ATOMIC_CAS, rb_postponed_job_struct::data, rb_thread_struct::errinfo, EXEC_TAG, rb_postponed_job_struct::func, GET_THREAD(), rb_thread_struct::interrupt_mask, rb_vm_struct::postponed_job_buffer, rb_vm_struct::postponed_job_index, POSTPONED_JOB_INTERRUPT_MASK, Qnil, TH_POP_TAG, TH_PUSH_TAG, VALUE, and rb_thread_struct::vm.

Referenced by rb_threadptr_execute_interrupts().

int rb_postponed_job_register ( unsigned int  flags,
rb_postponed_job_func_t  func,
void *  data 
)

Definition at line 1471 of file vm_trace.c.

References GET_THREAD(), MAX_POSTPONED_JOB, PJRR_FULL, PJRR_INTERRUPTED, PJRR_SUCESS, rb_vm_struct::postponed_job_index, postponed_job_register(), rb_bug(), and rb_thread_struct::vm.

int rb_postponed_job_register_one ( unsigned int  flags,
rb_postponed_job_func_t  func,
void *  data 
)

Definition at line 1487 of file vm_trace.c.

References rb_postponed_job_struct::func, GET_THREAD(), if(), rb_vm_struct::postponed_job_buffer, rb_vm_struct::postponed_job_index, RUBY_VM_SET_POSTPONED_JOB_INTERRUPT, and rb_thread_struct::vm.

Referenced by gc_finalize_deferred_register().

int rb_remove_event_hook ( rb_event_hook_func_t  func  ) 

Definition at line 204 of file vm_trace.c.

References GET_VM, Qundef, and remove_event_hook().

int rb_remove_event_hook_with_data ( rb_event_hook_func_t  func,
VALUE  data 
)

Definition at line 210 of file vm_trace.c.

References GET_VM, and remove_event_hook().

Referenced by rb_tracepoint_disable().

VALUE rb_suppress_tracing ( VALUE(*)(VALUE)  func,
VALUE  arg 
)

Definition at line 388 of file vm_trace.c.

References rb_trace_arg_struct::event, 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 139 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 152 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 192 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 198 of file vm_trace.c.

References rb_threadptr_remove_event_hook(), and thval2thread_t().

Referenced by rb_tracepoint_disable().

static void rb_threadptr_add_event_hook ( rb_thread_t th,
rb_event_hook_func_t  func,
rb_event_flag_t  events,
VALUE  data,
rb_event_hook_flag_t  hook_flags 
) [static]

Definition at line 132 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 382 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 376 of file vm_trace.c.

References rb_threadptr_exec_event_hooks_orig().

static void rb_threadptr_exec_event_hooks_orig ( rb_trace_arg_t trace_arg,
int  pop_p 
) [static]

Definition at line 317 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, exec_hooks_protected(), exec_hooks_unprotected(), rb_vm_tag::prev, Qnil, rb_mRubyVMFrozenCore, rb_threadptr_reset_recursive_data(), rb_threadptr_restore_recursive_data(), RUBY_INTERNAL_EVENT_MASK, 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, VALUE, 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 int rb_threadptr_remove_event_hook ( rb_thread_t th,
rb_event_hook_func_t  func,
VALUE  data 
) [static]

Definition at line 186 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 812 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 805 of file vm_trace.c.

References fill_id_and_klass(), and rb_trace_arg_struct::klass.

Referenced by newobj_i(), and tracepoint_attr_defined_class().

VALUE rb_tracearg_event ( rb_trace_arg_t trace_arg  ) 

Definition at line 741 of file vm_trace.c.

References rb_trace_arg_struct::event, get_event_id(), and ID2SYM.

Referenced by tracepoint_attr_event(), and tracepoint_inspect().

rb_event_flag_t rb_tracearg_event_flag ( rb_trace_arg_t trace_arg  ) 

Definition at line 735 of file vm_trace.c.

References rb_trace_arg_struct::event.

struct rb_trace_arg_struct* rb_tracearg_from_tracepoint ( VALUE  tpval  ) 

Definition at line 729 of file vm_trace.c.

References get_trace_arg().

Referenced by freeobj_i(), and newobj_i().

VALUE rb_tracearg_lineno ( rb_trace_arg_t trace_arg  ) 

Definition at line 764 of file vm_trace.c.

References fill_path_and_lineno(), INT2FIX, and rb_trace_arg_struct::lineno.

Referenced by newobj_i(), tracepoint_attr_lineno(), and tracepoint_inspect().

VALUE rb_tracearg_method_id ( rb_trace_arg_t trace_arg  ) 

Definition at line 798 of file vm_trace.c.

References fill_id_and_klass(), rb_trace_arg_struct::id, ID2SYM, and Qnil.

Referenced by newobj_i(), tracepoint_attr_method_id(), and tracepoint_inspect().

VALUE rb_tracearg_object ( rb_trace_arg_t trace_arg  ) 

Definition at line 862 of file vm_trace.c.

References rb_trace_arg_struct::data, rb_trace_arg_struct::event, Qundef, rb_bug(), rb_eRuntimeError, rb_raise(), RUBY_INTERNAL_EVENT_FREEOBJ, and RUBY_INTERNAL_EVENT_NEWOBJ.

Referenced by freeobj_i(), and newobj_i().

VALUE rb_tracearg_path ( rb_trace_arg_t trace_arg  ) 

Definition at line 770 of file vm_trace.c.

References fill_path_and_lineno(), and rb_trace_arg_struct::path.

Referenced by newobj_i(), tracepoint_attr_path(), and tracepoint_inspect().

VALUE rb_tracearg_raised_exception ( rb_trace_arg_t trace_arg  ) 

Definition at line 847 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 832 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 826 of file vm_trace.c.

References rb_trace_arg_struct::self.

Referenced by tracepoint_attr_self(), and tracepoint_inspect().

VALUE rb_tracepoint_disable ( VALUE  tpval  ) 

Definition at line 1026 of file vm_trace.c.

References Qundef, rb_remove_event_hook_with_data(), 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 trace_object_allocations_stop(), tracepoint_disable_m(), and tracepoint_enable_m().

VALUE rb_tracepoint_enable ( VALUE  tpval  ) 

Definition at line 1007 of file vm_trace.c.

References rb_tp_struct::events, Qundef, rb_add_event_hook2(), 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 trace_object_allocations_start(), tracepoint_disable_m(), tracepoint_enable_m(), and tracepoint_trace_s().

VALUE rb_tracepoint_enabled_p ( VALUE  tpval  ) 

Definition at line 1154 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 1177 of file vm_trace.c.

References GetThreadPtr, Qundef, RTEST, and tracepoint_new().

Referenced by trace_object_allocations_start().

void rb_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 void recalc_add_ruby_vm_event_flags ( rb_event_flag_t  events  )  [static]

Definition at line 64 of file vm_trace.c.

References MAX_EVENT_NUM, rb_objspace_set_event_hook(), ruby_event_flag_count, and ruby_vm_event_flags.

Referenced by connect_event_hook().

static void recalc_remove_ruby_vm_event_flags ( rb_event_flag_t  events  )  [static]

Definition at line 80 of file vm_trace.c.

References MAX_EVENT_NUM, rb_objspace_set_event_hook(), ruby_event_flag_count, and ruby_vm_event_flags.

Referenced by clean_hooks().

static int remove_event_hook ( rb_hook_list_t list,
rb_event_hook_func_t  func,
VALUE  data 
) [static]

Definition at line 166 of file vm_trace.c.

References rb_event_hook_struct::data, rb_event_hook_struct::func, rb_event_hook_struct::hook_flags, list, 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().

static VALUE set_trace_func ( VALUE  obj,
VALUE  trace 
) [static]

Definition at line 491 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(), and RUBY_EVENT_ALL.

Referenced by Init_vm_trace().

static rb_event_flag_t symbol2event_flag ( VALUE  v  )  [static]

Definition at line 685 of file vm_trace.c.

References C, CALL, CLASS, CONST_ID, END, id, ID2SYM, rb_convert_type(), rb_eArgError, rb_id2name(), rb_raise(), RETURN, RUBY_EVENT_B_CALL, RUBY_EVENT_B_RETURN, RUBY_EVENT_C_CALL, RUBY_EVENT_C_RETURN, RUBY_EVENT_CALL, RUBY_EVENT_RETURN, sym, SYM2ID, T_SYMBOL, and VALUE.

Referenced by tracepoint_new_s().

static void thread_add_trace_func ( rb_thread_t th,
VALUE  trace 
) [static]

Definition at line 509 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().

static VALUE thread_add_trace_func_m ( VALUE  obj,
VALUE  trace 
) [static]

Definition at line 528 of file vm_trace.c.

References GetThreadPtr, and thread_add_trace_func().

Referenced by Init_vm_trace().

static VALUE thread_set_trace_func_m ( VALUE  obj,
VALUE  trace 
) [static]

Definition at line 549 of file vm_trace.c.

References call_trace_func(), GetThreadPtr, NIL_P, Qnil, Qundef, rb_threadptr_remove_event_hook(), and thread_add_trace_func().

Referenced by Init_vm_trace().

static rb_thread_t* thval2thread_t ( VALUE  thval  )  [static]

Definition at line 98 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().

static VALUE tp_alloc ( VALUE  klass  )  [static]

Definition at line 678 of file vm_trace.c.

References tp_data_type, and TypedData_Make_Struct.

Referenced by tracepoint_new().

static void tp_call_trace ( VALUE  tpval,
rb_trace_arg_t trace_arg 
) [static]

Definition at line 994 of file vm_trace.c.

References rb_tp_struct::data, rb_tp_struct::func, rb_tp_struct::proc, Qnil, rb_proc_call_with_block(), tpptr(), and VALUE.

Referenced by rb_tracepoint_disable(), and rb_tracepoint_enable().

static void tp_mark ( void *  ptr  )  [static]

Definition at line 656 of file vm_trace.c.

References rb_tp_struct::proc, rb_gc_mark(), rb_thread_struct::self, and rb_tp_struct::target_th.

static size_t tp_memsize ( const void *  ptr  )  [static]

Definition at line 666 of file vm_trace.c.

static rb_tp_t* tpptr ( VALUE  tpval  )  [static]

Definition at line 711 of file vm_trace.c.

References tp_data_type, and 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().

static VALUE tracepoint_attr_binding ( VALUE  tpval  )  [static]

Definition at line 958 of file vm_trace.c.

References get_trace_arg(), and rb_tracearg_binding().

Referenced by Init_vm_trace().

static VALUE tracepoint_attr_defined_class ( VALUE  tpval  )  [static]

Definition at line 949 of file vm_trace.c.

References get_trace_arg(), and rb_tracearg_defined_class().

Referenced by Init_vm_trace().

static VALUE tracepoint_attr_event ( VALUE  tpval  )  [static]

Definition at line 882 of file vm_trace.c.

References get_trace_arg(), and rb_tracearg_event().

Referenced by Init_vm_trace().

static VALUE tracepoint_attr_lineno ( VALUE  tpval  )  [static]

Definition at line 891 of file vm_trace.c.

References get_trace_arg(), and rb_tracearg_lineno().

Referenced by Init_vm_trace().

static VALUE tracepoint_attr_method_id ( VALUE  tpval  )  [static]

Definition at line 909 of file vm_trace.c.

References get_trace_arg(), and rb_tracearg_method_id().

Referenced by Init_vm_trace().

static VALUE tracepoint_attr_path ( VALUE  tpval  )  [static]

Definition at line 900 of file vm_trace.c.

References get_trace_arg(), and rb_tracearg_path().

Referenced by Init_vm_trace().

static VALUE tracepoint_attr_raised_exception ( VALUE  tpval  )  [static]

Definition at line 988 of file vm_trace.c.

References get_trace_arg(), and rb_tracearg_raised_exception().

Referenced by Init_vm_trace().

static VALUE tracepoint_attr_return_value ( VALUE  tpval  )  [static]

Definition at line 979 of file vm_trace.c.

References get_trace_arg(), and rb_tracearg_return_value().

Referenced by Init_vm_trace().

static VALUE tracepoint_attr_self ( VALUE  tpval  )  [static]

Definition at line 970 of file vm_trace.c.

References get_trace_arg(), and rb_tracearg_self().

Referenced by Init_vm_trace().

static VALUE tracepoint_disable_m ( VALUE  tpval  )  [static]

Definition at line 1131 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().

static VALUE tracepoint_enable_m ( VALUE  tpval  )  [static]

Definition at line 1080 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().

static VALUE tracepoint_inspect ( VALUE  self  )  [static]

Definition at line 1275 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, rb_tp_struct::tracing, and VALUE.

Referenced by Init_vm_trace().

static VALUE tracepoint_new ( VALUE  klass,
rb_thread_t target_th,
rb_event_flag_t  events,
void(func)(VALUE, void *)  ,
void *  data,
VALUE  proc 
) [static]

Definition at line 1161 of file vm_trace.c.

References rb_tp_struct::data, rb_tp_struct::events, rb_tp_struct::func, rb_tp_struct::proc, rb_tp_struct::self, tp_alloc(), tp_data_type, and TypedData_Get_Struct.

Referenced by rb_tracepoint_new(), and tracepoint_new_s().

static VALUE tracepoint_new_s ( int  argc,
VALUE *  argv,
VALUE  self 
) [static]

Definition at line 1237 of file vm_trace.c.

References 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().

static VALUE tracepoint_trace_s ( int  argc,
VALUE *  argv,
VALUE  self 
) [static]

Definition at line 1259 of file vm_trace.c.

References rb_tracepoint_enable(), tracepoint_new_s(), and VALUE.

Referenced by Init_vm_trace().


Variable Documentation

VALUE rb_cTracePoint [static]

Definition at line 643 of file vm_trace.c.

int ruby_event_flag_count[MAX_EVENT_NUM] = {0} [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().

const rb_data_type_t tp_data_type [static]

Initial value:

Definition at line 671 of file vm_trace.c.

Referenced by tp_alloc(), tpptr(), and tracepoint_new().


Generated on 19 Jul 2016 for Ruby by  doxygen 1.4.7