GDB (xrefs)
Loading...
Searching...
No Matches
py-progspace.c
Go to the documentation of this file.
1/* Python interface to program spaces.
2
3 Copyright (C) 2010-2023 Free Software Foundation, Inc.
4
5 This file is part of GDB.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19
20#include "defs.h"
21#include "python-internal.h"
22#include "charset.h"
23#include "progspace.h"
24#include "objfiles.h"
25#include "language.h"
26#include "arch-utils.h"
27#include "solib.h"
28#include "block.h"
29#include "py-event.h"
30#include "observable.h"
31
33{
34 PyObject_HEAD
35
36 /* The corresponding pspace. */
38
39 /* Dictionary holding user-added attributes.
40 This is the __dict__ attribute of the object. */
42
43 /* The pretty-printer list of functions. */
45
46 /* The frame filter list of functions. */
48
49 /* The frame unwinder list. */
51
52 /* The type-printer list. */
54
55 /* The debug method list. */
57};
58
59extern PyTypeObject pspace_object_type
61
62/* Clear the PSPACE pointer in a Pspace object and remove the reference. */
64{
66 {
67 /* This is a fiction, but we're in a nasty spot: The pspace is in the
68 process of being deleted, we can't rely on anything in it. Plus
69 this is one time when the current program space and current inferior
70 are not in sync: All inferiors that use PSPACE may no longer exist.
71 We don't need to do much here, and since "there is always an inferior"
72 using target_gdbarch suffices.
73 Note: We cannot call get_current_arch because it may try to access
74 the target, which may involve accessing data in the pspace currently
75 being deleted. */
76 struct gdbarch *arch = target_gdbarch ();
77
78 gdbpy_enter enter_py (arch);
79 gdbpy_ref<pspace_object> object (obj);
80 object->pspace = NULL;
81 }
82};
83
86
87/* Require that PSPACE_OBJ be a valid program space ID. */
88#define PSPY_REQUIRE_VALID(pspace_obj) \
89 do { \
90 if (pspace_obj->pspace == nullptr) \
91 { \
92 PyErr_SetString (PyExc_RuntimeError, \
93 _("Program space no longer exists.")); \
94 return NULL; \
95 } \
96 } while (0)
97
98/* An Objfile method which returns the objfile's file name, or None. */
99
100static PyObject *
101pspy_get_filename (PyObject *self, void *closure)
102{
103 pspace_object *obj = (pspace_object *) self;
104
105 if (obj->pspace)
106 {
108
109 if (objfile)
111 .release ());
112 }
113 Py_RETURN_NONE;
114}
115
116/* Implement the gdb.Progspace.symbol_file attribute. Retun the
117 gdb.Objfile corresponding to the currently loaded symbol-file, or None
118 if no symbol-file is loaded. If the Progspace is invalid then raise an
119 exception. */
120
121static PyObject *
122pspy_get_symbol_file (PyObject *self, void *closure)
123{
124 pspace_object *obj = (pspace_object *) self;
125
126 PSPY_REQUIRE_VALID (obj);
127
129
130 if (objfile != nullptr)
131 return objfile_to_objfile_object (objfile).release ();
132
133 Py_RETURN_NONE;
134}
135
136/* Implement the gdb.Progspace.executable_filename attribute. Retun a
137 string containing the name of the current executable, or None if no
138 executable is currently set. If the Progspace is invalid then raise an
139 exception. */
140
141static PyObject *
142pspy_get_exec_file (PyObject *self, void *closure)
143{
144 pspace_object *obj = (pspace_object *) self;
145
146 PSPY_REQUIRE_VALID (obj);
147
148 const char *filename = obj->pspace->exec_filename.get ();
149 if (filename != nullptr)
150 return host_string_to_python_string (filename).release ();
151
152 Py_RETURN_NONE;
153}
154
155static void
157{
158 pspace_object *ps_self = (pspace_object *) self;
159
160 Py_XDECREF (ps_self->dict);
161 Py_XDECREF (ps_self->printers);
162 Py_XDECREF (ps_self->frame_filters);
163 Py_XDECREF (ps_self->frame_unwinders);
164 Py_XDECREF (ps_self->type_printers);
165 Py_XDECREF (ps_self->xmethods);
166 Py_TYPE (self)->tp_free (self);
167}
168
169/* Initialize a pspace_object.
170 The result is a boolean indicating success. */
171
172static int
174{
175 self->pspace = NULL;
176
177 self->dict = PyDict_New ();
178 if (self->dict == NULL)
179 return 0;
180
181 self->printers = PyList_New (0);
182 if (self->printers == NULL)
183 return 0;
184
185 self->frame_filters = PyDict_New ();
186 if (self->frame_filters == NULL)
187 return 0;
188
189 self->frame_unwinders = PyList_New (0);
190 if (self->frame_unwinders == NULL)
191 return 0;
192
193 self->type_printers = PyList_New (0);
194 if (self->type_printers == NULL)
195 return 0;
196
197 self->xmethods = PyList_New (0);
198 if (self->xmethods == NULL)
199 return 0;
200
201 return 1;
202}
203
204static PyObject *
205pspy_new (PyTypeObject *type, PyObject *args, PyObject *keywords)
206{
207 gdbpy_ref<pspace_object> self ((pspace_object *) type->tp_alloc (type, 0));
208
209 if (self != NULL)
210 {
211 if (!pspy_initialize (self.get ()))
212 return NULL;
213 }
214
215 return (PyObject *) self.release ();
216}
217
218PyObject *
219pspy_get_printers (PyObject *o, void *ignore)
220{
221 pspace_object *self = (pspace_object *) o;
222
223 Py_INCREF (self->printers);
224 return self->printers;
225}
226
227static int
229{
230 pspace_object *self = (pspace_object *) o;
231
232 if (! value)
233 {
234 PyErr_SetString (PyExc_TypeError,
235 "cannot delete the pretty_printers attribute");
236 return -1;
237 }
238
239 if (! PyList_Check (value))
240 {
241 PyErr_SetString (PyExc_TypeError,
242 "the pretty_printers attribute must be a list");
243 return -1;
244 }
245
246 /* Take care in case the LHS and RHS are related somehow. */
247 gdbpy_ref<> tmp (self->printers);
248 Py_INCREF (value);
249 self->printers = value;
250
251 return 0;
252}
253
254/* Return the Python dictionary attribute containing frame filters for
255 this program space. */
256PyObject *
258{
259 pspace_object *self = (pspace_object *) o;
260
261 Py_INCREF (self->frame_filters);
262 return self->frame_filters;
263}
264
265/* Set this object file's frame filters dictionary to FILTERS. */
266static int
267pspy_set_frame_filters (PyObject *o, PyObject *frame, void *ignore)
268{
269 pspace_object *self = (pspace_object *) o;
270
271 if (! frame)
272 {
273 PyErr_SetString (PyExc_TypeError,
274 "cannot delete the frame filter attribute");
275 return -1;
276 }
277
278 if (! PyDict_Check (frame))
279 {
280 PyErr_SetString (PyExc_TypeError,
281 "the frame filter attribute must be a dictionary");
282 return -1;
283 }
284
285 /* Take care in case the LHS and RHS are related somehow. */
286 gdbpy_ref<> tmp (self->frame_filters);
287 Py_INCREF (frame);
288 self->frame_filters = frame;
289
290 return 0;
291}
292
293/* Return the list of the frame unwinders for this program space. */
294
295PyObject *
297{
298 pspace_object *self = (pspace_object *) o;
299
300 Py_INCREF (self->frame_unwinders);
301 return self->frame_unwinders;
302}
303
304/* Set this program space's list of the unwinders to UNWINDERS. */
305
306static int
307pspy_set_frame_unwinders (PyObject *o, PyObject *unwinders, void *ignore)
308{
309 pspace_object *self = (pspace_object *) o;
310
311 if (!unwinders)
312 {
313 PyErr_SetString (PyExc_TypeError,
314 "cannot delete the frame unwinders list");
315 return -1;
316 }
317
318 if (!PyList_Check (unwinders))
319 {
320 PyErr_SetString (PyExc_TypeError,
321 "the frame unwinders attribute must be a list");
322 return -1;
323 }
324
325 /* Take care in case the LHS and RHS are related somehow. */
326 gdbpy_ref<> tmp (self->frame_unwinders);
327 Py_INCREF (unwinders);
328 self->frame_unwinders = unwinders;
329
330 return 0;
331}
332
333/* Get the 'type_printers' attribute. */
334
335static PyObject *
337{
338 pspace_object *self = (pspace_object *) o;
339
340 Py_INCREF (self->type_printers);
341 return self->type_printers;
342}
343
344/* Get the 'xmethods' attribute. */
345
346PyObject *
347pspy_get_xmethods (PyObject *o, void *ignore)
348{
349 pspace_object *self = (pspace_object *) o;
350
351 Py_INCREF (self->xmethods);
352 return self->xmethods;
353}
354
355/* Set the 'type_printers' attribute. */
356
357static int
359{
360 pspace_object *self = (pspace_object *) o;
361
362 if (! value)
363 {
364 PyErr_SetString (PyExc_TypeError,
365 "cannot delete the type_printers attribute");
366 return -1;
367 }
368
369 if (! PyList_Check (value))
370 {
371 PyErr_SetString (PyExc_TypeError,
372 "the type_printers attribute must be a list");
373 return -1;
374 }
375
376 /* Take care in case the LHS and RHS are related somehow. */
377 gdbpy_ref<> tmp (self->type_printers);
378 Py_INCREF (value);
379 self->type_printers = value;
380
381 return 0;
382}
383
384/* Implement the objfiles method. */
385
386static PyObject *
388{
389 pspace_object *self = (pspace_object *) self_;
390
391 PSPY_REQUIRE_VALID (self);
392
393 gdbpy_ref<> list (PyList_New (0));
394 if (list == NULL)
395 return NULL;
396
397 if (self->pspace != NULL)
398 {
399 for (objfile *objf : self->pspace->objfiles ())
400 {
402
403 if (item == nullptr
404 || PyList_Append (list.get (), item.get ()) == -1)
405 return NULL;
406 }
407 }
408
409 return list.release ();
410}
411
412/* Implementation of solib_name (Long) -> String.
413 Returns the name of the shared library holding a given address, or None. */
414
415static PyObject *
417{
418 CORE_ADDR pc;
419 PyObject *pc_obj;
420
421 pspace_object *self = (pspace_object *) o;
422
423 PSPY_REQUIRE_VALID (self);
424
425 if (!PyArg_ParseTuple (args, "O", &pc_obj))
426 return NULL;
427 if (get_addr_from_python (pc_obj, &pc) < 0)
428 return nullptr;
429
430 const char *soname = solib_name_from_address (self->pspace, pc);
431 if (soname == nullptr)
432 Py_RETURN_NONE;
433 return host_string_to_python_string (soname).release ();
434}
435
436/* Implement objfile_for_address. */
437
438static PyObject *
440{
441 CORE_ADDR addr;
442 PyObject *addr_obj;
443
444 pspace_object *self = (pspace_object *) o;
445
446 PSPY_REQUIRE_VALID (self);
447
448 if (!PyArg_ParseTuple (args, "O", &addr_obj))
449 return nullptr;
450 if (get_addr_from_python (addr_obj, &addr) < 0)
451 return nullptr;
452
453 struct objfile *objf = self->pspace->objfile_for_address (addr);
454 if (objf == nullptr)
455 Py_RETURN_NONE;
456
457 return objfile_to_objfile_object (objf).release ();
458}
459
460/* Return the innermost lexical block containing the specified pc value,
461 or 0 if there is none. */
462static PyObject *
464{
465 pspace_object *self = (pspace_object *) o;
466 CORE_ADDR pc;
467 PyObject *pc_obj;
468 const struct block *block = NULL;
469 struct compunit_symtab *cust = NULL;
470
471 PSPY_REQUIRE_VALID (self);
472
473 if (!PyArg_ParseTuple (args, "O", &pc_obj))
474 return NULL;
475 if (get_addr_from_python (pc_obj, &pc) < 0)
476 return nullptr;
477
478 try
479 {
481
483 cust = find_pc_compunit_symtab (pc);
484
485 if (cust != NULL && cust->objfile () != NULL)
486 block = block_for_pc (pc);
487 }
488 catch (const gdb_exception &except)
489 {
491 }
492
493 if (cust == NULL || cust->objfile () == NULL)
494 Py_RETURN_NONE;
495
496 if (block)
497 return block_to_block_object (block, cust->objfile ());
498
499 Py_RETURN_NONE;
500}
501
502/* Implementation of the find_pc_line function.
503 Returns the gdb.Symtab_and_line object corresponding to a PC value. */
504
505static PyObject *
507{
508 CORE_ADDR pc;
509 PyObject *result = NULL; /* init for gcc -Wall */
510 PyObject *pc_obj;
511 pspace_object *self = (pspace_object *) o;
512
513 PSPY_REQUIRE_VALID (self);
514
515 if (!PyArg_ParseTuple (args, "O", &pc_obj))
516 return NULL;
517 if (get_addr_from_python (pc_obj, &pc) < 0)
518 return nullptr;
519
520 try
521 {
522 struct symtab_and_line sal;
524
526
527 sal = find_pc_line (pc, 0);
528 result = symtab_and_line_to_sal_object (sal);
529 }
530 catch (const gdb_exception &except)
531 {
533 }
534
535 return result;
536}
537
538/* Implementation of is_valid (self) -> Boolean.
539 Returns True if this program space still exists in GDB. */
540
541static PyObject *
543{
544 pspace_object *self = (pspace_object *) o;
545
546 if (self->pspace == NULL)
547 Py_RETURN_FALSE;
548
549 Py_RETURN_TRUE;
550}
551
552
553
554/* Return a new reference to the Python object of type Pspace
555 representing PSPACE. If the object has already been created,
556 return it. Otherwise, create it. Return NULL and set the Python
557 error on failure. */
558
561{
563 if (result == NULL)
564 {
566 ((pspace_object *) PyObject_New (pspace_object, &pspace_object_type));
567 if (object == NULL)
568 return NULL;
569 if (!pspy_initialize (object.get ()))
570 return NULL;
571
572 object->pspace = pspace;
573 pspy_pspace_data_key.set (pspace, object.get ());
574 result = (PyObject *) object.release ();
575 }
576
577 return gdbpy_ref<>::new_reference (result);
578}
579
580/* See python-internal.h. */
581
582struct program_space *
584{
585 gdb_assert (gdbpy_is_progspace (obj));
586 return ((pspace_object *) obj)->pspace;
587}
588
589/* See python-internal.h. */
590
591bool
593{
594 return PyObject_TypeCheck (obj, &pspace_object_type);
595}
596
597/* Emit an ExecutableChangedEvent event to REGISTRY. Return 0 on success,
598 or a negative value on error. PSPACE is the program_space in which the
599 current executable has changed, and RELOAD_P is true if the executable
600 path stayed the same, but the file on disk changed, or false if the
601 executable path actually changed. */
602
603static int
605 struct program_space *pspace, bool reload_p)
606{
607 gdbpy_ref<> event_obj
608 = create_event_object (&executable_changed_event_object_type);
609 if (event_obj == nullptr)
610 return -1;
611
612 gdbpy_ref<> py_pspace = pspace_to_pspace_object (pspace);
613 if (py_pspace == nullptr
614 || evpy_add_attribute (event_obj.get (), "progspace",
615 py_pspace.get ()) < 0)
616 return -1;
617
618 gdbpy_ref<> py_reload_p (PyBool_FromLong (reload_p ? 1 : 0));
619 if (py_reload_p == nullptr
620 || evpy_add_attribute (event_obj.get (), "reload",
621 py_reload_p.get ()) < 0)
622 return -1;
623
624 return evpy_emit_event (event_obj.get (), registry);
625}
626
627/* Listener for the executable_changed observable, this is called when the
628 current executable within PSPACE changes. RELOAD_P is true if the
629 executable path stayed the same but the file changed on disk. RELOAD_P
630 is false if the executable path was changed. */
631
632static void
633gdbpy_executable_changed (struct program_space *pspace, bool reload_p)
634{
636 return;
637
638 gdbpy_enter enter_py;
639
640 if (!evregpy_no_listeners_p (gdb_py_events.executable_changed))
641 if (emit_executable_changed_event (gdb_py_events.executable_changed,
642 pspace, reload_p) < 0)
644}
645
646/* Helper function to emit NewProgspaceEvent (when ADDING_P is true) or
647 FreeProgspaceEvent events (when ADDING_P is false). */
648
649static void
651{
653 return;
654
655 gdbpy_enter enter_py;
656
658 PyTypeObject *event_type;
659 if (adding_p)
660 {
661 registry = gdb_py_events.new_progspace;
662 event_type = &new_progspace_event_object_type;
663 }
664 else
665 {
666 registry = gdb_py_events.free_progspace;
667 event_type = &free_progspace_event_object_type;
668 }
669
671 return;
672
673 gdbpy_ref<> pspace_obj = pspace_to_pspace_object (pspace);
674 if (pspace_obj == nullptr)
675 {
677 return;
678 }
679
680 gdbpy_ref<> event = create_event_object (event_type);
681 if (event == nullptr
682 || evpy_add_attribute (event.get (), "progspace",
683 pspace_obj.get ()) < 0
684 || evpy_emit_event (event.get (), registry) < 0)
686}
687
688/* Emit a NewProgspaceEvent to indicate PSPACE has been created. */
689
690static void
695
696/* Emit a FreeProgspaceEvent to indicate PSPACE is just about to be removed
697 from GDB. */
698
699static void
704
707{
709 "py-progspace");
711 "py-progspace");
713 "py-progspace");
714
715 if (PyType_Ready (&pspace_object_type) < 0)
716 return -1;
717
718 return gdb_pymodule_addobject (gdb_module, "Progspace",
720}
721
723
724
725
727{
728 { "__dict__", gdb_py_generic_dict, NULL,
729 "The __dict__ for this progspace.", &pspace_object_type },
730 { "filename", pspy_get_filename, NULL,
731 "The filename of the progspace's main symbol file, or None.", nullptr },
732 { "symbol_file", pspy_get_symbol_file, nullptr,
733 "The gdb.Objfile for the progspace's main symbol file, or None.",
734 nullptr},
735 { "executable_filename", pspy_get_exec_file, nullptr,
736 "The filename for the progspace's executable, or None.", nullptr},
737 { "pretty_printers", pspy_get_printers, pspy_set_printers,
738 "Pretty printers.", NULL },
740 "Frame filters.", NULL },
742 "Frame unwinders.", NULL },
744 "Type printers.", NULL },
745 { "xmethods", pspy_get_xmethods, NULL,
746 "Debug methods.", NULL },
747 { NULL }
748};
749
750static PyMethodDef progspace_object_methods[] =
751{
752 { "objfiles", pspy_get_objfiles, METH_NOARGS,
753 "Return a sequence of objfiles associated to this program space." },
754 { "solib_name", pspy_solib_name, METH_VARARGS,
755 "solib_name (Long) -> String.\n\
756Return the name of the shared library holding a given address, or None." },
757 { "objfile_for_address", pspy_objfile_for_address, METH_VARARGS,
758 "objfile_for_address (int) -> gdb.Objfile\n\
759Return the objfile containing the given address, or None." },
760 { "block_for_pc", pspy_block_for_pc, METH_VARARGS,
761 "Return the block containing the given pc value, or None." },
762 { "find_pc_line", pspy_find_pc_line, METH_VARARGS,
763 "find_pc_line (pc) -> Symtab_and_line.\n\
764Return the gdb.Symtab_and_line object corresponding to the pc value." },
765 { "is_valid", pspy_is_valid, METH_NOARGS,
766 "is_valid () -> Boolean.\n\
767Return true if this program space is valid, false if not." },
768 { NULL }
769};
770
771PyTypeObject pspace_object_type =
772{
773 PyVarObject_HEAD_INIT (NULL, 0)
774 "gdb.Progspace", /*tp_name*/
775 sizeof (pspace_object), /*tp_basicsize*/
776 0, /*tp_itemsize*/
777 pspy_dealloc, /*tp_dealloc*/
778 0, /*tp_print*/
779 0, /*tp_getattr*/
780 0, /*tp_setattr*/
781 0, /*tp_compare*/
782 0, /*tp_repr*/
783 0, /*tp_as_number*/
784 0, /*tp_as_sequence*/
785 0, /*tp_as_mapping*/
786 0, /*tp_hash */
787 0, /*tp_call*/
788 0, /*tp_str*/
789 0, /*tp_getattro*/
790 0, /*tp_setattro*/
791 0, /*tp_as_buffer*/
792 Py_TPFLAGS_DEFAULT, /*tp_flags*/
793 "GDB progspace object", /* tp_doc */
794 0, /* tp_traverse */
795 0, /* tp_clear */
796 0, /* tp_richcompare */
797 0, /* tp_weaklistoffset */
798 0, /* tp_iter */
799 0, /* tp_iternext */
800 progspace_object_methods, /* tp_methods */
801 0, /* tp_members */
802 pspace_getset, /* tp_getset */
803 0, /* tp_base */
804 0, /* tp_dict */
805 0, /* tp_descr_get */
806 0, /* tp_descr_set */
807 offsetof (pspace_object, dict), /* tp_dictoffset */
808 0, /* tp_init */
809 0, /* tp_alloc */
810 pspy_new, /* tp_new */
811};
constexpr string_view get()
Definition 70483.cc:49
struct gdbarch * target_gdbarch(void)
const struct block * block_for_pc(CORE_ADDR pc)
Definition block.c:276
void set(unsigned key, void *datum)
Definition registry.h:204
void * get(unsigned key)
Definition registry.h:211
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)
Definition objfiles.c:1259
void set_current_program_space(struct program_space *pspace)
Definition progspace.c:243
PyObject * block_to_block_object(const struct block *block, struct objfile *objfile)
Definition py-block.c:323
gdbpy_ref create_event_object(PyTypeObject *py_type)
Definition py-event.c:31
int evpy_add_attribute(PyObject *event, const char *name, PyObject *attr)
Definition py-event.c:50
int evpy_emit_event(PyObject *event, eventregistry_object *registry)
Definition py-event.c:83
events_object gdb_py_events
bool evregpy_no_listeners_p(eventregistry_object *registry)
gdbpy_ref objfile_to_objfile_object(struct objfile *objfile)
Definition py-objfile.c:686
int value
Definition py-param.c:79
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
Definition py-ref.h:42
PyObject * symtab_and_line_to_sal_object(struct symtab_and_line sal)
Definition py-symtab.c:481
gdbpy_ref host_string_to_python_string(const char *str)
Definition py-utils.c:154
int get_addr_from_python(PyObject *obj, CORE_ADDR *addr)
Definition py-utils.c:239
int gdb_pymodule_addobject(PyObject *module, const char *name, PyObject *object)
Definition py-utils.c:334
PyObject * gdb_py_generic_dict(PyObject *self, void *closure)
Definition py-utils.c:317
void gdbpy_print_stack(void)
PyObject * gdb_module
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)
Definition solib.c:1200
Definition block.h:109
struct objfile * objfile() const
Definition symtab.h:1788
objfiles_range objfiles()
Definition progspace.h:209
struct objfile * objfile_for_address(CORE_ADDR address)
Definition progspace.c:187
gdb::unique_xmalloc_ptr< char > exec_filename
Definition progspace.h:325
struct objfile * symfile_object_file
Definition progspace.h:357
void operator()(pspace_object *obj)
PyObject * frame_unwinders
PyObject * type_printers
PyObject * xmethods
PyObject_HEAD struct program_space * pspace
PyObject * dict
PyObject * printers
PyObject * frame_filters
CORE_ADDR pc
Definition symtab.h:2337
struct program_space * pspace
Definition symtab.h:2326
Definition value.h:130
struct compunit_symtab * find_pc_compunit_symtab(CORE_ADDR pc)
Definition symtab.c:2946
struct symtab_and_line find_pc_line(CORE_ADDR pc, int notcurrent)
Definition symtab.c:3295
int PyObject
Definition varobj.c:41