aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/gdbtypes.c2
-rw-r--r--gdb/gdbtypes.h4
3 files changed, 10 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index bb18676..c1eedea 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2021-01-23 Simon Marchi <simon.marchi@polymtl.ca>
+
+ * gdbtypes.c (copy_type_recursive): Use get_type_arch.
+ * gdbtypes.h (struct type) <set_owner>: Add asserts.
+
2021-01-23 Lancelot SIX <lsix@lancelotsix.com>
* Makefile.in (SELFTESTS_SRCS): Add
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 115f078..b66b89c 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -5518,7 +5518,7 @@ copy_type_recursive (struct objfile *objfile,
copy the entire thing and then update specific fields as needed. */
*TYPE_MAIN_TYPE (new_type) = *TYPE_MAIN_TYPE (type);
- new_type->set_owner (type->arch ());
+ new_type->set_owner (get_type_arch (type));
if (type->name ())
new_type->set_name (xstrdup (type->name ()));
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 30e8ac5..2e0b01a 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -1245,6 +1245,8 @@ struct type
/* Set the owner of the type to be OBJFILE. */
void set_owner (objfile *objfile)
{
+ gdb_assert (objfile != nullptr);
+
this->main_type->m_owner.objfile = objfile;
this->main_type->m_flag_objfile_owned = true;
}
@@ -1252,6 +1254,8 @@ struct type
/* Set the owner of the type to be ARCH. */
void set_owner (gdbarch *arch)
{
+ gdb_assert (arch != nullptr);
+
this->main_type->m_owner.gdbarch = arch;
this->main_type->m_flag_objfile_owned = false;
}