An object passed to an unwinder (a @code{gdb.PendingFrame} instance)
provides a method to read frame's registers:
-@defun PendingFrame.read_register (reg)
-This method returns the contents of the register @var{reg} in the
+@defun PendingFrame.read_register (register)
+This method returns the contents of @var{register} in the
frame as a @code{gdb.Value} object. For a description of the
-acceptable values of @var{reg} see
-@ref{gdbpy_frame_read_register,,Frame.read_register}. If @var{reg}
+acceptable values of @var{register} see
+@ref{gdbpy_frame_read_register,,Frame.read_register}. If @var{register}
does not name a register for the current architecture, this method
will throw an exception.
Returns the value of register REG as gdb.Value instance. */
static PyObject *
-pending_framepy_read_register (PyObject *self, PyObject *args)
+pending_framepy_read_register (PyObject *self, PyObject *args, PyObject *kw)
{
pending_frame_object *pending_frame = (pending_frame_object *) self;
PENDING_FRAMEPY_REQUIRE_VALID (pending_frame);
- int regnum;
PyObject *pyo_reg_id;
+ static const char *keywords[] = { "register", nullptr };
+ if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "O", keywords, &pyo_reg_id))
+ return nullptr;
- if (!PyArg_UnpackTuple (args, "read_register", 1, 1, &pyo_reg_id))
- return NULL;
+ int regnum;
if (!gdbpy_parse_register_id (pending_frame->gdbarch, pyo_reg_id, ®num))
return nullptr;
PendingFrame.create_unwind_info (self, frameId) -> UnwindInfo. */
static PyObject *
-pending_framepy_create_unwind_info (PyObject *self, PyObject *args)
+pending_framepy_create_unwind_info (PyObject *self, PyObject *args,
+ PyObject *kw)
{
PyObject *pyo_frame_id;
CORE_ADDR sp;
PENDING_FRAMEPY_REQUIRE_VALID ((pending_frame_object *) self);
- if (!PyArg_ParseTuple (args, "O:create_unwind_info", &pyo_frame_id))
+ static const char *keywords[] = { "frame_id", nullptr };
+ if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "O", keywords,
+ &pyo_frame_id))
return nullptr;
pyuw_get_attr_code code
static PyMethodDef pending_frame_object_methods[] =
{
- { "read_register", pending_framepy_read_register, METH_VARARGS,
+ { "read_register", (PyCFunction) pending_framepy_read_register,
+ METH_VARARGS | METH_KEYWORDS,
"read_register (REG) -> gdb.Value\n"
"Return the value of the REG in the frame." },
- { "create_unwind_info",
- pending_framepy_create_unwind_info, METH_VARARGS,
+ { "create_unwind_info", (PyCFunction) pending_framepy_create_unwind_info,
+ METH_VARARGS | METH_KEYWORDS,
"create_unwind_info (FRAME_ID) -> gdb.UnwindInfo\n"
"Construct UnwindInfo for this PendingFrame, using FRAME_ID\n"
"to identify it." },
read_register_error = str(ve)
frame_id = FrameId(
- pending_frame.read_register(TestUnwinder.AMD64_RSP),
+ pending_frame.read_register(register=TestUnwinder.AMD64_RSP),
pending_frame.read_register(TestUnwinder.AMD64_RIP),
)
unwind_info = pending_frame.create_unwind_info(frame_id)
captured_pending_frame = pending_frame
captured_pending_frame_repr = repr(pending_frame)
fid = FrameId(self._sp, self._pc)
- uw = pending_frame.create_unwind_info(fid)
+ uw = pending_frame.create_unwind_info(frame_id=fid)
uw.add_saved_register("rip", gdb.Value(0x123))
uw.add_saved_register("rbp", gdb.Value(0x456))
uw.add_saved_register("rsp", gdb.Value(0x789))