]> granicus.if.org Git - python/commitdiff
bpo-32962: python-gdb catchs ValueError on read_var() (GH-7692)
authorVictor Stinner <vstinner@redhat.com>
Thu, 14 Jun 2018 14:28:07 +0000 (16:28 +0200)
committerGitHub <noreply@github.com>
Thu, 14 Jun 2018 14:28:07 +0000 (16:28 +0200)
python-gdb now catchs ValueError on read_var(): when Python has no
debug symbols for example.

Misc/NEWS.d/next/Tools-Demos/2018-06-14-16-16-53.bpo-32962.2YfdwI.rst [new file with mode: 0644]
Tools/gdb/libpython.py

diff --git a/Misc/NEWS.d/next/Tools-Demos/2018-06-14-16-16-53.bpo-32962.2YfdwI.rst b/Misc/NEWS.d/next/Tools-Demos/2018-06-14-16-16-53.bpo-32962.2YfdwI.rst
new file mode 100644 (file)
index 0000000..de40070
--- /dev/null
@@ -0,0 +1,2 @@
+python-gdb now catchs ValueError on read_var(): when Python has no debug
+symbols for example.
index 7df7c9bd541672fab6ba2679ae0c01d066e79dea..41cbba2f10f351cc2b31640a3ad93d3177bdffd5 100755 (executable)
@@ -1552,15 +1552,22 @@ class Frame(object):
                 # Use the prettyprinter for the func:
                 func = frame.read_var(arg_name)
                 return str(func)
+            except ValueError:
+                return ('PyCFunction invocation (unable to read %s: '
+                        'missing debuginfos?)' % arg_name)
             except RuntimeError:
                 return 'PyCFunction invocation (unable to read %s)' % arg_name
 
         if caller == 'wrapper_call':
+            arg_name = 'wp'
             try:
-                func = frame.read_var('wp')
+                func = frame.read_var(arg_name)
                 return str(func)
+            except ValueError:
+                return ('<wrapper_call invocation (unable to read %s: '
+                        'missing debuginfos?)>' % arg_name)
             except RuntimeError:
-                return '<wrapper_call invocation>'
+                return '<wrapper_call invocation (unable to read %s)>' % arg_name
 
         # This frame isn't worth reporting:
         return False