Returns the value of a register in this frame. */
static PyObject *
-frapy_read_register (PyObject *self, PyObject *args)
+frapy_read_register (PyObject *self, PyObject *args, PyObject *kw)
{
PyObject *pyo_reg_id;
PyObject *result = nullptr;
- if (!PyArg_UnpackTuple (args, "read_register", 1, 1, &pyo_reg_id))
- return NULL;
+ static const char *keywords[] = { "register", nullptr };
+ if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "O", keywords, &pyo_reg_id))
+ return nullptr;
+
try
{
scoped_value_mark free_values;
{ "pc", frapy_pc, METH_NOARGS,
"pc () -> Long.\n\
Return the frame's resume address." },
- { "read_register", frapy_read_register, METH_VARARGS,
+ { "read_register", (PyCFunction) frapy_read_register,
+ METH_VARARGS | METH_KEYWORDS,
"read_register (register_name) -> gdb.Value\n\
Return the value of the register in the frame." },
{ "block", frapy_block, METH_NOARGS,
" = True" \
"test Frame.read_register(pc)"
+# Repeat the previous test, but this time use named arguments for the
+# read_register method call.
+gdb_test "python print ('result = %s' % (f0.read_register(register = 'pc') == f0.pc()))" \
+ " = True" \
+ "test Frame.read_register() using named arguments"
+
# Test arch-specific register name.
set pc ""
if {[is_amd64_regs_target]} {