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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cython
Commits
dca9af1e
Commit
dca9af1e
authored
Oct 12, 2013
by
Marc Abramowitz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cython/Debugger/Cygdb.py: Add debug logging with `logging` module
parent
e8301b2c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
1 deletion
+28
-1
Cython/Debugger/Cygdb.py
Cython/Debugger/Cygdb.py
+28
-1
No files found.
Cython/Debugger/Cygdb.py
View file @
dca9af1e
...
...
@@ -18,6 +18,9 @@ import tempfile
import
textwrap
import
subprocess
import
optparse
import
logging
logger
=
logging
.
getLogger
(
__name__
)
def
make_command_file
(
path_to_debug_info
,
prefix_code
=
''
,
no_import
=
False
):
if
not
no_import
:
...
...
@@ -78,6 +81,9 @@ def main(path_to_debug_info=None, gdb_argv=None, no_import=False):
parser
.
add_option
(
"--gdb-executable"
,
dest
=
"gdb"
,
default
=
'gdb'
,
help
=
"gdb executable to use [default: gdb]"
)
parser
.
add_option
(
"--verbose"
,
"-v"
,
dest
=
"verbosity"
,
action
=
"count"
,
default
=
0
,
help
=
"Verbose mode. Multiple -v options increase the verbosity"
)
(
options
,
args
)
=
parser
.
parse_args
()
if
path_to_debug_info
is
None
:
...
...
@@ -92,13 +98,34 @@ def main(path_to_debug_info=None, gdb_argv=None, no_import=False):
if
path_to_debug_info
==
'--'
:
no_import
=
True
logging_level
=
logging
.
WARN
if
options
.
verbosity
==
1
:
logging_level
=
logging
.
INFO
if
options
.
verbosity
==
2
:
logging_level
=
logging
.
DEBUG
logging
.
basicConfig
(
level
=
logging_level
)
logger
.
info
(
"verbosity = %r"
,
options
.
verbosity
)
logger
.
debug
(
"options = %r; args = %r"
,
options
,
args
)
logger
.
debug
(
"Done parsing command-line options. path_to_debug_info = %r, gdb_argv = %r"
,
path_to_debug_info
,
gdb_argv
)
tempfilename
=
make_command_file
(
path_to_debug_info
,
no_import
=
no_import
)
logger
.
info
(
"Launching %s with command file: %s and gdb_argv: %s"
,
options
.
gdb
,
tempfilename
,
gdb_argv
)
logger
.
debug
(
'Command file (%s) contains: """
\
n
%s"""'
,
tempfilename
,
open
(
tempfilename
).
read
())
logger
.
info
(
"Spawning %s..."
,
options
.
gdb
)
p
=
subprocess
.
Popen
([
options
.
gdb
,
'-command'
,
tempfilename
]
+
gdb_argv
)
logger
.
info
(
"Spawned %s (pid %d)"
,
options
.
gdb
,
p
.
pid
)
while
True
:
try
:
p
.
wait
()
logger
.
debug
(
"Waiting for gdb (pid %d) to exit..."
,
p
.
pid
)
ret
=
p
.
wait
()
logger
.
debug
(
"Wait for gdb (pid %d) to exit is done. Returned: %r"
,
p
.
pid
,
ret
)
except
KeyboardInterrupt
:
pass
else
:
break
logger
.
debug
(
"Removing temp command file: %s"
,
tempfilename
)
os
.
remove
(
tempfilename
)
logger
.
debug
(
"Removed temp command file: %s"
,
tempfilename
)
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