Tempfile document updated.
[ruby.git] / .gdbinit
blob7dd3336e286115ec24ae19217133117eaad983b8
1 set startup-with-shell off
3 define hook-run
4   set $color_type = 0
5   set $color_highlite = 0
6   set $color_end = 0
7 end
9 define ruby_gdb_init
10   if !$color_type
11     set $color_type = "\033[31m"
12   end
13   if !$color_highlite
14     set $color_highlite = "\033[36m"
15   end
16   if !$color_end
17     set $color_end = "\033[m"
18   end
19   if ruby_dummy_gdb_enums.special_consts
20   end
21 end
23 # set prompt \033[36m(gdb)\033[m\040
25 define rp
26   ruby_gdb_init
27   if (VALUE)($arg0) & RUBY_FIXNUM_FLAG
28     printf "FIXNUM: %ld\n", (long)($arg0) >> 1
29   else
30   if ((VALUE)($arg0) & ~(~(VALUE)0<<RUBY_SPECIAL_SHIFT)) == RUBY_SYMBOL_FLAG
31     set $id = (($arg0) >> RUBY_SPECIAL_SHIFT)
32     printf "%sSYMBOL%s: ", $color_type, $color_end
33     rp_id $id
34   else
35   if ($arg0) == RUBY_Qfalse
36     echo false\n
37   else
38   if ($arg0) == RUBY_Qtrue
39     echo true\n
40   else
41   if ($arg0) == RUBY_Qnil
42     echo nil\n
43   else
44   if ($arg0) == RUBY_Qundef
45     echo undef\n
46   else
47   if (VALUE)($arg0) & RUBY_IMMEDIATE_MASK
48     if ((VALUE)($arg0) & RUBY_FLONUM_MASK) == RUBY_FLONUM_FLAG
49       printf "%sFLONUM%s: %g\n", $color_type, $color_end, (double)rb_float_value($arg0)
50     else
51       echo immediate\n
52     end
53   else
54   set $flags = ((struct RBasic*)($arg0))->flags
55   if ($flags & RUBY_FL_PROMOTED) == RUBY_FL_PROMOTED
56     printf "[PROMOTED] "
57   end
58   if ($flags & RUBY_T_MASK) == RUBY_T_NONE
59     printf "%sT_NONE%s: ", $color_type, $color_end
60     print (struct RBasic *)($arg0)
61   else
62   if ($flags & RUBY_T_MASK) == RUBY_T_NIL
63     printf "%sT_NIL%s: ", $color_type, $color_end
64     print (struct RBasic *)($arg0)
65   else
66   if ($flags & RUBY_T_MASK) == RUBY_T_OBJECT
67     printf "%sT_OBJECT%s: ", $color_type, $color_end
68     print ((struct RObject *)($arg0))->basic
69     if ($flags & ROBJECT_EMBED)
70       print/x *((VALUE*)((struct RObject*)($arg0))->as.ary) @ (rb_shape_get_shape($arg0)->capacity)
71     else
72       print (((struct RObject *)($arg0))->as.heap)
73       if (((struct RObject*)($arg0))->as.heap.numiv) > 0
74         print/x *(((struct RObject*)($arg0))->as.heap.ivptr) @ (((struct RObject*)($arg0))->as.heap.numiv)
75       end
76     end
77   else
78   if ($flags & RUBY_T_MASK) == RUBY_T_CLASS
79     printf "%sT_CLASS%s%s: ", $color_type, ($flags & RUBY_FL_SINGLETON) ? "*" : "", $color_end
80     rp_class $arg0
81   else
82   if ($flags & RUBY_T_MASK) == RUBY_T_ICLASS
83     printf "%sT_ICLASS%s: ", $color_type, $color_end
84     rp_class $arg0
85   else
86   if ($flags & RUBY_T_MASK) == RUBY_T_MODULE
87     printf "%sT_MODULE%s: ", $color_type, $color_end
88     rp_class $arg0
89   else
90   if ($flags & RUBY_T_MASK) == RUBY_T_FLOAT
91     printf "%sT_FLOAT%s: %.16g ", $color_type, $color_end, (((struct RFloat*)($arg0))->float_value)
92     print (struct RFloat *)($arg0)
93   else
94   if ($flags & RUBY_T_MASK) == RUBY_T_STRING
95     printf "%sT_STRING%s: ", $color_type, $color_end
96     rp_string $arg0 $flags
97   else
98   if ($flags & RUBY_T_MASK) == RUBY_T_REGEXP
99     set $regsrc = ((struct RRegexp*)($arg0))->src
100     set $rsflags = ((struct RBasic*)$regsrc)->flags
101     printf "%sT_REGEXP%s: ", $color_type, $color_end
102     set $len = ($rsflags & RUBY_FL_USER1) ? \
103             ((struct RString*)$regsrc)->as.heap.len : \
104             (($rsflags & (RUBY_FL_USER2|RUBY_FL_USER3|RUBY_FL_USER4|RUBY_FL_USER5|RUBY_FL_USER6)) >> RUBY_FL_USHIFT+2)
105     set print address off
106     output *(char *)(($rsflags & RUBY_FL_USER1) ? \
107             ((struct RString*)$regsrc)->as.heap.ptr : \
108             ((struct RString*)$regsrc)->as.ary) @ $len
109     set print address on
110     printf " len:%ld ", $len
111     if $flags & RUBY_FL_USER6
112       printf "(none) "
113     end
114     if $flags & RUBY_FL_USER5
115       printf "(literal) "
116     end
117     if $flags & RUBY_FL_USER4
118       printf "(fixed) "
119     end
120     printf "encoding:%d ", ($flags & RUBY_ENCODING_MASK) >> RUBY_ENCODING_SHIFT
121     print (struct RRegexp *)($arg0)
122   else
123   if ($flags & RUBY_T_MASK) == RUBY_T_ARRAY
124     if ($flags & RUBY_FL_USER1)
125       set $len = (($flags & (RUBY_FL_USER3|RUBY_FL_USER4)) >> (RUBY_FL_USHIFT+3))
126       printf "%sT_ARRAY%s: len=%ld ", $color_type, $color_end, $len
127       printf "(embed) "
128       if ($len == 0)
129         printf "{(empty)} "
130       else
131         print/x *((VALUE*)((struct RArray*)($arg0))->as.ary) @ $len
132         printf " "
133       end
134     else
135       set $len = ((struct RArray*)($arg0))->as.heap.len
136       printf "%sT_ARRAY%s: len=%ld ", $color_type, $color_end, $len
137       if ($flags & RUBY_FL_USER2)
138         printf "(shared) shared="
139         output/x ((struct RArray*)($arg0))->as.heap.aux.shared_root
140         printf " "
141       else
142         printf "(ownership) capa=%ld ", ((struct RArray*)($arg0))->as.heap.aux.capa
143       end
144       if ($len == 0)
145         printf "{(empty)} "
146       else
147         print/x *((VALUE*)((struct RArray*)($arg0))->as.heap.ptr) @ $len
148         printf " "
149       end
150     end
151     print (struct RArray *)($arg0)
152   else
153   if ($flags & RUBY_T_MASK) == RUBY_T_FIXNUM
154     printf "%sT_FIXNUM%s: ", $color_type, $color_end
155     print (struct RBasic *)($arg0)
156   else
157   if ($flags & RUBY_T_MASK) == RUBY_T_HASH
158     printf "%sT_HASH%s: ", $color_type, $color_end,
159     if (((struct RHash *)($arg0))->basic.flags & RHASH_ST_TABLE_FLAG)
160       printf "st len=%ld ", ((struct RHash *)($arg0))->as.st->num_entries
161     else
162       printf "li len=%ld bound=%ld ", \
163         ((((struct RHash *)($arg0))->basic.flags & RHASH_AR_TABLE_SIZE_MASK) >> RHASH_AR_TABLE_SIZE_SHIFT), \
164         ((((struct RHash *)($arg0))->basic.flags & RHASH_AR_TABLE_BOUND_MASK) >> RHASH_AR_TABLE_BOUND_SHIFT)
165     end
166     print (struct RHash *)($arg0)
167   else
168   if ($flags & RUBY_T_MASK) == RUBY_T_STRUCT
169     set $len = (($flags & (RUBY_FL_USER1|RUBY_FL_USER2)) ? \
170        ($flags & (RUBY_FL_USER1|RUBY_FL_USER2)) >> (RUBY_FL_USHIFT+1) : \
171        ((struct RStruct *)($arg0))->as.heap.len)
172     printf "%sT_STRUCT%s: len=%ld ", $color_type, $color_end, $len
173     print (struct RStruct *)($arg0)
174     output/x *(($flags & (RUBY_FL_USER1|RUBY_FL_USER2)) ? \
175               ((struct RStruct *)($arg0))->as.ary : \
176               ((struct RStruct *)($arg0))->as.heap.ptr) @ $len
177   else
178   if ($flags & RUBY_T_MASK) == RUBY_T_BIGNUM
179     rp_bignum $arg0
180   else
181   if ($flags & RUBY_T_MASK) == RUBY_T_RATIONAL
182     printf "%sT_RATIONAL%s: ", $color_type, $color_end
183     print (struct RRational *)($arg0)
184   else
185   if ($flags & RUBY_T_MASK) == RUBY_T_COMPLEX
186     printf "%sT_COMPLEX%s: ", $color_type, $color_end
187     print (struct RComplex *)($arg0)
188   else
189   if ($flags & RUBY_T_MASK) == RUBY_T_FILE
190     printf "%sT_FILE%s: ", $color_type, $color_end
191     print (struct RFile *)($arg0)
192     output *((struct RFile *)($arg0))->fptr
193     printf "\n"
194   else
195   if ($flags & RUBY_T_MASK) == RUBY_T_TRUE
196     printf "%sT_TRUE%s: ", $color_type, $color_end
197     print (struct RBasic *)($arg0)
198   else
199   if ($flags & RUBY_T_MASK) == RUBY_T_FALSE
200     printf "%sT_FALSE%s: ", $color_type, $color_end
201     print (struct RBasic *)($arg0)
202   else
203   if ($flags & RUBY_T_MASK) == RUBY_T_DATA
204     if ((struct RTypedData *)($arg0))->typed_flag == 1
205       printf "%sT_DATA%s(%s): ", $color_type, $color_end, ((struct RTypedData *)($arg0))->type->wrap_struct_name
206       print (struct RTypedData *)($arg0)
207     else
208       printf "%sT_DATA%s: ", $color_type, $color_end
209       print (struct RData *)($arg0)
210     end
211   else
212   if ($flags & RUBY_T_MASK) == RUBY_T_MATCH
213     printf "%sT_MATCH%s: ", $color_type, $color_end
214     print (struct RMatch *)($arg0)
215   else
216   if ($flags & RUBY_T_MASK) == RUBY_T_SYMBOL
217     printf "%sT_SYMBOL%s: ", $color_type, $color_end
218     print (struct RSymbol *)($arg0)
219     set $id_type = ((struct RSymbol *)($arg0))->id & RUBY_ID_SCOPE_MASK
220     if $id_type == RUBY_ID_LOCAL
221       printf "l"
222     else
223     if $id_type == RUBY_ID_INSTANCE
224       printf "i"
225     else
226     if $id_type == RUBY_ID_GLOBAL
227       printf "G"
228     else
229     if $id_type == RUBY_ID_ATTRSET
230       printf "a"
231     else
232     if $id_type == RUBY_ID_CONST
233       printf "C"
234     else
235     if $id_type == RUBY_ID_CLASS
236       printf "c"
237     else
238       printf "j"
239     end
240     end
241     end
242     end
243     end
244     end
245     set $id_fstr = ((struct RSymbol *)($arg0))->fstr
246     rp_string $id_fstr
247   else
248   if ($flags & RUBY_T_MASK) == RUBY_T_UNDEF
249     printf "%sT_UNDEF%s: ", $color_type, $color_end
250     print (struct RBasic *)($arg0)
251   else
252   if ($flags & RUBY_T_MASK) == RUBY_T_IMEMO
253     printf "%sT_IMEMO%s(", $color_type, $color_end
254     output (enum imemo_type)(($flags>>RUBY_FL_USHIFT)&RUBY_IMEMO_MASK)
255     printf "): "
256     rp_imemo $arg0
257   else
258   if ($flags & RUBY_T_MASK) == RUBY_T_NODE
259     printf "%sT_NODE%s(", $color_type, $color_end
260     output (enum node_type)(($flags&RUBY_NODE_TYPEMASK)>>RUBY_NODE_TYPESHIFT)
261     printf "): "
262     print *(NODE *)($arg0)
263   else
264   if ($flags & RUBY_T_MASK) == RUBY_T_ZOMBIE
265     printf "%sT_ZOMBIE%s: ", $color_type, $color_end
266     print (struct RData *)($arg0)
267   else
268   if ($flags & RUBY_T_MASK) == RUBY_T_MOVED
269     printf "%sT_MOVED%s: ", $color_type, $color_end
270     print *(struct RMoved *)$arg0
271   else
272     printf "%sunknown%s: ", $color_type, $color_end
273     print (struct RBasic *)($arg0)
274   end
275   end
276   end
277   end
278   end
279   end
280   end
281   end
282   end
283   end
284   end
285   end
286   end
287   end
288   end
289   end
290   end
291   end
292   end
293   end
294   end
295   end
296   end
297   end
298   end
299   end
300   end
301   end
302   end
303   end
304   end
305   end
306   end
307   end
309 document rp
310   Print a Ruby's VALUE.
313 define rp_id
314   set $id = (ID)$arg0
315   if $id == '!' || $id == '+' || $id == '-' || $id == '*' || $id == '/' || $id == '%' || $id == '<' || $id == '>' || $id == '`'
316     printf "(:%c)\n", $id
317   else
318   if $id == idDot2
319     printf "(:..)\n"
320   else
321   if $id == idDot3
322     printf "(:...)\n"
323   else
324   if $id == idUPlus
325     printf "(:+@)\n"
326   else
327   if $id == idUMinus
328     printf "(:-@)\n"
329   else
330   if $id == idPow
331     printf "(:**)\n"
332   else
333   if $id == idCmp
334     printf "(:<=>)\n"
335   else
336   if $id == idLTLT
337     printf "(:<<)\n"
338   else
339   if $id == idGTGT
340     printf "(:>>)\n"
341   else
342   if $id == idLE
343     printf "(:<=)\n"
344   else
345   if $id == idGE
346     printf "(:>=)\n"
347   else
348   if $id == idEq
349     printf "(:==)\n"
350   else
351   if $id == idEqq
352     printf "(:===)\n"
353   else
354   if $id == idNeq
355     printf "(:!=)\n"
356   else
357   if $id == idEqTilde
358     printf "(:=~)\n"
359   else
360   if $id == idNeqTilde
361     printf "(:!~)\n"
362   else
363   if $id == idAREF
364     printf "(:[])\n"
365   else
366   if $id == idASET
367     printf "(:[]=)\n"
368   else
369   if $id == idCOLON2
370     printf "(:'::')\n"
371   else
372   if $id == idANDOP
373     printf "(:&&)\n"
374   else
375   if $id == idOROP
376     printf "(:||)\n"
377   else
378   if $id == idANDDOT
379     printf "(:&.)\n"
380   else
381     if $id <= tLAST_OP_ID
382       printf "O"
383     else
384       set $id_type = $id & RUBY_ID_SCOPE_MASK
385       if $id_type == RUBY_ID_LOCAL
386         printf "l"
387       else
388       if $id_type == RUBY_ID_INSTANCE
389         printf "i"
390       else
391       if $id_type == RUBY_ID_GLOBAL
392         printf "G"
393       else
394       if $id_type == RUBY_ID_ATTRSET
395         printf "a"
396       else
397       if $id_type == RUBY_ID_CONST
398         printf "C"
399       else
400       if $id_type == RUBY_ID_CLASS
401         printf "c"
402       else
403         printf "j"
404       end
405       end
406       end
407       end
408       end
409       end
410     end
411     printf "(%ld): ", $id
412     print_id $id
413     echo \n
414   end
415   end
416   end
417   end
418   end
419   end
420   end
421   end
422   end
423   end
424   end
425   end
426   end
427   end
428   end
429   end
430   end
431   end
432   end
433   end
434   end
435   end
437 document rp_id
438   Print an ID.
441 define output_string
442   set $flags = ((struct RBasic*)($arg0))->flags
443   set $len = ($flags & RUBY_FL_USER1) ? \
444           ((struct RString*)($arg0))->as.heap.len : \
445           (($flags & (RUBY_FL_USER2|RUBY_FL_USER3|RUBY_FL_USER4|RUBY_FL_USER5|RUBY_FL_USER6)) >> RUBY_FL_USHIFT+2)
446   if $len > 0
447     output *(char *)(($flags & RUBY_FL_USER1) ? \
448             ((struct RString*)($arg0))->as.heap.ptr : \
449             ((struct RString*)($arg0))->as.ary) @ $len
450   else
451     output ""
452   end
455 define print_string
456   set $flags = ((struct RBasic*)($arg0))->flags
457   set $len = ($flags & RUBY_FL_USER1) ? \
458           ((struct RString*)($arg0))->as.heap.len : \
459           (($flags & (RUBY_FL_USER2|RUBY_FL_USER3|RUBY_FL_USER4|RUBY_FL_USER5|RUBY_FL_USER6)) >> RUBY_FL_USHIFT+2)
460   if $len > 0
461     printf "%s", *(char *)(($flags & RUBY_FL_USER1) ? \
462             ((struct RString*)($arg0))->as.heap.ptr : \
463             ((struct RString*)($arg0))->as.ary) @ $len
464   end
467 define rp_string
468   output_string $arg0
469   printf " bytesize:%ld ", $len
470   if !($flags & RUBY_FL_USER1)
471     printf "(embed) "
472   else
473     if ($flags & RUBY_FL_USER2)
474       printf "(shared) "
475     end
476     if ($flags & RUBY_FL_USER3)
477       printf "(assoc) "
478     end
479   end
480   printf "encoding:%d ", ($flags & RUBY_ENCODING_MASK) >> RUBY_ENCODING_SHIFT
481   if ($flags & RUBY_ENC_CODERANGE_MASK) == 0
482     printf "coderange:unknown "
483   else
484   if ($flags & RUBY_ENC_CODERANGE_MASK) == RUBY_ENC_CODERANGE_7BIT
485     printf "coderange:7bit "
486   else
487   if ($flags & RUBY_ENC_CODERANGE_MASK) == RUBY_ENC_CODERANGE_VALID
488     printf "coderange:valid "
489   else
490     printf "coderange:broken "
491   end
492   end
493   end
494   print (struct RString *)($arg0)
496 document rp_string
497   Print the content of a String.
500 define rp_bignum
501   set $flags = ((struct RBignum*)($arg0))->basic.flags
502   set $len = (($flags & RUBY_FL_USER2) ? \
503        ($flags & (RUBY_FL_USER5|RUBY_FL_USER4|RUBY_FL_USER3)) >> (RUBY_FL_USHIFT+3) : \
504        ((struct RBignum*)($arg0))->as.heap.len)
505   printf "%sT_BIGNUM%s: sign=%d len=%ld ", $color_type, $color_end, \
506          (($flags & RUBY_FL_USER1) != 0), $len
507   if $flags & RUBY_FL_USER2
508     printf "(embed) "
509   end
510   print (struct RBignum *)($arg0)
511   set $ptr = (($flags & RUBY_FL_USER2) ? \
512               ((struct RBignum*)($arg0))->as.ary : \
513               ((struct RBignum*)($arg0))->as.heap.digits)
514   set $len = $len-1
515   printf "0x%x", $ptr[$len]
516   while $len > 0
517     set $len = $len-1
518     set $val = $ptr[$len]
519     set $w = sizeof($ptr[0])
520     printf "_"
521     if $w > 8
522       printf "%.32x", $val
523     else
524     if $w > 4
525       printf "%.16x", $val
526     else
527     if $w > 2
528       printf "%.8x", $val
529     else
530     if $w > 1
531       printf "%.4x", $val
532     else
533       printf "%.2x", $val
534     end
535     end
536     end
537     end
538   end
539   printf "\n"
541 document rp_bignum
542   Print the content of a Bignum.
545 define rp_class
546   printf "(struct RClass *) %p", (void*)$arg0
547   if RCLASS_ORIGIN((struct RClass *)($arg0)) != $arg0
548     printf " -> %p", RCLASS_ORIGIN((struct RClass *)($arg0))
549   end
550   printf "\n"
551   rb_classname $arg0
552   print/x *(struct RClass *)($arg0)
553   print *RCLASS_EXT((struct RClass *)($arg0))
555 document rp_class
556   Print the content of a Class/Module.
559 define rp_imemo
560   set $flags = (enum imemo_type)((((struct RBasic *)($arg0))->flags >> RUBY_FL_USHIFT) & RUBY_IMEMO_MASK)
561   if $flags == imemo_cref
562     printf "(rb_cref_t *) %p\n", (void*)$arg0
563     print *(rb_cref_t *)$arg0
564   else
565   if $flags == imemo_svar
566     printf "(struct vm_svar *) %p\n", (void*)$arg0
567     print *(struct vm_svar *)$arg0
568   else
569   if $flags == imemo_throw_data
570     printf "(struct vm_throw_data *) %p\n", (void*)$arg0
571     print *(struct vm_throw_data *)$arg0
572   else
573   if $flags == imemo_ifunc
574     printf "(struct vm_ifunc *) %p\n", (void*)$arg0
575     print *(struct vm_ifunc *)$arg0
576   else
577   if $flags == imemo_memo
578     printf "(struct MEMO *) %p\n", (void*)$arg0
579     print *(struct MEMO *)$arg0
580   else
581   if $flags == imemo_ment
582     printf "(rb_method_entry_t *) %p\n", (void*)$arg0
583     print *(rb_method_entry_t *)$arg0
584   else
585   if $flags == imemo_iseq
586     printf "(rb_iseq_t *) %p\n", (void*)$arg0
587     print *(rb_iseq_t *)$arg0
588   else
589     printf "(struct RIMemo *) %p\n", (void*)$arg0
590     print *(struct RIMemo *)$arg0
591   end
592   end
593   end
594   end
595   end
596   end
597   end
599 document rp_imemo
600   Print the content of a memo
603 define nd_type
604   print (enum node_type)((((NODE*)($arg0))->flags&RUBY_NODE_TYPEMASK)>>RUBY_NODE_TYPESHIFT)
606 document nd_type
607   Print a Ruby' node type.
610 define nd_file
611   print ((NODE*)($arg0))->nd_file
613 document nd_file
614   Print the source file name of a node.
617 define nd_line
618   print ((unsigned int)((((NODE*)($arg0))->flags>>RUBY_NODE_LSHIFT)&RUBY_NODE_LMASK))
620 document nd_line
621   Print the source line number of a node.
624 # Print members of ruby node.
626 define nd_head
627   printf "%su1.node%s: ", $color_highlite, $color_end
628   rp ($arg0).u1.node
631 define nd_alen
632   printf "%su2.argc%s: ", $color_highlite, $color_end
633   p ($arg0).u2.argc
636 define nd_next
637   printf "%su3.node%s: ", $color_highlite, $color_end
638   rp ($arg0).u3.node
642 define nd_cond
643   printf "%su1.node%s: ", $color_highlite, $color_end
644   rp ($arg0).u1.node
647 define nd_body
648   printf "%su2.node%s: ", $color_highlite, $color_end
649   rp ($arg0).u2.node
652 define nd_else
653   printf "%su3.node%s: ", $color_highlite, $color_end
654   rp ($arg0).u3.node
658 define nd_orig
659   printf "%su3.value%s: ", $color_highlite, $color_end
660   rp ($arg0).u3.value
664 define nd_resq
665   printf "%su2.node%s: ", $color_highlite, $color_end
666   rp ($arg0).u2.node
669 define nd_ensr
670   printf "%su3.node%s: ", $color_highlite, $color_end
671   rp ($arg0).u3.node
675 define nd_1st
676   printf "%su1.node%s: ", $color_highlite, $color_end
677   rp ($arg0).u1.node
680 define nd_2nd
681   printf "%su2.node%s: ", $color_highlite, $color_end
682   rp ($arg0).u2.node
686 define nd_stts
687   printf "%su1.node%s: ", $color_highlite, $color_end
688   rp ($arg0).u1.node
692 define nd_vid
693   printf "%su1.id%s: ", $color_highlite, $color_end
694   p ($arg0).u1.id
697 define nd_cflag
698   printf "%su2.id%s: ", $color_highlite, $color_end
699   p ($arg0).u2.id
702 define nd_cval
703   printf "%su3.value%s: ", $color_highlite, $color_end
704   rp ($arg0).u3.value
707 define nd_tbl
708   printf "%su1.tbl%s: ", $color_highlite, $color_end
709   p ($arg0).u1.tbl
713 define nd_var
714   printf "%su1.node%s: ", $color_highlite, $color_end
715   rp ($arg0).u1.node
718 define nd_ibdy
719   printf "%su2.node%s: ", $color_highlite, $color_end
720   rp ($arg0).u2.node
723 define nd_iter
724   printf "%su3.node%s: ", $color_highlite, $color_end
725   rp ($arg0).u3.node
729 define nd_value
730   printf "%su2.node%s: ", $color_highlite, $color_end
731   rp ($arg0).u2.node
734 define nd_aid
735   printf "%su3.id%s: ", $color_highlite, $color_end
736   p ($arg0).u3.id
740 define nd_lit
741   printf "%su1.value%s: ", $color_highlite, $color_end
742   rp ($arg0).u1.value
745 define nd_rest
746   printf "%su2.argc%s: ", $color_highlite, $color_end
747   p ($arg0).u2.argc
750 define nd_opt
751   printf "%su1.node%s: ", $color_highlite, $color_end
752   rp ($arg0).u1.node
756 define nd_recv
757   printf "%su1.node%s: ", $color_highlite, $color_end
758   rp ($arg0).u1.node
761 define nd_mid
762   printf "%su2.id%s: ", $color_highlite, $color_end
763   p ($arg0).u2.id
766 define nd_args
767   printf "%su3.node%s: ", $color_highlite, $color_end
768   rp ($arg0).u3.node
771 define nd_defn
772   printf "%su3.node%s: ", $color_highlite, $color_end
773   rp ($arg0).u3.node
777 define nd_old
778   printf "%su1.id%s: ", $color_highlite, $color_end
779   p ($arg0).u1.id
782 define nd_new
783   printf "%su2.id%s: ", $color_highlite, $color_end
784   p ($arg0).u2.id
788 define nd_cname
789   printf "%su1.id%s: ", $color_highlite, $color_end
790   p ($arg0).u1.id
793 define nd_super
794   printf "%su3.node%s: ", $color_highlite, $color_end
795   rp ($arg0).u3.node
799 define nd_modl
800   printf "%su1.id%s: ", $color_highlite, $color_end
801   p ($arg0).u1.id
804 define nd_clss
805   printf "%su1.value%s: ", $color_highlite, $color_end
806   rp ($arg0).u1.value
810 define nd_beg
811   printf "%su1.node%s: ", $color_highlite, $color_end
812   rp ($arg0).u1.node
815 define nd_end
816   printf "%su2.node%s: ", $color_highlite, $color_end
817   rp ($arg0).u2.node
820 define nd_state
821   printf "%su3.state%s: ", $color_highlite, $color_end
822   p ($arg0).u3.state
825 define nd_rval
826   printf "%su2.value%s: ", $color_highlite, $color_end
827   rp ($arg0).u2.value
831 define nd_nth
832   printf "%su2.argc%s: ", $color_highlite, $color_end
833   p ($arg0).u2.argc
837 define nd_tag
838   printf "%su1.id%s: ", $color_highlite, $color_end
839   p ($arg0).u1.id
842 define nd_tval
843   printf "%su2.value%s: ", $color_highlite, $color_end
844   rp ($arg0).u2.value
847 define nd_tree
848   set $buf = (struct RString *)rb_str_buf_new(0)
849   call dump_node((VALUE)($buf), rb_str_tmp_new(0), 0, ($arg0))
850   printf "%s\n", $buf->as.heap.ptr
853 define rb_p
854   call rb_p($arg0)
857 define rb_numtable_entry
858   set $rb_numtable_tbl = $arg0
859   set $rb_numtable_id = (st_data_t)$arg1
860   set $rb_numtable_key = 0
861   set $rb_numtable_rec = 0
862   if $rb_numtable_tbl->entries_packed
863     set $rb_numtable_p = $rb_numtable_tbl->as.packed.bins
864     while $rb_numtable_p && $rb_numtable_p < $rb_numtable_tbl->as.packed.bins+$rb_numtable_tbl->num_entries
865       if $rb_numtable_p.k == $rb_numtable_id
866         set $rb_numtable_key = $rb_numtable_p.k
867         set $rb_numtable_rec = $rb_numtable_p.v
868         set $rb_numtable_p = 0
869       else
870         set $rb_numtable_p = $rb_numtable_p + 1
871       end
872     end
873   else
874     set $rb_numtable_p = $rb_numtable_tbl->as.big.bins[st_numhash($rb_numtable_id) % $rb_numtable_tbl->num_bins]
875     while $rb_numtable_p
876       if $rb_numtable_p->key == $rb_numtable_id
877         set $rb_numtable_key = $rb_numtable_p->key
878         set $rb_numtable_rec = $rb_numtable_p->record
879         set $rb_numtable_p = 0
880       else
881         set $rb_numtable_p = $rb_numtable_p->next
882       end
883     end
884   end
887 define rb_id2name
888   ruby_gdb_init
889   printf "%sID%s: ", $color_type, $color_end
890   rp_id $arg0
892 document rb_id2name
893   Print the name of id
896 define rb_method_entry
897   set $rb_method_entry_klass = (struct RClass *)$arg0
898   set $rb_method_entry_id = (ID)$arg1
899   set $rb_method_entry_me = (rb_method_entry_t *)0
900   while !$rb_method_entry_me && $rb_method_entry_klass
901     rb_numtable_entry $rb_method_entry_klass->m_tbl_wrapper->tbl $rb_method_entry_id
902     set $rb_method_entry_me = (rb_method_entry_t *)$rb_numtable_rec
903     if !$rb_method_entry_me
904       set $rb_method_entry_klass = (struct RClass *)RCLASS_SUPER($rb_method_entry_klass)
905     end
906   end
907   if $rb_method_entry_me
908     print *$rb_method_entry_klass
909     print *$rb_method_entry_me
910   else
911     echo method not found\n
912   end
914 document rb_method_entry
915   Search method entry by class and id
918 define rb_classname
919   # up to 128bit int
920   set $rb_classname = rb_mod_name($arg0)
921   if $rb_classname != RUBY_Qnil
922     rp $rb_classname
923   else
924     echo anonymous class/module\n
925   end
928 define rb_ancestors
929   set $rb_ancestors_module = $arg0
930   while $rb_ancestors_module
931     rp_class $rb_ancestors_module
932     set $rb_ancestors_module = RCLASS_SUPER($rb_ancestors_module)
933   end
935 document rb_ancestors
936   Print ancestors.
939 define rb_backtrace
940   call rb_backtrace()
943 define iseq
944   if ruby_dummy_gdb_enums.special_consts
945   end
946   if ($arg0)->type == ISEQ_ELEMENT_NONE
947     echo [none]\n
948   end
949   if ($arg0)->type == ISEQ_ELEMENT_LABEL
950     print *(LABEL*)($arg0)
951   end
952   if ($arg0)->type == ISEQ_ELEMENT_INSN
953     print *(INSN*)($arg0)
954     if ((INSN*)($arg0))->insn_id != YARVINSN_jump
955       set $i = 0
956       set $operand_size = ((INSN*)($arg0))->operand_size
957       set $operands = ((INSN*)($arg0))->operands
958       while $i < $operand_size
959         rp $operands[$i++]
960       end
961     end
962   end
963   if ($arg0)->type == ISEQ_ELEMENT_ADJUST
964     print *(ADJUST*)($arg0)
965   end
968 define rb_ps
969   rb_ps_vm ruby_current_vm_ptr
971 document rb_ps
972 Dump all threads and their callstacks
975 define rb_ps_vm
976   print $ps_vm = (rb_vm_t*)$arg0
977   set $ps_thread_ln      = $ps_vm->ractor.main_ractor.threads.set.n.next
978   set $ps_thread_ln_last = $ps_vm->ractor.main_ractor.threads.set.n.prev
979   while 1
980     set $ps_thread_th = (rb_thread_t *)$ps_thread_ln
981     set $ps_thread = (VALUE)($ps_thread_th->self)
982     rb_ps_thread $ps_thread
983     if $ps_thread_ln == $ps_thread_ln_last
984       loop_break
985     end
986     set $ps_thread_ln = $ps_thread_ln->next
987   end
989 document rb_ps_vm
990 Dump all threads in a (rb_vm_t*) and their callstacks
993 define print_lineno
994   set $cfp = $arg0
995   set $iseq = $cfp->iseq
996   set $pos = $cfp->pc - $iseq->body->iseq_encoded
997   if $pos != 0
998     set $pos = $pos - 1
999   end
1001   set $index = 0
1002   set $size = $iseq->body->insns_info.size
1003   set $table = $iseq->body->insns_info.body
1004   set $positions = $iseq->body->insns_info.positions
1005   #printf "size: %d\n", $size
1006   if $size == 0
1007   else
1008   if $size == 1
1009     printf "%d", $table[0].line_no
1010   else
1011     if $positions
1012       # get_insn_info_linear_search
1013       set $index = 1
1014       while $index < $size
1015         #printf "table[%d]: position: %d, line: %d, pos: %d\n", $i, $positions[$i], $table[$i].line_no, $pos
1016         if $positions[$index] > $pos
1017           loop_break
1018         end
1019         set $index = $index + 1
1020         if $positions[$index] == $pos
1021           loop_break
1022         end
1023       end
1024     else
1025       # get_insn_info_succinct_bitvector
1026       set $sd = $iseq->body->insns_info.succ_index_table
1027       set $immediate_table_size = sizeof($sd->imm_part) / sizeof(uint64_t) * 9
1028       if $pos < $immediate_table_size
1029         set $i = $pos / 9
1030         set $j = $pos % 9
1031         set $index = ((int)($sd->imm_part[$i] >> ($j * 7))) & 0x7f
1032       else
1033         set $block_index = ($pos - $immediate_table_size) / 512
1034         set $block = &$sd->succ_part[$block_index]
1035         set $block_bit_index = ($pos - $immediate_table_size) % 512
1036         set $small_block_index = $block_bit_index / 64
1037         set $small_block_popcount = $small_block_index == 0 ? 0 : (((int)($block->small_block_ranks >> (($small_block_index - 1) * 9))) & 0x1ff)
1038         set $x = $block->bits[$small_block_index] << (63 - $block_bit_index % 64)
1039         set $x = ($x & 0x5555555555555555) + ($x >> 1 & 0x5555555555555555)
1040         set $x = ($x & 0x3333333333333333) + ($x >> 2 & 0x3333333333333333)
1041         set $x = ($x & 0x0707070707070707) + ($x >> 4 & 0x0707070707070707)
1042         set $x = ($x & 0x001f001f001f001f) + ($x >> 8 & 0x001f001f001f001f)
1043         set $x = ($x & 0x0000003f0000003f) + ($x >>16 & 0x0000003f0000003f)
1044         set $popcnt = ($x & 0x7f) + ($x >>32 & 0x7f)
1045         set $index = $block->rank + $small_block_popcount + $popcnt
1046       end
1047     end
1048     printf "%d", $table[$index-1].line_no
1049   end
1050   end
1053 define check_method_entry
1054   set $imemo = (struct RBasic *)$arg0
1055   if $imemo != RUBY_Qfalse
1056     set $type = ($imemo->flags >> 12) & 0x07
1057     if $type == imemo_ment
1058       set $me = (rb_callable_method_entry_t *)$imemo
1059     else
1060     if $type == imemo_svar
1061       set $imemo = ((struct vm_svar *)$imemo)->cref_or_me
1062       check_method_entry $imemo
1063     end
1064     end
1065   end
1068 define print_id
1069   set $id = $arg0
1070   # rb_id_to_serial
1071   if $id > tLAST_OP_ID
1072     set $serial = (rb_id_serial_t)($id >> RUBY_ID_SCOPE_SHIFT)
1073   else
1074     set $serial = (rb_id_serial_t)$id
1075   end
1076   if $serial && $serial <= ruby_global_symbols.last_id
1077     set $idx = $serial / ID_ENTRY_UNIT
1078     set $ids = (struct RArray *)ruby_global_symbols.ids
1079     set $flags = $ids->basic.flags
1080     if ($flags & RUBY_FL_USER1)
1081       set $idsptr = $ids->as.ary
1082       set $idslen = (($flags & (RUBY_FL_USER3|RUBY_FL_USER4)) >> (RUBY_FL_USHIFT+3))
1083     else
1084       set $idsptr = $ids->as.heap.ptr
1085       set $idslen = $ids->as.heap.len
1086     end
1087     if $idx < $idslen
1088       set $t = 0
1089       set $ary = (struct RArray *)$idsptr[$idx]
1090       if $ary != RUBY_Qnil
1091         set $flags = $ary->basic.flags
1092         if ($flags & RUBY_FL_USER1)
1093           set $aryptr = $ary->as.ary
1094           set $arylen = (($flags & (RUBY_FL_USER3|RUBY_FL_USER4)) >> (RUBY_FL_USHIFT+3))
1095         else
1096           set $aryptr = $ary->as.heap.ptr
1097           set $arylen = $ary->as.heap.len
1098         end
1099         set $result = $aryptr[($serial % ID_ENTRY_UNIT) * ID_ENTRY_SIZE + $t]
1100         if $result != RUBY_Qnil
1101           print_string $result
1102         else
1103           echo undef
1104         end
1105       end
1106     end
1107   end
1110 define print_pathobj
1111   set $flags = ((struct RBasic*)($arg0))->flags
1112   if ($flags & RUBY_T_MASK) == RUBY_T_STRING
1113     print_string $arg0
1114   end
1115   if ($flags & RUBY_T_MASK) == RUBY_T_ARRAY
1116     if $flags & RUBY_FL_USER1
1117       set $str = ((struct RArray*)($arg0))->as.ary[0]
1118     else
1119       set $str = ((struct RArray*)($arg0))->as.heap.ptr[0]
1120     end
1121     print_string $str
1122   end
1125 define rb_ps_thread
1126   set $ps_thread = (struct RTypedData*)$arg0
1127   set $ps_thread_th = (rb_thread_t*)$ps_thread->data
1128   printf "* #<Thread:%p rb_thread_t:%p native_thread:%p>\n", \
1129     $ps_thread, $ps_thread_th, $ps_thread_th->thread_id
1130   set $cfp = $ps_thread_th->ec->cfp
1131   set $cfpend = (rb_control_frame_t *)($ps_thread_th->ec->vm_stack + $ps_thread_th->ec->vm_stack_size)-1
1132   while $cfp < $cfpend
1133     if $cfp->iseq
1134       if !((VALUE)$cfp->iseq & RUBY_IMMEDIATE_MASK) && (((imemo_ifunc << RUBY_FL_USHIFT) | RUBY_T_IMEMO)==$cfp->iseq->flags & ((RUBY_IMEMO_MASK << RUBY_FL_USHIFT) | RUBY_T_MASK))
1135         printf "%d:ifunc ", $cfpend-$cfp
1136         set print symbol-filename on
1137         output/a $cfp->iseq.body
1138         set print symbol-filename off
1139         printf "\n"
1140       else
1141       if $cfp->pc
1142         set $location = $cfp->iseq->body->location
1143         printf "%d:", $cfpend-$cfp
1144         print_pathobj $location.pathobj
1145         printf ":"
1146         print_lineno $cfp
1147         printf ":in `"
1148         print_string $location.label
1149         printf "'\n"
1150       else
1151         printf "%d: ???.rb:???:in `???'\n", $cfpend-$cfp
1152       end
1153       end
1154     else
1155       # if VM_FRAME_TYPE($cfp->flag) == VM_FRAME_MAGIC_CFUNC
1156       set $ep = $cfp->ep
1157       if ($ep[0] & 0xffff0001) == 0x55550001
1158         #define VM_ENV_FLAG_LOCAL 0x02
1159         #define VM_ENV_PREV_EP(ep)   GC_GUARDED_PTR_REF(ep[VM_ENV_DATA_INDEX_SPECVAL])
1160         set $me = 0
1161         set $env_specval = $ep[-1]
1162         set $env_me_cref = $ep[-2]
1163         while ($env_specval & 0x02) != 0
1164           check_method_entry $env_me_cref
1165           if $me != 0
1166             loop_break
1167           end
1168           set $ep = $ep[0]
1169           set $env_specval = $ep[-1]
1170           set $env_me_cref = $ep[-2]
1171         end
1172         if $me == 0
1173           check_method_entry $env_me_cref
1174         end
1175         printf "%d:", $cfpend-$cfp
1176         set print symbol-filename on
1177         output/a $me->def->body.cfunc.func
1178         set print symbol-filename off
1179         set $mid = $me->def->original_id
1180         printf ":in `"
1181         print_id $mid
1182         printf "'\n"
1183       else
1184         printf "%d:unknown_frame:???:in `???'\n", $cfpend-$cfp
1185       end
1186     end
1187     set $cfp = $cfp + 1
1188   end
1191 define rb_count_objects
1192   set $objspace = ruby_current_vm_ptr->objspace
1193   set $counts_00 = 0
1194   set $counts_01 = 0
1195   set $counts_02 = 0
1196   set $counts_03 = 0
1197   set $counts_04 = 0
1198   set $counts_05 = 0
1199   set $counts_06 = 0
1200   set $counts_07 = 0
1201   set $counts_08 = 0
1202   set $counts_09 = 0
1203   set $counts_0a = 0
1204   set $counts_0b = 0
1205   set $counts_0c = 0
1206   set $counts_0d = 0
1207   set $counts_0e = 0
1208   set $counts_0f = 0
1209   set $counts_10 = 0
1210   set $counts_11 = 0
1211   set $counts_12 = 0
1212   set $counts_13 = 0
1213   set $counts_14 = 0
1214   set $counts_15 = 0
1215   set $counts_16 = 0
1216   set $counts_17 = 0
1217   set $counts_18 = 0
1218   set $counts_19 = 0
1219   set $counts_1a = 0
1220   set $counts_1b = 0
1221   set $counts_1c = 0
1222   set $counts_1d = 0
1223   set $counts_1e = 0
1224   set $counts_1f = 0
1225   set $total = 0
1226   set $i = 0
1227   while $i < $objspace->heap_pages.allocated_pages
1228     printf "\rcounting... %d/%d", $i, $objspace->heap_pages.allocated_pages
1229     set $page = $objspace->heap_pages.sorted[$i]
1230     set $p = $page->start
1231     set $pend = $p + $page->total_slots
1232     while $p < $pend
1233       set $flags = $p->as.basic.flags & 0x1f
1234       eval "set $counts_%02x = $counts_%02x + 1", $flags, $flags
1235       set $p = $p + 1
1236     end
1237     set $total = $total + $page->total_slots
1238     set $i = $i + 1
1239   end
1240   printf "\rTOTAL: %d, FREE: %d\n", $total, $counts_00
1241   printf "T_OBJECT: %d\n", $counts_01
1242   printf "T_CLASS: %d\n", $counts_02
1243   printf "T_MODULE: %d\n", $counts_03
1244   printf "T_FLOAT: %d\n", $counts_04
1245   printf "T_STRING: %d\n", $counts_05
1246   printf "T_REGEXP: %d\n", $counts_06
1247   printf "T_ARRAY: %d\n", $counts_07
1248   printf "T_HASH: %d\n", $counts_08
1249   printf "T_STRUCT: %d\n", $counts_09
1250   printf "T_BIGNUM: %d\n", $counts_0a
1251   printf "T_FILE: %d\n", $counts_0b
1252   printf "T_DATA: %d\n", $counts_0c
1253   printf "T_MATCH: %d\n", $counts_0d
1254   printf "T_COMPLEX: %d\n", $counts_0e
1255   printf "T_RATIONAL: %d\n", $counts_0f
1256   #printf "UNKNOWN_10: %d\n", $counts_10
1257   printf "T_NIL: %d\n", $counts_11
1258   printf "T_TRUE: %d\n", $counts_12
1259   printf "T_FALSE: %d\n", $counts_13
1260   printf "T_SYMBOL: %d\n", $counts_14
1261   printf "T_FIXNUM: %d\n", $counts_15
1262   printf "T_UNDEF: %d\n", $counts_16
1263   #printf "UNKNOWN_17: %d\n", $counts_17
1264   #printf "UNKNOWN_18: %d\n", $counts_18
1265   #printf "UNKNOWN_19: %d\n", $counts_19
1266   printf "T_IMEMO: %d\n", $counts_1a
1267   printf "T_NODE: %d\n", $counts_1b
1268   printf "T_ICLASS: %d\n", $counts_1c
1269   printf "T_ZOMBIE: %d\n", $counts_1d
1270   #printf "UNKNOWN_1E: %d\n", $counts_1e
1271   printf "T_MASK: %d\n", $counts_1f
1273 document rb_count_objects
1274   Counts all objects grouped by type.
1277 # Details: https://github.com/ruby/ruby/wiki/Machine-Instructions-Trace-with-GDB
1278 define trace_machine_instructions
1279   set logging enabled
1280   set height 0
1281   set width 0
1282   display/i $pc
1283   while !$exit_code
1284     info line *$pc
1285     si
1286   end
1289 define SDR
1290   call rb_vmdebug_stack_dump_raw_current()
1293 define rbi
1294   if ((LINK_ELEMENT*)$arg0)->type == ISEQ_ELEMENT_LABEL
1295     p *(LABEL*)$arg0
1296   else
1297   if ((LINK_ELEMENT*)$arg0)->type == ISEQ_ELEMENT_INSN
1298     p *(INSN*)$arg0
1299   else
1300   if ((LINK_ELEMENT*)$arg0)->type == ISEQ_ELEMENT_ADJUST
1301     p *(ADJUST*)$arg0
1302   else
1303     print *$arg0
1304   end
1305   end
1306   end
1309 define dump_node
1310   set $str = rb_parser_dump_tree($arg0, 0)
1311   set $flags = ((struct RBasic*)($str))->flags
1312   printf "%s", (char *)(($flags & RUBY_FL_USER1) ? \
1313                         ((struct RString*)$str)->as.heap.ptr : \
1314                         ((struct RString*)$str)->as.ary)
1317 define print_flags
1318   printf "RUBY_FL_WB_PROTECTED: %s\n", ((struct RBasic*)($arg0))->flags & RUBY_FL_WB_PROTECTED ? "1" : "0"
1319   printf "RUBY_FL_PROMOTED0   : %s\n", ((struct RBasic*)($arg0))->flags & RUBY_FL_PROMOTED0 ? "1" : "0"
1320   printf "RUBY_FL_PROMOTED1   : %s\n", ((struct RBasic*)($arg0))->flags & RUBY_FL_PROMOTED1 ? "1" : "0"
1321   printf "RUBY_FL_FINALIZE    : %s\n", ((struct RBasic*)($arg0))->flags & RUBY_FL_FINALIZE ? "1" : "0"
1322   printf "RUBY_FL_SHAREABLE   : %s\n", ((struct RBasic*)($arg0))->flags & RUBY_FL_SHAREABLE ? "1" : "0"
1323   printf "RUBY_FL_EXIVAR      : %s\n", ((struct RBasic*)($arg0))->flags & RUBY_FL_EXIVAR ? "1" : "0"
1324   printf "RUBY_FL_FREEZE      : %s\n", ((struct RBasic*)($arg0))->flags & RUBY_FL_FREEZE ? "1" : "0"
1326   printf "RUBY_FL_USER0       : %s\n", ((struct RBasic*)($arg0))->flags & RUBY_FL_USER0 ? "1" : "0"
1327   printf "RUBY_FL_USER1       : %s\n", ((struct RBasic*)($arg0))->flags & RUBY_FL_USER1 ? "1" : "0"
1328   printf "RUBY_FL_USER2       : %s\n", ((struct RBasic*)($arg0))->flags & RUBY_FL_USER2 ? "1" : "0"
1329   printf "RUBY_FL_USER3       : %s\n", ((struct RBasic*)($arg0))->flags & RUBY_FL_USER3 ? "1" : "0"
1330   printf "RUBY_FL_USER4       : %s\n", ((struct RBasic*)($arg0))->flags & RUBY_FL_USER4 ? "1" : "0"
1331   printf "RUBY_FL_USER5       : %s\n", ((struct RBasic*)($arg0))->flags & RUBY_FL_USER5 ? "1" : "0"
1332   printf "RUBY_FL_USER6       : %s\n", ((struct RBasic*)($arg0))->flags & RUBY_FL_USER6 ? "1" : "0"
1333   printf "RUBY_FL_USER7       : %s\n", ((struct RBasic*)($arg0))->flags & RUBY_FL_USER7 ? "1" : "0"
1334   printf "RUBY_FL_USER8       : %s\n", ((struct RBasic*)($arg0))->flags & RUBY_FL_USER8 ? "1" : "0"
1335   printf "RUBY_FL_USER9       : %s\n", ((struct RBasic*)($arg0))->flags & RUBY_FL_USER9 ? "1" : "0"
1336   printf "RUBY_FL_USER10      : %s\n", ((struct RBasic*)($arg0))->flags & RUBY_FL_USER10 ? "1" : "0"
1337   printf "RUBY_FL_USER11      : %s\n", ((struct RBasic*)($arg0))->flags & RUBY_FL_USER11 ? "1" : "0"
1338   printf "RUBY_FL_USER12      : %s\n", ((struct RBasic*)($arg0))->flags & RUBY_FL_USER12 ? "1" : "0"
1339   printf "RUBY_FL_USER13      : %s\n", ((struct RBasic*)($arg0))->flags & RUBY_FL_USER13 ? "1" : "0"
1340   printf "RUBY_FL_USER14      : %s\n", ((struct RBasic*)($arg0))->flags & RUBY_FL_USER14 ? "1" : "0"
1341   printf "RUBY_FL_USER15      : %s\n", ((struct RBasic*)($arg0))->flags & RUBY_FL_USER15 ? "1" : "0"
1342   printf "RUBY_FL_USER16      : %s\n", ((struct RBasic*)($arg0))->flags & RUBY_FL_USER16 ? "1" : "0"
1343   printf "RUBY_FL_USER17      : %s\n", ((struct RBasic*)($arg0))->flags & RUBY_FL_USER17 ? "1" : "0"
1344   printf "RUBY_FL_USER18      : %s\n", ((struct RBasic*)($arg0))->flags & RUBY_FL_USER18 ? "1" : "0"
1347 source misc/gdb.py