|
|
a094f6 |
commit ae438bc5c06b770c00f37e4ed244707ce3ab9ff4
|
|
|
a094f6 |
Author: Ulrich Weigand <ulrich.weigand@de.ibm.com>
|
|
|
a094f6 |
Date: Tue Sep 6 17:25:31 2016 +0200
|
|
|
a094f6 |
|
|
|
a094f6 |
Fix TYPE_SPECIFIC_FIELD for types created via arch_type
|
|
|
a094f6 |
|
|
|
a094f6 |
A type's TYPE_SPECIFIC_FIELD is supposed to be initialized as appropriate
|
|
|
a094f6 |
for the type code. This does happen if the type is created via init_type,
|
|
|
a094f6 |
but not if it created via arch_type.
|
|
|
a094f6 |
|
|
|
a094f6 |
Fixed by extracting the initialization logic into a new set_type_code
|
|
|
a094f6 |
routine, which is then called from both places.
|
|
|
a094f6 |
|
|
|
a094f6 |
gdb/ChangeLog:
|
|
|
a094f6 |
|
|
|
a094f6 |
* gdbtypes.c (set_type_code): New function.
|
|
|
a094f6 |
(init_type, arch_type): Use it.
|
|
|
a094f6 |
|
|
|
a094f6 |
Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
|
|
|
a094f6 |
|
|
|
a094f6 |
### a/gdb/ChangeLog
|
|
|
a094f6 |
### b/gdb/ChangeLog
|
|
|
a094f6 |
## -1,5 +1,10 @@
|
|
|
a094f6 |
2016-09-05 Ulrich Weigand <uweigand@de.ibm.com>
|
|
|
a094f6 |
|
|
|
a094f6 |
+ * gdbtypes.c (set_type_code): New function.
|
|
|
a094f6 |
+ (init_type, arch_type): Use it.
|
|
|
a094f6 |
+
|
|
|
a094f6 |
+2016-09-05 Ulrich Weigand <uweigand@de.ibm.com>
|
|
|
a094f6 |
+
|
|
|
a094f6 |
* ada-lang.c (ada_language_arch_info): Use gdbarch_long_double_bit
|
|
|
a094f6 |
instead of gdbarch_double_bit for "long_long_float".
|
|
|
a094f6 |
|
|
|
a094f6 |
--- a/gdb/gdbtypes.c
|
|
|
a094f6 |
+++ b/gdb/gdbtypes.c
|
|
|
a094f6 |
@@ -2681,6 +2681,30 @@ allocate_gnat_aux_type (struct type *type)
|
|
|
a094f6 |
*(TYPE_GNAT_SPECIFIC (type)) = gnat_aux_default;
|
|
|
a094f6 |
}
|
|
|
a094f6 |
|
|
|
a094f6 |
+/* Helper function to initialize a newly allocated type. Set type code
|
|
|
a094f6 |
+ to CODE and initialize the type-specific fields accordingly. */
|
|
|
a094f6 |
+
|
|
|
a094f6 |
+static void
|
|
|
a094f6 |
+set_type_code (struct type *type, enum type_code code)
|
|
|
a094f6 |
+{
|
|
|
a094f6 |
+ TYPE_CODE (type) = code;
|
|
|
a094f6 |
+
|
|
|
a094f6 |
+ switch (code)
|
|
|
a094f6 |
+ {
|
|
|
a094f6 |
+ case TYPE_CODE_STRUCT:
|
|
|
a094f6 |
+ case TYPE_CODE_UNION:
|
|
|
a094f6 |
+ case TYPE_CODE_NAMESPACE:
|
|
|
a094f6 |
+ INIT_CPLUS_SPECIFIC (type);
|
|
|
a094f6 |
+ break;
|
|
|
a094f6 |
+ case TYPE_CODE_FLT:
|
|
|
a094f6 |
+ TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_FLOATFORMAT;
|
|
|
a094f6 |
+ break;
|
|
|
a094f6 |
+ case TYPE_CODE_FUNC:
|
|
|
a094f6 |
+ INIT_FUNC_SPECIFIC (type);
|
|
|
a094f6 |
+ break;
|
|
|
a094f6 |
+ }
|
|
|
a094f6 |
+}
|
|
|
a094f6 |
+
|
|
|
a094f6 |
/* Helper function to initialize the standard scalar types.
|
|
|
a094f6 |
|
|
|
a094f6 |
If NAME is non-NULL, then it is used to initialize the type name.
|
|
|
a094f6 |
@@ -2694,7 +2718,7 @@ init_type (enum type_code code, int length, int flags,
|
|
|
a094f6 |
struct type *type;
|
|
|
a094f6 |
|
|
|
a094f6 |
type = alloc_type (objfile);
|
|
|
a094f6 |
- TYPE_CODE (type) = code;
|
|
|
a094f6 |
+ set_type_code (type, code);
|
|
|
a094f6 |
TYPE_LENGTH (type) = length;
|
|
|
a094f6 |
|
|
|
a094f6 |
gdb_assert (!(flags & (TYPE_FLAG_MIN - 1)));
|
|
|
a094f6 |
@@ -2730,20 +2754,6 @@ init_type (enum type_code code, int length, int flags,
|
|
|
a094f6 |
if (name && strcmp (name, "char") == 0)
|
|
|
a094f6 |
TYPE_NOSIGN (type) = 1;
|
|
|
a094f6 |
|
|
|
a094f6 |
- switch (code)
|
|
|
a094f6 |
- {
|
|
|
a094f6 |
- case TYPE_CODE_STRUCT:
|
|
|
a094f6 |
- case TYPE_CODE_UNION:
|
|
|
a094f6 |
- case TYPE_CODE_NAMESPACE:
|
|
|
a094f6 |
- INIT_CPLUS_SPECIFIC (type);
|
|
|
a094f6 |
- break;
|
|
|
a094f6 |
- case TYPE_CODE_FLT:
|
|
|
a094f6 |
- TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_FLOATFORMAT;
|
|
|
a094f6 |
- break;
|
|
|
a094f6 |
- case TYPE_CODE_FUNC:
|
|
|
a094f6 |
- INIT_FUNC_SPECIFIC (type);
|
|
|
a094f6 |
- break;
|
|
|
a094f6 |
- }
|
|
|
a094f6 |
return type;
|
|
|
a094f6 |
}
|
|
|
a094f6 |
|
|
|
a094f6 |
@@ -4634,7 +4644,7 @@ arch_type (struct gdbarch *gdbarch,
|
|
|
a094f6 |
struct type *type;
|
|
|
a094f6 |
|
|
|
a094f6 |
type = alloc_type_arch (gdbarch);
|
|
|
a094f6 |
- TYPE_CODE (type) = code;
|
|
|
a094f6 |
+ set_type_code (type, code);
|
|
|
a094f6 |
TYPE_LENGTH (type) = length;
|
|
|
a094f6 |
|
|
|
a094f6 |
if (name)
|