From 6a7cea2510e4898a2206626eefd4000ca84fd326 Mon Sep 17 00:00:00 2001 From: Mark Florisson Date: Mon, 1 Nov 2010 23:27:23 +0100 Subject: [PATCH] Added 'cy up' and 'cy down' commands. --- Cython/Debugger/libcython.py | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/Cython/Debugger/libcython.py b/Cython/Debugger/libcython.py index 81425d00..059e7ef5 100644 --- a/Cython/Debugger/libcython.py +++ b/Cython/Debugger/libcython.py @@ -431,13 +431,15 @@ class CyCy(CythonCommand): cy break cy step cy next + cy run + cy cont + cy up + cy down cy print cy list cy locals cy globals cy backtrace - cy up - cy down """ name = 'cy' @@ -454,6 +456,8 @@ class CyCy(CythonCommand): next = CyNext.register(), run = CyRun.register(), cont = CyCont.register(), + up = CyUp.register(), + down = CyDown.register(), list = CyList.register(), print_ = CyPrint.register(), locals = CyLocals.register(), @@ -714,25 +718,46 @@ class CyRun(CythonCodeStepper): """ name = 'cy run' + _command = 'run' def invoke(self, *args): - self.result = gdb.execute('run', to_string=True) + self.result = gdb.execute(self._command, to_string=True) self.end_stepping() -class CyCont(CythonCodeStepper): +class CyCont(CyRun): """ Continue a Cython program. This is like the 'run' command, except that it displays Cython or Python source lines as well. """ name = 'cy cont' + _command = 'cont' + + +class CyUp(CythonCodeStepper): + """ + Go up a Cython, Python or relevant C frame. + """ + name = 'cy up' + _command = 'up' def invoke(self, *args): - self.result = gdb.execute('cont', to_string=True) + self.result = gdb.execute(self._command, to_string=True) + while not self.is_relevant_function(gdb.selected_frame()): + self.result = gdb.execute(self._command, to_string=True) self.end_stepping() +class CyDown(CyUp): + """ + Go down a Cython, Python or relevant C frame. + """ + + name = 'cy down' + _command = 'down' + + class CyList(CythonCommand): """ List Cython source code. To disable to customize colouring see the cy_* -- 2.26.2