[前][次][番号順一覧][スレッド一覧]

ruby-changes:43670

From: ko1 <ko1@a...>
Date: Mon, 25 Jul 2016 17:00:50 +0900 (JST)
Subject: [ruby-changes:43670] ko1:r55743 (trunk): * debug.c (ruby_debug_printf): use rb_raw_obj_info()

ko1	2016-07-25 17:00:46 +0900 (Mon, 25 Jul 2016)

  New Revision: 55743

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55743

  Log:
    * debug.c (ruby_debug_printf): use rb_raw_obj_info()
      instead of rb_inspect() because it is more robust way
      to see object internal.

  Modified files:
    trunk/ChangeLog
    trunk/debug.c
Index: debug.c
===================================================================
--- debug.c	(revision 55742)
+++ debug.c	(revision 55743)
@@ -59,14 +59,16 @@ ruby_debug_printf(const char *format, .. https://github.com/ruby/ruby/blob/trunk/debug.c#L59
     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;
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 55742)
+++ ChangeLog	(revision 55743)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Jul 25 16:59:00 2016  Koichi Sasada  <ko1@a...>
+
+	* 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@i...>
 
 	* regenc.h/c, include/ruby/oniguruma.h, enc/ascii.c, big5.c, cp949.c,

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]