gdb: remove TYPE_LENGTH

Remove the macro, replace all uses with calls to type::length.

Change-Id: Ib9bdc954576860b21190886534c99103d6a47afb
This commit is contained in:
Simon Marchi 2022-09-21 11:05:21 -04:00
parent b6cdbc9a81
commit df86565b31
150 changed files with 1320 additions and 1323 deletions

View file

@ -746,7 +746,7 @@ infpy_thread_from_thread_handle (PyObject *self, PyObject *args, PyObject *kw)
{
struct value *val = value_object_to_value (handle_obj);
bytes = value_contents_all (val).data ();
bytes_len = TYPE_LENGTH (value_type (val));
bytes_len = value_type (val)->length ();
}
else
{

View file

@ -582,7 +582,7 @@ gdbpy_apply_val_pretty_printer (const struct extension_language_defn *extlang,
value_fetch_lazy (value);
/* No pretty-printer support for unavailable values. */
if (!value_bytes_available (value, 0, TYPE_LENGTH (type)))
if (!value_bytes_available (value, 0, type->length ()))
return EXT_LANG_RC_NOP;
if (!gdb_python_initialized)

View file

@ -771,7 +771,7 @@ typy_get_sizeof (PyObject *self, void *closure)
if (size_varies)
Py_RETURN_NONE;
return gdb_py_object_from_longest (TYPE_LENGTH (type)).release ();
return gdb_py_object_from_longest (type->length ()).release ();
}
/* Return the alignment of the type represented by SELF, in bytes. */

View file

@ -292,13 +292,13 @@ unwind_infopy_add_saved_register (PyObject *self, PyObject *args)
return NULL;
}
data_size = register_size (pending_frame->gdbarch, regnum);
if (data_size != TYPE_LENGTH (value_type (value)))
if (data_size != value_type (value)->length ())
{
PyErr_Format (
PyExc_ValueError,
"The value of the register returned by the Python "
"sniffer has unexpected size: %u instead of %u.",
(unsigned) TYPE_LENGTH (value_type (value)),
(unsigned) value_type (value)->length (),
(unsigned) data_size);
return NULL;
}
@ -620,7 +620,7 @@ pyuw_sniffer (const struct frame_unwind *self, struct frame_info *this_frame,
/* `value' validation was done before, just assert. */
gdb_assert (value != NULL);
gdb_assert (data_size == TYPE_LENGTH (value_type (value)));
gdb_assert (data_size == value_type (value)->length ());
cached_frame->reg[i].data = (gdb_byte *) xmalloc (data_size);
memcpy (cached_frame->reg[i].data,

View file

@ -158,7 +158,7 @@ convert_buffer_and_type_to_value (PyObject *obj, struct type *type)
return nullptr;
}
if (TYPE_LENGTH (type) > py_buf.len)
if (type->length () > py_buf.len)
{
PyErr_SetString (PyExc_ValueError,
_("Size of type is larger than that of buffer object."));
@ -597,7 +597,7 @@ valpy_string (PyObject *self, PyObject *args, PyObject *kw)
encoding = (user_encoding && *user_encoding) ? user_encoding : la_encoding;
return PyUnicode_Decode ((const char *) buffer.get (),
length * TYPE_LENGTH (char_type),
length * char_type->length (),
encoding, errors);
}