Skip to content

Commit 63e504d

Browse files
committed
Dump name of method for imemo callinfo
This commit dumps the `mid` of the imemo callinfo when calling `ObjectSpace.dump_all`.
1 parent 1943ea0 commit 63e504d

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

ext/objspace/depend

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,7 @@ objspace_dump.o: $(top_srcdir)/ccan/container_of/container_of.h
585585
objspace_dump.o: $(top_srcdir)/ccan/list/list.h
586586
objspace_dump.o: $(top_srcdir)/ccan/str/str.h
587587
objspace_dump.o: $(top_srcdir)/constant.h
588+
objspace_dump.o: $(top_srcdir)/debug_counter.h
588589
objspace_dump.o: $(top_srcdir)/id_table.h
589590
objspace_dump.o: $(top_srcdir)/internal.h
590591
objspace_dump.o: $(top_srcdir)/internal/array.h
@@ -610,6 +611,7 @@ objspace_dump.o: $(top_srcdir)/rubyparser.h
610611
objspace_dump.o: $(top_srcdir)/shape.h
611612
objspace_dump.o: $(top_srcdir)/symbol.h
612613
objspace_dump.o: $(top_srcdir)/thread_pthread.h
614+
objspace_dump.o: $(top_srcdir)/vm_callinfo.h
613615
objspace_dump.o: $(top_srcdir)/vm_core.h
614616
objspace_dump.o: $(top_srcdir)/vm_opts.h
615617
objspace_dump.o: objspace.h

ext/objspace/objspace_dump.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "ruby/debug.h"
2929
#include "ruby/util.h"
3030
#include "ruby/io.h"
31+
#include "vm_callinfo.h"
3132
#include "vm_core.h"
3233

3334
RUBY_EXTERN const char ruby_hexdigits[];
@@ -429,6 +430,17 @@ dump_object(VALUE obj, struct dump_config *dc)
429430
dump_append(dc, ", \"imemo_type\":\"");
430431
dump_append(dc, rb_imemo_name(imemo_type(obj)));
431432
dump_append(dc, "\"");
433+
434+
switch (imemo_type(obj)) {
435+
case imemo_callinfo:
436+
dump_append(dc, ", \"mid\":\"");
437+
dump_append(dc, RSTRING_PTR(rb_id2str(vm_ci_mid((const struct rb_callinfo *)obj))));
438+
dump_append(dc, "\"");
439+
break;
440+
441+
default:
442+
break;
443+
}
432444
break;
433445

434446
case T_SYMBOL:

0 commit comments

Comments
 (0)