[pypy-commit] pypy default: Fixes

arigo noreply at buildbot.pypy.org
Wed Oct 16 13:52:26 CEST 2013


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r67413:82101cce8799
Date: 2013-10-16 11:51 +0000
http://bitbucket.org/pypy/pypy/changeset/82101cce8799/

Log:	Fixes

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
@@ -89,7 +89,10 @@
             obj = self.gdb.parse_and_eval(arg)
             hdr = lookup(obj, '_gcheader')
             tid = hdr['h_tid']
-            offset = tid & 0xFFFFFFFF # 64bit only
+            if sys.maxint < 2**32:
+                offset = tid & 0xFFFF     # 32bit
+            else:
+                offset = tid & 0xFFFFFFFF # 64bit
             offset = int(offset) # convert from gdb.Value to python int
 
         typeids = self.get_typeids()
@@ -99,7 +102,10 @@
             return 'Cannot find the type with offset %d' % offset
 
     def get_typeids(self):
-        progspace = self.gdb.current_progspace()
+        try:
+            progspace = self.gdb.current_progspace()
+        except AttributeError:
+            progspace = None
         try:
             return self.prog2typeids[progspace]
         except KeyError:
@@ -111,7 +117,7 @@
         """
         Returns a mapping offset --> description
         """
-        exename = progspace.filename
+        exename = getattr(progspace, 'filename', '')
         root = os.path.dirname(exename)
         # XXX The same information is found in
         # XXX   pypy_g_rpython_memory_gctypelayout_GCData.gcd_inst_typeids_z
@@ -156,6 +162,7 @@
         offset = int(self.gdb.parse_and_eval(expr))
         self.line2offset[linenum] = offset
         self.offset2descr[offset] = descr
+        #print '%r -> %r -> %r' % (linenum, offset, descr)
         return offset
 
     def get(self, offset, default=None):


More information about the pypy-commit mailing list