Author: Armin Rigo <[email protected]>
Branch:
Changeset: r76849:55bd99ad0ea8
Date: 2015-04-20 13:40 +0200
http://bitbucket.org/pypy/pypy/changeset/55bd99ad0ea8/
Log: Null arrays and lists
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
@@ -264,12 +264,15 @@
def to_string(self):
t = self.val.type
- print(t)
if t.target().tag.startswith(r'pypy_array'):
+ if not self.val:
+ return 'r(null_array)'
length = int(self.val['length'])
items = self.val['items']
allocstr = ''
else:
+ if not self.val:
+ return 'r(null_list)'
length = int(self.val['l_length'])
array = self.val['l_items']
allocated = int(array['length'])
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
@@ -210,6 +210,16 @@
printer = gdb_pypy.RPyListPrinter.lookup(mylist, FakeGdb)
assert printer.to_string() == 'r[20, 21, 22] (len=3)'
+def test_pprint_null_list():
+ mylist = PtrValue({}, type_tag='pypy_list1')
+ printer = gdb_pypy.RPyListPrinter.lookup(mylist, FakeGdb)
+ assert printer.to_string() == 'r(null_list)'
+
+def test_pprint_null_array():
+ mylist = PtrValue({}, type_tag='pypy_array1')
+ printer = gdb_pypy.RPyListPrinter.lookup(mylist, FakeGdb)
+ assert printer.to_string() == 'r(null_array)'
+
def test_typeidsmap():
gdb = FakeGdb('', {exprmember(1): 111,
exprmember(2): 222,
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit