/* Python interface to objfiles.
- Copyright (C) 2008-2015 Free Software Foundation, Inc.
+ Copyright (C) 2008-2016 Free Software Foundation, Inc.
This file is part of GDB.
#include "objfiles.h"
#include "language.h"
#include "build-id.h"
-#include "elf-bfd.h"
#include "symtab.h"
typedef struct
objfile_object *obj = (objfile_object *) self;
if (obj->objfile)
- return PyString_Decode (objfile_name (obj->objfile),
- strlen (objfile_name (obj->objfile)),
- host_charset (), NULL);
+ return host_string_to_python_string (objfile_name (obj->objfile));
Py_RETURN_NONE;
}
{
const char *username = obj->objfile->original_name;
- return PyString_Decode (username, strlen (username),
- host_charset (), NULL);
+ return host_string_to_python_string (username);
}
Py_RETURN_NONE;
{
objfile_object *obj = (objfile_object *) self;
struct objfile *objfile = obj->objfile;
- const struct elf_build_id *build_id = NULL;
+ const struct bfd_build_id *build_id = NULL;
OBJFPY_REQUIRE_VALID (obj);
char *hex_form = make_hex_string (build_id->data, build_id->size);
PyObject *result;
- result = PyString_Decode (hex_form, strlen (hex_form),
- host_charset (), NULL);
+ result = host_string_to_python_string (hex_form);
xfree (hex_form);
return result;
}
objfpy_initialize (objfile_object *self)
{
self->objfile = NULL;
- self->dict = NULL;
+
+ self->dict = PyDict_New ();
+ if (self->dict == NULL)
+ return 0;
self->printers = PyList_New (0);
if (self->printers == NULL)
static char *keywords[] = { "file_name", NULL };
objfile_object *obj = (objfile_object *) self;
const char *file_name;
- int symfile_flags = 0;
OBJFPY_REQUIRE_VALID (obj);
{
bfd *abfd = symfile_bfd_open (file_name);
- symbol_file_add_separate (abfd, file_name, symfile_flags, obj->objfile);
+ symbol_file_add_separate (abfd, file_name, 0, obj->objfile);
}
CATCH (except, RETURN_MASK_ALL)
{
It is assumed that objfpy_build_id_ok (string) returns TRUE. */
static int
-objfpy_build_id_matches (const struct elf_build_id *build_id,
+objfpy_build_id_matches (const struct bfd_build_id *build_id,
const char *string)
{
size_t i;
ALL_OBJFILES (objfile)
{
- const struct elf_build_id *obfd_build_id;
+ const struct bfd_build_id *obfd_build_id;
if (objfile->obfd == NULL)
continue;
py_free_objfile (struct objfile *objfile, void *datum)
{
struct cleanup *cleanup;
- objfile_object *object = datum;
+ objfile_object *object = (objfile_object *) datum;
cleanup = ensure_python_env (get_objfile_arch (objfile), current_language);
object->objfile = NULL;
{
objfile_object *object;
- object = objfile_data (objfile, objfpy_objfile_data_key);
+ object = (objfile_object *) objfile_data (objfile, objfpy_objfile_data_key);
if (!object)
{
object = PyObject_New (objfile_object, &objfile_object_type);