Exemplo n.º 1
0
static PyObject *
create_exited_event_object (const LONGEST *exit_code, struct inferior *inf)
{
  gdbpy_ref<> exited_event (create_event_object (&exited_event_object_type));

  if (exited_event == NULL)
    return NULL;

  if (exit_code)
    {
      gdbpy_ref<> exit_code_obj (PyLong_FromLongLong (*exit_code));

      if (exit_code_obj == NULL)
	return NULL;
      if (evpy_add_attribute (exited_event.get (), "exit_code",
			      exit_code_obj.get ()) < 0)
	return NULL;
    }

  gdbpy_ref<> inf_obj (inferior_to_inferior_object (inf));
  if (inf_obj == NULL || evpy_add_attribute (exited_event.get (),
					     "inferior",
					     inf_obj.get ()) < 0)
    return NULL;

  return exited_event.release ();
}
Exemplo n.º 2
0
static PyObject*
create_inferior_appeared_event_object (struct inferior *inf)
{
  PyObject *inferior_appeared_event;
  PyObject *inf_obj = NULL;

  inferior_appeared_event = create_event_object (
    &inferior_appeared_event_object_type);

  if (!inferior_appeared_event)
    goto fail;

  inf_obj = inferior_to_inferior_object (inf);
  if (!inf_obj || evpy_add_attribute (inferior_appeared_event,
                                      "inferior",
                                      inf_obj) < 0)
    goto fail;
  Py_DECREF (inf_obj);

  return inferior_appeared_event;

 fail:
  Py_XDECREF (inf_obj);
  Py_XDECREF (inferior_appeared_event);
  return NULL;

}
Exemplo n.º 3
0
static PyObject*
create_solib_about_to_search_event_object (struct inferior *inf)
{
  PyObject *solib_about_to_search_event;
  PyObject *inf_obj = NULL;

  solib_about_to_search_event = create_event_object (&solib_about_to_search_event_object_type);

  if (!solib_about_to_search_event)
    goto fail;

  inf_obj = inferior_to_inferior_object (inf);
  if (!inf_obj || evpy_add_attribute (solib_about_to_search_event,
                                      "inferior",
                                      inf_obj) < 0)
    goto fail;
  Py_DECREF (inf_obj);

  return solib_about_to_search_event;

 fail:
  Py_XDECREF (inf_obj);
  Py_XDECREF (solib_about_to_search_event);
  return NULL;
}
Exemplo n.º 4
0
static int
build_inferior_list (struct inferior *inf, void *arg)
{
    PyObject *list = arg;
    PyObject *inferior = inferior_to_inferior_object (inf);

    PyList_Append (list, inferior);
    return 0;
}
Exemplo n.º 5
0
PyObject *
find_inferior_object (int pid)
{
  struct inferior *inf = find_inferior_pid (pid);

  if (inf)
    return inferior_to_inferior_object (inf);

  return NULL;
}
Exemplo n.º 6
0
static int
build_inferior_list (struct inferior *inf, void *arg)
{
  PyObject *list = arg;
  PyObject *inferior = inferior_to_inferior_object (inf);
  int success = 0;

  if (! inferior)
    return 0;

  success = PyList_Append (list, inferior);
  Py_DECREF (inferior);

  if (success)
    return 1;

  return 0;
}
Exemplo n.º 7
0
static PyObject *
create_exited_event_object (const LONGEST *exit_code, struct inferior *inf)
{
  PyObject *exited_event;
  PyObject *inf_obj = NULL;

  exited_event = create_event_object (&exited_event_object_type);

  if (!exited_event)
    goto fail;

  if (exit_code)
    {
      PyObject *exit_code_obj = PyLong_FromLongLong (*exit_code);
      int failed;

      if (exit_code_obj == NULL)
	goto fail;

      failed = evpy_add_attribute (exited_event, "exit_code",
				   exit_code_obj) < 0;
      Py_DECREF (exit_code_obj);
      if (failed)
	goto fail;
    }

  inf_obj = inferior_to_inferior_object (inf);
  if (!inf_obj || evpy_add_attribute (exited_event,
                                      "inferior",
                                      inf_obj) < 0)
    goto fail;
  Py_DECREF (inf_obj);

  return exited_event;

 fail:
  Py_XDECREF (inf_obj);
  Py_XDECREF (exited_event);
  return NULL;
}