Permalink
Browse files

Added gdb rph to print object given its subtend handle.

  • Loading branch information...
1 parent 0a16322 commit f51ae8a38507f5c3d49e7a33a6ea5cd634e5236f Brian Ford committed Mar 20, 2009
Showing with 15 additions and 0 deletions.
  1. +4 −0 .gdbinit
  2. +11 −0 vm/subtend/ruby.cpp
View
4 .gdbinit
@@ -10,6 +10,10 @@ define rps
p __show_simple__($arg0)
end
+define rph
+p __show_subtend__($arg0)
+end
+
define validate
p rubinius::VM::current_state()->om->validate_object($arg0)
end
View
11 vm/subtend/ruby.cpp
@@ -1388,4 +1388,15 @@ extern "C" {
return rb_funcall(block_handle, rb_intern("call"), 1, argument_handle);
}
+
+ /* For debugging. */
+ void __show_subtend__(VALUE obj_handle) {
+ NativeMethodEnvironment* env = NativeMethodEnvironment::get();
+
+ Object* object = env->get_object(obj_handle);
+ if(!object) {
+ std::cout << "the object is NULL, check if an exception was raised." << std::endl;
+ }
+ object->show(env->state());
+ }
}

0 comments on commit f51ae8a

Please sign in to comment.