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
Boxiang Sun
cython
Commits
a0dc7e64
Commit
a0dc7e64
authored
Mar 26, 2011
by
Mark Florisson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Debugger: Update 'help' documentation
parent
298ea966
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
19 deletions
+23
-19
Cython/Debugger/Tests/test_libpython_in_gdb.py
Cython/Debugger/Tests/test_libpython_in_gdb.py
+1
-3
Cython/Debugger/libcython.py
Cython/Debugger/libcython.py
+6
-14
Cython/Debugger/libpython.py
Cython/Debugger/libpython.py
+16
-2
No files found.
Cython/Debugger/Tests/test_libpython_in_gdb.py
View file @
a0dc7e64
...
...
@@ -113,5 +113,3 @@ class TestPrettyPrinters(test_libcython_in_gdb.DebugTestCase):
frame
=
self
.
pyobject_fromcode
(
'PyEval_GetFrame()'
)
self
.
assertEqual
(
type
(
frame
),
libpython
.
PyFrameObjectPtr
)
\ No newline at end of file
Cython/Debugger/libcython.py
View file @
a0dc7e64
...
...
@@ -592,6 +592,7 @@ class CyCy(CythonCommand):
cy bt / cy backtrace
cy list
cy print
cy set
cy locals
cy globals
cy exec
...
...
@@ -1245,19 +1246,6 @@ class EvaluateOrExecuteCodeMixin(object):
return
result
def
_evalcode_python
(
self
,
executor
,
code
,
input_type
):
global_dict
=
gdb
.
parse_and_eval
(
'PyEval_GetGlobals()'
)
local_dict
=
gdb
.
parse_and_eval
(
'PyEval_GetLocals()'
)
if
(
libpython
.
pointervalue
(
global_dict
)
==
0
or
libpython
.
pointervalue
(
local_dict
)
==
0
):
raise
gdb
.
GdbError
(
"Unable to find the locals or globals of the "
"most recent Python function (relative to the "
"selected frame)."
)
return
executor
.
evalcode
(
code
,
input_type
,
global_dict
,
local_dict
)
def
evalcode
(
self
,
code
,
input_type
):
"""
Evaluate `code` in a Python or Cython stack frame using the given
...
...
@@ -1266,7 +1254,7 @@ class EvaluateOrExecuteCodeMixin(object):
frame
=
self
.
_find_first_cython_or_python_frame
()
executor
=
libpython
.
PythonCodeExecutor
()
if
self
.
is_python_function
(
frame
):
return
self
.
_evalcode_python
(
executor
,
code
,
input_type
)
return
libpython
.
_evalcode_python
(
executor
,
code
,
input_type
)
return
self
.
_evalcode_cython
(
executor
,
code
,
input_type
)
...
...
@@ -1291,6 +1279,10 @@ class CySet(CythonCommand):
cy set my_cython_c_variable = 10
cy set my_cython_py_variable = $cy_eval("{'doner': 'kebab'}")
This is equivalent to
set $cy_value("my_cython_variable") = 10
"""
name
=
'cy set'
...
...
Cython/Debugger/libpython.py
View file @
a0dc7e64
...
...
@@ -2463,6 +2463,20 @@ class FixGdbCommand(gdb.Command):
self
.
fix_gdb
()
def
_evalcode_python
(
executor
,
code
,
input_type
):
"""
Execute Python code in the most recent stack frame.
"""
global_dict
=
gdb
.
parse_and_eval
(
'PyEval_GetGlobals()'
)
local_dict
=
gdb
.
parse_and_eval
(
'PyEval_GetLocals()'
)
if
(
pointervalue
(
global_dict
)
==
0
or
pointervalue
(
local_dict
)
==
0
):
raise
gdb
.
GdbError
(
"Unable to find the locals or globals of the "
"most recent Python function (relative to the "
"selected frame)."
)
return
executor
.
evalcode
(
code
,
input_type
,
global_dict
,
local_dict
)
class
PyExec
(
gdb
.
Command
):
def
readcode
(
self
,
expr
):
...
...
@@ -2486,8 +2500,8 @@ class PyExec(gdb.Command):
def
invoke
(
self
,
expr
,
from_tty
):
expr
,
input_type
=
self
.
readcode
(
expr
)
executor
=
PythonCodeExecutor
()
result
=
executor
.
evalcode
(
expr
,
input_type
,
global_dict
,
local_dict
)
executor
.
xdecref
(
result
)
executor
.
xdecref
(
_evalcode_python
(
executor
,
input_type
,
global_dict
,
local_dict
)
)
gdb
.
execute
(
'set breakpoint pending on'
)
...
...
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