[pypy-commit] pypy default: test and fix gdb_pypy.to_string max length logic
bdkearns
noreply at buildbot.pypy.org
Tue Feb 26 05:40:57 CET 2013
Author: Brian Kearns <bdkearns at gmail.com>
Branch:
Changeset: r61809:1610b141ce75
Date: 2013-02-25 23:39 -0500
http://bitbucket.org/pypy/pypy/changeset/1610b141ce75/
Log: test and fix gdb_pypy.to_string max length logic
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
@@ -160,7 +160,7 @@
except ValueError:
# it's a gdb.Value so it has "121 'y'" as repr
res.append(chr(int(str(items[0]).split(" ")[0])))
- if i < length:
+ if length > MAX_DISPLAY_LENGTH:
res.append('...')
string = ''.join(res)
return 'r' + repr(string)
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
@@ -143,7 +143,7 @@
cmd = gdb_pypy.RPyType(gdb)
assert cmd.do_invoke('*myvar', True) == 'GcStruct yyy {}'
-def test_pprint_string():
+def test_pprint_string(monkeypatch):
d = {'_gcheader': {
'h_tid': 123
},
@@ -156,6 +156,8 @@
p_string = PtrValue(d, type_tag='pypy_rpy_string0')
printer = gdb_pypy.RPyStringPrinter.lookup(p_string, FakeGdb)
assert printer.to_string() == "r'foobar'"
+ monkeypatch.setattr(gdb_pypy, 'MAX_DISPLAY_LENGTH', 5)
+ assert printer.to_string() == "r'fooba...'"
def test_pprint_list():
d = {'_gcheader': {
@@ -180,4 +182,4 @@
assert printer.to_string() == 'r[40, 41, 42] (len=3, alloc=5)'
mylist.type.target().tag = None
- assert gdb_pypy.RPyListPrinter.lookup(mylist, FakeGdb) is None
\ No newline at end of file
+ assert gdb_pypy.RPyListPrinter.lookup(mylist, FakeGdb) is None
More information about the pypy-commit
mailing list