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

Ruby 3.3.5p100 (2024-09-03 revision ef084cc8f4958c1b6e4ead99136631bef6d8ddba)

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#ifdef HAVE_STDINT_H
27#include <stdint.h>
28#endif
29
30/* These macros are not enums because they are wider than int.*/
31
37#define RUBY_EVENT_NONE 0x0000
38#define RUBY_EVENT_LINE 0x0001
39#define RUBY_EVENT_CLASS 0x0002
40#define RUBY_EVENT_END 0x0004
41#define RUBY_EVENT_CALL 0x0008
42#define RUBY_EVENT_RETURN 0x0010
43#define RUBY_EVENT_C_CALL 0x0020
44#define RUBY_EVENT_C_RETURN 0x0040
45#define RUBY_EVENT_RAISE 0x0080
46#define RUBY_EVENT_ALL 0x00ff
55#define RUBY_EVENT_B_CALL 0x0100
56#define RUBY_EVENT_B_RETURN 0x0200
57#define RUBY_EVENT_THREAD_BEGIN 0x0400
58#define RUBY_EVENT_THREAD_END 0x0800
59#define RUBY_EVENT_FIBER_SWITCH 0x1000
60#define RUBY_EVENT_SCRIPT_COMPILED 0x2000
61#define RUBY_EVENT_RESCUE 0x4000
62#define RUBY_EVENT_TRACEPOINT_ALL 0xffff
77#define RUBY_EVENT_RESERVED_FOR_INTERNAL_USE 0x030000
90#define RUBY_INTERNAL_EVENT_SWITCH 0x040000
91#define RUBY_EVENT_SWITCH 0x040000
92 /* 0x080000 */
93#define RUBY_INTERNAL_EVENT_NEWOBJ 0x100000
94#define RUBY_INTERNAL_EVENT_FREEOBJ 0x200000
95#define RUBY_INTERNAL_EVENT_GC_START 0x400000
96#define RUBY_INTERNAL_EVENT_GC_END_MARK 0x800000
97#define RUBY_INTERNAL_EVENT_GC_END_SWEEP 0x1000000
98#define RUBY_INTERNAL_EVENT_GC_ENTER 0x2000000
99#define RUBY_INTERNAL_EVENT_GC_EXIT 0x4000000
100#define RUBY_INTERNAL_EVENT_OBJSPACE_MASK 0x7f00000
101#define RUBY_INTERNAL_EVENT_MASK 0xffff0000
108 typedef uint32_t rb_event_flag_t;
109
120 typedef void (*rb_event_hook_func_t)(rb_event_flag_t evflag, VALUE data, VALUE self, ID mid, VALUE klass);
121
129#define RB_EVENT_HOOKS_HAVE_CALLBACK_DATA 1
130
131 RBIMPL_SYMBOL_EXPORT_BEGIN()
132
133
140void rb_add_event_hook(rb_event_hook_func_t func, rb_event_flag_t events, VALUE data);
141
156int rb_remove_event_hook(rb_event_hook_func_t func);
157 RBIMPL_SYMBOL_EXPORT_END()
158
159#endif /* RBIMPL_EVENT_H */
dllexport.h
Tweaking visibility of C variables/functions.
RBIMPL_SYMBOL_EXPORT_END
#define RBIMPL_SYMBOL_EXPORT_END()
Counterpart of RBIMPL_SYMBOL_EXPORT_BEGIN.
Definition dllexport.h:74
RBIMPL_SYMBOL_EXPORT_BEGIN
#define RBIMPL_SYMBOL_EXPORT_BEGIN()
Shortcut macro equivalent to RUBY_SYMBOL_EXPORT_BEGIN extern "C" {.
Definition dllexport.h:65
rb_add_event_hook
void rb_add_event_hook(rb_event_hook_func_t func, rb_event_flag_t events, VALUE data)
Registers an event hook function.
Definition vm_trace.c:207
rb_remove_event_hook
int rb_remove_event_hook(rb_event_hook_func_t func)
Removes the passed function from the list of event hooks.
Definition vm_trace.c:315
rb_event_hook_func_t
void(* rb_event_hook_func_t)(rb_event_flag_t evflag, VALUE data, VALUE self, ID mid, VALUE klass)
Type of event hooks.
Definition event.h:120
rb_event_flag_t
uint32_t rb_event_flag_t
Represents event(s).
Definition event.h:108
value.h
Defines VALUE and ID.
ID
uintptr_t ID
Type that represents a Ruby identifier such as a variable name.
Definition value.h:52
VALUE
uintptr_t VALUE
Type that represents a Ruby object.
Definition value.h:40