[pypy-commit] pypy default: Print a traceback when we get an exception (bogus gdb interface, why doesn't it do it)

arigo noreply at buildbot.pypy.org
Mon Apr 20 11:01:24 CEST 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r76843:b0f133375831
Date: 2015-04-20 11:00 +0200
http://bitbucket.org/pypy/pypy/changeset/b0f133375831/

Log:	Print a traceback when we get an exception (bogus gdb interface, why
	doesn't it do it)

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
@@ -73,15 +73,20 @@
 
     def invoke(self, arg, from_tty):
         # some magic code to automatically reload the python file while developing
-        from pypy.tool import gdb_pypy
         try:
-            reload(gdb_pypy)
+            from pypy.tool import gdb_pypy
+            try:
+                reload(gdb_pypy)
+            except:
+                import imp
+                imp.reload(gdb_pypy)
+            gdb_pypy.RPyType.prog2typeids = self.prog2typeids # persist the cache
+            self.__class__ = gdb_pypy.RPyType
+            print (self.do_invoke(arg, from_tty).decode('latin-1'))
         except:
-            import imp
-            imp.reload(gdb_pypy)
-        gdb_pypy.RPyType.prog2typeids = self.prog2typeids # persist the cache
-        self.__class__ = gdb_pypy.RPyType
-        print (self.do_invoke(arg, from_tty).decode('latin-1'))
+            import traceback
+            traceback.print_exc()
+            raise
 
     def do_invoke(self, arg, from_tty):
         try:


More information about the pypy-commit mailing list