diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-07-25 08:00:46 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-07-25 08:00:46 +0000 |
commit | 0ec4e24df7cd523b23c1451d5f8446d082cb352c (patch) | |
tree | 5c2e37ffb5dfa351377c15a3491170bc72ee5fea | |
parent | 0436d271aeff47aaa6ffb4c144fe0951c4c6e15a (diff) | |
download | ruby-0ec4e24df7cd523b23c1451d5f8446d082cb352c.tar.gz |
* debug.c (ruby_debug_printf): use rb_raw_obj_info()
instead of rb_inspect() because it is more robust way
to see object internal.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | debug.c | 10 |
2 files changed, 12 insertions, 4 deletions
@@ -1,3 +1,9 @@ +Mon Jul 25 16:59:00 2016 Koichi Sasada <ko1@atdot.net> + + * debug.c (ruby_debug_printf): use rb_raw_obj_info() + instead of rb_inspect() because it is more robust way + to see object internal. + Sun Jul 24 16:33:13 2016 Martin Duerst <duerst@it.aoyama.ac.jp> * regenc.h/c, include/ruby/oniguruma.h, enc/ascii.c, big5.c, cp949.c, @@ -59,14 +59,16 @@ ruby_debug_printf(const char *format, ...) va_end(ap); } +#include "gc.h" + VALUE ruby_debug_print_value(int level, int debug_level, const char *header, VALUE obj) { if (level < debug_level) { - VALUE str; - str = rb_inspect(obj); - fprintf(stderr, "DBG> %s: %s\n", header, - obj == (VALUE)(SIGNED_VALUE)-1 ? "" : StringValueCStr(str)); + char buff[0x100]; + rb_raw_obj_info(buff, 0x100, obj); + + fprintf(stderr, "DBG> %s: %s\n", header, buff); fflush(stderr); } return obj; |