summaryrefslogtreecommitdiffstats
path: root/Tools/gdb
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2016-12-16 09:00:53 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2016-12-16 09:00:53 (GMT)
commitcb5fe9c22c6b19acf1216a93856b7bdc2bb06677 (patch)
tree443bac3cea1a0c2a6f97a068f52c18f6200c10e2 /Tools/gdb
parent42f66a61f113a4ae6c0b29267ea1a4028e6124bb (diff)
parent610f5d739dd22bce352bde59dce3985c73aaefab (diff)
downloadcpython-cb5fe9c22c6b19acf1216a93856b7bdc2bb06677.zip
cpython-cb5fe9c22c6b19acf1216a93856b7bdc2bb06677.tar.gz
cpython-cb5fe9c22c6b19acf1216a93856b7bdc2bb06677.tar.bz2
Merge 3.5
Diffstat (limited to 'Tools/gdb')
-rwxr-xr-xTools/gdb/libpython.py20
1 files changed, 18 insertions, 2 deletions
diff --git a/Tools/gdb/libpython.py b/Tools/gdb/libpython.py
index 798b062..cc1afbe 100755
--- a/Tools/gdb/libpython.py
+++ b/Tools/gdb/libpython.py
@@ -1570,7 +1570,11 @@ class Frame(object):
def get_selected_python_frame(cls):
'''Try to obtain the Frame for the python-related code in the selected
frame, or None'''
- frame = cls.get_selected_frame()
+ try:
+ frame = cls.get_selected_frame()
+ except gdb.error:
+ # No frame: Python didn't start yet
+ return None
while frame:
if frame.is_python_frame():
@@ -1711,6 +1715,10 @@ PyList()
def move_in_stack(move_up):
'''Move up or down the stack (for the py-up/py-down command)'''
frame = Frame.get_selected_python_frame()
+ if not frame:
+ print('Unable to locate python frame')
+ return
+
while frame:
if move_up:
iter_frame = frame.older()
@@ -1773,6 +1781,10 @@ class PyBacktraceFull(gdb.Command):
def invoke(self, args, from_tty):
frame = Frame.get_selected_python_frame()
+ if not frame:
+ print('Unable to locate python frame')
+ return
+
while frame:
if frame.is_python_frame():
frame.print_summary()
@@ -1790,8 +1802,12 @@ class PyBacktrace(gdb.Command):
def invoke(self, args, from_tty):
- sys.stdout.write('Traceback (most recent call first):\n')
frame = Frame.get_selected_python_frame()
+ if not frame:
+ print('Unable to locate python frame')
+ return
+
+ sys.stdout.write('Traceback (most recent call first):\n')
while frame:
if frame.is_python_frame():
frame.print_traceback()