From b85f74fa4da98d1ffb8986bcd6b86bdaf82372ae Mon Sep 17 00:00:00 2001 From: Mark Florisson Date: Sun, 7 Nov 2010 21:31:45 +0100 Subject: [PATCH] Support breaking on line numbers in the current Cython module (using ':linenumber' syntax) Default sys.executable as the python interpreter for the debuggee --- Cython/Debugger/Cygdb.py | 1 + Cython/Debugger/libcython.py | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Cython/Debugger/Cygdb.py b/Cython/Debugger/Cygdb.py index 4c83c2c0..09906675 100644 --- a/Cython/Debugger/Cygdb.py +++ b/Cython/Debugger/Cygdb.py @@ -36,6 +36,7 @@ def make_command_file(path_to_debug_info, prefix_code='', no_import=False): f.write(prefix_code) f.write('set breakpoint pending on\n') f.write("set print pretty on\n") + f.write("file %s\n" % sys.executable) f.write('python from Cython.Debugger import libcython\n') if not no_import: f.write('\n'.join('cy import %s\n' % fn for fn in debug_files)) diff --git a/Cython/Debugger/libcython.py b/Cython/Debugger/libcython.py index ecee05ad..c0558dac 100644 --- a/Cython/Debugger/libcython.py +++ b/Cython/Debugger/libcython.py @@ -721,7 +721,11 @@ class CyBreak(CythonCommand): def _break_pyx(self, name): modulename, _, lineno = name.partition(':') lineno = int(lineno) - cython_module = self.cy.cython_namespace[modulename] + if modulename: + cython_module = self.cy.cython_namespace[modulename] + else: + cython_module = self.get_cython_function().module + if lineno in cython_module.lineno_cy2c: c_lineno = cython_module.lineno_cy2c[lineno] breakpoint = '%s:%s' % (cython_module.c_filename, c_lineno) -- 2.26.2