mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-08-06 14:49:38 +08:00
Give a language to a type
This changes main_type to hold a language, and updates the debug readers to set this field. This is done by adding the language to the type-allocator object. Note that the non-DWARF readers are changed on a "best effort" basis. This patch also reimplements type::is_array_like to use the type's language, and it adds a new type::is_string_like as well. This in turn lets us change the Python implementation of these methods to simply defer to the type.
This commit is contained in:
@ -448,17 +448,19 @@ static PyObject *
|
||||
typy_is_array_like (PyObject *self, void *closure)
|
||||
{
|
||||
struct type *type = ((type_object *) self)->type;
|
||||
bool result = false;
|
||||
|
||||
try
|
||||
{
|
||||
type = check_typedef (type);
|
||||
result = type->is_array_like ();
|
||||
}
|
||||
catch (const gdb_exception &except)
|
||||
{
|
||||
GDB_PY_HANDLE_EXCEPTION (except);
|
||||
}
|
||||
|
||||
if (type->is_array_like ())
|
||||
if (result)
|
||||
Py_RETURN_TRUE;
|
||||
else
|
||||
Py_RETURN_FALSE;
|
||||
@ -475,14 +477,7 @@ typy_is_string_like (PyObject *self, void *closure)
|
||||
try
|
||||
{
|
||||
type = check_typedef (type);
|
||||
|
||||
const language_defn *lang = nullptr;
|
||||
if (HAVE_GNAT_AUX_INFO (type))
|
||||
lang = language_def (language_ada);
|
||||
else if (HAVE_RUST_SPECIFIC (type))
|
||||
lang = language_def (language_rust);
|
||||
if (lang != nullptr)
|
||||
result = lang->is_string_type_p (type);
|
||||
result = type->is_string_like ();
|
||||
}
|
||||
catch (const gdb_exception &except)
|
||||
{
|
||||
|
Reference in New Issue
Block a user