ruby-changes:63004
From: Koichi <ko1@a...>
Date: Fri, 18 Sep 2020 14:18:14 +0900 (JST)
Subject: [ruby-changes:63004] b189dc6926 (master): rb_obj_info() shows more info for T_SYMBOL
https://git.ruby-lang.org/ruby.git/commit/?id=b189dc6926 From b189dc6926fffe1cdb04422c5116ad3ca1425cb7 Mon Sep 17 00:00:00 2001 From: Koichi Sasada <ko1@a...> Date: Wed, 16 Sep 2020 09:05:25 +0900 Subject: rb_obj_info() shows more info for T_SYMBOL diff --git a/gc.c b/gc.c index 38d1463..4b0fd06 100644 --- a/gc.c +++ b/gc.c @@ -11861,6 +11861,17 @@ rb_raw_obj_info(char *buff, const int buff_size, VALUE obj) https://github.com/ruby/ruby/blob/trunk/gc.c#L11861 APPENDF((BUFF_ARGS, "%.*s", str_len_no_raise(obj), RSTRING_PTR(obj))); break; } + case T_SYMBOL: { + VALUE fstr = RSYMBOL(obj)->fstr; + ID id = RSYMBOL(obj)->id; + if (RB_TYPE_P(fstr, T_STRING)) { + APPENDF((BUFF_ARGS, ":%s id:%d", RSTRING_PTR(fstr), (unsigned int)id)); + } + else { + APPENDF((BUFF_ARGS, "(%p) id:%d", (void *)fstr, (unsigned int)id)); + } + break; + } case T_MOVED: { APPENDF((BUFF_ARGS, "-> %p", (void*)rb_gc_location(obj))); break; -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/