aboutsummaryrefslogtreecommitdiffstats
path: root/yarvcore.h
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-04-19 10:37:08 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-04-19 10:37:08 +0000
commita73894337a830cdd32a913964f3150bc35269975 (patch)
tree9867f12c88a52c9c4d7ca5fe30c9b57e5a9e411f /yarvcore.h
parent2dd91facca2337ff611489f1ccd84441d8fc9bf2 (diff)
downloadruby-a73894337a830cdd32a913964f3150bc35269975.tar.gz
* eval.c, node.h, thread.c, yarvcore.[ch], eval_intern.h:
support set_trace_func (incomplete. id and klass don't be passed). And support Thread#set_trace_func which hook only specified thread and Thread#add_trace_func which add new trace func instead of replace old one. C level API was modified. See thread.c (logic) and yarvcore.h (data structures). * vm.c, vm_macro.def: add hook points. * compile.c, insns.def: fix "trace" instruction. * iseq.c, vm_macro.h: add compile option "trace_instruction". * test/ruby/test_settracefunc.rb: hook "c-return" of set_trace_func. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'yarvcore.h')
-rw-r--r--yarvcore.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/yarvcore.h b/yarvcore.h
index d0ff4127c5..4961adfc75 100644
--- a/yarvcore.h
+++ b/yarvcore.h
@@ -186,6 +186,7 @@ typedef struct rb_compile_option_struct {
int operands_unification;
int instructions_unification;
int stack_caching;
+ int trace_instruction;
} rb_compile_option_t;
struct iseq_compile_data {
@@ -304,6 +305,29 @@ struct rb_iseq_struct {
typedef struct rb_iseq_struct rb_iseq_t;
+#define RUBY_EVENT_NONE 0x00
+#define RUBY_EVENT_LINE 0x01
+#define RUBY_EVENT_CLASS 0x02
+#define RUBY_EVENT_END 0x04
+#define RUBY_EVENT_CALL 0x08
+#define RUBY_EVENT_RETURN 0x10
+#define RUBY_EVENT_C_CALL 0x20
+#define RUBY_EVENT_C_RETURN 0x40
+#define RUBY_EVENT_RAISE 0x80
+#define RUBY_EVENT_ALL 0xff
+#define RUBY_EVENT_VM 0x100
+
+typedef unsigned int rb_event_flag_t;
+typedef void (*rb_event_hook_func_t)(rb_event_flag_t, VALUE data, VALUE, ID, VALUE klass);
+
+typedef struct rb_event_hook_struct {
+ rb_event_flag_t flag;
+ rb_event_hook_func_t func;
+ VALUE data;
+ struct rb_event_hook_struct *next;
+} rb_event_hook_t;
+
+
#define GetVMPtr(obj, ptr) \
Data_Get_Struct(obj, rb_vm_t, ptr)
@@ -332,6 +356,9 @@ typedef struct rb_vm_struct {
/* signal */
rb_atomic_t signal_buff[RUBY_NSIG];
rb_atomic_t bufferd_signal_size;
+
+ /* hook */
+ rb_event_hook_t *event_hooks;
} rb_vm_t;
typedef struct {
@@ -456,6 +483,11 @@ struct rb_thread_struct
/* statistics data for profiler */
VALUE stat_insn_usage;
+ /* tracer */
+ rb_event_hook_t *event_hooks;
+ rb_event_flag_t event_flags;
+ int tracing;
+
/* misc */
int method_missing_reason;
int abort_on_exception;