Add a new class gdb.Architecture which exposes GDB's
internal representation of architecture via GDB Python API. * Makefile.in: Add entries corresponding to the new file python/py-arch.c. * NEWS (Python Scripting): Add entries for the new class gdb.Architecture and the new method gdb.Frame.architecture. * python/py-arch.c: Implement gdb.Architecture class. * python/py-frame.c (frapy_arch): Implement the method gdb.Frame.architecture(). (frame_object_methods): Add 'architecture' to the method table. * python/python-internal.h: Add declarations of new utility functions. * python/python.c (_initialize_python): Initialize gdb.Architecture class. * doc/gdb.texinfo (Architectures In Python): New sub-sub-section describing the gdb.Architecture class. (Frames In Python): Add description about the new method gdb.Frame.architecture(). * testsuite/gdb.python/frame.exp: Add a test for gdb.Frame.architecture() method.
This commit is contained in:
parent
796a7ff823
commit
bea883fd92
11 changed files with 241 additions and 0 deletions
|
@ -167,6 +167,25 @@ frapy_type (PyObject *self, PyObject *args)
|
|||
return PyInt_FromLong (type);
|
||||
}
|
||||
|
||||
/* Implementation of gdb.Frame.architecture (self) -> gdb.Architecture.
|
||||
Returns the frame's architecture as a gdb.Architecture object. */
|
||||
|
||||
static PyObject *
|
||||
frapy_arch (PyObject *self, PyObject *args)
|
||||
{
|
||||
struct frame_info *frame = NULL; /* Initialize to appease gcc warning. */
|
||||
frame_object *obj = (frame_object *) self;
|
||||
volatile struct gdb_exception except;
|
||||
|
||||
TRY_CATCH (except, RETURN_MASK_ALL)
|
||||
{
|
||||
FRAPY_REQUIRE_VALID (self, frame);
|
||||
}
|
||||
GDB_PY_HANDLE_EXCEPTION (except);
|
||||
|
||||
return gdbarch_to_arch_object (obj->gdbarch);
|
||||
}
|
||||
|
||||
/* Implementation of gdb.Frame.unwind_stop_reason (self) -> Integer.
|
||||
Returns one of the gdb.FRAME_UNWIND_* constants. */
|
||||
|
||||
|
@ -632,6 +651,9 @@ Return the function name of the frame, or None if it can't be determined." },
|
|||
{ "type", frapy_type, METH_NOARGS,
|
||||
"type () -> Integer.\n\
|
||||
Return the type of the frame." },
|
||||
{ "architecture", frapy_arch, METH_NOARGS,
|
||||
"architecture () -> gdb.Architecture.\n\
|
||||
Return the architecture of the frame." },
|
||||
{ "unwind_stop_reason", frapy_unwind_stop_reason, METH_NOARGS,
|
||||
"unwind_stop_reason () -> Integer.\n\
|
||||
Return the reason why it's not possible to find frames older than this." },
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue