* RFA: shrink main_type
@ 2008-08-17 18:50 Tom Tromey
2008-08-18 13:01 ` Joel Brobecker
0 siblings, 1 reply; 25+ messages in thread
From: Tom Tromey @ 2008-08-17 18:50 UTC (permalink / raw)
To: gdb-patches
This patch shrinks struct main_type 32- and 64-bit machines by
shrinking the type_code and flags fields and moving around a couple
other fields.
On my x86 box, this saves about 1% of memory on "gdb -readnow cc1" --
a few hundred K -- at the cost of slightly increasing gdb's text size.
I turned the TYPE_FLAG_* defines into an enum to ensure that we'd get
a warning if we ever overflow the 'flags' field.
I noticed that the Ada code does not use TYPE_FLAG_* consistently with
the rest of gdb (it tests the flags directly rather than using the
macros), but I didn't change this.
Built & regtested on x86-64. Ok?
Tom
:ADDPATCH types:
2008-08-17 Tom Tromey <tromey@redhat.com>
* gdbtypes.h (enum type_flag_value): New enum.
(TYPE_FLAG_UNSIGNED, TYPE_FLAG_NOSIGN, TYPE_FLAG_STUB,
TYPE_FLAG_TARGET_STUB, TYPE_FLAG_STATIC, TYPE_FLAG_CONST,
TYPE_FLAG_VOLATILE, TYPE_FLAG_PROTOTYPED, TYPE_FLAG_INCOMPLETE,
TYPE_FLAG_CODE_SPACE, TYPE_FLAG_DATA_SPACE, TYPE_FLAG_VARARGS,
TYPE_FLAG_VECTOR, TYPE_FLAG_ADDRESS_CLASS_1,
TYPE_FLAG_ADDRESS_CLASS_2, TYPE_FLAG_FIXED_INSTANCE,
TYPE_FLAG_STUB_SUPPORTED, TYPE_FLAG_NOTTEXT): Now enum constants.
(struct main_type) <code>: Now 5 bits.
<flags>: Move earlier. Now a bit field.
<nfields, vptr_fieldno>: Move earlier.
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 7ef7d67..5948a8d 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -144,26 +144,47 @@ enum type_code
#define TYPE_CODE_CLASS TYPE_CODE_STRUCT
-/* Some bits for the type's flags word, and macros to test them. */
+/* Some bits for the type's flags word, and macros to test them. See
+ the bit-testing code, below, for documentation of each constant in
+ this enum. */
+
+enum type_flag_value
+{
+ TYPE_FLAG_UNSIGNED = (1 << 0),
+ TYPE_FLAG_NOSIGN = (1 << 1),
+ TYPE_FLAG_STUB = (1 << 2),
+ TYPE_FLAG_TARGET_STUB = (1 << 3),
+ TYPE_FLAG_STATIC = (1 << 4),
+ TYPE_FLAG_CONST = (1 << 5),
+ TYPE_FLAG_VOLATILE = (1 << 6),
+ TYPE_FLAG_PROTOTYPED = (1 << 7),
+ TYPE_FLAG_INCOMPLETE = (1 << 8),
+ TYPE_FLAG_CODE_SPACE = (1 << 9),
+ TYPE_FLAG_DATA_SPACE = (1 << 10),
+ TYPE_FLAG_VARARGS = (1 << 11),
+ TYPE_FLAG_VECTOR = (1 << 12),
+ TYPE_FLAG_ADDRESS_CLASS_1 = (1 << 13),
+ TYPE_FLAG_ADDRESS_CLASS_2 = (1 << 14),
+ TYPE_FLAG_FIXED_INSTANCE = (1 << 15),
+ TYPE_FLAG_STUB_SUPPORTED = (1 << 16),
+ TYPE_FLAG_NOTTEXT = (1 << 17)
+};
/* Unsigned integer type. If this is not set for a TYPE_CODE_INT, the
type is signed (unless TYPE_FLAG_NOSIGN (below) is set). */
-#define TYPE_FLAG_UNSIGNED (1 << 0)
#define TYPE_UNSIGNED(t) (TYPE_FLAGS (t) & TYPE_FLAG_UNSIGNED)
/* No sign for this type. In C++, "char", "signed char", and "unsigned
char" are distinct types; so we need an extra flag to indicate the
absence of a sign! */
-#define TYPE_FLAG_NOSIGN (1 << 1)
#define TYPE_NOSIGN(t) (TYPE_FLAGS (t) & TYPE_FLAG_NOSIGN)
/* This appears in a type's flags word if it is a stub type (e.g., if
someone referenced a type that wasn't defined in a source file
via (struct sir_not_appearing_in_this_film *)). */
-#define TYPE_FLAG_STUB (1 << 2)
#define TYPE_STUB(t) (TYPE_FLAGS (t) & TYPE_FLAG_STUB)
/* The target type of this type is a stub type, and this type needs to
@@ -172,7 +193,6 @@ enum type_code
gets set based on the TYPE_LENGTH of the target type.
Also, set for TYPE_CODE_TYPEDEF. */
-#define TYPE_FLAG_TARGET_STUB (1 << 3)
#define TYPE_TARGET_STUB(t) (TYPE_FLAGS (t) & TYPE_FLAG_TARGET_STUB)
/* Static type. If this is set, the corresponding type had
@@ -181,21 +201,18 @@ enum type_code
* are indicated by other means (bitpos == -1)
*/
-#define TYPE_FLAG_STATIC (1 << 4)
#define TYPE_STATIC(t) (TYPE_FLAGS (t) & TYPE_FLAG_STATIC)
/* Constant type. If this is set, the corresponding type has a
* const modifier.
*/
-#define TYPE_FLAG_CONST (1 << 5)
#define TYPE_CONST(t) (TYPE_INSTANCE_FLAGS (t) & TYPE_FLAG_CONST)
/* Volatile type. If this is set, the corresponding type has a
* volatile modifier.
*/
-#define TYPE_FLAG_VOLATILE (1 << 6)
#define TYPE_VOLATILE(t) (TYPE_INSTANCE_FLAGS (t) & TYPE_FLAG_VOLATILE)
@@ -203,7 +220,6 @@ enum type_code
for function calls in order to tell us if it's necessary to coerce the args,
or to just do the standard conversions. This is used with a short field. */
-#define TYPE_FLAG_PROTOTYPED (1 << 7)
#define TYPE_PROTOTYPED(t) (TYPE_FLAGS (t) & TYPE_FLAG_PROTOTYPED)
/* This flag is used to indicate that processing for this type
@@ -214,7 +230,6 @@ enum type_code
info; the incomplete type has to be marked so that the class and
the method can be assigned correct types.) */
-#define TYPE_FLAG_INCOMPLETE (1 << 8)
#define TYPE_INCOMPLETE(t) (TYPE_FLAGS (t) & TYPE_FLAG_INCOMPLETE)
/* Instruction-space delimited type. This is for Harvard architectures
@@ -236,22 +251,18 @@ enum type_code
If neither flag is set, the default space for functions / methods
is instruction space, and for data objects is data memory. */
-#define TYPE_FLAG_CODE_SPACE (1 << 9)
#define TYPE_CODE_SPACE(t) (TYPE_INSTANCE_FLAGS (t) & TYPE_FLAG_CODE_SPACE)
-#define TYPE_FLAG_DATA_SPACE (1 << 10)
#define TYPE_DATA_SPACE(t) (TYPE_INSTANCE_FLAGS (t) & TYPE_FLAG_DATA_SPACE)
/* FIXME drow/2002-06-03: Only used for methods, but applies as well
to functions. */
-#define TYPE_FLAG_VARARGS (1 << 11)
#define TYPE_VARARGS(t) (TYPE_FLAGS (t) & TYPE_FLAG_VARARGS)
/* Identify a vector type. Gcc is handling this by adding an extra
attribute to the array type. We slurp that in as a new flag of a
type. This is used only in dwarf2read.c. */
-#define TYPE_FLAG_VECTOR (1 << 12)
#define TYPE_VECTOR(t) (TYPE_FLAGS (t) & TYPE_FLAG_VECTOR)
/* Address class flags. Some environments provide for pointers whose
@@ -259,10 +270,8 @@ enum type_code
where the bits are interpreted differently than normal addresses. The
TYPE_FLAG_ADDRESS_CLASS_n flags may be used in target specific
ways to represent these different types of address classes. */
-#define TYPE_FLAG_ADDRESS_CLASS_1 (1 << 13)
#define TYPE_ADDRESS_CLASS_1(t) (TYPE_INSTANCE_FLAGS(t) \
& TYPE_FLAG_ADDRESS_CLASS_1)
-#define TYPE_FLAG_ADDRESS_CLASS_2 (1 << 14)
#define TYPE_ADDRESS_CLASS_2(t) (TYPE_INSTANCE_FLAGS(t) \
& TYPE_FLAG_ADDRESS_CLASS_2)
#define TYPE_FLAG_ADDRESS_CLASS_ALL (TYPE_FLAG_ADDRESS_CLASS_1 \
@@ -279,20 +288,17 @@ enum type_code
the necessary run-time information, and does not need further
interpretation. Optionally marks ordinary, fixed-size GDB type. */
-#define TYPE_FLAG_FIXED_INSTANCE (1 << 15)
/* This debug target supports TYPE_STUB(t). In the unsupported case we have to
rely on NFIELDS to be zero etc., see TYPE_IS_OPAQUE ().
TYPE_STUB(t) with !TYPE_STUB_SUPPORTED(t) may exist if we only guessed
the TYPE_STUB(t) value (see dwarfread.c). */
-#define TYPE_FLAG_STUB_SUPPORTED (1 << 16)
#define TYPE_STUB_SUPPORTED(t) (TYPE_FLAGS (t) & TYPE_FLAG_STUB_SUPPORTED)
/* Not textual. By default, GDB treats all single byte integers as
characters (or elements of strings) unless this flag is set. */
-#define TYPE_FLAG_NOTTEXT (1 << 17)
#define TYPE_NOTTEXT(t) (TYPE_FLAGS (t) & TYPE_FLAG_NOTTEXT)
/* Array bound type. */
@@ -313,7 +319,7 @@ struct main_type
{
/* Code for kind of type */
- ENUM_BITFIELD(type_code) code : 8;
+ ENUM_BITFIELD(type_code) code : 5;
/* Array bounds. These fields appear at this location because
they pack nicely here. */
@@ -321,6 +327,29 @@ struct main_type
ENUM_BITFIELD(array_bound_type) upper_bound_type : 4;
ENUM_BITFIELD(array_bound_type) lower_bound_type : 4;
+ /* Flags about this type. This field appears at this location
+ because it packs nicely here. */
+
+ ENUM_BITFIELD(type_flag_value) flags : 18;
+
+ /* Number of fields described for this type. This field appears at
+ this location because it packs nicely here. */
+
+ short nfields;
+
+ /* Field number of the virtual function table pointer in
+ VPTR_BASETYPE. If -1, we were unable to find the virtual
+ function table pointer in initial symbol reading, and
+ get_vptr_fieldno should be called to find it if possible.
+ get_vptr_fieldno will update this field if possible.
+ Otherwise the value is left at -1.
+
+ Unused if this type does not have virtual functions.
+
+ This field appears at this location because it packs nicely here. */
+
+ short vptr_fieldno;
+
/* Name of this type, or NULL if none.
This is used for printing only, except by poorly designed C++ code.
@@ -364,25 +393,6 @@ struct main_type
struct type *target_type;
- /* Flags about this type. */
-
- int flags;
-
- /* Number of fields described for this type */
-
- short nfields;
-
- /* Field number of the virtual function table pointer in
- VPTR_BASETYPE. If -1, we were unable to find the virtual
- function table pointer in initial symbol reading, and
- get_vptr_fieldno should be called to find it if possible.
- get_vptr_fieldno will update this field if possible.
- Otherwise the value is left at -1.
-
- Unused if this type does not have virtual functions. */
-
- short vptr_fieldno;
-
/* For structure and union types, a description of each field.
For set and pascal array types, there is one "field",
whose type is the domain type of the set or array.
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: RFA: shrink main_type
2008-08-17 18:50 RFA: shrink main_type Tom Tromey
@ 2008-08-18 13:01 ` Joel Brobecker
2008-08-18 13:20 ` Daniel Jacobowitz
2008-08-18 15:04 ` RFA: shrink main_type Tom Tromey
0 siblings, 2 replies; 25+ messages in thread
From: Joel Brobecker @ 2008-08-18 13:01 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
> This patch shrinks struct main_type 32- and 64-bit machines by
> shrinking the type_code and flags fields and moving around a couple
> other fields.
>
> On my x86 box, this saves about 1% of memory on "gdb -readnow cc1" --
> a few hundred K -- at the cost of slightly increasing gdb's text size.
I'm not opposed to this sort of packing, particularly since this is
something that we already do for other fields of this type, but I'm
interested in the performance impact of such a change. A few hundred
K of memory for cc1 doesn't sound like a lot nowadays. I wonder what
it would cost and save for a program of the size of Mozilla...
> I noticed that the Ada code does not use TYPE_FLAG_* consistently with
> the rest of gdb (it tests the flags directly rather than using the
> macros), but I didn't change this.
Another good observation. I will try to find some time to fix...
I only saw a couple of instances (with TYPE_FIXED_INSTANCE). Did you
spot any other?
:REVIEWMAIL:
> 2008-08-17 Tom Tromey <tromey@redhat.com>
>
> * gdbtypes.h (enum type_flag_value): New enum.
> (TYPE_FLAG_UNSIGNED, TYPE_FLAG_NOSIGN, TYPE_FLAG_STUB,
> TYPE_FLAG_TARGET_STUB, TYPE_FLAG_STATIC, TYPE_FLAG_CONST,
> TYPE_FLAG_VOLATILE, TYPE_FLAG_PROTOTYPED, TYPE_FLAG_INCOMPLETE,
> TYPE_FLAG_CODE_SPACE, TYPE_FLAG_DATA_SPACE, TYPE_FLAG_VARARGS,
> TYPE_FLAG_VECTOR, TYPE_FLAG_ADDRESS_CLASS_1,
> TYPE_FLAG_ADDRESS_CLASS_2, TYPE_FLAG_FIXED_INSTANCE,
> TYPE_FLAG_STUB_SUPPORTED, TYPE_FLAG_NOTTEXT): Now enum constants.
I think this change is really great, and can be checked in separately
from the rest.
> (struct main_type) <code>: Now 5 bits.
> <flags>: Move earlier. Now a bit field.
> <nfields, vptr_fieldno>: Move earlier.
I'm having trouble understanding the new layout that you propose.
It looks like this:
ENUM_BITFIELD(type_code) code : 5;
/* Array bounds. These fields appear at this location because
they pack nicely here. */
ENUM_BITFIELD(array_bound_type) upper_bound_type : 4;
ENUM_BITFIELD(array_bound_type) lower_bound_type : 4;
/* Flags about this type. This field appears at this location
because it packs nicely here. */
ENUM_BITFIELD(type_flag_value) flags : 18;
Do the upper/lower_bound_type fields still "pack nicely"?
This is where my knowledge of C (or lack thereof) shows up, but
would the following declaration instead help the compiler?
ENUM_BITFIELD(type_code) code : 6;
ENUM_BITFIELD(type_flag_value) flags : 18;
ENUM_BITFIELD(array_bound_type) upper_bound_type : 4;
ENUM_BITFIELD(array_bound_type) lower_bound_type : 4;
Then, I don't understand why the two "short" fields have been
moved up just behind the "flags" field (sorry, like I said, there
are holes in my C knowledge).
--
Joel
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: RFA: shrink main_type
2008-08-18 13:01 ` Joel Brobecker
@ 2008-08-18 13:20 ` Daniel Jacobowitz
2008-08-18 13:30 ` Joel Brobecker
2008-08-18 15:19 ` Tom Tromey
2008-08-18 15:04 ` RFA: shrink main_type Tom Tromey
1 sibling, 2 replies; 25+ messages in thread
From: Daniel Jacobowitz @ 2008-08-18 13:20 UTC (permalink / raw)
To: Joel Brobecker; +Cc: Tom Tromey, gdb-patches
On Mon, Aug 18, 2008 at 05:00:09PM +0400, Joel Brobecker wrote:
> /* Flags about this type. This field appears at this location
> because it packs nicely here. */
>
> ENUM_BITFIELD(type_flag_value) flags : 18;
If you're going to do this anyway, why not make them individual
bitfields? Would that be too disruptive?
I don't think it's particularly useful to change the type of this to
the enum since we don't put enum values in it, just bitwise
combination of them. (Isn't that invalid in C++?)
And if you want to repack the upper/lower bounds fields, I bet they
can move into type_specific.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: RFA: shrink main_type
2008-08-18 13:20 ` Daniel Jacobowitz
@ 2008-08-18 13:30 ` Joel Brobecker
2008-08-18 15:19 ` Tom Tromey
1 sibling, 0 replies; 25+ messages in thread
From: Joel Brobecker @ 2008-08-18 13:30 UTC (permalink / raw)
To: Tom Tromey, gdb-patches
> I don't think it's particularly useful to change the type of this to
> the enum since we don't put enum values in it, just bitwise
> combination of them. (Isn't that invalid in C++?)
Argh, yes - I completely zapped the fact that we combined these flags...
--
Joel
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: RFA: shrink main_type
2008-08-18 13:01 ` Joel Brobecker
2008-08-18 13:20 ` Daniel Jacobowitz
@ 2008-08-18 15:04 ` Tom Tromey
1 sibling, 0 replies; 25+ messages in thread
From: Tom Tromey @ 2008-08-18 15:04 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches
>>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:
Joel> I'm not opposed to this sort of packing, particularly since this is
Joel> something that we already do for other fields of this type, but I'm
Joel> interested in the performance impact of such a change. A few hundred
Joel> K of memory for cc1 doesn't sound like a lot nowadays. I wonder what
Joel> it would cost and save for a program of the size of Mozilla...
I will find out.
I did not try to measure the performance impact. Any suggestions for
a test case that would be measurably impacted by this change? I am
not enough of a gdb expert to know what code would rely on access to
these fields in a time-critical way.
[ada]
Joel> Another good observation. I will try to find some time to fix...
Joel> I only saw a couple of instances (with TYPE_FIXED_INSTANCE). Did you
Joel> spot any other?
Yeah, there were just a couple, nothing major.
Joel> Do the upper/lower_bound_type fields still "pack nicely"?
Yes.
Joel> This is where my knowledge of C (or lack thereof) shows up, but
Joel> would the following declaration instead help the compiler?
Joel> ENUM_BITFIELD(type_code) code : 6;
Joel> ENUM_BITFIELD(type_flag_value) flags : 18;
Joel> ENUM_BITFIELD(array_bound_type) upper_bound_type : 4;
Joel> ENUM_BITFIELD(array_bound_type) lower_bound_type : 4;
It wouldn't hurt, but I don't think it would help. Bit fields are
just packed in as tightly as possible.
If you have the "7 dwarves" installed you can easily see the layout by
running "pahole --class_name=main_type". (FWIW it would be pretty
easy to change gdb to give this info -- which is pretty handy.)
Joel> Then, I don't understand why the two "short" fields have been
Joel> moved up just behind the "flags" field (sorry, like I said, there
Joel> are holes in my C knowledge).
No problem. I moved these fields to preserve good packing on a 64-bit
machine. Without this, there would be a hole between 'flags' and
'name', and another one where 'flags' used to be.
Tom
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: RFA: shrink main_type
2008-08-18 13:20 ` Daniel Jacobowitz
2008-08-18 13:30 ` Joel Brobecker
@ 2008-08-18 15:19 ` Tom Tromey
2008-08-18 19:39 ` Tom Tromey
1 sibling, 1 reply; 25+ messages in thread
From: Tom Tromey @ 2008-08-18 15:19 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches
>>>>> "Daniel" == Daniel Jacobowitz <drow@false.org> writes:
Daniel> If you're going to do this anyway, why not make them individual
Daniel> bitfields? Would that be too disruptive?
It would not be too bad. I count 69 uses of TYPE_FLAGS, that isn't a
huge number. The other uses are hidden by the accessor macros.
I will make this change.
FWIW I only looked at this struct since it is marked as being
space-critical, and I saw a way to shrink it a bit.
Daniel> I don't think it's particularly useful to change the type of this to
Daniel> the enum since we don't put enum values in it, just bitwise
Daniel> combination of them. (Isn't that invalid in C++?)
Yes, it is invalid C++. Though... currently if you build gdb with
g++, you will get thousands of errors. One more wouldn't make that
project significantly harder IMO :)
Daniel> And if you want to repack the upper/lower bounds fields, I bet they
Daniel> can move into type_specific.
I looked at this. I am not so sure about moving these fields -- they
are referenced by pretty much every language. I didn't look at why
this was so (i.e., could be dead code, or bad cut-and-paste, or
whatever).
I was thinking that perhaps the vptr stuff could go in type_specific.
Or, we could do like GCC and have different structures depending on
the code, so that non-struct types don't have to carry around unused
fields. I didn't try to measure how much this would save. These are
bigger changes; this particular patch was just an easy way to save
some memory.
Tom
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: RFA: shrink main_type
2008-08-18 15:19 ` Tom Tromey
@ 2008-08-18 19:39 ` Tom Tromey
2008-08-18 22:17 ` Andreas Schwab
2008-08-19 5:13 ` Joel Brobecker
0 siblings, 2 replies; 25+ messages in thread
From: Tom Tromey @ 2008-08-18 19:39 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches
Daniel> If you're going to do this anyway, why not make them individual
Daniel> bitfields? Would that be too disruptive?
Tom> It would not be too bad. I count 69 uses of TYPE_FLAGS, that isn't a
Tom> huge number. The other uses are hidden by the accessor macros.
Tom> I will make this change.
Here is a revision that replaces the main_type 'flags' field with
individual bit fields.
While doing this I noticed that we freely mixed flags and
instance_flags values in the (conceptual) enum here. I separated
these out, renamed a few values, and renumbered the constants.
In addition to helping reduce future confusion, I think this should
eliminate any questions about performance. I left 'code' as 8 bits,
and all other fields which require shifting and masking also did
before this patch.
Also, due to this separation, we now have more free bits in main_type
(with the previous patch we had 1 free, now we have 4, not counting
the unused bits of 'code').
The enum constants are still required due to init_type. I think no
call to init_type passes in an instance flag, but to be sure I added
an assert to this effect.
I did not try to replace instance_fields with individual bits.
As a side effect this fixes the minor Ada issues I mentioned earlier.
This patch also found a couple more instances.
This version of the patch required a minor test suite modification.
Now that TYPE_FLAGS is gone, "maint print type" had to change a
little. I also updated this code to print a few flags it was not
previously printing.
Built and regtested on x86-64 (compile farm).
Ok?
Tom
:ADDPATCH types:
2008-08-18 Tom Tromey <tromey@redhat.com>
* xml-tdesc.c (tdesc_end_union): Update.
* stabsread.c (define_symbol): Update.
(read_type): Update.
(read_struct_type): Update.
(read_enum_type): Update.
* spu-tdep.c (spu_builtin_type_vec128): Update.
* sh-tdep.c (sh_push_dummy_call_fpu): Update.
(sh_push_dummy_call_nofpu): Update.
* mdebugread.c (parse_symbol): Update.
(parse_symbol): Update.
(parse_symbol): Update.
(upgrade_type): Update.
* jv-lang.c (java_lookup_class): Update.
* iq2000-tdep.c (iq2000_pointer_to_address): Update.
* i386-tdep.c (i386_mmx_type): Update.
(i386_sse_type): Update.
* gdbtypes.h (enum type_flag_value): New enum.
(enum type_instance_flag_value): New enum.
(TYPE_FLAG_UNSIGNED, TYPE_FLAG_NOSIGN, TYPE_FLAG_STUB,
TYPE_FLAG_TARGET_STUB, TYPE_FLAG_STATIC, TYPE_FLAG_PROTOTYPED,
TYPE_FLAG_INCOMPLETE, TYPE_FLAG_VARARGS, TYPE_FLAG_VECTOR,
TYPE_FLAG_FIXED_INSTANCE, TYPE_FLAG_STUB_SUPPORTED,
TYPE_FLAG_NOTTEXT): Now enum constants.
(TYPE_FLAG_CONST, TYPE_FLAG_VOLATILE, TYPE_FLAG_CODE_SPACE,
TYPE_FLAG_DATA_SPACE, TYPE_FLAG_ADDRESS_CLASS_1,
TYPE_FLAG_ADDRESS_CLASS_2): Remove.
(TYPE_INSTANCE_FLAG_CONST, TYPE_INSTANCE_FLAG_VOLATILE,
TYPE_INSTANCE_FLAG_CODE_SPACE, TYPE_INSTANCE_FLAG_DATA_SPACE,
TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1,
TYPE_INSTANCE_FLAG_ADDRESS_CLASS_2): New constants.
(TYPE_UNSIGNED, TYPE_NOSIGN, TYPE_STUB, TYPE_TARGET_STUB,
TYPE_STATIC, TYPE_PROTOTYPED, TYPE_INCOMPLETE, TYPE_VARARGS,
TYPE_VECTOR, TYPE_FIXED_INSTANCE, TYPE_STUB_SUPPORTED,
TYPE_NOTTEXT): Update.
(TYPE_FLAG_ADDRESS_CLASS_ALL): Remove.
(TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL): New define.
(TYPE_VOLATILE, TYPE_CODE_SPACE, TYPE_DATA_SPACE,
TYPE_ADDRESS_CLASS_1, TYPE_ADDRESS_CLASS_2,
TYPE_ADDRESS_CLASS_ALL): Update.
(struct main_type) <flags>: Remove.
<flag_unsigned, flag_nosign, flag_stub, flag_target_stub,
flag_static, flag_prototyped, flag_incomplete, flag_varargs,
flag_vector, flag_stub_supported, flag_nottext,
flag_fixed_instance>: New fields.
<nfields, vptr_fieldno>: Move earlier.
(TYPE_FLAGS): Remove.
* gdbtypes.c (make_pointer_type): Update.
(address_space_name_to_int): Update.
(address_space_int_to_name): Update.
(make_type_with_address_space): Update.
(make_cv_type): Update.
(create_range_type): Update.
(get_discrete_bounds): Update.
(create_set_type): Update.
(make_vector_type): Update.
(smash_to_method_type): Update.
(check_typedef): Update.
(check_stub_method): Update.
(init_type): Individually assign flag fields.
(recursive_dump_type): Don't print entire TYPE_FLAGS field. Do
print TYPE_FIXED_INSTANCE, TYPE_STUB_SUPPORTED, and TYPE_NOTTEXT.
(copy_type_recursive): Copy the entire main type. Don't use
TYPE_FLAGS.
* features/rs6000/powerpc-altivec64l.c
(initialize_tdesc_powerpc_altivec64l): Update.
* features/rs6000/powerpc-altivec64.c
(initialize_tdesc_powerpc_altivec64): Update.
* features/rs6000/powerpc-altivec32l.c
(initialize_tdesc_powerpc_altivec32l): Update.
* features/rs6000/powerpc-altivec32.c
(initialize_tdesc_powerpc_altivec32): Update.
* features/rs6000/powerpc-7400.c (initialize_tdesc_powerpc_7400):
Update.
* features/arm-with-iwmmxt.c (initialize_tdesc_arm_with_iwmmxt):
Update.
* dwarf2read.c (read_structure_type): Update.
(read_enumeration_type): Likewise.
(process_enumeration_scope): Likewise.
(read_tag_pointer_type): Likewise.
(read_subroutine_type): Likewise.
(read_subroutine_type): Likewise.
* coffread.c (coff_read_enum_type): Update.
* ada-valprint.c (adjust_type_signedness): Update.
* ada-typeprint.c (print_record_field_types): Update.
* ada-lang.c (packed_array_type): Update.
(empty_record): Don't reset TYPE_FLAGS.
(ada_template_to_fixed_record_type_1): Update.
(ada_template_to_fixed_record_type_1): Likewise.
(template_to_static_fixed_type): Likewise.
(to_record_with_fixed_variant_part): Likewise.
(to_fixed_record_type): Likewise.
(to_fixed_array_type): Likewise.
(to_static_fixed_type): Likewise.
2008-08-18 Tom Tromey <tromey@redhat.com>
* gdb.base/maint.exp: Update "maint print type".
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index f3f1f34..aa692c3 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -1828,7 +1828,7 @@ packed_array_type (struct type *type, long *elt_bits)
(*elt_bits + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT;
}
- TYPE_FLAGS (new_type) |= TYPE_FLAG_FIXED_INSTANCE;
+ TYPE_FIXED_INSTANCE (new_type) = 1;
return new_type;
}
@@ -6901,7 +6901,6 @@ empty_record (struct objfile *objfile)
TYPE_FIELDS (type) = NULL;
TYPE_NAME (type) = "<empty>";
TYPE_TAG_NAME (type) = NULL;
- TYPE_FLAGS (type) = 0;
TYPE_LENGTH (type) = 0;
return type;
}
@@ -6961,7 +6960,7 @@ ada_template_to_fixed_record_type_1 (struct type *type,
memset (TYPE_FIELDS (rtype), 0, sizeof (struct field) * nfields);
TYPE_NAME (rtype) = ada_type_name (type);
TYPE_TAG_NAME (rtype) = NULL;
- TYPE_FLAGS (rtype) |= TYPE_FLAG_FIXED_INSTANCE;
+ TYPE_FIXED_INSTANCE (rtype) = 1;
off = 0;
bit_len = 0;
@@ -7141,7 +7140,7 @@ template_to_static_fixed_type (struct type *type0)
sizeof (struct field) * nfields);
TYPE_NAME (type) = ada_type_name (type0);
TYPE_TAG_NAME (type) = NULL;
- TYPE_FLAGS (type) |= TYPE_FLAG_FIXED_INSTANCE;
+ TYPE_FIXED_INSTANCE (type) = 1;
TYPE_LENGTH (type) = 0;
}
TYPE_FIELD_TYPE (type, f) = new_type;
@@ -7186,7 +7185,7 @@ to_record_with_fixed_variant_part (struct type *type, const gdb_byte *valaddr,
sizeof (struct field) * nfields);
TYPE_NAME (rtype) = ada_type_name (type);
TYPE_TAG_NAME (rtype) = NULL;
- TYPE_FLAGS (rtype) |= TYPE_FLAG_FIXED_INSTANCE;
+ TYPE_FIXED_INSTANCE (rtype) = 1;
TYPE_LENGTH (rtype) = TYPE_LENGTH (type);
branch_type = to_fixed_variant_branch_type
@@ -7241,7 +7240,7 @@ to_fixed_record_type (struct type *type0, const gdb_byte *valaddr,
{
struct type *templ_type;
- if (TYPE_FLAGS (type0) & TYPE_FLAG_FIXED_INSTANCE)
+ if (TYPE_FIXED_INSTANCE (type0))
return type0;
templ_type = dynamic_template_type (type0);
@@ -7257,7 +7256,7 @@ to_fixed_record_type (struct type *type0, const gdb_byte *valaddr,
}
else
{
- TYPE_FLAGS (type0) |= TYPE_FLAG_FIXED_INSTANCE;
+ TYPE_FIXED_INSTANCE (type0) = 1;
return type0;
}
@@ -7322,7 +7321,7 @@ to_fixed_array_type (struct type *type0, struct value *dval,
struct type *result;
if (ada_is_packed_array_type (type0) /* revisit? */
- || (TYPE_FLAGS (type0) & TYPE_FLAG_FIXED_INSTANCE))
+ || (TYPE_FIXED_INSTANCE (type0)))
return type0;
index_type_desc = ada_find_parallel_type (type0, "___XA");
@@ -7382,7 +7381,7 @@ to_fixed_array_type (struct type *type0, struct value *dval,
error (_("array type with dynamic size is larger than varsize-limit"));
}
- TYPE_FLAGS (result) |= TYPE_FLAG_FIXED_INSTANCE;
+ TYPE_FIXED_INSTANCE (result) = 1;
return result;
}
@@ -7472,7 +7471,7 @@ to_static_fixed_type (struct type *type0)
if (type0 == NULL)
return NULL;
- if (TYPE_FLAGS (type0) & TYPE_FLAG_FIXED_INSTANCE)
+ if (TYPE_FIXED_INSTANCE (type0))
return type0;
type0 = ada_check_typedef (type0);
diff --git a/gdb/ada-typeprint.c b/gdb/ada-typeprint.c
index 4b1f9ff..f9355c2 100644
--- a/gdb/ada-typeprint.c
+++ b/gdb/ada-typeprint.c
@@ -585,7 +585,7 @@ print_record_field_types (struct type *type, struct type *outer_type,
flds = 0;
len = TYPE_NFIELDS (type);
- if (len == 0 && (TYPE_FLAGS (type) & TYPE_FLAG_STUB) != 0)
+ if (len == 0 && (TYPE_STUB (type)) != 0)
return -1;
for (i = 0; i < len; i += 1)
diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c
index f09df20..82678f0 100644
--- a/gdb/ada-valprint.c
+++ b/gdb/ada-valprint.c
@@ -71,7 +71,7 @@ adjust_type_signedness (struct type *type)
{
if (type != NULL && TYPE_CODE (type) == TYPE_CODE_RANGE
&& TYPE_LOW_BOUND (type) >= 0)
- TYPE_FLAGS (type) |= TYPE_FLAG_UNSIGNED;
+ TYPE_UNSIGNED (type) = 1;
}
/* Assuming TYPE is a simple array type, prints its lower bound on STREAM,
diff --git a/gdb/coffread.c b/gdb/coffread.c
index e6cc389..f6f3b7e 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -2090,7 +2090,7 @@ coff_read_enum_type (int index, int length, int lastsym,
}
if (unsigned_enum)
- TYPE_FLAGS (type) |= TYPE_FLAG_UNSIGNED;
+ TYPE_UNSIGNED (type) = 1;
return type;
}
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 8f1062d..a8d0212 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -4058,9 +4058,9 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu)
TYPE_LENGTH (type) = 0;
}
- TYPE_FLAGS (type) |= TYPE_FLAG_STUB_SUPPORTED;
+ TYPE_STUB_SUPPORTED (type) = 1;
if (die_is_declaration (die, cu))
- TYPE_FLAGS (type) |= TYPE_FLAG_STUB;
+ TYPE_STUB (type) = 1;
/* We need to add the type field to the die immediately so we don't
infinitely recurse when dealing with pointers to the structure
@@ -4274,7 +4274,7 @@ read_enumeration_type (struct die_info *die, struct dwarf2_cu *cu)
Types. When another package uses such a type, an incomplete DIE
may be generated by the compiler. */
if (die_is_declaration (die, cu))
- TYPE_FLAGS (type) |= TYPE_FLAG_STUB;
+ TYPE_STUB (type) = 1;
return set_die_type (die, type, cu);
}
@@ -4410,7 +4410,7 @@ process_enumeration_scope (struct die_info *die, struct dwarf2_cu *cu)
xfree (fields);
}
if (unsigned_enum)
- TYPE_FLAGS (this_type) |= TYPE_FLAG_UNSIGNED;
+ TYPE_UNSIGNED (this_type) = 1;
}
new_symbol (die, this_type, cu);
@@ -4732,7 +4732,8 @@ read_tag_pointer_type (struct die_info *die, struct dwarf2_cu *cu)
type_flags = gdbarch_address_class_type_flags
(gdbarch, byte_size, addr_class);
- gdb_assert ((type_flags & ~TYPE_FLAG_ADDRESS_CLASS_ALL) == 0);
+ gdb_assert ((type_flags & ~TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL)
+ == 0);
type = make_type_with_address_space (type, type_flags);
}
else if (TYPE_LENGTH (type) != byte_size)
@@ -4879,7 +4880,7 @@ read_subroutine_type (struct die_info *die, struct dwarf2_cu *cu)
|| cu->language == language_cplus
|| cu->language == language_java
|| cu->language == language_pascal)
- TYPE_FLAGS (ftype) |= TYPE_FLAG_PROTOTYPED;
+ TYPE_PROTOTYPED (ftype) = 1;
/* Store the calling convention in the type if it's available in
the subroutine die. Otherwise set the calling convention to
@@ -4902,7 +4903,7 @@ read_subroutine_type (struct die_info *die, struct dwarf2_cu *cu)
if (child_die->tag == DW_TAG_formal_parameter)
nparams++;
else if (child_die->tag == DW_TAG_unspecified_parameters)
- TYPE_FLAGS (ftype) |= TYPE_FLAG_VARARGS;
+ TYPE_VARARGS (ftype) = 1;
child_die = sibling_die (child_die);
}
diff --git a/gdb/features/arm-with-iwmmxt.c b/gdb/features/arm-with-iwmmxt.c
index 8255c7f..d9c5221 100644
--- a/gdb/features/arm-with-iwmmxt.c
+++ b/gdb/features/arm-with-iwmmxt.c
@@ -59,7 +59,7 @@ initialize_tdesc_arm_with_iwmmxt (void)
append_composite_type_field (type, xstrdup ("u32"), field_type);
field_type = tdesc_named_type (feature, "uint64");
append_composite_type_field (type, xstrdup ("u64"), field_type);
- TYPE_FLAGS (type) |= TYPE_FLAG_VECTOR;
+ TYPE_VECTOR (type) = 1;
tdesc_record_type (feature, type);
tdesc_create_reg (feature, "wR0", 26, 1, NULL, 64, "iwmmxt_vec64i");
diff --git a/gdb/features/rs6000/powerpc-7400.c b/gdb/features/rs6000/powerpc-7400.c
index af0797e..4e9a5c5 100644
--- a/gdb/features/rs6000/powerpc-7400.c
+++ b/gdb/features/rs6000/powerpc-7400.c
@@ -170,7 +170,7 @@ initialize_tdesc_powerpc_7400 (void)
append_composite_type_field (type, xstrdup ("v8_int16"), field_type);
field_type = tdesc_named_type (feature, "v16i8");
append_composite_type_field (type, xstrdup ("v16_int8"), field_type);
- TYPE_FLAGS (type) |= TYPE_FLAG_VECTOR;
+ TYPE_VECTOR (type) = 1;
tdesc_record_type (feature, type);
tdesc_create_reg (feature, "vr0", 119, 1, NULL, 128, "vec128");
diff --git a/gdb/features/rs6000/powerpc-altivec32.c b/gdb/features/rs6000/powerpc-altivec32.c
index ff2aefa..db910ea 100644
--- a/gdb/features/rs6000/powerpc-altivec32.c
+++ b/gdb/features/rs6000/powerpc-altivec32.c
@@ -122,7 +122,7 @@ initialize_tdesc_powerpc_altivec32 (void)
append_composite_type_field (type, xstrdup ("v8_int16"), field_type);
field_type = tdesc_named_type (feature, "v16i8");
append_composite_type_field (type, xstrdup ("v16_int8"), field_type);
- TYPE_FLAGS (type) |= TYPE_FLAG_VECTOR;
+ TYPE_VECTOR (type) = 1;
tdesc_record_type (feature, type);
tdesc_create_reg (feature, "vr0", 71, 1, NULL, 128, "vec128");
diff --git a/gdb/features/rs6000/powerpc-altivec32l.c b/gdb/features/rs6000/powerpc-altivec32l.c
index c139c60..a08f09b 100644
--- a/gdb/features/rs6000/powerpc-altivec32l.c
+++ b/gdb/features/rs6000/powerpc-altivec32l.c
@@ -126,7 +126,7 @@ initialize_tdesc_powerpc_altivec32l (void)
append_composite_type_field (type, xstrdup ("v8_int16"), field_type);
field_type = tdesc_named_type (feature, "v16i8");
append_composite_type_field (type, xstrdup ("v16_int8"), field_type);
- TYPE_FLAGS (type) |= TYPE_FLAG_VECTOR;
+ TYPE_VECTOR (type) = 1;
tdesc_record_type (feature, type);
tdesc_create_reg (feature, "vr0", 73, 1, NULL, 128, "vec128");
diff --git a/gdb/features/rs6000/powerpc-altivec64.c b/gdb/features/rs6000/powerpc-altivec64.c
index 404a92d..dd1df89 100644
--- a/gdb/features/rs6000/powerpc-altivec64.c
+++ b/gdb/features/rs6000/powerpc-altivec64.c
@@ -122,7 +122,7 @@ initialize_tdesc_powerpc_altivec64 (void)
append_composite_type_field (type, xstrdup ("v8_int16"), field_type);
field_type = tdesc_named_type (feature, "v16i8");
append_composite_type_field (type, xstrdup ("v16_int8"), field_type);
- TYPE_FLAGS (type) |= TYPE_FLAG_VECTOR;
+ TYPE_VECTOR (type) = 1;
tdesc_record_type (feature, type);
tdesc_create_reg (feature, "vr0", 71, 1, NULL, 128, "vec128");
diff --git a/gdb/features/rs6000/powerpc-altivec64l.c b/gdb/features/rs6000/powerpc-altivec64l.c
index a5d4be7..892396d 100644
--- a/gdb/features/rs6000/powerpc-altivec64l.c
+++ b/gdb/features/rs6000/powerpc-altivec64l.c
@@ -126,7 +126,7 @@ initialize_tdesc_powerpc_altivec64l (void)
append_composite_type_field (type, xstrdup ("v8_int16"), field_type);
field_type = tdesc_named_type (feature, "v16i8");
append_composite_type_field (type, xstrdup ("v16_int8"), field_type);
- TYPE_FLAGS (type) |= TYPE_FLAG_VECTOR;
+ TYPE_VECTOR (type) = 1;
tdesc_record_type (feature, type);
tdesc_create_reg (feature, "vr0", 73, 1, NULL, 128, "vec128");
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 939a1dc..925bc9b 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -277,7 +277,7 @@ make_pointer_type (struct type *type, struct type **typeptr)
/* Mark pointers as unsigned. The target converts between pointers
and addresses (CORE_ADDRs) using gdbarch_pointer_to_address and
gdbarch_address_to_pointer. */
- TYPE_FLAGS (ntype) |= TYPE_FLAG_UNSIGNED;
+ TYPE_UNSIGNED (ntype) = 1;
if (!TYPE_POINTER_TYPE (type)) /* Remember it, if don't have one. */
TYPE_POINTER_TYPE (type) = ntype;
@@ -429,9 +429,9 @@ address_space_name_to_int (char *space_identifier)
int type_flags;
/* Check for known address space delimiters. */
if (!strcmp (space_identifier, "code"))
- return TYPE_FLAG_CODE_SPACE;
+ return TYPE_INSTANCE_FLAG_CODE_SPACE;
else if (!strcmp (space_identifier, "data"))
- return TYPE_FLAG_DATA_SPACE;
+ return TYPE_INSTANCE_FLAG_DATA_SPACE;
else if (gdbarch_address_class_name_to_type_flags_p (gdbarch)
&& gdbarch_address_class_name_to_type_flags (gdbarch,
space_identifier,
@@ -448,11 +448,11 @@ const char *
address_space_int_to_name (int space_flag)
{
struct gdbarch *gdbarch = current_gdbarch;
- if (space_flag & TYPE_FLAG_CODE_SPACE)
+ if (space_flag & TYPE_INSTANCE_FLAG_CODE_SPACE)
return "code";
- else if (space_flag & TYPE_FLAG_DATA_SPACE)
+ else if (space_flag & TYPE_INSTANCE_FLAG_DATA_SPACE)
return "data";
- else if ((space_flag & TYPE_FLAG_ADDRESS_CLASS_ALL)
+ else if ((space_flag & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL)
&& gdbarch_address_class_type_flags_to_name_p (gdbarch))
return gdbarch_address_class_type_flags_to_name (gdbarch, space_flag);
else
@@ -525,8 +525,9 @@ make_type_with_address_space (struct type *type, int space_flag)
{
struct type *ntype;
int new_flags = ((TYPE_INSTANCE_FLAGS (type)
- & ~(TYPE_FLAG_CODE_SPACE | TYPE_FLAG_DATA_SPACE
- | TYPE_FLAG_ADDRESS_CLASS_ALL))
+ & ~(TYPE_INSTANCE_FLAG_CODE_SPACE
+ | TYPE_INSTANCE_FLAG_DATA_SPACE
+ | TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL))
| space_flag);
return make_qualified_type (type, new_flags, NULL);
@@ -553,13 +554,13 @@ make_cv_type (int cnst, int voltl,
struct objfile *objfile;
int new_flags = (TYPE_INSTANCE_FLAGS (type)
- & ~(TYPE_FLAG_CONST | TYPE_FLAG_VOLATILE));
+ & ~(TYPE_INSTANCE_FLAG_CONST | TYPE_INSTANCE_FLAG_VOLATILE));
if (cnst)
- new_flags |= TYPE_FLAG_CONST;
+ new_flags |= TYPE_INSTANCE_FLAG_CONST;
if (voltl)
- new_flags |= TYPE_FLAG_VOLATILE;
+ new_flags |= TYPE_INSTANCE_FLAG_VOLATILE;
if (typeptr && *typeptr != NULL)
{
@@ -699,7 +700,7 @@ create_range_type (struct type *result_type, struct type *index_type,
TYPE_CODE (result_type) = TYPE_CODE_RANGE;
TYPE_TARGET_TYPE (result_type) = index_type;
if (TYPE_STUB (index_type))
- TYPE_FLAGS (result_type) |= TYPE_FLAG_TARGET_STUB;
+ TYPE_TARGET_STUB (result_type) = 1;
else
TYPE_LENGTH (result_type) = TYPE_LENGTH (check_typedef (index_type));
TYPE_NFIELDS (result_type) = 2;
@@ -710,7 +711,7 @@ create_range_type (struct type *result_type, struct type *index_type,
TYPE_FIELD_BITPOS (result_type, 1) = high_bound;
if (low_bound >= 0)
- TYPE_FLAGS (result_type) |= TYPE_FLAG_UNSIGNED;
+ TYPE_UNSIGNED (result_type) = 1;
return (result_type);
}
@@ -748,7 +749,7 @@ get_discrete_bounds (struct type *type, LONGEST *lowp, LONGEST *highp)
/* Set unsigned indicator if warranted. */
if (*lowp >= 0)
{
- TYPE_FLAGS (type) |= TYPE_FLAG_UNSIGNED;
+ TYPE_UNSIGNED (type) = 1;
}
}
else
@@ -828,7 +829,7 @@ create_array_type (struct type *result_type,
/* TYPE_FLAG_TARGET_STUB will take care of zero length arrays */
if (TYPE_LENGTH (result_type) == 0)
- TYPE_FLAGS (result_type) |= TYPE_FLAG_TARGET_STUB;
+ TYPE_TARGET_STUB (result_type) = 1;
return (result_type);
}
@@ -882,7 +883,7 @@ create_set_type (struct type *result_type, struct type *domain_type)
TYPE_LENGTH (result_type)
= (bit_length + TARGET_CHAR_BIT - 1) / TARGET_CHAR_BIT;
if (low_bound >= 0)
- TYPE_FLAGS (result_type) |= TYPE_FLAG_UNSIGNED;
+ TYPE_UNSIGNED (result_type) = 1;
}
TYPE_FIELD_TYPE (result_type, 0) = domain_type;
@@ -947,7 +948,7 @@ make_vector_type (struct type *array_type)
TYPE_TARGET_TYPE (inner_array) = elt_type;
}
- TYPE_FLAGS (array_type) |= TYPE_FLAG_VECTOR;
+ TYPE_VECTOR (array_type) = 1;
}
struct type *
@@ -1015,7 +1016,7 @@ smash_to_method_type (struct type *type, struct type *domain,
TYPE_FIELDS (type) = args;
TYPE_NFIELDS (type) = nargs;
if (varargs)
- TYPE_FLAGS (type) |= TYPE_FLAG_VARARGS;
+ TYPE_VARARGS (type) = 1;
TYPE_LENGTH (type) = 1; /* In practice, this is never needed. */
TYPE_CODE (type) = TYPE_CODE_METHOD;
}
@@ -1526,12 +1527,12 @@ check_typedef (struct type *type)
nb_elements = high_bound - low_bound + 1;
TYPE_LENGTH (type) = nb_elements * TYPE_LENGTH (target_type);
- TYPE_FLAGS (type) &= ~TYPE_FLAG_TARGET_STUB;
+ TYPE_TARGET_STUB (type) = 0;
}
else if (TYPE_CODE (type) == TYPE_CODE_RANGE)
{
TYPE_LENGTH (type) = TYPE_LENGTH (target_type);
- TYPE_FLAGS (type) &= ~TYPE_FLAG_TARGET_STUB;
+ TYPE_TARGET_STUB (type) = 0;
}
}
/* Cache TYPE_LENGTH for future use. */
@@ -1675,10 +1676,10 @@ check_stub_method (struct type *type, int method_id, int signature_id)
TYPE_DOMAIN_TYPE (mtype) = type;
TYPE_FIELDS (mtype) = argtypes;
TYPE_NFIELDS (mtype) = argcount;
- TYPE_FLAGS (mtype) &= ~TYPE_FLAG_STUB;
+ TYPE_STUB (mtype) = 0;
TYPE_FN_FIELD_STUB (f, signature_id) = 0;
if (p[-2] == '.')
- TYPE_FLAGS (mtype) |= TYPE_FLAG_VARARGS;
+ TYPE_VARARGS (mtype) = 1;
xfree (demangled_name);
}
@@ -1760,7 +1761,33 @@ init_type (enum type_code code, int length, int flags,
type = alloc_type (objfile);
TYPE_CODE (type) = code;
TYPE_LENGTH (type) = length;
- TYPE_FLAGS (type) |= flags;
+
+ gdb_assert (!(flags & (TYPE_FLAG_MIN - 1)));
+ if (flags & TYPE_FLAG_UNSIGNED)
+ TYPE_UNSIGNED (type) = 1;
+ if (flags & TYPE_FLAG_NOSIGN)
+ TYPE_NOSIGN (type) = 1;
+ if (flags & TYPE_FLAG_STUB)
+ TYPE_STUB (type) = 1;
+ if (flags & TYPE_FLAG_TARGET_STUB)
+ TYPE_TARGET_STUB (type) = 1;
+ if (flags & TYPE_FLAG_STATIC)
+ TYPE_STATIC (type) = 1;
+ if (flags & TYPE_FLAG_PROTOTYPED)
+ TYPE_PROTOTYPED (type) = 1;
+ if (flags & TYPE_FLAG_INCOMPLETE)
+ TYPE_INCOMPLETE (type) = 1;
+ if (flags & TYPE_FLAG_VARARGS)
+ TYPE_VARARGS (type) = 1;
+ if (flags & TYPE_FLAG_VECTOR)
+ TYPE_VECTOR (type) = 1;
+ if (flags & TYPE_FLAG_STUB_SUPPORTED)
+ TYPE_STUB_SUPPORTED (type) = 1;
+ if (flags & TYPE_FLAG_NOTTEXT)
+ TYPE_NOTTEXT (type) = 1;
+ if (flags & TYPE_FLAG_FIXED_INSTANCE)
+ TYPE_FIXED_INSTANCE (type) = 1;
+
if ((name != NULL) && (objfile != NULL))
{
TYPE_NAME (type) = obsavestring (name, strlen (name),
@@ -1774,7 +1801,7 @@ init_type (enum type_code code, int length, int flags,
/* C++ fancies. */
if (name && strcmp (name, "char") == 0)
- TYPE_FLAGS (type) |= TYPE_FLAG_NOSIGN;
+ TYPE_NOSIGN (type) = 1;
if (code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION
|| code == TYPE_CODE_NAMESPACE)
@@ -2739,7 +2766,8 @@ recursive_dump_type (struct type *type, int spaces)
puts_filtered (" TYPE_FLAG_ADDRESS_CLASS_2");
}
puts_filtered ("\n");
- printfi_filtered (spaces, "flags 0x%x", TYPE_FLAGS (type));
+
+ printfi_filtered (spaces, "flags");
if (TYPE_UNSIGNED (type))
{
puts_filtered (" TYPE_FLAG_UNSIGNED");
@@ -2779,6 +2807,18 @@ recursive_dump_type (struct type *type, int spaces)
{
puts_filtered (" TYPE_FLAG_VECTOR");
}
+ if (TYPE_FIXED_INSTANCE (type))
+ {
+ puts_filtered (" TYPE_FIXED_INSTANCE");
+ }
+ if (TYPE_STUB_SUPPORTED (type))
+ {
+ puts_filtered (" TYPE_STUB_SUPPORTED");
+ }
+ if (TYPE_NOTTEXT (type))
+ {
+ puts_filtered (" TYPE_NOTTEXT");
+ }
puts_filtered ("\n");
printfi_filtered (spaces, "nfields %d ", TYPE_NFIELDS (type));
gdb_print_host_address (TYPE_FIELDS (type), gdb_stdout);
@@ -2933,24 +2973,19 @@ copy_type_recursive (struct objfile *objfile,
stored->new = new_type;
*slot = stored;
- /* Copy the common fields of types. */
- TYPE_CODE (new_type) = TYPE_CODE (type);
- TYPE_ARRAY_UPPER_BOUND_TYPE (new_type) =
- TYPE_ARRAY_UPPER_BOUND_TYPE (type);
- TYPE_ARRAY_LOWER_BOUND_TYPE (new_type) =
- TYPE_ARRAY_LOWER_BOUND_TYPE (type);
+ /* Copy the common fields of types. For the main type, we simply
+ copy the entire thing and then update specific fields as needed. */
+ memcpy (TYPE_MAIN_TYPE (new_type), TYPE_MAIN_TYPE (type),
+ sizeof (struct main_type));
if (TYPE_NAME (type))
TYPE_NAME (new_type) = xstrdup (TYPE_NAME (type));
if (TYPE_TAG_NAME (type))
TYPE_TAG_NAME (new_type) = xstrdup (TYPE_TAG_NAME (type));
- TYPE_FLAGS (new_type) = TYPE_FLAGS (type);
- TYPE_VPTR_FIELDNO (new_type) = TYPE_VPTR_FIELDNO (type);
TYPE_INSTANCE_FLAGS (new_type) = TYPE_INSTANCE_FLAGS (type);
TYPE_LENGTH (new_type) = TYPE_LENGTH (type);
/* Copy the fields. */
- TYPE_NFIELDS (new_type) = TYPE_NFIELDS (type);
if (TYPE_NFIELDS (type))
{
int i, nfields;
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 7ef7d67..25b8c43 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -144,27 +144,61 @@ enum type_code
#define TYPE_CODE_CLASS TYPE_CODE_STRUCT
-/* Some bits for the type's flags word, and macros to test them. */
+/* Some constants representing each bit field in the main_type. See
+ the bit-field-specific macros, below, for documentation of each
+ constant in this enum. These enum values are only used with
+ init_type. Note that the values are chosen not to conflict with
+ type_instance_flag_value; this lets init_type error-check its
+ input. */
+
+enum type_flag_value
+{
+ TYPE_FLAG_UNSIGNED = (1 << 6),
+ TYPE_FLAG_NOSIGN = (1 << 7),
+ TYPE_FLAG_STUB = (1 << 8),
+ TYPE_FLAG_TARGET_STUB = (1 << 9),
+ TYPE_FLAG_STATIC = (1 << 10),
+ TYPE_FLAG_PROTOTYPED = (1 << 11),
+ TYPE_FLAG_INCOMPLETE = (1 << 12),
+ TYPE_FLAG_VARARGS = (1 << 13),
+ TYPE_FLAG_VECTOR = (1 << 14),
+ TYPE_FLAG_FIXED_INSTANCE = (1 << 15),
+ TYPE_FLAG_STUB_SUPPORTED = (1 << 16),
+ TYPE_FLAG_NOTTEXT = (1 << 17),
+
+ /* Used for error-checking. */
+ TYPE_FLAG_MIN = TYPE_FLAG_UNSIGNED
+};
+
+/* Some bits for the type's instance_flags word. See the macros below
+ for documentation on each bit. Note that if you add a value here,
+ you must update the enum type_flag_value as well. */
+enum type_instance_flag_value
+{
+ TYPE_INSTANCE_FLAG_CONST = (1 << 0),
+ TYPE_INSTANCE_FLAG_VOLATILE = (1 << 1),
+ TYPE_INSTANCE_FLAG_CODE_SPACE = (1 << 2),
+ TYPE_INSTANCE_FLAG_DATA_SPACE = (1 << 3),
+ TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1 = (1 << 4),
+ TYPE_INSTANCE_FLAG_ADDRESS_CLASS_2 = (1 << 5)
+};
/* Unsigned integer type. If this is not set for a TYPE_CODE_INT, the
type is signed (unless TYPE_FLAG_NOSIGN (below) is set). */
-#define TYPE_FLAG_UNSIGNED (1 << 0)
-#define TYPE_UNSIGNED(t) (TYPE_FLAGS (t) & TYPE_FLAG_UNSIGNED)
+#define TYPE_UNSIGNED(t) (TYPE_MAIN_TYPE (t)->flag_unsigned)
/* No sign for this type. In C++, "char", "signed char", and "unsigned
char" are distinct types; so we need an extra flag to indicate the
absence of a sign! */
-#define TYPE_FLAG_NOSIGN (1 << 1)
-#define TYPE_NOSIGN(t) (TYPE_FLAGS (t) & TYPE_FLAG_NOSIGN)
+#define TYPE_NOSIGN(t) (TYPE_MAIN_TYPE (t)->flag_nosign)
/* This appears in a type's flags word if it is a stub type (e.g., if
someone referenced a type that wasn't defined in a source file
via (struct sir_not_appearing_in_this_film *)). */
-#define TYPE_FLAG_STUB (1 << 2)
-#define TYPE_STUB(t) (TYPE_FLAGS (t) & TYPE_FLAG_STUB)
+#define TYPE_STUB(t) (TYPE_MAIN_TYPE (t)->flag_stub)
/* The target type of this type is a stub type, and this type needs to
be updated if it gets un-stubbed in check_typedef.
@@ -172,8 +206,7 @@ enum type_code
gets set based on the TYPE_LENGTH of the target type.
Also, set for TYPE_CODE_TYPEDEF. */
-#define TYPE_FLAG_TARGET_STUB (1 << 3)
-#define TYPE_TARGET_STUB(t) (TYPE_FLAGS (t) & TYPE_FLAG_TARGET_STUB)
+#define TYPE_TARGET_STUB(t) (TYPE_MAIN_TYPE (t)->flag_target_stub)
/* Static type. If this is set, the corresponding type had
* a static modifier.
@@ -181,30 +214,13 @@ enum type_code
* are indicated by other means (bitpos == -1)
*/
-#define TYPE_FLAG_STATIC (1 << 4)
-#define TYPE_STATIC(t) (TYPE_FLAGS (t) & TYPE_FLAG_STATIC)
-
-/* Constant type. If this is set, the corresponding type has a
- * const modifier.
- */
-
-#define TYPE_FLAG_CONST (1 << 5)
-#define TYPE_CONST(t) (TYPE_INSTANCE_FLAGS (t) & TYPE_FLAG_CONST)
-
-/* Volatile type. If this is set, the corresponding type has a
- * volatile modifier.
- */
-
-#define TYPE_FLAG_VOLATILE (1 << 6)
-#define TYPE_VOLATILE(t) (TYPE_INSTANCE_FLAGS (t) & TYPE_FLAG_VOLATILE)
-
+#define TYPE_STATIC(t) (TYPE_MAIN_TYPE (t)->flag_static)
/* This is a function type which appears to have a prototype. We need this
for function calls in order to tell us if it's necessary to coerce the args,
or to just do the standard conversions. This is used with a short field. */
-#define TYPE_FLAG_PROTOTYPED (1 << 7)
-#define TYPE_PROTOTYPED(t) (TYPE_FLAGS (t) & TYPE_FLAG_PROTOTYPED)
+#define TYPE_PROTOTYPED(t) (TYPE_MAIN_TYPE (t)->flag_prototyped)
/* This flag is used to indicate that processing for this type
is incomplete.
@@ -214,8 +230,52 @@ enum type_code
info; the incomplete type has to be marked so that the class and
the method can be assigned correct types.) */
-#define TYPE_FLAG_INCOMPLETE (1 << 8)
-#define TYPE_INCOMPLETE(t) (TYPE_FLAGS (t) & TYPE_FLAG_INCOMPLETE)
+#define TYPE_INCOMPLETE(t) (TYPE_MAIN_TYPE (t)->flag_incomplete)
+
+/* FIXME drow/2002-06-03: Only used for methods, but applies as well
+ to functions. */
+
+#define TYPE_VARARGS(t) (TYPE_MAIN_TYPE (t)->flag_varargs)
+
+/* Identify a vector type. Gcc is handling this by adding an extra
+ attribute to the array type. We slurp that in as a new flag of a
+ type. This is used only in dwarf2read.c. */
+#define TYPE_VECTOR(t) (TYPE_MAIN_TYPE (t)->flag_vector)
+
+/* The debugging formats (especially STABS) do not contain enough information
+ to represent all Ada types---especially those whose size depends on
+ dynamic quantities. Therefore, the GNAT Ada compiler includes
+ extra information in the form of additional type definitions
+ connected by naming conventions. This flag indicates that the
+ type is an ordinary (unencoded) GDB type that has been created from
+ the necessary run-time information, and does not need further
+ interpretation. Optionally marks ordinary, fixed-size GDB type. */
+
+#define TYPE_FIXED_INSTANCE(t) (TYPE_MAIN_TYPE (t)->flag_fixed_instance)
+
+/* This debug target supports TYPE_STUB(t). In the unsupported case we have to
+ rely on NFIELDS to be zero etc., see TYPE_IS_OPAQUE ().
+ TYPE_STUB(t) with !TYPE_STUB_SUPPORTED(t) may exist if we only guessed
+ the TYPE_STUB(t) value (see dwarfread.c). */
+
+#define TYPE_STUB_SUPPORTED(t) (TYPE_MAIN_TYPE (t)->flag_stub_supported)
+
+/* Not textual. By default, GDB treats all single byte integers as
+ characters (or elements of strings) unless this flag is set. */
+
+#define TYPE_NOTTEXT(t) (TYPE_MAIN_TYPE (t)->flag_nottext)
+
+/* Constant type. If this is set, the corresponding type has a
+ * const modifier.
+ */
+
+#define TYPE_CONST(t) (TYPE_INSTANCE_FLAGS (t) & TYPE_INSTANCE_FLAG_CONST)
+
+/* Volatile type. If this is set, the corresponding type has a
+ * volatile modifier.
+ */
+
+#define TYPE_VOLATILE(t) (TYPE_INSTANCE_FLAGS (t) & TYPE_INSTANCE_FLAG_VOLATILE)
/* Instruction-space delimited type. This is for Harvard architectures
which have separate instruction and data address spaces (and perhaps
@@ -236,64 +296,26 @@ enum type_code
If neither flag is set, the default space for functions / methods
is instruction space, and for data objects is data memory. */
-#define TYPE_FLAG_CODE_SPACE (1 << 9)
-#define TYPE_CODE_SPACE(t) (TYPE_INSTANCE_FLAGS (t) & TYPE_FLAG_CODE_SPACE)
-
-#define TYPE_FLAG_DATA_SPACE (1 << 10)
-#define TYPE_DATA_SPACE(t) (TYPE_INSTANCE_FLAGS (t) & TYPE_FLAG_DATA_SPACE)
+#define TYPE_CODE_SPACE(t) \
+ (TYPE_INSTANCE_FLAGS (t) & TYPE_INSTANCE_FLAG_CODE_SPACE)
-/* FIXME drow/2002-06-03: Only used for methods, but applies as well
- to functions. */
-
-#define TYPE_FLAG_VARARGS (1 << 11)
-#define TYPE_VARARGS(t) (TYPE_FLAGS (t) & TYPE_FLAG_VARARGS)
-
-/* Identify a vector type. Gcc is handling this by adding an extra
- attribute to the array type. We slurp that in as a new flag of a
- type. This is used only in dwarf2read.c. */
-#define TYPE_FLAG_VECTOR (1 << 12)
-#define TYPE_VECTOR(t) (TYPE_FLAGS (t) & TYPE_FLAG_VECTOR)
+#define TYPE_DATA_SPACE(t) \
+ (TYPE_INSTANCE_FLAGS (t) & TYPE_INSTANCE_FLAG_DATA_SPACE)
/* Address class flags. Some environments provide for pointers whose
size is different from that of a normal pointer or address types
where the bits are interpreted differently than normal addresses. The
TYPE_FLAG_ADDRESS_CLASS_n flags may be used in target specific
ways to represent these different types of address classes. */
-#define TYPE_FLAG_ADDRESS_CLASS_1 (1 << 13)
#define TYPE_ADDRESS_CLASS_1(t) (TYPE_INSTANCE_FLAGS(t) \
- & TYPE_FLAG_ADDRESS_CLASS_1)
-#define TYPE_FLAG_ADDRESS_CLASS_2 (1 << 14)
+ & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1)
#define TYPE_ADDRESS_CLASS_2(t) (TYPE_INSTANCE_FLAGS(t) \
- & TYPE_FLAG_ADDRESS_CLASS_2)
-#define TYPE_FLAG_ADDRESS_CLASS_ALL (TYPE_FLAG_ADDRESS_CLASS_1 \
- | TYPE_FLAG_ADDRESS_CLASS_2)
+ & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_2)
+#define TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL \
+ (TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1 | TYPE_INSTANCE_FLAG_ADDRESS_CLASS_2)
#define TYPE_ADDRESS_CLASS_ALL(t) (TYPE_INSTANCE_FLAGS(t) \
- & TYPE_FLAG_ADDRESS_CLASS_ALL)
-
-/* The debugging formats (especially STABS) do not contain enough information
- to represent all Ada types---especially those whose size depends on
- dynamic quantities. Therefore, the GNAT Ada compiler includes
- extra information in the form of additional type definitions
- connected by naming conventions. This flag indicates that the
- type is an ordinary (unencoded) GDB type that has been created from
- the necessary run-time information, and does not need further
- interpretation. Optionally marks ordinary, fixed-size GDB type. */
-
-#define TYPE_FLAG_FIXED_INSTANCE (1 << 15)
-
-/* This debug target supports TYPE_STUB(t). In the unsupported case we have to
- rely on NFIELDS to be zero etc., see TYPE_IS_OPAQUE ().
- TYPE_STUB(t) with !TYPE_STUB_SUPPORTED(t) may exist if we only guessed
- the TYPE_STUB(t) value (see dwarfread.c). */
-
-#define TYPE_FLAG_STUB_SUPPORTED (1 << 16)
-#define TYPE_STUB_SUPPORTED(t) (TYPE_FLAGS (t) & TYPE_FLAG_STUB_SUPPORTED)
+ & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL)
-/* Not textual. By default, GDB treats all single byte integers as
- characters (or elements of strings) unless this flag is set. */
-
-#define TYPE_FLAG_NOTTEXT (1 << 17)
-#define TYPE_NOTTEXT(t) (TYPE_FLAGS (t) & TYPE_FLAG_NOTTEXT)
/* Array bound type. */
enum array_bound_type
@@ -321,6 +343,41 @@ struct main_type
ENUM_BITFIELD(array_bound_type) upper_bound_type : 4;
ENUM_BITFIELD(array_bound_type) lower_bound_type : 4;
+ /* Flags about this type. These fields appear at this location
+ because they packs nicely here. See the TYPE_* macros for
+ documentation about these fields. */
+
+ unsigned int flag_unsigned : 1;
+ unsigned int flag_nosign : 1;
+ unsigned int flag_stub : 1;
+ unsigned int flag_target_stub : 1;
+ unsigned int flag_static : 1;
+ unsigned int flag_prototyped : 1;
+ unsigned int flag_incomplete : 1;
+ unsigned int flag_varargs : 1;
+ unsigned int flag_vector : 1;
+ unsigned int flag_stub_supported : 1;
+ unsigned int flag_nottext : 1;
+ unsigned int flag_fixed_instance : 1;
+
+ /* Number of fields described for this type. This field appears at
+ this location because it packs nicely here. */
+
+ short nfields;
+
+ /* Field number of the virtual function table pointer in
+ VPTR_BASETYPE. If -1, we were unable to find the virtual
+ function table pointer in initial symbol reading, and
+ get_vptr_fieldno should be called to find it if possible.
+ get_vptr_fieldno will update this field if possible.
+ Otherwise the value is left at -1.
+
+ Unused if this type does not have virtual functions.
+
+ This field appears at this location because it packs nicely here. */
+
+ short vptr_fieldno;
+
/* Name of this type, or NULL if none.
This is used for printing only, except by poorly designed C++ code.
@@ -364,25 +421,6 @@ struct main_type
struct type *target_type;
- /* Flags about this type. */
-
- int flags;
-
- /* Number of fields described for this type */
-
- short nfields;
-
- /* Field number of the virtual function table pointer in
- VPTR_BASETYPE. If -1, we were unable to find the virtual
- function table pointer in initial symbol reading, and
- get_vptr_fieldno should be called to find it if possible.
- get_vptr_fieldno will update this field if possible.
- Otherwise the value is left at -1.
-
- Unused if this type does not have virtual functions. */
-
- short vptr_fieldno;
-
/* For structure and union types, a description of each field.
For set and pascal array types, there is one "field",
whose type is the domain type of the set or array.
@@ -766,7 +804,6 @@ extern void allocate_cplus_struct_type (struct type *);
calls check_typedef, TYPE_LENGTH (VALUE_TYPE (X)) is safe. */
#define TYPE_LENGTH(thistype) (thistype)->length
#define TYPE_OBJFILE(thistype) TYPE_MAIN_TYPE(thistype)->objfile
-#define TYPE_FLAGS(thistype) TYPE_MAIN_TYPE(thistype)->flags
/* Note that TYPE_CODE can be TYPE_CODE_TYPEDEF, so if you want the real
type, you need to do TYPE_CODE (check_type (this_type)). */
#define TYPE_CODE(thistype) TYPE_MAIN_TYPE(thistype)->code
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 6c8feb5..048454a 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -2038,7 +2038,7 @@ i386_mmx_type (struct gdbarch *gdbarch)
append_composite_type_field (t, "v8_int8",
init_vector_type (builtin_type_int8, 8));
- TYPE_FLAGS (t) |= TYPE_FLAG_VECTOR;
+ TYPE_VECTOR (t) = 1;
TYPE_NAME (t) = "builtin_type_vec64i";
tdep->i386_mmx_type = t;
}
@@ -2084,7 +2084,7 @@ i386_sse_type (struct gdbarch *gdbarch)
init_vector_type (builtin_type_int64, 2));
append_composite_type_field (t, "uint128", builtin_type_int128);
- TYPE_FLAGS (t) |= TYPE_FLAG_VECTOR;
+ TYPE_VECTOR (t) = 1;
TYPE_NAME (t) = "builtin_type_vec128i";
tdep->i386_sse_type = t;
}
diff --git a/gdb/iq2000-tdep.c b/gdb/iq2000-tdep.c
index 4843ff1..8581aee 100644
--- a/gdb/iq2000-tdep.c
+++ b/gdb/iq2000-tdep.c
@@ -93,7 +93,7 @@ iq2000_pointer_to_address (struct type * type, const gdb_byte * buf)
if (target == TYPE_CODE_FUNC
|| target == TYPE_CODE_METHOD
- || (TYPE_FLAGS (TYPE_TARGET_TYPE (type)) & TYPE_FLAG_CODE_SPACE) != 0)
+ || (TYPE_CODE_SPACE (TYPE_TARGET_TYPE (type))) != 0)
addr = insn_addr_from_ptr (addr);
return addr;
diff --git a/gdb/jv-lang.c b/gdb/jv-lang.c
index 6080839..f10d1b3 100644
--- a/gdb/jv-lang.c
+++ b/gdb/jv-lang.c
@@ -189,7 +189,7 @@ java_lookup_class (char *name)
TYPE_CODE (type) = TYPE_CODE_STRUCT;
INIT_CPLUS_SPECIFIC (type);
TYPE_TAG_NAME (type) = obsavestring (name, strlen (name), &objfile->objfile_obstack);
- TYPE_FLAGS (type) |= TYPE_FLAG_STUB;
+ TYPE_STUB (type) = 1;
TYPE ? = addr;
return type;
#else
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index 4f98419..4a7e6af 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -789,7 +789,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
/* All functions in C++ have prototypes. For C we don't have enough
information in the debug info. */
if (SYMBOL_LANGUAGE (s) == language_cplus)
- TYPE_FLAGS (SYMBOL_TYPE (s)) |= TYPE_FLAG_PROTOTYPED;
+ TYPE_PROTOTYPED (SYMBOL_TYPE (s)) = 1;
/* Create and enter a new lexical context */
b = new_block (FUNCTION_BLOCK);
@@ -1080,7 +1080,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
f++;
}
if (unsigned_enum)
- TYPE_FLAGS (t) |= TYPE_FLAG_UNSIGNED;
+ TYPE_UNSIGNED (t) = 1;
}
/* make this the current type */
top_stack->cur_type = t;
@@ -1094,7 +1094,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
do not create a symbol for it either. */
if (TYPE_NFIELDS (t) == 0)
{
- TYPE_FLAGS (t) |= TYPE_FLAG_STUB;
+ TYPE_STUB (t) = 1;
break;
}
@@ -1781,7 +1781,7 @@ upgrade_type (int fd, struct type **tpp, int tq, union aux_ext *ax, int bigend,
problem. */
if (TYPE_LENGTH (*tpp) == 0)
{
- TYPE_FLAGS (t) |= TYPE_FLAG_TARGET_STUB;
+ TYPE_TARGET_STUB (t) = 1;
}
*tpp = t;
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 08f926e..362cbe0 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -1907,7 +1907,7 @@ rs6000_builtin_type_vec64 (struct gdbarch *gdbarch)
append_composite_type_field (t, "v8_int8",
init_vector_type (builtin_type_int8, 8));
- TYPE_FLAGS (t) |= TYPE_FLAG_VECTOR;
+ TYPE_VECTOR (t) = 1;
TYPE_NAME (t) = "ppc_builtin_type_vec64";
tdep->ppc_builtin_type_vec64 = t;
}
diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c
index 73abdd1..36fbb2a 100644
--- a/gdb/sh-tdep.c
+++ b/gdb/sh-tdep.c
@@ -1080,7 +1080,7 @@ sh_push_dummy_call_fpu (struct gdbarch *gdbarch,
non-vararg argument to be on the stack, no matter how many
registers have been used so far. */
if (sh_is_renesas_calling_convention (func_type)
- && (TYPE_FLAGS (func_type) & TYPE_FLAG_VARARGS))
+ && (TYPE_VARARGS (func_type)))
last_reg_arg = TYPE_NFIELDS (func_type) - 2;
/* first force sp to a 4-byte alignment */
@@ -1217,7 +1217,7 @@ sh_push_dummy_call_nofpu (struct gdbarch *gdbarch,
non-vararg argument to be on the stack, no matter how many
registers have been used so far. */
if (sh_is_renesas_calling_convention (func_type)
- && (TYPE_FLAGS (func_type) & TYPE_FLAG_VARARGS))
+ && (TYPE_VARARGS (func_type)))
last_reg_arg = TYPE_NFIELDS (func_type) - 2;
/* first force sp to a 4-byte alignment */
diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c
index 64c7051..4b22798 100644
--- a/gdb/spu-tdep.c
+++ b/gdb/spu-tdep.c
@@ -78,7 +78,7 @@ spu_builtin_type_vec128 (struct gdbarch *gdbarch)
append_composite_type_field (t, "v4_float",
init_vector_type (builtin_type_float, 4));
- TYPE_FLAGS (t) |= TYPE_FLAG_VECTOR;
+ TYPE_VECTOR (t) = 1;
TYPE_NAME (t) = "spu_builtin_type_vec128";
tdep->spu_builtin_type_vec128 = t;
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index e9580f9..800e9c4 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -822,7 +822,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
than the "declared-as" type for unprototyped functions, so
we treat all functions as if they were prototyped. This is used
primarily for promotion when calling the function from GDB. */
- TYPE_FLAGS (SYMBOL_TYPE (sym)) |= TYPE_FLAG_PROTOTYPED;
+ TYPE_PROTOTYPED (SYMBOL_TYPE (sym)) = 1;
/* fall into process_prototype_types */
@@ -868,7 +868,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
TYPE_FIELD_ARTIFICIAL (ftype, nparams++) = 0;
}
TYPE_NFIELDS (ftype) = nparams;
- TYPE_FLAGS (ftype) |= TYPE_FLAG_PROTOTYPED;
+ TYPE_PROTOTYPED (ftype) = 1;
}
break;
@@ -1558,7 +1558,7 @@ again:
TYPE_CODE (type) = code;
TYPE_TAG_NAME (type) = type_name;
INIT_CPLUS_SPECIFIC (type);
- TYPE_FLAGS (type) |= TYPE_FLAG_STUB;
+ TYPE_STUB (type) = 1;
add_undefined_type (type, typenums);
return type;
@@ -1624,7 +1624,7 @@ again:
}
else
{
- TYPE_FLAGS (type) |= TYPE_FLAG_TARGET_STUB;
+ TYPE_TARGET_STUB (type) = 1;
TYPE_TARGET_TYPE (type) = xtype;
}
}
@@ -1719,7 +1719,7 @@ again:
TYPE_FIELD_TYPE (func_type, i) = t->type;
}
TYPE_NFIELDS (func_type) = num_args;
- TYPE_FLAGS (func_type) |= TYPE_FLAG_PROTOTYPED;
+ TYPE_PROTOTYPED (func_type) = 1;
type = func_type;
break;
@@ -3332,7 +3332,7 @@ read_struct_type (char **pp, struct type *type, enum type_code type_code,
INIT_CPLUS_SPECIFIC (type);
TYPE_CODE (type) = type_code;
- TYPE_FLAGS (type) &= ~TYPE_FLAG_STUB;
+ TYPE_STUB (type) = 0;
/* First comes the total size in bytes. */
@@ -3506,9 +3506,9 @@ read_enum_type (char **pp, struct type *type,
TYPE_LENGTH (type) = gdbarch_int_bit (gdbarch) / HOST_CHAR_BIT;
TYPE_CODE (type) = TYPE_CODE_ENUM;
- TYPE_FLAGS (type) &= ~TYPE_FLAG_STUB;
+ TYPE_STUB (type) = 0;
if (unsigned_enum)
- TYPE_FLAGS (type) |= TYPE_FLAG_UNSIGNED;
+ TYPE_UNSIGNED (type) = 1;
TYPE_NFIELDS (type) = nsyms;
TYPE_FIELDS (type) = (struct field *)
TYPE_ALLOC (type, sizeof (struct field) * nsyms);
diff --git a/gdb/testsuite/gdb.base/maint.exp b/gdb/testsuite/gdb.base/maint.exp
index 1955175..05786e7 100644
--- a/gdb/testsuite/gdb.base/maint.exp
+++ b/gdb/testsuite/gdb.base/maint.exp
@@ -401,7 +401,7 @@ gdb_expect {
send_gdb "maint print type argc\n"
gdb_expect {
- -re "type node $hex\r\nname .int. \\($hex\\)\r\ntagname .<NULL>. \\($hex\\)\r\ncode $hex \\(TYPE_CODE_INT\\)\r\nlength \[24\]\r\nupper_bound_type $hex \\(BOUND_SIMPLE\\)\r\nlower_bound_type $hex \\(BOUND_SIMPLE\\)\r\nobjfile $hex\r\ntarget_type $hex\r\npointer_type $hex\r\nreference_type $hex\r\ntype_chain $hex\r\ninstance_flags $hex\r\nflags $hex\r\nnfields 0 $hex\r\nvptr_basetype $hex\r\nvptr_fieldno -1\r\ntype_specific $hex\r\n$gdb_prompt $"\
+ -re "type node $hex\r\nname .int. \\($hex\\)\r\ntagname .<NULL>. \\($hex\\)\r\ncode $hex \\(TYPE_CODE_INT\\)\r\nlength \[24\]\r\nupper_bound_type $hex \\(BOUND_SIMPLE\\)\r\nlower_bound_type $hex \\(BOUND_SIMPLE\\)\r\nobjfile $hex\r\ntarget_type $hex\r\npointer_type $hex\r\nreference_type $hex\r\ntype_chain $hex\r\ninstance_flags $hex\r\nflags\r\nnfields 0 $hex\r\nvptr_basetype $hex\r\nvptr_fieldno -1\r\ntype_specific $hex\r\n$gdb_prompt $"\
{ pass "maint print type" }
-re ".*$gdb_prompt $" { fail "maint print type" }
timeout { fail "(timeout) maint print type" }
diff --git a/gdb/xml-tdesc.c b/gdb/xml-tdesc.c
index d66c0e3..42bc4a0 100644
--- a/gdb/xml-tdesc.c
+++ b/gdb/xml-tdesc.c
@@ -222,7 +222,7 @@ tdesc_end_union (struct gdb_xml_parser *parser,
for (i = 0; i < TYPE_NFIELDS (data->current_union); i++)
if (TYPE_VECTOR (TYPE_FIELD_TYPE (data->current_union, i)))
{
- TYPE_FLAGS (data->current_union) |= TYPE_FLAG_VECTOR;
+ TYPE_VECTOR (data->current_union) = 1;
break;
}
}
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: RFA: shrink main_type
2008-08-18 19:39 ` Tom Tromey
@ 2008-08-18 22:17 ` Andreas Schwab
2008-08-18 22:32 ` Daniel Jacobowitz
2008-08-19 5:13 ` Joel Brobecker
1 sibling, 1 reply; 25+ messages in thread
From: Andreas Schwab @ 2008-08-18 22:17 UTC (permalink / raw)
To: Tom Tromey; +Cc: Joel Brobecker, gdb-patches
Tom Tromey <tromey@redhat.com> writes:
> + /* Copy the common fields of types. For the main type, we simply
> + copy the entire thing and then update specific fields as needed. */
> + memcpy (TYPE_MAIN_TYPE (new_type), TYPE_MAIN_TYPE (type),
> + sizeof (struct main_type));
IMHO this should be written as an assignment.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, MaxfeldstraÃe 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: RFA: shrink main_type
2008-08-18 22:17 ` Andreas Schwab
@ 2008-08-18 22:32 ` Daniel Jacobowitz
0 siblings, 0 replies; 25+ messages in thread
From: Daniel Jacobowitz @ 2008-08-18 22:32 UTC (permalink / raw)
To: Andreas Schwab; +Cc: Tom Tromey, Joel Brobecker, gdb-patches
On Tue, Aug 19, 2008 at 12:17:01AM +0200, Andreas Schwab wrote:
> Tom Tromey <tromey@redhat.com> writes:
>
> > + /* Copy the common fields of types. For the main type, we simply
> > + copy the entire thing and then update specific fields as needed. */
> > + memcpy (TYPE_MAIN_TYPE (new_type), TYPE_MAIN_TYPE (type),
> > + sizeof (struct main_type));
>
> IMHO this should be written as an assignment.
I think it's equally clear this way...
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: RFA: shrink main_type
2008-08-18 19:39 ` Tom Tromey
2008-08-18 22:17 ` Andreas Schwab
@ 2008-08-19 5:13 ` Joel Brobecker
2008-08-19 17:56 ` Tom Tromey
1 sibling, 1 reply; 25+ messages in thread
From: Joel Brobecker @ 2008-08-19 5:13 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
:REVIEWMAIL:
> 2008-08-18 Tom Tromey <tromey@redhat.com>
(wow, I'm surprised you actually typed the entire changelog).
For the future, I think that saying something like this:
* gdbtype.h (...): bla bla bla.
* xml-tdesc.c: Update throughout.
Is OK. I remember reading something like this in the GNU Coding Standards.
Overall, the patch looks OK to me. I like how it simplifies the code
a little bit. I also like the fact that you separated the type flags and
the instance flags, and added INSTANCE to the enum name.
Most of the rest of the patch is fairly mechanical, and looked fine.
I think there is one incorrect change, however, inside copy_type_recursive:
> @@ -2933,24 +2973,19 @@ copy_type_recursive (struct objfile *objfile,
> stored->new = new_type;
> *slot = stored;
>
> - /* Copy the common fields of types. */
> - TYPE_CODE (new_type) = TYPE_CODE (type);
> - TYPE_ARRAY_UPPER_BOUND_TYPE (new_type) =
> - TYPE_ARRAY_UPPER_BOUND_TYPE (type);
> - TYPE_ARRAY_LOWER_BOUND_TYPE (new_type) =
> - TYPE_ARRAY_LOWER_BOUND_TYPE (type);
> + /* Copy the common fields of types. For the main type, we simply
> + copy the entire thing and then update specific fields as needed. */
> + memcpy (TYPE_MAIN_TYPE (new_type), TYPE_MAIN_TYPE (type),
> + sizeof (struct main_type));
> if (TYPE_NAME (type))
> TYPE_NAME (new_type) = xstrdup (TYPE_NAME (type));
> if (TYPE_TAG_NAME (type))
> TYPE_TAG_NAME (new_type) = xstrdup (TYPE_TAG_NAME (type));
> - TYPE_FLAGS (new_type) = TYPE_FLAGS (type);
> - TYPE_VPTR_FIELDNO (new_type) = TYPE_VPTR_FIELDNO (type);
>
> TYPE_INSTANCE_FLAGS (new_type) = TYPE_INSTANCE_FLAGS (type);
> TYPE_LENGTH (new_type) = TYPE_LENGTH (type);
>
> /* Copy the fields. */
> - TYPE_NFIELDS (new_type) = TYPE_NFIELDS (type);
> if (TYPE_NFIELDS (type))
> {
> int i, nfields;
Because of the memcpy, you end up copying over the objfile field,
which is incorrect, since this code is used to duplicate type
information that is independent of the given objfile. I think there
are other fields as well that are now implicitly copied (such as
vptr_fieldno, and type_specific), but I think that in this case
it's not harmful.
> if (ada_is_packed_array_type (type0) /* revisit? */
> - || (TYPE_FLAGS (type0) & TYPE_FLAG_FIXED_INSTANCE))
> + || (TYPE_FIXED_INSTANCE (type0)))
> return type0;
Major nit-picking: The '('/')' around TYPE_FIXED_INSTANCE (type0) is
no longer necessary. I won't hate you if you don't fix that, but
I do personally like it better without.
> - if (len == 0 && (TYPE_FLAGS (type) & TYPE_FLAG_STUB) != 0)
> + if (len == 0 && (TYPE_STUB (type)) != 0)
> return -1;
Similarly, I thin it would be more readable to have:
if (len == 0 && TYPE_STUB (type))
(again, that might be a personal preference, feel free to disagree)
I spotted a few more areas where I could make the same type of comment:
> diff --git a/gdb/iq2000-tdep.c b/gdb/iq2000-tdep.c
> index 4843ff1..8581aee 100644
> --- a/gdb/iq2000-tdep.c
> +++ b/gdb/iq2000-tdep.c
> @@ -93,7 +93,7 @@ iq2000_pointer_to_address (struct type * type, const gdb_byte * buf)
>
> if (target == TYPE_CODE_FUNC
> || target == TYPE_CODE_METHOD
> - || (TYPE_FLAGS (TYPE_TARGET_TYPE (type)) & TYPE_FLAG_CODE_SPACE) != 0)
> + || (TYPE_CODE_SPACE (TYPE_TARGET_TYPE (type))) != 0)
> --- a/gdb/sh-tdep.c
> +++ b/gdb/sh-tdep.c
> @@ -1080,7 +1080,7 @@ sh_push_dummy_call_fpu (struct gdbarch *gdbarch,
> non-vararg argument to be on the stack, no matter how many
> registers have been used so far. */
> if (sh_is_renesas_calling_convention (func_type)
> - && (TYPE_FLAGS (func_type) & TYPE_FLAG_VARARGS))
> + && (TYPE_VARARGS (func_type)))
> last_reg_arg = TYPE_NFIELDS (func_type) - 2;
>
> /* first force sp to a 4-byte alignment */
> @@ -1217,7 +1217,7 @@ sh_push_dummy_call_nofpu (struct gdbarch *gdbarch,
> non-vararg argument to be on the stack, no matter how many
> registers have been used so far. */
> if (sh_is_renesas_calling_convention (func_type)
> - && (TYPE_FLAGS (func_type) & TYPE_FLAG_VARARGS))
> + && (TYPE_VARARGS (func_type)))
> last_reg_arg = TYPE_NFIELDS (func_type) - 2;
The testcase update looked fine too, but was very difficult to read.
I didn't see anything wrong, so between you and I, it should be fine.
--
Joel
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: RFA: shrink main_type
2008-08-19 5:13 ` Joel Brobecker
@ 2008-08-19 17:56 ` Tom Tromey
2008-08-24 10:12 ` Joel Brobecker
2010-09-15 19:23 ` Ken Werner
0 siblings, 2 replies; 25+ messages in thread
From: Tom Tromey @ 2008-08-19 17:56 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches
>>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:
Joel> Most of the rest of the patch is fairly mechanical, and looked
Joel> fine. I think there is one incorrect change, however, inside
Joel> copy_type_recursive:
Thanks, I fixed that. I checked all the other fields too.
Joel> Major nit-picking: The '('/')' around TYPE_FIXED_INSTANCE (type0) is
Joel> no longer necessary. I won't hate you if you don't fix that, but
Joel> I do personally like it better without.
I fixed all these.
Joel> The testcase update looked fine too, but was very difficult to read.
Joel> I didn't see anything wrong, so between you and I, it should be fine.
Basically the output format changed slightly -- we used to emit a hex
number holding all the flags, but now we don't.
Here's a new patch with all comments addressed. I changed the memcpy
to a struct assignment, too.
Built & regtested on x86-64 (compile farm).
Ok?
Tom
2008-08-18 Tom Tromey <tromey@redhat.com>
* xml-tdesc.c (tdesc_end_union): Update.
* stabsread.c (define_symbol): Update.
(read_type): Update.
(read_struct_type): Update.
(read_enum_type): Update.
* spu-tdep.c (spu_builtin_type_vec128): Update.
* sh-tdep.c (sh_push_dummy_call_fpu): Update.
(sh_push_dummy_call_nofpu): Update.
* mdebugread.c (parse_symbol): Update.
(parse_symbol): Update.
(parse_symbol): Update.
(upgrade_type): Update.
* jv-lang.c (java_lookup_class): Update.
* iq2000-tdep.c (iq2000_pointer_to_address): Update.
* i386-tdep.c (i386_mmx_type): Update.
(i386_sse_type): Update.
* gdbtypes.h (enum type_flag_value): New enum.
(enum type_instance_flag_value): New enum.
(TYPE_FLAG_UNSIGNED, TYPE_FLAG_NOSIGN, TYPE_FLAG_STUB,
TYPE_FLAG_TARGET_STUB, TYPE_FLAG_STATIC, TYPE_FLAG_PROTOTYPED,
TYPE_FLAG_INCOMPLETE, TYPE_FLAG_VARARGS, TYPE_FLAG_VECTOR,
TYPE_FLAG_FIXED_INSTANCE, TYPE_FLAG_STUB_SUPPORTED,
TYPE_FLAG_NOTTEXT): Now enum constants.
(TYPE_FLAG_CONST, TYPE_FLAG_VOLATILE, TYPE_FLAG_CODE_SPACE,
TYPE_FLAG_DATA_SPACE, TYPE_FLAG_ADDRESS_CLASS_1,
TYPE_FLAG_ADDRESS_CLASS_2): Remove.
(TYPE_INSTANCE_FLAG_CONST, TYPE_INSTANCE_FLAG_VOLATILE,
TYPE_INSTANCE_FLAG_CODE_SPACE, TYPE_INSTANCE_FLAG_DATA_SPACE,
TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1,
TYPE_INSTANCE_FLAG_ADDRESS_CLASS_2): New constants.
(TYPE_UNSIGNED, TYPE_NOSIGN, TYPE_STUB, TYPE_TARGET_STUB,
TYPE_STATIC, TYPE_PROTOTYPED, TYPE_INCOMPLETE, TYPE_VARARGS,
TYPE_VECTOR, TYPE_FIXED_INSTANCE, TYPE_STUB_SUPPORTED,
TYPE_NOTTEXT): Update.
(TYPE_FLAG_ADDRESS_CLASS_ALL): Remove.
(TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL): New define.
(TYPE_VOLATILE, TYPE_CODE_SPACE, TYPE_DATA_SPACE,
TYPE_ADDRESS_CLASS_1, TYPE_ADDRESS_CLASS_2,
TYPE_ADDRESS_CLASS_ALL): Update.
(struct main_type) <flags>: Remove.
<flag_unsigned, flag_nosign, flag_stub, flag_target_stub,
flag_static, flag_prototyped, flag_incomplete, flag_varargs,
flag_vector, flag_stub_supported, flag_nottext,
flag_fixed_instance>: New fields.
<nfields, vptr_fieldno>: Move earlier.
(TYPE_FLAGS): Remove.
* gdbtypes.c (make_pointer_type): Update.
(address_space_name_to_int): Update.
(address_space_int_to_name): Update.
(make_type_with_address_space): Update.
(make_cv_type): Update.
(create_range_type): Update.
(get_discrete_bounds): Update.
(create_set_type): Update.
(make_vector_type): Update.
(smash_to_method_type): Update.
(check_typedef): Update.
(check_stub_method): Update.
(init_type): Individually assign flag fields.
(recursive_dump_type): Don't print entire TYPE_FLAGS field. Do
print TYPE_FIXED_INSTANCE, TYPE_STUB_SUPPORTED, and TYPE_NOTTEXT.
(copy_type_recursive): Copy the entire main type. Don't use
TYPE_FLAGS.
* features/rs6000/powerpc-altivec64l.c
(initialize_tdesc_powerpc_altivec64l): Update.
* features/rs6000/powerpc-altivec64.c
(initialize_tdesc_powerpc_altivec64): Update.
* features/rs6000/powerpc-altivec32l.c
(initialize_tdesc_powerpc_altivec32l): Update.
* features/rs6000/powerpc-altivec32.c
(initialize_tdesc_powerpc_altivec32): Update.
* features/rs6000/powerpc-7400.c (initialize_tdesc_powerpc_7400):
Update.
* features/arm-with-iwmmxt.c (initialize_tdesc_arm_with_iwmmxt):
Update.
* dwarf2read.c (read_structure_type): Update.
(read_enumeration_type): Likewise.
(process_enumeration_scope): Likewise.
(read_tag_pointer_type): Likewise.
(read_subroutine_type): Likewise.
(read_subroutine_type): Likewise.
* coffread.c (coff_read_enum_type): Update.
* ada-valprint.c (adjust_type_signedness): Update.
* ada-typeprint.c (print_record_field_types): Update.
* ada-lang.c (packed_array_type): Update.
(empty_record): Don't reset TYPE_FLAGS.
(ada_template_to_fixed_record_type_1): Update.
(ada_template_to_fixed_record_type_1): Likewise.
(template_to_static_fixed_type): Likewise.
(to_record_with_fixed_variant_part): Likewise.
(to_fixed_record_type): Likewise.
(to_fixed_array_type): Likewise.
(to_static_fixed_type): Likewise.
2008-08-18 Tom Tromey <tromey@redhat.com>
* gdb.base/maint.exp: Update "maint print type".
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 63f1a41..c369ad5 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -1828,7 +1828,7 @@ packed_array_type (struct type *type, long *elt_bits)
(*elt_bits + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT;
}
- TYPE_FLAGS (new_type) |= TYPE_FLAG_FIXED_INSTANCE;
+ TYPE_FIXED_INSTANCE (new_type) = 1;
return new_type;
}
@@ -6901,7 +6901,6 @@ empty_record (struct objfile *objfile)
TYPE_FIELDS (type) = NULL;
TYPE_NAME (type) = "<empty>";
TYPE_TAG_NAME (type) = NULL;
- TYPE_FLAGS (type) = 0;
TYPE_LENGTH (type) = 0;
return type;
}
@@ -6961,7 +6960,7 @@ ada_template_to_fixed_record_type_1 (struct type *type,
memset (TYPE_FIELDS (rtype), 0, sizeof (struct field) * nfields);
TYPE_NAME (rtype) = ada_type_name (type);
TYPE_TAG_NAME (rtype) = NULL;
- TYPE_FLAGS (rtype) |= TYPE_FLAG_FIXED_INSTANCE;
+ TYPE_FIXED_INSTANCE (rtype) = 1;
off = 0;
bit_len = 0;
@@ -7141,7 +7140,7 @@ template_to_static_fixed_type (struct type *type0)
sizeof (struct field) * nfields);
TYPE_NAME (type) = ada_type_name (type0);
TYPE_TAG_NAME (type) = NULL;
- TYPE_FLAGS (type) |= TYPE_FLAG_FIXED_INSTANCE;
+ TYPE_FIXED_INSTANCE (type) = 1;
TYPE_LENGTH (type) = 0;
}
TYPE_FIELD_TYPE (type, f) = new_type;
@@ -7186,7 +7185,7 @@ to_record_with_fixed_variant_part (struct type *type, const gdb_byte *valaddr,
sizeof (struct field) * nfields);
TYPE_NAME (rtype) = ada_type_name (type);
TYPE_TAG_NAME (rtype) = NULL;
- TYPE_FLAGS (rtype) |= TYPE_FLAG_FIXED_INSTANCE;
+ TYPE_FIXED_INSTANCE (rtype) = 1;
TYPE_LENGTH (rtype) = TYPE_LENGTH (type);
branch_type = to_fixed_variant_branch_type
@@ -7241,7 +7240,7 @@ to_fixed_record_type (struct type *type0, const gdb_byte *valaddr,
{
struct type *templ_type;
- if (TYPE_FLAGS (type0) & TYPE_FLAG_FIXED_INSTANCE)
+ if (TYPE_FIXED_INSTANCE (type0))
return type0;
templ_type = dynamic_template_type (type0);
@@ -7257,7 +7256,7 @@ to_fixed_record_type (struct type *type0, const gdb_byte *valaddr,
}
else
{
- TYPE_FLAGS (type0) |= TYPE_FLAG_FIXED_INSTANCE;
+ TYPE_FIXED_INSTANCE (type0) = 1;
return type0;
}
@@ -7322,7 +7321,7 @@ to_fixed_array_type (struct type *type0, struct value *dval,
struct type *result;
if (ada_is_packed_array_type (type0) /* revisit? */
- || (TYPE_FLAGS (type0) & TYPE_FLAG_FIXED_INSTANCE))
+ || TYPE_FIXED_INSTANCE (type0))
return type0;
index_type_desc = ada_find_parallel_type (type0, "___XA");
@@ -7382,7 +7381,7 @@ to_fixed_array_type (struct type *type0, struct value *dval,
error (_("array type with dynamic size is larger than varsize-limit"));
}
- TYPE_FLAGS (result) |= TYPE_FLAG_FIXED_INSTANCE;
+ TYPE_FIXED_INSTANCE (result) = 1;
return result;
}
@@ -7472,7 +7471,7 @@ to_static_fixed_type (struct type *type0)
if (type0 == NULL)
return NULL;
- if (TYPE_FLAGS (type0) & TYPE_FLAG_FIXED_INSTANCE)
+ if (TYPE_FIXED_INSTANCE (type0))
return type0;
type0 = ada_check_typedef (type0);
diff --git a/gdb/ada-typeprint.c b/gdb/ada-typeprint.c
index 4b1f9ff..8e39e0f 100644
--- a/gdb/ada-typeprint.c
+++ b/gdb/ada-typeprint.c
@@ -585,7 +585,7 @@ print_record_field_types (struct type *type, struct type *outer_type,
flds = 0;
len = TYPE_NFIELDS (type);
- if (len == 0 && (TYPE_FLAGS (type) & TYPE_FLAG_STUB) != 0)
+ if (len == 0 && TYPE_STUB (type))
return -1;
for (i = 0; i < len; i += 1)
diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c
index f09df20..82678f0 100644
--- a/gdb/ada-valprint.c
+++ b/gdb/ada-valprint.c
@@ -71,7 +71,7 @@ adjust_type_signedness (struct type *type)
{
if (type != NULL && TYPE_CODE (type) == TYPE_CODE_RANGE
&& TYPE_LOW_BOUND (type) >= 0)
- TYPE_FLAGS (type) |= TYPE_FLAG_UNSIGNED;
+ TYPE_UNSIGNED (type) = 1;
}
/* Assuming TYPE is a simple array type, prints its lower bound on STREAM,
diff --git a/gdb/coffread.c b/gdb/coffread.c
index e6cc389..f6f3b7e 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -2090,7 +2090,7 @@ coff_read_enum_type (int index, int length, int lastsym,
}
if (unsigned_enum)
- TYPE_FLAGS (type) |= TYPE_FLAG_UNSIGNED;
+ TYPE_UNSIGNED (type) = 1;
return type;
}
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 8f1062d..a8d0212 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -4058,9 +4058,9 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu)
TYPE_LENGTH (type) = 0;
}
- TYPE_FLAGS (type) |= TYPE_FLAG_STUB_SUPPORTED;
+ TYPE_STUB_SUPPORTED (type) = 1;
if (die_is_declaration (die, cu))
- TYPE_FLAGS (type) |= TYPE_FLAG_STUB;
+ TYPE_STUB (type) = 1;
/* We need to add the type field to the die immediately so we don't
infinitely recurse when dealing with pointers to the structure
@@ -4274,7 +4274,7 @@ read_enumeration_type (struct die_info *die, struct dwarf2_cu *cu)
Types. When another package uses such a type, an incomplete DIE
may be generated by the compiler. */
if (die_is_declaration (die, cu))
- TYPE_FLAGS (type) |= TYPE_FLAG_STUB;
+ TYPE_STUB (type) = 1;
return set_die_type (die, type, cu);
}
@@ -4410,7 +4410,7 @@ process_enumeration_scope (struct die_info *die, struct dwarf2_cu *cu)
xfree (fields);
}
if (unsigned_enum)
- TYPE_FLAGS (this_type) |= TYPE_FLAG_UNSIGNED;
+ TYPE_UNSIGNED (this_type) = 1;
}
new_symbol (die, this_type, cu);
@@ -4732,7 +4732,8 @@ read_tag_pointer_type (struct die_info *die, struct dwarf2_cu *cu)
type_flags = gdbarch_address_class_type_flags
(gdbarch, byte_size, addr_class);
- gdb_assert ((type_flags & ~TYPE_FLAG_ADDRESS_CLASS_ALL) == 0);
+ gdb_assert ((type_flags & ~TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL)
+ == 0);
type = make_type_with_address_space (type, type_flags);
}
else if (TYPE_LENGTH (type) != byte_size)
@@ -4879,7 +4880,7 @@ read_subroutine_type (struct die_info *die, struct dwarf2_cu *cu)
|| cu->language == language_cplus
|| cu->language == language_java
|| cu->language == language_pascal)
- TYPE_FLAGS (ftype) |= TYPE_FLAG_PROTOTYPED;
+ TYPE_PROTOTYPED (ftype) = 1;
/* Store the calling convention in the type if it's available in
the subroutine die. Otherwise set the calling convention to
@@ -4902,7 +4903,7 @@ read_subroutine_type (struct die_info *die, struct dwarf2_cu *cu)
if (child_die->tag == DW_TAG_formal_parameter)
nparams++;
else if (child_die->tag == DW_TAG_unspecified_parameters)
- TYPE_FLAGS (ftype) |= TYPE_FLAG_VARARGS;
+ TYPE_VARARGS (ftype) = 1;
child_die = sibling_die (child_die);
}
diff --git a/gdb/features/arm-with-iwmmxt.c b/gdb/features/arm-with-iwmmxt.c
index 8255c7f..d9c5221 100644
--- a/gdb/features/arm-with-iwmmxt.c
+++ b/gdb/features/arm-with-iwmmxt.c
@@ -59,7 +59,7 @@ initialize_tdesc_arm_with_iwmmxt (void)
append_composite_type_field (type, xstrdup ("u32"), field_type);
field_type = tdesc_named_type (feature, "uint64");
append_composite_type_field (type, xstrdup ("u64"), field_type);
- TYPE_FLAGS (type) |= TYPE_FLAG_VECTOR;
+ TYPE_VECTOR (type) = 1;
tdesc_record_type (feature, type);
tdesc_create_reg (feature, "wR0", 26, 1, NULL, 64, "iwmmxt_vec64i");
diff --git a/gdb/features/rs6000/powerpc-7400.c b/gdb/features/rs6000/powerpc-7400.c
index af0797e..4e9a5c5 100644
--- a/gdb/features/rs6000/powerpc-7400.c
+++ b/gdb/features/rs6000/powerpc-7400.c
@@ -170,7 +170,7 @@ initialize_tdesc_powerpc_7400 (void)
append_composite_type_field (type, xstrdup ("v8_int16"), field_type);
field_type = tdesc_named_type (feature, "v16i8");
append_composite_type_field (type, xstrdup ("v16_int8"), field_type);
- TYPE_FLAGS (type) |= TYPE_FLAG_VECTOR;
+ TYPE_VECTOR (type) = 1;
tdesc_record_type (feature, type);
tdesc_create_reg (feature, "vr0", 119, 1, NULL, 128, "vec128");
diff --git a/gdb/features/rs6000/powerpc-altivec32.c b/gdb/features/rs6000/powerpc-altivec32.c
index ff2aefa..db910ea 100644
--- a/gdb/features/rs6000/powerpc-altivec32.c
+++ b/gdb/features/rs6000/powerpc-altivec32.c
@@ -122,7 +122,7 @@ initialize_tdesc_powerpc_altivec32 (void)
append_composite_type_field (type, xstrdup ("v8_int16"), field_type);
field_type = tdesc_named_type (feature, "v16i8");
append_composite_type_field (type, xstrdup ("v16_int8"), field_type);
- TYPE_FLAGS (type) |= TYPE_FLAG_VECTOR;
+ TYPE_VECTOR (type) = 1;
tdesc_record_type (feature, type);
tdesc_create_reg (feature, "vr0", 71, 1, NULL, 128, "vec128");
diff --git a/gdb/features/rs6000/powerpc-altivec32l.c b/gdb/features/rs6000/powerpc-altivec32l.c
index c139c60..a08f09b 100644
--- a/gdb/features/rs6000/powerpc-altivec32l.c
+++ b/gdb/features/rs6000/powerpc-altivec32l.c
@@ -126,7 +126,7 @@ initialize_tdesc_powerpc_altivec32l (void)
append_composite_type_field (type, xstrdup ("v8_int16"), field_type);
field_type = tdesc_named_type (feature, "v16i8");
append_composite_type_field (type, xstrdup ("v16_int8"), field_type);
- TYPE_FLAGS (type) |= TYPE_FLAG_VECTOR;
+ TYPE_VECTOR (type) = 1;
tdesc_record_type (feature, type);
tdesc_create_reg (feature, "vr0", 73, 1, NULL, 128, "vec128");
diff --git a/gdb/features/rs6000/powerpc-altivec64.c b/gdb/features/rs6000/powerpc-altivec64.c
index 404a92d..dd1df89 100644
--- a/gdb/features/rs6000/powerpc-altivec64.c
+++ b/gdb/features/rs6000/powerpc-altivec64.c
@@ -122,7 +122,7 @@ initialize_tdesc_powerpc_altivec64 (void)
append_composite_type_field (type, xstrdup ("v8_int16"), field_type);
field_type = tdesc_named_type (feature, "v16i8");
append_composite_type_field (type, xstrdup ("v16_int8"), field_type);
- TYPE_FLAGS (type) |= TYPE_FLAG_VECTOR;
+ TYPE_VECTOR (type) = 1;
tdesc_record_type (feature, type);
tdesc_create_reg (feature, "vr0", 71, 1, NULL, 128, "vec128");
diff --git a/gdb/features/rs6000/powerpc-altivec64l.c b/gdb/features/rs6000/powerpc-altivec64l.c
index a5d4be7..892396d 100644
--- a/gdb/features/rs6000/powerpc-altivec64l.c
+++ b/gdb/features/rs6000/powerpc-altivec64l.c
@@ -126,7 +126,7 @@ initialize_tdesc_powerpc_altivec64l (void)
append_composite_type_field (type, xstrdup ("v8_int16"), field_type);
field_type = tdesc_named_type (feature, "v16i8");
append_composite_type_field (type, xstrdup ("v16_int8"), field_type);
- TYPE_FLAGS (type) |= TYPE_FLAG_VECTOR;
+ TYPE_VECTOR (type) = 1;
tdesc_record_type (feature, type);
tdesc_create_reg (feature, "vr0", 73, 1, NULL, 128, "vec128");
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 939a1dc..0849e09 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -277,7 +277,7 @@ make_pointer_type (struct type *type, struct type **typeptr)
/* Mark pointers as unsigned. The target converts between pointers
and addresses (CORE_ADDRs) using gdbarch_pointer_to_address and
gdbarch_address_to_pointer. */
- TYPE_FLAGS (ntype) |= TYPE_FLAG_UNSIGNED;
+ TYPE_UNSIGNED (ntype) = 1;
if (!TYPE_POINTER_TYPE (type)) /* Remember it, if don't have one. */
TYPE_POINTER_TYPE (type) = ntype;
@@ -429,9 +429,9 @@ address_space_name_to_int (char *space_identifier)
int type_flags;
/* Check for known address space delimiters. */
if (!strcmp (space_identifier, "code"))
- return TYPE_FLAG_CODE_SPACE;
+ return TYPE_INSTANCE_FLAG_CODE_SPACE;
else if (!strcmp (space_identifier, "data"))
- return TYPE_FLAG_DATA_SPACE;
+ return TYPE_INSTANCE_FLAG_DATA_SPACE;
else if (gdbarch_address_class_name_to_type_flags_p (gdbarch)
&& gdbarch_address_class_name_to_type_flags (gdbarch,
space_identifier,
@@ -448,11 +448,11 @@ const char *
address_space_int_to_name (int space_flag)
{
struct gdbarch *gdbarch = current_gdbarch;
- if (space_flag & TYPE_FLAG_CODE_SPACE)
+ if (space_flag & TYPE_INSTANCE_FLAG_CODE_SPACE)
return "code";
- else if (space_flag & TYPE_FLAG_DATA_SPACE)
+ else if (space_flag & TYPE_INSTANCE_FLAG_DATA_SPACE)
return "data";
- else if ((space_flag & TYPE_FLAG_ADDRESS_CLASS_ALL)
+ else if ((space_flag & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL)
&& gdbarch_address_class_type_flags_to_name_p (gdbarch))
return gdbarch_address_class_type_flags_to_name (gdbarch, space_flag);
else
@@ -525,8 +525,9 @@ make_type_with_address_space (struct type *type, int space_flag)
{
struct type *ntype;
int new_flags = ((TYPE_INSTANCE_FLAGS (type)
- & ~(TYPE_FLAG_CODE_SPACE | TYPE_FLAG_DATA_SPACE
- | TYPE_FLAG_ADDRESS_CLASS_ALL))
+ & ~(TYPE_INSTANCE_FLAG_CODE_SPACE
+ | TYPE_INSTANCE_FLAG_DATA_SPACE
+ | TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL))
| space_flag);
return make_qualified_type (type, new_flags, NULL);
@@ -553,13 +554,13 @@ make_cv_type (int cnst, int voltl,
struct objfile *objfile;
int new_flags = (TYPE_INSTANCE_FLAGS (type)
- & ~(TYPE_FLAG_CONST | TYPE_FLAG_VOLATILE));
+ & ~(TYPE_INSTANCE_FLAG_CONST | TYPE_INSTANCE_FLAG_VOLATILE));
if (cnst)
- new_flags |= TYPE_FLAG_CONST;
+ new_flags |= TYPE_INSTANCE_FLAG_CONST;
if (voltl)
- new_flags |= TYPE_FLAG_VOLATILE;
+ new_flags |= TYPE_INSTANCE_FLAG_VOLATILE;
if (typeptr && *typeptr != NULL)
{
@@ -699,7 +700,7 @@ create_range_type (struct type *result_type, struct type *index_type,
TYPE_CODE (result_type) = TYPE_CODE_RANGE;
TYPE_TARGET_TYPE (result_type) = index_type;
if (TYPE_STUB (index_type))
- TYPE_FLAGS (result_type) |= TYPE_FLAG_TARGET_STUB;
+ TYPE_TARGET_STUB (result_type) = 1;
else
TYPE_LENGTH (result_type) = TYPE_LENGTH (check_typedef (index_type));
TYPE_NFIELDS (result_type) = 2;
@@ -710,7 +711,7 @@ create_range_type (struct type *result_type, struct type *index_type,
TYPE_FIELD_BITPOS (result_type, 1) = high_bound;
if (low_bound >= 0)
- TYPE_FLAGS (result_type) |= TYPE_FLAG_UNSIGNED;
+ TYPE_UNSIGNED (result_type) = 1;
return (result_type);
}
@@ -748,7 +749,7 @@ get_discrete_bounds (struct type *type, LONGEST *lowp, LONGEST *highp)
/* Set unsigned indicator if warranted. */
if (*lowp >= 0)
{
- TYPE_FLAGS (type) |= TYPE_FLAG_UNSIGNED;
+ TYPE_UNSIGNED (type) = 1;
}
}
else
@@ -828,7 +829,7 @@ create_array_type (struct type *result_type,
/* TYPE_FLAG_TARGET_STUB will take care of zero length arrays */
if (TYPE_LENGTH (result_type) == 0)
- TYPE_FLAGS (result_type) |= TYPE_FLAG_TARGET_STUB;
+ TYPE_TARGET_STUB (result_type) = 1;
return (result_type);
}
@@ -882,7 +883,7 @@ create_set_type (struct type *result_type, struct type *domain_type)
TYPE_LENGTH (result_type)
= (bit_length + TARGET_CHAR_BIT - 1) / TARGET_CHAR_BIT;
if (low_bound >= 0)
- TYPE_FLAGS (result_type) |= TYPE_FLAG_UNSIGNED;
+ TYPE_UNSIGNED (result_type) = 1;
}
TYPE_FIELD_TYPE (result_type, 0) = domain_type;
@@ -947,7 +948,7 @@ make_vector_type (struct type *array_type)
TYPE_TARGET_TYPE (inner_array) = elt_type;
}
- TYPE_FLAGS (array_type) |= TYPE_FLAG_VECTOR;
+ TYPE_VECTOR (array_type) = 1;
}
struct type *
@@ -1015,7 +1016,7 @@ smash_to_method_type (struct type *type, struct type *domain,
TYPE_FIELDS (type) = args;
TYPE_NFIELDS (type) = nargs;
if (varargs)
- TYPE_FLAGS (type) |= TYPE_FLAG_VARARGS;
+ TYPE_VARARGS (type) = 1;
TYPE_LENGTH (type) = 1; /* In practice, this is never needed. */
TYPE_CODE (type) = TYPE_CODE_METHOD;
}
@@ -1526,12 +1527,12 @@ check_typedef (struct type *type)
nb_elements = high_bound - low_bound + 1;
TYPE_LENGTH (type) = nb_elements * TYPE_LENGTH (target_type);
- TYPE_FLAGS (type) &= ~TYPE_FLAG_TARGET_STUB;
+ TYPE_TARGET_STUB (type) = 0;
}
else if (TYPE_CODE (type) == TYPE_CODE_RANGE)
{
TYPE_LENGTH (type) = TYPE_LENGTH (target_type);
- TYPE_FLAGS (type) &= ~TYPE_FLAG_TARGET_STUB;
+ TYPE_TARGET_STUB (type) = 0;
}
}
/* Cache TYPE_LENGTH for future use. */
@@ -1675,10 +1676,10 @@ check_stub_method (struct type *type, int method_id, int signature_id)
TYPE_DOMAIN_TYPE (mtype) = type;
TYPE_FIELDS (mtype) = argtypes;
TYPE_NFIELDS (mtype) = argcount;
- TYPE_FLAGS (mtype) &= ~TYPE_FLAG_STUB;
+ TYPE_STUB (mtype) = 0;
TYPE_FN_FIELD_STUB (f, signature_id) = 0;
if (p[-2] == '.')
- TYPE_FLAGS (mtype) |= TYPE_FLAG_VARARGS;
+ TYPE_VARARGS (mtype) = 1;
xfree (demangled_name);
}
@@ -1760,7 +1761,33 @@ init_type (enum type_code code, int length, int flags,
type = alloc_type (objfile);
TYPE_CODE (type) = code;
TYPE_LENGTH (type) = length;
- TYPE_FLAGS (type) |= flags;
+
+ gdb_assert (!(flags & (TYPE_FLAG_MIN - 1)));
+ if (flags & TYPE_FLAG_UNSIGNED)
+ TYPE_UNSIGNED (type) = 1;
+ if (flags & TYPE_FLAG_NOSIGN)
+ TYPE_NOSIGN (type) = 1;
+ if (flags & TYPE_FLAG_STUB)
+ TYPE_STUB (type) = 1;
+ if (flags & TYPE_FLAG_TARGET_STUB)
+ TYPE_TARGET_STUB (type) = 1;
+ if (flags & TYPE_FLAG_STATIC)
+ TYPE_STATIC (type) = 1;
+ if (flags & TYPE_FLAG_PROTOTYPED)
+ TYPE_PROTOTYPED (type) = 1;
+ if (flags & TYPE_FLAG_INCOMPLETE)
+ TYPE_INCOMPLETE (type) = 1;
+ if (flags & TYPE_FLAG_VARARGS)
+ TYPE_VARARGS (type) = 1;
+ if (flags & TYPE_FLAG_VECTOR)
+ TYPE_VECTOR (type) = 1;
+ if (flags & TYPE_FLAG_STUB_SUPPORTED)
+ TYPE_STUB_SUPPORTED (type) = 1;
+ if (flags & TYPE_FLAG_NOTTEXT)
+ TYPE_NOTTEXT (type) = 1;
+ if (flags & TYPE_FLAG_FIXED_INSTANCE)
+ TYPE_FIXED_INSTANCE (type) = 1;
+
if ((name != NULL) && (objfile != NULL))
{
TYPE_NAME (type) = obsavestring (name, strlen (name),
@@ -1774,7 +1801,7 @@ init_type (enum type_code code, int length, int flags,
/* C++ fancies. */
if (name && strcmp (name, "char") == 0)
- TYPE_FLAGS (type) |= TYPE_FLAG_NOSIGN;
+ TYPE_NOSIGN (type) = 1;
if (code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION
|| code == TYPE_CODE_NAMESPACE)
@@ -2739,7 +2766,8 @@ recursive_dump_type (struct type *type, int spaces)
puts_filtered (" TYPE_FLAG_ADDRESS_CLASS_2");
}
puts_filtered ("\n");
- printfi_filtered (spaces, "flags 0x%x", TYPE_FLAGS (type));
+
+ printfi_filtered (spaces, "flags");
if (TYPE_UNSIGNED (type))
{
puts_filtered (" TYPE_FLAG_UNSIGNED");
@@ -2779,6 +2807,18 @@ recursive_dump_type (struct type *type, int spaces)
{
puts_filtered (" TYPE_FLAG_VECTOR");
}
+ if (TYPE_FIXED_INSTANCE (type))
+ {
+ puts_filtered (" TYPE_FIXED_INSTANCE");
+ }
+ if (TYPE_STUB_SUPPORTED (type))
+ {
+ puts_filtered (" TYPE_STUB_SUPPORTED");
+ }
+ if (TYPE_NOTTEXT (type))
+ {
+ puts_filtered (" TYPE_NOTTEXT");
+ }
puts_filtered ("\n");
printfi_filtered (spaces, "nfields %d ", TYPE_NFIELDS (type));
gdb_print_host_address (TYPE_FIELDS (type), gdb_stdout);
@@ -2933,24 +2973,20 @@ copy_type_recursive (struct objfile *objfile,
stored->new = new_type;
*slot = stored;
- /* Copy the common fields of types. */
- TYPE_CODE (new_type) = TYPE_CODE (type);
- TYPE_ARRAY_UPPER_BOUND_TYPE (new_type) =
- TYPE_ARRAY_UPPER_BOUND_TYPE (type);
- TYPE_ARRAY_LOWER_BOUND_TYPE (new_type) =
- TYPE_ARRAY_LOWER_BOUND_TYPE (type);
+ /* Copy the common fields of types. For the main type, we simply
+ copy the entire thing and then update specific fields as needed. */
+ *TYPE_MAIN_TYPE (new_type) = *TYPE_MAIN_TYPE (type);
+ TYPE_OBJFILE (new_type) = NULL;
+
if (TYPE_NAME (type))
TYPE_NAME (new_type) = xstrdup (TYPE_NAME (type));
if (TYPE_TAG_NAME (type))
TYPE_TAG_NAME (new_type) = xstrdup (TYPE_TAG_NAME (type));
- TYPE_FLAGS (new_type) = TYPE_FLAGS (type);
- TYPE_VPTR_FIELDNO (new_type) = TYPE_VPTR_FIELDNO (type);
TYPE_INSTANCE_FLAGS (new_type) = TYPE_INSTANCE_FLAGS (type);
TYPE_LENGTH (new_type) = TYPE_LENGTH (type);
/* Copy the fields. */
- TYPE_NFIELDS (new_type) = TYPE_NFIELDS (type);
if (TYPE_NFIELDS (type))
{
int i, nfields;
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 7ef7d67..25b8c43 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -144,27 +144,61 @@ enum type_code
#define TYPE_CODE_CLASS TYPE_CODE_STRUCT
-/* Some bits for the type's flags word, and macros to test them. */
+/* Some constants representing each bit field in the main_type. See
+ the bit-field-specific macros, below, for documentation of each
+ constant in this enum. These enum values are only used with
+ init_type. Note that the values are chosen not to conflict with
+ type_instance_flag_value; this lets init_type error-check its
+ input. */
+
+enum type_flag_value
+{
+ TYPE_FLAG_UNSIGNED = (1 << 6),
+ TYPE_FLAG_NOSIGN = (1 << 7),
+ TYPE_FLAG_STUB = (1 << 8),
+ TYPE_FLAG_TARGET_STUB = (1 << 9),
+ TYPE_FLAG_STATIC = (1 << 10),
+ TYPE_FLAG_PROTOTYPED = (1 << 11),
+ TYPE_FLAG_INCOMPLETE = (1 << 12),
+ TYPE_FLAG_VARARGS = (1 << 13),
+ TYPE_FLAG_VECTOR = (1 << 14),
+ TYPE_FLAG_FIXED_INSTANCE = (1 << 15),
+ TYPE_FLAG_STUB_SUPPORTED = (1 << 16),
+ TYPE_FLAG_NOTTEXT = (1 << 17),
+
+ /* Used for error-checking. */
+ TYPE_FLAG_MIN = TYPE_FLAG_UNSIGNED
+};
+
+/* Some bits for the type's instance_flags word. See the macros below
+ for documentation on each bit. Note that if you add a value here,
+ you must update the enum type_flag_value as well. */
+enum type_instance_flag_value
+{
+ TYPE_INSTANCE_FLAG_CONST = (1 << 0),
+ TYPE_INSTANCE_FLAG_VOLATILE = (1 << 1),
+ TYPE_INSTANCE_FLAG_CODE_SPACE = (1 << 2),
+ TYPE_INSTANCE_FLAG_DATA_SPACE = (1 << 3),
+ TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1 = (1 << 4),
+ TYPE_INSTANCE_FLAG_ADDRESS_CLASS_2 = (1 << 5)
+};
/* Unsigned integer type. If this is not set for a TYPE_CODE_INT, the
type is signed (unless TYPE_FLAG_NOSIGN (below) is set). */
-#define TYPE_FLAG_UNSIGNED (1 << 0)
-#define TYPE_UNSIGNED(t) (TYPE_FLAGS (t) & TYPE_FLAG_UNSIGNED)
+#define TYPE_UNSIGNED(t) (TYPE_MAIN_TYPE (t)->flag_unsigned)
/* No sign for this type. In C++, "char", "signed char", and "unsigned
char" are distinct types; so we need an extra flag to indicate the
absence of a sign! */
-#define TYPE_FLAG_NOSIGN (1 << 1)
-#define TYPE_NOSIGN(t) (TYPE_FLAGS (t) & TYPE_FLAG_NOSIGN)
+#define TYPE_NOSIGN(t) (TYPE_MAIN_TYPE (t)->flag_nosign)
/* This appears in a type's flags word if it is a stub type (e.g., if
someone referenced a type that wasn't defined in a source file
via (struct sir_not_appearing_in_this_film *)). */
-#define TYPE_FLAG_STUB (1 << 2)
-#define TYPE_STUB(t) (TYPE_FLAGS (t) & TYPE_FLAG_STUB)
+#define TYPE_STUB(t) (TYPE_MAIN_TYPE (t)->flag_stub)
/* The target type of this type is a stub type, and this type needs to
be updated if it gets un-stubbed in check_typedef.
@@ -172,8 +206,7 @@ enum type_code
gets set based on the TYPE_LENGTH of the target type.
Also, set for TYPE_CODE_TYPEDEF. */
-#define TYPE_FLAG_TARGET_STUB (1 << 3)
-#define TYPE_TARGET_STUB(t) (TYPE_FLAGS (t) & TYPE_FLAG_TARGET_STUB)
+#define TYPE_TARGET_STUB(t) (TYPE_MAIN_TYPE (t)->flag_target_stub)
/* Static type. If this is set, the corresponding type had
* a static modifier.
@@ -181,30 +214,13 @@ enum type_code
* are indicated by other means (bitpos == -1)
*/
-#define TYPE_FLAG_STATIC (1 << 4)
-#define TYPE_STATIC(t) (TYPE_FLAGS (t) & TYPE_FLAG_STATIC)
-
-/* Constant type. If this is set, the corresponding type has a
- * const modifier.
- */
-
-#define TYPE_FLAG_CONST (1 << 5)
-#define TYPE_CONST(t) (TYPE_INSTANCE_FLAGS (t) & TYPE_FLAG_CONST)
-
-/* Volatile type. If this is set, the corresponding type has a
- * volatile modifier.
- */
-
-#define TYPE_FLAG_VOLATILE (1 << 6)
-#define TYPE_VOLATILE(t) (TYPE_INSTANCE_FLAGS (t) & TYPE_FLAG_VOLATILE)
-
+#define TYPE_STATIC(t) (TYPE_MAIN_TYPE (t)->flag_static)
/* This is a function type which appears to have a prototype. We need this
for function calls in order to tell us if it's necessary to coerce the args,
or to just do the standard conversions. This is used with a short field. */
-#define TYPE_FLAG_PROTOTYPED (1 << 7)
-#define TYPE_PROTOTYPED(t) (TYPE_FLAGS (t) & TYPE_FLAG_PROTOTYPED)
+#define TYPE_PROTOTYPED(t) (TYPE_MAIN_TYPE (t)->flag_prototyped)
/* This flag is used to indicate that processing for this type
is incomplete.
@@ -214,8 +230,52 @@ enum type_code
info; the incomplete type has to be marked so that the class and
the method can be assigned correct types.) */
-#define TYPE_FLAG_INCOMPLETE (1 << 8)
-#define TYPE_INCOMPLETE(t) (TYPE_FLAGS (t) & TYPE_FLAG_INCOMPLETE)
+#define TYPE_INCOMPLETE(t) (TYPE_MAIN_TYPE (t)->flag_incomplete)
+
+/* FIXME drow/2002-06-03: Only used for methods, but applies as well
+ to functions. */
+
+#define TYPE_VARARGS(t) (TYPE_MAIN_TYPE (t)->flag_varargs)
+
+/* Identify a vector type. Gcc is handling this by adding an extra
+ attribute to the array type. We slurp that in as a new flag of a
+ type. This is used only in dwarf2read.c. */
+#define TYPE_VECTOR(t) (TYPE_MAIN_TYPE (t)->flag_vector)
+
+/* The debugging formats (especially STABS) do not contain enough information
+ to represent all Ada types---especially those whose size depends on
+ dynamic quantities. Therefore, the GNAT Ada compiler includes
+ extra information in the form of additional type definitions
+ connected by naming conventions. This flag indicates that the
+ type is an ordinary (unencoded) GDB type that has been created from
+ the necessary run-time information, and does not need further
+ interpretation. Optionally marks ordinary, fixed-size GDB type. */
+
+#define TYPE_FIXED_INSTANCE(t) (TYPE_MAIN_TYPE (t)->flag_fixed_instance)
+
+/* This debug target supports TYPE_STUB(t). In the unsupported case we have to
+ rely on NFIELDS to be zero etc., see TYPE_IS_OPAQUE ().
+ TYPE_STUB(t) with !TYPE_STUB_SUPPORTED(t) may exist if we only guessed
+ the TYPE_STUB(t) value (see dwarfread.c). */
+
+#define TYPE_STUB_SUPPORTED(t) (TYPE_MAIN_TYPE (t)->flag_stub_supported)
+
+/* Not textual. By default, GDB treats all single byte integers as
+ characters (or elements of strings) unless this flag is set. */
+
+#define TYPE_NOTTEXT(t) (TYPE_MAIN_TYPE (t)->flag_nottext)
+
+/* Constant type. If this is set, the corresponding type has a
+ * const modifier.
+ */
+
+#define TYPE_CONST(t) (TYPE_INSTANCE_FLAGS (t) & TYPE_INSTANCE_FLAG_CONST)
+
+/* Volatile type. If this is set, the corresponding type has a
+ * volatile modifier.
+ */
+
+#define TYPE_VOLATILE(t) (TYPE_INSTANCE_FLAGS (t) & TYPE_INSTANCE_FLAG_VOLATILE)
/* Instruction-space delimited type. This is for Harvard architectures
which have separate instruction and data address spaces (and perhaps
@@ -236,64 +296,26 @@ enum type_code
If neither flag is set, the default space for functions / methods
is instruction space, and for data objects is data memory. */
-#define TYPE_FLAG_CODE_SPACE (1 << 9)
-#define TYPE_CODE_SPACE(t) (TYPE_INSTANCE_FLAGS (t) & TYPE_FLAG_CODE_SPACE)
-
-#define TYPE_FLAG_DATA_SPACE (1 << 10)
-#define TYPE_DATA_SPACE(t) (TYPE_INSTANCE_FLAGS (t) & TYPE_FLAG_DATA_SPACE)
+#define TYPE_CODE_SPACE(t) \
+ (TYPE_INSTANCE_FLAGS (t) & TYPE_INSTANCE_FLAG_CODE_SPACE)
-/* FIXME drow/2002-06-03: Only used for methods, but applies as well
- to functions. */
-
-#define TYPE_FLAG_VARARGS (1 << 11)
-#define TYPE_VARARGS(t) (TYPE_FLAGS (t) & TYPE_FLAG_VARARGS)
-
-/* Identify a vector type. Gcc is handling this by adding an extra
- attribute to the array type. We slurp that in as a new flag of a
- type. This is used only in dwarf2read.c. */
-#define TYPE_FLAG_VECTOR (1 << 12)
-#define TYPE_VECTOR(t) (TYPE_FLAGS (t) & TYPE_FLAG_VECTOR)
+#define TYPE_DATA_SPACE(t) \
+ (TYPE_INSTANCE_FLAGS (t) & TYPE_INSTANCE_FLAG_DATA_SPACE)
/* Address class flags. Some environments provide for pointers whose
size is different from that of a normal pointer or address types
where the bits are interpreted differently than normal addresses. The
TYPE_FLAG_ADDRESS_CLASS_n flags may be used in target specific
ways to represent these different types of address classes. */
-#define TYPE_FLAG_ADDRESS_CLASS_1 (1 << 13)
#define TYPE_ADDRESS_CLASS_1(t) (TYPE_INSTANCE_FLAGS(t) \
- & TYPE_FLAG_ADDRESS_CLASS_1)
-#define TYPE_FLAG_ADDRESS_CLASS_2 (1 << 14)
+ & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1)
#define TYPE_ADDRESS_CLASS_2(t) (TYPE_INSTANCE_FLAGS(t) \
- & TYPE_FLAG_ADDRESS_CLASS_2)
-#define TYPE_FLAG_ADDRESS_CLASS_ALL (TYPE_FLAG_ADDRESS_CLASS_1 \
- | TYPE_FLAG_ADDRESS_CLASS_2)
+ & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_2)
+#define TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL \
+ (TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1 | TYPE_INSTANCE_FLAG_ADDRESS_CLASS_2)
#define TYPE_ADDRESS_CLASS_ALL(t) (TYPE_INSTANCE_FLAGS(t) \
- & TYPE_FLAG_ADDRESS_CLASS_ALL)
-
-/* The debugging formats (especially STABS) do not contain enough information
- to represent all Ada types---especially those whose size depends on
- dynamic quantities. Therefore, the GNAT Ada compiler includes
- extra information in the form of additional type definitions
- connected by naming conventions. This flag indicates that the
- type is an ordinary (unencoded) GDB type that has been created from
- the necessary run-time information, and does not need further
- interpretation. Optionally marks ordinary, fixed-size GDB type. */
-
-#define TYPE_FLAG_FIXED_INSTANCE (1 << 15)
-
-/* This debug target supports TYPE_STUB(t). In the unsupported case we have to
- rely on NFIELDS to be zero etc., see TYPE_IS_OPAQUE ().
- TYPE_STUB(t) with !TYPE_STUB_SUPPORTED(t) may exist if we only guessed
- the TYPE_STUB(t) value (see dwarfread.c). */
-
-#define TYPE_FLAG_STUB_SUPPORTED (1 << 16)
-#define TYPE_STUB_SUPPORTED(t) (TYPE_FLAGS (t) & TYPE_FLAG_STUB_SUPPORTED)
+ & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL)
-/* Not textual. By default, GDB treats all single byte integers as
- characters (or elements of strings) unless this flag is set. */
-
-#define TYPE_FLAG_NOTTEXT (1 << 17)
-#define TYPE_NOTTEXT(t) (TYPE_FLAGS (t) & TYPE_FLAG_NOTTEXT)
/* Array bound type. */
enum array_bound_type
@@ -321,6 +343,41 @@ struct main_type
ENUM_BITFIELD(array_bound_type) upper_bound_type : 4;
ENUM_BITFIELD(array_bound_type) lower_bound_type : 4;
+ /* Flags about this type. These fields appear at this location
+ because they packs nicely here. See the TYPE_* macros for
+ documentation about these fields. */
+
+ unsigned int flag_unsigned : 1;
+ unsigned int flag_nosign : 1;
+ unsigned int flag_stub : 1;
+ unsigned int flag_target_stub : 1;
+ unsigned int flag_static : 1;
+ unsigned int flag_prototyped : 1;
+ unsigned int flag_incomplete : 1;
+ unsigned int flag_varargs : 1;
+ unsigned int flag_vector : 1;
+ unsigned int flag_stub_supported : 1;
+ unsigned int flag_nottext : 1;
+ unsigned int flag_fixed_instance : 1;
+
+ /* Number of fields described for this type. This field appears at
+ this location because it packs nicely here. */
+
+ short nfields;
+
+ /* Field number of the virtual function table pointer in
+ VPTR_BASETYPE. If -1, we were unable to find the virtual
+ function table pointer in initial symbol reading, and
+ get_vptr_fieldno should be called to find it if possible.
+ get_vptr_fieldno will update this field if possible.
+ Otherwise the value is left at -1.
+
+ Unused if this type does not have virtual functions.
+
+ This field appears at this location because it packs nicely here. */
+
+ short vptr_fieldno;
+
/* Name of this type, or NULL if none.
This is used for printing only, except by poorly designed C++ code.
@@ -364,25 +421,6 @@ struct main_type
struct type *target_type;
- /* Flags about this type. */
-
- int flags;
-
- /* Number of fields described for this type */
-
- short nfields;
-
- /* Field number of the virtual function table pointer in
- VPTR_BASETYPE. If -1, we were unable to find the virtual
- function table pointer in initial symbol reading, and
- get_vptr_fieldno should be called to find it if possible.
- get_vptr_fieldno will update this field if possible.
- Otherwise the value is left at -1.
-
- Unused if this type does not have virtual functions. */
-
- short vptr_fieldno;
-
/* For structure and union types, a description of each field.
For set and pascal array types, there is one "field",
whose type is the domain type of the set or array.
@@ -766,7 +804,6 @@ extern void allocate_cplus_struct_type (struct type *);
calls check_typedef, TYPE_LENGTH (VALUE_TYPE (X)) is safe. */
#define TYPE_LENGTH(thistype) (thistype)->length
#define TYPE_OBJFILE(thistype) TYPE_MAIN_TYPE(thistype)->objfile
-#define TYPE_FLAGS(thistype) TYPE_MAIN_TYPE(thistype)->flags
/* Note that TYPE_CODE can be TYPE_CODE_TYPEDEF, so if you want the real
type, you need to do TYPE_CODE (check_type (this_type)). */
#define TYPE_CODE(thistype) TYPE_MAIN_TYPE(thistype)->code
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 6c8feb5..048454a 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -2038,7 +2038,7 @@ i386_mmx_type (struct gdbarch *gdbarch)
append_composite_type_field (t, "v8_int8",
init_vector_type (builtin_type_int8, 8));
- TYPE_FLAGS (t) |= TYPE_FLAG_VECTOR;
+ TYPE_VECTOR (t) = 1;
TYPE_NAME (t) = "builtin_type_vec64i";
tdep->i386_mmx_type = t;
}
@@ -2084,7 +2084,7 @@ i386_sse_type (struct gdbarch *gdbarch)
init_vector_type (builtin_type_int64, 2));
append_composite_type_field (t, "uint128", builtin_type_int128);
- TYPE_FLAGS (t) |= TYPE_FLAG_VECTOR;
+ TYPE_VECTOR (t) = 1;
TYPE_NAME (t) = "builtin_type_vec128i";
tdep->i386_sse_type = t;
}
diff --git a/gdb/iq2000-tdep.c b/gdb/iq2000-tdep.c
index 4843ff1..d7a47a2 100644
--- a/gdb/iq2000-tdep.c
+++ b/gdb/iq2000-tdep.c
@@ -93,7 +93,7 @@ iq2000_pointer_to_address (struct type * type, const gdb_byte * buf)
if (target == TYPE_CODE_FUNC
|| target == TYPE_CODE_METHOD
- || (TYPE_FLAGS (TYPE_TARGET_TYPE (type)) & TYPE_FLAG_CODE_SPACE) != 0)
+ || TYPE_CODE_SPACE (TYPE_TARGET_TYPE (type)))
addr = insn_addr_from_ptr (addr);
return addr;
diff --git a/gdb/jv-lang.c b/gdb/jv-lang.c
index 6080839..f10d1b3 100644
--- a/gdb/jv-lang.c
+++ b/gdb/jv-lang.c
@@ -189,7 +189,7 @@ java_lookup_class (char *name)
TYPE_CODE (type) = TYPE_CODE_STRUCT;
INIT_CPLUS_SPECIFIC (type);
TYPE_TAG_NAME (type) = obsavestring (name, strlen (name), &objfile->objfile_obstack);
- TYPE_FLAGS (type) |= TYPE_FLAG_STUB;
+ TYPE_STUB (type) = 1;
TYPE ? = addr;
return type;
#else
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index 4f98419..4a7e6af 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -789,7 +789,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
/* All functions in C++ have prototypes. For C we don't have enough
information in the debug info. */
if (SYMBOL_LANGUAGE (s) == language_cplus)
- TYPE_FLAGS (SYMBOL_TYPE (s)) |= TYPE_FLAG_PROTOTYPED;
+ TYPE_PROTOTYPED (SYMBOL_TYPE (s)) = 1;
/* Create and enter a new lexical context */
b = new_block (FUNCTION_BLOCK);
@@ -1080,7 +1080,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
f++;
}
if (unsigned_enum)
- TYPE_FLAGS (t) |= TYPE_FLAG_UNSIGNED;
+ TYPE_UNSIGNED (t) = 1;
}
/* make this the current type */
top_stack->cur_type = t;
@@ -1094,7 +1094,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
do not create a symbol for it either. */
if (TYPE_NFIELDS (t) == 0)
{
- TYPE_FLAGS (t) |= TYPE_FLAG_STUB;
+ TYPE_STUB (t) = 1;
break;
}
@@ -1781,7 +1781,7 @@ upgrade_type (int fd, struct type **tpp, int tq, union aux_ext *ax, int bigend,
problem. */
if (TYPE_LENGTH (*tpp) == 0)
{
- TYPE_FLAGS (t) |= TYPE_FLAG_TARGET_STUB;
+ TYPE_TARGET_STUB (t) = 1;
}
*tpp = t;
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index d48ea9e..fa00cc4 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -2087,7 +2087,7 @@ rs6000_builtin_type_vec64 (struct gdbarch *gdbarch)
append_composite_type_field (t, "v8_int8",
init_vector_type (builtin_type_int8, 8));
- TYPE_FLAGS (t) |= TYPE_FLAG_VECTOR;
+ TYPE_VECTOR (t) = 1;
TYPE_NAME (t) = "ppc_builtin_type_vec64";
tdep->ppc_builtin_type_vec64 = t;
}
diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c
index 73abdd1..911785a 100644
--- a/gdb/sh-tdep.c
+++ b/gdb/sh-tdep.c
@@ -1080,7 +1080,7 @@ sh_push_dummy_call_fpu (struct gdbarch *gdbarch,
non-vararg argument to be on the stack, no matter how many
registers have been used so far. */
if (sh_is_renesas_calling_convention (func_type)
- && (TYPE_FLAGS (func_type) & TYPE_FLAG_VARARGS))
+ && TYPE_VARARGS (func_type))
last_reg_arg = TYPE_NFIELDS (func_type) - 2;
/* first force sp to a 4-byte alignment */
@@ -1217,7 +1217,7 @@ sh_push_dummy_call_nofpu (struct gdbarch *gdbarch,
non-vararg argument to be on the stack, no matter how many
registers have been used so far. */
if (sh_is_renesas_calling_convention (func_type)
- && (TYPE_FLAGS (func_type) & TYPE_FLAG_VARARGS))
+ && TYPE_VARARGS (func_type))
last_reg_arg = TYPE_NFIELDS (func_type) - 2;
/* first force sp to a 4-byte alignment */
diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c
index 92cbd30..178ab5f 100644
--- a/gdb/spu-tdep.c
+++ b/gdb/spu-tdep.c
@@ -78,7 +78,7 @@ spu_builtin_type_vec128 (struct gdbarch *gdbarch)
append_composite_type_field (t, "v4_float",
init_vector_type (builtin_type_float, 4));
- TYPE_FLAGS (t) |= TYPE_FLAG_VECTOR;
+ TYPE_VECTOR (t) = 1;
TYPE_NAME (t) = "spu_builtin_type_vec128";
tdep->spu_builtin_type_vec128 = t;
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index e9580f9..800e9c4 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -822,7 +822,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
than the "declared-as" type for unprototyped functions, so
we treat all functions as if they were prototyped. This is used
primarily for promotion when calling the function from GDB. */
- TYPE_FLAGS (SYMBOL_TYPE (sym)) |= TYPE_FLAG_PROTOTYPED;
+ TYPE_PROTOTYPED (SYMBOL_TYPE (sym)) = 1;
/* fall into process_prototype_types */
@@ -868,7 +868,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
TYPE_FIELD_ARTIFICIAL (ftype, nparams++) = 0;
}
TYPE_NFIELDS (ftype) = nparams;
- TYPE_FLAGS (ftype) |= TYPE_FLAG_PROTOTYPED;
+ TYPE_PROTOTYPED (ftype) = 1;
}
break;
@@ -1558,7 +1558,7 @@ again:
TYPE_CODE (type) = code;
TYPE_TAG_NAME (type) = type_name;
INIT_CPLUS_SPECIFIC (type);
- TYPE_FLAGS (type) |= TYPE_FLAG_STUB;
+ TYPE_STUB (type) = 1;
add_undefined_type (type, typenums);
return type;
@@ -1624,7 +1624,7 @@ again:
}
else
{
- TYPE_FLAGS (type) |= TYPE_FLAG_TARGET_STUB;
+ TYPE_TARGET_STUB (type) = 1;
TYPE_TARGET_TYPE (type) = xtype;
}
}
@@ -1719,7 +1719,7 @@ again:
TYPE_FIELD_TYPE (func_type, i) = t->type;
}
TYPE_NFIELDS (func_type) = num_args;
- TYPE_FLAGS (func_type) |= TYPE_FLAG_PROTOTYPED;
+ TYPE_PROTOTYPED (func_type) = 1;
type = func_type;
break;
@@ -3332,7 +3332,7 @@ read_struct_type (char **pp, struct type *type, enum type_code type_code,
INIT_CPLUS_SPECIFIC (type);
TYPE_CODE (type) = type_code;
- TYPE_FLAGS (type) &= ~TYPE_FLAG_STUB;
+ TYPE_STUB (type) = 0;
/* First comes the total size in bytes. */
@@ -3506,9 +3506,9 @@ read_enum_type (char **pp, struct type *type,
TYPE_LENGTH (type) = gdbarch_int_bit (gdbarch) / HOST_CHAR_BIT;
TYPE_CODE (type) = TYPE_CODE_ENUM;
- TYPE_FLAGS (type) &= ~TYPE_FLAG_STUB;
+ TYPE_STUB (type) = 0;
if (unsigned_enum)
- TYPE_FLAGS (type) |= TYPE_FLAG_UNSIGNED;
+ TYPE_UNSIGNED (type) = 1;
TYPE_NFIELDS (type) = nsyms;
TYPE_FIELDS (type) = (struct field *)
TYPE_ALLOC (type, sizeof (struct field) * nsyms);
diff --git a/gdb/testsuite/gdb.base/maint.exp b/gdb/testsuite/gdb.base/maint.exp
index 1955175..05786e7 100644
--- a/gdb/testsuite/gdb.base/maint.exp
+++ b/gdb/testsuite/gdb.base/maint.exp
@@ -401,7 +401,7 @@ gdb_expect {
send_gdb "maint print type argc\n"
gdb_expect {
- -re "type node $hex\r\nname .int. \\($hex\\)\r\ntagname .<NULL>. \\($hex\\)\r\ncode $hex \\(TYPE_CODE_INT\\)\r\nlength \[24\]\r\nupper_bound_type $hex \\(BOUND_SIMPLE\\)\r\nlower_bound_type $hex \\(BOUND_SIMPLE\\)\r\nobjfile $hex\r\ntarget_type $hex\r\npointer_type $hex\r\nreference_type $hex\r\ntype_chain $hex\r\ninstance_flags $hex\r\nflags $hex\r\nnfields 0 $hex\r\nvptr_basetype $hex\r\nvptr_fieldno -1\r\ntype_specific $hex\r\n$gdb_prompt $"\
+ -re "type node $hex\r\nname .int. \\($hex\\)\r\ntagname .<NULL>. \\($hex\\)\r\ncode $hex \\(TYPE_CODE_INT\\)\r\nlength \[24\]\r\nupper_bound_type $hex \\(BOUND_SIMPLE\\)\r\nlower_bound_type $hex \\(BOUND_SIMPLE\\)\r\nobjfile $hex\r\ntarget_type $hex\r\npointer_type $hex\r\nreference_type $hex\r\ntype_chain $hex\r\ninstance_flags $hex\r\nflags\r\nnfields 0 $hex\r\nvptr_basetype $hex\r\nvptr_fieldno -1\r\ntype_specific $hex\r\n$gdb_prompt $"\
{ pass "maint print type" }
-re ".*$gdb_prompt $" { fail "maint print type" }
timeout { fail "(timeout) maint print type" }
diff --git a/gdb/xml-tdesc.c b/gdb/xml-tdesc.c
index d66c0e3..42bc4a0 100644
--- a/gdb/xml-tdesc.c
+++ b/gdb/xml-tdesc.c
@@ -222,7 +222,7 @@ tdesc_end_union (struct gdb_xml_parser *parser,
for (i = 0; i < TYPE_NFIELDS (data->current_union); i++)
if (TYPE_VECTOR (TYPE_FIELD_TYPE (data->current_union, i)))
{
- TYPE_FLAGS (data->current_union) |= TYPE_FLAG_VECTOR;
+ TYPE_VECTOR (data->current_union) = 1;
break;
}
}
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: RFA: shrink main_type
2008-08-19 17:56 ` Tom Tromey
@ 2008-08-24 10:12 ` Joel Brobecker
2008-08-24 16:41 ` Tom Tromey
2010-09-15 19:23 ` Ken Werner
1 sibling, 1 reply; 25+ messages in thread
From: Joel Brobecker @ 2008-08-24 10:12 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
> 2008-08-18 Tom Tromey <tromey@redhat.com>
>
> * xml-tdesc.c (tdesc_end_union): Update.
> * stabsread.c (define_symbol): Update.
> (read_type): Update.
> (read_struct_type): Update.
[...]
> (to_fixed_array_type): Likewise.
> (to_static_fixed_type): Likewise.
>
> 2008-08-18 Tom Tromey <tromey@redhat.com>
>
> * gdb.base/maint.exp: Update "maint print type".
Looks good! Please commit.
--
Joel
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: RFA: shrink main_type
2008-08-24 10:12 ` Joel Brobecker
@ 2008-08-24 16:41 ` Tom Tromey
2008-08-24 18:03 ` Tom Tromey
0 siblings, 1 reply; 25+ messages in thread
From: Tom Tromey @ 2008-08-24 16:41 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches
>>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:
Joel> Looks good! Please commit.
Thanks.
dwarf2read.c needed the additional appended hunk in order to compile.
This file changed since I wrote this patch. So, I am including this
in what I am going to commit.
Tom
***************
*** 5000,5006 ****
TYPE_TARGET_TYPE (type) = target_type;
if (name && strcmp (name, "char") == 0)
! TYPE_FLAGS (type) |= TYPE_FLAG_NOSIGN;
return set_die_type (die, type, cu);
}
--- 5001,5007 ----
TYPE_TARGET_TYPE (type) = target_type;
if (name && strcmp (name, "char") == 0)
! TYPE_NOSIGN (type) = 1;
return set_die_type (die, type, cu);
}
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: RFA: shrink main_type
2008-08-24 16:41 ` Tom Tromey
@ 2008-08-24 18:03 ` Tom Tromey
2008-08-24 20:35 ` Tom Tromey
0 siblings, 1 reply; 25+ messages in thread
From: Tom Tromey @ 2008-08-24 18:03 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches
>>>>> "Tom" == Tom Tromey <tromey@redhat.com> writes:
Tom> dwarf2read.c needed the additional appended hunk in order to compile.
Tom> This file changed since I wrote this patch. So, I am including this
Tom> in what I am going to commit.
It turns out I missed a couple other problems. My apologies -- I
messed up.
Here is the follow-up patch I am committing as obvious. It fixes the
remaining uses of TYPE_FLAGS in the tree.
Also, I didn't realize that the features/ files were generated from XML.
Whoops. I will send a follow-on patch for this.
While looking at this, I found that --enable-targets=all does not
build. Is this known? I'm thinking that in the future I would like
to enable this flag on my patch tester, so I miss fewer potential
problems in the future. Also I see a few --enable arguments related
to the gdb build in configure (build-warnings, werror,
gdb-build-warnings) ... should I be enabling any of these?
I tested the appended by building with a powerpc target enabled.
Tom
ChangeLog:
2008-08-24 Tom Tromey <tromey@redhat.com>
* rs6000-tdep.c (rs6000_builtin_type_vec128): Don't use
TYPE_FLAGS.
* features/rs6000/powerpc-vsx32l.c
(initialize_tdesc_powerpc_vsx32l): Update.
* features/rs6000/powerpc-vsx32.c
(initialize_tdesc_powerpc_vsx32): Update.
* features/rs6000/powerpc-vsx64.c
(initialize_tdesc_powerpc_vsx64): Update.
* features/rs6000/powerpc-vsx64l.c
(initialize_tdesc_powerpc_vsx64l): Update.
* target-descriptions.c (maint_print_c_tdesc_cmd): Emit
TYPE_VECTOR, not TYPE_FLAGS.
Index: rs6000-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/rs6000-tdep.c,v
retrieving revision 1.322
diff -u -r1.322 rs6000-tdep.c
--- rs6000-tdep.c 24 Aug 2008 16:39:57 -0000 1.322
+++ rs6000-tdep.c 24 Aug 2008 18:00:04 -0000
@@ -2128,7 +2128,7 @@
append_composite_type_field (t, "v16_int8",
init_vector_type (builtin_type_int8, 16));
- TYPE_FLAGS (t) |= TYPE_FLAG_VECTOR;
+ TYPE_VECTOR (t) = 1;
TYPE_NAME (t) = "ppc_builtin_type_vec128";
tdep->ppc_builtin_type_vec128 = t;
}
Index: target-descriptions.c
===================================================================
RCS file: /cvs/src/src/gdb/target-descriptions.c,v
retrieving revision 1.16
diff -u -r1.16 target-descriptions.c
--- target-descriptions.c 3 Jul 2008 23:14:35 -0000 1.16
+++ target-descriptions.c 24 Aug 2008 18:00:04 -0000
@@ -1096,7 +1096,7 @@
}
if (TYPE_VECTOR (type))
printf_unfiltered
- (" TYPE_FLAGS (type) |= TYPE_FLAG_VECTOR;\n");
+ (" TYPE_VECTOR (type) = 1;\n");
break;
default:
error (_("C output is not supported type \"%s\"."), TYPE_NAME (type));
Index: features/rs6000/powerpc-vsx32.c
===================================================================
RCS file: /cvs/src/src/gdb/features/rs6000/powerpc-vsx32.c,v
retrieving revision 1.1
diff -u -r1.1 powerpc-vsx32.c
--- features/rs6000/powerpc-vsx32.c 15 Aug 2008 15:18:34 -0000 1.1
+++ features/rs6000/powerpc-vsx32.c 24 Aug 2008 18:00:04 -0000
@@ -122,7 +122,7 @@
append_composite_type_field (type, xstrdup ("v8_int16"), field_type);
field_type = tdesc_named_type (feature, "v16i8");
append_composite_type_field (type, xstrdup ("v16_int8"), field_type);
- TYPE_FLAGS (type) |= TYPE_FLAG_VECTOR;
+ TYPE_VECTOR (type) = 1;
tdesc_record_type (feature, type);
tdesc_create_reg (feature, "vr0", 71, 1, NULL, 128, "vec128");
Index: features/rs6000/powerpc-vsx32l.c
===================================================================
RCS file: /cvs/src/src/gdb/features/rs6000/powerpc-vsx32l.c,v
retrieving revision 1.1
diff -u -r1.1 powerpc-vsx32l.c
--- features/rs6000/powerpc-vsx32l.c 15 Aug 2008 15:18:34 -0000 1.1
+++ features/rs6000/powerpc-vsx32l.c 24 Aug 2008 18:00:04 -0000
@@ -126,7 +126,7 @@
append_composite_type_field (type, xstrdup ("v8_int16"), field_type);
field_type = tdesc_named_type (feature, "v16i8");
append_composite_type_field (type, xstrdup ("v16_int8"), field_type);
- TYPE_FLAGS (type) |= TYPE_FLAG_VECTOR;
+ TYPE_VECTOR (type) = 1;
tdesc_record_type (feature, type);
tdesc_create_reg (feature, "vr0", 73, 1, NULL, 128, "vec128");
Index: features/rs6000/powerpc-vsx64.c
===================================================================
RCS file: /cvs/src/src/gdb/features/rs6000/powerpc-vsx64.c,v
retrieving revision 1.1
diff -u -r1.1 powerpc-vsx64.c
--- features/rs6000/powerpc-vsx64.c 15 Aug 2008 15:18:34 -0000 1.1
+++ features/rs6000/powerpc-vsx64.c 24 Aug 2008 18:00:04 -0000
@@ -122,7 +122,7 @@
append_composite_type_field (type, xstrdup ("v8_int16"), field_type);
field_type = tdesc_named_type (feature, "v16i8");
append_composite_type_field (type, xstrdup ("v16_int8"), field_type);
- TYPE_FLAGS (type) |= TYPE_FLAG_VECTOR;
+ TYPE_VECTOR (type) = 1;
tdesc_record_type (feature, type);
tdesc_create_reg (feature, "vr0", 71, 1, NULL, 128, "vec128");
Index: features/rs6000/powerpc-vsx64l.c
===================================================================
RCS file: /cvs/src/src/gdb/features/rs6000/powerpc-vsx64l.c,v
retrieving revision 1.1
diff -u -r1.1 powerpc-vsx64l.c
--- features/rs6000/powerpc-vsx64l.c 15 Aug 2008 15:18:34 -0000 1.1
+++ features/rs6000/powerpc-vsx64l.c 24 Aug 2008 18:00:04 -0000
@@ -126,7 +126,7 @@
append_composite_type_field (type, xstrdup ("v8_int16"), field_type);
field_type = tdesc_named_type (feature, "v16i8");
append_composite_type_field (type, xstrdup ("v16_int8"), field_type);
- TYPE_FLAGS (type) |= TYPE_FLAG_VECTOR;
+ TYPE_VECTOR (type) = 1;
tdesc_record_type (feature, type);
tdesc_create_reg (feature, "vr0", 73, 1, NULL, 128, "vec128");
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: RFA: shrink main_type
2008-08-24 18:03 ` Tom Tromey
@ 2008-08-24 20:35 ` Tom Tromey
2008-08-25 15:50 ` Joel Brobecker
0 siblings, 1 reply; 25+ messages in thread
From: Tom Tromey @ 2008-08-24 20:35 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches
Tom> It turns out I missed a couple other problems. My apologies -- I
Tom> messed up.
Sigh. One more problem.
While looking at the --enable-targets=all failure I found a rename I
missed in s390-tdep.c.
Fix appended.
Hopefully there aren't any more. I'm hardly confident in that at all
right now... anyway, if you find something, let me know and I will fix
it ASAP.
Tom
ChangeLog:
2008-08-24 Tom Tromey <tromey@redhat.com>
* s390-tdep.c (s390_address_class_type_flags): Use
TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1.
(s390_address_class_type_flags_to_name): Likewise.
(s390_address_class_name_to_type_flags): Likewise.
Index: s390-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/s390-tdep.c,v
retrieving revision 1.175
diff -u -r1.175 s390-tdep.c
--- s390-tdep.c 16 May 2008 00:27:23 -0000 1.175
+++ s390-tdep.c 24 Aug 2008 20:31:22 -0000
@@ -2278,7 +2278,7 @@
s390_address_class_type_flags (int byte_size, int dwarf2_addr_class)
{
if (byte_size == 4)
- return TYPE_FLAG_ADDRESS_CLASS_1;
+ return TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1;
else
return 0;
}
@@ -2286,7 +2286,7 @@
static const char *
s390_address_class_type_flags_to_name (struct gdbarch *gdbarch, int type_flags)
{
- if (type_flags & TYPE_FLAG_ADDRESS_CLASS_1)
+ if (type_flags & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1)
return "mode32";
else
return NULL;
@@ -2298,7 +2298,7 @@
{
if (strcmp (name, "mode32") == 0)
{
- *type_flags_ptr = TYPE_FLAG_ADDRESS_CLASS_1;
+ *type_flags_ptr = TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1;
return 1;
}
else
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: RFA: shrink main_type
2008-08-24 20:35 ` Tom Tromey
@ 2008-08-25 15:50 ` Joel Brobecker
2008-08-25 19:12 ` Tom Tromey
0 siblings, 1 reply; 25+ messages in thread
From: Joel Brobecker @ 2008-08-25 15:50 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
> Sigh. One more problem.
I couldn't help smiling at the situation because I've been there too.
> Hopefully there aren't any more. I'm hardly confident in that at all
> right now... anyway, if you find something, let me know and I will fix
> it ASAP.
I probably should have grep'ed for the various TYPE_FLAG_... names that
you changed when I reviewed your patch instead of assuming that you got
them all - I got lazy because I am under a bit of time pressure :-(.
Like you said, we'll fix any problem you might have left, so no big deal
as far as I am concerned. Thanks for acting on it so diligently :)
--
Joel
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: RFA: shrink main_type
2008-08-25 15:50 ` Joel Brobecker
@ 2008-08-25 19:12 ` Tom Tromey
0 siblings, 0 replies; 25+ messages in thread
From: Tom Tromey @ 2008-08-25 19:12 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches
Joel> I probably should have grep'ed for the various TYPE_FLAG_... names that
Joel> you changed when I reviewed your patch instead of assuming that you got
Joel> them all - I got lazy because I am under a bit of time pressure :-(.
Bah -- no, I don't agree, since of course you should be able to trust
me to do it. And actually I did do it, except I forgot to fully
re-check pre-commit, and I was relying on idutils, which didn't find
the TYPE_FLAG instance in a string. Bah.
Joel> Like you said, we'll fix any problem you might have left, so no big deal
Joel> as far as I am concerned. Thanks for acting on it so diligently :)
If I'm going to make mistakes the least I can do is clean them up :)
Tom
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: RFA: shrink main_type
2008-08-19 17:56 ` Tom Tromey
2008-08-24 10:12 ` Joel Brobecker
@ 2010-09-15 19:23 ` Ken Werner
2010-09-25 14:38 ` Ken Werner
2010-09-30 18:56 ` Joel Brobecker
1 sibling, 2 replies; 25+ messages in thread
From: Ken Werner @ 2010-09-15 19:23 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
[-- Attachment #1: Type: Text/Plain, Size: 1804 bytes --]
On Tuesday, August 19, 2008 07:55:37 pm Tom Tromey wrote:
> + /* Flags about this type. These fields appear at this location
> + because they packs nicely here. See the TYPE_* macros for
> + documentation about these fields. */
> +
> + unsigned int flag_unsigned : 1;
> + unsigned int flag_nosign : 1;
> + unsigned int flag_stub : 1;
> + unsigned int flag_target_stub : 1;
> + unsigned int flag_static : 1;
> + unsigned int flag_prototyped : 1;
> + unsigned int flag_incomplete : 1;
> + unsigned int flag_varargs : 1;
> + unsigned int flag_vector : 1;
> + unsigned int flag_stub_supported : 1;
> + unsigned int flag_nottext : 1;
> + unsigned int flag_fixed_instance : 1;
Hi Tom,
This is quite an old change but while debugging gdb I noticed that vector
types do have a strange bit set into their instance_flags and this seems to go
back to this patch.
The snippet above introduces the flag_nottext as a bitfield member of the type
struct while gdbtypes.c:make_vector_type still sets that bit into the
instance_flags.
The nottext flag is set for the element types of vectors
(gdbtypes.c:make_vector_type) and for the builtin_int8/builtin_int8 types. The
flag is read from the c-valprint.c:c_textual_element_type function that
determines whether arrays of chars should be printed as strings or not. So, I
guess that prior to this patch char vectors were printed just like integer
vectors - plain data. One approach to restore that functionality would be to
move the nottext flag into to the instance_flags of the type. Attached is an
untested patch of what I have in mind. Comments are welcome.
This also renders my previous attempt to fix the printing of character vectors
(http://sourceware.org/ml/gdb-patches/2010-06/msg00573.html) obsolete.
Regards
Ken Werner
[-- Attachment #2: type_nottext.patch --]
[-- Type: text/x-patch, Size: 4791 bytes --]
Index: gdb/c-valprint.c
===================================================================
RCS file: /cvs/src/src/gdb/c-valprint.c,v
retrieving revision 1.72
diff -p -u -r1.72 c-valprint.c
--- gdb/c-valprint.c 14 Jul 2010 14:13:54 -0000 1.72
+++ gdb/c-valprint.c 15 Sep 2010 12:22:49 -0000
@@ -180,8 +180,7 @@ c_val_print (struct type *type, const gd
/* Print arrays of textual chars with a string syntax, as
long as the entire array is valid. */
- if (!TYPE_VECTOR (type)
- && c_textual_element_type (unresolved_elttype, options->format)
+ if (c_textual_element_type (unresolved_elttype, options->format)
&& value_bits_valid (original_value,
TARGET_CHAR_BIT * embedded_offset,
TARGET_CHAR_BIT * TYPE_LENGTH (type)))
Index: gdb/gdbtypes.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtypes.c,v
retrieving revision 1.199
diff -p -u -r1.199 gdbtypes.c
--- gdb/gdbtypes.c 8 Sep 2010 17:17:42 -0000 1.199
+++ gdb/gdbtypes.c 15 Sep 2010 12:22:49 -0000
@@ -942,7 +942,7 @@ make_vector_type (struct type *array_typ
elt_type = TYPE_TARGET_TYPE (inner_array);
if (TYPE_CODE (elt_type) == TYPE_CODE_INT)
{
- flags = TYPE_INSTANCE_FLAGS (elt_type) | TYPE_FLAG_NOTTEXT;
+ flags = TYPE_INSTANCE_FLAGS (elt_type) | TYPE_INSTANCE_FLAG_NOTTEXT;
elt_type = make_qualified_type (elt_type, flags, NULL);
TYPE_TARGET_TYPE (inner_array) = elt_type;
}
@@ -1801,8 +1801,6 @@ init_type (enum type_code code, int leng
TYPE_VECTOR (type) = 1;
if (flags & TYPE_FLAG_STUB_SUPPORTED)
TYPE_STUB_SUPPORTED (type) = 1;
- if (flags & TYPE_FLAG_NOTTEXT)
- TYPE_NOTTEXT (type) = 1;
if (flags & TYPE_FLAG_FIXED_INSTANCE)
TYPE_FIXED_INSTANCE (type) = 1;
@@ -3490,8 +3488,10 @@ gdbtypes_post_init (struct gdbarch *gdba
= arch_integer_type (gdbarch, 128, 0, "int128_t");
builtin_type->builtin_uint128
= arch_integer_type (gdbarch, 128, 1, "uint128_t");
- TYPE_NOTTEXT (builtin_type->builtin_int8) = 1;
- TYPE_NOTTEXT (builtin_type->builtin_uint8) = 1;
+ TYPE_INSTANCE_FLAGS (builtin_type->builtin_int8) |=
+ TYPE_INSTANCE_FLAG_NOTTEXT;
+ TYPE_INSTANCE_FLAGS (builtin_type->builtin_uint8) |=
+ TYPE_INSTANCE_FLAG_NOTTEXT;
/* Wide character types. */
builtin_type->builtin_char16
Index: gdb/gdbtypes.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbtypes.h,v
retrieving revision 1.134
diff -p -u -r1.134 gdbtypes.h
--- gdb/gdbtypes.h 28 Jul 2010 16:23:58 -0000 1.134
+++ gdb/gdbtypes.h 15 Sep 2010 12:22:49 -0000
@@ -159,18 +159,17 @@ enum type_code
enum type_flag_value
{
- TYPE_FLAG_UNSIGNED = (1 << 6),
- TYPE_FLAG_NOSIGN = (1 << 7),
- TYPE_FLAG_STUB = (1 << 8),
- TYPE_FLAG_TARGET_STUB = (1 << 9),
- TYPE_FLAG_STATIC = (1 << 10),
- TYPE_FLAG_PROTOTYPED = (1 << 11),
- TYPE_FLAG_INCOMPLETE = (1 << 12),
- TYPE_FLAG_VARARGS = (1 << 13),
- TYPE_FLAG_VECTOR = (1 << 14),
- TYPE_FLAG_FIXED_INSTANCE = (1 << 15),
- TYPE_FLAG_STUB_SUPPORTED = (1 << 16),
- TYPE_FLAG_NOTTEXT = (1 << 17),
+ TYPE_FLAG_UNSIGNED = (1 << 7),
+ TYPE_FLAG_NOSIGN = (1 << 8),
+ TYPE_FLAG_STUB = (1 << 9),
+ TYPE_FLAG_TARGET_STUB = (1 << 10),
+ TYPE_FLAG_STATIC = (1 << 11),
+ TYPE_FLAG_PROTOTYPED = (1 << 12),
+ TYPE_FLAG_INCOMPLETE = (1 << 13),
+ TYPE_FLAG_VARARGS = (1 << 14),
+ TYPE_FLAG_VECTOR = (1 << 15),
+ TYPE_FLAG_FIXED_INSTANCE = (1 << 16),
+ TYPE_FLAG_STUB_SUPPORTED = (1 << 17),
/* Used for error-checking. */
TYPE_FLAG_MIN = TYPE_FLAG_UNSIGNED
@@ -186,7 +185,8 @@ enum type_instance_flag_value
TYPE_INSTANCE_FLAG_CODE_SPACE = (1 << 2),
TYPE_INSTANCE_FLAG_DATA_SPACE = (1 << 3),
TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1 = (1 << 4),
- TYPE_INSTANCE_FLAG_ADDRESS_CLASS_2 = (1 << 5)
+ TYPE_INSTANCE_FLAG_ADDRESS_CLASS_2 = (1 << 5),
+ TYPE_INSTANCE_FLAG_NOTTEXT = (1 << 6),
};
/* Unsigned integer type. If this is not set for a TYPE_CODE_INT, the
@@ -269,7 +269,7 @@ enum type_instance_flag_value
/* Not textual. By default, GDB treats all single byte integers as
characters (or elements of strings) unless this flag is set. */
-#define TYPE_NOTTEXT(t) (TYPE_MAIN_TYPE (t)->flag_nottext)
+#define TYPE_NOTTEXT(t) (TYPE_INSTANCE_FLAGS (t) & TYPE_INSTANCE_FLAG_NOTTEXT)
/* Type owner. If TYPE_OBJFILE_OWNED is true, the type is owned by
the objfile retrieved as TYPE_OBJFILE. Otherweise, the type is
@@ -388,7 +388,6 @@ struct main_type
unsigned int flag_varargs : 1;
unsigned int flag_vector : 1;
unsigned int flag_stub_supported : 1;
- unsigned int flag_nottext : 1;
unsigned int flag_fixed_instance : 1;
unsigned int flag_objfile_owned : 1;
/* True if this type was declared with "class" rather than
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: RFA: shrink main_type
2010-09-15 19:23 ` Ken Werner
@ 2010-09-25 14:38 ` Ken Werner
2010-09-30 18:56 ` Joel Brobecker
1 sibling, 0 replies; 25+ messages in thread
From: Ken Werner @ 2010-09-25 14:38 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
On Wednesday, September 15, 2010 2:41:43 pm Ken Werner wrote:
> On Tuesday, August 19, 2008 07:55:37 pm Tom Tromey wrote:
> > + /* Flags about this type. These fields appear at this location
> > + because they packs nicely here. See the TYPE_* macros for
> > + documentation about these fields. */
> > +
> > + unsigned int flag_unsigned : 1;
> > + unsigned int flag_nosign : 1;
> > + unsigned int flag_stub : 1;
> > + unsigned int flag_target_stub : 1;
> > + unsigned int flag_static : 1;
> > + unsigned int flag_prototyped : 1;
> > + unsigned int flag_incomplete : 1;
> > + unsigned int flag_varargs : 1;
> > + unsigned int flag_vector : 1;
> > + unsigned int flag_stub_supported : 1;
> > + unsigned int flag_nottext : 1;
> > + unsigned int flag_fixed_instance : 1;
>
> Hi Tom,
>
> This is quite an old change but while debugging gdb I noticed that vector
> types do have a strange bit set into their instance_flags and this seems to
> go back to this patch.
> The snippet above introduces the flag_nottext as a bitfield member of the
> type struct while gdbtypes.c:make_vector_type still sets that bit into the
> instance_flags.
>
> The nottext flag is set for the element types of vectors
> (gdbtypes.c:make_vector_type) and for the builtin_int8/builtin_int8 types.
> The flag is read from the c-valprint.c:c_textual_element_type function
> that determines whether arrays of chars should be printed as strings or
> not. So, I guess that prior to this patch char vectors were printed just
> like integer vectors - plain data. One approach to restore that
> functionality would be to move the nottext flag into to the instance_flags
> of the type. Attached is an untested patch of what I have in mind.
> Comments are welcome.
>
> This also renders my previous attempt to fix the printing of character
> vectors (http://sourceware.org/ml/gdb-patches/2010-06/msg00573.html)
> obsolete.
>
> Regards
> Ken Werner
Ping. : ) Since I screwed up the recipient list plus the fact that this was a
reply to a 2008 post it may be well hidden by the mail reader.
Are there any comments on that?
Thanks
Ken
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: RFA: shrink main_type
2010-09-15 19:23 ` Ken Werner
2010-09-25 14:38 ` Ken Werner
@ 2010-09-30 18:56 ` Joel Brobecker
2010-10-01 13:23 ` Ken Werner
2010-10-01 15:34 ` [patch] move the nottext flag to the instance_flags Ken Werner
1 sibling, 2 replies; 25+ messages in thread
From: Joel Brobecker @ 2010-09-30 18:56 UTC (permalink / raw)
To: Ken Werner; +Cc: gdb-patches
I'm sorry about the delay in getting to this. I hope it's something
temporary that we all seem to be busier than usual.
> One approach to restore that functionality would be to move the
> nottext flag into to the instance_flags of the type. Attached is an
> untested patch of what I have in mind. Comments are welcome.
It took me a while to figure out why this is necessary. Initially,
I thought that the vector type should have the NOTTEXT bit set,
but that wouldn't be sufficient for the case where we just print
one element of the vector (because we'd end up checking type of
the element and not find the NOTTEXT bit set, and thus print it
as a character rather than an integer.
Do I understand the situation correctly? If yes, can we add a test
that checks that, if not already there?
Based on that understanding, then I agree that the NOTTEXT flag
seems to be more of an instance flag than a type flag. The code
in make_vector_type seems to be confirming that.
If you make a proper submission for this patch, I will officially
review it.
--
Joel
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: RFA: shrink main_type
2010-09-30 18:56 ` Joel Brobecker
@ 2010-10-01 13:23 ` Ken Werner
2010-10-01 15:34 ` [patch] move the nottext flag to the instance_flags Ken Werner
1 sibling, 0 replies; 25+ messages in thread
From: Ken Werner @ 2010-10-01 13:23 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches
On Thursday, September 30, 2010 7:55:18 pm Joel Brobecker wrote:
> I'm sorry about the delay in getting to this. I hope it's something
> temporary that we all seem to be busier than usual.
Thanks for taking a look at this.
> > One approach to restore that functionality would be to move the
> > nottext flag into to the instance_flags of the type. Attached is an
> > untested patch of what I have in mind. Comments are welcome.
> It took me a while to figure out why this is necessary. Initially,
> I thought that the vector type should have the NOTTEXT bit set,
> but that wouldn't be sufficient for the case where we just print
> one element of the vector (because we'd end up checking type of
> the element and not find the NOTTEXT bit set, and thus print it
> as a character rather than an integer.
>
> Do I understand the situation correctly? If yes, can we add a test
> that checks that, if not already there?
I think you are right because c_textual_element_type queries the type of the
element to be printed. In case a single element of the vector is printed it is
the type of the vectors target type. Printing of character vectors is only
tested indirectly through gdb.arch/altivec-abi.exp. I think it would be good
to add a few tests to gdb.base/gnu_vector.exp.
> Based on that understanding, then I agree that the NOTTEXT flag
> seems to be more of an instance flag than a type flag. The code
> in make_vector_type seems to be confirming that.
>
> If you make a proper submission for this patch, I will officially
> review it.
When I first realized that printing of char vectors is awkward I attempted to
fix this at c-valprint (http://sourceware.org/ml/gdb-
patches/2010-06/msg00573.html) but overlooked that there already is a
mechanism for that. Then I learned about the NOTTEXT flag and thought Toms
shrink-main_type-patch broke the char vector printing and revived this mail
thread. Now I think this never worked because even the initial patch from Jan
(http://sourceware.org/ml/gdb-patches/2007-08/msg00467.html) writes the
nottext bit into the instance flags (make_vector_type) but the
textual_element_type function checks for a type flag. I think that moving
nottext flag into to the instance_flags of the type is a good way to fix this.
I'll post a proper patch soon.
Thanks
-ken
^ permalink raw reply [flat|nested] 25+ messages in thread
* [patch] move the nottext flag to the instance_flags
2010-09-30 18:56 ` Joel Brobecker
2010-10-01 13:23 ` Ken Werner
@ 2010-10-01 15:34 ` Ken Werner
2010-10-01 16:15 ` Joel Brobecker
1 sibling, 1 reply; 25+ messages in thread
From: Ken Werner @ 2010-10-01 15:34 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 572 bytes --]
On Thursday, September 30, 2010 7:55:18 pm Joel Brobecker wrote:
> If you make a proper submission for this patch, I will officially
> review it.
This patch moves the nottext flag into to the instance_flags of the
type to handle the printing of character vectors as discussed here:
http://sourceware.org/ml/gdb-patches/2010-10/msg00005.html
The initial patch on how char vectors should be treated can be found at:
http://sourceware.org/ml/gdb-patches/2007-08/msg00467.html
Tested on powerpc64-*-linux-gnu and i686-*-linux-gnu, no regressions.
OK to apply?
Thanks
-ken
[-- Attachment #2: type_nottext.patch --]
[-- Type: text/x-patch, Size: 9176 bytes --]
ChangeLog:
2010-10-01 Ken Werner <ken.werner@de.ibm.com>
* gdbtypes.h (struct main_type): Remove flag_nottext.
(enum type_flag_value): Remove TYPE_FLAG_NOTTEXT.
(enum type_instance_flag_value): Add TYPE_INSTANCE_FLAG_NOTTEXT.
(TYPE_NOTTEXT): Use TYPE_INSTANCE_FLAG_NOTTEXT instead of flag_nottext.
* gdbtypes.c (make_vector_type): Use TYPE_INSTANCE_FLAG_NOTTEXT instead
of TYPE_FLAG_NOTTEXT.
(init_type): Remove the initialization of the flag_nottext field.
(gdbtypes_post_init): Use TYPE_INSTANCE_FLAG_NOTTEXT instead of
TYPE_FLAG_NOTTEXT.
* c-valprint.c (c_val_print): Remove TYPE_VECTOR check.
testsuite/ChangeLog:
2010-10-01 Ken Werner <ken.werner@de.ibm.com>
* gdb.base/gnu_vector.c: Add variable c4.
* gdb.base/gnu_vector.exp: Add tests for character vector printing.
* gdb.arch/altivec-abi.exp: Fix expect pattern of character vectors.
Index: gdb/c-valprint.c
===================================================================
RCS file: /cvs/src/src/gdb/c-valprint.c,v
retrieving revision 1.72
diff -p -u -r1.72 c-valprint.c
--- gdb/c-valprint.c 14 Jul 2010 14:13:54 -0000 1.72
+++ gdb/c-valprint.c 1 Oct 2010 14:13:29 -0000
@@ -180,8 +180,7 @@ c_val_print (struct type *type, const gd
/* Print arrays of textual chars with a string syntax, as
long as the entire array is valid. */
- if (!TYPE_VECTOR (type)
- && c_textual_element_type (unresolved_elttype, options->format)
+ if (c_textual_element_type (unresolved_elttype, options->format)
&& value_bits_valid (original_value,
TARGET_CHAR_BIT * embedded_offset,
TARGET_CHAR_BIT * TYPE_LENGTH (type)))
Index: gdb/gdbtypes.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtypes.c,v
retrieving revision 1.199
diff -p -u -r1.199 gdbtypes.c
--- gdb/gdbtypes.c 8 Sep 2010 17:17:42 -0000 1.199
+++ gdb/gdbtypes.c 1 Oct 2010 14:13:30 -0000
@@ -942,7 +942,7 @@ make_vector_type (struct type *array_typ
elt_type = TYPE_TARGET_TYPE (inner_array);
if (TYPE_CODE (elt_type) == TYPE_CODE_INT)
{
- flags = TYPE_INSTANCE_FLAGS (elt_type) | TYPE_FLAG_NOTTEXT;
+ flags = TYPE_INSTANCE_FLAGS (elt_type) | TYPE_INSTANCE_FLAG_NOTTEXT;
elt_type = make_qualified_type (elt_type, flags, NULL);
TYPE_TARGET_TYPE (inner_array) = elt_type;
}
@@ -1801,8 +1801,6 @@ init_type (enum type_code code, int leng
TYPE_VECTOR (type) = 1;
if (flags & TYPE_FLAG_STUB_SUPPORTED)
TYPE_STUB_SUPPORTED (type) = 1;
- if (flags & TYPE_FLAG_NOTTEXT)
- TYPE_NOTTEXT (type) = 1;
if (flags & TYPE_FLAG_FIXED_INSTANCE)
TYPE_FIXED_INSTANCE (type) = 1;
@@ -3490,8 +3488,10 @@ gdbtypes_post_init (struct gdbarch *gdba
= arch_integer_type (gdbarch, 128, 0, "int128_t");
builtin_type->builtin_uint128
= arch_integer_type (gdbarch, 128, 1, "uint128_t");
- TYPE_NOTTEXT (builtin_type->builtin_int8) = 1;
- TYPE_NOTTEXT (builtin_type->builtin_uint8) = 1;
+ TYPE_INSTANCE_FLAGS (builtin_type->builtin_int8) |=
+ TYPE_INSTANCE_FLAG_NOTTEXT;
+ TYPE_INSTANCE_FLAGS (builtin_type->builtin_uint8) |=
+ TYPE_INSTANCE_FLAG_NOTTEXT;
/* Wide character types. */
builtin_type->builtin_char16
Index: gdb/gdbtypes.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbtypes.h,v
retrieving revision 1.134
diff -p -u -r1.134 gdbtypes.h
--- gdb/gdbtypes.h 28 Jul 2010 16:23:58 -0000 1.134
+++ gdb/gdbtypes.h 1 Oct 2010 14:13:30 -0000
@@ -159,18 +159,17 @@ enum type_code
enum type_flag_value
{
- TYPE_FLAG_UNSIGNED = (1 << 6),
- TYPE_FLAG_NOSIGN = (1 << 7),
- TYPE_FLAG_STUB = (1 << 8),
- TYPE_FLAG_TARGET_STUB = (1 << 9),
- TYPE_FLAG_STATIC = (1 << 10),
- TYPE_FLAG_PROTOTYPED = (1 << 11),
- TYPE_FLAG_INCOMPLETE = (1 << 12),
- TYPE_FLAG_VARARGS = (1 << 13),
- TYPE_FLAG_VECTOR = (1 << 14),
- TYPE_FLAG_FIXED_INSTANCE = (1 << 15),
- TYPE_FLAG_STUB_SUPPORTED = (1 << 16),
- TYPE_FLAG_NOTTEXT = (1 << 17),
+ TYPE_FLAG_UNSIGNED = (1 << 7),
+ TYPE_FLAG_NOSIGN = (1 << 8),
+ TYPE_FLAG_STUB = (1 << 9),
+ TYPE_FLAG_TARGET_STUB = (1 << 10),
+ TYPE_FLAG_STATIC = (1 << 11),
+ TYPE_FLAG_PROTOTYPED = (1 << 12),
+ TYPE_FLAG_INCOMPLETE = (1 << 13),
+ TYPE_FLAG_VARARGS = (1 << 14),
+ TYPE_FLAG_VECTOR = (1 << 15),
+ TYPE_FLAG_FIXED_INSTANCE = (1 << 16),
+ TYPE_FLAG_STUB_SUPPORTED = (1 << 17),
/* Used for error-checking. */
TYPE_FLAG_MIN = TYPE_FLAG_UNSIGNED
@@ -186,7 +185,8 @@ enum type_instance_flag_value
TYPE_INSTANCE_FLAG_CODE_SPACE = (1 << 2),
TYPE_INSTANCE_FLAG_DATA_SPACE = (1 << 3),
TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1 = (1 << 4),
- TYPE_INSTANCE_FLAG_ADDRESS_CLASS_2 = (1 << 5)
+ TYPE_INSTANCE_FLAG_ADDRESS_CLASS_2 = (1 << 5),
+ TYPE_INSTANCE_FLAG_NOTTEXT = (1 << 6),
};
/* Unsigned integer type. If this is not set for a TYPE_CODE_INT, the
@@ -269,7 +269,7 @@ enum type_instance_flag_value
/* Not textual. By default, GDB treats all single byte integers as
characters (or elements of strings) unless this flag is set. */
-#define TYPE_NOTTEXT(t) (TYPE_MAIN_TYPE (t)->flag_nottext)
+#define TYPE_NOTTEXT(t) (TYPE_INSTANCE_FLAGS (t) & TYPE_INSTANCE_FLAG_NOTTEXT)
/* Type owner. If TYPE_OBJFILE_OWNED is true, the type is owned by
the objfile retrieved as TYPE_OBJFILE. Otherweise, the type is
@@ -388,7 +388,6 @@ struct main_type
unsigned int flag_varargs : 1;
unsigned int flag_vector : 1;
unsigned int flag_stub_supported : 1;
- unsigned int flag_nottext : 1;
unsigned int flag_fixed_instance : 1;
unsigned int flag_objfile_owned : 1;
/* True if this type was declared with "class" rather than
Index: gdb/testsuite/gdb.arch/altivec-abi.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.arch/altivec-abi.exp,v
retrieving revision 1.20
diff -p -u -r1.20 altivec-abi.exp
--- gdb/testsuite/gdb.arch/altivec-abi.exp 14 Jul 2010 14:54:58 -0000 1.20
+++ gdb/testsuite/gdb.arch/altivec-abi.exp 1 Oct 2010 14:13:30 -0000
@@ -82,7 +82,7 @@ proc altivec_abi_tests { extra_flags for
# now all the arguments of vec_fun are initialized
- set pattern "vec_func .vshort_f=.111, 222, 333, 444, 555, 666, 777, 888., vushort_f=.100, 200, 300, 400, 500, 600, 700, 800., vint_f=.-10, -20, -30, -40., vuint_f=.1111, 2222, 3333, 4444., vchar_f=.97 'a', 98 'b', 99 'c', 100 'd', 101 'e', 102 'f', 103 'g', 104 'h', 105 'i', 108 'l', 109 'm', 110 'n', 111 'o', 112 'p', 113 'q', 114 'r'., vuchar_f=.65 'A', 66 'B', 67 'C', 68 'D', 69 'E', 70 'F', 71 'G', 72 'H', 73 'I', 76 'L', 77 'M', 78 'N', 79 'O', 80 'P', 81 'Q', 82 'R'., vfloat_f=.1.25, 3.75, 5.5, 1.25., x_f=.1, 2, 3, 4, 5, 6, 7, 8., y_f=.12, 22, 32, 42., a_f=.118 'v', 101 'e', 99 'c', 116 't', 111 'o', 114 'r', 32 ' ', 111 'o', 102 'f', 32 ' ', 99 'c', 104 'h', 97 'a', 114 'r', 115 's', 46 '.'., b_f=.5.5, 4.5, 3.75, 2.25., c_f=.1.25, 3.5, 5.5, 7.75., intv_on_stack_f=.12, 34, 56, 78.."
+ set pattern "vec_func .vshort_f=.111, 222, 333, 444, 555, 666, 777, 888., vushort_f=.100, 200, 300, 400, 500, 600, 700, 800., vint_f=.-10, -20, -30, -40., vuint_f=.1111, 2222, 3333, 4444., vchar_f=.97, 98, 99, 100, 101, 102, 103, 104, 105, 108, 109, 110, 111, 112, 113, 114., vuchar_f=.65, 66, 67, 68, 69, 70, 71, 72, 73, 76, 77, 78, 79, 80, 81, 82., vfloat_f=.1.25, 3.75, 5.5, 1.25., x_f=.1, 2, 3, 4, 5, 6, 7, 8., y_f=.12, 22, 32, 42., a_f=.118, 101, 99, 116, 111, 114, 32, 111, 102, 32, 99, 104, 97, 114, 115, 46., b_f=.5.5, 4.5, 3.75, 2.25., c_f=.1.25, 3.5, 5.5, 7.75., intv_on_stack_f=.12, 34, 56, 78.."
set pattern1 $pattern
append pattern1 " at.*altivec-abi.c.*vint_res = vec_add.*vint_f, intv_on_stack_f.;"
Index: gdb/testsuite/gdb.base/gnu_vector.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/gnu_vector.c,v
retrieving revision 1.1
diff -p -u -r1.1 gnu_vector.c
--- gdb/testsuite/gdb.base/gnu_vector.c 11 Aug 2010 16:48:26 -0000 1.1
+++ gdb/testsuite/gdb.base/gnu_vector.c 1 Oct 2010 14:13:30 -0000
@@ -17,6 +17,7 @@
Contributed by Ken Werner <ken.werner@de.ibm.com> */
+char __attribute__ ((vector_size (4 * sizeof(char)))) c4 = {1, 2, 3, 4};
int __attribute__ ((vector_size (4 * sizeof(int)))) i4a = {2, 4, 8, 16};
int __attribute__ ((vector_size (4 * sizeof(int)))) i4b = {1, 2, 8, 4};
float __attribute__ ((vector_size (4 * sizeof(float)))) f4a = {2, 4, 8, 16};
Index: gdb/testsuite/gdb.base/gnu_vector.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/gnu_vector.exp,v
retrieving revision 1.1
diff -p -u -r1.1 gnu_vector.exp
--- gdb/testsuite/gdb.base/gnu_vector.exp 11 Aug 2010 16:48:26 -0000 1.1
+++ gdb/testsuite/gdb.base/gnu_vector.exp 1 Oct 2010 14:13:30 -0000
@@ -46,6 +46,10 @@ if { ![runto main] } {
return -1
}
+# Test printing of character vector types
+gdb_test "print c4" "\\\$$decimal = \\{1, 2, 3, 4\\}"
+gdb_test "print c4\[2\]" "\\\$$decimal = 3"
+
# Test binary operators on integer vector types
gdb_test "print i4a" "\\\$$decimal = \\{2, 4, 8, 16\\}"
gdb_test "print i4b" "\\\$$decimal = \\{1, 2, 8, 4\\}"
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [patch] move the nottext flag to the instance_flags
2010-10-01 15:34 ` [patch] move the nottext flag to the instance_flags Ken Werner
@ 2010-10-01 16:15 ` Joel Brobecker
2010-10-05 21:50 ` Tom Tromey
0 siblings, 1 reply; 25+ messages in thread
From: Joel Brobecker @ 2010-10-01 16:15 UTC (permalink / raw)
To: Ken Werner; +Cc: gdb-patches
> 2010-10-01 Ken Werner <ken.werner@de.ibm.com>
>
> * gdbtypes.h (struct main_type): Remove flag_nottext.
> (enum type_flag_value): Remove TYPE_FLAG_NOTTEXT.
> (enum type_instance_flag_value): Add TYPE_INSTANCE_FLAG_NOTTEXT.
> (TYPE_NOTTEXT): Use TYPE_INSTANCE_FLAG_NOTTEXT instead of flag_nottext.
> * gdbtypes.c (make_vector_type): Use TYPE_INSTANCE_FLAG_NOTTEXT instead
> of TYPE_FLAG_NOTTEXT.
> (init_type): Remove the initialization of the flag_nottext field.
> (gdbtypes_post_init): Use TYPE_INSTANCE_FLAG_NOTTEXT instead of
> TYPE_FLAG_NOTTEXT.
> * c-valprint.c (c_val_print): Remove TYPE_VECTOR check.
>
> testsuite/ChangeLog:
>
> 2010-10-01 Ken Werner <ken.werner@de.ibm.com>
>
> * gdb.base/gnu_vector.c: Add variable c4.
> * gdb.base/gnu_vector.exp: Add tests for character vector printing.
> * gdb.arch/altivec-abi.exp: Fix expect pattern of character vectors.
Looks good to me. Can you wait, maybe a day or two to give Tom a chance
to comment before you commit, in case he spots something I didn't?
Thanks,
--
Joel
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [patch] move the nottext flag to the instance_flags
2010-10-01 16:15 ` Joel Brobecker
@ 2010-10-05 21:50 ` Tom Tromey
2010-10-06 8:45 ` Ken Werner
0 siblings, 1 reply; 25+ messages in thread
From: Tom Tromey @ 2010-10-05 21:50 UTC (permalink / raw)
To: Joel Brobecker; +Cc: Ken Werner, gdb-patches
>>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:
Joel> Looks good to me. Can you wait, maybe a day or two to give Tom a chance
Joel> to comment before you commit, in case he spots something I didn't?
I'm sorry about the delay on this.
I think this seems reasonable.
Tom
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [patch] move the nottext flag to the instance_flags
2010-10-05 21:50 ` Tom Tromey
@ 2010-10-06 8:45 ` Ken Werner
0 siblings, 0 replies; 25+ messages in thread
From: Ken Werner @ 2010-10-06 8:45 UTC (permalink / raw)
To: Tom Tromey; +Cc: Joel Brobecker, gdb-patches
On Tuesday, October 05, 2010 11:50:23 pm Tom Tromey wrote:
> >>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:
> Joel> Looks good to me. Can you wait, maybe a day or two to give Tom a
> chance Joel> to comment before you commit, in case he spots something I
> didn't?
>
> I'm sorry about the delay on this.
> I think this seems reasonable.
Patch applied.
http://sourceware.org/ml/gdb-cvs/2010-10/msg00031.html
Thanks
Ken
^ permalink raw reply [flat|nested] 25+ messages in thread
end of thread, other threads:[~2010-10-06 8:45 UTC | newest]
Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-17 18:50 RFA: shrink main_type Tom Tromey
2008-08-18 13:01 ` Joel Brobecker
2008-08-18 13:20 ` Daniel Jacobowitz
2008-08-18 13:30 ` Joel Brobecker
2008-08-18 15:19 ` Tom Tromey
2008-08-18 19:39 ` Tom Tromey
2008-08-18 22:17 ` Andreas Schwab
2008-08-18 22:32 ` Daniel Jacobowitz
2008-08-19 5:13 ` Joel Brobecker
2008-08-19 17:56 ` Tom Tromey
2008-08-24 10:12 ` Joel Brobecker
2008-08-24 16:41 ` Tom Tromey
2008-08-24 18:03 ` Tom Tromey
2008-08-24 20:35 ` Tom Tromey
2008-08-25 15:50 ` Joel Brobecker
2008-08-25 19:12 ` Tom Tromey
2010-09-15 19:23 ` Ken Werner
2010-09-25 14:38 ` Ken Werner
2010-09-30 18:56 ` Joel Brobecker
2010-10-01 13:23 ` Ken Werner
2010-10-01 15:34 ` [patch] move the nottext flag to the instance_flags Ken Werner
2010-10-01 16:15 ` Joel Brobecker
2010-10-05 21:50 ` Tom Tromey
2010-10-06 8:45 ` Ken Werner
2008-08-18 15:04 ` RFA: shrink main_type Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox