Ruby 2.7.0p0(2019-12-25revision647ee6f091eafcce70ffb75ddf7e121e192ab217)

debug.h
Go to the documentation of this file.
1 /**********************************************************************
2
3 ruby/debug.h -
4
5 $Author: ko1 $
6 created at: Tue Nov 20 20:35:08 2012
7
8 Copyright (C) 2012 Yukihiro Matsumoto
9
10 **********************************************************************/
11
12 #ifndef RB_DEBUG_H
13 #define RB_DEBUG_H 1
14
15 #if defined(__cplusplus)
16 extern "C" {
17 #if 0
18 } /* satisfy cc-mode */
19 #endif
20 #endif
21
22 RUBY_SYMBOL_EXPORT_BEGIN
23
24 /* Note: This file contains experimental APIs. */
25 /* APIs can be replaced at Ruby 2.0.1 or later */
26
27
28 /* profile frames APIs */
29 int rb_profile_frames(int start, int limit, VALUE *buff, int *lines);
30 VALUE rb_profile_frame_path(VALUE frame);
31 VALUE rb_profile_frame_absolute_path(VALUE frame);
32 VALUE rb_profile_frame_label(VALUE frame);
33 VALUE rb_profile_frame_base_label(VALUE frame);
34 VALUE rb_profile_frame_full_label(VALUE frame);
35 VALUE rb_profile_frame_first_lineno(VALUE frame);
36 VALUE rb_profile_frame_classpath(VALUE frame);
37 VALUE rb_profile_frame_singleton_method_p(VALUE frame);
38 VALUE rb_profile_frame_method_name(VALUE frame);
39 VALUE rb_profile_frame_qualified_method_name(VALUE frame);
40
41 /* debug inspector APIs */
42 typedef struct rb_debug_inspector_struct rb_debug_inspector_t;
43 typedef VALUE (*rb_debug_inspector_func_t)(const rb_debug_inspector_t *, void *);
44
45 VALUE rb_debug_inspector_open(rb_debug_inspector_func_t func, void *data);
46 VALUE rb_debug_inspector_frame_self_get(const rb_debug_inspector_t *dc, long index);
47 VALUE rb_debug_inspector_frame_class_get(const rb_debug_inspector_t *dc, long index);
48 VALUE rb_debug_inspector_frame_binding_get(const rb_debug_inspector_t *dc, long index);
49 VALUE rb_debug_inspector_frame_iseq_get(const rb_debug_inspector_t *dc, long index);
50 VALUE rb_debug_inspector_backtrace_locations(const rb_debug_inspector_t *dc);
51
52 /* Old style set_trace_func APIs */
53
54 /* duplicated def of include/ruby/ruby.h */
55 void rb_add_event_hook(rb_event_hook_func_t func, rb_event_flag_t events, VALUE data);
56 int rb_remove_event_hook(rb_event_hook_func_t func);
57
58 int rb_remove_event_hook_with_data(rb_event_hook_func_t func, VALUE data);
59 void rb_thread_add_event_hook(VALUE thval, rb_event_hook_func_t func, rb_event_flag_t events, VALUE data);
60 int rb_thread_remove_event_hook(VALUE thval, rb_event_hook_func_t func);
61 int rb_thread_remove_event_hook_with_data(VALUE thval, rb_event_hook_func_t func, VALUE data);
62
63 /* TracePoint APIs */
64
65 VALUE rb_tracepoint_new(VALUE target_thread_not_supported_yet, rb_event_flag_t events, void (*func)(VALUE, void *), void *data);
66 VALUE rb_tracepoint_enable(VALUE tpval);
67 VALUE rb_tracepoint_disable(VALUE tpval);
68 VALUE rb_tracepoint_enabled_p(VALUE tpval);
69
70 typedef struct rb_trace_arg_struct rb_trace_arg_t;
71 rb_trace_arg_t *rb_tracearg_from_tracepoint(VALUE tpval);
72
73 rb_event_flag_t rb_tracearg_event_flag(rb_trace_arg_t *trace_arg);
74 VALUE rb_tracearg_event(rb_trace_arg_t *trace_arg);
75 VALUE rb_tracearg_lineno(rb_trace_arg_t *trace_arg);
76 VALUE rb_tracearg_path(rb_trace_arg_t *trace_arg);
77 VALUE rb_tracearg_method_id(rb_trace_arg_t *trace_arg);
78 VALUE rb_tracearg_callee_id(rb_trace_arg_t *trace_arg);
79 VALUE rb_tracearg_defined_class(rb_trace_arg_t *trace_arg);
80 VALUE rb_tracearg_binding(rb_trace_arg_t *trace_arg);
81 VALUE rb_tracearg_self(rb_trace_arg_t *trace_arg);
82 VALUE rb_tracearg_return_value(rb_trace_arg_t *trace_arg);
83 VALUE rb_tracearg_raised_exception(rb_trace_arg_t *trace_arg);
84 VALUE rb_tracearg_object(rb_trace_arg_t *trace_arg);
85
86 /*
87 * Postponed Job API
88 * rb_postponed_job_register and rb_postponed_job_register_one are
89 * async-signal-safe and used via SIGPROF by the "stackprof" RubyGem
90 */
91 typedef void (*rb_postponed_job_func_t)(void *arg);
92 int rb_postponed_job_register(unsigned int flags, rb_postponed_job_func_t func, void *data);
93 int rb_postponed_job_register_one(unsigned int flags, rb_postponed_job_func_t func, void *data);
94
95 /* undocumented advanced tracing APIs */
96
97 typedef enum {
98 RUBY_EVENT_HOOK_FLAG_SAFE = 0x01,
99 RUBY_EVENT_HOOK_FLAG_DELETED = 0x02,
100 RUBY_EVENT_HOOK_FLAG_RAW_ARG = 0x04
101 } rb_event_hook_flag_t;
102
103 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);
104 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);
105
106 RUBY_SYMBOL_EXPORT_END
107
108 #if defined(__cplusplus)
109 #if 0
110 { /* satisfy cc-mode */
111 #endif
112 } /* extern "C" { */
113 #endif
114
115 #endif /* RUBY_DEBUG_H */
rb_thread_add_event_hook
void rb_thread_add_event_hook(VALUE thval, rb_event_hook_func_t func, rb_event_flag_t events, VALUE data)
Definition: vm_trace.c:151
RUBY_SYMBOL_EXPORT_END
#define RUBY_SYMBOL_EXPORT_END
Definition: missing.h:49
void
void
Definition: rb_mjit_min_header-2.7.0.h:13273
rb_profile_frame_absolute_path
VALUE rb_profile_frame_absolute_path(VALUE frame)
Definition: vm_backtrace.c:1375
rb_debug_inspector_backtrace_locations
VALUE rb_debug_inspector_backtrace_locations(const rb_debug_inspector_t *dc)
Definition: vm_backtrace.c:1302
rb_debug_inspector_frame_self_get
VALUE rb_debug_inspector_frame_self_get(const rb_debug_inspector_t *dc, long index)
Definition: vm_backtrace.c:1272
rb_postponed_job_register_one
int rb_postponed_job_register_one(unsigned int flags, rb_postponed_job_func_t func, void *data)
Definition: vm_trace.c:1608
rb_tracearg_lineno
VALUE rb_tracearg_lineno(rb_trace_arg_t *trace_arg)
Definition: vm_trace.c:812
RUBY_EVENT_HOOK_FLAG_RAW_ARG
@ RUBY_EVENT_HOOK_FLAG_RAW_ARG
Definition: debug.h:100
rb_tracepoint_enabled_p
VALUE rb_tracepoint_enabled_p(VALUE tpval)
Definition: vm_trace.c:1335
VALUE
unsigned long VALUE
Definition: ruby.h:102
index
int index
Definition: rb_mjit_min_header-2.7.0.h:11246
rb_tracearg_self
VALUE rb_tracearg_self(rb_trace_arg_t *trace_arg)
Definition: vm_trace.c:921
rb_thread_remove_event_hook_with_data
int rb_thread_remove_event_hook_with_data(VALUE thval, rb_event_hook_func_t func, VALUE data)
Definition: vm_trace.c:256
rb_event_hook_flag_t
rb_event_hook_flag_t
Definition: debug.h:97
rb_tracearg_object
VALUE rb_tracearg_object(rb_trace_arg_t *trace_arg)
Definition: vm_trace.c:1008
rb_debug_inspector_frame_class_get
VALUE rb_debug_inspector_frame_class_get(const rb_debug_inspector_t *dc, long index)
Definition: vm_backtrace.c:1279
rb_postponed_job_func_t
void(* rb_postponed_job_func_t)(void *arg)
Definition: debug.h:91
rb_tracearg_defined_class
VALUE rb_tracearg_defined_class(rb_trace_arg_t *trace_arg)
Definition: vm_trace.c:900
rb_debug_inspector_frame_iseq_get
VALUE rb_debug_inspector_frame_iseq_get(const rb_debug_inspector_t *dc, long index)
Definition: vm_backtrace.c:1293
rb_tracearg_raised_exception
VALUE rb_tracearg_raised_exception(rb_trace_arg_t *trace_arg)
Definition: vm_trace.c:942
rb_profile_frame_singleton_method_p
VALUE rb_profile_frame_singleton_method_p(VALUE frame)
Definition: vm_backtrace.c:1439
rb_debug_inspector_frame_binding_get
VALUE rb_debug_inspector_frame_binding_get(const rb_debug_inspector_t *dc, long index)
Definition: vm_backtrace.c:1286
rb_profile_frame_first_lineno
VALUE rb_profile_frame_first_lineno(VALUE frame)
Definition: vm_backtrace.c:1396
rb_profile_frame_classpath
VALUE rb_profile_frame_classpath(VALUE frame)
Definition: vm_backtrace.c:1418
rb_debug_inspector_struct
Definition: vm_backtrace.c:1121
rb_add_event_hook2
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)
Definition: vm_trace.c:170
rb_profile_frame_full_label
VALUE rb_profile_frame_full_label(VALUE frame)
Definition: vm_backtrace.c:1481
rb_profile_frame_base_label
VALUE rb_profile_frame_base_label(VALUE frame)
Definition: vm_backtrace.c:1389
rb_tracearg_from_tracepoint
rb_trace_arg_t * rb_tracearg_from_tracepoint(VALUE tpval)
Definition: vm_trace.c:786
rb_tracearg_callee_id
VALUE rb_tracearg_callee_id(rb_trace_arg_t *trace_arg)
Definition: vm_trace.c:893
rb_trace_arg_struct
Definition: vm_core.h:1874
rb_thread_add_event_hook2
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)
Definition: vm_trace.c:164
rb_profile_frame_qualified_method_name
VALUE rb_profile_frame_qualified_method_name(VALUE frame)
Definition: vm_backtrace.c:1459
RUBY_EVENT_HOOK_FLAG_DELETED
@ RUBY_EVENT_HOOK_FLAG_DELETED
Definition: debug.h:99
rb_tracepoint_enable
VALUE rb_tracepoint_enable(VALUE tpval)
Definition: vm_trace.c:1113
rb_event_hook_func_t
void(* rb_event_hook_func_t)(rb_event_flag_t evflag, VALUE data, VALUE self, ID mid, VALUE klass)
Definition: ruby.h:2279
rb_tracepoint_disable
VALUE rb_tracepoint_disable(VALUE tpval)
Definition: vm_trace.c:1221
rb_add_event_hook
void rb_add_event_hook(rb_event_hook_func_t func, rb_event_flag_t events, VALUE data)
Definition: vm_trace.c:157
rb_postponed_job_register
int rb_postponed_job_register(unsigned int flags, rb_postponed_job_func_t func, void *data)
Definition: vm_trace.c:1589
rb_tracearg_binding
VALUE rb_tracearg_binding(rb_trace_arg_t *trace_arg)
Definition: vm_trace.c:907
rb_event_flag_t
uint32_t rb_event_flag_t
Definition: ruby.h:2278
arg
VALUE arg
Definition: rb_mjit_min_header-2.7.0.h:5601
RUBY_SYMBOL_EXPORT_BEGIN
#define RUBY_SYMBOL_EXPORT_BEGIN
Definition: missing.h:48
rb_remove_event_hook
int rb_remove_event_hook(rb_event_hook_func_t func)
Definition: vm_trace.c:262
rb_debug_inspector_open
VALUE rb_debug_inspector_open(rb_debug_inspector_func_t func, void *data)
Definition: vm_backtrace.c:1231
rb_trace_arg_struct::data
VALUE data
Definition: vm_core.h:1882
RUBY_EVENT_HOOK_FLAG_SAFE
@ RUBY_EVENT_HOOK_FLAG_SAFE
Definition: debug.h:98
rb_profile_frames
RUBY_SYMBOL_EXPORT_BEGIN int rb_profile_frames(int start, int limit, VALUE *buff, int *lines)
Definition: vm_backtrace.c:1308
rb_profile_frame_method_name
VALUE rb_profile_frame_method_name(VALUE frame)
Definition: vm_backtrace.c:1452
rb_tracepoint_new
VALUE rb_tracepoint_new(VALUE target_thread_not_supported_yet, rb_event_flag_t events, void(*func)(VALUE, void *), void *data)
Definition: vm_trace.c:1394
rb_tracearg_return_value
VALUE rb_tracearg_return_value(rb_trace_arg_t *trace_arg)
Definition: vm_trace.c:927
rb_tracearg_event_flag
rb_event_flag_t rb_tracearg_event_flag(rb_trace_arg_t *trace_arg)
Definition: vm_trace.c:792
rb_remove_event_hook_with_data
int rb_remove_event_hook_with_data(rb_event_hook_func_t func, VALUE data)
Definition: vm_trace.c:268
rb_tracearg_event
VALUE rb_tracearg_event(rb_trace_arg_t *trace_arg)
Definition: vm_trace.c:798
rb_debug_inspector_func_t
VALUE(* rb_debug_inspector_func_t)(const rb_debug_inspector_t *, void *)
Definition: debug.h:43
rb_profile_frame_path
VALUE rb_profile_frame_path(VALUE frame)
Definition: vm_backtrace.c:1368
rb_tracearg_method_id
VALUE rb_tracearg_method_id(rb_trace_arg_t *trace_arg)
Definition: vm_trace.c:886
rb_tracearg_path
VALUE rb_tracearg_path(rb_trace_arg_t *trace_arg)
Definition: vm_trace.c:818
rb_profile_frame_label
VALUE rb_profile_frame_label(VALUE frame)
Definition: vm_backtrace.c:1382
rb_thread_remove_event_hook
int rb_thread_remove_event_hook(VALUE thval, rb_event_hook_func_t func)
Definition: vm_trace.c:250