Example #1
0
static PyObject *
find_pretty_printer_from_progspace (PyObject *value)
{
  PyObject *obj = pspace_to_pspace_object (current_program_space);

  if (!obj)
    return NULL;
  gdbpy_ref<> pp_list (pspy_get_printers (obj, NULL));
  return search_pp_list (pp_list.get (), value);
}
static PyObject *
find_pretty_printer_from_progspace (PyObject *value)
{
    PyObject *pp_list;
    PyObject *function;
    PyObject *obj = pspace_to_pspace_object (current_program_space);

    if (!obj)
        return NULL;
    pp_list = pspy_get_printers (obj, NULL);
    function = search_pp_list (pp_list, value);
    Py_XDECREF (pp_list);
    return function;
}
Example #3
0
static gdbpy_ref<>
create_clear_objfiles_event_object (void)
{
  gdbpy_ref<> objfile_event
    = create_event_object (&clear_objfiles_event_object_type);
  if (objfile_event == NULL)
    return NULL;

  gdbpy_ref<> py_progspace = pspace_to_pspace_object (current_program_space);
  if (py_progspace == NULL || evpy_add_attribute (objfile_event.get (),
						  "progspace",
						  py_progspace.get ()) < 0)
    return NULL;

  return objfile_event;
}
static PyObject *
create_clear_objfiles_event_object (void)
{
  PyObject *objfile_event;
  PyObject *py_progspace;

  objfile_event = create_event_object (&clear_objfiles_event_object_type);
  if (!objfile_event)
    goto fail;

  /* Note that pspace_to_pspace_object returns a borrowed reference,
     so we don't need a decref here.  */
  py_progspace = pspace_to_pspace_object (current_program_space);
  if (!py_progspace || evpy_add_attribute (objfile_event,
					   "progspace",
					   py_progspace) < 0)
    goto fail;

  return objfile_event;

 fail:
  Py_XDECREF (objfile_event);
  return NULL;
}