Exemplo n.º 1
0
static struct objfile *
get_dynamics_objfile (struct gdbarch *gdbarch)
{
  struct objfile *dynamics_objfile;

  dynamics_objfile = program_space_data (current_program_space,
					 jv_dynamics_progspace_key);

  if (dynamics_objfile == NULL)
    {
      struct jv_per_objfile_data *data;

      /* Mark it as shared so that it is cleared when the inferior is
	 re-run.  */
      dynamics_objfile = allocate_objfile (NULL, NULL,
					   OBJF_SHARED | OBJF_NOT_FILENAME);
      dynamics_objfile->per_bfd->gdbarch = gdbarch;

      data = XCNEW (struct jv_per_objfile_data);
      set_objfile_data (dynamics_objfile, jv_dynamics_objfile_data_key, data);

      set_program_space_data (current_program_space,
			      jv_dynamics_progspace_key,
			      dynamics_objfile);
    }
  return dynamics_objfile;
}
Exemplo n.º 2
0
static struct i386fbsd_info *
get_i386fbsd_info (void)
{
  struct i386fbsd_info *info;

  info = program_space_data (current_program_space, i386fbsd_pspace_data);
  if (info != NULL)
    return info;

  info = XCNEW (struct i386fbsd_info);
  set_program_space_data (current_program_space, i386fbsd_pspace_data, info);

  /*
   * In revision 1.117 of i386/i386/exception.S trap handlers
   * were changed to pass trapframes by reference rather than
   * by value.  Detect this by seeing if the first instruction
   * at the 'calltrap' label is a "push %esp" which has the
   * opcode 0x54.
   */
  if (parse_and_eval_long("((char *)calltrap)[0]") == 0x54)
    info->ofs_fix = 4;
  else
    info->ofs_fix = 0;
  return info;
}
Exemplo n.º 3
0
PyObject *
pspace_to_pspace_object (struct program_space *pspace)
{
  pspace_object *object;

  object = program_space_data (pspace, pspy_pspace_data_key);
  if (!object)
    {
      object = PyObject_New (pspace_object, &pspace_object_type);
      if (object)
	{
	  object->pspace = pspace;

	  object->printers = PyList_New (0);
	  if (!object->printers)
	    {
	      Py_DECREF (object);
	      return NULL;
	    }

	  object->type_printers = PyList_New (0);
	  if (!object->type_printers)
	    {
	      Py_DECREF (object);
	      return NULL;
	    }

	  set_program_space_data (pspace, pspy_pspace_data_key, object);
	}
    }

  return (PyObject *) object;
}
Exemplo n.º 4
0
static void
dsbt_pspace_data_cleanup (struct program_space *pspace, void *arg)
{
  struct dsbt_info *info;

  info = program_space_data (pspace, solib_dsbt_pspace_data);
  xfree (info);
}
Exemplo n.º 5
0
static struct objfile_pspace_info *
get_objfile_pspace_data (struct program_space *pspace)
{
  struct objfile_pspace_info *info;

  info = program_space_data (pspace, objfiles_pspace_data);
  if (info == NULL)
    {
      info = XCNEW (struct objfile_pspace_info);
      set_program_space_data (pspace, objfiles_pspace_data, info);
    }
Exemplo n.º 6
0
static void
objfiles_pspace_data_cleanup (struct program_space *pspace, void *arg)
{
  struct objfile_pspace_info *info;

  info = program_space_data (pspace, objfiles_pspace_data);
  if (info != NULL)
    {
      xfree (info->sections);
      xfree (info);
    }
}
Exemplo n.º 7
0
static struct darwin_info *
get_darwin_info (void)
{
  struct darwin_info *info;

  info = program_space_data (current_program_space, solib_darwin_pspace_data);
  if (info != NULL)
    return info;

  info = XCNEW (struct darwin_info);
  set_program_space_data (current_program_space,
			  solib_darwin_pspace_data, info);
  return info;
}
Exemplo n.º 8
0
static struct dsbt_info *
get_dsbt_info (void)
{
  struct dsbt_info *info;

  info = program_space_data (current_program_space, solib_dsbt_pspace_data);
  if (info != NULL)
    return info;

  info = XCNEW (struct dsbt_info);
  set_program_space_data (current_program_space, solib_dsbt_pspace_data, info);

  info->lm_base_cache = 0;
  info->main_lm_addr = 0;

  return info;
}
Exemplo n.º 9
0
/* A function called when the dynamics_objfile is freed.  We use this
   to clean up some internal state.  */
static void
jv_per_objfile_free (struct objfile *objfile, void *data)
{
  struct jv_per_objfile_data *jv_data = data;
  struct objfile *dynamics_objfile;

  dynamics_objfile = program_space_data (current_program_space,
					 jv_dynamics_progspace_key);
  gdb_assert (objfile == dynamics_objfile);

  if (jv_data->dict)
    dict_free (jv_data->dict);
  xfree (jv_data);

  set_program_space_data (current_program_space,
			  jv_dynamics_progspace_key,
			  NULL);
}
Exemplo n.º 10
0
PyObject *
pspace_to_pspace_object (struct program_space *pspace)
{
  gdbpy_ref<pspace_object> object
    ((pspace_object *) program_space_data (pspace, pspy_pspace_data_key));
  if (object == NULL)
    {
      object.reset (PyObject_New (pspace_object, &pspace_object_type));
      if (object != NULL)
	{
	  if (!pspy_initialize (object.get ()))
	    return NULL;

	  object->pspace = pspace;
	  set_program_space_data (pspace, pspy_pspace_data_key, object.get ());
	}
    }

  return (PyObject *) object.release ();
}
Exemplo n.º 11
0
PyObject *
pspace_to_pspace_object (struct program_space *pspace)
{
    pspace_object *object;

    object = (pspace_object *) program_space_data (pspace, pspy_pspace_data_key);
    if (!object)
    {
        object = PyObject_New (pspace_object, &pspace_object_type);
        if (object)
        {
            if (!pspy_initialize (object))
            {
                Py_DECREF (object);
                return NULL;
            }

            object->pspace = pspace;
            set_program_space_data (pspace, pspy_pspace_data_key, object);
        }
    }

    return (PyObject *) object;
}