Ruby: debug.c Source File

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

debug.c
Go to the documentation of this file.
1/**********************************************************************
2
3 debug.c -
4
5 $Author$
6 created at: 04/08/25 02:31:54 JST
7
8 Copyright (C) 2004-2007 Koichi Sasada
9
10**********************************************************************/
11
12#include "ruby/internal/config.h"
13
14#include <stdio.h>
15
16#include "eval_intern.h"
17#include "id.h"
18#include "internal/signal.h"
19#include "internal/util.h"
20#include "ruby/encoding.h"
21#include "ruby/io.h"
22#include "ruby/ruby.h"
23#include "ruby/util.h"
24#include "symbol.h"
25#include "vm_core.h"
26#include "vm_debug.h"
27#include "vm_callinfo.h"
28#include "ruby/thread_native.h"
29#include "ractor_core.h"
30
31/* This is the only place struct RIMemo is actually used */
32 struct RIMemo {
33 VALUE flags;
34 VALUE v0;
35 VALUE v1;
36 VALUE v2;
37 VALUE v3;
38};
39
40/* for gdb */
41const union {
42 enum ruby_special_consts special_consts;
43 enum ruby_value_type value_type;
44 enum ruby_tag_type tag_type;
45 enum node_type node_type;
46 enum ruby_method_ids method_ids;
47 enum ruby_id_types id_types;
48 enum ruby_fl_type fl_types;
49 enum ruby_fl_ushift fl_ushift;
50 enum ruby_encoding_consts encoding_consts;
51 enum ruby_coderange_type enc_coderange_types;
52 enum ruby_econv_flag_type econv_flag_types;
53 rb_econv_result_t econv_result;
54 enum ruby_robject_flags robject_flags;
55 enum ruby_robject_consts robject_consts;
56 enum ruby_rmodule_flags rmodule_flags;
57 enum ruby_rstring_flags rstring_flags;
58 enum ruby_rstring_consts rstring_consts;
59 enum ruby_rarray_flags rarray_flags;
60 enum ruby_rarray_consts rarray_consts;
61 enum {
62 RUBY_FMODE_READABLE = FMODE_READABLE,
63 RUBY_FMODE_WRITABLE = FMODE_WRITABLE,
64 RUBY_FMODE_READWRITE = FMODE_READWRITE,
65 RUBY_FMODE_BINMODE = FMODE_BINMODE,
66 RUBY_FMODE_SYNC = FMODE_SYNC,
67 RUBY_FMODE_TTY = FMODE_TTY,
68 RUBY_FMODE_DUPLEX = FMODE_DUPLEX,
69 RUBY_FMODE_APPEND = FMODE_APPEND,
70 RUBY_FMODE_CREATE = FMODE_CREATE,
71 RUBY_FMODE_NOREVLOOKUP = 0x00000100,
72 RUBY_FMODE_TRUNC = FMODE_TRUNC,
73 RUBY_FMODE_TEXTMODE = FMODE_TEXTMODE,
74 RUBY_FMODE_PREP = 0x00010000,
75 RUBY_FMODE_SETENC_BY_BOM = FMODE_SETENC_BY_BOM,
76 RUBY_FMODE_UNIX = 0x00200000,
77 RUBY_FMODE_INET = 0x00400000,
78 RUBY_FMODE_INET6 = 0x00800000,
79
80 RUBY_NODE_TYPESHIFT = NODE_TYPESHIFT,
81 RUBY_NODE_TYPEMASK = NODE_TYPEMASK,
82 RUBY_NODE_LSHIFT = NODE_LSHIFT,
83 RUBY_NODE_FL_NEWLINE = NODE_FL_NEWLINE
84 } various;
85 union {
86 enum imemo_type types;
87 enum {RUBY_IMEMO_MASK = IMEMO_MASK} mask;
88 struct RIMemo *ptr;
89 } imemo;
90 struct RSymbol *symbol_ptr;
91 enum vm_call_flag_bits vm_call_flags;
92} ruby_dummy_gdb_enums;
93
94 const SIGNED_VALUE RUBY_NODE_LMASK = NODE_LMASK;
95
96int
97ruby_debug_print_indent(int level, int debug_level, int indent_level)
98{
99 if (level < debug_level) {
100 fprintf(stderr, "%*s", indent_level, "");
101 fflush(stderr);
102 return TRUE;
103 }
104 return FALSE;
105}
106
107void
108ruby_debug_printf(const char *format, ...)
109{
110 va_list ap;
111 va_start(ap, format);
112 vfprintf(stderr, format, ap);
113 va_end(ap);
114}
115
116#include "gc.h"
117
118 VALUE
119ruby_debug_print_value(int level, int debug_level, const char *header, VALUE obj)
120{
121 if (level < debug_level) {
122 char buff[0x100];
123 rb_raw_obj_info(buff, 0x100, obj);
124
125 fprintf(stderr, "DBG> %s: %s\n", header, buff);
126 fflush(stderr);
127 }
128 return obj;
129}
130
131void
132ruby_debug_print_v(VALUE v)
133{
134 ruby_debug_print_value(0, 1, "", v);
135}
136
137 ID
138ruby_debug_print_id(int level, int debug_level, const char *header, ID id)
139{
140 if (level < debug_level) {
141 fprintf(stderr, "DBG> %s: %s\n", header, rb_id2name(id));
142 fflush(stderr);
143 }
144 return id;
145}
146
147 NODE *
148ruby_debug_print_node(int level, int debug_level, const char *header, const NODE *node)
149{
150 if (level < debug_level) {
151 fprintf(stderr, "DBG> %s: %s (%u)\n", header,
152 ruby_node_name(nd_type(node)), nd_line(node));
153 }
154 return (NODE *)node;
155}
156
157void
158ruby_debug_breakpoint(void)
159{
160 /* */
161}
162
163#if defined _WIN32
164# if RUBY_MSVCRT_VERSION >= 80
165extern int ruby_w32_rtc_error;
166# endif
167#endif
168#if defined _WIN32 || defined __CYGWIN__
169#include <windows.h>
170UINT ruby_w32_codepage[2];
171#endif
172extern int ruby_rgengc_debug;
173extern int ruby_on_ci;
174
175int
176ruby_env_debug_option(const char *str, int len, void *arg)
177{
178 int ov;
179 size_t retlen;
180 unsigned long n;
181#define SET_WHEN(name, var, val) do { \
182 if (len == sizeof(name) - 1 && \
183 strncmp(str, (name), len) == 0) { \
184 (var) = (val); \
185 return 1; \
186 } \
187 } while (0)
188#define NAME_MATCH_VALUE(name) \
189 ((size_t)len >= sizeof(name)-1 && \
190 strncmp(str, (name), sizeof(name)-1) == 0 && \
191 ((len == sizeof(name)-1 && !(len = 0)) || \
192 (str[sizeof(name)-1] == '=' && \
193 (str += sizeof(name), len -= sizeof(name), 1))))
194#define SET_UINT(val) do { \
195 n = ruby_scan_digits(str, len, 10, &retlen, &ov); \
196 if (!ov && retlen) { \
197 val = (unsigned int)n; \
198 } \
199 str += retlen; \
200 len -= retlen; \
201 } while (0)
202#define SET_UINT_LIST(name, vals, num) do { \
203 int i; \
204 for (i = 0; i < (num); ++i) { \
205 SET_UINT((vals)[i]); \
206 if (!len || *str != ':') break; \
207 ++str; \
208 --len; \
209 } \
210 if (len > 0) { \
211 fprintf(stderr, "ignored "name" option: `%.*s'\n", len, str); \
212 } \
213 } while (0)
214#define SET_WHEN_UINT(name, vals, num, req) \
215 if (NAME_MATCH_VALUE(name)) SET_UINT_LIST(name, vals, num);
216
217 SET_WHEN("gc_stress", *ruby_initial_gc_stress_ptr, Qtrue);
218 SET_WHEN("core", ruby_enable_coredump, 1);
219 SET_WHEN("ci", ruby_on_ci, 1);
220 if (NAME_MATCH_VALUE("rgengc")) {
221 if (!len) ruby_rgengc_debug = 1;
222 else SET_UINT_LIST("rgengc", &ruby_rgengc_debug, 1);
223 return 1;
224 }
225#if defined _WIN32
226# if RUBY_MSVCRT_VERSION >= 80
227 SET_WHEN("rtc_error", ruby_w32_rtc_error, 1);
228# endif
229#endif
230#if defined _WIN32 || defined __CYGWIN__
231 if (NAME_MATCH_VALUE("codepage")) {
232 if (!len) fprintf(stderr, "missing codepage argument");
233 else SET_UINT_LIST("codepage", ruby_w32_codepage, numberof(ruby_w32_codepage));
234 return 1;
235 }
236#endif
237 return 0;
238}
239
240static void
241set_debug_option(const char *str, int len, void *arg)
242{
243 if (!ruby_env_debug_option(str, len, arg)) {
244 fprintf(stderr, "unexpected debug option: %.*s\n", len, str);
245 }
246}
247
248#ifdef USE_RUBY_DEBUG_LOG
249 STATIC_ASSERT(USE_RUBY_DEBUG_LOG, USE_RUBY_DEBUG_LOG ? RUBY_DEVEL : 1);
250#endif
251
252#if RUBY_DEVEL
253static void setup_debug_log(void);
254#else
255#define setup_debug_log()
256#endif
257
258void
259ruby_set_debug_option(const char *str)
260{
261 ruby_each_words(str, set_debug_option, 0);
262 setup_debug_log();
263}
264
265#if RUBY_DEVEL
266
267// RUBY_DEBUG_LOG features
268// See vm_debug.h comments for details.
269
270#define MAX_DEBUG_LOG 0x1000
271#define MAX_DEBUG_LOG_MESSAGE_LEN 0x0200
272#define MAX_DEBUG_LOG_FILTER 0x0010
273
274enum ruby_debug_log_mode ruby_debug_log_mode;
275
276static struct {
277 char *mem;
278 unsigned int cnt;
279 char filters[MAX_DEBUG_LOG_FILTER][MAX_DEBUG_LOG_FILTER];
280 unsigned int filters_num;
281 rb_nativethread_lock_t lock;
282 FILE *output;
283} debug_log;
284
285static char *
286RUBY_DEBUG_LOG_MEM_ENTRY(unsigned int index)
287{
288 return &debug_log.mem[MAX_DEBUG_LOG_MESSAGE_LEN * index];
289}
290
291static void
292 setup_debug_log(void)
293{
294 // check RUBY_DEBUG_LOG
295 const char *log_config = getenv("RUBY_DEBUG_LOG");
296 if (log_config) {
297 fprintf(stderr, "RUBY_DEBUG_LOG=%s\n", log_config);
298
299 if (strcmp(log_config, "mem") == 0) {
300 debug_log.mem = (char *)malloc(MAX_DEBUG_LOG * MAX_DEBUG_LOG_MESSAGE_LEN);
301 if (debug_log.mem == NULL) {
302 fprintf(stderr, "setup_debug_log failed (can't allocate memory)\n");
303 exit(1);
304 }
305 ruby_debug_log_mode |= ruby_debug_log_memory;
306 }
307 else if (strcmp(log_config, "stderr") == 0) {
308 ruby_debug_log_mode |= ruby_debug_log_stderr;
309 }
310 else {
311 ruby_debug_log_mode |= ruby_debug_log_file;
312 if ((debug_log.output = fopen(log_config, "w")) == NULL) {
313 fprintf(stderr, "can not open %s for RUBY_DEBUG_LOG\n", log_config);
314 exit(1);
315 }
316 setvbuf(debug_log.output, NULL, _IONBF, 0);
317 }
318
319 rb_nativethread_lock_initialize(&debug_log.lock);
320 }
321
322 // check RUBY_DEBUG_LOG_FILTER
323 const char *filter_config = getenv("RUBY_DEBUG_LOG_FILTER");
324 if (filter_config && strlen(filter_config) > 0) {
325 unsigned int i;
326 for (i=0; i<MAX_DEBUG_LOG_FILTER; i++) {
327 const char *p;
328 if ((p = strchr(filter_config, ',')) == NULL) {
329 if (strlen(filter_config) >= MAX_DEBUG_LOG_FILTER) {
330 fprintf(stderr, "too long: %s (max:%d)\n", filter_config, MAX_DEBUG_LOG_FILTER);
331 exit(1);
332 }
333 strncpy(debug_log.filters[i], filter_config, MAX_DEBUG_LOG_FILTER - 1);
334 i++;
335 break;
336 }
337 else {
338 size_t n = p - filter_config;
339 if (n >= MAX_DEBUG_LOG_FILTER) {
340 fprintf(stderr, "too long: %s (max:%d)\n", filter_config, MAX_DEBUG_LOG_FILTER);
341 exit(1);
342 }
343 strncpy(debug_log.filters[i], filter_config, n);
344 filter_config = p+1;
345 }
346 }
347 debug_log.filters_num = i;
348 for (i=0; i<debug_log.filters_num; i++) {
349 fprintf(stderr, "RUBY_DEBUG_LOG_FILTER[%d]=%s\n", i, debug_log.filters[i]);
350 }
351 }
352}
353
354bool
355 ruby_debug_log_filter(const char *func_name)
356{
357 if (debug_log.filters_num > 0) {
358 for (unsigned int i = 0; i<debug_log.filters_num; i++) {
359 if (strstr(func_name, debug_log.filters[i]) != NULL) {
360 return true;
361 }
362 }
363 return false;
364 }
365 else {
366 return true;
367 }
368}
369
370static const char *
371pretty_filename(const char *path)
372{
373 // basename is one idea.
374 const char *s;
375 while ((s = strchr(path, '/')) != NULL) {
376 path = s+1;
377 }
378 return path;
379}
380
381void
382 ruby_debug_log(const char *file, int line, const char *func_name, const char *fmt, ...)
383{
384 char buff[MAX_DEBUG_LOG_MESSAGE_LEN] = {0};
385 int len = 0;
386 int r = 0;
387
388 // message title
389 if (func_name && len < MAX_DEBUG_LOG_MESSAGE_LEN) {
390 r = snprintf(buff + len, MAX_DEBUG_LOG_MESSAGE_LEN, "%s\t", func_name);
391 if (r < 0) rb_bug("ruby_debug_log returns %d\n", r);
392 len += r;
393 }
394
395 // message
396 if (fmt && len < MAX_DEBUG_LOG_MESSAGE_LEN) {
397 va_list args;
398 va_start(args, fmt);
399 r = vsnprintf(buff + len, MAX_DEBUG_LOG_MESSAGE_LEN - len, fmt, args);
400 va_end(args);
401 if (r < 0) rb_bug("ruby_debug_log vsnprintf() returns %d", r);
402 len += r;
403 }
404
405 // optional information
406
407 // C location
408 if (file && len < MAX_DEBUG_LOG_MESSAGE_LEN) {
409 r = snprintf(buff + len, MAX_DEBUG_LOG_MESSAGE_LEN, "\t%s:%d", pretty_filename(file), line);
410 if (r < 0) rb_bug("ruby_debug_log returns %d\n", r);
411 len += r;
412 }
413
414 // Ruby location
415 int ruby_line;
416 const char *ruby_file = rb_source_location_cstr(&ruby_line);
417 if (len < MAX_DEBUG_LOG_MESSAGE_LEN) {
418 if (ruby_file) {
419 r = snprintf(buff + len, MAX_DEBUG_LOG_MESSAGE_LEN - len, "\t%s:%d", pretty_filename(ruby_file), ruby_line);
420 }
421 else {
422 r = snprintf(buff + len, MAX_DEBUG_LOG_MESSAGE_LEN - len, "\t");
423 }
424 if (r < 0) rb_bug("ruby_debug_log returns %d\n", r);
425 len += r;
426 }
427
428 // ractor information
429 if (ruby_single_main_ractor == NULL) {
430 rb_ractor_t *cr = GET_RACTOR();
431 if (r && len < MAX_DEBUG_LOG_MESSAGE_LEN) {
432 r = snprintf(buff + len, MAX_DEBUG_LOG_MESSAGE_LEN - len, "\tr:#%u/%u",
433 (unsigned int)rb_ractor_id(cr), GET_VM()->ractor.cnt);
434 if (r < 0) rb_bug("ruby_debug_log returns %d\n", r);
435 len += r;
436 }
437 }
438
439 // thread information
440 if (!rb_thread_alone()) {
441 const rb_thread_t *th = GET_THREAD();
442 if (r && len < MAX_DEBUG_LOG_MESSAGE_LEN) {
443 r = snprintf(buff + len, MAX_DEBUG_LOG_MESSAGE_LEN - len, "\tth:%p", (void *)th);
444 if (r < 0) rb_bug("ruby_debug_log returns %d\n", r);
445 len += r;
446 }
447 }
448
449 rb_nativethread_lock_lock(&debug_log.lock);
450 {
451 unsigned int cnt = debug_log.cnt++;
452
453 if (ruby_debug_log_mode & ruby_debug_log_memory) {
454 unsigned int index = cnt % MAX_DEBUG_LOG;
455 char *dst = RUBY_DEBUG_LOG_MEM_ENTRY(index);
456 strncpy(dst, buff, MAX_DEBUG_LOG_MESSAGE_LEN);
457 }
458 if (ruby_debug_log_mode & ruby_debug_log_stderr) {
459 fprintf(stderr, "%4u: %s\n", cnt, buff);
460 }
461 if (ruby_debug_log_mode & ruby_debug_log_file) {
462 fprintf(debug_log.output, "%u\t%s\n", cnt, buff);
463 }
464 }
465 rb_nativethread_lock_unlock(&debug_log.lock);
466}
467
468// for debugger
469static void
470debug_log_dump(FILE *out, unsigned int n)
471{
472 if (ruby_debug_log_mode & ruby_debug_log_memory) {
473 unsigned int size = debug_log.cnt > MAX_DEBUG_LOG ? MAX_DEBUG_LOG : debug_log.cnt;
474 unsigned int current_index = debug_log.cnt % MAX_DEBUG_LOG;
475 if (n == 0) n = size;
476 if (n > size) n = size;
477
478 for (unsigned int i=0; i<n; i++) {
479 int index = current_index - size + i;
480 if (index < 0) index += MAX_DEBUG_LOG;
481 VM_ASSERT(index <= MAX_DEBUG_LOG);
482 const char *mesg = RUBY_DEBUG_LOG_MEM_ENTRY(index);;
483 fprintf(out, "%4u: %s\n", debug_log.cnt - size + i, mesg);
484 }
485 }
486 else {
487 fprintf(stderr, "RUBY_DEBUG_LOG=mem is not specified.");
488 }
489}
490
491// for debuggers
492
493void
494 ruby_debug_log_print(unsigned int n)
495{
496 debug_log_dump(stderr, n);
497}
498
499void
500ruby_debug_log_dump(const char *fname, unsigned int n)
501{
502 FILE *fp = fopen(fname, "w");
503 if (fp == NULL) {
504 fprintf(stderr, "can't open %s. give up.\n", fname);
505 }
506 else {
507 debug_log_dump(fp, n);
508 fclose(fp);
509 }
510}
511#endif // #if RUBY_DEVEL
ruby_env_debug_option
int ruby_env_debug_option(const char *str, int len, void *arg)
Definition: debug.c:176
rstring_flags
enum ruby_rstring_flags rstring_flags
Definition: debug.c:57
vm_call_flags
enum vm_call_flag_bits vm_call_flags
Definition: debug.c:91
ruby_debug_breakpoint
void ruby_debug_breakpoint(void)
Definition: debug.c:158
various
enum @11::@12 various
ruby_debug_print_indent
int ruby_debug_print_indent(int level, int debug_level, int indent_level)
Definition: debug.c:97
SET_WHEN
#define SET_WHEN(name, var, val)
value_type
enum ruby_value_type value_type
Definition: debug.c:43
NAME_MATCH_VALUE
#define NAME_MATCH_VALUE(name)
econv_flag_types
enum ruby_econv_flag_type econv_flag_types
Definition: debug.c:52
node_type
enum node_type node_type
Definition: debug.c:45
mask
enum @11::@13::@14 mask
rarray_consts
enum ruby_rarray_consts rarray_consts
Definition: debug.c:60
imemo
union @11::@13 imemo
ruby_set_debug_option
void ruby_set_debug_option(const char *str)
Definition: debug.c:259
robject_consts
enum ruby_robject_consts robject_consts
Definition: debug.c:55
ruby_dummy_gdb_enums
const union @11 ruby_dummy_gdb_enums
special_consts
enum ruby_special_consts special_consts
Definition: debug.c:42
robject_flags
enum ruby_robject_flags robject_flags
Definition: debug.c:54
ruby_debug_print_v
void ruby_debug_print_v(VALUE v)
Definition: debug.c:132
rstring_consts
enum ruby_rstring_consts rstring_consts
Definition: debug.c:58
ruby_debug_printf
void ruby_debug_printf(const char *format,...)
Definition: debug.c:108
econv_result
rb_econv_result_t econv_result
Definition: debug.c:53
ruby_on_ci
int ruby_on_ci
Definition: vm_dump.c:47
method_ids
enum ruby_method_ids method_ids
Definition: debug.c:46
ruby_debug_print_id
ID ruby_debug_print_id(int level, int debug_level, const char *header, ID id)
Definition: debug.c:138
tag_type
enum ruby_tag_type tag_type
Definition: debug.c:44
enc_coderange_types
enum ruby_coderange_type enc_coderange_types
Definition: debug.c:51
rarray_flags
enum ruby_rarray_flags rarray_flags
Definition: debug.c:59
ruby_debug_print_value
VALUE ruby_debug_print_value(int level, int debug_level, const char *header, VALUE obj)
Definition: debug.c:119
id_types
enum ruby_id_types id_types
Definition: debug.c:47
fl_types
enum ruby_fl_type fl_types
Definition: debug.c:48
fl_ushift
enum ruby_fl_ushift fl_ushift
Definition: debug.c:49
ptr
struct RIMemo * ptr
Definition: debug.c:88
ruby_rgengc_debug
int ruby_rgengc_debug
Definition: gc.c:383
setup_debug_log
#define setup_debug_log()
Definition: debug.c:255
types
enum imemo_type types
Definition: debug.c:86
encoding_consts
enum ruby_encoding_consts encoding_consts
Definition: debug.c:50
RUBY_NODE_LMASK
const SIGNED_VALUE RUBY_NODE_LMASK
Definition: debug.c:94
rmodule_flags
enum ruby_rmodule_flags rmodule_flags
Definition: debug.c:56
symbol_ptr
struct RSymbol * symbol_ptr
Definition: debug.c:90
SET_UINT_LIST
#define SET_UINT_LIST(name, vals, num)
ruby_debug_print_node
NODE * ruby_debug_print_node(int level, int debug_level, const char *header, const NODE *node)
Definition: debug.c:148
strchr
char * strchr(char *, char)
out
string_t out
Definition: enough.c:230
len
uint8_t len
Definition: escape.c:17
str
char str[HTML_ESCAPE_MAX_LEN+1]
Definition: escape.c:18
numberof
#define numberof(array)
Definition: etc.c:649
eval_intern.h
ruby_fl_ushift
ruby_fl_ushift
Definition: fl_type.h:150
ruby_fl_type
ruby_fl_type
Definition: fl_type.h:162
ruby_initial_gc_stress_ptr
VALUE * ruby_initial_gc_stress_ptr
Definition: gc.c:879
rb_raw_obj_info
const char * rb_raw_obj_info(char *buff, const int buff_size, VALUE obj)
Definition: gc.c:12229
rb_bug
void rb_bug(const char *fmt,...)
Definition: error.c:768
id.h
ruby_method_ids
ruby_method_ids
Definition: id.h:78
ruby_id_types
ruby_id_types
Definition: id.h:16
IMEMO_MASK
#define IMEMO_MASK
Definition: imemo.h:23
imemo_type
imemo_type
Definition: imemo.h:34
encoding.h
ruby_coderange_type
ruby_coderange_type
Definition: encoding.h:55
ruby_encoding_consts
ruby_encoding_consts
Definition: encoding.h:21
rb_econv_result_t
rb_econv_result_t
Definition: encoding.h:288
ruby_econv_flag_type
ruby_econv_flag_type
Definition: encoding.h:352
config.h
Thin wrapper to ruby/config.h.
rb_thread_alone
int rb_thread_alone(void)
Definition: thread.c:3757
rb_id2name
const char * rb_id2name(ID)
Definition: symbol.c:944
io.h
FMODE_READABLE
#define FMODE_READABLE
Definition: io.h:105
FMODE_SETENC_BY_BOM
#define FMODE_SETENC_BY_BOM
Definition: io.h:119
FMODE_READWRITE
#define FMODE_READWRITE
Definition: io.h:107
FMODE_TTY
#define FMODE_TTY
Definition: io.h:110
FMODE_CREATE
#define FMODE_CREATE
Definition: io.h:113
FMODE_WRITABLE
#define FMODE_WRITABLE
Definition: io.h:106
FMODE_APPEND
#define FMODE_APPEND
Definition: io.h:112
FMODE_DUPLEX
#define FMODE_DUPLEX
Definition: io.h:111
FMODE_BINMODE
#define FMODE_BINMODE
Definition: io.h:108
FMODE_SYNC
#define FMODE_SYNC
Definition: io.h:109
FMODE_TEXTMODE
#define FMODE_TEXTMODE
Definition: io.h:117
FMODE_TRUNC
#define FMODE_TRUNC
Definition: io.h:116
strstr
char * strstr(const char *, const char *)
Definition: strstr.c:8
util.h
ruby_each_words
void ruby_each_words(const char *, void(*)(const char *, int, void *), void *)
Definition: util.c:589
gc.h
Internal header for GC.
signal.h
Internal header for SignalException.
ruby_enable_coredump
int ruby_enable_coredump
Definition: signal.c:1507
STATIC_ASSERT
#define STATIC_ASSERT
Definition: static_assert.h:14
util.h
Internal header corresponding util.c.
rb_source_location_cstr
const char * rb_source_location_cstr(int *pline)
Definition: vm.c:1616
size
voidpf void uLong size
Definition: ioapi.h:138
ruby_node_name
const char * ruby_node_name(int node)
Definition: iseq.c:2593
id
const int id
Definition: nkf.c:209
TRUE
#define TRUE
Definition: nkf.h:175
FALSE
#define FALSE
Definition: nkf.h:174
nd_line
#define nd_line(n)
Definition: node.h:196
node_type
node_type
Definition: node.h:21
NODE_TYPESHIFT
#define NODE_TYPESHIFT
Definition: node.h:185
NODE_TYPEMASK
#define NODE_TYPEMASK
Definition: node.h:186
NODE_LMASK
#define NODE_LMASK
Definition: node.h:195
NODE_FL_NEWLINE
#define NODE_FL_NEWLINE
Definition: node.h:183
NODE_LSHIFT
#define NODE_LSHIFT
Definition: node.h:194
nd_type
#define nd_type(n)
Definition: node.h:188
ractor_core.h
ruby_rarray_flags
ruby_rarray_flags
Definition: rarray.h:72
ruby_rarray_consts
ruby_rarray_consts
Definition: rarray.h:82
ruby_rmodule_flags
ruby_rmodule_flags
Definition: rclass.h:35
NULL
#define NULL
Definition: regenc.h:69
ruby_robject_consts
ruby_robject_consts
Definition: robject.h:48
ruby_robject_flags
ruby_robject_flags
Definition: robject.h:46
ruby_rstring_consts
ruby_rstring_consts
Definition: rstring.h:68
ruby_rstring_flags
ruby_rstring_flags
Definition: rstring.h:59
ruby.h
cnt
rb_atomic_t cnt[RUBY_NSIG]
Definition: signal.c:508
ruby_special_consts
ruby_special_consts
special constants - i.e.
Definition: special_consts.h:75
Qtrue
#define Qtrue
Definition: special_consts.h:52
malloc
#define malloc
Definition: st.c:170
strlen
size_t strlen(const char *)
__sFILE
Definition: vsnprintf.c:169
RIMemo
Definition: debug.c:32
RIMemo::v0
VALUE v0
Definition: debug.c:34
RIMemo::v2
VALUE v2
Definition: debug.c:36
RIMemo::v1
VALUE v1
Definition: debug.c:35
RIMemo::flags
VALUE flags
Definition: debug.c:33
RIMemo::v3
VALUE v3
Definition: debug.c:37
RNode
Definition: node.h:149
RSymbol
Definition: symbol.h:26
file
Definition: gzappend.c:170
rb_ractor_struct
Definition: ractor_core.h:82
rb_thread_struct
Definition: vm_core.h:935
vsnprintf
#define vsnprintf
Definition: subst.h:15
snprintf
#define snprintf
Definition: subst.h:14
symbol.h
thread_native.h
rb_nativethread_lock_lock
void rb_nativethread_lock_lock(rb_nativethread_lock_t *lock)
Definition: thread.c:442
rb_nativethread_lock_unlock
void rb_nativethread_lock_unlock(rb_nativethread_lock_t *lock)
Definition: thread.c:448
rb_nativethread_lock_initialize
void rb_nativethread_lock_initialize(rb_nativethread_lock_t *lock)
Definition: thread.c:430
VALUE
unsigned long VALUE
Definition: value.h:38
SIGNED_VALUE
#define SIGNED_VALUE
Definition: value.h:40
ID
unsigned long ID
Definition: value.h:39
ruby_value_type
ruby_value_type
C-level type of an object.
Definition: value_type.h:110
ruby_single_main_ractor
rb_ractor_t * ruby_single_main_ractor
Definition: vm.c:381
vm_callinfo.h
vm_call_flag_bits
vm_call_flag_bits
Definition: vm_callinfo.h:14
vm_core.h
ruby_tag_type
ruby_tag_type
Definition: vm_core.h:185
VM_ASSERT
#define VM_ASSERT(expr)
Definition: vm_core.h:61
vm_debug.h
ruby_debug_log_filter
bool ruby_debug_log_filter(const char *func_name)
ruby_debug_log
void ruby_debug_log(const char *file, int line, const char *func_name, const char *fmt,...)
ruby_debug_log_print
void ruby_debug_log_print(unsigned int n)
ruby_debug_log_mode
ruby_debug_log_mode
Definition: vm_debug.h:83
ruby_debug_log_file
@ ruby_debug_log_file
Definition: vm_debug.h:87
ruby_debug_log_stderr
@ ruby_debug_log_stderr
Definition: vm_debug.h:86
ruby_debug_log_memory
@ ruby_debug_log_memory
Definition: vm_debug.h:85
getenv
#define getenv(name)
Definition: win32.c:80