summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2018-06-14 14:28:07 (GMT)
committerGitHub <noreply@github.com>2018-06-14 14:28:07 (GMT)
commit019d33b7a447e78057842332fb5d3bad01922122 (patch)
tree7bdbec241885be3207973511a45770673309b045
parent4ffe9c2b251f6e027b26250b7a2618e78d4edd22 (diff)
downloadcpython-019d33b7a447e78057842332fb5d3bad01922122.zip
cpython-019d33b7a447e78057842332fb5d3bad01922122.tar.gz
cpython-019d33b7a447e78057842332fb5d3bad01922122.tar.bz2
bpo-32962: python-gdb catchs ValueError on read_var() (GH-7692)
python-gdb now catchs ValueError on read_var(): when Python has no debug symbols for example.
-rw-r--r--Misc/NEWS.d/next/Tools-Demos/2018-06-14-16-16-53.bpo-32962.2YfdwI.rst2
-rwxr-xr-xTools/gdb/libpython.py11
2 files changed, 11 insertions, 2 deletions
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
index 0000000..de40070
--- /dev/null
+++ b/Misc/NEWS.d/next/Tools-Demos/2018-06-14-16-16-53.bpo-32962.2YfdwI.rst
@@ -0,0 +1,2 @@
+python-gdb now catchs ValueError on read_var(): when Python has no debug
+symbols for example.
diff --git a/Tools/gdb/libpython.py b/Tools/gdb/libpython.py
index 7df7c9b..41cbba2 100755
--- a/Tools/gdb/libpython.py
+++ b/Tools/gdb/libpython.py
@@ -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