Ruby 2.0.0p247(2013-06-27revision41674)

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

Data Structures | Macros | Typedefs | Functions | Variables
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"`
Include dependency graph for vm_trace.c:

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

## Functions
void | 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_t * | thval2thread_t (VALUE thval)
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 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 int | exec_hooks (rb_thread_t *th, rb_hook_list_t *list, const rb_trace_arg_t *trace_arg, int can_clean_hooks)
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 void | tp_free (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_t * | tpptr (VALUE tpval)
static rb_trace_arg_t * | get_trace_arg (void)
struct rb_trace_arg_struct * | rb_tracearg_from_tracepoint (VALUE tpval)
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)
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)
void | Init_vm_trace (void)

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

## Macro Definition Documentation

#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_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 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_tp_struct rb_tp_t

## 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 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 void call_trace_func | ( | rb_event_flag_t | event,
|  | VALUE | data,
|  | VALUE | self,
|  | ID | id,
|  | VALUE | klass
| ) |  |
| static

Definition at line 563 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 void clean_hooks | ( | rb_hook_list_t * | list) |  |
| 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().

static int clear_trace_func_i | ( | st_data_t | key,
|  | st_data_t | val,
|  | st_data_t | flag
| ) |  |
| static

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 void connect_event_hook | ( | rb_hook_list_t * | list,
|  | rb_event_hook_t * | hook
| ) |  |
| 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 int exec_hooks | ( | rb_thread_t * | th,
|  | rb_hook_list_t * | list,
|  | const rb_trace_arg_t * | trace_arg,
|  | int | can_clean_hooks
| ) |  |
| 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 void fill_id_and_klass | ( | rb_trace_arg_t * | trace_arg) |  |
| static

Definition at line 728 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 698 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 536 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 const char* get_event_name | ( | rb_event_flag_t | event) |  |
| static

Definition at line 519 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 676 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 1261 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().

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

Definition at line 344 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 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 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 338 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 332 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 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, 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 int rb_threadptr_remove_event_hook | ( | rb_thread_t * | th,
|  | rb_event_hook_func_t | func,
|  | VALUE | data
| ) |  |
| 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 763 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 756 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 692 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 686 of file vm_trace.c.

References get_trace_arg().

VALUE rb_tracearg_lineno | ( | rb_trace_arg_t * | trace_arg) |  |

Definition at line 715 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 749 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 721 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 798 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 783 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 777 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 963 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().

VALUE rb_tracepoint_enable | ( | VALUE | tpval) |  |

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

VALUE rb_tracepoint_enabled_p | ( | VALUE | tpval) |  |

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

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

static void recalc_add_ruby_vm_event_flags | ( | rb_event_flag_t | events) |  |
| 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 void recalc_remove_ruby_vm_event_flags | ( | rb_event_flag_t | events) |  |
| 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 int remove_event_hook | ( | rb_hook_list_t * | list,
|  | rb_event_hook_func_t | func,
|  | VALUE | data
| ) |  |
| 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().

static VALUE set_trace_func | ( | VALUE | obj,
|  | VALUE | trace
| ) |  |
| static

Definition at line 444 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 rb_event_flag_t symbol2event_flag | ( | VALUE | v) |  |
| static

Definition at line 644 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 void thread_add_trace_func | ( | rb_thread_t * | th,
|  | VALUE | trace
| ) |  |
| static

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

References GetThreadPtr, rb_secure(), 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 502 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 rb_thread_t* thval2thread_t | ( | VALUE | thval) |  |
| 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().

static VALUE tp_alloc | ( | VALUE | klass) |  |
| static

Definition at line 637 of file vm_trace.c.

References TypedData_Make_Struct.

Referenced by tracepoint_new().

static void tp_call_trace | ( | VALUE | tpval,
|  | rb_trace_arg_t * | trace_arg
| ) |  |
| static

Definition at line 930 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 void tp_free | ( | void * | ptr) |  |
| static

Definition at line 620 of file vm_trace.c.

static void tp_mark | ( | void * | ptr) |  |
| static

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

static rb_tp_t* tpptr | ( | VALUE | tpval) |  |
| static

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

static VALUE tracepoint_attr_binding | ( | VALUE | tpval) |  |
| static

Definition at line 894 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 885 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 818 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 827 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 845 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 836 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 924 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 915 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 906 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 1069 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 1018 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 1213 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 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 1099 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().

static VALUE tracepoint_new_s | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | self
| ) |  |
| static

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

static VALUE tracepoint_trace_s | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | self
| ) |  |
| static

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

## Variable Documentation

VALUE rb_cTracePoint
| static

Definition at line 597 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:
= {
"tracepoint",
{tp_mark, tp_free, tp_memsize,},
}

Definition at line 631 of file vm_trace.c.