80 object->pspace = NULL;
88#define PSPY_REQUIRE_VALID(pspace_obj) \
90 if (pspace_obj->pspace == nullptr) \
92 PyErr_SetString (PyExc_RuntimeError, \
93 _("Program space no longer exists.")); \
149 if (filename !=
nullptr)
160 Py_XDECREF (ps_self->
dict);
166 Py_TYPE (self)->tp_free (self);
177 self->
dict = PyDict_New ();
178 if (self->
dict == NULL)
215 return (
PyObject *) self.release ();
234 PyErr_SetString (PyExc_TypeError,
235 "cannot delete the pretty_printers attribute");
239 if (! PyList_Check (
value))
241 PyErr_SetString (PyExc_TypeError,
242 "the pretty_printers attribute must be a list");
273 PyErr_SetString (PyExc_TypeError,
274 "cannot delete the frame filter attribute");
278 if (! PyDict_Check (frame))
280 PyErr_SetString (PyExc_TypeError,
281 "the frame filter attribute must be a dictionary");
313 PyErr_SetString (PyExc_TypeError,
314 "cannot delete the frame unwinders list");
318 if (!PyList_Check (unwinders))
320 PyErr_SetString (PyExc_TypeError,
321 "the frame unwinders attribute must be a list");
327 Py_INCREF (unwinders);
364 PyErr_SetString (PyExc_TypeError,
365 "cannot delete the type_printers attribute");
369 if (! PyList_Check (
value))
371 PyErr_SetString (PyExc_TypeError,
372 "the type_printers attribute must be a list");
404 || PyList_Append (list.get (), item.get ()) == -1)
409 return list.release ();
425 if (!PyArg_ParseTuple (args,
"O", &pc_obj))
431 if (soname ==
nullptr)
448 if (!PyArg_ParseTuple (args,
"O", &addr_obj))
473 if (!PyArg_ParseTuple (args,
"O", &pc_obj))
485 if (cust != NULL && cust->
objfile () != NULL)
488 catch (
const gdb_exception &except)
493 if (cust == NULL || cust->
objfile () == NULL)
515 if (!PyArg_ParseTuple (args,
"O", &pc_obj))
530 catch (
const gdb_exception &except)
574 result = (
PyObject *)
object.release ();
609 if (event_obj ==
nullptr)
613 if (py_pspace ==
nullptr
615 py_pspace.get ()) < 0)
618 gdbpy_ref<> py_reload_p (PyBool_FromLong (reload_p ? 1 : 0));
619 if (py_reload_p ==
nullptr
621 py_reload_p.get ()) < 0)
642 pspace, reload_p) < 0)
658 PyTypeObject *event_type;
662 event_type = &new_progspace_event_object_type;
667 event_type = &free_progspace_event_object_type;
674 if (pspace_obj ==
nullptr)
683 pspace_obj.get ()) < 0
731 "The filename of the progspace's main symbol file, or None.",
nullptr },
733 "The gdb.Objfile for the progspace's main symbol file, or None.",
736 "The filename for the progspace's executable, or None.",
nullptr},
738 "Pretty printers.", NULL },
740 "Frame filters.", NULL },
742 "Frame unwinders.", NULL },
744 "Type printers.", NULL },
746 "Debug methods.", NULL },
753 "Return a sequence of objfiles associated to this program space." },
755 "solib_name (Long) -> String.\n\
756Return the name of the shared library holding a given address, or None." },
758 "objfile_for_address (int) -> gdb.Objfile\n\
759Return the objfile containing the given address, or None." },
761 "Return the block containing the given pc value, or None." },
763 "find_pc_line (pc) -> Symtab_and_line.\n\
764Return the gdb.Symtab_and_line object corresponding to the pc value." },
766 "is_valid () -> Boolean.\n\
767Return true if this program space is valid, false if not." },
773 PyVarObject_HEAD_INIT (NULL, 0)
793 "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)
observable< program_space * > new_program_space
observable< struct program_space *, bool > executable_changed
observable< program_space * > free_program_space
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 create_event_object(PyTypeObject *py_type)
int evpy_add_attribute(PyObject *event, const char *name, PyObject *attr)
int evpy_emit_event(PyObject *event, eventregistry_object *registry)
events_object gdb_py_events
bool evregpy_no_listeners_p(eventregistry_object *registry)
gdbpy_ref objfile_to_objfile_object(struct objfile *objfile)
PyTypeObject pspace_object_type
bool gdbpy_is_progspace(PyObject *obj)
static PyObject * pspy_get_symbol_file(PyObject *self, void *closure)
static const registry< program_space >::key< pspace_object, pspace_deleter > pspy_pspace_data_key
static int emit_executable_changed_event(eventregistry_object *registry, struct program_space *pspace, bool reload_p)
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 void gdbpy_new_program_space_event(program_space *pspace)
static gdb_PyGetSetDef pspace_getset[]
PyObject * pspy_get_xmethods(PyObject *o, void *ignore)
static PyObject * pspy_block_for_pc(PyObject *o, PyObject *args)
static void gdbpy_executable_changed(struct program_space *pspace, bool reload_p)
static int pspy_set_frame_unwinders(PyObject *o, PyObject *unwinders, void *ignore)
static PyObject * pspy_get_type_printers(PyObject *o, void *ignore)
static void gdbpy_program_space_event(program_space *pspace, bool adding_p)
#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 PyObject * pspy_get_exec_file(PyObject *self, void *closure)
static int pspy_set_printers(PyObject *o, PyObject *value, void *ignore)
static void gdbpy_free_program_space_event(program_space *pspace)
static int pspy_initialize(pspace_object *self)
PyObject * pspy_get_printers(PyObject *o, void *ignore)
static PyObject * pspy_objfile_for_address(PyObject *o, PyObject *args)
static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION gdbpy_initialize_pspace(void)
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)
void gdbpy_print_stack(void)
int gdb_python_initialized
#define CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF(ARG)
#define CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
#define GDBPY_INITIALIZE_FILE(INIT,...)
#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 * objfile_for_address(CORE_ADDR address)
gdb::unique_xmalloc_ptr< char > exec_filename
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)