MSP430 Assembler: Leave placement of .lower and .upper sections to generic linker...
[deliverable/binutils-gdb.git] / gdb / python / py-arch.c
index 8d0ec3330cc332769b78d95f46d3aec2ff74a9f0..0799186ca5fda2aa3c119711768fa329a2445b77 100644 (file)
@@ -1,6 +1,6 @@
 /* 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.
 
@@ -22,7 +22,6 @@
 #include "arch-utils.h"
 #include "disasm.h"
 #include "python-internal.h"
-#include "py-ref.h"
 
 typedef struct arch_object_type_object {
   PyObject_HEAD
@@ -97,14 +96,11 @@ archpy_name (PyObject *self, PyObject *args)
 {
   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
@@ -116,7 +112,7 @@ archpy_name (PyObject *self, PyObject *args)
 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;
@@ -126,8 +122,9 @@ archpy_disassemble (PyObject *self, PyObject *args, PyObject *kw)
 
   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;
@@ -178,7 +175,7 @@ archpy_disassemble (PyObject *self, PyObject *args, PyObject *kw)
         }
     }
 
-  gdbpy_ref result_list (PyList_New (0));
+  gdbpy_ref<> result_list (PyList_New (0));
   if (result_list == NULL)
     return NULL;
 
@@ -193,7 +190,7 @@ archpy_disassemble (PyObject *self, PyObject *args, PyObject *kw)
        || (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;
@@ -202,16 +199,15 @@ archpy_disassemble (PyObject *self, PyObject *args, PyObject *kw)
 
       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))
This page took 0.031285 seconds and 4 git commands to generate.