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

ruby-changes:46310

From: nobu <ko1@a...>
Date: Fri, 21 Apr 2017 09:53:31 +0900 (JST)
Subject: [ruby-changes:46310] nobu:r58424 (trunk): vm_dump.c: non-scalar thread_id

nobu	2017-04-21 09:53:26 +0900 (Fri, 21 Apr 2017)

  New Revision: 58424

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

  Log:
    vm_dump.c: non-scalar thread_id
    
    * vm_dump.c (rb_vmdebug_stack_dump_all_threads): fix for
      non-scalar thread_id platforms.  c.f. [Bug #9884]

  Modified files:
    trunk/thread.c
    trunk/vm_dump.c
Index: thread.c
===================================================================
--- thread.c	(revision 58423)
+++ thread.c	(revision 58424)
@@ -203,8 +203,9 @@ void rb_thread_debug(const char *fmt, .. https://github.com/ruby/ruby/blob/trunk/thread.c#L203
 #endif
 
 # ifdef NON_SCALAR_THREAD_ID
-static const char *
-fill_thread_id_string(rb_nativethread_id_t thid, rb_thread_id_string_t buf)
+#define fill_thread_id_string ruby_fill_thread_id_string
+const char *
+ruby_fill_thread_id_string(rb_nativethread_id_t thid, rb_thread_id_string_t buf)
 {
     extern const char ruby_digitmap[];
     size_t i;
Index: vm_dump.c
===================================================================
--- vm_dump.c	(revision 58423)
+++ vm_dump.c	(revision 58424)
@@ -1047,6 +1047,10 @@ rb_vm_bugreport(const void *ctx) https://github.com/ruby/ruby/blob/trunk/vm_dump.c#L1047
     }
 }
 
+#ifdef NON_SCALAR_THREAD_ID
+const char *ruby_fill_thread_id_string(rb_nativethread_id_t thid, rb_thread_id_string_t buf);
+#endif
+
 void
 rb_vmdebug_stack_dump_all_threads(void)
 {
@@ -1054,7 +1058,13 @@ rb_vmdebug_stack_dump_all_threads(void) https://github.com/ruby/ruby/blob/trunk/vm_dump.c#L1058
     rb_thread_t *th = NULL;
 
     list_for_each(&vm->living_threads, th, vmlt_node) {
+#ifdef NON_SCALAR_THREAD_ID
+	rb_thread_id_string_t buf;
+	ruby_fill_thread_id_string(th->thread_id, buf);
+	fprintf(stderr, "th: %p, native_id: %s\n", th, buf);
+#else
 	fprintf(stderr, "th: %p, native_id: %p\n", th, (void *)th->thread_id);
+#endif
 	rb_vmdebug_stack_dump_raw(th, th->cfp);
     }
 }

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

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