Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Gwenaël Samain
cython
Commits
29e61a09
Commit
29e61a09
authored
14 years ago
by
Mark Florisson
Browse files
Options
Download
Email Patches
Plain Diff
Put debugger startup code in Cython.Debugger.cygdb
Fixed small autocompletion bug
parent
8a10a7ea
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
62 additions
and
5 deletions
+62
-5
Cython/Debugger/cygdb.py
Cython/Debugger/cygdb.py
+54
-0
Cython/Debugger/libcython.py
Cython/Debugger/libcython.py
+4
-3
bin/cygdb
bin/cygdb
+2
-1
cygdb.py
cygdb.py
+2
-1
No files found.
Cython/Debugger/cygdb.py
0 → 100644
View file @
29e61a09
#!/usr/bin/env python
"""
The Cython debugger
The current directory should contain a directory named 'cython_debug', or a
path to the cython project directory should be given (the parent directory of
cython_debug).
"""
import
os
import
sys
import
glob
import
tempfile
import
subprocess
def
main
(
import_libpython
=
False
,
path_to_debug_info
=
os
.
curdir
):
"""
Start the Cython debugger. This tells gdb to import the Cython and Python
extensions (libpython.py and libcython.py) and it enables gdb's pending
breakpoints
import_libpython indicates whether we should just 'import libpython',
or import it from Cython.Debugger
path_to_debug_info is the path to the cython_debug directory
"""
debug_files
=
glob
.
glob
(
os
.
path
.
join
(
path_to_debug_info
,
'cython_debug/cython_debug_info_*'
))
if
not
debug_files
:
sys
.
exit
(
'No debug files were found in %s. Aborting.'
%
(
os
.
path
.
abspath
(
path_to_debug_info
)))
fd
,
tempfilename
=
tempfile
.
mkstemp
()
f
=
os
.
fdopen
(
fd
,
'w'
)
f
.
write
(
'set breakpoint pending on
\n
'
)
f
.
write
(
'python from Cython.Debugger import libcython
\n
'
)
if
import_libpython
:
f
.
write
(
'python import libpython'
)
else
:
f
.
write
(
'python from Cython.Debugger import libpython
\n
'
)
f
.
write
(
'
\n
'
.
join
(
'cy import %s
\n
'
%
fn
for
fn
in
debug_files
))
f
.
close
()
p
=
subprocess
.
Popen
([
'gdb'
,
'-command'
,
tempfilename
])
while
True
:
try
:
p
.
wait
()
except
KeyboardInterrupt
:
pass
else
:
break
os
.
remove
(
tempfilename
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Cython/Debugger/libcython.py
View file @
29e61a09
...
...
@@ -227,8 +227,8 @@ class CyBreak(gdb.Command):
@
dont_suppress_errors
def
complete
(
self
,
text
,
word
):
names
=
itertools
.
chain
(
functions_by_qualified_name
,
functions_by_name
)
last
word
=
text
.
strip
().
split
()
[
-
1
]
if
'.'
in
lastword
:
word
s
=
text
.
strip
().
split
()
if
words
and
'.'
in
words
[
-
1
]
:
compl
=
[
n
for
n
in
functions_by_qualified_name
if
n
.
startswith
(
lastword
)]
else
:
...
...
@@ -291,7 +291,8 @@ class CyPrint(gdb.Command):
try
:
cython_function
=
self
.
_get_current_cython_function
()
except
NoCythonFunctionNameInFrameError
:
print
'Unable to determine the name of the function in the current frame.'
print
(
'Unable to determine the name of the function in the '
'current frame.'
)
except
RuntimeError
,
e
:
print
e
.
args
[
0
]
else
:
...
...
This diff is collapsed.
Click to expand it.
bin/cygdb
View file @
29e61a09
#!/usr/bin/env python
import
sys
from
Cython.Debugger
import
cygdb
if
__name__
==
'__main__'
:
if
len
(
sys
.
argv
)
>
1
:
cygdb
.
main
(
path_to_debug_info
=
sys
.
argv
[
1
])
else
:
cygdb
.
main
()
\ No newline at end of file
cygdb
.
main
()
This diff is collapsed.
Click to expand it.
cygdb.py
View file @
29e61a09
#!/usr/bin/env python
import
sys
from
Cython.Debugger
import
cygdb
if
__name__
==
'__main__'
:
if
len
(
sys
.
argv
)
>
1
:
cygdb
.
main
(
path_to_debug_info
=
sys
.
argv
[
1
])
else
:
cygdb
.
main
()
\ No newline at end of file
cygdb
.
main
()
This diff is collapsed.
Click to expand it.
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