GDB (xrefs)
Classes | Defines | Functions | Variables
/home/stan/gdb/src/gdb/python/py-inferior.c File Reference
#include "defs.h"
#include "exceptions.h"
#include "gdbcore.h"
#include "gdbthread.h"
#include "inferior.h"
#include "objfiles.h"
#include "observer.h"
#include "python-internal.h"
#include "arch-utils.h"
#include "language.h"
#include "gdb_signals.h"
#include "py-event.h"
#include "py-stopevent.h"

Go to the source code of this file.

Classes

struct  threadlist_entry
struct  inferior_object
struct  membuf_object

Defines

#define INFPY_REQUIRE_VALID(Inferior)
#define CHARBUFFERPROC_NAME   charbufferproc

Functions

static PyTypeObject
inferior_object_type 
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("inferior_object")
static PyTypeObject
membuf_object_type 
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("membuf_object")
static void python_on_normal_stop (struct bpstats *bs, int print_frame)
static void python_on_resume (ptid_t ptid)
static void python_inferior_exit (struct inferior *inf)
static void python_new_objfile (struct objfile *objfile)
PyObjectinferior_to_inferior_object (struct inferior *inferior)
PyObjectfind_inferior_object (int pid)
thread_objectfind_thread_object (ptid_t ptid)
static void add_thread_object (struct thread_info *tp)
static void delete_thread_object (struct thread_info *tp, int ignore)
static PyObjectinfpy_threads (PyObject *self, PyObject *args)
static PyObjectinfpy_get_num (PyObject *self, void *closure)
static PyObjectinfpy_get_pid (PyObject *self, void *closure)
static PyObjectinfpy_get_was_attached (PyObject *self, void *closure)
static int build_inferior_list (struct inferior *inf, void *arg)
PyObjectgdbpy_inferiors (PyObject *unused, PyObject *unused2)
static PyObjectinfpy_read_memory (PyObject *self, PyObject *args, PyObject *kw)
static PyObjectinfpy_write_memory (PyObject *self, PyObject *args, PyObject *kw)
static void mbpy_dealloc (PyObject *self)
static PyObjectmbpy_str (PyObject *self)
static Py_ssize_t get_read_buffer (PyObject *self, Py_ssize_t segment, void **ptrptr)
static Py_ssize_t get_write_buffer (PyObject *self, Py_ssize_t segment, void **ptrptr)
static Py_ssize_t get_seg_count (PyObject *self, Py_ssize_t *lenp)
static Py_ssize_t get_char_buffer (PyObject *self, Py_ssize_t segment, char **ptrptr)
static PyObjectinfpy_search_memory (PyObject *self, PyObject *args, PyObject *kw)
static PyObjectinfpy_is_valid (PyObject *self, PyObject *args)
static void infpy_dealloc (PyObject *obj)
static void py_free_inferior (struct inferior *inf, void *datum)
PyObjectgdbpy_selected_inferior (PyObject *self, PyObject *args)
int gdbpy_initialize_inferior (void)

Variables

static struct inferior_data * infpy_inf_data_key
static PyGetSetDef inferior_object_getset []
static PyMethodDef inferior_object_methods []
static PyTypeObject inferior_object_type
static PyBufferProcs buffer_procs
static PyTypeObject membuf_object_type

Define Documentation

#define CHARBUFFERPROC_NAME   charbufferproc

Definition at line 894 of file py-inferior.c.

#define INFPY_REQUIRE_VALID (   Inferior)
Value:
do {                                                            \
    if (!Inferior->inferior)                                    \
      {                                                         \
        PyErr_SetString (PyExc_RuntimeError,                    \
                         _("Inferior no longer exists."));      \
        return NULL;                                            \
      }                                                         \
  } while (0)

Definition at line 72 of file py-inferior.c.

Referenced by infpy_get_num(), infpy_get_pid(), infpy_get_was_attached(), and infpy_threads().


Function Documentation

static void add_thread_object ( struct thread_info tp) [static]
static int build_inferior_list ( struct inferior inf,
void *  arg 
) [static]

Definition at line 378 of file py-inferior.c.

References inferior_to_inferior_object(), and Py_DECREF.

Referenced by gdbpy_inferiors().

static PyTypeObject inferior_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ( "inferior_object"  ) [static]
static PyTypeObject membuf_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ( "membuf_object"  ) [static]
static void delete_thread_object ( struct thread_info tp,
int  ignore 
) [static]
PyObject* gdbpy_inferiors ( PyObject unused,
PyObject unused2 
)

Definition at line 399 of file py-inferior.c.

References build_inferior_list(), iterate_over_inferiors(), and Py_DECREF.

Definition at line 775 of file py-inferior.c.

References current_inferior(), and inferior_to_inferior_object().

