/* Python interface to architecture
- Copyright (C) 2013-2017 Free Software Foundation, Inc.
+ Copyright (C) 2013-2019 Free Software Foundation, Inc.
This file is part of GDB.
#include "arch-utils.h"
#include "disasm.h"
#include "python-internal.h"
-#include "py-ref.h"
typedef struct arch_object_type_object {
PyObject_HEAD
{
struct gdbarch *gdbarch = NULL;
const char *name;
- PyObject *py_name;
ARCHPY_REQUIRE_VALID (self, gdbarch);
name = (gdbarch_bfd_arch_info (gdbarch))->printable_name;
- py_name = PyString_FromString (name);
-
- return py_name;
+ return PyString_FromString (name);
}
/* Implementation of
static PyObject *
archpy_disassemble (PyObject *self, PyObject *args, PyObject *kw)
{
- static char *keywords[] = { "start_pc", "end_pc", "count", NULL };
+ static const char *keywords[] = { "start_pc", "end_pc", "count", NULL };
CORE_ADDR start, end = 0;
CORE_ADDR pc;
gdb_py_ulongest start_temp;
ARCHPY_REQUIRE_VALID (self, gdbarch);
- if (!PyArg_ParseTupleAndKeywords (args, kw, GDB_PY_LLU_ARG "|OO", keywords,
- &start_temp, &end_obj, &count_obj))
+ if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, GDB_PY_LLU_ARG "|OO",
+ keywords, &start_temp, &end_obj,
+ &count_obj))
return NULL;
start = start_temp;
}
}
- gdbpy_ref result_list (PyList_New (0));
+ gdbpy_ref<> result_list (PyList_New (0));
if (result_list == NULL)
return NULL;
|| (end_obj == NULL && count_obj == NULL && pc == start);)
{
int insn_len = 0;
- gdbpy_ref insn_dict (PyDict_New ());
+ gdbpy_ref<> insn_dict (PyDict_New ());
if (insn_dict == NULL)
return NULL;
string_file stb;
- TRY
+ try
{
insn_len = gdb_print_insn (gdbarch, pc, &stb, NULL);
}
- CATCH (except, RETURN_MASK_ALL)
+ catch (const gdb_exception &except)
{
gdbpy_convert_exception (except);
return NULL;
}
- END_CATCH
if (PyDict_SetItemString (insn_dict.get (), "addr",
gdb_py_long_from_ulongest (pc))