78 object->pspace = NULL;
86#define PSPY_REQUIRE_VALID(pspace_obj) \
88 if (pspace_obj->pspace == nullptr) \
90 PyErr_SetString (PyExc_RuntimeError, \
91 _("Program space no longer exists.")); \
119 Py_XDECREF (ps_self->
dict);
125 Py_TYPE (self)->tp_free (self);
136 self->
dict = PyDict_New ();
137 if (self->
dict == NULL)
174 return (PyObject *) self.release ();
193 PyErr_SetString (PyExc_TypeError,
194 "cannot delete the pretty_printers attribute");
198 if (! PyList_Check (
value))
200 PyErr_SetString (PyExc_TypeError,
201 "the pretty_printers attribute must be a list");
232 PyErr_SetString (PyExc_TypeError,
233 "cannot delete the frame filter attribute");
237 if (! PyDict_Check (frame))
239 PyErr_SetString (PyExc_TypeError,
240 "the frame filter attribute must be a dictionary");
272 PyErr_SetString (PyExc_TypeError,
273 "cannot delete the frame unwinders list");
277 if (!PyList_Check (unwinders))
279 PyErr_SetString (PyExc_TypeError,
280 "the frame unwinders attribute must be a list");
286 Py_INCREF (unwinders);
323 PyErr_SetString (PyExc_TypeError,
324 "cannot delete the type_printers attribute");
328 if (! PyList_Check (
value))
330 PyErr_SetString (PyExc_TypeError,
331 "the type_printers attribute must be a list");
363 || PyList_Append (list.get (), item.get ()) == -1)
368 return list.release ();
384 if (!PyArg_ParseTuple (args,
"O", &pc_obj))
390 if (soname ==
nullptr)
408 if (!PyArg_ParseTuple (args,
"O", &pc_obj))
420 if (cust != NULL && cust->
objfile () != NULL)
423 catch (
const gdb_exception &except)
428 if (cust == NULL || cust->
objfile () == NULL)
444 PyObject *result = NULL;
450 if (!PyArg_ParseTuple (args,
"O", &pc_obj))
465 catch (
const gdb_exception &except)
509 result = (PyObject *)
object.release ();
549 "The progspace's main filename, or None.", NULL },
551 "Pretty printers.", NULL },
553 "Frame filters.", NULL },
555 "Frame unwinders.", NULL },
557 "Type printers.", NULL },
559 "Debug methods.", NULL },
566 "Return a sequence of objfiles associated to this program space." },
568 "solib_name (Long) -> String.\n\
569Return the name of the shared library holding a given address, or None." },
571 "Return the block containing the given pc value, or None." },
573 "find_pc_line (pc) -> Symtab_and_line.\n\
574Return the gdb.Symtab_and_line object corresponding to the pc value." },
576 "is_valid () -> Boolean.\n\
577Return true if this program space is valid, false if not." },
583 PyVarObject_HEAD_INIT (NULL, 0)
603 "GDB progspace object",
constexpr string_view get()
struct gdbarch * target_gdbarch(void)
const struct block * block_for_pc(CORE_ADDR pc)
void set(unsigned key, void *datum)
const char * objfile_name(const struct objfile *objfile)
void set_current_program_space(struct program_space *pspace)
PyObject * block_to_block_object(const struct block *block, struct objfile *objfile)
gdbpy_ref objfile_to_objfile_object(struct objfile *objfile)
PyTypeObject pspace_object_type
bool gdbpy_is_progspace(PyObject *obj)
static const registry< program_space >::key< pspace_object, pspace_deleter > pspy_pspace_data_key
static PyObject * pspy_is_valid(PyObject *o, PyObject *args)
static int pspy_set_frame_filters(PyObject *o, PyObject *frame, void *ignore)
static PyObject * pspy_get_objfiles(PyObject *self_, PyObject *args)
static PyObject * pspy_get_filename(PyObject *self, void *closure)
static int pspy_set_type_printers(PyObject *o, PyObject *value, void *ignore)
static PyObject * pspy_new(PyTypeObject *type, PyObject *args, PyObject *keywords)
static PyObject * pspy_find_pc_line(PyObject *o, PyObject *args)
static PyObject * pspy_solib_name(PyObject *o, PyObject *args)
static gdb_PyGetSetDef pspace_getset[]
PyObject * pspy_get_xmethods(PyObject *o, void *ignore)
static PyObject * pspy_block_for_pc(PyObject *o, PyObject *args)
static int pspy_set_frame_unwinders(PyObject *o, PyObject *unwinders, void *ignore)
static PyObject * pspy_get_type_printers(PyObject *o, void *ignore)
#define PSPY_REQUIRE_VALID(pspace_obj)
gdbpy_ref pspace_to_pspace_object(struct program_space *pspace)
static void pspy_dealloc(PyObject *self)
struct program_space * progspace_object_to_program_space(PyObject *obj)
static int pspy_set_printers(PyObject *o, PyObject *value, void *ignore)
int gdbpy_initialize_pspace(void)
static int pspy_initialize(pspace_object *self)
PyObject * pspy_get_printers(PyObject *o, void *ignore)
PyObject * pspy_get_frame_filters(PyObject *o, void *ignore)
static PyMethodDef progspace_object_methods[]
PyObject * pspy_get_frame_unwinders(PyObject *o, void *ignore)
gdb::ref_ptr< T, gdbpy_ref_policy< T > > gdbpy_ref
PyObject * symtab_and_line_to_sal_object(struct symtab_and_line sal)
gdbpy_ref host_string_to_python_string(const char *str)
int get_addr_from_python(PyObject *obj, CORE_ADDR *addr)
int gdb_pymodule_addobject(PyObject *module, const char *name, PyObject *object)
PyObject * gdb_py_generic_dict(PyObject *self, void *closure)
#define CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF(ARG)
#define GDB_PY_HANDLE_EXCEPTION(Exception)
const char * solib_name_from_address(struct program_space *pspace, CORE_ADDR address)
struct objfile * objfile() const
objfiles_range objfiles()
struct objfile * symfile_object_file
void operator()(pspace_object *obj)
PyObject * frame_unwinders
PyObject_HEAD struct program_space * pspace
struct program_space * pspace
struct compunit_symtab * find_pc_compunit_symtab(CORE_ADDR pc)
struct symtab_and_line find_pc_line(CORE_ADDR pc, int notcurrent)