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

ruby-changes:37699

From: nobu <ko1@a...>
Date: Sat, 28 Feb 2015 15:44:28 +0900 (JST)
Subject: [ruby-changes:37699] nobu:r49780 (trunk): vm_dump.c: no new strings in signal context

nobu	2015-02-28 15:44:22 +0900 (Sat, 28 Feb 2015)

  New Revision: 49780

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

  Log:
    vm_dump.c: no new strings in signal context
    
    * vm_dump.c (rb_vm_bugreport): get rid of making new strings
      inside signal context.

  Modified files:
    trunk/ChangeLog
    trunk/vm_dump.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 49779)
+++ ChangeLog	(revision 49780)
@@ -1,4 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
-Sat Feb 28 15:42:27 2015  Nobuyoshi Nakada  <nobu@r...>
+Sat Feb 28 15:44:20 2015  Nobuyoshi Nakada  <nobu@r...>
+
+	* vm_dump.c (rb_vm_bugreport): get rid of making new strings
+	  inside signal context.
 
 	* variable.c (rb_tmp_class_path): defer making temporary class
 	  path string.
Index: vm_dump.c
===================================================================
--- vm_dump.c	(revision 49779)
+++ vm_dump.c	(revision 49780)
@@ -1000,12 +1000,21 @@ rb_vm_bugreport(const void *ctx) https://github.com/ruby/ruby/blob/trunk/vm_dump.c#L1000
 	    else if (RB_TYPE_P(name, T_CLASS) || RB_TYPE_P(name, T_MODULE)) {
 		const char *const type = RB_TYPE_P(name, T_CLASS) ?
 		    "class" : "module";
-		name = rb_class_name(name);
+		name = rb_search_class_path(rb_class_real(name));
+		if (!RB_TYPE_P(name, T_STRING)) {
+		    fprintf(stderr, " %4d %s:<unnamed>\n", i, type);
+		    continue;
+		}
 		fprintf(stderr, " %4d %s:%.*s\n", i, type,
 			LIMITED_NAME_LENGTH(name), RSTRING_PTR(name));
 	    }
 	    else {
-		VALUE klass = rb_class_name(CLASS_OF(name));
+		VALUE klass = rb_search_class_path(rb_obj_class(name));
+		if (!RB_TYPE_P(klass, T_STRING)) {
+		    fprintf(stderr, " %4d #<%p:%p>\n", i,
+			    (void *)CLASS_OF(name), (void *)name);
+		    continue;
+		}
 		fprintf(stderr, " %4d #<%.*s:%p>\n", i,
 			LIMITED_NAME_LENGTH(klass), RSTRING_PTR(klass),
 			(void *)name);

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

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