Ruby  2.0.0p247(2013-06-27revision41674)
include/ruby/debug.h
Go to the documentation of this file.
00001 /**********************************************************************
00002 
00003   ruby/debug.h -
00004 
00005   $Author: ko1 $
00006   created at: Tue Nov 20 20:35:08 2012
00007 
00008   Copyright (C) 2012 Yukihiro Matsumoto
00009 
00010 **********************************************************************/
00011 
00012 #ifndef RB_DEBUG_H
00013 #define RB_DEBUG_H 1
00014 
00015 #if defined(__cplusplus)
00016 extern "C" {
00017 #if 0
00018 } /* satisfy cc-mode */
00019 #endif
00020 #endif
00021 
00022 #if defined __GNUC__ && __GNUC__ >= 4
00023 #pragma GCC visibility push(default)
00024 #endif
00025 
00026 /* Note: This file contains experimental APIs. */
00027 /* APIs can be replaced at Ruby 2.0.1 or later */
00028 
00029 /* debug inspector APIs */
00030 typedef struct rb_debug_inspector_struct rb_debug_inspector_t;
00031 typedef VALUE (*rb_debug_inspector_func_t)(const rb_debug_inspector_t *, void *);
00032 
00033 VALUE rb_debug_inspector_open(rb_debug_inspector_func_t func, void *data);
00034 VALUE rb_debug_inspector_frame_self_get(const rb_debug_inspector_t *dc, long index);
00035 VALUE rb_debug_inspector_frame_class_get(const rb_debug_inspector_t *dc, long index);
00036 VALUE rb_debug_inspector_frame_binding_get(const rb_debug_inspector_t *dc, long index);
00037 VALUE rb_debug_inspector_frame_iseq_get(const rb_debug_inspector_t *dc, long index);
00038 VALUE rb_debug_inspector_backtrace_locations(const rb_debug_inspector_t *dc);
00039 
00040 /* Old style set_trace_func APIs */
00041 
00042 /* duplicated def of include/ruby/ruby.h */
00043 void rb_add_event_hook(rb_event_hook_func_t func, rb_event_flag_t events, VALUE data);
00044 int rb_remove_event_hook(rb_event_hook_func_t func);
00045 
00046 int rb_remove_event_hook_with_data(rb_event_hook_func_t func, VALUE data);
00047 void rb_thread_add_event_hook(VALUE thval, rb_event_hook_func_t func, rb_event_flag_t events, VALUE data);
00048 int rb_thread_remove_event_hook(VALUE thval, rb_event_hook_func_t func);
00049 int rb_thread_remove_event_hook_with_data(VALUE thval, rb_event_hook_func_t func, VALUE data);
00050 
00051 /* TracePoint APIs */
00052 
00053 VALUE rb_tracepoint_new(VALUE target_thread_not_supported_yet, rb_event_flag_t events, void (*func)(VALUE, void *), void *data);
00054 VALUE rb_tracepoint_enable(VALUE tpval);
00055 VALUE rb_tracepoint_disable(VALUE tpval);
00056 VALUE rb_tracepoint_enabled_p(VALUE tpval);
00057 
00058 typedef struct rb_trace_arg_struct rb_trace_arg_t;
00059 rb_trace_arg_t *rb_tracearg_from_tracepoint(VALUE tpval);
00060 
00061 VALUE rb_tracearg_event(rb_trace_arg_t *trace_arg);
00062 VALUE rb_tracearg_lineno(rb_trace_arg_t *trace_arg);
00063 VALUE rb_tracearg_path(rb_trace_arg_t *trace_arg);
00064 VALUE rb_tracearg_method_id(rb_trace_arg_t *trace_arg);
00065 VALUE rb_tracearg_defined_class(rb_trace_arg_t *trace_arg);
00066 VALUE rb_tracearg_binding(rb_trace_arg_t *trace_arg);
00067 VALUE rb_tracearg_self(rb_trace_arg_t *trace_arg);
00068 VALUE rb_tracearg_return_value(rb_trace_arg_t *trace_arg);
00069 VALUE rb_tracearg_raised_exception(rb_trace_arg_t *trace_arg);
00070 
00071 /* undocumented advanced tracing APIs */
00072 
00073 typedef enum {
00074     RUBY_EVENT_HOOK_FLAG_SAFE    = 0x01,
00075     RUBY_EVENT_HOOK_FLAG_DELETED = 0x02,
00076     RUBY_EVENT_HOOK_FLAG_RAW_ARG = 0x04
00077 } rb_event_hook_flag_t;
00078 
00079 void rb_add_event_hook2(rb_event_hook_func_t func, rb_event_flag_t events, VALUE data, rb_event_hook_flag_t hook_flag);
00080 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_flag);
00081 
00082 #if defined __GNUC__ && __GNUC__ >= 4
00083 #pragma GCC visibility pop
00084 #endif
00085 
00086 #if defined(__cplusplus)
00087 #if 0
00088 { /* satisfy cc-mode */
00089 #endif
00090 }  /* extern "C" { */
00091 #endif
00092 
00093 #endif /* RUBY_DEBUG_H */
00094