Commit a0dc7e64 authored by Mark Florisson's avatar Mark Florisson

Debugger: Update 'help' documentation

parent 298ea966
......@@ -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
......@@ -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'
......
......@@ -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')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment