Skip to content

Commit

Permalink
Merge 3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
vstinner committed Dec 16, 2016
2 parents 65f86a4 + cb5fe9c commit 1d59a0a
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions Tools/gdb/libpython.py
Original file line number Diff line number Diff line change
Expand Up @@ -1570,7 +1570,11 @@ def get_selected_frame(cls):
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():
Expand Down Expand Up @@ -1711,6 +1715,10 @@ def invoke(self, args, from_tty):
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()
Expand Down Expand Up @@ -1773,6 +1781,10 @@ def __init__(self):

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()
Expand All @@ -1790,8 +1802,12 @@ def __init__(self):


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()
Expand Down

0 comments on commit 1d59a0a

Please sign in to comment.