Ruby: include/ruby/internal/event.h Source File

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

event.h
Go to the documentation of this file.
1#ifndef RBIMPL_EVENT_H /*-*-C++-*-vi:se ft=cpp:*/
2#define RBIMPL_EVENT_H
23#include "ruby/internal/dllexport.h"
24#include "ruby/internal/value.h"
25
26 RBIMPL_SYMBOL_EXPORT_BEGIN()
27
28/* traditional set_trace_func events */
29#define RUBY_EVENT_NONE 0x0000
30#define RUBY_EVENT_LINE 0x0001
31#define RUBY_EVENT_CLASS 0x0002
32#define RUBY_EVENT_END 0x0004
33#define RUBY_EVENT_CALL 0x0008
34#define RUBY_EVENT_RETURN 0x0010
35#define RUBY_EVENT_C_CALL 0x0020
36#define RUBY_EVENT_C_RETURN 0x0040
37#define RUBY_EVENT_RAISE 0x0080
38#define RUBY_EVENT_ALL 0x00ff
39
40/* for TracePoint extended events */
41#define RUBY_EVENT_B_CALL 0x0100
42#define RUBY_EVENT_B_RETURN 0x0200
43#define RUBY_EVENT_THREAD_BEGIN 0x0400
44#define RUBY_EVENT_THREAD_END 0x0800
45#define RUBY_EVENT_FIBER_SWITCH 0x1000
46#define RUBY_EVENT_SCRIPT_COMPILED 0x2000
47#define RUBY_EVENT_TRACEPOINT_ALL 0xffff
48
49/* special events */
50#define RUBY_EVENT_RESERVED_FOR_INTERNAL_USE 0x030000
51
52/* internal events */
53#define RUBY_INTERNAL_EVENT_SWITCH 0x040000
54#define RUBY_EVENT_SWITCH 0x040000 /* obsolete name. this macro is for compatibility */
55 /* 0x080000 */
56#define RUBY_INTERNAL_EVENT_NEWOBJ 0x100000
57#define RUBY_INTERNAL_EVENT_FREEOBJ 0x200000
58#define RUBY_INTERNAL_EVENT_GC_START 0x400000
59#define RUBY_INTERNAL_EVENT_GC_END_MARK 0x800000
60#define RUBY_INTERNAL_EVENT_GC_END_SWEEP 0x1000000
61#define RUBY_INTERNAL_EVENT_GC_ENTER 0x2000000
62#define RUBY_INTERNAL_EVENT_GC_EXIT 0x4000000
63#define RUBY_INTERNAL_EVENT_OBJSPACE_MASK 0x7f00000
64#define RUBY_INTERNAL_EVENT_MASK 0xffff0000
65
66 typedef uint32_t rb_event_flag_t;
67 typedef void (*rb_event_hook_func_t)(rb_event_flag_t evflag, VALUE data, VALUE self, ID mid, VALUE klass);
68
69#define RB_EVENT_HOOKS_HAVE_CALLBACK_DATA 1
70void rb_add_event_hook(rb_event_hook_func_t func, rb_event_flag_t events, VALUE data);
71int rb_remove_event_hook(rb_event_hook_func_t func);
72
73 RBIMPL_SYMBOL_EXPORT_END()
74
75#endif /* RBIMPL_EVENT_H */
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
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_remove_event_hook
int rb_remove_event_hook(rb_event_hook_func_t func)
Definition: vm_trace.c:265
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
uint32_t
unsigned int uint32_t
Definition: sha2.h:101
value.h
Defines VALUE and ID.
VALUE
unsigned long VALUE
Definition: value.h:38
ID
unsigned long ID
Definition: value.h:39