#include "language.h"
#include "build-id.h"
#include "symtab.h"
-#include "py-ref.h"
typedef struct
{
OBJFPY_REQUIRE_VALID (obj);
- TRY
+ try
{
build_id = build_id_bfd_get (objfile->obfd);
}
- CATCH (except, RETURN_MASK_ALL)
+ catch (const gdb_exception &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
}
- END_CATCH
if (build_id != NULL)
{
static int
objfpy_set_printers (PyObject *o, PyObject *value, void *ignore)
{
- PyObject *tmp;
objfile_object *self = (objfile_object *) o;
if (! value)
}
/* Take care in case the LHS and RHS are related somehow. */
- tmp = self->printers;
+ gdbpy_ref<> tmp (self->printers);
Py_INCREF (value);
self->printers = value;
- Py_XDECREF (tmp);
return 0;
}
static int
objfpy_set_frame_filters (PyObject *o, PyObject *filters, void *ignore)
{
- PyObject *tmp;
objfile_object *self = (objfile_object *) o;
if (! filters)
}
/* Take care in case the LHS and RHS are related somehow. */
- tmp = self->frame_filters;
+ gdbpy_ref<> tmp (self->frame_filters);
Py_INCREF (filters);
self->frame_filters = filters;
- Py_XDECREF (tmp);
return 0;
}
static int
objfpy_set_frame_unwinders (PyObject *o, PyObject *unwinders, void *ignore)
{
- PyObject *tmp;
objfile_object *self = (objfile_object *) o;
if (!unwinders)
}
/* Take care in case the LHS and RHS are related somehow. */
- tmp = self->frame_unwinders;
+ gdbpy_ref<> tmp (self->frame_unwinders);
Py_INCREF (unwinders);
self->frame_unwinders = unwinders;
- Py_XDECREF (tmp);
return 0;
}
static int
objfpy_set_type_printers (PyObject *o, PyObject *value, void *ignore)
{
- PyObject *tmp;
objfile_object *self = (objfile_object *) o;
if (! value)
}
/* Take care in case the LHS and RHS are related somehow. */
- tmp = self->type_printers;
+ gdbpy_ref<> tmp (self->type_printers);
Py_INCREF (value);
self->type_printers = value;
- Py_XDECREF (tmp);
return 0;
}
if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "s", keywords, &file_name))
return NULL;
- TRY
+ try
{
gdb_bfd_ref_ptr abfd (symfile_bfd_open (file_name));
symbol_file_add_separate (abfd.get (), file_name, 0, obj->objfile);
}
- CATCH (except, RETURN_MASK_ALL)
+ catch (const gdb_exception &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
}
- END_CATCH
Py_RETURN_NONE;
}
static struct objfile *
objfpy_lookup_objfile_by_name (const char *name)
{
- struct objfile *objfile;
-
- ALL_OBJFILES (objfile)
+ for (objfile *objfile : current_program_space->objfiles ())
{
const char *filename;
static struct objfile *
objfpy_lookup_objfile_by_build_id (const char *build_id)
{
- struct objfile *objfile;
-
- ALL_OBJFILES (objfile)
+ for (objfile *objfile : current_program_space->objfiles ())
{
const struct bfd_build_id *obfd_build_id;