[pypy-commit] pypy default: search typeids.txt also in the parent directory
antocuni
noreply at buildbot.pypy.org
Fri Aug 5 15:01:29 CEST 2011
Author: Antonio Cuni <anto.cuni at gmail.com>
Branch:
Changeset: r46292:6c9102779b16
Date: 2011-08-05 15:02 +0200
http://bitbucket.org/pypy/pypy/changeset/6c9102779b16/
Log: search typeids.txt also in the parent directory
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
@@ -108,6 +108,9 @@
exename = progspace.filename
root = os.path.dirname(exename)
typeids_txt = os.path.join(root, 'typeids.txt')
+ if not os.path.exists(typeids_txt):
+ newroot = os.path.dirname(root)
+ typeids_txt = os.path.join(newroot, 'typeids.txt')
print 'loading', typeids_txt
typeids = {}
with open(typeids_txt) as f:
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
@@ -76,6 +76,21 @@
hdr = gdb_pypy.lookup(obj, 'gcheader')
assert hdr['h_tid'] == 123
+def test_load_typeids(tmpdir):
+ exe = tmpdir.join('testing_1').join('pypy-c')
+ typeids = tmpdir.join('typeids.txt')
+ typeids.write("""
+member0 GcStruct xxx {}
+""".strip())
+ progspace = Mock(filename=str(exe))
+ exprs = {
+ '((char*)(&pypy_g_typeinfo.member0)) - (char*)&pypy_g_typeinfo': 0,
+ }
+ gdb = FakeGdb(exprs, progspace)
+ cmd = gdb_pypy.RPyType(gdb)
+ typeids = cmd.load_typeids(progspace)
+ assert typeids[0] == 'GcStruct xxx {}'
+
def test_RPyType(tmpdir):
exe = tmpdir.join('pypy-c')
typeids = tmpdir.join('typeids.txt')
More information about the pypy-commit
mailing list