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 PyObject * arch_object_data_init (struct gdbarch *gdbarch)
 
struct gdbarcharch_object_to_gdbarch (PyObject *obj)
 
bool gdbpy_is_architecture (PyObject *obj)
 
PyObject * gdbarch_to_arch_object (struct gdbarch *gdbarch)
 
static PyObject * archpy_name (PyObject *self, PyObject *args)
 
static PyObject * archpy_disassemble (PyObject *self, PyObject *args, PyObject *kw)
 
static PyObject * archpy_registers (PyObject *self, PyObject *args, PyObject *kw)
 
static PyObject * archpy_register_groups (PyObject *self, PyObject *args)
 
static PyObject * archpy_integer_type (PyObject *self, PyObject *args, PyObject *kw)
 
PyObject * gdbpy_all_architecture_names (PyObject *self, PyObject *args)
 
int gdbpy_initialize_arch (void)
 

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.

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 gdbpy_format_address().

◆ 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

◆ CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF()

PyTypeObject arch_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ( "arch_object"  )

◆ 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 326 of file py-arch.c.

References gdbarch_printable_names(), and name.

◆ gdbpy_initialize_arch()

int gdbpy_initialize_arch ( void  )

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

References arch_object_type, gdb_module, and gdb_pymodule_addobject().

Referenced by do_start_initialization().

◆ 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(), and gdbpy_format_address().

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 358 of file py-arch.c.

◆ arch_object_type

PyTypeObject arch_object_type

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

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