aboutsummaryrefslogtreecommitdiff
path: root/gdb/python
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2022-09-21 11:05:21 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2022-09-21 11:05:21 -0400
commitdf86565b31bf12aab6fdceade49169bc6f378b13 (patch)
tree76d5944661919552ce4ea01ac49188e151d72fa7 /gdb/python
parentb6cdbc9a8173b9e6cc8cfc284caa0efa8129ca02 (diff)
downloadbinutils-df86565b31bf12aab6fdceade49169bc6f378b13.zip
binutils-df86565b31bf12aab6fdceade49169bc6f378b13.tar.gz
binutils-df86565b31bf12aab6fdceade49169bc6f378b13.tar.bz2
gdb: remove TYPE_LENGTH
Remove the macro, replace all uses with calls to type::length. Change-Id: Ib9bdc954576860b21190886534c99103d6a47afb
Diffstat (limited to 'gdb/python')
-rw-r--r--gdb/python/py-inferior.c2
-rw-r--r--gdb/python/py-prettyprint.c2
-rw-r--r--gdb/python/py-type.c2
-rw-r--r--gdb/python/py-unwind.c6
-rw-r--r--gdb/python/py-value.c4
5 files changed, 8 insertions, 8 deletions
diff --git a/gdb/python/py-inferior.c b/gdb/python/py-inferior.c
index 6ea384e..0066ae6 100644
--- a/gdb/python/py-inferior.c
+++ b/gdb/python/py-inferior.c
@@ -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
{
diff --git a/gdb/python/py-prettyprint.c b/gdb/python/py-prettyprint.c
index 1f8dd26..9276807 100644
--- a/gdb/python/py-prettyprint.c
+++ b/gdb/python/py-prettyprint.c
@@ -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)
diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c
index 3d7d2f6..3e558de 100644
--- a/gdb/python/py-type.c
+++ b/gdb/python/py-type.c
@@ -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. */
diff --git a/gdb/python/py-unwind.c b/gdb/python/py-unwind.c
index dcb1d7a..0a1b460 100644
--- a/gdb/python/py-unwind.c
+++ b/gdb/python/py-unwind.c
@@ -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,
diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c
index cb3346c..92a1530 100644
--- a/gdb/python/py-value.c
+++ b/gdb/python/py-value.c
@@ -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);
}