|
|
01917d |
commit 88dfca6c43c11dea69db24cfb87e6821e63e29b2
|
|
|
01917d |
Author: Ulrich Weigand <ulrich.weigand@de.ibm.com>
|
|
|
01917d |
Date: Tue Sep 6 17:26:32 2016 +0200
|
|
|
01917d |
|
|
|
01917d |
Add some missing arch_..._type helpers
|
|
|
01917d |
|
|
|
01917d |
gdbtypes provides a number of helper routines that can be called instead of
|
|
|
01917d |
using arch_type directly to create a type of a particular kind. This patch
|
|
|
01917d |
adds two additional such routines that have been missing so far, to allow
|
|
|
01917d |
creation of TYPE_CODE_DECFLOAT and TYPE_CODE_POINTER types.
|
|
|
01917d |
|
|
|
01917d |
The patch also changes a number of places to use the new helper routines
|
|
|
01917d |
instead of calling arch_type directly. No functional change intended.
|
|
|
01917d |
|
|
|
01917d |
gdb/ChangeLog:
|
|
|
01917d |
|
|
|
01917d |
* gdbtypes.h (arch_decfloat_type): New prototype.
|
|
|
01917d |
(arch_pointer_type): Likewise.
|
|
|
01917d |
* gdbtypes.c (arch_decfloat_type): New function.
|
|
|
01917d |
(arch_pointer_type): Likewise.
|
|
|
01917d |
(gdbtypes_post_init): Use arch_decfloat_type.
|
|
|
01917d |
* avr-tdep.c (avr_gdbarch_init): Use arch_pointer_type.
|
|
|
01917d |
* ft32-tdep.c (ft32_gdbarch_init): Likewise.
|
|
|
01917d |
* m32c-tdep.c (make_types): Likewise.
|
|
|
01917d |
* rl78-tdep.c (rl78_gdbarch_init): Likewise.
|
|
|
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,17 @@
|
|
|
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 |
+ (arch_pointer_type): Likewise.
|
|
|
01917d |
+ (gdbtypes_post_init): Use arch_decfloat_type.
|
|
|
01917d |
+ * avr-tdep.c (avr_gdbarch_init): Use arch_pointer_type.
|
|
|
01917d |
+ * ft32-tdep.c (ft32_gdbarch_init): Likewise.
|
|
|
01917d |
+ * m32c-tdep.c (make_types): Likewise.
|
|
|
01917d |
+ * rl78-tdep.c (rl78_gdbarch_init): Likewise.
|
|
|
01917d |
+
|
|
|
01917d |
+2016-09-05 Ulrich Weigand <uweigand@de.ibm.com>
|
|
|
01917d |
+
|
|
|
01917d |
* gdbtypes.c (set_type_code): New function.
|
|
|
01917d |
(init_type, arch_type): Use it.
|
|
|
01917d |
|
|
|
01917d |
Index: gdb-7.6.1/gdb/avr-tdep.c
|
|
|
01917d |
===================================================================
|
|
|
01917d |
--- gdb-7.6.1.orig/gdb/avr-tdep.c 2017-03-11 21:27:41.914206796 +0100
|
|
|
01917d |
+++ gdb-7.6.1/gdb/avr-tdep.c 2017-03-11 21:27:46.928242088 +0100
|
|
|
01917d |
@@ -1390,9 +1390,8 @@
|
|
|
01917d |
be defined. */
|
|
|
01917d |
tdep->void_type = arch_type (gdbarch, TYPE_CODE_VOID, 1, "void");
|
|
|
01917d |
tdep->func_void_type = make_function_type (tdep->void_type, NULL);
|
|
|
01917d |
- tdep->pc_type = arch_type (gdbarch, TYPE_CODE_PTR, 4, NULL);
|
|
|
01917d |
- TYPE_TARGET_TYPE (tdep->pc_type) = tdep->func_void_type;
|
|
|
01917d |
- TYPE_UNSIGNED (tdep->pc_type) = 1;
|
|
|
01917d |
+ tdep->pc_type = arch_pointer_type (gdbarch, 4 * TARGET_CHAR_BIT, NULL,
|
|
|
01917d |
+ tdep->func_void_type);
|
|
|
01917d |
|
|
|
01917d |
set_gdbarch_short_bit (gdbarch, 2 * TARGET_CHAR_BIT);
|
|
|
01917d |
set_gdbarch_int_bit (gdbarch, 2 * TARGET_CHAR_BIT);
|
|
|
01917d |
Index: gdb-7.6.1/gdb/gdbtypes.c
|
|
|
01917d |
===================================================================
|
|
|
01917d |
--- gdb-7.6.1.orig/gdb/gdbtypes.c 2017-03-11 21:27:41.914206796 +0100
|
|
|
01917d |
+++ gdb-7.6.1/gdb/gdbtypes.c 2017-03-11 21:29:16.324862413 +0100
|
|
|
01917d |
@@ -3932,7 +3932,7 @@
|
|
|
01917d |
|
|
|
01917d |
struct type *
|
|
|
01917d |
arch_type (struct gdbarch *gdbarch,
|
|
|
01917d |
- enum type_code code, LONGEST length, char *name)
|
|
|
01917d |
+ enum type_code code, LONGEST length, const char *name)
|
|
|
01917d |
{
|
|
|
01917d |
struct type *type;
|
|
|
01917d |
|
|
|
01917d |
@@ -4023,6 +4023,18 @@
|
|
|
01917d |
return t;
|
|
|
01917d |
}
|
|
|
01917d |
|
|
|
01917d |
+/* Allocate a TYPE_CODE_DECFLOAT type structure associated with GDBARCH.
|
|
|
01917d |
+ BIT is the type size in bits. NAME is the type name. */
|
|
|
01917d |
+
|
|
|
01917d |
+struct type *
|
|
|
01917d |
+arch_decfloat_type (struct gdbarch *gdbarch, int bit, const char *name)
|
|
|
01917d |
+{
|
|
|
01917d |
+ struct type *t;
|
|
|
01917d |
+
|
|
|
01917d |
+ t = arch_type (gdbarch, TYPE_CODE_DECFLOAT, bit / TARGET_CHAR_BIT, name);
|
|
|
01917d |
+ return t;
|
|
|
01917d |
+}
|
|
|
01917d |
+
|
|
|
01917d |
/* Allocate a TYPE_CODE_COMPLEX type structure associated with GDBARCH.
|
|
|
01917d |
NAME is the type name. TARGET_TYPE is the component float type. */
|
|
|
01917d |
|
|
|
01917d |
@@ -4038,6 +4050,23 @@
|
|
|
01917d |
return t;
|
|
|
01917d |
}
|
|
|
01917d |
|
|
|
01917d |
+/* Allocate a TYPE_CODE_PTR type structure associated with GDBARCH.
|
|
|
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 |
+arch_pointer_type (struct gdbarch *gdbarch,
|
|
|
01917d |
+ int bit, const char *name, struct type *target_type)
|
|
|
01917d |
+{
|
|
|
01917d |
+ struct type *t;
|
|
|
01917d |
+
|
|
|
01917d |
+ t = arch_type (gdbarch, 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 |
/* Allocate a TYPE_CODE_FLAGS type structure associated with GDBARCH.
|
|
|
01917d |
NAME is the type name. LENGTH is the size of the flag word in bytes. */
|
|
|
01917d |
|
|
|
01917d |
@@ -4235,11 +4264,11 @@
|
|
|
01917d |
/* The following three are about decimal floating point types, which
|
|
|
01917d |
are 32-bits, 64-bits and 128-bits respectively. */
|
|
|
01917d |
builtin_type->builtin_decfloat
|
|
|
01917d |
- = arch_type (gdbarch, TYPE_CODE_DECFLOAT, 32 / 8, "_Decimal32");
|
|
|
01917d |
+ = arch_decfloat_type (gdbarch, 32, "_Decimal32");
|
|
|
01917d |
builtin_type->builtin_decdouble
|
|
|
01917d |
- = arch_type (gdbarch, TYPE_CODE_DECFLOAT, 64 / 8, "_Decimal64");
|
|
|
01917d |
+ = arch_decfloat_type (gdbarch, 64, "_Decimal64");
|
|
|
01917d |
builtin_type->builtin_declong
|
|
|
01917d |
- = arch_type (gdbarch, TYPE_CODE_DECFLOAT, 128 / 8, "_Decimal128");
|
|
|
01917d |
+ = arch_decfloat_type (gdbarch, 128, "_Decimal128");
|
|
|
01917d |
|
|
|
01917d |
/* "True" character types. */
|
|
|
01917d |
builtin_type->builtin_true_char
|
|
|
01917d |
Index: gdb-7.6.1/gdb/gdbtypes.h
|
|
|
01917d |
===================================================================
|
|
|
01917d |
--- gdb-7.6.1.orig/gdb/gdbtypes.h 2017-03-11 21:27:41.914206796 +0100
|
|
|
01917d |
+++ gdb-7.6.1/gdb/gdbtypes.h 2017-03-11 21:29:02.861770587 +0100
|
|
|
01917d |
@@ -1547,14 +1547,17 @@
|
|
|
01917d |
|
|
|
01917d |
/* Helper functions to construct architecture-owned types. */
|
|
|
01917d |
extern struct type *arch_type (struct gdbarch *, enum type_code, LONGEST,
|
|
|
01917d |
- char *);
|
|
|
01917d |
+ const char *);
|
|
|
01917d |
extern struct type *arch_integer_type (struct gdbarch *, int, int, char *);
|
|
|
01917d |
extern struct type *arch_character_type (struct gdbarch *, int, int, char *);
|
|
|
01917d |
extern struct type *arch_boolean_type (struct gdbarch *, int, int, char *);
|
|
|
01917d |
extern struct type *arch_float_type (struct gdbarch *, int, char *,
|
|
|
01917d |
const struct floatformat **);
|
|
|
01917d |
+extern struct type *arch_decfloat_type (struct gdbarch *, int, const char *);
|
|
|
01917d |
extern struct type *arch_complex_type (struct gdbarch *, char *,
|
|
|
01917d |
struct type *);
|
|
|
01917d |
+extern struct type *arch_pointer_type (struct gdbarch *, int, const char *,
|
|
|
01917d |
+ struct type *);
|
|
|
01917d |
|
|
|
01917d |
/* Helper functions to construct a struct or record type. An
|
|
|
01917d |
initially empty type is created using arch_composite_type().
|
|
|
01917d |
Index: gdb-7.6.1/gdb/m32c-tdep.c
|
|
|
01917d |
===================================================================
|
|
|
01917d |
--- gdb-7.6.1.orig/gdb/m32c-tdep.c 2017-03-11 21:27:41.914206796 +0100
|
|
|
01917d |
+++ gdb-7.6.1/gdb/m32c-tdep.c 2017-03-11 21:27:46.930242102 +0100
|
|
|
01917d |
@@ -194,27 +194,18 @@
|
|
|
01917d |
this is called, so we avoid using them. */
|
|
|
01917d |
tdep->voyd = arch_type (arch, TYPE_CODE_VOID, 1, "void");
|
|
|
01917d |
tdep->ptr_voyd
|
|
|
01917d |
- = arch_type (arch, TYPE_CODE_PTR, gdbarch_ptr_bit (arch) / TARGET_CHAR_BIT,
|
|
|
01917d |
- NULL);
|
|
|
01917d |
- TYPE_TARGET_TYPE (tdep->ptr_voyd) = tdep->voyd;
|
|
|
01917d |
- TYPE_UNSIGNED (tdep->ptr_voyd) = 1;
|
|
|
01917d |
+ = arch_pointer_type (arch, gdbarch_ptr_bit (arch), NULL, tdep->voyd);
|
|
|
01917d |
tdep->func_voyd = lookup_function_type (tdep->voyd);
|
|
|
01917d |
|
|
|
01917d |
xsnprintf (type_name, sizeof (type_name), "%s_data_addr_t",
|
|
|
01917d |
gdbarch_bfd_arch_info (arch)->printable_name);
|
|
|
01917d |
tdep->data_addr_reg_type
|
|
|
01917d |
- = arch_type (arch, TYPE_CODE_PTR, data_addr_reg_bits / TARGET_CHAR_BIT,
|
|
|
01917d |
- xstrdup (type_name));
|
|
|
01917d |
- TYPE_TARGET_TYPE (tdep->data_addr_reg_type) = tdep->voyd;
|
|
|
01917d |
- TYPE_UNSIGNED (tdep->data_addr_reg_type) = 1;
|
|
|
01917d |
+ = arch_pointer_type (arch, data_addr_reg_bits, type_name, tdep->voyd);
|
|
|
01917d |
|
|
|
01917d |
xsnprintf (type_name, sizeof (type_name), "%s_code_addr_t",
|
|
|
01917d |
gdbarch_bfd_arch_info (arch)->printable_name);
|
|
|
01917d |
tdep->code_addr_reg_type
|
|
|
01917d |
- = arch_type (arch, TYPE_CODE_PTR, code_addr_reg_bits / TARGET_CHAR_BIT,
|
|
|
01917d |
- xstrdup (type_name));
|
|
|
01917d |
- TYPE_TARGET_TYPE (tdep->code_addr_reg_type) = tdep->func_voyd;
|
|
|
01917d |
- TYPE_UNSIGNED (tdep->code_addr_reg_type) = 1;
|
|
|
01917d |
+ = arch_pointer_type (arch, code_addr_reg_bits, type_name, tdep->func_voyd);
|
|
|
01917d |
|
|
|
01917d |
tdep->uint8 = arch_integer_type (arch, 8, 1, "uint8_t");
|
|
|
01917d |
tdep->uint16 = arch_integer_type (arch, 16, 1, "uint16_t");
|