|
|
01917d |
commit 19f392bc2a93d9e64d063b884cd6eca547c8dad0
|
|
|
01917d |
Author: Ulrich Weigand <ulrich.weigand@de.ibm.com>
|
|
|
01917d |
Date: Tue Sep 6 17:27:55 2016 +0200
|
|
|
01917d |
|
|
|
01917d |
Unify init_type and arch_type interface and helpers
|
|
|
01917d |
|
|
|
01917d |
This adds a number of helper routines for creating objfile-owned types;
|
|
|
01917d |
these correspond 1:1 to the already existing helper routines for creating
|
|
|
01917d |
gdbarch-owned types, and are intended to be used instead of init_type.
|
|
|
01917d |
A shared fragment of init_float_type and arch_float_type is extracted into
|
|
|
01917d |
a separate subroutine verify_subroutine.
|
|
|
01917d |
|
|
|
01917d |
The commit also brings the interface of init_type in line with the one for
|
|
|
01917d |
arch_type. In particular, this means removing the FLAGS argument; callers
|
|
|
01917d |
now set the required flags directly. (Since most callers use the new
|
|
|
01917d |
helper routines, very few callers actually need to set any additional
|
|
|
01917d |
flags directly any more.)
|
|
|
01917d |
|
|
|
01917d |
Note that this means all the TYPE_FLAGS_... defined are no longer needed
|
|
|
01917d |
anywhere; they will be removed by a follow-on commit.
|
|
|
01917d |
|
|
|
01917d |
All users of init_type are changed to use on of the new helpers where
|
|
|
01917d |
possible. No functional change intended.
|
|
|
01917d |
|
|
|
01917d |
gdb/ChangeLog:
|
|
|
01917d |
|
|
|
01917d |
* gdbtypes.h (init_type): Remove FLAGS argument. Move OBJFILE
|
|
|
01917d |
argument to first position.
|
|
|
01917d |
(init_integer_type): New prototype.
|
|
|
01917d |
(init_character_type): Likewise.
|
|
|
01917d |
(init_boolean_type): Likewise.
|
|
|
01917d |
(init_float_type): Likewise.
|
|
|
01917d |
(init_decfloat_type): Likewise.
|
|
|
01917d |
(init_complex_type): Likewise.
|
|
|
01917d |
(init_pointer_type): Likewise.
|
|
|
01917d |
* gdbtypes.c (verify_floatflormat): New function.
|
|
|
01917d |
(init_type): Remove FLAGS argument and processing. Move OBJFILE
|
|
|
01917d |
argument to first position.
|
|
|
01917d |
(init_integer_type): New function.
|
|
|
01917d |
(init_character_type): Likewise.
|
|
|
01917d |
(init_boolean_type): Likewise.
|
|
|
01917d |
(init_float_type): Likewise.
|
|
|
01917d |
(init_decfloat_type): Likewise.
|
|
|
01917d |
(init_complex_type): Likewise.
|
|
|
01917d |
(init_pointer_type): Likewise.
|
|
|
01917d |
(arch_float_type): Use verify_floatflormat.
|
|
|
01917d |
(objfile_type): Use init_..._type helpers instead of calling
|
|
|
01917d |
init_type directly.
|
|
|
01917d |
* dwarf2read.c (fixup_go_packaging): Update to changed init_type
|
|
|
01917d |
prototype.
|
|
|
01917d |
(read_namespace_type): Likewise.
|
|
|
01917d |
(read_module_type): Likewise.
|
|
|
01917d |
(read_typedef): Likewise.
|
|
|
01917d |
(read_unspecified_type): Likewise.
|
|
|
01917d |
(build_error_marker_type): Likewise.
|
|
|
01917d |
(read_base_type): Use init_..._type helpers.
|
|
|
01917d |
* mdebugread.c (basic_type): Use init_..._type helpers.
|
|
|
01917d |
(parse_type): Update to changed init_type prototype.
|
|
|
01917d |
(cross_ref): Likewise.
|
|
|
01917d |
* stabsread.c (rs6000_builtin_type): Use init_..._type helpers.
|
|
|
01917d |
(read_sun_builtin_type): Likewise.
|
|
|
01917d |
(read_sun_floating_type): Likewise.
|
|
|
01917d |
(read_range_type): Likewise. Also update to changed init_type
|
|
|
01917d |
prototype.
|
|
|
01917d |
|
|
|
01917d |
Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
|
|
|
01917d |
|
|
|
01917d |
### a/gdb/ChangeLog
|
|
|
01917d |
### b/gdb/ChangeLog
|
|
|
01917d |
## -1,5 +1,46 @@
|
|
|
01917d |
2016-09-05 Ulrich Weigand <uweigand@de.ibm.com>
|
|
|
01917d |
|
|
|
01917d |
+ * gdbtypes.h (init_type): Remove FLAGS argument. Move OBJFILE
|
|
|
01917d |
+ argument to first position.
|
|
|
01917d |
+ (init_integer_type): New prototype.
|
|
|
01917d |
+ (init_character_type): Likewise.
|
|
|
01917d |
+ (init_boolean_type): Likewise.
|
|
|
01917d |
+ (init_float_type): Likewise.
|
|
|
01917d |
+ (init_decfloat_type): Likewise.
|
|
|
01917d |
+ (init_complex_type): Likewise.
|
|
|
01917d |
+ (init_pointer_type): Likewise.
|
|
|
01917d |
+ * gdbtypes.c (verify_floatflormat): New function.
|
|
|
01917d |
+ (init_type): Remove FLAGS argument and processing. Move OBJFILE
|
|
|
01917d |
+ argument to first position.
|
|
|
01917d |
+ (init_integer_type): New function.
|
|
|
01917d |
+ (init_character_type): Likewise.
|
|
|
01917d |
+ (init_boolean_type): Likewise.
|
|
|
01917d |
+ (init_float_type): Likewise.
|
|
|
01917d |
+ (init_decfloat_type): Likewise.
|
|
|
01917d |
+ (init_complex_type): Likewise.
|
|
|
01917d |
+ (init_pointer_type): Likewise.
|
|
|
01917d |
+ (arch_float_type): Use verify_floatflormat.
|
|
|
01917d |
+ (objfile_type): Use init_..._type helpers instead of calling
|
|
|
01917d |
+ init_type directly.
|
|
|
01917d |
+ * dwarf2read.c (fixup_go_packaging): Update to changed init_type
|
|
|
01917d |
+ prototype.
|
|
|
01917d |
+ (read_namespace_type): Likewise.
|
|
|
01917d |
+ (read_module_type): Likewise.
|
|
|
01917d |
+ (read_typedef): Likewise.
|
|
|
01917d |
+ (read_unspecified_type): Likewise.
|
|
|
01917d |
+ (build_error_marker_type): Likewise.
|
|
|
01917d |
+ (read_base_type): Use init_..._type helpers.
|
|
|
01917d |
+ * mdebugread.c (basic_type): Use init_..._type helpers.
|
|
|
01917d |
+ (parse_type): Update to changed init_type prototype.
|
|
|
01917d |
+ (cross_ref): Likewise.
|
|
|
01917d |
+ * stabsread.c (rs6000_builtin_type): Use init_..._type helpers.
|
|
|
01917d |
+ (read_sun_builtin_type): Likewise.
|
|
|
01917d |
+ (read_sun_floating_type): Likewise.
|
|
|
01917d |
+ (read_range_type): Likewise. Also update to changed init_type
|
|
|
01917d |
+ prototype.
|
|
|
01917d |
+
|
|
|
01917d |
+2016-09-05 Ulrich Weigand <uweigand@de.ibm.com>
|
|
|
01917d |
+
|
|
|
01917d |
* gdbtypes.h (arch_decfloat_type): New prototype.
|
|
|
01917d |
(arch_pointer_type): Likewise.
|
|
|
01917d |
* gdbtypes.c (arch_decfloat_type): New function.
|
|
|
01917d |
Index: gdb-7.6.1/gdb/dwarf2read.c
|
|
|
01917d |
===================================================================
|
|
|
01917d |
--- gdb-7.6.1.orig/gdb/dwarf2read.c 2017-03-11 21:42:28.099262777 +0100
|
|
|
01917d |
+++ gdb-7.6.1/gdb/dwarf2read.c 2017-03-11 21:45:39.098565504 +0100
|
|
|
01917d |
@@ -6901,8 +6901,8 @@
|
|
|
01917d |
const char *saved_package_name = obstack_copy0 (&objfile->objfile_obstack,
|
|
|
01917d |
package_name,
|
|
|
01917d |
strlen (package_name));
|
|
|
01917d |
- struct type *type = init_type (TYPE_CODE_MODULE, 0, 0,
|
|
|
01917d |
- saved_package_name, objfile);
|
|
|
01917d |
+ struct type *type = init_type (objfile, TYPE_CODE_MODULE, 0,
|
|
|
01917d |
+ saved_package_name);
|
|
|
01917d |
struct symbol *sym;
|
|
|
01917d |
|
|
|
01917d |
TYPE_TAG_NAME (type) = TYPE_NAME (type);
|
|
|
01917d |
@@ -12266,9 +12266,7 @@
|
|
|
01917d |
previous_prefix, name, 0, cu);
|
|
|
01917d |
|
|
|
01917d |
/* Create the type. */
|
|
|
01917d |
- type = init_type (TYPE_CODE_NAMESPACE, 0, 0, NULL,
|
|
|
01917d |
- objfile);
|
|
|
01917d |
- TYPE_NAME (type) = name;
|
|
|
01917d |
+ type = init_type (objfile, TYPE_CODE_NAMESPACE, 0, name);
|
|
|
01917d |
TYPE_TAG_NAME (type) = TYPE_NAME (type);
|
|
|
01917d |
|
|
|
01917d |
return set_die_type (die, type, cu);
|
|
|
01917d |
@@ -12331,7 +12329,7 @@
|
|
|
01917d |
complaint (&symfile_complaints,
|
|
|
01917d |
_("DW_TAG_module has no name, offset 0x%x"),
|
|
|
01917d |
die->offset.sect_off);
|
|
|
01917d |
- type = init_type (TYPE_CODE_MODULE, 0, 0, module_name, objfile);
|
|
|
01917d |
+ type = init_type (objfile, TYPE_CODE_MODULE, 0, module_name);
|
|
|
01917d |
|
|
|
01917d |
/* determine_prefix uses TYPE_TAG_NAME. */
|
|
|
01917d |
TYPE_TAG_NAME (type) = TYPE_NAME (type);
|
|
|
01917d |
@@ -12884,9 +12882,8 @@
|
|
|
01917d |
struct type *this_type, *target_type;
|
|
|
01917d |
|
|
|
01917d |
name = dwarf2_full_name (NULL, die, cu);
|
|
|
01917d |
- this_type = init_type (TYPE_CODE_TYPEDEF, 0,
|
|
|
01917d |
- TYPE_FLAG_TARGET_STUB, NULL, objfile);
|
|
|
01917d |
- TYPE_NAME (this_type) = name;
|
|
|
01917d |
+ this_type = init_type (objfile, TYPE_CODE_TYPEDEF, 0, name);
|
|
|
01917d |
+ TYPE_TARGET_STUB (this_type) = 1;
|
|
|
01917d |
set_die_type (die, this_type, cu);
|
|
|
01917d |
target_type = die_type (die, cu);
|
|
|
01917d |
if (target_type != this_type)
|
|
|
01917d |
@@ -12913,11 +12910,8 @@
|
|
|
01917d |
struct objfile *objfile = cu->objfile;
|
|
|
01917d |
struct type *type;
|
|
|
01917d |
struct attribute *attr;
|
|
|
01917d |
- int encoding = 0, size = 0;
|
|
|
01917d |
+ int encoding = 0, bits = 0;
|
|
|
01917d |
const char *name;
|
|
|
01917d |
- enum type_code code = TYPE_CODE_INT;
|
|
|
01917d |
- int type_flags = 0;
|
|
|
01917d |
- struct type *target_type = NULL;
|
|
|
01917d |
|
|
|
01917d |
attr = dwarf2_attr (die, DW_AT_encoding, cu);
|
|
|
01917d |
if (attr)
|
|
|
01917d |
@@ -12927,7 +12921,7 @@
|
|
|
01917d |
attr = dwarf2_attr (die, DW_AT_byte_size, cu);
|
|
|
01917d |
if (attr)
|
|
|
01917d |
{
|
|
|
01917d |
- size = DW_UNSND (attr);
|
|
|
01917d |
+ bits = DW_UNSND (attr) * TARGET_CHAR_BIT;
|
|
|
01917d |
}
|
|
|
01917d |
name = dwarf2_name (die, cu);
|
|
|
01917d |
if (!name)
|
|
|
01917d |
@@ -12940,61 +12934,63 @@
|
|
|
01917d |
{
|
|
|
01917d |
case DW_ATE_address:
|
|
|
01917d |
/* Turn DW_ATE_address into a void * pointer. */
|
|
|
01917d |
- code = TYPE_CODE_PTR;
|
|
|
01917d |
- type_flags |= TYPE_FLAG_UNSIGNED;
|
|
|
01917d |
- target_type = init_type (TYPE_CODE_VOID, 1, 0, NULL, objfile);
|
|
|
01917d |
+ type = init_type (objfile, TYPE_CODE_VOID, 1, NULL);
|
|
|
01917d |
+ type = init_pointer_type (objfile, bits, name, type);
|
|
|
01917d |
break;
|
|
|
01917d |
case DW_ATE_boolean:
|
|
|
01917d |
- code = TYPE_CODE_BOOL;
|
|
|
01917d |
- type_flags |= TYPE_FLAG_UNSIGNED;
|
|
|
01917d |
+ type = init_boolean_type (objfile, bits, 1, name);
|
|
|
01917d |
break;
|
|
|
01917d |
case DW_ATE_complex_float:
|
|
|
01917d |
- code = TYPE_CODE_COMPLEX;
|
|
|
01917d |
- target_type = init_type (TYPE_CODE_FLT, size / 2, 0, NULL, objfile);
|
|
|
01917d |
+ type = init_float_type (objfile, bits / 2, NULL, NULL);
|
|
|
01917d |
+ type = init_complex_type (objfile, name, type);
|
|
|
01917d |
break;
|
|
|
01917d |
case DW_ATE_decimal_float:
|
|
|
01917d |
- code = TYPE_CODE_DECFLOAT;
|
|
|
01917d |
+ type = init_decfloat_type (objfile, bits, name);
|
|
|
01917d |
break;
|
|
|
01917d |
case DW_ATE_float:
|
|
|
01917d |
- code = TYPE_CODE_FLT;
|
|
|
01917d |
+ type = init_float_type (objfile, bits, name, NULL);
|
|
|
01917d |
break;
|
|
|
01917d |
case DW_ATE_signed:
|
|
|
01917d |
+ type = init_integer_type (objfile, bits, 0, name);
|
|
|
01917d |
break;
|
|
|
01917d |
case DW_ATE_unsigned:
|
|
|
01917d |
- type_flags |= TYPE_FLAG_UNSIGNED;
|
|
|
01917d |
if (cu->language == language_fortran
|
|
|
01917d |
&& name
|
|
|
01917d |
&& strncmp (name, "character(", sizeof ("character(") - 1) == 0)
|
|
|
01917d |
- code = TYPE_CODE_CHAR;
|
|
|
01917d |
+ type = init_character_type (objfile, bits, 1, name);
|
|
|
01917d |
+ else
|
|
|
01917d |
+ type = init_integer_type (objfile, bits, 1, name);
|
|
|
01917d |
break;
|
|
|
01917d |
case DW_ATE_signed_char:
|
|
|
01917d |
if (cu->language == language_ada || cu->language == language_m2
|
|
|
01917d |
|| cu->language == language_pascal
|
|
|
01917d |
|| cu->language == language_fortran)
|
|
|
01917d |
- code = TYPE_CODE_CHAR;
|
|
|
01917d |
+ type = init_character_type (objfile, bits, 0, name);
|
|
|
01917d |
+ else
|
|
|
01917d |
+ type = init_integer_type (objfile, bits, 0, name);
|
|
|
01917d |
break;
|
|
|
01917d |
case DW_ATE_unsigned_char:
|
|
|
01917d |
if (cu->language == language_ada || cu->language == language_m2
|
|
|
01917d |
|| cu->language == language_pascal
|
|
|
01917d |
|| cu->language == language_fortran)
|
|
|
01917d |
- code = TYPE_CODE_CHAR;
|
|
|
01917d |
- type_flags |= TYPE_FLAG_UNSIGNED;
|
|
|
01917d |
+ type = init_character_type (objfile, bits, 1, name);
|
|
|
01917d |
+ else
|
|
|
01917d |
+ type = init_integer_type (objfile, bits, 1, name);
|
|
|
01917d |
break;
|
|
|
01917d |
case DW_ATE_UTF:
|
|
|
01917d |
/* We just treat this as an integer and then recognize the
|
|
|
01917d |
type by name elsewhere. */
|
|
|
01917d |
+ type = init_integer_type (objfile, bits, 0, name);
|
|
|
01917d |
break;
|
|
|
01917d |
|
|
|
01917d |
default:
|
|
|
01917d |
complaint (&symfile_complaints, _("unsupported DW_AT_encoding: '%s'"),
|
|
|
01917d |
dwarf_type_encoding_name (encoding));
|
|
|
01917d |
+ type = init_type (objfile, TYPE_CODE_ERROR,
|
|
|
01917d |
+ bits / TARGET_CHAR_BIT, name);
|
|
|
01917d |
break;
|
|
|
01917d |
}
|
|
|
01917d |
|
|
|
01917d |
- type = init_type (code, size, type_flags, NULL, objfile);
|
|
|
01917d |
- TYPE_NAME (type) = name;
|
|
|
01917d |
- TYPE_TARGET_TYPE (type) = target_type;
|
|
|
01917d |
-
|
|
|
01917d |
if (name && strcmp (name, "char") == 0)
|
|
|
01917d |
TYPE_NOSIGN (type) = 1;
|
|
|
01917d |
|
|
|
01917d |
@@ -13287,7 +13283,7 @@
|
|
|
01917d |
|
|
|
01917d |
/* For now, we only support the C meaning of an unspecified type: void. */
|
|
|
01917d |
|
|
|
01917d |
- type = init_type (TYPE_CODE_VOID, 0, 0, NULL, cu->objfile);
|
|
|
01917d |
+ type = init_type (cu->objfile, TYPE_CODE_VOID, 0, NULL);
|
|
|
01917d |
TYPE_NAME (type) = dwarf2_name (die, cu);
|
|
|
01917d |
|
|
|
01917d |
return set_die_type (die, type, cu);
|
|
|
01917d |
@@ -16913,7 +16909,7 @@
|
|
|
01917d |
message, strlen (message));
|
|
|
01917d |
xfree (message);
|
|
|
01917d |
|
|
|
01917d |
- this_type = init_type (TYPE_CODE_ERROR, 0, 0, saved, objfile);
|
|
|
01917d |
+ this_type = init_type (objfile, TYPE_CODE_ERROR, 0, saved);
|
|
|
01917d |
}
|
|
|
01917d |
|
|
|
01917d |
return this_type;
|
|
|
01917d |
Index: gdb-7.6.1/gdb/gdbtypes.c
|
|
|
01917d |
===================================================================
|
|
|
01917d |
--- gdb-7.6.1.orig/gdb/gdbtypes.c 2017-03-11 21:45:27.194484312 +0100
|
|
|
01917d |
+++ gdb-7.6.1/gdb/gdbtypes.c 2017-03-11 21:48:13.551598067 +0100
|
|
|
01917d |
@@ -2107,6 +2107,41 @@
|
|
|
01917d |
}
|
|
|
01917d |
}
|
|
|
01917d |
|
|
|
01917d |
+// RH
|
|
|
01917d |
+#define FLOATFORMAT_CHAR_BIT 8 // doublest.c
|
|
|
01917d |
+static size_t
|
|
|
01917d |
+floatformat_totalsize_bytes (const struct floatformat *fmt)
|
|
|
01917d |
+{
|
|
|
01917d |
+ return ((fmt->totalsize + FLOATFORMAT_CHAR_BIT - 1)
|
|
|
01917d |
+ / FLOATFORMAT_CHAR_BIT);
|
|
|
01917d |
+}
|
|
|
01917d |
+
|
|
|
01917d |
+/* Helper function to verify floating-point format and size.
|
|
|
01917d |
+ BIT is the type size in bits; if BIT equals -1, the size is
|
|
|
01917d |
+ determined by the floatformat. Returns size to be used. */
|
|
|
01917d |
+
|
|
|
01917d |
+static int
|
|
|
01917d |
+verify_floatformat (int bit, const struct floatformat **floatformats)
|
|
|
01917d |
+{
|
|
|
01917d |
+ if (bit == -1)
|
|
|
01917d |
+ {
|
|
|
01917d |
+ gdb_assert (floatformats != NULL);
|
|
|
01917d |
+ gdb_assert (floatformats[0] != NULL && floatformats[1] != NULL);
|
|
|
01917d |
+ bit = floatformats[0]->totalsize;
|
|
|
01917d |
+ }
|
|
|
01917d |
+ gdb_assert (bit >= 0);
|
|
|
01917d |
+
|
|
|
01917d |
+ if (floatformats != NULL)
|
|
|
01917d |
+ {
|
|
|
01917d |
+ size_t len = bit / TARGET_CHAR_BIT;
|
|
|
01917d |
+
|
|
|
01917d |
+ gdb_assert (len >= floatformat_totalsize_bytes (floatformats[0]));
|
|
|
01917d |
+ gdb_assert (len >= floatformat_totalsize_bytes (floatformats[1]));
|
|
|
01917d |
+ }
|
|
|
01917d |
+
|
|
|
01917d |
+ return bit;
|
|
|
01917d |
+}
|
|
|
01917d |
+
|
|
|
01917d |
/* Helper function to initialize the standard scalar types.
|
|
|
01917d |
|
|
|
01917d |
If NAME is non-NULL, then it is used to initialize the type name.
|
|
|
01917d |
@@ -2114,8 +2149,8 @@
|
|
|
01917d |
least as long as OBJFILE. */
|
|
|
01917d |
|
|
|
01917d |
struct type *
|
|
|
01917d |
-init_type (enum type_code code, LONGEST length, int flags,
|
|
|
01917d |
- const char *name, struct objfile *objfile)
|
|
|
01917d |
+init_type (struct objfile *objfile, enum type_code code, LONGEST length,
|
|
|
01917d |
+ const char *name)
|
|
|
01917d |
{
|
|
|
01917d |
struct type *type;
|
|
|
01917d |
|
|
|
01917d |
@@ -2123,32 +2158,6 @@
|
|
|
01917d |
set_type_code (type, code);
|
|
|
01917d |
TYPE_LENGTH (type) = length;
|
|
|
01917d |
|
|
|
01917d |
- gdb_assert (!(flags & (TYPE_FLAG_MIN - 1)));
|
|
|
01917d |
- if (flags & TYPE_FLAG_UNSIGNED)
|
|
|
01917d |
- TYPE_UNSIGNED (type) = 1;
|
|
|
01917d |
- if (flags & TYPE_FLAG_NOSIGN)
|
|
|
01917d |
- TYPE_NOSIGN (type) = 1;
|
|
|
01917d |
- if (flags & TYPE_FLAG_STUB)
|
|
|
01917d |
- TYPE_STUB (type) = 1;
|
|
|
01917d |
- if (flags & TYPE_FLAG_TARGET_STUB)
|
|
|
01917d |
- TYPE_TARGET_STUB (type) = 1;
|
|
|
01917d |
- if (flags & TYPE_FLAG_STATIC)
|
|
|
01917d |
- TYPE_STATIC (type) = 1;
|
|
|
01917d |
- if (flags & TYPE_FLAG_PROTOTYPED)
|
|
|
01917d |
- TYPE_PROTOTYPED (type) = 1;
|
|
|
01917d |
- if (flags & TYPE_FLAG_INCOMPLETE)
|
|
|
01917d |
- TYPE_INCOMPLETE (type) = 1;
|
|
|
01917d |
- if (flags & TYPE_FLAG_VARARGS)
|
|
|
01917d |
- TYPE_VARARGS (type) = 1;
|
|
|
01917d |
- if (flags & TYPE_FLAG_VECTOR)
|
|
|
01917d |
- TYPE_VECTOR (type) = 1;
|
|
|
01917d |
- if (flags & TYPE_FLAG_STUB_SUPPORTED)
|
|
|
01917d |
- TYPE_STUB_SUPPORTED (type) = 1;
|
|
|
01917d |
- if (flags & TYPE_FLAG_FIXED_INSTANCE)
|
|
|
01917d |
- TYPE_FIXED_INSTANCE (type) = 1;
|
|
|
01917d |
- if (flags & TYPE_FLAG_GNU_IFUNC)
|
|
|
01917d |
- TYPE_GNU_IFUNC (type) = 1;
|
|
|
01917d |
-
|
|
|
01917d |
TYPE_NAME (type) = name;
|
|
|
01917d |
|
|
|
01917d |
/* C++ fancies. */
|
|
|
01917d |
@@ -2158,6 +2167,121 @@
|
|
|
01917d |
|
|
|
01917d |
return type;
|
|
|
01917d |
}
|
|
|
01917d |
+
|
|
|
01917d |
+/* Allocate a TYPE_CODE_INT type structure associated with OBJFILE.
|
|
|
01917d |
+ BIT is the type size in bits. If UNSIGNED_P is non-zero, set
|
|
|
01917d |
+ the type's TYPE_UNSIGNED flag. NAME is the type name. */
|
|
|
01917d |
+
|
|
|
01917d |
+struct type *
|
|
|
01917d |
+init_integer_type (struct objfile *objfile,
|
|
|
01917d |
+ int bit, int unsigned_p, const char *name)
|
|
|
01917d |
+{
|
|
|
01917d |
+ struct type *t;
|
|
|
01917d |
+
|
|
|
01917d |
+ t = init_type (objfile, TYPE_CODE_INT, bit / TARGET_CHAR_BIT, name);
|
|
|
01917d |
+ if (unsigned_p)
|
|
|
01917d |
+ TYPE_UNSIGNED (t) = 1;
|
|
|
01917d |
+
|
|
|
01917d |
+ return t;
|
|
|
01917d |
+}
|
|
|
01917d |
+
|
|
|
01917d |
+/* Allocate a TYPE_CODE_CHAR type structure associated with OBJFILE.
|
|
|
01917d |
+ BIT is the type size in bits. If UNSIGNED_P is non-zero, set
|
|
|
01917d |
+ the type's TYPE_UNSIGNED flag. NAME is the type name. */
|
|
|
01917d |
+
|
|
|
01917d |
+struct type *
|
|
|
01917d |
+init_character_type (struct objfile *objfile,
|
|
|
01917d |
+ int bit, int unsigned_p, const char *name)
|
|
|
01917d |
+{
|
|
|
01917d |
+ struct type *t;
|
|
|
01917d |
+
|
|
|
01917d |
+ t = init_type (objfile, TYPE_CODE_CHAR, bit / TARGET_CHAR_BIT, name);
|
|
|
01917d |
+ if (unsigned_p)
|
|
|
01917d |
+ TYPE_UNSIGNED (t) = 1;
|
|
|
01917d |
+
|
|
|
01917d |
+ return t;
|
|
|
01917d |
+}
|
|
|
01917d |
+
|
|
|
01917d |
+/* Allocate a TYPE_CODE_BOOL type structure associated with OBJFILE.
|
|
|
01917d |
+ BIT is the type size in bits. If UNSIGNED_P is non-zero, set
|
|
|
01917d |
+ the type's TYPE_UNSIGNED flag. NAME is the type name. */
|
|
|
01917d |
+
|
|
|
01917d |
+struct type *
|
|
|
01917d |
+init_boolean_type (struct objfile *objfile,
|
|
|
01917d |
+ int bit, int unsigned_p, const char *name)
|
|
|
01917d |
+{
|
|
|
01917d |
+ struct type *t;
|
|
|
01917d |
+
|
|
|
01917d |
+ t = init_type (objfile, TYPE_CODE_BOOL, bit / TARGET_CHAR_BIT, name);
|
|
|
01917d |
+ if (unsigned_p)
|
|
|
01917d |
+ TYPE_UNSIGNED (t) = 1;
|
|
|
01917d |
+
|
|
|
01917d |
+ return t;
|
|
|
01917d |
+}
|
|
|
01917d |
+
|
|
|
01917d |
+/* Allocate a TYPE_CODE_FLT type structure associated with OBJFILE.
|
|
|
01917d |
+ BIT is the type size in bits; if BIT equals -1, the size is
|
|
|
01917d |
+ determined by the floatformat. NAME is the type name. Set the
|
|
|
01917d |
+ TYPE_FLOATFORMAT from FLOATFORMATS. */
|
|
|
01917d |
+
|
|
|
01917d |
+struct type *
|
|
|
01917d |
+init_float_type (struct objfile *objfile,
|
|
|
01917d |
+ int bit, const char *name,
|
|
|
01917d |
+ const struct floatformat **floatformats)
|
|
|
01917d |
+{
|
|
|
01917d |
+ struct type *t;
|
|
|
01917d |
+
|
|
|
01917d |
+ bit = verify_floatformat (bit, floatformats);
|
|
|
01917d |
+ t = init_type (objfile, TYPE_CODE_FLT, bit / TARGET_CHAR_BIT, name);
|
|
|
01917d |
+ TYPE_FLOATFORMAT (t) = floatformats;
|
|
|
01917d |
+
|
|
|
01917d |
+ return t;
|
|
|
01917d |
+}
|
|
|
01917d |
+
|
|
|
01917d |
+/* Allocate a TYPE_CODE_DECFLOAT type structure associated with OBJFILE.
|
|
|
01917d |
+ BIT is the type size in bits. NAME is the type name. */
|
|
|
01917d |
+
|
|
|
01917d |
+struct type *
|
|
|
01917d |
+init_decfloat_type (struct objfile *objfile, int bit, const char *name)
|
|
|
01917d |
+{
|
|
|
01917d |
+ struct type *t;
|
|
|
01917d |
+
|
|
|
01917d |
+ t = init_type (objfile, TYPE_CODE_DECFLOAT, bit / TARGET_CHAR_BIT, name);
|
|
|
01917d |
+ return t;
|
|
|
01917d |
+}
|
|
|
01917d |
+
|
|
|
01917d |
+/* Allocate a TYPE_CODE_COMPLEX type structure associated with OBJFILE.
|
|
|
01917d |
+ NAME is the type name. TARGET_TYPE is the component float type. */
|
|
|
01917d |
+
|
|
|
01917d |
+struct type *
|
|
|
01917d |
+init_complex_type (struct objfile *objfile,
|
|
|
01917d |
+ const char *name, struct type *target_type)
|
|
|
01917d |
+{
|
|
|
01917d |
+ struct type *t;
|
|
|
01917d |
+
|
|
|
01917d |
+ t = init_type (objfile, TYPE_CODE_COMPLEX,
|
|
|
01917d |
+ 2 * TYPE_LENGTH (target_type), name);
|
|
|
01917d |
+ TYPE_TARGET_TYPE (t) = target_type;
|
|
|
01917d |
+ return t;
|
|
|
01917d |
+}
|
|
|
01917d |
+
|
|
|
01917d |
+/* Allocate a TYPE_CODE_PTR type structure associated with OBJFILE.
|
|
|
01917d |
+ BIT is the pointer type size in bits. NAME is the type name.
|
|
|
01917d |
+ TARGET_TYPE is the pointer target type. Always sets the pointer type's
|
|
|
01917d |
+ TYPE_UNSIGNED flag. */
|
|
|
01917d |
+
|
|
|
01917d |
+struct type *
|
|
|
01917d |
+init_pointer_type (struct objfile *objfile,
|
|
|
01917d |
+ int bit, const char *name, struct type *target_type)
|
|
|
01917d |
+{
|
|
|
01917d |
+ struct type *t;
|
|
|
01917d |
+
|
|
|
01917d |
+ t = init_type (objfile, TYPE_CODE_PTR, bit / TARGET_CHAR_BIT, name);
|
|
|
01917d |
+ TYPE_TARGET_TYPE (t) = target_type;
|
|
|
01917d |
+ TYPE_UNSIGNED (t) = 1;
|
|
|
01917d |
+ return t;
|
|
|
01917d |
+}
|
|
|
01917d |
+
|
|
|
01917d |
|
|
|
01917d |
/* Queries on types. */
|
|
|
01917d |
|
|
|
01917d |
@@ -4010,14 +4134,7 @@
|
|
|
01917d |
{
|
|
|
01917d |
struct type *t;
|
|
|
01917d |
|
|
|
01917d |
- if (bit == -1)
|
|
|
01917d |
- {
|
|
|
01917d |
- gdb_assert (floatformats != NULL);
|
|
|
01917d |
- gdb_assert (floatformats[0] != NULL && floatformats[1] != NULL);
|
|
|
01917d |
- bit = floatformats[0]->totalsize;
|
|
|
01917d |
- }
|
|
|
01917d |
- gdb_assert (bit >= 0);
|
|
|
01917d |
-
|
|
|
01917d |
+ bit = verify_floatformat (bit, floatformats);
|
|
|
01917d |
t = arch_type (gdbarch, TYPE_CODE_FLT, bit / TARGET_CHAR_BIT, name);
|
|
|
01917d |
TYPE_FLOATFORMAT (t) = floatformats;
|
|
|
01917d |
return t;
|
|
|
01917d |
@@ -4350,109 +4467,80 @@
|
|
|
01917d |
|
|
|
01917d |
/* Basic types. */
|
|
|
01917d |
objfile_type->builtin_void
|
|
|
01917d |
- = init_type (TYPE_CODE_VOID, 1,
|
|
|
01917d |
- 0,
|
|
|
01917d |
- "void", objfile);
|
|
|
01917d |
-
|
|
|
01917d |
+ = init_type (objfile, TYPE_CODE_VOID, 1, "void");
|
|
|
01917d |
objfile_type->builtin_char
|
|
|
01917d |
- = init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
|
|
|
01917d |
- (TYPE_FLAG_NOSIGN
|
|
|
01917d |
- | (gdbarch_char_signed (gdbarch) ? 0 : TYPE_FLAG_UNSIGNED)),
|
|
|
01917d |
- "char", objfile);
|
|
|
01917d |
+ = init_integer_type (objfile, TARGET_CHAR_BIT,
|
|
|
01917d |
+ !gdbarch_char_signed (gdbarch), "char");
|
|
|
01917d |
objfile_type->builtin_signed_char
|
|
|
01917d |
- = init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
|
|
|
01917d |
- 0,
|
|
|
01917d |
- "signed char", objfile);
|
|
|
01917d |
+ = init_integer_type (objfile, TARGET_CHAR_BIT,
|
|
|
01917d |
+ 0, "signed char");
|
|
|
01917d |
objfile_type->builtin_unsigned_char
|
|
|
01917d |
- = init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
|
|
|
01917d |
- TYPE_FLAG_UNSIGNED,
|
|
|
01917d |
- "unsigned char", objfile);
|
|
|
01917d |
+ = init_integer_type (objfile, TARGET_CHAR_BIT,
|
|
|
01917d |
+ 1, "unsigned char");
|
|
|
01917d |
objfile_type->builtin_short
|
|
|
01917d |
- = init_type (TYPE_CODE_INT,
|
|
|
01917d |
- gdbarch_short_bit (gdbarch) / TARGET_CHAR_BIT,
|
|
|
01917d |
- 0, "short", objfile);
|
|
|
01917d |
+ = init_integer_type (objfile, gdbarch_short_bit (gdbarch),
|
|
|
01917d |
+ 0, "short");
|
|
|
01917d |
objfile_type->builtin_unsigned_short
|
|
|
01917d |
- = init_type (TYPE_CODE_INT,
|
|
|
01917d |
- gdbarch_short_bit (gdbarch) / TARGET_CHAR_BIT,
|
|
|
01917d |
- TYPE_FLAG_UNSIGNED, "unsigned short", objfile);
|
|
|
01917d |
+ = init_integer_type (objfile, gdbarch_short_bit (gdbarch),
|
|
|
01917d |
+ 1, "unsigned short");
|
|
|
01917d |
objfile_type->builtin_int
|
|
|
01917d |
- = init_type (TYPE_CODE_INT,
|
|
|
01917d |
- gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
|
|
|
01917d |
- 0, "int", objfile);
|
|
|
01917d |
+ = init_integer_type (objfile, gdbarch_int_bit (gdbarch),
|
|
|
01917d |
+ 0, "int");
|
|
|
01917d |
objfile_type->builtin_unsigned_int
|
|
|
01917d |
- = init_type (TYPE_CODE_INT,
|
|
|
01917d |
- gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
|
|
|
01917d |
- TYPE_FLAG_UNSIGNED, "unsigned int", objfile);
|
|
|
01917d |
+ = init_integer_type (objfile, gdbarch_int_bit (gdbarch),
|
|
|
01917d |
+ 1, "unsigned int");
|
|
|
01917d |
objfile_type->builtin_long
|
|
|
01917d |
- = init_type (TYPE_CODE_INT,
|
|
|
01917d |
- gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT,
|
|
|
01917d |
- 0, "long", objfile);
|
|
|
01917d |
+ = init_integer_type (objfile, gdbarch_long_bit (gdbarch),
|
|
|
01917d |
+ 0, "long");
|
|
|
01917d |
objfile_type->builtin_unsigned_long
|
|
|
01917d |
- = init_type (TYPE_CODE_INT,
|
|
|
01917d |
- gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT,
|
|
|
01917d |
- TYPE_FLAG_UNSIGNED, "unsigned long", objfile);
|
|
|
01917d |
+ = init_integer_type (objfile, gdbarch_long_bit (gdbarch),
|
|
|
01917d |
+ 1, "unsigned long");
|
|
|
01917d |
objfile_type->builtin_long_long
|
|
|
01917d |
- = init_type (TYPE_CODE_INT,
|
|
|
01917d |
- gdbarch_long_long_bit (gdbarch) / TARGET_CHAR_BIT,
|
|
|
01917d |
- 0, "long long", objfile);
|
|
|
01917d |
+ = init_integer_type (objfile, gdbarch_long_long_bit (gdbarch),
|
|
|
01917d |
+ 0, "long long");
|
|
|
01917d |
objfile_type->builtin_unsigned_long_long
|
|
|
01917d |
- = init_type (TYPE_CODE_INT,
|
|
|
01917d |
- gdbarch_long_long_bit (gdbarch) / TARGET_CHAR_BIT,
|
|
|
01917d |
- TYPE_FLAG_UNSIGNED, "unsigned long long", objfile);
|
|
|
01917d |
-
|
|
|
01917d |
+ = init_integer_type (objfile, gdbarch_long_long_bit (gdbarch),
|
|
|
01917d |
+ 1, "unsigned long long");
|
|
|
01917d |
objfile_type->builtin_float
|
|
|
01917d |
- = init_type (TYPE_CODE_FLT,
|
|
|
01917d |
- gdbarch_float_bit (gdbarch) / TARGET_CHAR_BIT,
|
|
|
01917d |
- 0, "float", objfile);
|
|
|
01917d |
- TYPE_FLOATFORMAT (objfile_type->builtin_float)
|
|
|
01917d |
- = gdbarch_float_format (gdbarch);
|
|
|
01917d |
+ = init_float_type (objfile, gdbarch_float_bit (gdbarch),
|
|
|
01917d |
+ "float", gdbarch_float_format (gdbarch));
|
|
|
01917d |
objfile_type->builtin_double
|
|
|
01917d |
- = init_type (TYPE_CODE_FLT,
|
|
|
01917d |
- gdbarch_double_bit (gdbarch) / TARGET_CHAR_BIT,
|
|
|
01917d |
- 0, "double", objfile);
|
|
|
01917d |
- TYPE_FLOATFORMAT (objfile_type->builtin_double)
|
|
|
01917d |
- = gdbarch_double_format (gdbarch);
|
|
|
01917d |
+ = init_float_type (objfile, gdbarch_double_bit (gdbarch),
|
|
|
01917d |
+ "double", gdbarch_double_format (gdbarch));
|
|
|
01917d |
objfile_type->builtin_long_double
|
|
|
01917d |
- = init_type (TYPE_CODE_FLT,
|
|
|
01917d |
- gdbarch_long_double_bit (gdbarch) / TARGET_CHAR_BIT,
|
|
|
01917d |
- 0, "long double", objfile);
|
|
|
01917d |
- TYPE_FLOATFORMAT (objfile_type->builtin_long_double)
|
|
|
01917d |
- = gdbarch_long_double_format (gdbarch);
|
|
|
01917d |
+ = init_float_type (objfile, gdbarch_long_double_bit (gdbarch),
|
|
|
01917d |
+ "long double", gdbarch_long_double_format (gdbarch));
|
|
|
01917d |
|
|
|
01917d |
/* This type represents a type that was unrecognized in symbol read-in. */
|
|
|
01917d |
objfile_type->builtin_error
|
|
|
01917d |
- = init_type (TYPE_CODE_ERROR, 0, 0, "<unknown type>", objfile);
|
|
|
01917d |
+ = init_type (objfile, TYPE_CODE_ERROR, 0, "<unknown type>");
|
|
|
01917d |
|
|
|
01917d |
/* The following set of types is used for symbols with no
|
|
|
01917d |
debug information. */
|
|
|
01917d |
objfile_type->nodebug_text_symbol
|
|
|
01917d |
- = init_type (TYPE_CODE_FUNC, 1, 0,
|
|
|
01917d |
- "<text variable, no debug info>", objfile);
|
|
|
01917d |
+ = init_type (objfile, TYPE_CODE_FUNC, 1,
|
|
|
01917d |
+ "<text variable, no debug info>");
|
|
|
01917d |
TYPE_TARGET_TYPE (objfile_type->nodebug_text_symbol)
|
|
|
01917d |
= objfile_type->builtin_int;
|
|
|
01917d |
objfile_type->nodebug_text_gnu_ifunc_symbol
|
|
|
01917d |
- = init_type (TYPE_CODE_FUNC, 1, TYPE_FLAG_GNU_IFUNC,
|
|
|
01917d |
- "<text gnu-indirect-function variable, no debug info>",
|
|
|
01917d |
- objfile);
|
|
|
01917d |
+ = init_type (objfile, TYPE_CODE_FUNC, 1,
|
|
|
01917d |
+ "<text gnu-indirect-function variable, no debug info>");
|
|
|
01917d |
TYPE_TARGET_TYPE (objfile_type->nodebug_text_gnu_ifunc_symbol)
|
|
|
01917d |
= objfile_type->nodebug_text_symbol;
|
|
|
01917d |
+ TYPE_GNU_IFUNC (objfile_type->nodebug_text_gnu_ifunc_symbol) = 1;
|
|
|
01917d |
objfile_type->nodebug_got_plt_symbol
|
|
|
01917d |
- = init_type (TYPE_CODE_PTR, gdbarch_addr_bit (gdbarch) / 8, 0,
|
|
|
01917d |
- "<text from jump slot in .got.plt, no debug info>",
|
|
|
01917d |
- objfile);
|
|
|
01917d |
- TYPE_TARGET_TYPE (objfile_type->nodebug_got_plt_symbol)
|
|
|
01917d |
- = objfile_type->nodebug_text_symbol;
|
|
|
01917d |
+ = init_pointer_type (objfile, gdbarch_addr_bit (gdbarch),
|
|
|
01917d |
+ "<text from jump slot in .got.plt, no debug info>",
|
|
|
01917d |
+ objfile_type->nodebug_text_symbol);
|
|
|
01917d |
objfile_type->nodebug_data_symbol
|
|
|
01917d |
- = init_type (TYPE_CODE_INT,
|
|
|
01917d |
- gdbarch_int_bit (gdbarch) / HOST_CHAR_BIT, 0,
|
|
|
01917d |
- "<data variable, no debug info>", objfile);
|
|
|
01917d |
+ = init_integer_type (objfile, gdbarch_int_bit (gdbarch), 0,
|
|
|
01917d |
+ "<data variable, no debug info>");
|
|
|
01917d |
objfile_type->nodebug_unknown_symbol
|
|
|
01917d |
- = init_type (TYPE_CODE_INT, 1, 0,
|
|
|
01917d |
- "<variable (not text or data), no debug info>", objfile);
|
|
|
01917d |
+ = init_integer_type (objfile, TARGET_CHAR_BIT, 0,
|
|
|
01917d |
+ "<variable (not text or data), no debug info>");
|
|
|
01917d |
objfile_type->nodebug_tls_symbol
|
|
|
01917d |
- = init_type (TYPE_CODE_INT,
|
|
|
01917d |
- gdbarch_int_bit (gdbarch) / HOST_CHAR_BIT, 0,
|
|
|
01917d |
- "<thread local variable, no debug info>", objfile);
|
|
|
01917d |
+ = init_integer_type (objfile, gdbarch_int_bit (gdbarch), 0,
|
|
|
01917d |
+ "<thread local variable, no debug info>");
|
|
|
01917d |
|
|
|
01917d |
/* NOTE: on some targets, addresses and pointers are not necessarily
|
|
|
01917d |
the same --- for example, on the D10V, pointers are 16 bits long,
|
|
|
01917d |
@@ -4482,9 +4570,8 @@
|
|
|
01917d |
are indeed in the unified virtual address space. */
|
|
|
01917d |
|
|
|
01917d |
objfile_type->builtin_core_addr
|
|
|
01917d |
- = init_type (TYPE_CODE_INT,
|
|
|
01917d |
- gdbarch_addr_bit (gdbarch) / 8,
|
|
|
01917d |
- TYPE_FLAG_UNSIGNED, "__CORE_ADDR", objfile);
|
|
|
01917d |
+ = init_integer_type (objfile, gdbarch_addr_bit (gdbarch), 1,
|
|
|
01917d |
+ "__CORE_ADDR");
|
|
|
01917d |
|
|
|
01917d |
set_objfile_data (objfile, objfile_type_data, objfile_type);
|
|
|
01917d |
return objfile_type;
|
|
|
01917d |
Index: gdb-7.6.1/gdb/gdbtypes.h
|
|
|
01917d |
===================================================================
|
|
|
01917d |
--- gdb-7.6.1.orig/gdb/gdbtypes.h 2017-03-11 21:45:27.194484312 +0100
|
|
|
01917d |
+++ gdb-7.6.1/gdb/gdbtypes.h 2017-03-11 21:45:39.100565518 +0100
|
|
|
01917d |
@@ -1542,8 +1542,21 @@
|
|
|
01917d |
extern struct gdbarch *get_type_arch (const struct type *);
|
|
|
01917d |
|
|
|
01917d |
/* Helper function to construct objfile-owned types. */
|
|
|
01917d |
-extern struct type *init_type (enum type_code, LONGEST, int, const char *,
|
|
|
01917d |
- struct objfile *);
|
|
|
01917d |
+extern struct type *init_type (struct objfile *, enum type_code, LONGEST,
|
|
|
01917d |
+ const char *);
|
|
|
01917d |
+extern struct type *init_integer_type (struct objfile *, int, int,
|
|
|
01917d |
+ const char *);
|
|
|
01917d |
+extern struct type *init_character_type (struct objfile *, int, int,
|
|
|
01917d |
+ const char *);
|
|
|
01917d |
+extern struct type *init_boolean_type (struct objfile *, int, int,
|
|
|
01917d |
+ const char *);
|
|
|
01917d |
+extern struct type *init_float_type (struct objfile *, int, const char *,
|
|
|
01917d |
+ const struct floatformat **);
|
|
|
01917d |
+extern struct type *init_decfloat_type (struct objfile *, int, const char *);
|
|
|
01917d |
+extern struct type *init_complex_type (struct objfile *, const char *,
|
|
|
01917d |
+ struct type *);
|
|
|
01917d |
+extern struct type *init_pointer_type (struct objfile *, int, const char *,
|
|
|
01917d |
+ struct type *);
|
|
|
01917d |
|
|
|
01917d |
/* Helper functions to construct architecture-owned types. */
|
|
|
01917d |
extern struct type *arch_type (struct gdbarch *, enum type_code, LONGEST,
|
|
|
01917d |
Index: gdb-7.6.1/gdb/mdebugread.c
|
|
|
01917d |
===================================================================
|
|
|
01917d |
--- gdb-7.6.1.orig/gdb/mdebugread.c 2017-03-11 21:42:28.099262777 +0100
|
|
|
01917d |
+++ gdb-7.6.1/gdb/mdebugread.c 2017-03-11 21:45:39.101565525 +0100
|
|
|
01917d |
@@ -1374,97 +1374,80 @@
|
|
|
01917d |
break;
|
|
|
01917d |
|
|
|
01917d |
case btAdr:
|
|
|
01917d |
- tp = init_type (TYPE_CODE_PTR, 4, TYPE_FLAG_UNSIGNED,
|
|
|
01917d |
- "adr_32", objfile);
|
|
|
01917d |
- TYPE_TARGET_TYPE (tp) = objfile_type (objfile)->builtin_void;
|
|
|
01917d |
+ tp = init_pointer_type (objfile, 32, "adr_32",
|
|
|
01917d |
+ objfile_type (objfile)->builtin_void);
|
|
|
01917d |
break;
|
|
|
01917d |
|
|
|
01917d |
case btChar:
|
|
|
01917d |
- tp = init_type (TYPE_CODE_INT, 1, 0,
|
|
|
01917d |
- "char", objfile);
|
|
|
01917d |
+ tp = init_integer_type (objfile, 8, 0, "char");
|
|
|
01917d |
break;
|
|
|
01917d |
|
|
|
01917d |
case btUChar:
|
|
|
01917d |
- tp = init_type (TYPE_CODE_INT, 1, TYPE_FLAG_UNSIGNED,
|
|
|
01917d |
- "unsigned char", objfile);
|
|
|
01917d |
+ tp = init_integer_type (objfile, 8, 1, "unsigned char");
|
|
|
01917d |
break;
|
|
|
01917d |
|
|
|
01917d |
case btShort:
|
|
|
01917d |
- tp = init_type (TYPE_CODE_INT, 2, 0,
|
|
|
01917d |
- "short", objfile);
|
|
|
01917d |
+ tp = init_integer_type (objfile, 16, 0, "short");
|
|
|
01917d |
break;
|
|
|
01917d |
|
|
|
01917d |
case btUShort:
|
|
|
01917d |
- tp = init_type (TYPE_CODE_INT, 2, TYPE_FLAG_UNSIGNED,
|
|
|
01917d |
- "unsigned short", objfile);
|
|
|
01917d |
+ tp = init_integer_type (objfile, 16, 1, "unsigned short");
|
|
|
01917d |
break;
|
|
|
01917d |
|
|
|
01917d |
case btInt:
|
|
|
01917d |
- tp = init_type (TYPE_CODE_INT, 4, 0,
|
|
|
01917d |
- "int", objfile);
|
|
|
01917d |
+ tp = init_integer_type (objfile, 32, 0, "int");
|
|
|
01917d |
break;
|
|
|
01917d |
|
|
|
01917d |
case btUInt:
|
|
|
01917d |
- tp = init_type (TYPE_CODE_INT, 4, TYPE_FLAG_UNSIGNED,
|
|
|
01917d |
- "unsigned int", objfile);
|
|
|
01917d |
+ tp = init_integer_type (objfile, 32, 1, "unsigned int");
|
|
|
01917d |
break;
|
|
|
01917d |
|
|
|
01917d |
case btLong:
|
|
|
01917d |
- tp = init_type (TYPE_CODE_INT, 4, 0,
|
|
|
01917d |
- "long", objfile);
|
|
|
01917d |
+ tp = init_integer_type (objfile, 32, 0, "long");
|
|
|
01917d |
break;
|
|
|
01917d |
|
|
|
01917d |
case btULong:
|
|
|
01917d |
- tp = init_type (TYPE_CODE_INT, 4, TYPE_FLAG_UNSIGNED,
|
|
|
01917d |
- "unsigned long", objfile);
|
|
|
01917d |
+ tp = init_integer_type (objfile, 32, 1, "unsigned long");
|
|
|
01917d |
break;
|
|
|
01917d |
|
|
|
01917d |
case btFloat:
|
|
|
01917d |
- tp = init_type (TYPE_CODE_FLT,
|
|
|
01917d |
- gdbarch_float_bit (gdbarch) / TARGET_CHAR_BIT, 0,
|
|
|
01917d |
- "float", objfile);
|
|
|
01917d |
+ tp = init_float_type (objfile, gdbarch_float_bit (gdbarch),
|
|
|
01917d |
+ "float", NULL);
|
|
|
01917d |
break;
|
|
|
01917d |
|
|
|
01917d |
case btDouble:
|
|
|
01917d |
- tp = init_type (TYPE_CODE_FLT,
|
|
|
01917d |
- gdbarch_double_bit (gdbarch) / TARGET_CHAR_BIT, 0,
|
|
|
01917d |
- "double", objfile);
|
|
|
01917d |
+ tp = init_float_type (objfile, gdbarch_double_bit (gdbarch),
|
|
|
01917d |
+ "double", NULL);
|
|
|
01917d |
break;
|
|
|
01917d |
|
|
|
01917d |
case btComplex:
|
|
|
01917d |
- tp = init_type (TYPE_CODE_COMPLEX,
|
|
|
01917d |
- 2 * gdbarch_float_bit (gdbarch) / TARGET_CHAR_BIT, 0,
|
|
|
01917d |
- "complex", objfile);
|
|
|
01917d |
- TYPE_TARGET_TYPE (tp) = basic_type (btFloat, objfile);
|
|
|
01917d |
+ tp = init_complex_type (objfile, "complex",
|
|
|
01917d |
+ basic_type (btFloat, objfile));
|
|
|
01917d |
break;
|
|
|
01917d |
|
|
|
01917d |
case btDComplex:
|
|
|
01917d |
- tp = init_type (TYPE_CODE_COMPLEX,
|
|
|
01917d |
- 2 * gdbarch_double_bit (gdbarch) / TARGET_CHAR_BIT, 0,
|
|
|
01917d |
- "double complex", objfile);
|
|
|
01917d |
- TYPE_TARGET_TYPE (tp) = basic_type (btDouble, objfile);
|
|
|
01917d |
+ tp = init_complex_type (objfile, "double complex",
|
|
|
01917d |
+ basic_type (btFloat, objfile));
|
|
|
01917d |
break;
|
|
|
01917d |
|
|
|
01917d |
case btFixedDec:
|
|
|
01917d |
/* We use TYPE_CODE_INT to print these as integers. Does this do any
|
|
|
01917d |
good? Would we be better off with TYPE_CODE_ERROR? Should
|
|
|
01917d |
TYPE_CODE_ERROR print things in hex if it knows the size? */
|
|
|
01917d |
- tp = init_type (TYPE_CODE_INT,
|
|
|
01917d |
- gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT, 0,
|
|
|
01917d |
- "fixed decimal", objfile);
|
|
|
01917d |
+ tp = init_integer_type (objfile, gdbarch_int_bit (gdbarch), 0,
|
|
|
01917d |
+ "fixed decimal");
|
|
|
01917d |
break;
|
|
|
01917d |
|
|
|
01917d |
case btFloatDec:
|
|
|
01917d |
- tp = init_type (TYPE_CODE_ERROR,
|
|
|
01917d |
- gdbarch_double_bit (gdbarch) / TARGET_CHAR_BIT, 0,
|
|
|
01917d |
- "floating decimal", objfile);
|
|
|
01917d |
+ tp = init_type (objfile, TYPE_CODE_ERROR,
|
|
|
01917d |
+ gdbarch_double_bit (gdbarch) / TARGET_CHAR_BIT,
|
|
|
01917d |
+ "floating decimal");
|
|
|
01917d |
break;
|
|
|
01917d |
|
|
|
01917d |
case btString:
|
|
|
01917d |
/* Is a "string" the way btString means it the same as TYPE_CODE_STRING?
|
|
|
01917d |
FIXME. */
|
|
|
01917d |
- tp = init_type (TYPE_CODE_STRING, 1, 0,
|
|
|
01917d |
- "string", objfile);
|
|
|
01917d |
+ tp = init_type (objfile, TYPE_CODE_STRING, 1, "string");
|
|
|
01917d |
break;
|
|
|
01917d |
|
|
|
01917d |
case btVoid:
|
|
|
01917d |
@@ -1472,39 +1455,32 @@
|
|
|
01917d |
break;
|
|
|
01917d |
|
|
|
01917d |
case btLong64:
|
|
|
01917d |
- tp = init_type (TYPE_CODE_INT, 8, 0,
|
|
|
01917d |
- "long", objfile);
|
|
|
01917d |
+ tp = init_integer_type (objfile, 64, 0, "long");
|
|
|
01917d |
break;
|
|
|
01917d |
|
|
|
01917d |
case btULong64:
|
|
|
01917d |
- tp = init_type (TYPE_CODE_INT, 8, TYPE_FLAG_UNSIGNED,
|
|
|
01917d |
- "unsigned long", objfile);
|
|
|
01917d |
+ tp = init_integer_type (objfile, 64, 1, "unsigned long");
|
|
|
01917d |
break;
|
|
|
01917d |
|
|
|
01917d |
case btLongLong64:
|
|
|
01917d |
- tp = init_type (TYPE_CODE_INT, 8, 0,
|
|
|
01917d |
- "long long", objfile);
|
|
|
01917d |
+ tp = init_integer_type (objfile, 64, 0, "long long");
|
|
|
01917d |
break;
|
|
|
01917d |
|
|
|
01917d |
case btULongLong64:
|
|
|
01917d |
- tp = init_type (TYPE_CODE_INT, 8, TYPE_FLAG_UNSIGNED,
|
|
|
01917d |
- "unsigned long long", objfile);
|
|
|
01917d |
+ tp = init_integer_type (objfile, 64, 1, "unsigned long long");
|
|
|
01917d |
break;
|
|
|
01917d |
|
|
|
01917d |
case btAdr64:
|
|
|
01917d |
- tp = init_type (TYPE_CODE_PTR, 8, TYPE_FLAG_UNSIGNED,
|
|
|
01917d |
- "adr_64", objfile);
|
|
|
01917d |
- TYPE_TARGET_TYPE (tp) = objfile_type (objfile)->builtin_void;
|
|
|
01917d |
+ tp = init_pointer_type (objfile, 64, "adr_64",
|
|
|
01917d |
+ objfile_type (objfile)->builtin_void);
|
|
|
01917d |
break;
|
|
|
01917d |
|
|
|
01917d |
case btInt64:
|
|
|
01917d |
- tp = init_type (TYPE_CODE_INT, 8, 0,
|
|
|
01917d |
- "int", objfile);
|
|
|
01917d |
+ tp = init_integer_type (objfile, 64, 0, "int");
|
|
|
01917d |
break;
|
|
|
01917d |
|
|
|
01917d |
case btUInt64:
|
|
|
01917d |
- tp = init_type (TYPE_CODE_INT, 8, TYPE_FLAG_UNSIGNED,
|
|
|
01917d |
- "unsigned int", objfile);
|
|
|
01917d |
+ tp = init_integer_type (objfile, 64, 1, "unsigned int");
|
|
|
01917d |
break;
|
|
|
01917d |
|
|
|
01917d |
default:
|
|
|
01917d |
@@ -1656,7 +1632,7 @@
|
|
|
01917d |
/* Try to cross reference this type, build new type on failure. */
|
|
|
01917d |
ax += cross_ref (fd, ax, &tp, type_code, &name, bigend, sym_name);
|
|
|
01917d |
if (tp == (struct type *) NULL)
|
|
|
01917d |
- tp = init_type (type_code, 0, 0, (char *) NULL, mdebugread_objfile);
|
|
|
01917d |
+ tp = init_type (mdebugread_objfile, type_code, 0, NULL);
|
|
|
01917d |
|
|
|
01917d |
/* DEC c89 produces cross references to qualified aggregate types,
|
|
|
01917d |
dereference them. */
|
|
|
01917d |
@@ -1715,7 +1691,7 @@
|
|
|
01917d |
/* Try to cross reference this type, build new type on failure. */
|
|
|
01917d |
ax += cross_ref (fd, ax, &tp, type_code, &name, bigend, sym_name);
|
|
|
01917d |
if (tp == (struct type *) NULL)
|
|
|
01917d |
- tp = init_type (type_code, 0, 0, (char *) NULL, mdebugread_objfile);
|
|
|
01917d |
+ tp = init_type (mdebugread_objfile, type_code, 0, NULL);
|
|
|
01917d |
|
|
|
01917d |
/* Make sure that TYPE_CODE(tp) has an expected type code.
|
|
|
01917d |
Any type may be returned from cross_ref if file indirect entries
|
|
|
01917d |
@@ -4433,13 +4409,13 @@
|
|
|
01917d |
}
|
|
|
01917d |
|
|
|
01917d |
/* mips cc uses a rf of -1 for opaque struct definitions.
|
|
|
01917d |
- Set TYPE_FLAG_STUB for these types so that check_typedef will
|
|
|
01917d |
+ Set TYPE_STUB for these types so that check_typedef will
|
|
|
01917d |
resolve them if the struct gets defined in another compilation unit. */
|
|
|
01917d |
if (rf == -1)
|
|
|
01917d |
{
|
|
|
01917d |
*pname = "<undefined>";
|
|
|
01917d |
- *tpp = init_type (type_code, 0, TYPE_FLAG_STUB,
|
|
|
01917d |
- (char *) NULL, mdebugread_objfile);
|
|
|
01917d |
+ *tpp = init_type (mdebugread_objfile, type_code, 0, NULL);
|
|
|
01917d |
+ TYPE_STUB (*tpp) = 1;
|
|
|
01917d |
return result;
|
|
|
01917d |
}
|
|
|
01917d |
|
|
|
01917d |
@@ -4525,8 +4501,7 @@
|
|
|
01917d |
switch (tir.bt)
|
|
|
01917d |
{
|
|
|
01917d |
case btVoid:
|
|
|
01917d |
- *tpp = init_type (type_code, 0, 0, (char *) NULL,
|
|
|
01917d |
- mdebugread_objfile);
|
|
|
01917d |
+ *tpp = init_type (mdebugread_objfile, type_code, 0, NULL);
|
|
|
01917d |
*pname = "<undefined>";
|
|
|
01917d |
break;
|
|
|
01917d |
|
|
|
01917d |
@@ -4561,8 +4536,7 @@
|
|
|
01917d |
complaint (&symfile_complaints,
|
|
|
01917d |
_("illegal bt %d in forward typedef for %s"), tir.bt,
|
|
|
01917d |
sym_name);
|
|
|
01917d |
- *tpp = init_type (type_code, 0, 0, (char *) NULL,
|
|
|
01917d |
- mdebugread_objfile);
|
|
|
01917d |
+ *tpp = init_type (mdebugread_objfile, type_code, 0, NULL);
|
|
|
01917d |
break;
|
|
|
01917d |
}
|
|
|
01917d |
return result;
|
|
|
01917d |
@@ -4590,7 +4564,7 @@
|
|
|
01917d |
has not been parsed yet.
|
|
|
01917d |
Initialize the type only, it will be filled in when
|
|
|
01917d |
it's definition is parsed. */
|
|
|
01917d |
- *tpp = init_type (type_code, 0, 0, (char *) NULL, mdebugread_objfile);
|
|
|
01917d |
+ *tpp = init_type (mdebugread_objfile, type_code, 0, NULL);
|
|
|
01917d |
}
|
|
|
01917d |
add_pending (fh, esh, *tpp);
|
|
|
01917d |
}
|
|
|
01917d |
Index: gdb-7.6.1/gdb/stabsread.c
|
|
|
01917d |
===================================================================
|
|
|
01917d |
--- gdb-7.6.1.orig/gdb/stabsread.c 2017-03-11 21:42:28.099262777 +0100
|
|
|
01917d |
+++ gdb-7.6.1/gdb/stabsread.c 2017-03-11 21:45:39.102565532 +0100
|
|
|
01917d |
@@ -2098,130 +2098,115 @@
|
|
|
01917d |
is other than 32 bits, then it should use a new negative type
|
|
|
01917d |
number (or avoid negative type numbers for that case).
|
|
|
01917d |
See stabs.texinfo. */
|
|
|
01917d |
- rettype = init_type (TYPE_CODE_INT, 4, 0, "int", objfile);
|
|
|
01917d |
+ rettype = init_integer_type (objfile, 32, 0, "int");
|
|
|
01917d |
break;
|
|
|
01917d |
case 2:
|
|
|
01917d |
- rettype = init_type (TYPE_CODE_INT, 1, 0, "char", objfile);
|
|
|
01917d |
+ rettype = init_integer_type (objfile, 8, 0, "char");
|
|
|
01917d |
break;
|
|
|
01917d |
case 3:
|
|
|
01917d |
- rettype = init_type (TYPE_CODE_INT, 2, 0, "short", objfile);
|
|
|
01917d |
+ rettype = init_integer_type (objfile, 16, 0, "short");
|
|
|
01917d |
break;
|
|
|
01917d |
case 4:
|
|
|
01917d |
- rettype = init_type (TYPE_CODE_INT, 4, 0, "long", objfile);
|
|
|
01917d |
+ rettype = init_integer_type (objfile, 32, 0, "long");
|
|
|
01917d |
break;
|
|
|
01917d |
case 5:
|
|
|
01917d |
- rettype = init_type (TYPE_CODE_INT, 1, TYPE_FLAG_UNSIGNED,
|
|
|
01917d |
- "unsigned char", objfile);
|
|
|
01917d |
+ rettype = init_integer_type (objfile, 8, 1, "unsigned char");
|
|
|
01917d |
break;
|
|
|
01917d |
case 6:
|
|
|
01917d |
- rettype = init_type (TYPE_CODE_INT, 1, 0, "signed char", objfile);
|
|
|
01917d |
+ rettype = init_integer_type (objfile, 8, 0, "signed char");
|
|
|
01917d |
break;
|
|
|
01917d |
case 7:
|
|
|
01917d |
- rettype = init_type (TYPE_CODE_INT, 2, TYPE_FLAG_UNSIGNED,
|
|
|
01917d |
- "unsigned short", objfile);
|
|
|
01917d |
+ rettype = init_integer_type (objfile, 16, 1, "unsigned short");
|
|
|
01917d |
break;
|
|
|
01917d |
case 8:
|
|
|
01917d |
- rettype = init_type (TYPE_CODE_INT, 4, TYPE_FLAG_UNSIGNED,
|
|
|
01917d |
- "unsigned int", objfile);
|
|
|
01917d |
+ rettype = init_integer_type (objfile, 32, 1, "unsigned int");
|
|
|
01917d |
break;
|
|
|
01917d |
case 9:
|
|
|
01917d |
- rettype = init_type (TYPE_CODE_INT, 4, TYPE_FLAG_UNSIGNED,
|
|
|
01917d |
- "unsigned", objfile);
|
|
|
01917d |
+ rettype = init_integer_type (objfile, 32, 1, "unsigned");
|
|
|
01917d |
break;
|
|
|
01917d |
case 10:
|
|
|
01917d |
- rettype = init_type (TYPE_CODE_INT, 4, TYPE_FLAG_UNSIGNED,
|
|
|
01917d |
- "unsigned long", objfile);
|
|
|
01917d |
+ rettype = init_integer_type (objfile, 32, 1, "unsigned long");
|
|
|
01917d |
break;
|
|
|
01917d |
case 11:
|
|
|
01917d |
- rettype = init_type (TYPE_CODE_VOID, 1, 0, "void", objfile);
|
|
|
01917d |
+ rettype = init_type (objfile, TYPE_CODE_VOID, 1, "void");
|
|
|
01917d |
break;
|
|
|
01917d |
case 12:
|
|
|
01917d |
/* IEEE single precision (32 bit). */
|
|
|
01917d |
- rettype = init_type (TYPE_CODE_FLT, 4, 0, "float", objfile);
|
|
|
01917d |
+ rettype = init_float_type (objfile, 32, "float", NULL);
|
|
|
01917d |
break;
|
|
|
01917d |
case 13:
|
|
|
01917d |
/* IEEE double precision (64 bit). */
|
|
|
01917d |
- rettype = init_type (TYPE_CODE_FLT, 8, 0, "double", objfile);
|
|
|
01917d |
+ rettype = init_float_type (objfile, 64, "double", NULL);
|
|
|
01917d |
break;
|
|
|
01917d |
case 14:
|
|
|
01917d |
/* This is an IEEE double on the RS/6000, and different machines with
|
|
|
01917d |
different sizes for "long double" should use different negative
|
|
|
01917d |
type numbers. See stabs.texinfo. */
|
|
|
01917d |
- rettype = init_type (TYPE_CODE_FLT, 8, 0, "long double", objfile);
|
|
|
01917d |
+ rettype = init_float_type (objfile, 64, "long double", NULL);
|
|
|
01917d |
break;
|
|
|
01917d |
case 15:
|
|
|
01917d |
- rettype = init_type (TYPE_CODE_INT, 4, 0, "integer", objfile);
|
|
|
01917d |
+ rettype = init_integer_type (objfile, 32, 0, "integer");
|
|
|
01917d |
break;
|
|
|
01917d |
case 16:
|
|
|
01917d |
- rettype = init_type (TYPE_CODE_BOOL, 4, TYPE_FLAG_UNSIGNED,
|
|
|
01917d |
- "boolean", objfile);
|
|
|
01917d |
+ rettype = init_boolean_type (objfile, 32, 1, "boolean");
|
|
|
01917d |
break;
|
|
|
01917d |
case 17:
|
|
|
01917d |
- rettype = init_type (TYPE_CODE_FLT, 4, 0, "short real", objfile);
|
|
|
01917d |
+ rettype = init_float_type (objfile, 32, "short real", NULL);
|
|
|
01917d |
break;
|
|
|
01917d |
case 18:
|
|
|
01917d |
- rettype = init_type (TYPE_CODE_FLT, 8, 0, "real", objfile);
|
|
|
01917d |
+ rettype = init_float_type (objfile, 64, "real", NULL);
|
|
|
01917d |
break;
|
|
|
01917d |
case 19:
|
|
|
01917d |
- rettype = init_type (TYPE_CODE_ERROR, 0, 0, "stringptr", objfile);
|
|
|
01917d |
+ rettype = init_type (objfile, TYPE_CODE_ERROR, 0, "stringptr");
|
|
|
01917d |
break;
|
|
|
01917d |
case 20:
|
|
|
01917d |
- rettype = init_type (TYPE_CODE_CHAR, 1, TYPE_FLAG_UNSIGNED,
|
|
|
01917d |
- "character", objfile);
|
|
|
01917d |
+ rettype = init_character_type (objfile, 8, 1, "character");
|
|
|
01917d |
break;
|
|
|
01917d |
case 21:
|
|
|
01917d |
- rettype = init_type (TYPE_CODE_BOOL, 1, TYPE_FLAG_UNSIGNED,
|
|
|
01917d |
- "logical*1", objfile);
|
|
|
01917d |
+ rettype = init_boolean_type (objfile, 8, 1, "logical*1");
|
|
|
01917d |
break;
|
|
|
01917d |
case 22:
|
|
|
01917d |
- rettype = init_type (TYPE_CODE_BOOL, 2, TYPE_FLAG_UNSIGNED,
|
|
|
01917d |
- "logical*2", objfile);
|
|
|
01917d |
+ rettype = init_boolean_type (objfile, 16, 1, "logical*2");
|
|
|
01917d |
break;
|
|
|
01917d |
case 23:
|
|
|
01917d |
- rettype = init_type (TYPE_CODE_BOOL, 4, TYPE_FLAG_UNSIGNED,
|
|
|
01917d |
- "logical*4", objfile);
|
|
|
01917d |
+ rettype = init_boolean_type (objfile, 32, 1, "logical*4");
|
|
|
01917d |
break;
|
|
|
01917d |
case 24:
|
|
|
01917d |
- rettype = init_type (TYPE_CODE_BOOL, 4, TYPE_FLAG_UNSIGNED,
|
|
|
01917d |
- "logical", objfile);
|
|
|
01917d |
+ rettype = init_boolean_type (objfile, 32, 1, "logical");
|
|
|
01917d |
break;
|
|
|
01917d |
case 25:
|
|
|
01917d |
/* Complex type consisting of two IEEE single precision values. */
|
|
|
01917d |
- rettype = init_type (TYPE_CODE_COMPLEX, 8, 0, "complex", objfile);
|
|
|
01917d |
- TYPE_TARGET_TYPE (rettype) = init_type (TYPE_CODE_FLT, 4, 0, "float",
|
|
|
01917d |
- objfile);
|
|
|
01917d |
+ rettype = init_complex_type (objfile, "complex",
|
|
|
01917d |
+ rs6000_builtin_type (12, objfile));
|
|
|
01917d |
break;
|
|
|
01917d |
case 26:
|
|
|
01917d |
/* Complex type consisting of two IEEE double precision values. */
|
|
|
01917d |
- rettype = init_type (TYPE_CODE_COMPLEX, 16, 0, "double complex", NULL);
|
|
|
01917d |
- TYPE_TARGET_TYPE (rettype) = init_type (TYPE_CODE_FLT, 8, 0, "double",
|
|
|
01917d |
- objfile);
|
|
|
01917d |
+ rettype = init_complex_type (objfile, "double complex",
|
|
|
01917d |
+ rs6000_builtin_type (13, objfile));
|
|
|
01917d |
break;
|
|
|
01917d |
case 27:
|
|
|
01917d |
- rettype = init_type (TYPE_CODE_INT, 1, 0, "integer*1", objfile);
|
|
|
01917d |
+ rettype = init_integer_type (objfile, 8, 0, "integer*1");
|
|
|
01917d |
break;
|
|
|
01917d |
case 28:
|
|
|
01917d |
- rettype = init_type (TYPE_CODE_INT, 2, 0, "integer*2", objfile);
|
|
|
01917d |
+ rettype = init_integer_type (objfile, 16, 0, "integer*2");
|
|
|
01917d |
break;
|
|
|
01917d |
case 29:
|
|
|
01917d |
- rettype = init_type (TYPE_CODE_INT, 4, 0, "integer*4", objfile);
|
|
|
01917d |
+ rettype = init_integer_type (objfile, 32, 0, "integer*4");
|
|
|
01917d |
break;
|
|
|
01917d |
case 30:
|
|
|
01917d |
- rettype = init_type (TYPE_CODE_CHAR, 2, 0, "wchar", objfile);
|
|
|
01917d |
+ rettype = init_character_type (objfile, 16, 0, "wchar");
|
|
|
01917d |
break;
|
|
|
01917d |
case 31:
|
|
|
01917d |
- rettype = init_type (TYPE_CODE_INT, 8, 0, "long long", objfile);
|
|
|
01917d |
+ rettype = init_integer_type (objfile, 64, 0, "long long");
|
|
|
01917d |
break;
|
|
|
01917d |
case 32:
|
|
|
01917d |
- rettype = init_type (TYPE_CODE_INT, 8, TYPE_FLAG_UNSIGNED,
|
|
|
01917d |
- "unsigned long long", objfile);
|
|
|
01917d |
+ rettype = init_integer_type (objfile, 64, 1, "unsigned long long");
|
|
|
01917d |
break;
|
|
|
01917d |
case 33:
|
|
|
01917d |
- rettype = init_type (TYPE_CODE_INT, 8, TYPE_FLAG_UNSIGNED,
|
|
|
01917d |
- "logical*8", objfile);
|
|
|
01917d |
+ rettype = init_integer_type (objfile, 64, 1, "logical*8");
|
|
|
01917d |
break;
|
|
|
01917d |
case 34:
|
|
|
01917d |
- rettype = init_type (TYPE_CODE_INT, 8, 0, "integer*8", objfile);
|
|
|
01917d |
+ rettype = init_integer_type (objfile, 64, 0, "integer*8");
|
|
|
01917d |
break;
|
|
|
01917d |
}
|
|
|
01917d |
negative_types[-typenum] = rettype;
|
|
|
01917d |
@@ -3757,16 +3742,16 @@
|
|
|
01917d |
{
|
|
|
01917d |
int type_bits;
|
|
|
01917d |
int nbits;
|
|
|
01917d |
- int signed_type;
|
|
|
01917d |
- enum type_code code = TYPE_CODE_INT;
|
|
|
01917d |
+ int unsigned_type;
|
|
|
01917d |
+ int boolean_type = 0;
|
|
|
01917d |
|
|
|
01917d |
switch (**pp)
|
|
|
01917d |
{
|
|
|
01917d |
case 's':
|
|
|
01917d |
- signed_type = 1;
|
|
|
01917d |
+ unsigned_type = 0;
|
|
|
01917d |
break;
|
|
|
01917d |
case 'u':
|
|
|
01917d |
- signed_type = 0;
|
|
|
01917d |
+ unsigned_type = 1;
|
|
|
01917d |
break;
|
|
|
01917d |
default:
|
|
|
01917d |
return error_type (pp, objfile);
|
|
|
01917d |
@@ -3783,7 +3768,7 @@
|
|
|
01917d |
(*pp)++;
|
|
|
01917d |
else if (**pp == 'b')
|
|
|
01917d |
{
|
|
|
01917d |
- code = TYPE_CODE_BOOL;
|
|
|
01917d |
+ boolean_type = 1;
|
|
|
01917d |
(*pp)++;
|
|
|
01917d |
}
|
|
|
01917d |
|
|
|
01917d |
@@ -3814,14 +3799,17 @@
|
|
|
01917d |
++(*pp);
|
|
|
01917d |
|
|
|
01917d |
if (type_bits == 0)
|
|
|
01917d |
- return init_type (TYPE_CODE_VOID, 1,
|
|
|
01917d |
- signed_type ? 0 : TYPE_FLAG_UNSIGNED, (char *) NULL,
|
|
|
01917d |
- objfile);
|
|
|
01917d |
+ {
|
|
|
01917d |
+ struct type *type = init_type (objfile, TYPE_CODE_VOID, 1, NULL);
|
|
|
01917d |
+ if (unsigned_type)
|
|
|
01917d |
+ TYPE_UNSIGNED (type) = 1;
|
|
|
01917d |
+ return type;
|
|
|
01917d |
+ }
|
|
|
01917d |
+
|
|
|
01917d |
+ if (boolean_type)
|
|
|
01917d |
+ return init_boolean_type (objfile, type_bits, unsigned_type, NULL);
|
|
|
01917d |
else
|
|
|
01917d |
- return init_type (code,
|
|
|
01917d |
- type_bits / TARGET_CHAR_BIT,
|
|
|
01917d |
- signed_type ? 0 : TYPE_FLAG_UNSIGNED, (char *) NULL,
|
|
|
01917d |
- objfile);
|
|
|
01917d |
+ return init_integer_type (objfile, type_bits, unsigned_type, NULL);
|
|
|
01917d |
}
|
|
|
01917d |
|
|
|
01917d |
static struct type *
|
|
|
01917d |
@@ -3843,16 +3831,16 @@
|
|
|
01917d |
if (nbits != 0)
|
|
|
01917d |
return error_type (pp, objfile);
|
|
|
01917d |
|
|
|
01917d |
+ nbits = nbytes * TARGET_CHAR_BIT;
|
|
|
01917d |
+
|
|
|
01917d |
if (details == NF_COMPLEX || details == NF_COMPLEX16
|
|
|
01917d |
|| details == NF_COMPLEX32)
|
|
|
01917d |
{
|
|
|
01917d |
- rettype = init_type (TYPE_CODE_COMPLEX, nbytes, 0, NULL, objfile);
|
|
|
01917d |
- TYPE_TARGET_TYPE (rettype)
|
|
|
01917d |
- = init_type (TYPE_CODE_FLT, nbytes / 2, 0, NULL, objfile);
|
|
|
01917d |
- return rettype;
|
|
|
01917d |
+ rettype = init_float_type (objfile, nbits / 2, NULL, NULL);
|
|
|
01917d |
+ return init_complex_type (objfile, NULL, rettype);
|
|
|
01917d |
}
|
|
|
01917d |
|
|
|
01917d |
- return init_type (TYPE_CODE_FLT, nbytes, 0, NULL, objfile);
|
|
|
01917d |
+ return init_float_type (objfile, nbits, NULL, NULL);
|
|
|
01917d |
}
|
|
|
01917d |
|
|
|
01917d |
/* Read a number from the string pointed to by *PP.
|
|
|
01917d |
@@ -4115,18 +4103,14 @@
|
|
|
01917d |
}
|
|
|
01917d |
|
|
|
01917d |
if (got_signed || got_unsigned)
|
|
|
01917d |
- {
|
|
|
01917d |
- return init_type (TYPE_CODE_INT, nbits / TARGET_CHAR_BIT,
|
|
|
01917d |
- got_unsigned ? TYPE_FLAG_UNSIGNED : 0, NULL,
|
|
|
01917d |
- objfile);
|
|
|
01917d |
- }
|
|
|
01917d |
+ return init_integer_type (objfile, nbits, got_unsigned, NULL);
|
|
|
01917d |
else
|
|
|
01917d |
return error_type (pp, objfile);
|
|
|
01917d |
}
|
|
|
01917d |
|
|
|
01917d |
/* A type defined as a subrange of itself, with bounds both 0, is void. */
|
|
|
01917d |
if (self_subrange && n2 == 0 && n3 == 0)
|
|
|
01917d |
- return init_type (TYPE_CODE_VOID, 1, 0, NULL, objfile);
|
|
|
01917d |
+ return init_type (objfile, TYPE_CODE_VOID, 1, NULL);
|
|
|
01917d |
|
|
|
01917d |
/* If n3 is zero and n2 is positive, we want a floating type, and n2
|
|
|
01917d |
is the width in bytes.
|
|
|
01917d |
@@ -4143,16 +4127,10 @@
|
|
|
01917d |
if (n3 == 0 && n2 > 0)
|
|
|
01917d |
{
|
|
|
01917d |
struct type *float_type
|
|
|
01917d |
- = init_type (TYPE_CODE_FLT, n2, 0, NULL, objfile);
|
|
|
01917d |
+ = init_float_type (objfile, n2 * TARGET_CHAR_BIT, NULL, NULL);
|
|
|
01917d |
|
|
|
01917d |
if (self_subrange)
|
|
|
01917d |
- {
|
|
|
01917d |
- struct type *complex_type =
|
|
|
01917d |
- init_type (TYPE_CODE_COMPLEX, 2 * n2, 0, NULL, objfile);
|
|
|
01917d |
-
|
|
|
01917d |
- TYPE_TARGET_TYPE (complex_type) = float_type;
|
|
|
01917d |
- return complex_type;
|
|
|
01917d |
- }
|
|
|
01917d |
+ return init_complex_type (objfile, NULL, float_type);
|
|
|
01917d |
else
|
|
|
01917d |
return float_type;
|
|
|
01917d |
}
|
|
|
01917d |
@@ -4171,15 +4149,17 @@
|
|
|
01917d |
bits = gdbarch_int_bit (gdbarch);
|
|
|
01917d |
}
|
|
|
01917d |
|
|
|
01917d |
- return init_type (TYPE_CODE_INT, bits / TARGET_CHAR_BIT,
|
|
|
01917d |
- TYPE_FLAG_UNSIGNED, NULL, objfile);
|
|
|
01917d |
+ return init_integer_type (objfile, bits, 1, NULL);
|
|
|
01917d |
}
|
|
|
01917d |
|
|
|
01917d |
/* Special case: char is defined (Who knows why) as a subrange of
|
|
|
01917d |
itself with range 0-127. */
|
|
|
01917d |
else if (self_subrange && n2 == 0 && n3 == 127)
|
|
|
01917d |
- return init_type (TYPE_CODE_INT, 1, TYPE_FLAG_NOSIGN, NULL, objfile);
|
|
|
01917d |
-
|
|
|
01917d |
+ {
|
|
|
01917d |
+ struct type *type = init_integer_type (objfile, 1, 0, NULL);
|
|
|
01917d |
+ TYPE_NOSIGN (type) = 1;
|
|
|
01917d |
+ return type;
|
|
|
01917d |
+ }
|
|
|
01917d |
/* We used to do this only for subrange of self or subrange of int. */
|
|
|
01917d |
else if (n2 == 0)
|
|
|
01917d |
{
|
|
|
01917d |
@@ -4189,8 +4169,7 @@
|
|
|
01917d |
|
|
|
01917d |
if (n3 < 0)
|
|
|
01917d |
/* n3 actually gives the size. */
|
|
|
01917d |
- return init_type (TYPE_CODE_INT, -n3, TYPE_FLAG_UNSIGNED,
|
|
|
01917d |
- NULL, objfile);
|
|
|
01917d |
+ return init_integer_type (objfile, -n3 * TARGET_CHAR_BIT, 1, NULL);
|
|
|
01917d |
|
|
|
01917d |
/* Is n3 == 2**(8n)-1 for some integer n? Then it's an
|
|
|
01917d |
unsigned n-byte integer. But do require n to be a power of
|
|
|
01917d |
@@ -4204,8 +4183,7 @@
|
|
|
01917d |
bits >>= 8;
|
|
|
01917d |
if (bits == 0
|
|
|
01917d |
&& ((bytes - 1) & bytes) == 0) /* "bytes is a power of two" */
|
|
|
01917d |
- return init_type (TYPE_CODE_INT, bytes, TYPE_FLAG_UNSIGNED, NULL,
|
|
|
01917d |
- objfile);
|
|
|
01917d |
+ return init_integer_type (objfile, bytes * TARGET_CHAR_BIT, 1, NULL);
|
|
|
01917d |
}
|
|
|
01917d |
}
|
|
|
01917d |
/* I think this is for Convex "long long". Since I don't know whether
|
|
|
01917d |
@@ -4215,15 +4193,15 @@
|
|
|
01917d |
&& (self_subrange
|
|
|
01917d |
|| n2 == -gdbarch_long_long_bit
|
|
|
01917d |
(gdbarch) / TARGET_CHAR_BIT))
|
|
|
01917d |
- return init_type (TYPE_CODE_INT, -n2, 0, NULL, objfile);
|
|
|
01917d |
+ return init_integer_type (objfile, -n2 * TARGET_CHAR_BIT, 0, NULL);
|
|
|
01917d |
else if (n2 == -n3 - 1)
|
|
|
01917d |
{
|
|
|
01917d |
if (n3 == 0x7f)
|
|
|
01917d |
- return init_type (TYPE_CODE_INT, 1, 0, NULL, objfile);
|
|
|
01917d |
+ return init_integer_type (objfile, 8, 0, NULL);
|
|
|
01917d |
if (n3 == 0x7fff)
|
|
|
01917d |
- return init_type (TYPE_CODE_INT, 2, 0, NULL, objfile);
|
|
|
01917d |
+ return init_integer_type (objfile, 16, 0, NULL);
|
|
|
01917d |
if (n3 == 0x7fffffff)
|
|
|
01917d |
- return init_type (TYPE_CODE_INT, 4, 0, NULL, objfile);
|
|
|
01917d |
+ return init_integer_type (objfile, 32, 0, NULL);
|
|
|
01917d |
}
|
|
|
01917d |
|
|
|
01917d |
/* We have a real range type on our hands. Allocate space and
|