GDB (xrefs)
Loading...
Searching...
No Matches
Classes | Macros | Functions | Variables
py-arch.c File Reference
#include "defs.h"
#include "gdbarch.h"
#include "arch-utils.h"
#include "disasm.h"
#include "python-internal.h"

Go to the source code of this file.

Classes

struct  arch_object
 

Macros

#define ARCHPY_REQUIRE_VALID(arch_obj, arch)
 

Functions

PyTypeObject arch_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("arch_object")
 
static PyObjectarch_object_data_init (struct gdbarch *gdbarch)
 
struct gdbarcharch_object_to_gdbarch (PyObject *obj)
 
bool gdbpy_is_architecture (PyObject *obj)
 
PyObjectgdbarch_to_arch_object (struct gdbarch *gdbarch)
 
static PyObjectarchpy_name (PyObject *self, PyObject *args)
 
static PyObjectarchpy_disassemble (PyObject *self, PyObject *args, PyObject *kw)
 
static PyObjectarchpy_registers (PyObject *self, PyObject *args, PyObject *kw)
 
static PyObjectarchpy_register_groups (PyObject *self, PyObject *args)
 
static PyObjectarchpy_integer_type (PyObject *self, PyObject *args, PyObject *kw)
 
static PyObjectarchpy_repr (PyObject *self)
 
PyObjectgdbpy_all_architecture_names (PyObject *self, PyObject *args)
 
static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION gdbpy_initialize_arch (void)
 
 GDBPY_INITIALIZE_FILE (gdbpy_initialize_arch)
 

Variables

static const registry< gdbarch >::key< PyObject, gdb::noop_deleter< PyObject > > arch_object_data
 
static PyMethodDef arch_object_methods []
 
PyTypeObject arch_object_type
 

Macro Definition Documentation

◆ ARCHPY_REQUIRE_VALID

#define ARCHPY_REQUIRE_VALID ( arch_obj,
arch )
Value:
do { \
arch = arch_object_to_gdbarch (arch_obj); \
if (arch == NULL) \
{ \
PyErr_SetString (PyExc_RuntimeError, \
_("Architecture is invalid.")); \
return NULL; \
} \
} while (0)
struct gdbarch * arch_object_to_gdbarch(PyObject *obj)
Definition py-arch.c:69

Definition at line 35 of file py-arch.c.

Referenced by archpy_disassemble(), archpy_integer_type(), archpy_name(), archpy_register_groups(), and archpy_registers().

Function Documentation

◆ arch_object_data_init()

static PyObject * arch_object_data_init ( struct gdbarch * gdbarch)
static

Definition at line 53 of file py-arch.c.

References arch_object_type, and arch_object::gdbarch.

Referenced by gdbarch_to_arch_object().

◆ arch_object_to_gdbarch()

struct gdbarch * arch_object_to_gdbarch ( PyObject * obj)

Definition at line 69 of file py-arch.c.

References arch_object::gdbarch, and gdbpy_is_architecture().

Referenced by archpy_repr().

◆ archpy_disassemble()

static PyObject * archpy_disassemble ( PyObject * self,
PyObject * args,
PyObject * kw )
static

◆ archpy_integer_type()

static PyObject * archpy_integer_type ( PyObject * self,
PyObject * args,
PyObject * kw )
static

◆ archpy_name()

static PyObject * archpy_name ( PyObject * self,
PyObject * args )
static

Definition at line 109 of file py-arch.c.

References ARCHPY_REQUIRE_VALID, gdbarch_bfd_arch_info(), and name.

◆ archpy_register_groups()

static PyObject * archpy_register_groups ( PyObject * self,
PyObject * args )
static

Definition at line 259 of file py-arch.c.

References ARCHPY_REQUIRE_VALID, and gdbpy_new_reggroup_iterator().

◆ archpy_registers()

static PyObject * archpy_registers ( PyObject * self,
PyObject * args,
PyObject * kw )
static

◆ archpy_repr()

static PyObject * archpy_repr ( PyObject * self)
static

Definition at line 325 of file py-arch.c.

References arch_object_to_gdbarch(), and gdbarch_bfd_arch_info().

◆ CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF()

PyTypeObject arch_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ( "arch_object" )
extern

◆ gdbarch_to_arch_object()

PyObject * gdbarch_to_arch_object ( struct gdbarch * gdbarch)

◆ gdbpy_all_architecture_names()

PyObject * gdbpy_all_architecture_names ( PyObject * self,
PyObject * args )

Definition at line 341 of file py-arch.c.

References gdbarch_printable_names(), and name.

◆ gdbpy_initialize_arch()

static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION gdbpy_initialize_arch ( void )
static

Definition at line 363 of file py-arch.c.

References arch_object_type, gdb_module, and gdb_pymodule_addobject().

◆ GDBPY_INITIALIZE_FILE()

GDBPY_INITIALIZE_FILE ( gdbpy_initialize_arch )

◆ gdbpy_is_architecture()

bool gdbpy_is_architecture ( PyObject * obj)

Definition at line 80 of file py-arch.c.

References arch_object_type.

Referenced by arch_object_to_gdbarch().

Variable Documentation

◆ arch_object_data

const registry<gdbarch>::key<PyObject, gdb::noop_deleter<PyObject> > arch_object_data
static

Definition at line 32 of file py-arch.c.

Referenced by gdbarch_to_arch_object().

◆ arch_object_methods

PyMethodDef arch_object_methods[]
static
Initial value:
= {
{ "name", archpy_name, METH_NOARGS,
"name () -> String.\n\
Return the name of the architecture as a string value." },
{ "disassemble", (PyCFunction) archpy_disassemble,
METH_VARARGS | METH_KEYWORDS,
"disassemble (start_pc [, end_pc [, count]]) -> List.\n\
Return a list of at most COUNT disassembled instructions from START_PC to\n\
END_PC." },
{ "integer_type", (PyCFunction) archpy_integer_type,
METH_VARARGS | METH_KEYWORDS,
"integer_type (size [, signed]) -> type\n\
Return an integer Type corresponding to the given bitsize and signed-ness.\n\
If not specified, the type defaults to signed." },
{ "registers", (PyCFunction) archpy_registers,
METH_VARARGS | METH_KEYWORDS,
"registers ([ group-name ]) -> Iterator.\n\
Return an iterator of register descriptors for the registers in register\n\
group GROUP-NAME." },
{ "register_groups", archpy_register_groups,
METH_NOARGS,
"register_groups () -> Iterator.\n\
Return an iterator over all of the register groups in this architecture." },
{NULL}
}
static PyObject * archpy_register_groups(PyObject *self, PyObject *args)
Definition py-arch.c:259
static PyObject * archpy_name(PyObject *self, PyObject *args)
Definition py-arch.c:109
static PyObject * archpy_disassemble(PyObject *self, PyObject *args, PyObject *kw)
Definition py-arch.c:127
static PyObject * archpy_registers(PyObject *self, PyObject *args, PyObject *kw)
Definition py-arch.c:237
static PyObject * archpy_integer_type(PyObject *self, PyObject *args, PyObject *kw)
Definition py-arch.c:270

Definition at line 377 of file py-arch.c.

◆ arch_object_type

PyTypeObject arch_object_type

Definition at line 403 of file py-arch.c.

Referenced by arch_object_data_init(), gdbpy_initialize_arch(), and gdbpy_is_architecture().