[pypy-commit] pypy default: make sure to pretty print *all* rpython lists, not just the one named pypy_list0

antocuni noreply at buildbot.pypy.org
Mon Aug 8 17:39:18 CEST 2011


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: 
Changeset: r46377:64e0d0e00ea1
Date: 2011-08-08 17:40 +0200
http://bitbucket.org/pypy/pypy/changeset/64e0d0e00ea1/

Log:	make sure to pretty print *all* rpython lists, not just the one
	named pypy_list0

diff --git a/pypy/tool/gdb_pypy.py b/pypy/tool/gdb_pypy.py
--- a/pypy/tool/gdb_pypy.py
+++ b/pypy/tool/gdb_pypy.py
@@ -10,6 +10,7 @@
 
 from __future__ import with_statement
 
+import re
 import sys
 import os.path
 
@@ -171,7 +172,7 @@
     @classmethod
     def lookup(cls, val, gdb=None):
         t = val.type
-        if is_ptr(t, gdb) and t.target().tag == 'pypy_list0':
+        if is_ptr(t, gdb) and re.match(r'pypy_list\d*', t.target().tag):
             return cls(val)
         return None
 
diff --git a/pypy/tool/test/test_gdb_pypy.py b/pypy/tool/test/test_gdb_pypy.py
--- a/pypy/tool/test/test_gdb_pypy.py
+++ b/pypy/tool/test/test_gdb_pypy.py
@@ -174,3 +174,7 @@
     mylist = PtrValue(d, type_tag='pypy_list0')
     printer = gdb_pypy.RPyListPrinter.lookup(mylist, FakeGdb)
     assert printer.to_string() == 'r[40, 41, 42] (len=3, alloc=5)'
+    #
+    mylist.type.target().tag = 'pypy_list1234'
+    printer = gdb_pypy.RPyListPrinter.lookup(mylist, FakeGdb)
+    assert printer.to_string() == 'r[40, 41, 42] (len=3, alloc=5)'


More information about the pypy-commit mailing list