Ruby: include/ruby/debug.h Source File

Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)

debug.h
Go to the documentation of this file.
1#ifndef RB_DEBUG_H /*-*-C++-*-vi:se ft=cpp:*/
2#define RB_DEBUG_H 1
13#include "ruby/internal/dllexport.h"
14#include "ruby/internal/event.h"
15#include "ruby/internal/value.h"
16
17 RBIMPL_SYMBOL_EXPORT_BEGIN()
18
19/* Note: This file contains experimental APIs. */
20/* APIs can be replaced at Ruby 2.0.1 or later */
21
22
23/* profile frames APIs */
24 int rb_profile_frames(int start, int limit, VALUE *buff, int *lines);
25 VALUE rb_profile_frame_path(VALUE frame);
26 VALUE rb_profile_frame_absolute_path(VALUE frame);
27 VALUE rb_profile_frame_label(VALUE frame);
28 VALUE rb_profile_frame_base_label(VALUE frame);
29 VALUE rb_profile_frame_full_label(VALUE frame);
30 VALUE rb_profile_frame_first_lineno(VALUE frame);
31 VALUE rb_profile_frame_classpath(VALUE frame);
32 VALUE rb_profile_frame_singleton_method_p(VALUE frame);
33 VALUE rb_profile_frame_method_name(VALUE frame);
34 VALUE rb_profile_frame_qualified_method_name(VALUE frame);
35
36/* debug inspector APIs */
37typedef struct rb_debug_inspector_struct rb_debug_inspector_t;
38typedef VALUE (*rb_debug_inspector_func_t)(const rb_debug_inspector_t *, void *);
39
40 VALUE rb_debug_inspector_open(rb_debug_inspector_func_t func, void *data);
41 VALUE rb_debug_inspector_frame_self_get(const rb_debug_inspector_t *dc, long index);
42 VALUE rb_debug_inspector_frame_class_get(const rb_debug_inspector_t *dc, long index);
43 VALUE rb_debug_inspector_frame_binding_get(const rb_debug_inspector_t *dc, long index);
44 VALUE rb_debug_inspector_frame_iseq_get(const rb_debug_inspector_t *dc, long index);
45 VALUE rb_debug_inspector_backtrace_locations(const rb_debug_inspector_t *dc);
46
47/* Old style set_trace_func APIs */
48
49/* duplicated def of include/ruby/ruby.h */
50void rb_add_event_hook(rb_event_hook_func_t func, rb_event_flag_t events, VALUE data);
51int rb_remove_event_hook(rb_event_hook_func_t func);
52
53int rb_remove_event_hook_with_data(rb_event_hook_func_t func, VALUE data);
54void rb_thread_add_event_hook(VALUE thval, rb_event_hook_func_t func, rb_event_flag_t events, VALUE data);
55int rb_thread_remove_event_hook(VALUE thval, rb_event_hook_func_t func);
56int rb_thread_remove_event_hook_with_data(VALUE thval, rb_event_hook_func_t func, VALUE data);
57
58/* TracePoint APIs */
59
60 VALUE rb_tracepoint_new(VALUE target_thread_not_supported_yet, rb_event_flag_t events, void (*func)(VALUE, void *), void *data);
61 VALUE rb_tracepoint_enable(VALUE tpval);
62 VALUE rb_tracepoint_disable(VALUE tpval);
63 VALUE rb_tracepoint_enabled_p(VALUE tpval);
64
65typedef struct rb_trace_arg_struct rb_trace_arg_t;
66 rb_trace_arg_t *rb_tracearg_from_tracepoint(VALUE tpval);
67
68 rb_event_flag_t rb_tracearg_event_flag(rb_trace_arg_t *trace_arg);
69 VALUE rb_tracearg_event(rb_trace_arg_t *trace_arg);
70 VALUE rb_tracearg_lineno(rb_trace_arg_t *trace_arg);
71 VALUE rb_tracearg_path(rb_trace_arg_t *trace_arg);
72 VALUE rb_tracearg_method_id(rb_trace_arg_t *trace_arg);
73 VALUE rb_tracearg_callee_id(rb_trace_arg_t *trace_arg);
74 VALUE rb_tracearg_defined_class(rb_trace_arg_t *trace_arg);
75 VALUE rb_tracearg_binding(rb_trace_arg_t *trace_arg);
76 VALUE rb_tracearg_self(rb_trace_arg_t *trace_arg);
77 VALUE rb_tracearg_return_value(rb_trace_arg_t *trace_arg);
78 VALUE rb_tracearg_raised_exception(rb_trace_arg_t *trace_arg);
79 VALUE rb_tracearg_object(rb_trace_arg_t *trace_arg);
80
81/*
82 * Postponed Job API
83 * rb_postponed_job_register and rb_postponed_job_register_one are
84 * async-signal-safe and used via SIGPROF by the "stackprof" RubyGem
85 */
86typedef void (*rb_postponed_job_func_t)(void *arg);
87int rb_postponed_job_register(unsigned int flags, rb_postponed_job_func_t func, void *data);
88int rb_postponed_job_register_one(unsigned int flags, rb_postponed_job_func_t func, void *data);
89
90/* undocumented advanced tracing APIs */
91
92typedef enum {
93 RUBY_EVENT_HOOK_FLAG_SAFE = 0x01,
94 RUBY_EVENT_HOOK_FLAG_DELETED = 0x02,
95 RUBY_EVENT_HOOK_FLAG_RAW_ARG = 0x04
96} rb_event_hook_flag_t;
97
98void rb_add_event_hook2(rb_event_hook_func_t func, rb_event_flag_t events, VALUE data, rb_event_hook_flag_t hook_flag);
99void 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);
100
101 RBIMPL_SYMBOL_EXPORT_END()
102
103#endif /* RUBY_DEBUG_H */
rb_profile_frames
int rb_profile_frames(int start, int limit, VALUE *buff, int *lines)
Definition: vm_backtrace.c:1512
rb_profile_frame_full_label
VALUE rb_profile_frame_full_label(VALUE frame)
Definition: vm_backtrace.c:1737
rb_tracearg_binding
VALUE rb_tracearg_binding(rb_trace_arg_t *trace_arg)
Definition: vm_trace.c:917
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:161
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:1497
rb_tracepoint_enabled_p
VALUE rb_tracepoint_enabled_p(VALUE tpval)
Definition: vm_trace.c:1347
rb_tracearg_object
VALUE rb_tracearg_object(rb_trace_arg_t *trace_arg)
Definition: vm_trace.c:1018
rb_tracearg_callee_id
VALUE rb_tracearg_callee_id(rb_trace_arg_t *trace_arg)
Definition: vm_trace.c:903
rb_profile_frame_method_name
VALUE rb_profile_frame_method_name(VALUE frame)
Definition: vm_backtrace.c:1697
rb_tracearg_defined_class
VALUE rb_tracearg_defined_class(rb_trace_arg_t *trace_arg)
Definition: vm_trace.c:910
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:1407
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:168
rb_tracearg_raised_exception
VALUE rb_tracearg_raised_exception(rb_trace_arg_t *trace_arg)
Definition: vm_trace.c:952
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:155
rb_profile_frame_qualified_method_name
VALUE rb_profile_frame_qualified_method_name(VALUE frame)
Definition: vm_backtrace.c:1729
rb_profile_frame_label
VALUE rb_profile_frame_label(VALUE frame)
Definition: vm_backtrace.c:1627
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:174
rb_tracepoint_disable
VALUE rb_tracepoint_disable(VALUE tpval)
Definition: vm_trace.c:1233
rb_remove_event_hook
int rb_remove_event_hook(rb_event_hook_func_t func)
Definition: vm_trace.c:265
rb_tracearg_self
VALUE rb_tracearg_self(rb_trace_arg_t *trace_arg)
Definition: vm_trace.c:931
rb_thread_remove_event_hook
int rb_thread_remove_event_hook(VALUE thval, rb_event_hook_func_t func)
Definition: vm_trace.c:253
rb_profile_frame_singleton_method_p
VALUE rb_profile_frame_singleton_method_p(VALUE frame)
Definition: vm_backtrace.c:1684
rb_debug_inspector_backtrace_locations
VALUE rb_debug_inspector_backtrace_locations(const rb_debug_inspector_t *dc)
Definition: vm_backtrace.c:1506
rb_profile_frame_absolute_path
VALUE rb_profile_frame_absolute_path(VALUE frame)
Definition: vm_backtrace.c:1612
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:1627
rb_debug_inspector_open
VALUE rb_debug_inspector_open(rb_debug_inspector_func_t func, void *data)
Definition: vm_backtrace.c:1435
rb_tracearg_return_value
VALUE rb_tracearg_return_value(rb_trace_arg_t *trace_arg)
Definition: vm_trace.c:937
rb_tracearg_event_flag
rb_event_flag_t rb_tracearg_event_flag(rb_trace_arg_t *trace_arg)
Definition: vm_trace.c:802
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:1476
rb_tracearg_path
VALUE rb_tracearg_path(rb_trace_arg_t *trace_arg)
Definition: vm_trace.c:828
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:259
rb_tracepoint_enable
VALUE rb_tracepoint_enable(VALUE tpval)
Definition: vm_trace.c:1125
rb_debug_inspector_func_t
VALUE(* rb_debug_inspector_func_t)(const rb_debug_inspector_t *, void *)
Definition: debug.h:38
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:1490
rb_event_hook_flag_t
rb_event_hook_flag_t
Definition: debug.h:92
RUBY_EVENT_HOOK_FLAG_DELETED
@ RUBY_EVENT_HOOK_FLAG_DELETED
Definition: debug.h:94
RUBY_EVENT_HOOK_FLAG_SAFE
@ RUBY_EVENT_HOOK_FLAG_SAFE
Definition: debug.h:93
RUBY_EVENT_HOOK_FLAG_RAW_ARG
@ RUBY_EVENT_HOOK_FLAG_RAW_ARG
Definition: debug.h:95
rb_postponed_job_register
int rb_postponed_job_register(unsigned int flags, rb_postponed_job_func_t func, void *data)
Definition: vm_trace.c:1608
rb_tracearg_method_id
VALUE rb_tracearg_method_id(rb_trace_arg_t *trace_arg)
Definition: vm_trace.c:896
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:1483
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:271
rb_profile_frame_classpath
VALUE rb_profile_frame_classpath(VALUE frame)
Definition: vm_backtrace.c:1663
rb_tracearg_from_tracepoint
rb_trace_arg_t * rb_tracearg_from_tracepoint(VALUE tpval)
Definition: vm_trace.c:796
rb_profile_frame_path
VALUE rb_profile_frame_path(VALUE frame)
Definition: vm_backtrace.c:1580
rb_profile_frame_first_lineno
VALUE rb_profile_frame_first_lineno(VALUE frame)
Definition: vm_backtrace.c:1641
rb_tracearg_lineno
VALUE rb_tracearg_lineno(rb_trace_arg_t *trace_arg)
Definition: vm_trace.c:822
rb_postponed_job_func_t
void(* rb_postponed_job_func_t)(void *arg)
Definition: debug.h:86
rb_profile_frame_base_label
VALUE rb_profile_frame_base_label(VALUE frame)
Definition: vm_backtrace.c:1634
rb_tracearg_event
VALUE rb_tracearg_event(rb_trace_arg_t *trace_arg)
Definition: vm_trace.c:808
dllexport.h
Tewaking visibility of C variables/functions.
RBIMPL_SYMBOL_EXPORT_END
#define RBIMPL_SYMBOL_EXPORT_END()
Counterpart of RBIMPL_SYMBOL_EXPORT_BEGIN.
Definition: dllexport.h:86
RBIMPL_SYMBOL_EXPORT_BEGIN
#define RBIMPL_SYMBOL_EXPORT_BEGIN()
Shortcut macro equivalent to RUBY_SYMBOL_EXPORT_BEGIN extern "C" {.
Definition: dllexport.h:77
event.h
Debugging and tracing APIs.
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: event.h:67
rb_event_flag_t
uint32_t rb_event_flag_t
Definition: event.h:66
int
typedef int(ZCALLBACK *close_file_func) OF((voidpf opaque
const
#define const
Definition: strftime.c:108
rb_debug_inspector_struct
Definition: vm_backtrace.c:1322
rb_trace_arg_struct
Definition: vm_core.h:1933
value.h
Defines VALUE and ID.
VALUE
unsigned long VALUE
Definition: value.h:38