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

ruby-changes:13618

From: nobu <ko1@a...>
Date: Mon, 19 Oct 2009 15:17:46 +0900 (JST)
Subject: [ruby-changes:13618] Ruby:r25401 (trunk): * .gdbinit (rb_method_entry): search method entry by class and id.

nobu	2009-10-19 15:17:31 +0900 (Mon, 19 Oct 2009)

  New Revision: 25401

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

  Log:
    * .gdbinit (rb_method_entry): search method entry by class and id.

  Modified files:
    trunk/.gdbinit
    trunk/ChangeLog

Index: .gdbinit
===================================================================
--- .gdbinit	(revision 25400)
+++ .gdbinit	(revision 25401)
@@ -614,10 +614,70 @@
   call rb_p($arg0)
 end
 
+define rb_numtable_entry
+  set $rb_numtable_tbl = $arg0
+  set $rb_numtable_id = (st_data_t)$arg1
+  set $rb_numtable_key = 0
+  set $rb_numtable_rec = 0
+  if $rb_numtable_tbl->entries_packed
+    set $rb_numtable_p = $rb_numtable_tbl->bins
+    while $rb_numtable_p && $rb_numtable_p < $rb_numtable_tbl->bins+$rb_numtable_tbl->num_entries
+      if (st_data_t)$rb_numtable_p[0] == $rb_numtable_id
+	set $rb_numtable_key = (st_data_t)$rb_numtable_p[0]
+	set $rb_numtable_rec = (st_data_t)$rb_numtable_p[1]
+	set $rb_numtable_p = 0
+      else
+	set $rb_numtable_p = $rb_numtable_p + 2
+      end
+    end
+  else
+    set $rb_numtable_p = $rb_numtable_tbl->bins[$rb_numtable_id % $rb_numtable_tbl->num_bins]
+    while $rb_numtable_p
+      if $rb_numtable_p->key == $rb_numtable_id
+	set $rb_numtable_key = $rb_numtable_p->key
+	set $rb_numtable_rec = $rb_numtable_p->record
+	set $rb_numtable_p = 0
+      else
+	set $rb_numtable_p = $rb_numtable_p->next
+      end
+    end
+  end
+end
+
 define rb_id2name
-  call rb_id2name($arg0)
+  rb_numtable_entry global_symbols.id_str (ID)$arg0
+  if $rb_numtable_rec
+    rp $rb_numtable_rec
+  else
+    echo undef\n
+  end
 end
+document rb_id2name
+  Print the name of id
+end
 
+define rb_method_entry
+  set $rb_method_entry_klass = (struct RClass *)$arg0
+  set $rb_method_entry_id = (ID)$arg1
+  set $rb_method_entry_me = (rb_method_entry_t *)0
+  while !$rb_method_entry_me && $rb_method_entry_klass
+    rb_numtable_entry $rb_method_entry_klass->m_tbl $rb_method_entry_id
+    set $rb_method_entry_me = (rb_method_entry_t *)$rb_numtable_rec
+    if !$rb_method_entry_me
+      set $rb_method_entry_klass = (struct RClass *)$rb_method_entry_klass->ptr->super
+    end
+  end
+  if $rb_method_entry_me
+    print *$rb_method_entry_klass
+    print *$rb_method_entry_me
+  else
+    echo method not found\n
+  end
+end
+document rb_method_entry
+  Search method entry by class and id
+end
+
 define rb_classname
   call classname($arg0)
   rb_p $
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 25400)
+++ ChangeLog	(revision 25401)
@@ -1,3 +1,7 @@
+Mon Oct 19 15:17:29 2009  Nobuyoshi Nakada  <nobu@r...>
+
+	* .gdbinit (rb_method_entry): search method entry by class and id.
+
 Mon Oct 19 15:03:31 2009  NAKAMURA Usaku  <usa@r...>
 
 	* win32/Makefile.sub (enc/unicode/name2ctype.h): no need to create

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

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