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

ruby-changes:13616

From: nobu <ko1@a...>
Date: Mon, 19 Oct 2009 11:34:55 +0900 (JST)
Subject: [ruby-changes:13616] Ruby:r25399 (trunk): * .gdbinit (rb_ps): dump all threads and their callstacks. based

nobu	2009-10-19 11:34:40 +0900 (Mon, 19 Oct 2009)

  New Revision: 25399

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

  Log:
    * .gdbinit (rb_ps): dump all threads and their callstacks.  based
      on [ruby-core:26155] by Joshua ben Jore <twists AT gmail.com>.

  Modified files:
    trunk/.gdbinit
    trunk/ChangeLog

Index: .gdbinit
===================================================================
--- .gdbinit	(revision 25398)
+++ .gdbinit	(revision 25399)
@@ -652,3 +652,41 @@
     print *(ADJUST*)($arg0)
   end
 end
+
+define rb_ps
+  rb_ps_vm ruby_current_vm
+end
+document rb_ps
+Dump all threads and their callstacks
+end
+
+define rb_ps_vm
+  print $ps_vm = (rb_vm_t*)$arg0
+  set $ps_threads = (st_table*)$ps_vm->living_threads
+  if $ps_threads->entries_packed
+    set $ps_threads_i = 0
+    while $ps_threads_i < $ps_threads->num_entries
+      set $ps_threads_key = (st_data_t)$ps_threads->bins[$ps_threads_i * 2]
+      set $ps_threads_val = (st_data_t)$ps_threads->bins[$ps_threads_i * 2 + 1]
+      rb_ps_thread $ps_threads_key $ps_threads_val
+      set $ps_threads_i = $ps_threads_i + 1
+    end
+  else
+    set $ps_threads_ptr = (st_table_entry*)$ps_threads->head
+    while $ps_threads_ptr
+      set $ps_threads_key = (st_data_t)$ps_threads_ptr->key
+      set $ps_threads_val = (st_data_t)$ps_threads_ptr->record
+      rb_ps_thread $ps_threads_key $ps_threads_val
+      set $ps_threads_ptr = (st_table_entry*)$ps_threads_ptr->fore
+    end
+  end
+end
+document rb_ps_vm
+Dump all threads in a (rb_vm_t*) and their callstacks
+end
+
+define rb_ps_thread
+  set $ps_thread = (struct RTypedData*)$arg0
+  set $ps_thread_id = $arg1
+  print $ps_thread_th = (rb_thread_t*)$ps_thread->data
+end
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 25398)
+++ ChangeLog	(revision 25399)
@@ -1,3 +1,8 @@
+Mon Oct 19 11:34:38 2009  Nobuyoshi Nakada  <nobu@r...>
+
+	* .gdbinit (rb_ps): dump all threads and their callstacks.  based
+	  on [ruby-core:26155] by Joshua ben Jore <twists AT gmail.com>.
+
 Mon Oct 19 10:59:36 2009  Nobuyoshi Nakada  <nobu@r...>
 
 	* iseq.c (prepare_iseq_build, rb_iseq_build_for_ruby2cext):

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

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