static Py_ssize_t get_char_buffer ( PyObject self,
Py_ssize_t  segment,
char **  ptrptr 
) [static]

Definition at line 606 of file py-inferior.c.

References get_read_buffer().

static Py_ssize_t get_read_buffer ( PyObject self,
Py_ssize_t  segment,
void **  ptrptr 
) [static]

Definition at line 574 of file py-inferior.c.

References _, membuf_object::buffer, and membuf_object::length.

Referenced by get_char_buffer(), and get_write_buffer().

static Py_ssize_t get_seg_count ( PyObject self,
Py_ssize_t *  lenp 
) [static]

Definition at line 597 of file py-inferior.c.

static Py_ssize_t get_write_buffer ( PyObject self,
Py_ssize_t  segment,
void **  ptrptr 
) [static]

Definition at line 591 of file py-inferior.c.

References get_read_buffer().

static void infpy_dealloc ( PyObject obj) [static]

Definition at line 727 of file py-inferior.c.

References inferior_object::inferior, and infpy_inf_data_key.

static PyObject* infpy_get_num ( PyObject self,
void *  closure 
) [static]

Definition at line 347 of file py-inferior.c.

References inferior_object::inferior, INFPY_REQUIRE_VALID, and inferior::num.

static PyObject* infpy_get_pid ( PyObject self,
void *  closure 
) [static]

Definition at line 357 of file py-inferior.c.

References inferior_object::inferior, INFPY_REQUIRE_VALID, and inferior::pid.

static PyObject* infpy_get_was_attached ( PyObject self,
void *  closure 
) [static]
static PyObject* infpy_is_valid ( PyObject self,
PyObject args 
) [static]

Definition at line 716 of file py-inferior.c.

References inferior_object::inferior.

static PyObject* infpy_read_memory ( PyObject self,
PyObject args,
PyObject kw 
) [static]
static PyObject* infpy_search_memory ( PyObject self,
PyObject args,
PyObject kw 
) [static]
static PyObject* infpy_threads ( PyObject self,
PyObject args 
) [static]
static PyObject* infpy_write_memory ( PyObject self,
PyObject args,
PyObject kw 
) [static]
static void mbpy_dealloc ( PyObject self) [static]

Definition at line 537 of file py-inferior.c.

References xfree().

static PyObject* mbpy_str ( PyObject self) [static]
static void py_free_inferior ( struct inferior inf,
void *  datum 
) [static]
static void python_inferior_exit ( struct inferior inf) [static]
static void python_new_objfile ( struct objfile objfile) [static]
static void python_on_normal_stop ( struct bpstats bs,
int  print_frame 
) [static]
static void python_on_resume ( ptid_t  ptid) [static]

Variable Documentation

PyBufferProcs buffer_procs [static]
PyGetSetDef inferior_object_getset[] [static]
Initial value:
{
  { "num", infpy_get_num, NULL, "ID of inferior, as assigned by GDB.", NULL },
  { "pid", infpy_get_pid, NULL, "PID of inferior, as assigned by the OS.",
    NULL },
  { "was_attached", infpy_get_was_attached, NULL,
    "True if the inferior was created using 'attach'.", NULL },
  { NULL }
}

Definition at line 808 of file py-inferior.c.

PyMethodDef inferior_object_methods[] [static]
Initial value:
{
  { "is_valid", infpy_is_valid, METH_NOARGS,
    "is_valid () -> Boolean.\n\
Return true if this inferior is valid, false if not." },
  { "threads", infpy_threads, METH_NOARGS,
    "Return all the threads of this inferior." },
  { "read_memory", (PyCFunction) infpy_read_memory,
    METH_VARARGS | METH_KEYWORDS,
    "read_memory (address, length) -> buffer\n\
Return a buffer object for reading from the inferior's memory." },
  { "write_memory", (PyCFunction) infpy_write_memory,
    METH_VARARGS | METH_KEYWORDS,
    "write_memory (address, buffer [, length])\n\
Write the given buffer object to the inferior's memory." },
  { "search_memory", (PyCFunction) infpy_search_memory,
    METH_VARARGS | METH_KEYWORDS,
    "search_memory (address, length, pattern) -> long\n\
Return a long with the address of a match, or None." },
  { NULL }
}

Definition at line 818 of file py-inferior.c.

PyTypeObject inferior_object_type [static]

Definition at line 840 of file py-inferior.c.

Referenced by gdbpy_initialize_inferior(), and inferior_to_inferior_object().

struct inferior_data* infpy_inf_data_key [static]
PyTypeObject membuf_object_type [static]

Definition at line 907 of file py-inferior.c.

Referenced by gdbpy_initialize_inferior(), and infpy_read_memory().

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines