diff options
author | Tom Tromey <tromey@adacore.com> | 2020-09-15 11:08:56 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2020-09-15 11:08:56 -0600 |
commit | 4bde49dc81c5c16189af70b9a144dbb5651994f1 (patch) | |
tree | 538a8007afa184fc28f2f9a5781265afc1402156 | |
parent | 37431074656958dfb788a1980f5a1cd474705b83 (diff) | |
download | gdb-4bde49dc81c5c16189af70b9a144dbb5651994f1.zip gdb-4bde49dc81c5c16189af70b9a144dbb5651994f1.tar.gz gdb-4bde49dc81c5c16189af70b9a144dbb5651994f1.tar.bz2 |
Don't use gdb_py_long_from_longest
Change the Python layer to avoid gdb_py_long_from_longest, and remove
the defines.
gdb/ChangeLog
2020-09-15 Tom Tromey <tromey@adacore.com>
* python/python-internal.h (gdb_py_long_from_longest): Remove
defines.
* python/py-value.c (valpy_long): Use gdb_py_object_from_longest.
* python/py-type.c (convert_field, typy_get_sizeof): Use
gdb_py_object_from_longest.
* python/py-record-btrace.c (btpy_list_index): Use
gdb_py_object_from_longest.
-rw-r--r-- | gdb/ChangeLog | 10 | ||||
-rw-r--r-- | gdb/python/py-record-btrace.c | 2 | ||||
-rw-r--r-- | gdb/python/py-type.c | 8 | ||||
-rw-r--r-- | gdb/python/py-value.c | 2 | ||||
-rw-r--r-- | gdb/python/python-internal.h | 2 |
5 files changed, 15 insertions, 9 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8a7ad2a..6df6633 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,15 @@ 2020-09-15 Tom Tromey <tromey@adacore.com> + * python/python-internal.h (gdb_py_long_from_longest): Remove + defines. + * python/py-value.c (valpy_long): Use gdb_py_object_from_longest. + * python/py-type.c (convert_field, typy_get_sizeof): Use + gdb_py_object_from_longest. + * python/py-record-btrace.c (btpy_list_index): Use + gdb_py_object_from_longest. + +2020-09-15 Tom Tromey <tromey@adacore.com> + * python/python-internal.h (PyInt_FromSsize_t): Remove define. * python/py-record.c (recpy_element_number): Use gdb_py_object_from_longest. diff --git a/gdb/python/py-record-btrace.c b/gdb/python/py-record-btrace.c index 08613a8..84a3d9e 100644 --- a/gdb/python/py-record-btrace.c +++ b/gdb/python/py-record-btrace.c @@ -556,7 +556,7 @@ btpy_list_index (PyObject *self, PyObject *value) if (index < 0) return PyErr_Format (PyExc_ValueError, _("Not in list.")); - return gdb_py_long_from_longest (index); + return gdb_py_object_from_longest (index).release (); } /* Implementation of BtraceList.count (self, value) -> int. */ diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c index 2e175b6..229fde3 100644 --- a/gdb/python/py-type.c +++ b/gdb/python/py-type.c @@ -183,8 +183,7 @@ convert_field (struct type *type, int field) if (type->code () == TYPE_CODE_ENUM) { - arg.reset (gdb_py_long_from_longest (TYPE_FIELD_ENUMVAL (type, - field))); + arg = gdb_py_object_from_longest (TYPE_FIELD_ENUMVAL (type, field)); attrstring = "enumval"; } else @@ -192,8 +191,7 @@ convert_field (struct type *type, int field) if (TYPE_FIELD_LOC_KIND (type, field) == FIELD_LOC_KIND_DWARF_BLOCK) arg = gdbpy_ref<>::new_reference (Py_None); else - arg.reset (gdb_py_long_from_longest (TYPE_FIELD_BITPOS (type, - field))); + arg = gdb_py_object_from_longest (TYPE_FIELD_BITPOS (type, field)); attrstring = "bitpos"; } @@ -725,7 +723,7 @@ typy_get_sizeof (PyObject *self, void *closure) if (size_varies) Py_RETURN_NONE; - return gdb_py_long_from_longest (TYPE_LENGTH (type)); + return gdb_py_object_from_longest (TYPE_LENGTH (type)).release (); } /* Return the alignment of the type represented by SELF, in bytes. */ diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c index 2d9e77a..504a9de 100644 --- a/gdb/python/py-value.c +++ b/gdb/python/py-value.c @@ -1733,7 +1733,7 @@ valpy_long (PyObject *self) if (type->is_unsigned ()) return gdb_py_long_from_ulongest (l); else - return gdb_py_long_from_longest (l); + return gdb_py_object_from_longest (l).release (); } /* Implements conversion to float. */ diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h index e406f37..b93c78f 100644 --- a/gdb/python/python-internal.h +++ b/gdb/python/python-internal.h @@ -126,7 +126,6 @@ #define GDB_PY_LLU_ARG "K" typedef PY_LONG_LONG gdb_py_longest; typedef unsigned PY_LONG_LONG gdb_py_ulongest; -#define gdb_py_long_from_longest PyLong_FromLongLong #define gdb_py_long_from_ulongest PyLong_FromUnsignedLongLong #define gdb_py_long_as_ulongest PyLong_AsUnsignedLongLong @@ -136,7 +135,6 @@ typedef unsigned PY_LONG_LONG gdb_py_ulongest; #define GDB_PY_LLU_ARG "K" typedef long gdb_py_longest; typedef unsigned long gdb_py_ulongest; -#define gdb_py_long_from_longest PyLong_FromLong #define gdb_py_long_from_ulongest PyLong_FromUnsignedLong #define gdb_py_long_as_ulongest PyLong_AsUnsignedLong |