From 7170baa878ac0223f26fcf8c8bf25492415e6eaa Mon Sep 17 00:00:00 2001 From: tmm1 Date: Tue, 10 Dec 2013 02:26:09 +0000 Subject: objspace_dump.c: include object's gc flags in dump * ext/objspace/objspace_dump.c (dump_object): include fstring flag on strings. include gc flags (old, remembered, wb_protected) on all objects. * ext/objspace/objspace_dump.c (Init_objspace_dump): initialize lazy IDs before first use. * gc.c (rb_obj_gc_flags): new function to retrieve object flags * internal.h (RB_OBJ_GC_FLAGS_MAX): maximum flags allowed for one obj * test/objspace/test_objspace.rb (test_dump_flags): test for above * test/objspace/test_objspace.rb (test_trace_object_allocations): resolve name before dump (for rb_class_path_cached) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44105 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/objspace/test_objspace.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'test/objspace') diff --git a/test/objspace/test_objspace.rb b/test/objspace/test_objspace.rb index 38fd9bd46f..42dc55de9f 100644 --- a/test/objspace/test_objspace.rb +++ b/test/objspace/test_objspace.rb @@ -130,6 +130,7 @@ class TestObjSpace < Test::Unit::TestCase end def test_trace_object_allocations + Class.name o0 = Object.new ObjectSpace.trace_object_allocations{ o1 = Object.new; line1 = __LINE__; c1 = GC.count @@ -193,6 +194,12 @@ class TestObjSpace < Test::Unit::TestCase assert_equal(nil, ObjectSpace.allocation_sourcefile(obj3)) end + def test_dump_flags + info = ObjectSpace.dump("foo".freeze) + assert_match /"wb_protected":true, "old":true, "marked":true/, info + assert_match /"fstring":true/, info + end + def test_dump_to_default line = nil info = nil -- cgit v1.2.3