diff options
author | Jim Kingdon <jkingdon@engr.sgi.com> | 1993-11-15 20:13:30 +0000 |
---|---|---|
committer | Jim Kingdon <jkingdon@engr.sgi.com> | 1993-11-15 20:13:30 +0000 |
commit | dda398c369f499c0468c4cacdae9ff3d44555832 (patch) | |
tree | be4e446a92993ca5626a6ce627b7fe73ef9a41bf /gdb/gdbtypes.c | |
parent | f130fb33e52c99f7517cc94bf2b994d873649a2c (diff) | |
download | gdb-dda398c369f499c0468c4cacdae9ff3d44555832.zip gdb-dda398c369f499c0468c4cacdae9ff3d44555832.tar.gz gdb-dda398c369f499c0468c4cacdae9ff3d44555832.tar.bz2 |
* gdbtypes.h: Add TYPE_FLAG_TARGET_STUB.
* gdbtypes.c (check_stub_type): On TYPE_FLAG_TARGET_STUB, do
what cleanup_undefined_types does for arrays, except we clear
TYPE_FLAG_TARGET_STUB if we fix up the type.
* stabsread.c (cleanup_undefined_types): Add comments about how
doing arrays here is no longer the clean way to do it.
(read_array_type): Set TYPE_FLAG_TARGET_STUB as well as calling
add_undefined_type.
* c-typeprint.c, ch-typeprint.c: Move call to check_stub_type
outside switch so it happens for all type codes.
* cp-valprint.c (cp_print_value_fields): Recurse to val_print,
instead of c_val_print, so that check_stub_type gets called.
* gdbtypes.h, gdbtypes.c, m2-lang.c, ch-lang.c, c-lang.c: Remove
TYPE_FLAG_SIGNED. It was inconsistently set, never checked
(except in recursive_dump_type), and is pointless.
Diffstat (limited to 'gdb/gdbtypes.c')
-rw-r--r-- | gdb/gdbtypes.c | 43 |
1 files changed, 32 insertions, 11 deletions
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 473aac4..4755c82 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -790,13 +790,14 @@ fill_in_vptr_fieldno (type) If this is a stubbed struct (i.e. declared as struct foo *), see if we can find a full definition in some other file. If so, copy this - definition, so we can use it in future. If not, set a flag so we - don't waste too much time in future. (FIXME, this doesn't seem - to be happening...) + definition, so we can use it in future. There used to be a comment (but + not any code) that if we don't find a full definition, we'd set a flag + so we don't spend time in the future checking the same type. That would + be a mistake, though--we might load in more symbols which contain a + full definition for the type. This used to be coded as a macro, but I don't think it is called - often enough to merit such treatment. -*/ + often enough to merit such treatment. */ struct complaint stub_noname_complaint = {"stub type has NULL name", 0, 0}; @@ -822,7 +823,31 @@ check_stub_type (type) (struct symtab **) NULL); if (sym) { - memcpy ((char *)type, (char *)SYMBOL_TYPE(sym), sizeof (struct type)); + memcpy ((char *)type, + (char *)SYMBOL_TYPE(sym), + sizeof (struct type)); + } + } + + if (TYPE_FLAGS (type) & TYPE_FLAG_TARGET_STUB) + { + struct type *range_type; + + check_stub_type (TYPE_TARGET_TYPE (type)); + if (!(TYPE_FLAGS (TYPE_TARGET_TYPE (type)) & TYPE_FLAG_STUB) + && TYPE_CODE (type) == TYPE_CODE_ARRAY + && TYPE_NFIELDS (type) == 1 + && (TYPE_CODE (range_type = TYPE_FIELD_TYPE (type, 0)) + == TYPE_CODE_RANGE)) + { + /* Now recompute the length of the array type, based on its + number of elements and the target type's length. */ + TYPE_LENGTH (type) = + ((TYPE_FIELD_BITPOS (range_type, 1) + - TYPE_FIELD_BITPOS (range_type, 0) + + 1) + * TYPE_LENGTH (TYPE_TARGET_TYPE (type))); + TYPE_FLAGS (type) &= ~TYPE_FLAG_TARGET_STUB; } } } @@ -1295,10 +1320,6 @@ recursive_dump_type (type, spaces) { puts_filtered (" TYPE_FLAG_UNSIGNED"); } - if (TYPE_FLAGS (type) & TYPE_FLAG_SIGNED) - { - puts_filtered (" TYPE_FLAG_SIGNED"); - } if (TYPE_FLAGS (type) & TYPE_FLAG_STUB) { puts_filtered (" TYPE_FLAG_STUB"); @@ -1375,7 +1396,7 @@ _initialize_gdbtypes () "char", (struct objfile *) NULL); builtin_type_signed_char = init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT, - TYPE_FLAG_SIGNED, + 0, "signed char", (struct objfile *) NULL); builtin_type_unsigned_char = init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT, |