Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
117ef042
Commit
117ef042
authored
Dec 14, 2010
by
Mark Florisson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor inferior execution control code, better gdb message handling and re-fix runtests.py
parent
bd41e488
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
178 additions
and
161 deletions
+178
-161
Cython/Debugger/Tests/test_libcython_in_gdb.py
Cython/Debugger/Tests/test_libcython_in_gdb.py
+1
-1
Cython/Debugger/libcython.py
Cython/Debugger/libcython.py
+25
-22
Cython/Debugger/libpython.py
Cython/Debugger/libpython.py
+146
-132
runtests.py
runtests.py
+6
-6
No files found.
Cython/Debugger/Tests/test_libcython_in_gdb.py
View file @
117ef042
...
@@ -58,7 +58,7 @@ class DebugTestCase(unittest.TestCase):
...
@@ -58,7 +58,7 @@ class DebugTestCase(unittest.TestCase):
if
source_line
is
not
None
:
if
source_line
is
not
None
:
lineno
=
test_libcython
.
source_to_lineno
[
source_line
]
lineno
=
test_libcython
.
source_to_lineno
[
source_line
]
frame
=
gdb
.
selected_frame
()
frame
=
gdb
.
selected_frame
()
self
.
assertEqual
(
libcython
.
cy
.
step
.
lineno
(
frame
),
lineno
)
self
.
assertEqual
(
libcython
.
cy
thon_info
.
lineno
(
frame
),
lineno
)
def
break_and_run
(
self
,
source_line
):
def
break_and_run
(
self
,
source_line
):
break_lineno
=
test_libcython
.
source_to_lineno
[
source_line
]
break_lineno
=
test_libcython
.
source_to_lineno
[
source_line
]
...
...
Cython/Debugger/libcython.py
View file @
117ef042
...
@@ -835,10 +835,9 @@ class CyBreak(CythonCommand):
...
@@ -835,10 +835,9 @@ class CyBreak(CythonCommand):
return
compl
return
compl
class
Cython
CodeStepper
(
CythonCommand
,
libpython
.
GenericCodeStepper
):
class
Cython
Info
(
CythonBase
,
libpython
.
LanguageInfo
):
"""
"""
Base class for CyStep and CyNext. It implements the interface dictated by
Implementation of the interface dictated by libpython.LanguageInfo.
libpython.GenericCodeStepper.
"""
"""
def
lineno
(
self
,
frame
):
def
lineno
(
self
,
frame
):
...
@@ -849,20 +848,16 @@ class CythonCodeStepper(CythonCommand, libpython.GenericCodeStepper):
...
@@ -849,20 +848,16 @@ class CythonCodeStepper(CythonCommand, libpython.GenericCodeStepper):
if
self
.
is_cython_function
(
frame
):
if
self
.
is_cython_function
(
frame
):
return
self
.
get_cython_lineno
(
frame
)
return
self
.
get_cython_lineno
(
frame
)
else
:
else
:
return
libpython
.
py_step
.
lineno
(
frame
)
return
libpython
.
py_step
.
l
ang_info
.
l
ineno
(
frame
)
def
get_source_line
(
self
,
frame
):
def
get_source_line
(
self
,
frame
):
try
:
try
:
line
=
super
(
Cython
CodeStepper
,
self
).
get_source_line
(
frame
)
line
=
super
(
Cython
Info
,
self
).
get_source_line
(
frame
)
except
gdb
.
GdbError
:
except
gdb
.
GdbError
:
return
None
return
None
else
:
else
:
return
line
.
strip
()
or
None
return
line
.
strip
()
or
None
@
classmethod
def
register
(
cls
):
return
cls
(
cls
.
name
,
stepinto
=
getattr
(
cls
,
'stepinto'
,
False
))
def
runtime_break_functions
(
self
):
def
runtime_break_functions
(
self
):
if
self
.
is_cython_function
():
if
self
.
is_cython_function
():
return
self
.
get_cython_function
().
step_into_functions
return
self
.
get_cython_function
().
step_into_functions
...
@@ -873,7 +868,15 @@ class CythonCodeStepper(CythonCommand, libpython.GenericCodeStepper):
...
@@ -873,7 +868,15 @@ class CythonCodeStepper(CythonCommand, libpython.GenericCodeStepper):
return
result
return
result
class
CyStep
(
CythonCodeStepper
):
class
CythonExecutionControlCommand
(
CythonCommand
,
libpython
.
ExecutionControlCommandBase
):
@
classmethod
def
register
(
cls
):
return
cls
(
cls
.
name
,
cython_info
)
class
CyStep
(
CythonExecutionControlCommand
,
libpython
.
PythonStepperMixin
):
"Step through Cython, Python or C code."
"Step through Cython, Python or C code."
name
=
'cy step'
name
=
'cy step'
...
@@ -881,8 +884,7 @@ class CyStep(CythonCodeStepper):
...
@@ -881,8 +884,7 @@ class CyStep(CythonCodeStepper):
def
invoke
(
self
,
args
,
from_tty
):
def
invoke
(
self
,
args
,
from_tty
):
if
self
.
is_python_function
():
if
self
.
is_python_function
():
libpython
.
py_step
.
get_source_line
=
self
.
get_source_line
self
.
python_step
(
self
.
stepinto
)
libpython
.
py_step
.
invoke
(
args
,
from_tty
)
elif
not
self
.
is_cython_function
():
elif
not
self
.
is_cython_function
():
if
self
.
stepinto
:
if
self
.
stepinto
:
command
=
'step'
command
=
'step'
...
@@ -891,7 +893,7 @@ class CyStep(CythonCodeStepper):
...
@@ -891,7 +893,7 @@ class CyStep(CythonCodeStepper):
self
.
finish_executing
(
gdb
.
execute
(
command
,
to_string
=
True
))
self
.
finish_executing
(
gdb
.
execute
(
command
,
to_string
=
True
))
else
:
else
:
self
.
step
()
self
.
step
(
stepinto
=
self
.
stepinto
)
class
CyNext
(
CyStep
):
class
CyNext
(
CyStep
):
...
@@ -901,7 +903,7 @@ class CyNext(CyStep):
...
@@ -901,7 +903,7 @@ class CyNext(CyStep):
stepinto
=
False
stepinto
=
False
class
CyRun
(
Cython
CodeStepper
):
class
CyRun
(
Cython
ExecutionControlCommand
):
"""
"""
Run a Cython program. This is like the 'run' command, except that it
Run a Cython program. This is like the 'run' command, except that it
displays Cython or Python source lines as well
displays Cython or Python source lines as well
...
@@ -909,26 +911,26 @@ class CyRun(CythonCodeStepper):
...
@@ -909,26 +911,26 @@ class CyRun(CythonCodeStepper):
name
=
'cy run'
name
=
'cy run'
invoke
=
Cython
CodeStepper
.
run
invoke
=
Cython
ExecutionControlCommand
.
run
class
CyCont
(
Cy
Run
):
class
CyCont
(
Cy
thonExecutionControlCommand
):
"""
"""
Continue a Cython program. This is like the 'run' command, except that it
Continue a Cython program. This is like the 'run' command, except that it
displays Cython or Python source lines as well.
displays Cython or Python source lines as well.
"""
"""
name
=
'cy cont'
name
=
'cy cont'
invoke
=
Cython
CodeStepper
.
cont
invoke
=
Cython
ExecutionControlCommand
.
cont
class
CyFinish
(
Cy
Run
):
class
CyFinish
(
Cy
thonExecutionControlCommand
):
"""
"""
Execute until the function returns.
Execute until the function returns.
"""
"""
name
=
'cy finish'
name
=
'cy finish'
invoke
=
Cython
CodeStepper
.
finish
invoke
=
Cython
ExecutionControlCommand
.
finish
class
CyUp
(
CythonCommand
):
class
CyUp
(
CythonCommand
):
...
@@ -964,7 +966,7 @@ class CyDown(CyUp):
...
@@ -964,7 +966,7 @@ class CyDown(CyUp):
_command
=
'down'
_command
=
'down'
class
CySelect
(
CythonCo
deStepper
):
class
CySelect
(
CythonCo
mmand
):
"""
"""
Select a frame. Use frame numbers as listed in `cy backtrace`.
Select a frame. Use frame numbers as listed in `cy backtrace`.
This command is useful because `cy backtrace` prints a reversed backtrace.
This command is useful because `cy backtrace` prints a reversed backtrace.
...
@@ -982,7 +984,7 @@ class CySelect(CythonCodeStepper):
...
@@ -982,7 +984,7 @@ class CySelect(CythonCodeStepper):
while
frame
.
newer
():
while
frame
.
newer
():
frame
=
frame
.
newer
()
frame
=
frame
.
newer
()
stackdepth
=
self
.
_
stackdepth
(
frame
)
stackdepth
=
libpython
.
stackdepth
(
frame
)
try
:
try
:
gdb
.
execute
(
'select %d'
%
(
stackdepth
-
stackno
-
1
,))
gdb
.
execute
(
'select %d'
%
(
stackdepth
-
stackno
-
1
,))
...
@@ -1288,5 +1290,6 @@ class CyLine(gdb.Function, CythonBase):
...
@@ -1288,5 +1290,6 @@ class CyLine(gdb.Function, CythonBase):
def
invoke
(
self
):
def
invoke
(
self
):
return
self
.
get_cython_lineno
()
return
self
.
get_cython_lineno
()
cython_info
=
CythonInfo
()
cy
=
CyCy
.
register
()
cy
=
CyCy
.
register
()
cython_info
.
cy
=
cy
\ No newline at end of file
Cython/Debugger/libpython.py
View file @
117ef042
This diff is collapsed.
Click to expand it.
runtests.py
View file @
117ef042
...
@@ -644,12 +644,12 @@ class CythonUnitTestCase(CythonCompileTestCase):
...
@@ -644,12 +644,12 @@ class CythonUnitTestCase(CythonCompileTestCase):
except
Exception
:
except
Exception
:
pass
pass
# Someone wrapped this in a:
try
:
# 'try: import gdb; ... except: include_debugger = False' thing, but don't do
import
gdb
# this, it doesn't work as gdb is a builtin module in GDB. The tests themselves
include_debugger
=
sys
.
version_info
[:
2
]
>
(
2
,
5
)
# are doing the skipping. If there's a problem with the tests, please file an
except
:
# issue.
include_debugger
=
False
include_debugger
=
sys
.
version_info
[:
2
]
>
(
2
,
5
)
def
collect_unittests
(
path
,
module_prefix
,
suite
,
selectors
):
def
collect_unittests
(
path
,
module_prefix
,
suite
,
selectors
):
def
file_matches
(
filename
):
def
file_matches
(
filename
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment