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

Go to the source code of this file.

Classes

struct  arch_object_type_object
 

Macros

#define ARCHPY_REQUIRE_VALID(arch_obj, arch)
 

Typedefs

typedef struct arch_object_type_object arch_object
 

Functions

PyTypeObject arch_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("arch_object")
 
static void * arch_object_data_init (struct gdbarch *gdbarch)
 
struct gdbarcharch_object_to_gdbarch (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)
 
int gdbpy_initialize_arch (void)
 

Variables

static struct gdbarch_dataarch_object_data = NULL
 
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
#define _(String)
Definition: gdb_locale.h:35

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

Referenced by archpy_disassemble(), and archpy_name().

Typedef Documentation

◆ arch_object

Function Documentation

◆ arch_object_data_init()

static void* arch_object_data_init ( struct gdbarch gdbarch)
static

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

References arch_object_type, and arch_object_type_object::gdbarch.

Referenced by gdbpy_initialize_arch().

◆ arch_object_to_gdbarch()

struct gdbarch* arch_object_to_gdbarch ( PyObject *  obj)

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

References arch_object_type_object::gdbarch.

◆ archpy_disassemble()

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

◆ archpy_name()

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

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

References ARCHPY_REQUIRE_VALID, gdbarch_bfd_arch_info(), and name.

◆ 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)

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

References arch_object_data.

Referenced by frapy_arch().

◆ gdbpy_initialize_arch()

int gdbpy_initialize_arch ( void  )

Variable Documentation

◆ arch_object_data

struct gdbarch_data* arch_object_data = NULL
static

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

Referenced by gdbarch_to_arch_object(), and gdbpy_initialize_arch().

◆ 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." },
{NULL}
}
static PyObject * archpy_disassemble(PyObject *self, PyObject *args, PyObject *kw)
Definition: py-arch.c:117
static PyObject * archpy_name(PyObject *self, PyObject *args)
Definition: py-arch.c:96

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

◆ arch_object_type

PyTypeObject arch_object_type

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

Referenced by arch_object_data_init(), and gdbpy_initialize_arch().