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.
This commit is contained in:
Tom Tromey 2020-09-15 11:08:56 -06:00
parent 3743107465
commit 4bde49dc81
5 changed files with 15 additions and 9 deletions

View file

@ -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. */