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

ruby-changes:24216

From: nobu <ko1@a...>
Date: Mon, 2 Jul 2012 17:07:09 +0900 (JST)
Subject: [ruby-changes:24216] nobu:r36267 (trunk): rp_class rb_ancestors

nobu	2012-07-02 17:07:01 +0900 (Mon, 02 Jul 2012)

  New Revision: 36267

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

  Log:
    rp_class rb_ancestors
    
    * .gdbinit (rp_class): Print the content of a Class/Module.
    
    * .gdbinit (rb_ancestors): Print ancestors.

  Modified files:
    trunk/.gdbinit

Index: .gdbinit
===================================================================
--- .gdbinit	(revision 36266)
+++ .gdbinit	(revision 36267)
@@ -106,21 +106,15 @@
   else
   if ($flags & RUBY_T_MASK) == RUBY_T_CLASS
     printf "T_CLASS%s: ", ($flags & RUBY_FL_SINGLETON) ? "*" : ""
-    print (struct RClass *)($arg0)
-    print *(struct RClass *)($arg0)
-    print *((struct RClass *)($arg0))->ptr
+    rp_class $arg0
   else
   if ($flags & RUBY_T_MASK) == RUBY_T_ICLASS
     printf "T_ICLASS: "
-    print (struct RClass *)($arg0)
-    print *(struct RClass *)($arg0)
-    print *((struct RClass *)($arg0))->ptr
+    rp_class $arg0
   else
   if ($flags & RUBY_T_MASK) == RUBY_T_MODULE
     printf "T_MODULE: "
-    print (struct RClass *)($arg0)
-    print *(struct RClass *)($arg0)
-    print *((struct RClass *)($arg0))->ptr
+    rp_class $arg0
   else
   if ($flags & RUBY_T_MASK) == RUBY_T_FLOAT
     printf "T_FLOAT: %.16g ", (((struct RFloat*)($arg0))->float_value)
@@ -343,6 +337,19 @@
   Print a Ruby's VALUE.
 end
 
+define rp_class
+  printf "(struct RClass *) %p", (void*)$arg0
+  if ((struct RClass *)($arg0))->ptr.origin != $arg0
+    printf " -> %p", ((struct RClass *)($arg0))->ptr.origin
+  end
+  printf "\n"
+  print *(struct RClass *)($arg0)
+  print *((struct RClass *)($arg0))->ptr
+end
+document rp_class
+  Print the content of a Class/Module.
+end
+
 define nd_type
   print (enum node_type)((((NODE*)($arg0))->flags&RUBY_NODE_TYPEMASK)>>RUBY_NODE_TYPESHIFT)
 end
@@ -695,6 +702,17 @@
   print *(struct RClass*)($arg0)
 end
 
+define rb_ancestors
+  set $rb_ancestors_module = $arg0
+  while $rb_ancestors_module
+    rp $rb_ancestors_module
+    set $rb_ancestors_module = ((struct RClass *)($rb_ancestors_module))->ptr.super
+  end
+end
+document rb_ancestors
+  Print ancestors.
+end
+
 define rb_backtrace
   call rb_backtrace()
 end

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

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