Print warning if cygdb reads debug info and is using an interpreter without debug...
authorMark Florisson <markflorisson88@gmail.com>
Fri, 3 Dec 2010 20:55:29 +0000 (21:55 +0100)
committerMark Florisson <markflorisson88@gmail.com>
Fri, 3 Dec 2010 20:55:29 +0000 (21:55 +0100)
Cython/Debugger/Cygdb.py

index 87b2c0f6ecf5be735e2a29c0e2f33ea8a34638d2..eefbdbe0994574b7272b4c645e10541126733967 100644 (file)
@@ -15,6 +15,7 @@ import os
 import sys
 import glob
 import tempfile
+import textwrap
 import subprocess
 
 usage = "Usage: cygdb [PATH [GDB_ARGUMENTS]]"
@@ -46,6 +47,17 @@ def make_command_file(path_to_debug_info, prefix_code='', no_import=False):
         interpreter = open(path).read()
         f.write("file %s\n" % interpreter)
         f.write('\n'.join('cy import %s\n' % fn for fn in debug_files))
+        f.write(textwrap.dedent('''\
+            python
+            import sys
+            try:
+                gdb.lookup_type('PyModuleObject')
+            except RuntimeError:
+                sys.stderr.write(
+                    'Python was not compiled with debug symbols (or it was '
+                    'stripped). Some functionality may not work (properly).\\n')
+            end
+        '''))
     
     f.close()