diff options
Diffstat (limited to 'gdb/ada-lang.c')
-rw-r--r-- | gdb/ada-lang.c | 3598 |
1 files changed, 1799 insertions, 1799 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 930a514..a1f5d93 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -112,18 +112,18 @@ static void ada_add_all_symbols (struct obstack *, const struct block *, static int is_nonfunction (struct block_symbol *, int); static void add_defn_to_vec (struct obstack *, struct symbol *, - const struct block *); + const struct block *); static int num_defns_collected (struct obstack *); static struct block_symbol *defns_collected (struct obstack *, int); static struct value *resolve_subexp (expression_up *, int *, int, - struct type *, int, + struct type *, int, innermost_block_tracker *); static void replace_operator_with_call (expression_up *, int, int, int, - struct symbol *, const struct block *); + struct symbol *, const struct block *); static int possible_user_operator_p (enum exp_opcode, struct value **); @@ -140,18 +140,18 @@ static int scalar_type_p (struct type *); static int discrete_type_p (struct type *); static struct type *ada_lookup_struct_elt_type (struct type *, const char *, - int, int); + int, int); static struct value *evaluate_subexp_type (struct expression *, int *); static struct type *ada_find_parallel_type_with_name (struct type *, - const char *); + const char *); static int is_dynamic_field (struct type *, int); static struct type *to_fixed_variant_branch_type (struct type *, const gdb_byte *, - CORE_ADDR, struct value *); + CORE_ADDR, struct value *); static struct type *to_fixed_array_type (struct type *, struct value *, int); @@ -175,10 +175,10 @@ static int ada_is_packed_array_type (struct type *); static int ada_is_unconstrained_packed_array_type (struct type *); static struct value *value_subscript_packed (struct value *, int, - struct value **); + struct value **); static struct value *coerce_unspec_val_to_type (struct value *, - struct type *); + struct type *); static int lesseq_defined_than (struct symbol *, struct symbol *); @@ -201,17 +201,17 @@ static struct value *val_atr (struct type *, LONGEST); static struct value *value_val_atr (struct type *, struct value *); static struct symbol *standard_lookup (const char *, const struct block *, - domain_enum); + domain_enum); static struct value *ada_search_struct_field (const char *, struct value *, int, - struct type *); + struct type *); static int find_struct_field (const char *, struct type *, int, - struct type **, int *, int *, int *, int *); + struct type **, int *, int *, int *, int *); static int ada_resolve_function (struct block_symbol *, int, - struct value **, int, const char *, - struct type *, int); + struct value **, int, const char *, + struct type *, int); static int ada_is_direct_array_type (struct type *); @@ -418,7 +418,7 @@ get_ada_pspace_data (struct program_space *pspace) return data; } - /* Utilities */ + /* Utilities */ /* If TYPE is a TYPE_CODE_TYPEDEF type, return the target type after all typedef layers have been peeled. Otherwise, return TYPE. @@ -505,7 +505,7 @@ grow_vect (void *vect, size_t *size, size_t min_size, int element_size) { *size *= 2; if (*size < min_size) - *size = min_size; + *size = min_size; vect = xrealloc (vect, *size * element_size); } return vect; @@ -522,9 +522,9 @@ field_name_match (const char *field_name, const char *target) return (strncmp (field_name, target, len) == 0 && (field_name[len] == '\0' - || (startswith (field_name + len, "___") - && strcmp (field_name + strlen (field_name) - 6, - "___XVN") != 0))); + || (startswith (field_name + len, "___") + && strcmp (field_name + strlen (field_name) - 6, + "___XVN") != 0))); } @@ -538,7 +538,7 @@ field_name_match (const char *field_name, const char *target) int ada_get_field_index (const struct type *type, const char *field_name, - int maybe_missing) + int maybe_missing) { int fieldno; struct type *struct_type = check_typedef ((struct type *) type); @@ -549,7 +549,7 @@ ada_get_field_index (const struct type *type, const char *field_name, if (!maybe_missing) error (_("Unable to find field %s in struct %s. Aborting"), - field_name, struct_type->name ()); + field_name, struct_type->name ()); return -1; } @@ -566,9 +566,9 @@ ada_name_prefix_len (const char *name) const char *p = strstr (name, "___"); if (p == NULL) - return strlen (name); + return strlen (name); else - return p - name; + return p - name; } } @@ -601,11 +601,11 @@ coerce_unspec_val_to_type (struct value *val, struct type *type) struct value *result; /* Make sure that the object size is not unreasonable before - trying to allocate some memory for it. */ + trying to allocate some memory for it. */ ada_ensure_varsize_limit (type); if (value_lazy (val) - || TYPE_LENGTH (type) > TYPE_LENGTH (value_type (val))) + || TYPE_LENGTH (type) > TYPE_LENGTH (value_type (val))) result = allocate_value_lazy (type); else { @@ -796,7 +796,7 @@ get_base_type (struct type *type) while (type != NULL && type->code () == TYPE_CODE_RANGE) { if (type == TYPE_TARGET_TYPE (type) || TYPE_TARGET_TYPE (type) == NULL) - return type; + return type; type = TYPE_TARGET_TYPE (type); } return type; @@ -814,12 +814,12 @@ ada_get_decoded_value (struct value *value) if (ada_is_array_descriptor_type (type) || (ada_is_constrained_packed_array_type (type) - && type->code () != TYPE_CODE_PTR)) + && type->code () != TYPE_CODE_PTR)) { if (type->code () == TYPE_CODE_TYPEDEF) /* array access type. */ - value = ada_coerce_to_simple_array_ptr (value); + value = ada_coerce_to_simple_array_ptr (value); else - value = ada_coerce_to_simple_array (value); + value = ada_coerce_to_simple_array (value); } else value = ada_to_fixed_value (value); @@ -843,7 +843,7 @@ ada_get_decoded_type (struct type *type) - /* Language Selection */ + /* Language Selection */ /* If the main program is in Ada, return language_ada, otherwise return LANG (the main program is in Ada iif the adainit symbol is found). */ @@ -878,7 +878,7 @@ ada_main_name (void) { CORE_ADDR main_program_name_addr = BMSYMBOL_VALUE_ADDRESS (msym); if (main_program_name_addr == 0) - error (_("Invalid address for Ada main program name.")); + error (_("Invalid address for Ada main program name.")); main_program_name = target_read_string (main_program_name_addr, 1024); return main_program_name.get (); @@ -888,7 +888,7 @@ ada_main_name (void) return NULL; } - /* Symbols */ + /* Symbols */ /* Table of Ada operators and their GNAT-encoded names. Last entry is pair of NULLs. */ @@ -934,14 +934,14 @@ ada_encode_1 (const char *decoded, bool throw_errors) if (*p == '.') encoding_buffer.append ("__"); else if (*p == '"') - { - const struct ada_opname_map *mapping; - - for (mapping = ada_opname_table; - mapping->encoded != NULL - && !startswith (p, mapping->decoded); mapping += 1) - ; - if (mapping->encoded == NULL) + { + const struct ada_opname_map *mapping; + + for (mapping = ada_opname_table; + mapping->encoded != NULL + && !startswith (p, mapping->decoded); mapping += 1) + ; + if (mapping->encoded == NULL) { if (throw_errors) error (_("invalid Ada operator name: %s"), p); @@ -949,8 +949,8 @@ ada_encode_1 (const char *decoded, bool throw_errors) return {}; } encoding_buffer.append (mapping->encoded); - break; - } + break; + } else encoding_buffer.push_back (*p); } @@ -989,7 +989,7 @@ ada_fold_name (gdb::string_view name) int i; for (i = 0; i <= len; i += 1) - fold_buffer[i] = tolower (name[i]); + fold_buffer[i] = tolower (name[i]); } return fold_buffer; @@ -1023,15 +1023,15 @@ ada_remove_trailing_digits (const char *encoded, int *len) int i = *len - 2; while (i > 0 && isdigit (encoded[i])) - i--; + i--; if (i >= 0 && encoded[i] == '.') - *len = i; + *len = i; else if (i >= 0 && encoded[i] == '$') - *len = i; + *len = i; else if (i >= 2 && startswith (encoded + i - 2, "___")) - *len = i - 2; + *len = i - 2; else if (i >= 1 && startswith (encoded + i - 1, "__")) - *len = i - 1; + *len = i - 1; } } @@ -1100,9 +1100,9 @@ ada_decode (const char *encoded) if (p != NULL && p - encoded < len0 - 3) { if (p[3] == 'X') - len0 = p - encoded; + len0 = p - encoded; else - goto Suppress; + goto Suppress; } /* Remove any trailing TKB suffix. It tells us that this symbol @@ -1135,12 +1135,12 @@ ada_decode (const char *encoded) { i = len0 - 2; while ((i >= 0 && isdigit (encoded[i])) - || (i >= 1 && encoded[i] == '_' && isdigit (encoded[i - 1]))) - i -= 1; + || (i >= 1 && encoded[i] == '_' && isdigit (encoded[i - 1]))) + i -= 1; if (i > 1 && encoded[i] == '_' && encoded[i - 1] == '_') - len0 = i - 1; + len0 = i - 1; else if (encoded[i] == '$') - len0 = i; + len0 = i; } /* The first few characters that are not alphabetic are not part @@ -1154,136 +1154,136 @@ ada_decode (const char *encoded) { /* Is this a symbol function? */ if (at_start_name && encoded[i] == 'O') - { - int k; - - for (k = 0; ada_opname_table[k].encoded != NULL; k += 1) - { - int op_len = strlen (ada_opname_table[k].encoded); - if ((strncmp (ada_opname_table[k].encoded + 1, encoded + i + 1, - op_len - 1) == 0) - && !isalnum (encoded[i + op_len])) - { - strcpy (&decoded.front() + j, ada_opname_table[k].decoded); - at_start_name = 0; - i += op_len; - j += strlen (ada_opname_table[k].decoded); - break; - } - } - if (ada_opname_table[k].encoded != NULL) - continue; - } + { + int k; + + for (k = 0; ada_opname_table[k].encoded != NULL; k += 1) + { + int op_len = strlen (ada_opname_table[k].encoded); + if ((strncmp (ada_opname_table[k].encoded + 1, encoded + i + 1, + op_len - 1) == 0) + && !isalnum (encoded[i + op_len])) + { + strcpy (&decoded.front() + j, ada_opname_table[k].decoded); + at_start_name = 0; + i += op_len; + j += strlen (ada_opname_table[k].decoded); + break; + } + } + if (ada_opname_table[k].encoded != NULL) + continue; + } at_start_name = 0; /* Replace "TK__" with "__", which will eventually be translated - into "." (just below). */ + into "." (just below). */ if (i < len0 - 4 && startswith (encoded + i, "TK__")) - i += 2; + i += 2; /* Replace "__B_{DIGITS}+__" sequences by "__", which will eventually - be translated into "." (just below). These are internal names - generated for anonymous blocks inside which our symbol is nested. */ + be translated into "." (just below). These are internal names + generated for anonymous blocks inside which our symbol is nested. */ if (len0 - i > 5 && encoded [i] == '_' && encoded [i+1] == '_' - && encoded [i+2] == 'B' && encoded [i+3] == '_' - && isdigit (encoded [i+4])) - { - int k = i + 5; - - while (k < len0 && isdigit (encoded[k])) - k++; /* Skip any extra digit. */ - - /* Double-check that the "__B_{DIGITS}+" sequence we found - is indeed followed by "__". */ - if (len0 - k > 2 && encoded [k] == '_' && encoded [k+1] == '_') - i = k; - } + && encoded [i+2] == 'B' && encoded [i+3] == '_' + && isdigit (encoded [i+4])) + { + int k = i + 5; + + while (k < len0 && isdigit (encoded[k])) + k++; /* Skip any extra digit. */ + + /* Double-check that the "__B_{DIGITS}+" sequence we found + is indeed followed by "__". */ + if (len0 - k > 2 && encoded [k] == '_' && encoded [k+1] == '_') + i = k; + } /* Remove _E{DIGITS}+[sb] */ /* Just as for protected object subprograms, there are 2 categories - of subprograms created by the compiler for each entry. The first - one implements the actual entry code, and has a suffix following - the convention above; the second one implements the barrier and - uses the same convention as above, except that the 'E' is replaced - by a 'B'. + of subprograms created by the compiler for each entry. The first + one implements the actual entry code, and has a suffix following + the convention above; the second one implements the barrier and + uses the same convention as above, except that the 'E' is replaced + by a 'B'. - Just as above, we do not decode the name of barrier functions - to give the user a clue that the code he is debugging has been - internally generated. */ + Just as above, we do not decode the name of barrier functions + to give the user a clue that the code he is debugging has been + internally generated. */ if (len0 - i > 3 && encoded [i] == '_' && encoded[i+1] == 'E' - && isdigit (encoded[i+2])) - { - int k = i + 3; - - while (k < len0 && isdigit (encoded[k])) - k++; - - if (k < len0 - && (encoded[k] == 'b' || encoded[k] == 's')) - { - k++; - /* Just as an extra precaution, make sure that if this - suffix is followed by anything else, it is a '_'. - Otherwise, we matched this sequence by accident. */ - if (k == len0 - || (k < len0 && encoded[k] == '_')) - i = k; - } - } + && isdigit (encoded[i+2])) + { + int k = i + 3; + + while (k < len0 && isdigit (encoded[k])) + k++; + + if (k < len0 + && (encoded[k] == 'b' || encoded[k] == 's')) + { + k++; + /* Just as an extra precaution, make sure that if this + suffix is followed by anything else, it is a '_'. + Otherwise, we matched this sequence by accident. */ + if (k == len0 + || (k < len0 && encoded[k] == '_')) + i = k; + } + } /* Remove trailing "N" in [a-z0-9]+N__. The N is added by - the GNAT front-end in protected object subprograms. */ + the GNAT front-end in protected object subprograms. */ if (i < len0 + 3 - && encoded[i] == 'N' && encoded[i+1] == '_' && encoded[i+2] == '_') - { - /* Backtrack a bit up until we reach either the begining of - the encoded name, or "__". Make sure that we only find - digits or lowercase characters. */ - const char *ptr = encoded + i - 1; - - while (ptr >= encoded && is_lower_alphanum (ptr[0])) - ptr--; - if (ptr < encoded - || (ptr > encoded && ptr[0] == '_' && ptr[-1] == '_')) - i++; - } + && encoded[i] == 'N' && encoded[i+1] == '_' && encoded[i+2] == '_') + { + /* Backtrack a bit up until we reach either the begining of + the encoded name, or "__". Make sure that we only find + digits or lowercase characters. */ + const char *ptr = encoded + i - 1; + + while (ptr >= encoded && is_lower_alphanum (ptr[0])) + ptr--; + if (ptr < encoded + || (ptr > encoded && ptr[0] == '_' && ptr[-1] == '_')) + i++; + } if (encoded[i] == 'X' && i != 0 && isalnum (encoded[i - 1])) - { - /* This is a X[bn]* sequence not separated from the previous - part of the name with a non-alpha-numeric character (in other - words, immediately following an alpha-numeric character), then - verify that it is placed at the end of the encoded name. If - not, then the encoding is not valid and we should abort the - decoding. Otherwise, just skip it, it is used in body-nested - package names. */ - do - i += 1; - while (i < len0 && (encoded[i] == 'b' || encoded[i] == 'n')); - if (i < len0) - goto Suppress; - } + { + /* This is a X[bn]* sequence not separated from the previous + part of the name with a non-alpha-numeric character (in other + words, immediately following an alpha-numeric character), then + verify that it is placed at the end of the encoded name. If + not, then the encoding is not valid and we should abort the + decoding. Otherwise, just skip it, it is used in body-nested + package names. */ + do + i += 1; + while (i < len0 && (encoded[i] == 'b' || encoded[i] == 'n')); + if (i < len0) + goto Suppress; + } else if (i < len0 - 2 && encoded[i] == '_' && encoded[i + 1] == '_') - { - /* Replace '__' by '.'. */ - decoded[j] = '.'; - at_start_name = 1; - i += 2; - j += 1; - } + { + /* Replace '__' by '.'. */ + decoded[j] = '.'; + at_start_name = 1; + i += 2; + j += 1; + } else - { - /* It's a character part of the decoded name, so just copy it - over. */ - decoded[j] = encoded[i]; - i += 1; - j += 1; - } + { + /* It's a character part of the decoded name, so just copy it + over. */ + decoded[j] = encoded[i]; + i += 1; + j += 1; + } } decoded.resize (j); @@ -1339,19 +1339,19 @@ ada_decode_symbol (const struct general_symbol_info *arg) if (obstack != NULL) *resultp = obstack_strdup (obstack, decoded.c_str ()); else - { + { /* Sometimes, we can't find a corresponding objfile, in which case, we put the result on the heap. Since we only decode when needed, we hope this usually does not cause a significant memory leak (FIXME). */ - char **slot = (char **) htab_find_slot (decoded_names_store, - decoded.c_str (), INSERT); + char **slot = (char **) htab_find_slot (decoded_names_store, + decoded.c_str (), INSERT); - if (*slot == NULL) - *slot = xstrdup (decoded.c_str ()); - *resultp = *slot; - } + if (*slot == NULL) + *slot = xstrdup (decoded.c_str ()); + *resultp = *slot; + } } return *resultp; @@ -1365,7 +1365,7 @@ ada_la_decode (const char *encoded, int options) - /* Arrays */ + /* Arrays */ /* Assuming that INDEX_DESC_TYPE is an ___XA structure, a structure generated by the GNAT compiler to describe the index type used @@ -1408,7 +1408,7 @@ ada_fixup_array_indexes_type (struct type *index_desc_type) is not equal to the field name. */ if (index_desc_type->field (0).type ()->name () != NULL && strcmp (index_desc_type->field (0).type ()->name (), - TYPE_FIELD_NAME (index_desc_type, 0)) == 0) + TYPE_FIELD_NAME (index_desc_type, 0)) == 0) return; /* Fixup each field of INDEX_DESC_TYPE. */ @@ -1439,7 +1439,7 @@ desc_base_type (struct type *type) if (type != NULL && (type->code () == TYPE_CODE_PTR - || type->code () == TYPE_CODE_REF)) + || type->code () == TYPE_CODE_REF)) return ada_check_typedef (TYPE_TARGET_TYPE (type)); else return type; @@ -1471,9 +1471,9 @@ thin_descriptor_type (struct type *type) struct type *alt_type = ada_find_parallel_type (base_type, "___XVE"); if (alt_type == NULL) - return base_type; + return base_type; else - return alt_type; + return alt_type; } } @@ -1500,7 +1500,7 @@ is_thick_pntr (struct type *type) { type = desc_base_type (type); return (type != NULL && type->code () == TYPE_CODE_STRUCT - && lookup_struct_elt_type (type, "P_BOUNDS", 1) != NULL); + && lookup_struct_elt_type (type, "P_BOUNDS", 1) != NULL); } /* If TYPE is the type of an array descriptor (fat or thin pointer) or a @@ -1519,16 +1519,16 @@ desc_bounds_type (struct type *type) { type = thin_descriptor_type (type); if (type == NULL) - return NULL; + return NULL; r = lookup_struct_elt_type (type, "BOUNDS", 1); if (r != NULL) - return ada_check_typedef (r); + return ada_check_typedef (r); } else if (type->code () == TYPE_CODE_STRUCT) { r = lookup_struct_elt_type (type, "P_BOUNDS", 1); if (r != NULL) - return ada_check_typedef (TYPE_TARGET_TYPE (ada_check_typedef (r))); + return ada_check_typedef (TYPE_TARGET_TYPE (ada_check_typedef (r))); } return NULL; } @@ -1544,23 +1544,23 @@ desc_bounds (struct value *arr) if (is_thin_pntr (type)) { struct type *bounds_type = - desc_bounds_type (thin_descriptor_type (type)); + desc_bounds_type (thin_descriptor_type (type)); LONGEST addr; if (bounds_type == NULL) - error (_("Bad GNAT array descriptor")); + error (_("Bad GNAT array descriptor")); /* NOTE: The following calculation is not really kosher, but - since desc_type is an XVE-encoded type (and shouldn't be), - the correct calculation is a real pain. FIXME (and fix GCC). */ + since desc_type is an XVE-encoded type (and shouldn't be), + the correct calculation is a real pain. FIXME (and fix GCC). */ if (type->code () == TYPE_CODE_PTR) - addr = value_as_long (arr); + addr = value_as_long (arr); else - addr = value_address (arr); + addr = value_address (arr); return - value_from_longest (lookup_pointer_type (bounds_type), - addr - TYPE_LENGTH (bounds_type)); + value_from_longest (lookup_pointer_type (bounds_type), + addr - TYPE_LENGTH (bounds_type)); } else if (is_thick_pntr (type)) @@ -1648,7 +1648,7 @@ desc_data (struct value *arr) return thin_data_pntr (arr); else if (is_thick_pntr (type)) return value_struct_elt (&arr, NULL, "P_ARRAY", NULL, - _("Bad GNAT array descriptor")); + _("Bad GNAT array descriptor")); else return NULL; } @@ -1688,7 +1688,7 @@ desc_one_bound (struct value *bounds, int i, int which) xsnprintf (bound_name, sizeof (bound_name), "%cB%d", which ? 'U' : 'L', i - 1); return value_struct_elt (&bounds, NULL, bound_name, NULL, - _("Bad GNAT array descriptor bounds")); + _("Bad GNAT array descriptor bounds")); } /* If BOUNDS is an array-bounds structure type, return the bit position @@ -1758,7 +1758,7 @@ ada_is_direct_array_type (struct type *type) return 0; type = ada_check_typedef (type); return (type->code () == TYPE_CODE_ARRAY - || ada_is_array_descriptor_type (type)); + || ada_is_array_descriptor_type (type)); } /* Non-zero iff TYPE represents any kind of array in Ada, or a pointer @@ -1815,7 +1815,7 @@ ada_is_bogus_array_descriptor (struct type *type) type != NULL && type->code () == TYPE_CODE_STRUCT && (lookup_struct_elt_type (type, "P_BOUNDS", 1) != NULL - || lookup_struct_elt_type (type, "P_ARRAY", 1) != NULL) + || lookup_struct_elt_type (type, "P_ARRAY", 1) != NULL) && !ada_is_array_descriptor_type (type); } @@ -1858,28 +1858,28 @@ ada_type_of_array (struct value *arr, int bounds) arity = ada_array_arity (value_type (arr)); if (elt_type == NULL || arity == 0) - return ada_check_typedef (value_type (arr)); + return ada_check_typedef (value_type (arr)); descriptor = desc_bounds (arr); if (value_as_long (descriptor) == 0) - return NULL; + return NULL; while (arity > 0) - { - struct type *range_type = alloc_type_copy (value_type (arr)); - struct type *array_type = alloc_type_copy (value_type (arr)); - struct value *low = desc_one_bound (descriptor, arity, 0); - struct value *high = desc_one_bound (descriptor, arity, 1); - - arity -= 1; - create_static_range_type (range_type, value_type (low), + { + struct type *range_type = alloc_type_copy (value_type (arr)); + struct type *array_type = alloc_type_copy (value_type (arr)); + struct value *low = desc_one_bound (descriptor, arity, 0); + struct value *high = desc_one_bound (descriptor, arity, 1); + + arity -= 1; + create_static_range_type (range_type, value_type (low), longest_to_int (value_as_long (low)), longest_to_int (value_as_long (high))); - elt_type = create_array_type (array_type, elt_type, range_type); + elt_type = create_array_type (array_type, elt_type, range_type); if (ada_is_unconstrained_packed_array_type (value_type (arr))) { /* We need to store the element packed bitsize, as well as - recompute the array size, because it was previously + recompute the array size, because it was previously computed based on the unpacked element size. */ LONGEST lo = value_as_long (low); LONGEST hi = value_as_long (high); @@ -1887,16 +1887,16 @@ ada_type_of_array (struct value *arr, int bounds) TYPE_FIELD_BITSIZE (elt_type, 0) = decode_packed_array_bitsize (value_type (arr)); /* If the array has no element, then the size is already - zero, and does not need to be recomputed. */ + zero, and does not need to be recomputed. */ if (lo < hi) { int array_bitsize = - (hi - lo + 1) * TYPE_FIELD_BITSIZE (elt_type, 0); + (hi - lo + 1) * TYPE_FIELD_BITSIZE (elt_type, 0); TYPE_LENGTH (array_type) = (array_bitsize + 7) / 8; } } - } + } return lookup_pointer_type (elt_type); } @@ -1915,7 +1915,7 @@ ada_coerce_to_simple_array_ptr (struct value *arr) struct type *arrType = ada_type_of_array (arr, 1); if (arrType == NULL) - return NULL; + return NULL; return value_cast (arrType, value_copy (desc_data (arr))); } else if (ada_is_constrained_packed_array_type (value_type (arr))) @@ -1936,7 +1936,7 @@ ada_coerce_to_simple_array (struct value *arr) struct value *arrVal = ada_coerce_to_simple_array_ptr (arr); if (arrVal == NULL) - error (_("Bounds unavailable for null array pointer.")); + error (_("Bounds unavailable for null array pointer.")); ada_ensure_varsize_limit (TYPE_TARGET_TYPE (value_type (arrVal))); return value_ind (arrVal); } @@ -2087,7 +2087,7 @@ constrained_packed_array_type (struct type *type, long *elt_bits) { *elt_bits *= (high_bound - low_bound + 1); TYPE_LENGTH (new_type) = - (*elt_bits + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT; + (*elt_bits + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT; } new_type->set_is_fixed_instance (true); @@ -2215,36 +2215,36 @@ value_subscript_packed (struct value *arr, int arity, struct value **ind) for (i = 0; i < arity; i += 1) { if (elt_type->code () != TYPE_CODE_ARRAY - || TYPE_FIELD_BITSIZE (elt_type, 0) == 0) - error - (_("attempt to do packed indexing of " + || TYPE_FIELD_BITSIZE (elt_type, 0) == 0) + error + (_("attempt to do packed indexing of " "something other than a packed array")); else - { - struct type *range_type = elt_type->index_type (); - LONGEST lowerbound, upperbound; - LONGEST idx; - - if (get_discrete_bounds (range_type, &lowerbound, &upperbound) < 0) - { - lim_warning (_("don't know bounds of array")); - lowerbound = upperbound = 0; - } - - idx = pos_atr (ind[i]); - if (idx < lowerbound || idx > upperbound) - lim_warning (_("packed array index %ld out of bounds"), + { + struct type *range_type = elt_type->index_type (); + LONGEST lowerbound, upperbound; + LONGEST idx; + + if (get_discrete_bounds (range_type, &lowerbound, &upperbound) < 0) + { + lim_warning (_("don't know bounds of array")); + lowerbound = upperbound = 0; + } + + idx = pos_atr (ind[i]); + if (idx < lowerbound || idx > upperbound) + lim_warning (_("packed array index %ld out of bounds"), (long) idx); - bits = TYPE_FIELD_BITSIZE (elt_type, 0); - elt_total_bit_offset += (idx - lowerbound) * bits; - elt_type = ada_check_typedef (TYPE_TARGET_TYPE (elt_type)); - } + bits = TYPE_FIELD_BITSIZE (elt_type, 0); + elt_total_bit_offset += (idx - lowerbound) * bits; + elt_type = ada_check_typedef (TYPE_TARGET_TYPE (elt_type)); + } } elt_off = elt_total_bit_offset / HOST_CHAR_BIT; bit_off = elt_total_bit_offset % HOST_CHAR_BIT; v = ada_value_primitive_packed_val (arr, NULL, elt_off, bit_off, - bits, elt_type); + bits, elt_type); return v; } @@ -2289,7 +2289,7 @@ ada_unpack_from_contents (const gdb_byte *src, int bit_offset, int bit_size, int src_bytes_left; /* Number of source bytes left to process. */ int srcBitsLeft; /* Number of source bits left to move */ int unusedLS; /* Number of bits in next significant - byte of source that are unused */ + byte of source that are unused */ int unpacked_idx; /* Index into the unpacked buffer */ int unpacked_bytes_left; /* Number of bytes left to set in unpacked. */ @@ -2318,26 +2318,26 @@ ada_unpack_from_contents (const gdb_byte *src, int bit_offset, int bit_size, src_idx = src_len - 1; if (is_signed_type && ((src[0] << bit_offset) & (1 << (HOST_CHAR_BIT - 1)))) - sign = ~0; + sign = ~0; unusedLS = - (HOST_CHAR_BIT - (bit_size + bit_offset) % HOST_CHAR_BIT) - % HOST_CHAR_BIT; + (HOST_CHAR_BIT - (bit_size + bit_offset) % HOST_CHAR_BIT) + % HOST_CHAR_BIT; if (is_scalar) { - accumSize = 0; - unpacked_idx = unpacked_len - 1; + accumSize = 0; + unpacked_idx = unpacked_len - 1; } else { - /* Non-scalar values must be aligned at a byte boundary... */ - accumSize = - (HOST_CHAR_BIT - bit_size % HOST_CHAR_BIT) % HOST_CHAR_BIT; - /* ... And are placed at the beginning (most-significant) bytes - of the target. */ - unpacked_idx = (bit_size + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT - 1; - unpacked_bytes_left = unpacked_idx + 1; + /* Non-scalar values must be aligned at a byte boundary... */ + accumSize = + (HOST_CHAR_BIT - bit_size % HOST_CHAR_BIT) % HOST_CHAR_BIT; + /* ... And are placed at the beginning (most-significant) bytes + of the target. */ + unpacked_idx = (bit_size + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT - 1; + unpacked_bytes_left = unpacked_idx + 1; } } else @@ -2349,31 +2349,31 @@ ada_unpack_from_contents (const gdb_byte *src, int bit_offset, int bit_size, accumSize = 0; if (is_signed_type && (src[src_len - 1] & (1 << sign_bit_offset))) - sign = ~0; + sign = ~0; } accum = 0; while (src_bytes_left > 0) { /* Mask for removing bits of the next source byte that are not - part of the value. */ + part of the value. */ unsigned int unusedMSMask = - (1 << (srcBitsLeft >= HOST_CHAR_BIT ? HOST_CHAR_BIT : srcBitsLeft)) - - 1; + (1 << (srcBitsLeft >= HOST_CHAR_BIT ? HOST_CHAR_BIT : srcBitsLeft)) - + 1; /* Sign-extend bits for this byte. */ unsigned int signMask = sign & ~unusedMSMask; accum |= - (((src[src_idx] >> unusedLS) & unusedMSMask) | signMask) << accumSize; + (((src[src_idx] >> unusedLS) & unusedMSMask) | signMask) << accumSize; accumSize += HOST_CHAR_BIT - unusedLS; if (accumSize >= HOST_CHAR_BIT) - { - unpacked[unpacked_idx] = accum & ~(~0UL << HOST_CHAR_BIT); - accumSize -= HOST_CHAR_BIT; - accum >>= HOST_CHAR_BIT; - unpacked_bytes_left -= 1; - unpacked_idx += delta; - } + { + unpacked[unpacked_idx] = accum & ~(~0UL << HOST_CHAR_BIT); + accumSize -= HOST_CHAR_BIT; + accum >>= HOST_CHAR_BIT; + unpacked_bytes_left -= 1; + unpacked_idx += delta; + } srcBitsLeft -= HOST_CHAR_BIT - unusedLS; unusedLS = 0; src_bytes_left -= 1; @@ -2404,7 +2404,7 @@ ada_unpack_from_contents (const gdb_byte *src, int bit_offset, int bit_size, struct value * ada_value_primitive_packed_val (struct value *obj, const gdb_byte *valaddr, long offset, int bit_offset, int bit_size, - struct type *type) + struct type *type) { struct value *v; const gdb_byte *src; /* First byte containing data to unpack */ @@ -2433,7 +2433,7 @@ ada_value_primitive_packed_val (struct value *obj, const gdb_byte *valaddr, staging.resize (staging_len); ada_unpack_from_contents (src, bit_offset, bit_size, - staging.data (), staging.size (), + staging.data (), staging.size (), is_big_endian, has_negatives (type), is_scalar); type = resolve_dynamic_type (type, staging, 0); @@ -2479,10 +2479,10 @@ ada_value_primitive_packed_val (struct value *obj, const gdb_byte *valaddr, set_value_bitpos (v, bit_offset + value_bitpos (obj)); set_value_bitsize (v, bit_size); if (value_bitpos (v) >= HOST_CHAR_BIT) - { + { ++new_offset; - set_value_bitpos (v, value_bitpos (v) - HOST_CHAR_BIT); - } + set_value_bitpos (v, value_bitpos (v) - HOST_CHAR_BIT); + } set_value_offset (v, new_offset); /* Also set the parent value. This is needed when trying to @@ -2539,7 +2539,7 @@ ada_value_assign (struct value *toval, struct value *fromval) if (VALUE_LVAL (toval) == lval_memory && bits > 0 && (type->code () == TYPE_CODE_FLT - || type->code () == TYPE_CODE_STRUCT)) + || type->code () == TYPE_CODE_STRUCT)) { int len = (value_bitpos (toval) + bits + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT; @@ -2549,7 +2549,7 @@ ada_value_assign (struct value *toval, struct value *fromval) CORE_ADDR to_addr = value_address (toval); if (type->code () == TYPE_CODE_FLT) - fromval = value_cast (type, fromval); + fromval = value_cast (type, fromval); read_memory (to_addr, buffer, len); from_size = value_bitsize (fromval); @@ -2567,7 +2567,7 @@ ada_value_assign (struct value *toval, struct value *fromval) val = value_copy (toval); memcpy (value_contents_raw (val), value_contents (fromval), - TYPE_LENGTH (type)); + TYPE_LENGTH (type)); deprecated_set_value_type (val, type); return val; @@ -2610,7 +2610,7 @@ value_assign_to_component (struct value *container, struct value *component, int src_offset; if (is_scalar_type (check_typedef (value_type (component)))) - src_offset + src_offset = TYPE_LENGTH (value_type (component)) * TARGET_CHAR_BIT - bits; else src_offset = 0; @@ -2656,7 +2656,7 @@ ada_value_subscript (struct value *arr, int arity, struct value **ind) struct type *saved_elt_type = TYPE_TARGET_TYPE (elt_type); if (elt_type->code () != TYPE_CODE_ARRAY) - error (_("too many subscripts (%d expected)"), k); + error (_("too many subscripts (%d expected)"), k); elt = value_subscript (elt, pos_atr (ind[k])); @@ -2713,9 +2713,9 @@ ada_value_ptr_subscript (struct value *arr, int arity, struct value **ind) LONGEST lwb, upb; if (type->code () != TYPE_CODE_ARRAY) - error (_("too many subscripts (%d expected)"), k); + error (_("too many subscripts (%d expected)"), k); arr = value_cast (lookup_pointer_type (TYPE_TARGET_TYPE (type)), - value_copy (arr)); + value_copy (arr)); get_discrete_bounds (type->index_type (), &lwb, &upb); arr = value_ptradd (arr, pos_atr (ind[k]) - lwb); type = TYPE_TARGET_TYPE (type); @@ -2730,7 +2730,7 @@ ada_value_ptr_subscript (struct value *arr, int arity, struct value **ind) this array is LOW, as per Ada rules. */ static struct value * ada_value_slice_from_ptr (struct value *array_ptr, struct type *type, - int low, int high) + int low, int high) { struct type *type0 = ada_check_typedef (type); struct type *base_index_type = TYPE_TARGET_TYPE (type0->index_type ()); @@ -2805,8 +2805,8 @@ ada_array_arity (struct type *type) else while (type->code () == TYPE_CODE_ARRAY) { - arity += 1; - type = ada_check_typedef (TYPE_TARGET_TYPE (type)); + arity += 1; + type = ada_check_typedef (TYPE_TARGET_TYPE (type)); } return arity; @@ -2831,25 +2831,25 @@ ada_array_element_type (struct type *type, int nindices) k = ada_array_arity (type); if (k == 0) - return NULL; + return NULL; /* Initially p_array_type = elt_type(*)[]...(k times)...[]. */ if (nindices >= 0 && k > nindices) - k = nindices; + k = nindices; while (k > 0 && p_array_type != NULL) - { - p_array_type = ada_check_typedef (TYPE_TARGET_TYPE (p_array_type)); - k -= 1; - } + { + p_array_type = ada_check_typedef (TYPE_TARGET_TYPE (p_array_type)); + k -= 1; + } return p_array_type; } else if (type->code () == TYPE_CODE_ARRAY) { while (nindices != 0 && type->code () == TYPE_CODE_ARRAY) - { - type = TYPE_TARGET_TYPE (type); - nindices -= 1; - } + { + type = TYPE_TARGET_TYPE (type); + nindices -= 1; + } return type; } @@ -2877,13 +2877,13 @@ ada_index_type (struct type *type, int n, const char *name) int i; for (i = 1; i < n; i += 1) - type = TYPE_TARGET_TYPE (type); + type = TYPE_TARGET_TYPE (type); result_type = TYPE_TARGET_TYPE (type->index_type ()); /* FIXME: The stabs type r(0,0);bound;bound in an array type - has a target type of TYPE_CODE_UNDEF. We compensate here, but - perhaps stabsread.c would make more sense. */ + has a target type of TYPE_CODE_UNDEF. We compensate here, but + perhaps stabsread.c would make more sense. */ if (result_type && result_type->code () == TYPE_CODE_UNDEF) - result_type = NULL; + result_type = NULL; } else { @@ -2948,8 +2948,8 @@ ada_array_bound_from_type (struct type *arr_type, int n, int which) return (LONGEST) (which == 0 - ? ada_discrete_type_low_bound (index_type) - : ada_discrete_type_high_bound (index_type)); + ? ada_discrete_type_low_bound (index_type) + : ada_discrete_type_high_bound (index_type)); } /* Given that arr is an array value, returns the lower bound of the @@ -3030,7 +3030,7 @@ empty_array (struct type *arr_type, int low, int high) struct type *arr_type0 = ada_check_typedef (arr_type); struct type *index_type = create_static_range_type - (NULL, TYPE_TARGET_TYPE (arr_type0->index_type ()), low, + (NULL, TYPE_TARGET_TYPE (arr_type0->index_type ()), low, high < low ? low - 1 : high); struct type *elt_type = ada_array_element_type (arr_type0, 1); @@ -3038,7 +3038,7 @@ empty_array (struct type *arr_type, int low, int high) } - /* Name resolution */ + /* Name resolution */ /* The "decoded" name for the user-definable Ada operator corresponding to OP. */ @@ -3051,7 +3051,7 @@ ada_decoded_op_name (enum exp_opcode op) for (i = 0; ada_opname_table[i].encoded != NULL; i += 1) { if (ada_opname_table[i].op == op) - return ada_opname_table[i].decoded; + return ada_opname_table[i].decoded; } error (_("Could not find operator name for opcode")); } @@ -3074,23 +3074,23 @@ encoded_ordered_before (const char *N0, const char *N1) int k0, k1; for (k0 = strlen (N0) - 1; k0 > 0 && isdigit (N0[k0]); k0 -= 1) - ; + ; for (k1 = strlen (N1) - 1; k1 > 0 && isdigit (N1[k1]); k1 -= 1) - ; + ; if ((N0[k0] == '_' || N0[k0] == '$') && N0[k0 + 1] != '\000' - && (N1[k1] == '_' || N1[k1] == '$') && N1[k1 + 1] != '\000') - { - int n0, n1; - - n0 = k0; - while (N0[n0] == '_' && n0 > 0 && N0[n0 - 1] == '_') - n0 -= 1; - n1 = k1; - while (N1[n1] == '_' && n1 > 0 && N1[n1 - 1] == '_') - n1 -= 1; - if (n0 == n1 && strncmp (N0, N1, n0) == 0) - return (atoi (N0 + k0 + 1) < atoi (N1 + k1 + 1)); - } + && (N1[k1] == '_' || N1[k1] == '$') && N1[k1 + 1] != '\000') + { + int n0, n1; + + n0 = k0; + while (N0[n0] == '_' && n0 > 0 && N0[n0 - 1] == '_') + n0 -= 1; + n1 = k1; + while (N1[n1] == '_' && n1 > 0 && N1[n1 - 1] == '_') + n1 -= 1; + if (n0 == n1 && strncmp (N0, N1, n0) == 0) + return (atoi (N0 + k0 + 1) < atoi (N1 + k1 + 1)); + } return (strcmp (N0, N1) < 0); } } @@ -3109,12 +3109,12 @@ sort_choices (struct block_symbol syms[], int nsyms) int j; for (j = i - 1; j >= 0; j -= 1) - { - if (encoded_ordered_before (syms[j].symbol->linkage_name (), - sym.symbol->linkage_name ())) - break; - syms[j + 1] = syms[j]; - } + { + if (encoded_ordered_before (syms[j].symbol->linkage_name (), + sym.symbol->linkage_name ())) + break; + syms[j + 1] = syms[j]; + } syms[j + 1] = sym; } } @@ -3180,7 +3180,7 @@ ada_print_symbol_signature (struct ui_file *stream, struct symbol *sym, static int get_selections (int *choices, int n_choices, int max_results, - int is_all_choice, const char *annotation_suffix) + int is_all_choice, const char *annotation_suffix) { const char *args; const char *prompt; @@ -3207,41 +3207,41 @@ get_selections (int *choices, int n_choices, int max_results, args = skip_spaces (args); if (*args == '\0' && n_chosen == 0) - error_no_arg (_("one or more choice numbers")); + error_no_arg (_("one or more choice numbers")); else if (*args == '\0') - break; + break; choice = strtol (args, &args2, 10); if (args == args2 || choice < 0 - || choice > n_choices + first_choice - 1) - error (_("Argument must be choice number")); + || choice > n_choices + first_choice - 1) + error (_("Argument must be choice number")); args = args2; if (choice == 0) - error (_("cancelled")); + error (_("cancelled")); if (choice < first_choice) - { - n_chosen = n_choices; - for (j = 0; j < n_choices; j += 1) - choices[j] = j; - break; - } + { + n_chosen = n_choices; + for (j = 0; j < n_choices; j += 1) + choices[j] = j; + break; + } choice -= first_choice; for (j = n_chosen - 1; j >= 0 && choice < choices[j]; j -= 1) - { - } + { + } if (j < 0 || choice != choices[j]) - { - int k; + { + int k; - for (k = n_chosen - 1; k > j; k -= 1) - choices[k + 1] = choices[k]; - choices[j + 1] = choice; - n_chosen += 1; - } + for (k = n_chosen - 1; k > j; k -= 1) + choices[k + 1] = choices[k]; + choices[j + 1] = choice; + n_chosen += 1; + } } if (n_chosen > max_results) @@ -3292,12 +3292,12 @@ See set/show multiple-symbol.")); for (i = 0; i < nsyms; i += 1) { if (syms[i].symbol == NULL) - continue; + continue; if (SYMBOL_CLASS (syms[i].symbol) == LOC_BLOCK) - { - struct symtab_and_line sal = - find_function_start_sal (syms[i].symbol, 1); + { + struct symtab_and_line sal = + find_function_start_sal (syms[i].symbol, 1); printf_filtered ("[%d] ", i + first_choice); ada_print_symbol_signature (gdb_stdout, syms[i].symbol, @@ -3311,20 +3311,20 @@ See set/show multiple-symbol.")); styled_string (file_name_style.style (), symtab_to_filename_for_display (sal.symtab)), sal.line); - continue; - } + continue; + } else - { - int is_enumeral = - (SYMBOL_CLASS (syms[i].symbol) == LOC_CONST - && SYMBOL_TYPE (syms[i].symbol) != NULL - && SYMBOL_TYPE (syms[i].symbol)->code () == TYPE_CODE_ENUM); + { + int is_enumeral = + (SYMBOL_CLASS (syms[i].symbol) == LOC_CONST + && SYMBOL_TYPE (syms[i].symbol) != NULL + && SYMBOL_TYPE (syms[i].symbol)->code () == TYPE_CODE_ENUM); struct symtab *symtab = NULL; if (SYMBOL_OBJFILE_OWNED (syms[i].symbol)) symtab = symbol_symtab (syms[i].symbol); - if (SYMBOL_LINE (syms[i].symbol) != 0 && symtab != NULL) + if (SYMBOL_LINE (syms[i].symbol) != 0 && symtab != NULL) { printf_filtered ("[%d] ", i + first_choice); ada_print_symbol_signature (gdb_stdout, syms[i].symbol, @@ -3333,15 +3333,15 @@ See set/show multiple-symbol.")); symtab_to_filename_for_display (symtab), SYMBOL_LINE (syms[i].symbol)); } - else if (is_enumeral - && SYMBOL_TYPE (syms[i].symbol)->name () != NULL) - { - printf_filtered (("[%d] "), i + first_choice); - ada_print_type (SYMBOL_TYPE (syms[i].symbol), NULL, - gdb_stdout, -1, 0, &type_print_raw_options); - printf_filtered (_("'(%s) (enumeral)\n"), + else if (is_enumeral + && SYMBOL_TYPE (syms[i].symbol)->name () != NULL) + { + printf_filtered (("[%d] "), i + first_choice); + ada_print_type (SYMBOL_TYPE (syms[i].symbol), NULL, + gdb_stdout, -1, 0, &type_print_raw_options); + printf_filtered (_("'(%s) (enumeral)\n"), syms[i].symbol->print_name ()); - } + } else { printf_filtered ("[%d] ", i + first_choice); @@ -3358,11 +3358,11 @@ See set/show multiple-symbol.")); ? _(" (enumeral)\n") : _(" at ?\n")); } - } + } } n_chosen = get_selections (chosen, nsyms, max_results, max_results > 1, - "overload-choice"); + "overload-choice"); for (i = 0; i < n_chosen; i += 1) syms[i] = syms[chosen[i]]; @@ -3381,7 +3381,7 @@ See set/show multiple-symbol.")); static struct value * resolve_subexp (expression_up *expp, int *pos, int deprocedure_p, - struct type *context_type, int parse_completion, + struct type *context_type, int parse_completion, innermost_block_tracker *tracker) { int pc = *pos; @@ -3402,13 +3402,13 @@ resolve_subexp (expression_up *expp, int *pos, int deprocedure_p, { case OP_FUNCALL: if (exp->elts[pc + 3].opcode == OP_VAR_VALUE - && SYMBOL_DOMAIN (exp->elts[pc + 5].symbol) == UNDEF_DOMAIN) - *pos += 7; + && SYMBOL_DOMAIN (exp->elts[pc + 5].symbol) == UNDEF_DOMAIN) + *pos += 7; else - { - *pos += 3; - resolve_subexp (expp, pos, 0, NULL, parse_completion, tracker); - } + { + *pos += 3; + resolve_subexp (expp, pos, 0, NULL, parse_completion, tracker); + } nargs = longest_to_int (exp->elts[pc + 1].longconst); break; @@ -3448,16 +3448,16 @@ resolve_subexp (expression_up *expp, int *pos, int deprocedure_p, case BINOP_ASSIGN: { - struct value *arg1; - - *pos += 1; - arg1 = resolve_subexp (expp, pos, 0, NULL, parse_completion, tracker); - if (arg1 == NULL) - resolve_subexp (expp, pos, 1, NULL, parse_completion, tracker); - else - resolve_subexp (expp, pos, 1, value_type (arg1), parse_completion, + struct value *arg1; + + *pos += 1; + arg1 = resolve_subexp (expp, pos, 0, NULL, parse_completion, tracker); + if (arg1 == NULL) + resolve_subexp (expp, pos, 1, NULL, parse_completion, tracker); + else + resolve_subexp (expp, pos, 1, value_type (arg1), parse_completion, tracker); - break; + break; } case UNOP_CAST: @@ -3557,122 +3557,122 @@ resolve_subexp (expression_up *expp, int *pos, int deprocedure_p, case OP_VAR_VALUE: if (SYMBOL_DOMAIN (exp->elts[pc + 2].symbol) == UNDEF_DOMAIN) - { - std::vector<struct block_symbol> candidates; - int n_candidates; - - n_candidates = - ada_lookup_symbol_list (exp->elts[pc + 2].symbol->linkage_name (), - exp->elts[pc + 1].block, VAR_DOMAIN, - &candidates); - - if (n_candidates > 1) - { - /* Types tend to get re-introduced locally, so if there - are any local symbols that are not types, first filter - out all types. */ - int j; - for (j = 0; j < n_candidates; j += 1) - switch (SYMBOL_CLASS (candidates[j].symbol)) - { - case LOC_REGISTER: - case LOC_ARG: - case LOC_REF_ARG: - case LOC_REGPARM_ADDR: - case LOC_LOCAL: - case LOC_COMPUTED: - goto FoundNonType; - default: - break; - } - FoundNonType: - if (j < n_candidates) - { - j = 0; - while (j < n_candidates) - { - if (SYMBOL_CLASS (candidates[j].symbol) == LOC_TYPEDEF) - { - candidates[j] = candidates[n_candidates - 1]; - n_candidates -= 1; - } - else - j += 1; - } - } - } - - if (n_candidates == 0) - error (_("No definition found for %s"), - exp->elts[pc + 2].symbol->print_name ()); - else if (n_candidates == 1) - i = 0; - else if (deprocedure_p - && !is_nonfunction (candidates.data (), n_candidates)) - { - i = ada_resolve_function - (candidates.data (), n_candidates, NULL, 0, - exp->elts[pc + 2].symbol->linkage_name (), - context_type, parse_completion); - if (i < 0) - error (_("Could not find a match for %s"), - exp->elts[pc + 2].symbol->print_name ()); - } - else - { - printf_filtered (_("Multiple matches for %s\n"), - exp->elts[pc + 2].symbol->print_name ()); - user_select_syms (candidates.data (), n_candidates, 1); - i = 0; - } - - exp->elts[pc + 1].block = candidates[i].block; - exp->elts[pc + 2].symbol = candidates[i].symbol; + { + std::vector<struct block_symbol> candidates; + int n_candidates; + + n_candidates = + ada_lookup_symbol_list (exp->elts[pc + 2].symbol->linkage_name (), + exp->elts[pc + 1].block, VAR_DOMAIN, + &candidates); + + if (n_candidates > 1) + { + /* Types tend to get re-introduced locally, so if there + are any local symbols that are not types, first filter + out all types. */ + int j; + for (j = 0; j < n_candidates; j += 1) + switch (SYMBOL_CLASS (candidates[j].symbol)) + { + case LOC_REGISTER: + case LOC_ARG: + case LOC_REF_ARG: + case LOC_REGPARM_ADDR: + case LOC_LOCAL: + case LOC_COMPUTED: + goto FoundNonType; + default: + break; + } + FoundNonType: + if (j < n_candidates) + { + j = 0; + while (j < n_candidates) + { + if (SYMBOL_CLASS (candidates[j].symbol) == LOC_TYPEDEF) + { + candidates[j] = candidates[n_candidates - 1]; + n_candidates -= 1; + } + else + j += 1; + } + } + } + + if (n_candidates == 0) + error (_("No definition found for %s"), + exp->elts[pc + 2].symbol->print_name ()); + else if (n_candidates == 1) + i = 0; + else if (deprocedure_p + && !is_nonfunction (candidates.data (), n_candidates)) + { + i = ada_resolve_function + (candidates.data (), n_candidates, NULL, 0, + exp->elts[pc + 2].symbol->linkage_name (), + context_type, parse_completion); + if (i < 0) + error (_("Could not find a match for %s"), + exp->elts[pc + 2].symbol->print_name ()); + } + else + { + printf_filtered (_("Multiple matches for %s\n"), + exp->elts[pc + 2].symbol->print_name ()); + user_select_syms (candidates.data (), n_candidates, 1); + i = 0; + } + + exp->elts[pc + 1].block = candidates[i].block; + exp->elts[pc + 2].symbol = candidates[i].symbol; tracker->update (candidates[i]); - } + } if (deprocedure_p - && (SYMBOL_TYPE (exp->elts[pc + 2].symbol)->code () - == TYPE_CODE_FUNC)) - { - replace_operator_with_call (expp, pc, 0, 4, - exp->elts[pc + 2].symbol, - exp->elts[pc + 1].block); - exp = expp->get (); - } + && (SYMBOL_TYPE (exp->elts[pc + 2].symbol)->code () + == TYPE_CODE_FUNC)) + { + replace_operator_with_call (expp, pc, 0, 4, + exp->elts[pc + 2].symbol, + exp->elts[pc + 1].block); + exp = expp->get (); + } break; case OP_FUNCALL: { - if (exp->elts[pc + 3].opcode == OP_VAR_VALUE - && SYMBOL_DOMAIN (exp->elts[pc + 5].symbol) == UNDEF_DOMAIN) - { + if (exp->elts[pc + 3].opcode == OP_VAR_VALUE + && SYMBOL_DOMAIN (exp->elts[pc + 5].symbol) == UNDEF_DOMAIN) + { std::vector<struct block_symbol> candidates; - int n_candidates; - - n_candidates = - ada_lookup_symbol_list (exp->elts[pc + 5].symbol->linkage_name (), - exp->elts[pc + 4].block, VAR_DOMAIN, - &candidates); - - if (n_candidates == 1) - i = 0; - else - { - i = ada_resolve_function - (candidates.data (), n_candidates, - argvec, nargs, - exp->elts[pc + 5].symbol->linkage_name (), - context_type, parse_completion); - if (i < 0) - error (_("Could not find a match for %s"), - exp->elts[pc + 5].symbol->print_name ()); - } - - exp->elts[pc + 4].block = candidates[i].block; - exp->elts[pc + 5].symbol = candidates[i].symbol; + int n_candidates; + + n_candidates = + ada_lookup_symbol_list (exp->elts[pc + 5].symbol->linkage_name (), + exp->elts[pc + 4].block, VAR_DOMAIN, + &candidates); + + if (n_candidates == 1) + i = 0; + else + { + i = ada_resolve_function + (candidates.data (), n_candidates, + argvec, nargs, + exp->elts[pc + 5].symbol->linkage_name (), + context_type, parse_completion); + if (i < 0) + error (_("Could not find a match for %s"), + exp->elts[pc + 5].symbol->print_name ()); + } + + exp->elts[pc + 4].block = candidates[i].block; + exp->elts[pc + 5].symbol = candidates[i].symbol; tracker->update (candidates[i]); - } + } } break; case BINOP_ADD: @@ -3697,26 +3697,26 @@ resolve_subexp (expression_up *expp, int *pos, int deprocedure_p, case UNOP_LOGICAL_NOT: case UNOP_ABS: if (possible_user_operator_p (op, argvec)) - { + { std::vector<struct block_symbol> candidates; - int n_candidates; + int n_candidates; - n_candidates = - ada_lookup_symbol_list (ada_decoded_op_name (op), + n_candidates = + ada_lookup_symbol_list (ada_decoded_op_name (op), NULL, VAR_DOMAIN, - &candidates); + &candidates); - i = ada_resolve_function (candidates.data (), n_candidates, argvec, + i = ada_resolve_function (candidates.data (), n_candidates, argvec, nargs, ada_decoded_op_name (op), NULL, parse_completion); - if (i < 0) - break; + if (i < 0) + break; replace_operator_with_call (expp, pc, nargs, 1, candidates[i].symbol, candidates[i].block); - exp = expp->get (); - } + exp = expp->get (); + } break; case OP_TYPE: @@ -3756,35 +3756,35 @@ ada_type_match (struct type *ftype, struct type *atype, int may_deref) return ftype->code () == atype->code (); case TYPE_CODE_PTR: if (atype->code () == TYPE_CODE_PTR) - return ada_type_match (TYPE_TARGET_TYPE (ftype), - TYPE_TARGET_TYPE (atype), 0); + return ada_type_match (TYPE_TARGET_TYPE (ftype), + TYPE_TARGET_TYPE (atype), 0); else - return (may_deref - && ada_type_match (TYPE_TARGET_TYPE (ftype), atype, 0)); + return (may_deref + && ada_type_match (TYPE_TARGET_TYPE (ftype), atype, 0)); case TYPE_CODE_INT: case TYPE_CODE_ENUM: case TYPE_CODE_RANGE: switch (atype->code ()) - { - case TYPE_CODE_INT: - case TYPE_CODE_ENUM: - case TYPE_CODE_RANGE: - return 1; - default: - return 0; - } + { + case TYPE_CODE_INT: + case TYPE_CODE_ENUM: + case TYPE_CODE_RANGE: + return 1; + default: + return 0; + } case TYPE_CODE_ARRAY: return (atype->code () == TYPE_CODE_ARRAY - || ada_is_array_descriptor_type (atype)); + || ada_is_array_descriptor_type (atype)); case TYPE_CODE_STRUCT: if (ada_is_array_descriptor_type (ftype)) - return (atype->code () == TYPE_CODE_ARRAY - || ada_is_array_descriptor_type (atype)); + return (atype->code () == TYPE_CODE_ARRAY + || ada_is_array_descriptor_type (atype)); else - return (atype->code () == TYPE_CODE_STRUCT - && !ada_is_array_descriptor_type (atype)); + return (atype->code () == TYPE_CODE_STRUCT + && !ada_is_array_descriptor_type (atype)); case TYPE_CODE_UNION: case TYPE_CODE_FLT: @@ -3815,15 +3815,15 @@ ada_args_match (struct symbol *func, struct value **actuals, int n_actuals) for (i = 0; i < n_actuals; i += 1) { if (actuals[i] == NULL) - return 0; + return 0; else - { - struct type *ftype = ada_check_typedef (func_type->field (i).type ()); - struct type *atype = ada_check_typedef (value_type (actuals[i])); + { + struct type *ftype = ada_check_typedef (func_type->field (i).type ()); + struct type *atype = ada_check_typedef (value_type (actuals[i])); - if (!ada_type_match (ftype, atype, 1)) - return 0; - } + if (!ada_type_match (ftype, atype, 1)) + return 0; + } } return 1; } @@ -3873,8 +3873,8 @@ return_match (struct type *func_type, struct type *context_type) static int ada_resolve_function (struct block_symbol syms[], - int nsyms, struct value **args, int nargs, - const char *name, struct type *context_type, + int nsyms, struct value **args, int nargs, + const char *name, struct type *context_type, int parse_completion) { int fallback; @@ -3888,16 +3888,16 @@ ada_resolve_function (struct block_symbol syms[], for (fallback = 0; m == 0 && fallback < 2; fallback++) { for (k = 0; k < nsyms; k += 1) - { - struct type *type = ada_check_typedef (SYMBOL_TYPE (syms[k].symbol)); + { + struct type *type = ada_check_typedef (SYMBOL_TYPE (syms[k].symbol)); - if (ada_args_match (syms[k].symbol, args, nargs) - && (fallback || return_match (type, context_type))) - { - syms[m] = syms[k]; - m += 1; - } - } + if (ada_args_match (syms[k].symbol, args, nargs) + && (fallback || return_match (type, context_type))) + { + syms[m] = syms[k]; + m += 1; + } + } } /* If we got multiple matches, ask the user which one to use. Don't do this @@ -3921,14 +3921,14 @@ ada_resolve_function (struct block_symbol syms[], static void replace_operator_with_call (expression_up *expp, int pc, int nargs, - int oplen, struct symbol *sym, - const struct block *block) + int oplen, struct symbol *sym, + const struct block *block) { /* A new expression, with 6 more elements (3 for funcall, 4 for function symbol, -oplen for operator being replaced). */ struct expression *newexp = (struct expression *) xzalloc (sizeof (struct expression) - + EXP_ELEM_TO_BYTES ((*expp)->nelts + 7 - oplen)); + + EXP_ELEM_TO_BYTES ((*expp)->nelts + 7 - oplen)); struct expression *exp = expp->get (); newexp->nelts = exp->nelts + 7 - oplen; @@ -3936,7 +3936,7 @@ replace_operator_with_call (expression_up *expp, int pc, int nargs, newexp->gdbarch = exp->gdbarch; memcpy (newexp->elts, exp->elts, EXP_ELEM_TO_BYTES (pc)); memcpy (newexp->elts + pc + 7, exp->elts + pc + oplen, - EXP_ELEM_TO_BYTES (exp->nelts - pc - oplen)); + EXP_ELEM_TO_BYTES (exp->nelts - pc - oplen)); newexp->elts[pc].opcode = newexp->elts[pc + 2].opcode = OP_FUNCALL; newexp->elts[pc + 1].longconst = (LONGEST) nargs; @@ -3961,16 +3961,16 @@ numeric_type_p (struct type *type) else { switch (type->code ()) - { - case TYPE_CODE_INT: - case TYPE_CODE_FLT: - return 1; - case TYPE_CODE_RANGE: - return (type == TYPE_TARGET_TYPE (type) - || numeric_type_p (TYPE_TARGET_TYPE (type))); - default: - return 0; - } + { + case TYPE_CODE_INT: + case TYPE_CODE_FLT: + return 1; + case TYPE_CODE_RANGE: + return (type == TYPE_TARGET_TYPE (type) + || numeric_type_p (TYPE_TARGET_TYPE (type))); + default: + return 0; + } } } @@ -3984,15 +3984,15 @@ integer_type_p (struct type *type) else { switch (type->code ()) - { - case TYPE_CODE_INT: - return 1; - case TYPE_CODE_RANGE: - return (type == TYPE_TARGET_TYPE (type) - || integer_type_p (TYPE_TARGET_TYPE (type))); - default: - return 0; - } + { + case TYPE_CODE_INT: + return 1; + case TYPE_CODE_RANGE: + return (type == TYPE_TARGET_TYPE (type) + || integer_type_p (TYPE_TARGET_TYPE (type))); + default: + return 0; + } } } @@ -4006,15 +4006,15 @@ scalar_type_p (struct type *type) else { switch (type->code ()) - { - case TYPE_CODE_INT: - case TYPE_CODE_RANGE: - case TYPE_CODE_ENUM: - case TYPE_CODE_FLT: - return 1; - default: - return 0; - } + { + case TYPE_CODE_INT: + case TYPE_CODE_RANGE: + case TYPE_CODE_ENUM: + case TYPE_CODE_FLT: + return 1; + default: + return 0; + } } } @@ -4028,15 +4028,15 @@ discrete_type_p (struct type *type) else { switch (type->code ()) - { - case TYPE_CODE_INT: - case TYPE_CODE_RANGE: - case TYPE_CODE_ENUM: - case TYPE_CODE_BOOL: - return 1; - default: - return 0; - } + { + case TYPE_CODE_INT: + case TYPE_CODE_RANGE: + case TYPE_CODE_ENUM: + case TYPE_CODE_BOOL: + return 1; + default: + return 0; + } } } @@ -4096,7 +4096,7 @@ possible_user_operator_p (enum exp_opcode op, struct value *args[]) } } - /* Renaming */ + /* Renaming */ /* NOTES: @@ -4203,7 +4203,7 @@ ada_read_renaming_var_value (struct symbol *renaming_sym, } - /* Evaluation: Function Calls */ + /* Evaluation: Function Calls */ /* Return an lvalue containing the value VAL. This is the identity on lvalues, and otherwise has the side-effect of allocating memory @@ -4217,7 +4217,7 @@ ensure_lval (struct value *val) { int len = TYPE_LENGTH (ada_check_typedef (value_type (val))); const CORE_ADDR addr = - value_as_long (value_allocate_space_in_inferior (len)); + value_as_long (value_allocate_space_in_inferior (len)); VALUE_LVAL (val) = lval_memory; set_value_address (val, addr); @@ -4255,10 +4255,10 @@ ada_value_struct_elt (struct value *arg, const char *name, int no_err) goto BadValue; t1 = ada_check_typedef (t1); if (t1->code () == TYPE_CODE_PTR) - { - arg = coerce_ref (arg); - t = t1; - } + { + arg = coerce_ref (arg); + t = t1; + } } while (t->code () == TYPE_CODE_PTR) @@ -4268,12 +4268,12 @@ ada_value_struct_elt (struct value *arg, const char *name, int no_err) goto BadValue; t1 = ada_check_typedef (t1); if (t1->code () == TYPE_CODE_PTR) - { - arg = value_ind (arg); - t = t1; - } + { + arg = value_ind (arg); + t = t1; + } else - break; + break; } if (t1->code () != TYPE_CODE_STRUCT && t1->code () != TYPE_CODE_UNION) @@ -4293,25 +4293,25 @@ ada_value_struct_elt (struct value *arg, const char *name, int no_err) address = value_address (ada_coerce_ref (arg)); /* Check to see if this is a tagged type. We also need to handle - the case where the type is a reference to a tagged type, but - we have to be careful to exclude pointers to tagged types. - The latter should be shown as usual (as a pointer), whereas - a reference should mostly be transparent to the user. */ + the case where the type is a reference to a tagged type, but + we have to be careful to exclude pointers to tagged types. + The latter should be shown as usual (as a pointer), whereas + a reference should mostly be transparent to the user. */ if (ada_is_tagged_type (t1, 0) - || (t1->code () == TYPE_CODE_REF - && ada_is_tagged_type (TYPE_TARGET_TYPE (t1), 0))) - { - /* We first try to find the searched field in the current type. + || (t1->code () == TYPE_CODE_REF + && ada_is_tagged_type (TYPE_TARGET_TYPE (t1), 0))) + { + /* We first try to find the searched field in the current type. If not found then let's look in the fixed type. */ - if (!find_struct_field (name, t1, 0, - &field_type, &byte_offset, &bit_offset, - &bit_size, NULL)) + if (!find_struct_field (name, t1, 0, + &field_type, &byte_offset, &bit_offset, + &bit_size, NULL)) check_tag = 1; else check_tag = 0; - } + } else check_tag = 0; @@ -4321,22 +4321,22 @@ ada_value_struct_elt (struct value *arg, const char *name, int no_err) address, NULL, check_tag); if (find_struct_field (name, t1, 0, - &field_type, &byte_offset, &bit_offset, - &bit_size, NULL)) - { - if (bit_size != 0) - { - if (t->code () == TYPE_CODE_REF) - arg = ada_coerce_ref (arg); - else - arg = ada_value_ind (arg); - v = ada_value_primitive_packed_val (arg, NULL, byte_offset, - bit_offset, bit_size, - field_type); - } - else - v = value_at_lazy (field_type, address + byte_offset); - } + &field_type, &byte_offset, &bit_offset, + &bit_size, NULL)) + { + if (bit_size != 0) + { + if (t->code () == TYPE_CODE_REF) + arg = ada_coerce_ref (arg); + else + arg = ada_value_ind (arg); + v = ada_value_primitive_packed_val (arg, NULL, byte_offset, + bit_offset, bit_size, + field_type); + } + else + v = value_at_lazy (field_type, address + byte_offset); + } } if (v != NULL || no_err) @@ -4378,23 +4378,23 @@ ada_convert_actual (struct value *actual, struct type *formal_type0) struct value *result; if (formal_target->code () == TYPE_CODE_ARRAY - && ada_is_array_descriptor_type (actual_target)) + && ada_is_array_descriptor_type (actual_target)) result = desc_data (actual); else if (formal_type->code () != TYPE_CODE_PTR) - { - if (VALUE_LVAL (actual) != lval_memory) - { - struct value *val; - - actual_type = ada_check_typedef (value_type (actual)); - val = allocate_value (actual_type); - memcpy ((char *) value_contents_raw (val), - (char *) value_contents (actual), - TYPE_LENGTH (actual_type)); - actual = ensure_lval (val); - } - result = value_addr (actual); - } + { + if (VALUE_LVAL (actual) != lval_memory) + { + struct value *val; + + actual_type = ada_check_typedef (value_type (actual)); + val = allocate_value (actual_type); + memcpy ((char *) value_contents_raw (val), + (char *) value_contents (actual), + TYPE_LENGTH (actual_type)); + actual = ensure_lval (val); + } + result = value_addr (actual); + } else return actual; return value_cast_pointers (formal_type, result, 0); @@ -4487,7 +4487,7 @@ make_array_descriptor (struct type *type, struct value *arr) return descriptor; } - /* Symbol Cache Module */ + /* Symbol Cache Module */ /* Performance measurements made as of 2010-01-15 indicate that this cache does bring some noticeable improvements. Depending @@ -4560,7 +4560,7 @@ find_entry (const char *name, domain_enum domain) for (e = &sym_cache->root[h]; *e != NULL; e = &(*e)->next) { if (domain == (*e)->domain && strcmp (name, (*e)->name) == 0) - return e; + return e; } return NULL; } @@ -4573,7 +4573,7 @@ find_entry (const char *name, domain_enum domain) static int lookup_cached_symbol (const char *name, domain_enum domain, - struct symbol **sym, const struct block **block) + struct symbol **sym, const struct block **block) { struct cache_entry **e = find_entry (name, domain); @@ -4591,7 +4591,7 @@ lookup_cached_symbol (const char *name, domain_enum domain, static void cache_symbol (const char *name, domain_enum domain, struct symbol *sym, - const struct block *block) + const struct block *block) { struct ada_symbol_cache *sym_cache = ada_get_symbol_cache (current_program_space); @@ -4624,7 +4624,7 @@ cache_symbol (const char *name, domain_enum domain, struct symbol *sym, e->block = block; } - /* Symbol Lookup */ + /* Symbol Lookup */ /* Return the symbol name match type that should be used used when searching for all symbols matching LOOKUP_NAME. @@ -4645,7 +4645,7 @@ name_match_type_from_name (const char *lookup_name) static struct symbol * standard_lookup (const char *name, const struct block *block, - domain_enum domain) + domain_enum domain) { /* Initialize it just to avoid a GCC false warning. */ struct block_symbol sym = {}; @@ -4668,8 +4668,8 @@ is_nonfunction (struct block_symbol syms[], int n) for (i = 0; i < n; i += 1) if (SYMBOL_TYPE (syms[i].symbol)->code () != TYPE_CODE_FUNC - && (SYMBOL_TYPE (syms[i].symbol)->code () != TYPE_CODE_ENUM - || SYMBOL_CLASS (syms[i].symbol) != LOC_CONST)) + && (SYMBOL_TYPE (syms[i].symbol)->code () != TYPE_CODE_ENUM + || SYMBOL_CLASS (syms[i].symbol) != LOC_CONST)) return 1; return 0; @@ -4713,28 +4713,28 @@ lesseq_defined_than (struct symbol *sym0, struct symbol *sym1) return 1; case LOC_TYPEDEF: { - struct type *type0 = SYMBOL_TYPE (sym0); - struct type *type1 = SYMBOL_TYPE (sym1); - const char *name0 = sym0->linkage_name (); - const char *name1 = sym1->linkage_name (); - int len0 = strlen (name0); - - return - type0->code () == type1->code () - && (equiv_types (type0, type1) - || (len0 < strlen (name1) && strncmp (name0, name1, len0) == 0 - && startswith (name1 + len0, "___XV"))); + struct type *type0 = SYMBOL_TYPE (sym0); + struct type *type1 = SYMBOL_TYPE (sym1); + const char *name0 = sym0->linkage_name (); + const char *name1 = sym1->linkage_name (); + int len0 = strlen (name0); + + return + type0->code () == type1->code () + && (equiv_types (type0, type1) + || (len0 < strlen (name1) && strncmp (name0, name1, len0) == 0 + && startswith (name1 + len0, "___XV"))); } case LOC_CONST: return SYMBOL_VALUE (sym0) == SYMBOL_VALUE (sym1) - && equiv_types (SYMBOL_TYPE (sym0), SYMBOL_TYPE (sym1)); + && equiv_types (SYMBOL_TYPE (sym0), SYMBOL_TYPE (sym1)); case LOC_STATIC: { - const char *name0 = sym0->linkage_name (); - const char *name1 = sym1->linkage_name (); - return (strcmp (name0, name1) == 0 - && SYMBOL_VALUE_ADDRESS (sym0) == SYMBOL_VALUE_ADDRESS (sym1)); + const char *name0 = sym0->linkage_name (); + const char *name1 = sym1->linkage_name (); + return (strcmp (name0, name1) == 0 + && SYMBOL_VALUE_ADDRESS (sym0) == SYMBOL_VALUE_ADDRESS (sym1)); } default: @@ -4747,8 +4747,8 @@ lesseq_defined_than (struct symbol *sym0, struct symbol *sym1) static void add_defn_to_vec (struct obstack *obstackp, - struct symbol *sym, - const struct block *block) + struct symbol *sym, + const struct block *block) { int i; struct block_symbol *prevDefns = defns_collected (obstackp, 0); @@ -4765,13 +4765,13 @@ add_defn_to_vec (struct obstack *obstackp, for (i = num_defns_collected (obstackp) - 1; i >= 0; i -= 1) { if (lesseq_defined_than (sym, prevDefns[i].symbol)) - return; + return; else if (lesseq_defined_than (prevDefns[i].symbol, sym)) - { - prevDefns[i].symbol = sym; - prevDefns[i].block = block; - return; - } + { + prevDefns[i].symbol = sym; + prevDefns[i].block = block; + return; + } } { @@ -4898,7 +4898,7 @@ ada_identical_enum_types_p (struct type *type1, struct type *type2) ada_remove_trailing_digits (TYPE_FIELD_NAME (type1, i), &len_1); ada_remove_trailing_digits (TYPE_FIELD_NAME (type2, i), &len_2); if (len_1 != len_2 - || strncmp (TYPE_FIELD_NAME (type1, i), + || strncmp (TYPE_FIELD_NAME (type1, i), TYPE_FIELD_NAME (type2, i), len_1) != 0) return 0; @@ -4952,7 +4952,7 @@ symbols_are_identical_enums (const std::vector<struct block_symbol> &syms) /* Quick check: They should all have the same number of enumerals. */ for (i = 1; i < syms.size (); i++) if (SYMBOL_TYPE (syms[i].symbol)->num_fields () - != SYMBOL_TYPE (syms[0].symbol)->num_fields ()) + != SYMBOL_TYPE (syms[0].symbol)->num_fields ()) return 0; /* All the sanity checks passed, so we might have a set of @@ -4960,7 +4960,7 @@ symbols_are_identical_enums (const std::vector<struct block_symbol> &syms) comparison of the type of each symbol. */ for (i = 1; i < syms.size (); i++) if (!ada_identical_enum_types_p (SYMBOL_TYPE (syms[i].symbol), - SYMBOL_TYPE (syms[0].symbol))) + SYMBOL_TYPE (syms[0].symbol))) return 0; return 1; @@ -4990,42 +4990,42 @@ remove_extra_symbols (std::vector<struct block_symbol> *syms) int remove_p = 0; /* If two symbols have the same name and one of them is a stub type, - the get rid of the stub. */ + the get rid of the stub. */ if (SYMBOL_TYPE ((*syms)[i].symbol)->is_stub () - && (*syms)[i].symbol->linkage_name () != NULL) - { - for (j = 0; j < syms->size (); j++) - { - if (j != i - && !SYMBOL_TYPE ((*syms)[j].symbol)->is_stub () - && (*syms)[j].symbol->linkage_name () != NULL - && strcmp ((*syms)[i].symbol->linkage_name (), - (*syms)[j].symbol->linkage_name ()) == 0) - remove_p = 1; - } - } + && (*syms)[i].symbol->linkage_name () != NULL) + { + for (j = 0; j < syms->size (); j++) + { + if (j != i + && !SYMBOL_TYPE ((*syms)[j].symbol)->is_stub () + && (*syms)[j].symbol->linkage_name () != NULL + && strcmp ((*syms)[i].symbol->linkage_name (), + (*syms)[j].symbol->linkage_name ()) == 0) + remove_p = 1; + } + } /* Two symbols with the same name, same class and same address - should be identical. */ + should be identical. */ else if ((*syms)[i].symbol->linkage_name () != NULL - && SYMBOL_CLASS ((*syms)[i].symbol) == LOC_STATIC - && is_nondebugging_type (SYMBOL_TYPE ((*syms)[i].symbol))) - { - for (j = 0; j < syms->size (); j += 1) - { - if (i != j - && (*syms)[j].symbol->linkage_name () != NULL - && strcmp ((*syms)[i].symbol->linkage_name (), - (*syms)[j].symbol->linkage_name ()) == 0 - && SYMBOL_CLASS ((*syms)[i].symbol) + && SYMBOL_CLASS ((*syms)[i].symbol) == LOC_STATIC + && is_nondebugging_type (SYMBOL_TYPE ((*syms)[i].symbol))) + { + for (j = 0; j < syms->size (); j += 1) + { + if (i != j + && (*syms)[j].symbol->linkage_name () != NULL + && strcmp ((*syms)[i].symbol->linkage_name (), + (*syms)[j].symbol->linkage_name ()) == 0 + && SYMBOL_CLASS ((*syms)[i].symbol) == SYMBOL_CLASS ((*syms)[j].symbol) - && SYMBOL_VALUE_ADDRESS ((*syms)[i].symbol) - == SYMBOL_VALUE_ADDRESS ((*syms)[j].symbol)) - remove_p = 1; - } - } + && SYMBOL_VALUE_ADDRESS ((*syms)[i].symbol) + == SYMBOL_VALUE_ADDRESS ((*syms)[j].symbol)) + remove_p = 1; + } + } if (remove_p) syms->erase (syms->begin () + i); @@ -5163,15 +5163,15 @@ old_renaming_is_invisible (const struct symbol *sym, const char *function_name) below has a couple of limitations (FIXME: brobecker-2003-05-12): - When the user tries to print a rename in a function while there - is another rename entity defined in a package: Normally, the - rename in the function has precedence over the rename in the - package, so the latter should be removed from the list. This is - currently not the case. - + is another rename entity defined in a package: Normally, the + rename in the function has precedence over the rename in the + package, so the latter should be removed from the list. This is + currently not the case. + - This function will incorrectly remove valid renames if - the CURRENT_BLOCK corresponds to a function which symbol name - has been changed by an "Export" pragma. As a consequence, - the user will be unable to print such rename entities. */ + the CURRENT_BLOCK corresponds to a function which symbol name + has been changed by an "Export" pragma. As a consequence, + the user will be unable to print such rename entities. */ static int remove_irrelevant_renamings (std::vector<struct block_symbol> *syms, @@ -5247,12 +5247,12 @@ remove_irrelevant_renamings (std::vector<struct block_symbol> *syms, while (i < syms->size ()) { if (ada_parse_renaming ((*syms)[i].symbol, NULL, NULL, NULL) - == ADA_OBJECT_RENAMING - && old_renaming_is_invisible ((*syms)[i].symbol, + == ADA_OBJECT_RENAMING + && old_renaming_is_invisible ((*syms)[i].symbol, current_function_name)) syms->erase (syms->begin () + i); else - i += 1; + i += 1; } return syms->size (); @@ -5282,8 +5282,8 @@ ada_add_local_symbols (struct obstack *obstackp, /* If we found a non-function match, assume that's the one. */ if (is_nonfunction (defns_collected (obstackp, 0), - num_defns_collected (obstackp))) - return; + num_defns_collected (obstackp))) + return; block = BLOCK_SUPERBLOCK (block); } @@ -5547,7 +5547,7 @@ add_nonlocal_symbols (struct obstack *obstackp, lookup_name_info name1 (bracket_name, symbol_name_match_type::FULL); for (objfile *objfile : current_program_space->objfiles ()) - { + { data.objfile = objfile; objfile->sf->qf->map_matching_symbols (objfile, name1, domain, global, callback, @@ -5737,7 +5737,7 @@ ada_lookup_encoded_symbol (const char *name, const struct block *block, struct block_symbol ada_lookup_symbol (const char *name, const struct block *block0, - domain_enum domain) + domain_enum domain) { std::vector<struct block_symbol> candidates; int n_candidates; @@ -5781,7 +5781,7 @@ is_name_suffix (const char *str) { str += 3; while (isdigit (str[0])) - str += 1; + str += 1; } /* [.$][0-9]+ */ @@ -5790,9 +5790,9 @@ is_name_suffix (const char *str) { matching = str + 1; while (isdigit (matching[0])) - matching += 1; + matching += 1; if (matching[0] == '\0') - return 1; + return 1; } /* ___[0-9]+ */ @@ -5801,9 +5801,9 @@ is_name_suffix (const char *str) { matching = str + 3; while (isdigit (matching[0])) - matching += 1; + matching += 1; if (matching[0] == '\0') - return 1; + return 1; } /* "TKB" suffixes are used for subprograms implementing task bodies. */ @@ -5833,10 +5833,10 @@ is_name_suffix (const char *str) { matching = str + 3; while (isdigit (matching[0])) - matching += 1; + matching += 1; if ((matching[0] == 'b' || matching[0] == 's') - && matching [1] == '\0') - return 1; + && matching [1] == '\0') + return 1; } /* ??? We should not modify STR directly, as we are doing below. This @@ -5848,11 +5848,11 @@ is_name_suffix (const char *str) { str += 1; while (str[0] != '_' && str[0] != '\0') - { - if (str[0] != 'n' && str[0] != 'b') - return 0; - str += 1; - } + { + if (str[0] != 'n' && str[0] != 'b') + return 0; + str += 1; + } } if (str[0] == '\000') @@ -5861,39 +5861,39 @@ is_name_suffix (const char *str) if (str[0] == '_') { if (str[1] != '_' || str[2] == '\000') - return 0; + return 0; if (str[2] == '_') - { - if (strcmp (str + 3, "JM") == 0) - return 1; - /* FIXME: brobecker/2004-09-30: GNAT will soon stop using - the LJM suffix in favor of the JM one. But we will - still accept LJM as a valid suffix for a reasonable - amount of time, just to allow ourselves to debug programs - compiled using an older version of GNAT. */ - if (strcmp (str + 3, "LJM") == 0) - return 1; - if (str[3] != 'X') - return 0; - if (str[4] == 'F' || str[4] == 'D' || str[4] == 'B' - || str[4] == 'U' || str[4] == 'P') - return 1; - if (str[4] == 'R' && str[5] != 'T') - return 1; - return 0; - } + { + if (strcmp (str + 3, "JM") == 0) + return 1; + /* FIXME: brobecker/2004-09-30: GNAT will soon stop using + the LJM suffix in favor of the JM one. But we will + still accept LJM as a valid suffix for a reasonable + amount of time, just to allow ourselves to debug programs + compiled using an older version of GNAT. */ + if (strcmp (str + 3, "LJM") == 0) + return 1; + if (str[3] != 'X') + return 0; + if (str[4] == 'F' || str[4] == 'D' || str[4] == 'B' + || str[4] == 'U' || str[4] == 'P') + return 1; + if (str[4] == 'R' && str[5] != 'T') + return 1; + return 0; + } if (!isdigit (str[2])) - return 0; + return 0; for (k = 3; str[k] != '\0'; k += 1) - if (!isdigit (str[k]) && str[k] != '_') - return 0; + if (!isdigit (str[k]) && str[k] != '_') + return 0; return 1; } if (str[0] == '$' && isdigit (str[1])) { for (k = 2; str[k] != '\0'; k += 1) - if (!isdigit (str[k]) && str[k] != '_') - return 0; + if (!isdigit (str[k]) && str[k] != '_') + return 0; return 1; } return 0; @@ -6066,8 +6066,8 @@ ada_add_block_symbols (struct obstack *obstackp, if (!found_sym && arg_sym != NULL) { add_defn_to_vec (obstackp, - fixup_symbol_section (arg_sym, objfile), - block); + fixup_symbol_section (arg_sym, objfile), + block); } if (!lookup_name.ada ().wild_match_p ()) @@ -6080,23 +6080,23 @@ ada_add_block_symbols (struct obstack *obstackp, ALL_BLOCK_SYMBOLS (block, iter, sym) { - if (symbol_matches_domain (sym->language (), - SYMBOL_DOMAIN (sym), domain)) - { - int cmp; - - cmp = (int) '_' - (int) sym->linkage_name ()[0]; - if (cmp == 0) - { - cmp = !startswith (sym->linkage_name (), "_ada_"); - if (cmp == 0) - cmp = strncmp (name, sym->linkage_name () + 5, - name_len); - } - - if (cmp == 0 - && is_name_suffix (sym->linkage_name () + name_len + 5)) - { + if (symbol_matches_domain (sym->language (), + SYMBOL_DOMAIN (sym), domain)) + { + int cmp; + + cmp = (int) '_' - (int) sym->linkage_name ()[0]; + if (cmp == 0) + { + cmp = !startswith (sym->linkage_name (), "_ada_"); + if (cmp == 0) + cmp = strncmp (name, sym->linkage_name () + 5, + name_len); + } + + if (cmp == 0 + && is_name_suffix (sym->linkage_name () + name_len + 5)) + { if (SYMBOL_CLASS (sym) != LOC_UNRESOLVED) { if (SYMBOL_IS_ARGUMENT (sym)) @@ -6109,23 +6109,23 @@ ada_add_block_symbols (struct obstack *obstackp, block); } } - } - } + } + } } /* NOTE: This really shouldn't be needed for _ada_ symbols. - They aren't parameters, right? */ + They aren't parameters, right? */ if (!found_sym && arg_sym != NULL) - { - add_defn_to_vec (obstackp, - fixup_symbol_section (arg_sym, objfile), - block); - } + { + add_defn_to_vec (obstackp, + fixup_symbol_section (arg_sym, objfile), + block); + } } } - /* Symbol Completion */ + /* Symbol Completion */ /* See symtab.h. */ @@ -6148,9 +6148,9 @@ ada_lookup_name_info::matches if (match && !m_encoded_p) { /* One needed check before declaring a positive match is to verify - that iff we are doing a verbatim match, the decoded version - of the symbol name starts with '<'. Otherwise, this symbol name - is not a suitable completion. */ + that iff we are doing a verbatim match, the decoded version + of the symbol name starts with '<'. Otherwise, this symbol name + is not a suitable completion. */ bool has_angle_bracket = (decoded_name[0] == '<'); match = (has_angle_bracket == m_verbatim_p); @@ -6159,10 +6159,10 @@ ada_lookup_name_info::matches if (match && !m_verbatim_p) { /* When doing non-verbatim match, another check that needs to - be done is to verify that the potentially matching symbol name - does not include capital letters, because the ada-mode would - not be able to understand these symbol names without the - angle bracket notation. */ + be done is to verify that the potentially matching symbol name + does not include capital letters, because the ada-mode would + not be able to understand these symbol names without the + angle bracket notation. */ const char *tmp; for (tmp = sym_name; *tmp != '\0' && !isupper (*tmp); tmp++); @@ -6175,8 +6175,8 @@ ada_lookup_name_info::matches if (!match && m_wild_match_p) { /* Since we are doing wild matching, this means that TEXT - may represent an unqualified symbol name. We therefore must - also compare TEXT against the unqualified name of the symbol. */ + may represent an unqualified symbol name. We therefore must + also compare TEXT against the unqualified name of the symbol. */ sym_name = ada_unqualified_name (decoded_name.c_str ()); if (strncmp (sym_name, text, text_len) == 0) @@ -6209,7 +6209,7 @@ ada_lookup_name_info::matches return true; } - /* Field Access */ + /* Field Access */ /* Return non-zero if TYPE is a pointer to the GNAT dispatch table used for tagged types. */ @@ -6306,7 +6306,7 @@ ada_is_tag_type (struct type *type) const char *name = ada_type_name (TYPE_TARGET_TYPE (type)); return (name != NULL - && strcmp (name, "ada__tags__dispatch_table") == 0); + && strcmp (name, "ada__tags__dispatch_table") == 0); } } @@ -6342,13 +6342,13 @@ ada_value_tag (struct value *val) static struct value * value_tag_from_contents_and_address (struct type *type, const gdb_byte *valaddr, - CORE_ADDR address) + CORE_ADDR address) { int tag_byte_offset; struct type *tag_type; if (find_struct_field ("_tag", type, 0, &tag_type, &tag_byte_offset, - NULL, NULL, NULL)) + NULL, NULL, NULL)) { const gdb_byte *valaddr1 = ((valaddr == NULL) ? NULL @@ -6591,15 +6591,15 @@ ada_parent_type (struct type *type) for (i = 0; i < type->num_fields (); i += 1) if (ada_is_parent_field (type, i)) { - struct type *parent_type = type->field (i).type (); + struct type *parent_type = type->field (i).type (); - /* If the _parent field is a pointer, then dereference it. */ - if (parent_type->code () == TYPE_CODE_PTR) - parent_type = TYPE_TARGET_TYPE (parent_type); - /* If there is a parallel XVS type, get the actual base type. */ - parent_type = ada_get_base_type (parent_type); + /* If the _parent field is a pointer, then dereference it. */ + if (parent_type->code () == TYPE_CODE_PTR) + parent_type = TYPE_TARGET_TYPE (parent_type); + /* If there is a parallel XVS type, get the actual base type. */ + parent_type = ada_get_base_type (parent_type); - return ada_check_typedef (parent_type); + return ada_check_typedef (parent_type); } return NULL; @@ -6615,8 +6615,8 @@ ada_is_parent_field (struct type *type, int field_num) const char *name = TYPE_FIELD_NAME (ada_check_typedef (type), field_num); return (name != NULL - && (startswith (name, "PARENT") - || startswith (name, "_parent"))); + && (startswith (name, "PARENT") + || startswith (name, "_parent"))); } /* True iff field number FIELD_NUM of structure type TYPE is a @@ -6642,10 +6642,10 @@ ada_is_wrapper_field (struct type *type, int field_num) } return (name != NULL - && (startswith (name, "PARENT") - || strcmp (name, "REP") == 0 - || startswith (name, "_parent") - || name[0] == 'S' || name[0] == 'R' || name[0] == 'O')); + && (startswith (name, "PARENT") + || strcmp (name, "REP") == 0 + || startswith (name, "_parent") + || name[0] == 'S' || name[0] == 'R' || name[0] == 'O')); } /* True iff field number FIELD_NUM of structure or union type TYPE @@ -6720,7 +6720,7 @@ ada_variant_discrim_name (struct type *type0) discrim_end -= 1) { if (startswith (discrim_end, "___XVN")) - break; + break; } if (discrim_end == name) return ""; @@ -6729,11 +6729,11 @@ ada_variant_discrim_name (struct type *type0) discrim_start -= 1) { if (discrim_start == name + 1) - return ""; + return ""; if ((discrim_start > name + 3 - && startswith (discrim_start - 3, "___")) - || discrim_start[-1] == '.') - break; + && startswith (discrim_start - 3, "___")) + || discrim_start[-1] == '.') + break; } GROW_VECT (result, result_len, discrim_end - discrim_start + 1); @@ -6771,7 +6771,7 @@ ada_scan_number (const char str[], int k, LONGEST * R, int *new_k) if (str[k] == 'm') { if (R != NULL) - *R = (-(LONGEST) (RU - 1)) - 1; + *R = (-(LONGEST) (RU - 1)) - 1; k += 1; } else if (R != NULL) @@ -6802,35 +6802,35 @@ ada_in_variant (LONGEST val, struct type *type, int field_num) while (1) { switch (name[p]) - { - case '\0': - return 0; - case 'S': - { - LONGEST W; - - if (!ada_scan_number (name, p + 1, &W, &p)) - return 0; - if (val == W) - return 1; - break; - } - case 'R': - { - LONGEST L, U; - - if (!ada_scan_number (name, p + 1, &L, &p) - || name[p] != 'T' || !ada_scan_number (name, p + 1, &U, &p)) - return 0; - if (val >= L && val <= U) - return 1; - break; - } - case 'O': - return 1; - default: - return 0; - } + { + case '\0': + return 0; + case 'S': + { + LONGEST W; + + if (!ada_scan_number (name, p + 1, &W, &p)) + return 0; + if (val == W) + return 1; + break; + } + case 'R': + { + LONGEST L, U; + + if (!ada_scan_number (name, p + 1, &L, &p) + || name[p] != 'T' || !ada_scan_number (name, p + 1, &U, &p)) + return 0; + if (val >= L && val <= U) + return 1; + break; + } + case 'O': + return 1; + default: + return 0; + } } } @@ -6843,7 +6843,7 @@ ada_in_variant (LONGEST val, struct type *type, int field_num) struct value * ada_value_primitive_field (struct value *arg1, int offset, int fieldno, - struct type *arg_type) + struct type *arg_type) { struct type *type; @@ -6859,8 +6859,8 @@ ada_value_primitive_field (struct value *arg1, int offset, int fieldno, int bit_size = TYPE_FIELD_BITSIZE (arg_type, fieldno); return ada_value_primitive_packed_val (arg1, value_contents (arg1), - offset + bit_pos / 8, - bit_pos % 8, bit_size, type); + offset + bit_pos / 8, + bit_pos % 8, bit_size, type); } else return value_primitive_field (arg1, offset, fieldno, arg_type); @@ -6883,21 +6883,21 @@ ada_value_primitive_field (struct value *arg1, int offset, int fieldno, has some components with the same name, like in this scenario: type Top_T is tagged record - N : Integer := 1; - U : Integer := 974; - A : Integer := 48; + N : Integer := 1; + U : Integer := 974; + A : Integer := 48; end record; type Middle_T is new Top.Top_T with record - N : Character := 'a'; - C : Integer := 3; + N : Character := 'a'; + C : Integer := 3; end record; type Bottom_T is new Middle.Middle_T with record - N : Float := 4.0; - C : Character := '5'; - X : Integer := 6; - A : Character := 'J'; + N : Float := 4.0; + C : Character := '5'; + X : Integer := 6; + A : Character := 'J'; end record; Let's say we now have a variable declared and initialized as follow: @@ -6933,8 +6933,8 @@ ada_value_primitive_field (struct value *arg1, int offset, int fieldno, static int find_struct_field (const char *name, struct type *type, int offset, - struct type **field_type_p, - int *byte_offset_p, int *bit_offset_p, int *bit_size_p, + struct type **field_type_p, + int *byte_offset_p, int *bit_offset_p, int *bit_size_p, int *index_p) { int i; @@ -6958,10 +6958,10 @@ find_struct_field (const char *name, struct type *type, int offset, const char *t_field_name = TYPE_FIELD_NAME (type, i); if (t_field_name == NULL) - continue; + continue; else if (ada_is_parent_field (type, i)) - { + { /* This is a field pointing us to the parent type of a tagged type. As hinted in this function's documentation, we give preference to fields in the current record first, so what @@ -6970,13 +6970,13 @@ find_struct_field (const char *name, struct type *type, int offset, in the current record, then we'll get back to it and search inside it whether the field might exist in the parent. */ - parent_offset = i; - continue; - } + parent_offset = i; + continue; + } else if (name != NULL && field_name_match (t_field_name, name)) - { - int bit_size = TYPE_FIELD_BITSIZE (type, i); + { + int bit_size = TYPE_FIELD_BITSIZE (type, i); if (field_type_p != NULL) *field_type_p = type->field (i).type (); @@ -6986,33 +6986,33 @@ find_struct_field (const char *name, struct type *type, int offset, *bit_offset_p = bit_pos % 8; if (bit_size_p != NULL) *bit_size_p = bit_size; - return 1; - } + return 1; + } else if (ada_is_wrapper_field (type, i)) - { + { if (find_struct_field (name, type->field (i).type (), fld_offset, field_type_p, byte_offset_p, bit_offset_p, bit_size_p, index_p)) - return 1; - } + return 1; + } else if (ada_is_variant_part (type, i)) - { + { /* PNH: Wait. Do we ever execute this section, or is ARG always of fixed type?? */ - int j; - struct type *field_type + int j; + struct type *field_type = ada_check_typedef (type->field (i).type ()); - for (j = 0; j < field_type->num_fields (); j += 1) - { - if (find_struct_field (name, field_type->field (j).type (), - fld_offset - + TYPE_FIELD_BITPOS (field_type, j) / 8, - field_type_p, byte_offset_p, - bit_offset_p, bit_size_p, index_p)) - return 1; - } - } + for (j = 0; j < field_type->num_fields (); j += 1) + { + if (find_struct_field (name, field_type->field (j).type (), + fld_offset + + TYPE_FIELD_BITPOS (field_type, j) / 8, + field_type_p, byte_offset_p, + bit_offset_p, bit_size_p, index_p)) + return 1; + } + } else if (index_p != NULL) *index_p += 1; } @@ -7026,9 +7026,9 @@ find_struct_field (const char *name, struct type *type, int offset, int fld_offset = offset + bit_pos / 8; if (find_struct_field (name, type->field (parent_offset).type (), - fld_offset, field_type_p, byte_offset_p, - bit_offset_p, bit_size_p, index_p)) - return 1; + fld_offset, field_type_p, byte_offset_p, + bit_offset_p, bit_size_p, index_p)) + return 1; } return 0; @@ -7057,7 +7057,7 @@ num_visible_fields (struct type *type) static struct value * ada_search_struct_field (const char *name, struct value *arg, int offset, - struct type *type) + struct type *type) { int i; int parent_offset = -1; @@ -7068,10 +7068,10 @@ ada_search_struct_field (const char *name, struct value *arg, int offset, const char *t_field_name = TYPE_FIELD_NAME (type, i); if (t_field_name == NULL) - continue; + continue; else if (ada_is_parent_field (type, i)) - { + { /* This is a field pointing us to the parent type of a tagged type. As hinted in this function's documentation, we give preference to fields in the current record first, so what @@ -7080,43 +7080,43 @@ ada_search_struct_field (const char *name, struct value *arg, int offset, in the current record, then we'll get back to it and search inside it whether the field might exist in the parent. */ - parent_offset = i; - continue; - } + parent_offset = i; + continue; + } else if (field_name_match (t_field_name, name)) - return ada_value_primitive_field (arg, offset, i, type); + return ada_value_primitive_field (arg, offset, i, type); else if (ada_is_wrapper_field (type, i)) - { - struct value *v = /* Do not let indent join lines here. */ - ada_search_struct_field (name, arg, - offset + TYPE_FIELD_BITPOS (type, i) / 8, - type->field (i).type ()); + { + struct value *v = /* Do not let indent join lines here. */ + ada_search_struct_field (name, arg, + offset + TYPE_FIELD_BITPOS (type, i) / 8, + type->field (i).type ()); - if (v != NULL) - return v; - } + if (v != NULL) + return v; + } else if (ada_is_variant_part (type, i)) - { + { /* PNH: Do we ever get here? See find_struct_field. */ - int j; - struct type *field_type = ada_check_typedef (type->field (i).type ()); - int var_offset = offset + TYPE_FIELD_BITPOS (type, i) / 8; + int j; + struct type *field_type = ada_check_typedef (type->field (i).type ()); + int var_offset = offset + TYPE_FIELD_BITPOS (type, i) / 8; - for (j = 0; j < field_type->num_fields (); j += 1) - { - struct value *v = ada_search_struct_field /* Force line + for (j = 0; j < field_type->num_fields (); j += 1) + { + struct value *v = ada_search_struct_field /* Force line break. */ - (name, arg, - var_offset + TYPE_FIELD_BITPOS (field_type, j) / 8, - field_type->field (j).type ()); + (name, arg, + var_offset + TYPE_FIELD_BITPOS (field_type, j) / 8, + field_type->field (j).type ()); - if (v != NULL) - return v; - } - } + if (v != NULL) + return v; + } + } } /* Field not found so far. If this is a tagged type which @@ -7129,7 +7129,7 @@ ada_search_struct_field (const char *name, struct value *arg, int offset, type->field (parent_offset).type ()); if (v != NULL) - return v; + return v; } return NULL; @@ -7166,26 +7166,26 @@ ada_index_struct_field_1 (int *index_p, struct value *arg, int offset, for (i = 0; i < type->num_fields (); i += 1) { if (TYPE_FIELD_NAME (type, i) == NULL) - continue; + continue; else if (ada_is_wrapper_field (type, i)) - { - struct value *v = /* Do not let indent join lines here. */ - ada_index_struct_field_1 (index_p, arg, + { + struct value *v = /* Do not let indent join lines here. */ + ada_index_struct_field_1 (index_p, arg, offset + TYPE_FIELD_BITPOS (type, i) / 8, type->field (i).type ()); - if (v != NULL) - return v; - } + if (v != NULL) + return v; + } else if (ada_is_variant_part (type, i)) - { + { /* PNH: Do we ever get here? See ada_search_struct_field, find_struct_field. */ error (_("Cannot assign this kind of variant record")); - } + } else if (*index_p == 0) - return ada_value_primitive_field (arg, offset, i, type); + return ada_value_primitive_field (arg, offset, i, type); else *index_p -= 1; } @@ -7226,7 +7226,7 @@ type_as_string (struct type *type) static struct type * ada_lookup_struct_elt_type (struct type *type, const char *name, int refok, - int noerr) + int noerr) { int i; int parent_offset = -1; @@ -7237,10 +7237,10 @@ ada_lookup_struct_elt_type (struct type *type, const char *name, int refok, if (refok && type != NULL) while (1) { - type = ada_check_typedef (type); - if (type->code () != TYPE_CODE_PTR && type->code () != TYPE_CODE_REF) - break; - type = TYPE_TARGET_TYPE (type); + type = ada_check_typedef (type); + if (type->code () != TYPE_CODE_PTR && type->code () != TYPE_CODE_REF) + break; + type = TYPE_TARGET_TYPE (type); } if (type == NULL @@ -7248,7 +7248,7 @@ ada_lookup_struct_elt_type (struct type *type, const char *name, int refok, && type->code () != TYPE_CODE_UNION)) { if (noerr) - return NULL; + return NULL; error (_("Type %s is not a structure or union type"), type != NULL ? type_as_string (type).c_str () : _("(null)")); @@ -7262,10 +7262,10 @@ ada_lookup_struct_elt_type (struct type *type, const char *name, int refok, struct type *t; if (t_field_name == NULL) - continue; + continue; else if (ada_is_parent_field (type, i)) - { + { /* This is a field pointing us to the parent type of a tagged type. As hinted in this function's documentation, we give preference to fields in the current record first, so what @@ -7274,32 +7274,32 @@ ada_lookup_struct_elt_type (struct type *type, const char *name, int refok, in the current record, then we'll get back to it and search inside it whether the field might exist in the parent. */ - parent_offset = i; - continue; - } + parent_offset = i; + continue; + } else if (field_name_match (t_field_name, name)) return type->field (i).type (); else if (ada_is_wrapper_field (type, i)) - { - t = ada_lookup_struct_elt_type (type->field (i).type (), name, - 0, 1); - if (t != NULL) + { + t = ada_lookup_struct_elt_type (type->field (i).type (), name, + 0, 1); + if (t != NULL) return t; - } + } else if (ada_is_variant_part (type, i)) - { - int j; - struct type *field_type = ada_check_typedef (type->field (i).type ()); + { + int j; + struct type *field_type = ada_check_typedef (type->field (i).type ()); - for (j = field_type->num_fields () - 1; j >= 0; j -= 1) - { + for (j = field_type->num_fields () - 1; j >= 0; j -= 1) + { /* FIXME pnh 2008/01/26: We check for a field that is - NOT wrapped in a struct, since the compiler sometimes + NOT wrapped in a struct, since the compiler sometimes generates these for unchecked variant types. Revisit - if the compiler changes this practice. */ + if the compiler changes this practice. */ const char *v_field_name = TYPE_FIELD_NAME (field_type, j); if (v_field_name != NULL @@ -7309,10 +7309,10 @@ ada_lookup_struct_elt_type (struct type *type, const char *name, int refok, t = ada_lookup_struct_elt_type (field_type->field (j).type (), name, 0, 1); - if (t != NULL) + if (t != NULL) return t; - } - } + } + } } @@ -7321,11 +7321,11 @@ ada_lookup_struct_elt_type (struct type *type, const char *name, int refok, if (parent_offset != -1) { - struct type *t; + struct type *t; - t = ada_lookup_struct_elt_type (type->field (parent_offset).type (), - name, 0, 1); - if (t != NULL) + t = ada_lookup_struct_elt_type (type->field (parent_offset).type (), + name, 0, 1); + if (t != NULL) return t; } @@ -7380,9 +7380,9 @@ ada_which_variant_applies (struct type *var_type, struct value *outer) for (i = 0; i < var_type->num_fields (); i += 1) { if (ada_is_others_clause (var_type, i)) - others_clause = i; + others_clause = i; else if (ada_in_variant (discrim_val, var_type, i)) - return i; + return i; } return others_clause; @@ -7390,7 +7390,7 @@ ada_which_variant_applies (struct type *var_type, struct value *outer) - /* Dynamic-Sized Records */ + /* Dynamic-Sized Records */ /* Strategy: The type ostensibly attached to a value with dynamic size (i.e., a size that is not statically recorded in the debugging @@ -7556,7 +7556,7 @@ ada_prefer_type (struct type *type0, struct type *type1) else if (ada_is_constrained_packed_array_type (type0)) return 1; else if (ada_is_array_descriptor_type (type0) - && !ada_is_array_descriptor_type (type1)) + && !ada_is_array_descriptor_type (type1)) return 1; else { @@ -7603,10 +7603,10 @@ find_parallel_type_by_descriptive_type (struct type *type, const char *name) const char *result_name = ada_type_name (result); if (result_name == NULL) - { - warning (_("unexpected null name on descriptive type")); - return NULL; - } + { + warning (_("unexpected null name on descriptive type")); + return NULL; + } /* If the names match, stop. */ if (strcmp (result_name, name) == 0) @@ -7697,9 +7697,9 @@ dynamic_template_type (struct type *type) int len = strlen (ada_type_name (type)); if (len > 6 && strcmp (ada_type_name (type) + len - 6, "___XVE") == 0) - return type; + return type; else - return ada_find_parallel_type (type, "___XVE"); + return ada_find_parallel_type (type, "___XVE"); } } @@ -7730,7 +7730,7 @@ variant_field_index (struct type *type) for (f = 0; f < type->num_fields (); f += 1) { if (ada_is_variant_part (type, f)) - return f; + return f; } return -1; } @@ -7769,8 +7769,8 @@ empty_record (struct type *templ) struct type * ada_template_to_fixed_record_type_1 (struct type *type, const gdb_byte *valaddr, - CORE_ADDR address, struct value *dval0, - int keep_dynamic_fields) + CORE_ADDR address, struct value *dval0, + int keep_dynamic_fields) { struct value *mark = value_mark (); struct value *dval; @@ -7790,9 +7790,9 @@ ada_template_to_fixed_record_type_1 (struct type *type, { nfields = 0; while (nfields < type->num_fields () - && !ada_is_variant_part (type, nfields) - && !is_dynamic_field (type, nfields)) - nfields++; + && !ada_is_variant_part (type, nfields) + && !is_dynamic_field (type, nfields)) + nfields++; } rtype = alloc_type_copy (type); @@ -7816,18 +7816,18 @@ ada_template_to_fixed_record_type_1 (struct type *type, TYPE_FIELD_BITSIZE (rtype, f) = 0; if (ada_is_variant_part (type, f)) - { - variant_field = f; - fld_bit_len = 0; - } + { + variant_field = f; + fld_bit_len = 0; + } else if (is_dynamic_field (type, f)) - { + { const gdb_byte *field_valaddr = valaddr; CORE_ADDR field_address = address; struct type *field_type = TYPE_TARGET_TYPE (type->field (f).type ()); - if (dval0 == NULL) + if (dval0 == NULL) { /* rtype's length is computed based on the run-time value of discriminants. If the discriminants are not @@ -7844,8 +7844,8 @@ ada_template_to_fixed_record_type_1 (struct type *type, address); rtype = value_type (dval); } - else - dval = dval0; + else + dval = dval0; /* If the type referenced by this field is an aligner type, we need to unwrap that aligner type, because its size might not be set. @@ -7885,18 +7885,18 @@ ada_template_to_fixed_record_type_1 (struct type *type, ada_ensure_varsize_limit (field_type); rtype->field (f).set_type (field_type); - TYPE_FIELD_NAME (rtype, f) = TYPE_FIELD_NAME (type, f); + TYPE_FIELD_NAME (rtype, f) = TYPE_FIELD_NAME (type, f); /* The multiplication can potentially overflow. But because the field length has been size-checked just above, and assuming that the maximum size is a reasonable value, an overflow should not happen in practice. So rather than adding overflow recovery code to this already complex code, we just assume that it's not going to happen. */ - fld_bit_len = - TYPE_LENGTH (rtype->field (f).type ()) * TARGET_CHAR_BIT; - } + fld_bit_len = + TYPE_LENGTH (rtype->field (f).type ()) * TARGET_CHAR_BIT; + } else - { + { /* Note: If this field's type is a typedef, it is important to preserve the typedef layer. @@ -7907,12 +7907,12 @@ ada_template_to_fixed_record_type_1 (struct type *type, structure, the typedef is the only clue which allows us to distinguish between the two options. Stripping it would prevent us from printing this field appropriately. */ - rtype->field (f).set_type (type->field (f).type ()); - TYPE_FIELD_NAME (rtype, f) = TYPE_FIELD_NAME (type, f); - if (TYPE_FIELD_BITSIZE (type, f) > 0) - fld_bit_len = - TYPE_FIELD_BITSIZE (rtype, f) = TYPE_FIELD_BITSIZE (type, f); - else + rtype->field (f).set_type (type->field (f).type ()); + TYPE_FIELD_NAME (rtype, f) = TYPE_FIELD_NAME (type, f); + if (TYPE_FIELD_BITSIZE (type, f) > 0) + fld_bit_len = + TYPE_FIELD_BITSIZE (rtype, f) = TYPE_FIELD_BITSIZE (type, f); + else { struct type *field_type = type->field (f).type (); @@ -7923,15 +7923,15 @@ ada_template_to_fixed_record_type_1 (struct type *type, if (field_type->code () == TYPE_CODE_TYPEDEF) field_type = ada_typedef_target_type (field_type); - fld_bit_len = - TYPE_LENGTH (ada_check_typedef (field_type)) * TARGET_CHAR_BIT; + fld_bit_len = + TYPE_LENGTH (ada_check_typedef (field_type)) * TARGET_CHAR_BIT; } - } + } if (off + fld_bit_len > bit_len) - bit_len = off + fld_bit_len; + bit_len = off + fld_bit_len; off += fld_bit_len; TYPE_LENGTH (rtype) = - align_up (bit_len, TARGET_CHAR_BIT) / TARGET_CHAR_BIT; + align_up (bit_len, TARGET_CHAR_BIT) / TARGET_CHAR_BIT; } /* We handle the variant part, if any, at the end because of certain @@ -7954,31 +7954,31 @@ ada_template_to_fixed_record_type_1 (struct type *type, rtype = value_type (dval); } else - dval = dval0; + dval = dval0; branch_type = - to_fixed_variant_branch_type - (type->field (variant_field).type (), - cond_offset_host (valaddr, off / TARGET_CHAR_BIT), - cond_offset_target (address, off / TARGET_CHAR_BIT), dval); + to_fixed_variant_branch_type + (type->field (variant_field).type (), + cond_offset_host (valaddr, off / TARGET_CHAR_BIT), + cond_offset_target (address, off / TARGET_CHAR_BIT), dval); if (branch_type == NULL) - { - for (f = variant_field + 1; f < rtype->num_fields (); f += 1) - rtype->field (f - 1) = rtype->field (f); + { + for (f = variant_field + 1; f < rtype->num_fields (); f += 1) + rtype->field (f - 1) = rtype->field (f); rtype->set_num_fields (rtype->num_fields () - 1); - } + } else - { - rtype->field (variant_field).set_type (branch_type); - TYPE_FIELD_NAME (rtype, variant_field) = "S"; - fld_bit_len = - TYPE_LENGTH (rtype->field (variant_field).type ()) * - TARGET_CHAR_BIT; - if (off + fld_bit_len > bit_len) - bit_len = off + fld_bit_len; - TYPE_LENGTH (rtype) = - align_up (bit_len, TARGET_CHAR_BIT) / TARGET_CHAR_BIT; - } + { + rtype->field (variant_field).set_type (branch_type); + TYPE_FIELD_NAME (rtype, variant_field) = "S"; + fld_bit_len = + TYPE_LENGTH (rtype->field (variant_field).type ()) * + TARGET_CHAR_BIT; + if (off + fld_bit_len > bit_len) + bit_len = off + fld_bit_len; + TYPE_LENGTH (rtype) = + align_up (bit_len, TARGET_CHAR_BIT) / TARGET_CHAR_BIT; + } } /* According to exp_dbug.ads, the size of TYPE for variable-size records @@ -8013,10 +8013,10 @@ ada_template_to_fixed_record_type_1 (struct type *type, static struct type * template_to_fixed_record_type (struct type *type, const gdb_byte *valaddr, - CORE_ADDR address, struct value *dval0) + CORE_ADDR address, struct value *dval0) { return ada_template_to_fixed_record_type_1 (type, valaddr, - address, dval0, 1); + address, dval0, 1); } /* An ordinary record type in which ___XVL-convention fields and @@ -8059,10 +8059,10 @@ template_to_static_fixed_type (struct type *type0) if (is_dynamic_field (type0, f)) { field_type = ada_check_typedef (field_type); - new_type = to_static_fixed_type (TYPE_TARGET_TYPE (field_type)); + new_type = to_static_fixed_type (TYPE_TARGET_TYPE (field_type)); } else - new_type = static_unwrap_type (field_type); + new_type = static_unwrap_type (field_type); if (new_type != field_type) { @@ -8102,7 +8102,7 @@ template_to_static_fixed_type (struct type *type0) static struct type * to_record_with_fixed_variant_part (struct type *type, const gdb_byte *valaddr, - CORE_ADDR address, struct value *dval0) + CORE_ADDR address, struct value *dval0) { struct value *mark = value_mark (); struct value *dval; @@ -8139,17 +8139,17 @@ to_record_with_fixed_variant_part (struct type *type, const gdb_byte *valaddr, branch_type = to_fixed_variant_branch_type (type->field (variant_field).type (), cond_offset_host (valaddr, - TYPE_FIELD_BITPOS (type, variant_field) - / TARGET_CHAR_BIT), + TYPE_FIELD_BITPOS (type, variant_field) + / TARGET_CHAR_BIT), cond_offset_target (address, - TYPE_FIELD_BITPOS (type, variant_field) - / TARGET_CHAR_BIT), dval); + TYPE_FIELD_BITPOS (type, variant_field) + / TARGET_CHAR_BIT), dval); if (branch_type == NULL) { int f; for (f = variant_field + 1; f < nfields; f += 1) - rtype->field (f - 1) = rtype->field (f); + rtype->field (f - 1) = rtype->field (f); rtype->set_num_fields (rtype->num_fields () - 1); } else @@ -8185,7 +8185,7 @@ to_record_with_fixed_variant_part (struct type *type, const gdb_byte *valaddr, static struct type * to_fixed_record_type (struct type *type0, const gdb_byte *valaddr, - CORE_ADDR address, struct value *dval) + CORE_ADDR address, struct value *dval) { struct type *templ_type; @@ -8199,9 +8199,9 @@ to_fixed_record_type (struct type *type0, const gdb_byte *valaddr, else if (variant_field_index (type0) >= 0) { if (dval == NULL && valaddr == NULL && address == 0) - return type0; + return type0; return to_record_with_fixed_variant_part (type0, valaddr, address, - dval); + dval); } else { @@ -8221,7 +8221,7 @@ to_fixed_record_type (struct type *type0, const gdb_byte *valaddr, static struct type * to_fixed_variant_branch_type (struct type *var_type0, const gdb_byte *valaddr, - CORE_ADDR address, struct value *dval) + CORE_ADDR address, struct value *dval) { int which; struct type *templ_type; @@ -8337,7 +8337,7 @@ ada_is_redundant_index_type_desc (struct type *array_type, static struct type * to_fixed_array_type (struct type *type0, struct value *dval, - int ignore_too_big) + int ignore_too_big) { struct type *index_type_desc; struct type *result; @@ -8393,26 +8393,26 @@ to_fixed_array_type (struct type *type0, struct value *dval, struct type *elt_type0 = ada_check_typedef (TYPE_TARGET_TYPE (type0)); /* NOTE: elt_type---the fixed version of elt_type0---should never - depend on the contents of the array in properly constructed - debugging data. */ + depend on the contents of the array in properly constructed + debugging data. */ /* Create a fixed version of the array element type. - We're not providing the address of an element here, - and thus the actual object value cannot be inspected to do - the conversion. This should not be a problem, since arrays of - unconstrained objects are not allowed. In particular, all - the elements of an array of a tagged type should all be of - the same type specified in the debugging info. No need to - consult the object tag. */ + We're not providing the address of an element here, + and thus the actual object value cannot be inspected to do + the conversion. This should not be a problem, since arrays of + unconstrained objects are not allowed. In particular, all + the elements of an array of a tagged type should all be of + the same type specified in the debugging info. No need to + consult the object tag. */ struct type *elt_type = ada_to_fixed_type (elt_type0, 0, 0, dval, 1); /* Make sure we always create a new array type when dealing with packed array types, since we're going to fix-up the array type length and element bitsize a little further down. */ if (elt_type0 == elt_type && !constrained_packed_array_p) - result = type0; + result = type0; else - result = create_array_type (alloc_type_copy (type0), - elt_type, type0->index_type ()); + result = create_array_type (alloc_type_copy (type0), + elt_type, type0->index_type ()); } else { @@ -8421,34 +8421,34 @@ to_fixed_array_type (struct type *type0, struct value *dval, elt_type0 = type0; for (i = index_type_desc->num_fields (); i > 0; i -= 1) - elt_type0 = TYPE_TARGET_TYPE (elt_type0); + elt_type0 = TYPE_TARGET_TYPE (elt_type0); /* NOTE: result---the fixed version of elt_type0---should never - depend on the contents of the array in properly constructed - debugging data. */ + depend on the contents of the array in properly constructed + debugging data. */ /* Create a fixed version of the array element type. - We're not providing the address of an element here, - and thus the actual object value cannot be inspected to do - the conversion. This should not be a problem, since arrays of - unconstrained objects are not allowed. In particular, all - the elements of an array of a tagged type should all be of - the same type specified in the debugging info. No need to - consult the object tag. */ + We're not providing the address of an element here, + and thus the actual object value cannot be inspected to do + the conversion. This should not be a problem, since arrays of + unconstrained objects are not allowed. In particular, all + the elements of an array of a tagged type should all be of + the same type specified in the debugging info. No need to + consult the object tag. */ result = - ada_to_fixed_type (ada_check_typedef (elt_type0), 0, 0, dval, 1); + ada_to_fixed_type (ada_check_typedef (elt_type0), 0, 0, dval, 1); elt_type0 = type0; for (i = index_type_desc->num_fields () - 1; i >= 0; i -= 1) - { - struct type *range_type = - to_fixed_range_type (index_type_desc->field (i).type (), dval); + { + struct type *range_type = + to_fixed_range_type (index_type_desc->field (i).type (), dval); - result = create_array_type (alloc_type_copy (elt_type0), - result, range_type); + result = create_array_type (alloc_type_copy (elt_type0), + result, range_type); elt_type0 = TYPE_TARGET_TYPE (elt_type0); - } + } if (!ignore_too_big && TYPE_LENGTH (result) > varsize_limit) - error (_("array type with dynamic size is larger than varsize-limit")); + error (_("array type with dynamic size is larger than varsize-limit")); } /* We want to preserve the type name. This can be useful when @@ -8468,7 +8468,7 @@ to_fixed_array_type (struct type *type0, struct value *dval, TYPE_FIELD_BITSIZE (result, 0) = TYPE_FIELD_BITSIZE (type0, 0); TYPE_LENGTH (result) = len * elt_bitsize / HOST_CHAR_BIT; if (TYPE_LENGTH (result) * HOST_CHAR_BIT < len * elt_bitsize) - TYPE_LENGTH (result)++; + TYPE_LENGTH (result)++; } result->set_is_fixed_instance (true); @@ -8490,7 +8490,7 @@ to_fixed_array_type (struct type *type0, struct value *dval, static struct type * ada_to_fixed_type_1 (struct type *type, const gdb_byte *valaddr, - CORE_ADDR address, struct value *dval, int check_tag) + CORE_ADDR address, struct value *dval, int check_tag) { type = ada_check_typedef (type); @@ -8504,19 +8504,19 @@ ada_to_fixed_type_1 (struct type *type, const gdb_byte *valaddr, return type; case TYPE_CODE_STRUCT: { - struct type *static_type = to_static_fixed_type (type); - struct type *fixed_record_type = - to_fixed_record_type (type, valaddr, address, NULL); - - /* If STATIC_TYPE is a tagged type and we know the object's address, - then we can determine its tag, and compute the object's actual - type from there. Note that we have to use the fixed record - type (the parent part of the record may have dynamic fields - and the way the location of _tag is expressed may depend on - them). */ - - if (check_tag && address != 0 && ada_is_tagged_type (static_type, 0)) - { + struct type *static_type = to_static_fixed_type (type); + struct type *fixed_record_type = + to_fixed_record_type (type, valaddr, address, NULL); + + /* If STATIC_TYPE is a tagged type and we know the object's address, + then we can determine its tag, and compute the object's actual + type from there. Note that we have to use the fixed record + type (the parent part of the record may have dynamic fields + and the way the location of _tag is expressed may depend on + them). */ + + if (check_tag && address != 0 && ada_is_tagged_type (static_type, 0)) + { struct value *tag = value_tag_from_contents_and_address (fixed_record_type, @@ -8527,24 +8527,24 @@ ada_to_fixed_type_1 (struct type *type, const gdb_byte *valaddr, value_from_contents_and_address (fixed_record_type, valaddr, address); - fixed_record_type = value_type (obj); - if (real_type != NULL) - return to_fixed_record_type + fixed_record_type = value_type (obj); + if (real_type != NULL) + return to_fixed_record_type (real_type, NULL, value_address (ada_tag_value_at_base_address (obj)), NULL); - } - - /* Check to see if there is a parallel ___XVZ variable. - If there is, then it provides the actual size of our type. */ - else if (ada_type_name (fixed_record_type) != NULL) - { - const char *name = ada_type_name (fixed_record_type); - char *xvz_name + } + + /* Check to see if there is a parallel ___XVZ variable. + If there is, then it provides the actual size of our type. */ + else if (ada_type_name (fixed_record_type) != NULL) + { + const char *name = ada_type_name (fixed_record_type); + char *xvz_name = (char *) alloca (strlen (name) + 7 /* "___XVZ\0" */); bool xvz_found = false; - LONGEST size; + LONGEST size; - xsnprintf (xvz_name, strlen (name) + 7, "%s___XVZ", name); + xsnprintf (xvz_name, strlen (name) + 7, "%s___XVZ", name); try { xvz_found = get_int_var_value (xvz_name, size); @@ -8561,43 +8561,43 @@ ada_to_fixed_type_1 (struct type *type, const gdb_byte *valaddr, xvz_name, except.what ()); } - if (xvz_found && TYPE_LENGTH (fixed_record_type) != size) - { - fixed_record_type = copy_type (fixed_record_type); - TYPE_LENGTH (fixed_record_type) = size; - - /* The FIXED_RECORD_TYPE may have be a stub. We have - observed this when the debugging info is STABS, and - apparently it is something that is hard to fix. - - In practice, we don't need the actual type definition - at all, because the presence of the XVZ variable allows us - to assume that there must be a XVS type as well, which we - should be able to use later, when we need the actual type - definition. - - In the meantime, pretend that the "fixed" type we are - returning is NOT a stub, because this can cause trouble - when using this type to create new types targeting it. - Indeed, the associated creation routines often check - whether the target type is a stub and will try to replace - it, thus using a type with the wrong size. This, in turn, - might cause the new type to have the wrong size too. - Consider the case of an array, for instance, where the size - of the array is computed from the number of elements in - our array multiplied by the size of its element. */ + if (xvz_found && TYPE_LENGTH (fixed_record_type) != size) + { + fixed_record_type = copy_type (fixed_record_type); + TYPE_LENGTH (fixed_record_type) = size; + + /* The FIXED_RECORD_TYPE may have be a stub. We have + observed this when the debugging info is STABS, and + apparently it is something that is hard to fix. + + In practice, we don't need the actual type definition + at all, because the presence of the XVZ variable allows us + to assume that there must be a XVS type as well, which we + should be able to use later, when we need the actual type + definition. + + In the meantime, pretend that the "fixed" type we are + returning is NOT a stub, because this can cause trouble + when using this type to create new types targeting it. + Indeed, the associated creation routines often check + whether the target type is a stub and will try to replace + it, thus using a type with the wrong size. This, in turn, + might cause the new type to have the wrong size too. + Consider the case of an array, for instance, where the size + of the array is computed from the number of elements in + our array multiplied by the size of its element. */ fixed_record_type->set_is_stub (false); - } - } - return fixed_record_type; + } + } + return fixed_record_type; } case TYPE_CODE_ARRAY: return to_fixed_array_type (type, dval, 1); case TYPE_CODE_UNION: if (dval == NULL) - return type; + return type; else - return to_fixed_variant_branch_type (type, valaddr, address, dval); + return to_fixed_variant_branch_type (type, valaddr, address, dval); } } @@ -8623,7 +8623,7 @@ ada_to_fixed_type_1 (struct type *type, const gdb_byte *valaddr, struct type * ada_to_fixed_type (struct type *type, const gdb_byte *valaddr, - CORE_ADDR address, struct value *dval, int check_tag) + CORE_ADDR address, struct value *dval, int check_tag) { struct type *fixed_type = @@ -8677,15 +8677,15 @@ to_static_fixed_type (struct type *type0) case TYPE_CODE_STRUCT: type = dynamic_template_type (type0); if (type != NULL) - return template_to_static_fixed_type (type); + return template_to_static_fixed_type (type); else - return template_to_static_fixed_type (type0); + return template_to_static_fixed_type (type0); case TYPE_CODE_UNION: type = ada_find_parallel_type (type0, "___XVU"); if (type != NULL) - return template_to_static_fixed_type (type); + return template_to_static_fixed_type (type); else - return template_to_static_fixed_type (type0); + return template_to_static_fixed_type (type0); } } @@ -8707,9 +8707,9 @@ static_unwrap_type (struct type *type) struct type *raw_real_type = ada_get_base_type (type); if (raw_real_type == type) - return type; + return type; else - return to_static_fixed_type (raw_real_type); + return to_static_fixed_type (raw_real_type); } } @@ -8753,7 +8753,7 @@ ada_check_typedef (struct type *type) struct type *type1 = ada_find_any_type (name); if (type1 == NULL) - return type; + return type; /* TYPE1 might itself be a TYPE_CODE_TYPEDEF (this can happen with stubs pointing to arrays, as we don't create symbols for array @@ -8774,7 +8774,7 @@ ada_check_typedef (struct type *type) static struct value * ada_to_fixed_value_create (struct type *type0, CORE_ADDR address, - struct value *val0) + struct value *val0) { struct type *type = ada_to_fixed_type (type0, 0, address, NULL, 1); @@ -8871,7 +8871,7 @@ val_atr (struct type *type, LONGEST val) if (type->code () == TYPE_CODE_ENUM) { if (val < 0 || val >= type->num_fields ()) - error (_("argument to 'VAL out of range")); + error (_("argument to 'VAL out of range")); val = TYPE_FIELD_ENUMVAL (type, val); } return value_from_longest (type, val); @@ -8889,7 +8889,7 @@ value_val_atr (struct type *type, struct value *arg) } - /* Evaluation */ + /* Evaluation */ /* True if TYPE appears to be an Ada character type. [At the moment, this is true only for Character and Wide_Character; @@ -8909,12 +8909,12 @@ ada_is_character_type (struct type *type) with a known character type name. */ name = ada_type_name (type); return (name != NULL - && (type->code () == TYPE_CODE_INT - || type->code () == TYPE_CODE_RANGE) - && (strcmp (name, "character") == 0 - || strcmp (name, "wide_character") == 0 - || strcmp (name, "wide_wide_character") == 0 - || strcmp (name, "unsigned char") == 0)); + && (type->code () == TYPE_CODE_INT + || type->code () == TYPE_CODE_RANGE) + && (strcmp (name, "character") == 0 + || strcmp (name, "wide_character") == 0 + || strcmp (name, "wide_wide_character") == 0 + || strcmp (name, "unsigned char") == 0)); } /* True if TYPE appears to be an Ada string type. */ @@ -8926,7 +8926,7 @@ ada_is_string_type (struct type *type) if (type != NULL && type->code () != TYPE_CODE_PTR && (ada_is_simple_array_type (type) - || ada_is_array_descriptor_type (type)) + || ada_is_array_descriptor_type (type)) && ada_array_arity (type) == 1) { struct type *elttype = ada_array_element_type (type, 1); @@ -8961,8 +8961,8 @@ ada_is_aligner_type (struct type *type) return 0; return (type->code () == TYPE_CODE_STRUCT - && type->num_fields () == 1 - && strcmp (TYPE_FIELD_NAME (type, 0), "F") == 0); + && type->num_fields () == 1 + && strcmp (TYPE_FIELD_NAME (type, 0), "F") == 0); } /* If there is an ___XVS-convention type parallel to SUBTYPE, return @@ -9034,9 +9034,9 @@ ada_aligned_value_addr (struct type *type, const gdb_byte *valaddr) { if (ada_is_aligner_type (type)) return ada_aligned_value_addr (type->field (0).type (), - valaddr + - TYPE_FIELD_BITPOS (type, - 0) / TARGET_CHAR_BIT); + valaddr + + TYPE_FIELD_BITPOS (type, + 0) / TARGET_CHAR_BIT); else return valaddr; } @@ -9067,12 +9067,12 @@ ada_enum_name (const char *name) else { while ((tmp = strstr (name, "__")) != NULL) - { - if (isdigit (tmp[2])) - break; - else - name = tmp + 2; - } + { + if (isdigit (tmp[2])) + break; + else + name = tmp + 2; + } } if (name[0] == 'Q') @@ -9080,10 +9080,10 @@ ada_enum_name (const char *name) int v; if (name[1] == 'U' || name[1] == 'W') - { - if (sscanf (name + 2, "%x", &v) != 1) - return name; - } + { + if (sscanf (name + 2, "%x", &v) != 1) + return name; + } else if (((name[1] >= '0' && name[1] <= '9') || (name[1] >= 'a' && name[1] <= 'z')) && name[2] == '\0') @@ -9093,15 +9093,15 @@ ada_enum_name (const char *name) return result; } else - return name; + return name; GROW_VECT (result, result_len, 16); if (isascii (v) && isprint (v)) - xsnprintf (result, result_len, "'%c'", v); + xsnprintf (result, result_len, "'%c'", v); else if (name[1] == 'U') - xsnprintf (result, result_len, "[\"%02x\"]", v); + xsnprintf (result, result_len, "[\"%02x\"]", v); else - xsnprintf (result, result_len, "[\"%04x\"]", v); + xsnprintf (result, result_len, "[\"%04x\"]", v); return result; } @@ -9111,12 +9111,12 @@ ada_enum_name (const char *name) if (tmp == NULL) tmp = strstr (name, "$"); if (tmp != NULL) - { - GROW_VECT (result, result_len, tmp - name + 1); - strncpy (result, name, tmp - name); - result[tmp - name] = '\0'; - return result; - } + { + GROW_VECT (result, result_len, tmp - name + 1); + strncpy (result, name, tmp - name); + result[tmp - name] = '\0'; + return result; + } return name; } @@ -9153,7 +9153,7 @@ unwrap_value (struct value *val) else { struct type *raw_real_type = - ada_check_typedef (ada_get_base_type (type)); + ada_check_typedef (ada_get_base_type (type)); /* If there is no parallel XVS or XVE type, then the value is already unwrapped. Return it without further modification. */ @@ -9162,10 +9162,10 @@ unwrap_value (struct value *val) return val; return - coerce_unspec_val_to_type - (val, ada_to_fixed_type (raw_real_type, 0, - value_address (val), - NULL, 1)); + coerce_unspec_val_to_type + (val, ada_to_fixed_type (raw_real_type, 0, + value_address (val), + NULL, 1)); } } @@ -9300,8 +9300,8 @@ coerce_for_assign (struct type *type, struct value *val) } if (TYPE_LENGTH (TYPE_TARGET_TYPE (type2)) - != TYPE_LENGTH (TYPE_TARGET_TYPE (type))) - error (_("Incompatible types in assignment")); + != TYPE_LENGTH (TYPE_TARGET_TYPE (type))) + error (_("Incompatible types in assignment")); deprecated_set_value_type (val, type); } return val; @@ -9346,12 +9346,12 @@ ada_value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op) case BINOP_DIV: v = v1 / v2; if (!TRUNCATION_TOWARDS_ZERO && v1 * (v1 % v2) < 0) - v += v > 0 ? -1 : 1; + v += v > 0 ? -1 : 1; break; case BINOP_REM: v = v1 % v2; if (v * v1 < 0) - v -= v2; + v -= v2; break; default: /* Should not reach this point. */ @@ -9360,7 +9360,7 @@ ada_value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op) val = allocate_value (type1); store_unsigned_integer (value_contents_raw (val), - TYPE_LENGTH (value_type (val)), + TYPE_LENGTH (value_type (val)), type_byte_order (type1), v); return val; } @@ -9374,7 +9374,7 @@ ada_value_equal (struct value *arg1, struct value *arg2) struct type *arg1_type, *arg2_type; /* Automatically dereference any array reference before - we attempt to perform the comparison. */ + we attempt to perform the comparison. */ arg1 = ada_coerce_ref (arg1); arg2 = ada_coerce_ref (arg2); @@ -9385,11 +9385,11 @@ ada_value_equal (struct value *arg1, struct value *arg2) arg2_type = ada_check_typedef (value_type (arg2)); if (arg1_type->code () != TYPE_CODE_ARRAY - || arg2_type->code () != TYPE_CODE_ARRAY) - error (_("Attempt to compare array with non-array")); + || arg2_type->code () != TYPE_CODE_ARRAY) + error (_("Attempt to compare array with non-array")); /* FIXME: The following works only for types whose - representations use all bits (no padding or undefined bits) - and do not have user-defined equality. */ + representations use all bits (no padding or undefined bits) + and do not have user-defined equality. */ return (TYPE_LENGTH (arg1_type) == TYPE_LENGTH (arg2_type) && memcmp (value_contents (arg1), value_contents (arg2), TYPE_LENGTH (arg1_type)) == 0); @@ -9786,10 +9786,10 @@ ada_value_cast (struct type *type, struct value *arg2) known. Consider for instance a variant record: type Rec (Empty : Boolean := True) is record - case Empty is - when True => null; - when False => Value : Integer; - end case; + case Empty is + when True => null; + when False => Value : Integer; + end case; end record; Yes : Rec := (Empty => False, Value => 1); No : Rec := (empty => True); @@ -9806,15 +9806,15 @@ ada_value_cast (struct type *type, struct value *arg2) type would look like this: type Rec is record - Empty : Boolean; - Value : Integer; + Empty : Boolean; + Value : Integer; end record; On the other hand, if we printed the value of "No", its fixed type would become: type Rec is record - Empty : Boolean; + Empty : Boolean; end record; Things become a little more complicated when trying to fix an entity @@ -9854,11 +9854,11 @@ ada_value_cast (struct type *type, struct value *arg2) The simplest case is when we have an array of a constrained element type. For instance, consider the following type declarations: - type Bounded_String (Max_Size : Integer) is - Length : Integer; - Buffer : String (1 .. Max_Size); - end record; - type Bounded_String_Array is array (1 ..2) of Bounded_String (80); + type Bounded_String (Max_Size : Integer) is + Length : Integer; + Buffer : String (1 .. Max_Size); + end record; + type Bounded_String_Array is array (1 ..2) of Bounded_String (80); In this case, the compiler describes the array as an array of variable-size elements (identified by its XVS suffix) for which @@ -9877,19 +9877,19 @@ ada_value_cast (struct type *type, struct value *arg2) But there are cases when this size is not statically known. For instance, assuming that "Five" is an integer variable: - type Dynamic is array (1 .. Five) of Integer; - type Wrapper (Has_Length : Boolean := False) is record - Data : Dynamic; - case Has_Length is - when True => Length : Integer; - when False => null; - end case; - end record; - type Wrapper_Array is array (1 .. 2) of Wrapper; + type Dynamic is array (1 .. Five) of Integer; + type Wrapper (Has_Length : Boolean := False) is record + Data : Dynamic; + case Has_Length is + when True => Length : Integer; + when False => null; + end case; + end record; + type Wrapper_Array is array (1 .. 2) of Wrapper; - Hello : Wrapper_Array := (others => (Has_Length => True, - Data => (others => 17), - Length => 1)); + Hello : Wrapper_Array := (others => (Has_Length => True, + Data => (others => 17), + Length => 1)); The debugging info would describe variable Hello as being an @@ -9909,11 +9909,11 @@ ada_value_cast (struct type *type, struct value *arg2) Consider for instance the example: - type Bounded_String (Max_Size : Natural) is record - Str : String (1 .. Max_Size); - Length : Natural; - end record; - My_String : Bounded_String (Max_Size => 10); + type Bounded_String (Max_Size : Natural) is record + Str : String (1 .. Max_Size); + Length : Natural; + end record; + My_String : Bounded_String (Max_Size => 10); In that case, the position of field "Length" depends on the size of field Str, which itself depends on the value of the Max_Size @@ -9927,16 +9927,16 @@ ada_value_cast (struct type *type, struct value *arg2) (assuming type Rec above): type Container (Big : Boolean) is record - First : Rec; - After : Integer; - case Big is - when True => Another : Integer; - when False => null; - end case; + First : Rec; + After : Integer; + case Big is + when True => Another : Integer; + when False => null; + end case; end record; My_Container : Container := (Big => False, - First => (Empty => True), - After => 42); + First => (Empty => True), + After => 42); In that example, the compiler creates a PAD type for component First, whose size is constant, and then positions the component After just @@ -9961,14 +9961,14 @@ ada_value_cast (struct type *type, struct value *arg2) we might end up with the wrong size for our component. This can be observed with the following type declarations: - type Octal is new Integer range 0 .. 7; - type Octal_Array is array (Positive range <>) of Octal; - pragma Pack (Octal_Array); + type Octal is new Integer range 0 .. 7; + type Octal_Array is array (Positive range <>) of Octal; + pragma Pack (Octal_Array); - type Octal_Buffer (Size : Positive) is record - Buffer : Octal_Array (1 .. Size); - Length : Integer; - end record; + type Octal_Buffer (Size : Positive) is record + Buffer : Octal_Array (1 .. Size); + Length : Integer; + end record; In that case, Buffer is a PAD type whose size is unset and needs to be computed by fixing the unwrapped type. @@ -10015,32 +10015,32 @@ ada_evaluate_subexp_for_cast (expression *exp, int *pos, value *val; if (exp->elts[pc].opcode == OP_VAR_MSYM_VALUE) - { - if (noside == EVAL_AVOID_SIDE_EFFECTS) - return value_zero (to_type, not_lval); - - val = evaluate_var_msym_value (noside, - exp->elts[pc + 1].objfile, - exp->elts[pc + 2].msymbol); - } + { + if (noside == EVAL_AVOID_SIDE_EFFECTS) + return value_zero (to_type, not_lval); + + val = evaluate_var_msym_value (noside, + exp->elts[pc + 1].objfile, + exp->elts[pc + 2].msymbol); + } else - val = evaluate_var_value (noside, - exp->elts[pc + 1].block, - exp->elts[pc + 2].symbol); + val = evaluate_var_value (noside, + exp->elts[pc + 1].block, + exp->elts[pc + 2].symbol); if (noside == EVAL_SKIP) - return eval_skip_value (exp); + return eval_skip_value (exp); val = ada_value_cast (to_type, val); /* Follow the Ada language semantics that do not allow taking an address of the result of a cast (view conversion in Ada). */ if (VALUE_LVAL (val) == lval_memory) - { - if (value_lazy (val)) - value_fetch_lazy (val); - VALUE_LVAL (val) = not_lval; - } + { + if (value_lazy (val)) + value_fetch_lazy (val); + VALUE_LVAL (val) = not_lval; + } return val; } @@ -10055,7 +10055,7 @@ ada_evaluate_subexp_for_cast (expression *exp, int *pos, static struct value * ada_evaluate_subexp (struct type *expect_type, struct expression *exp, - int *pos, enum noside noside) + int *pos, enum noside noside) { enum exp_opcode op; int tem; @@ -10080,29 +10080,29 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, arg1 = unwrap_value (arg1); /* If evaluating an OP_FLOAT and an EXPECT_TYPE was provided, - then we need to perform the conversion manually, because - evaluate_subexp_standard doesn't do it. This conversion is - necessary in Ada because the different kinds of float/fixed - types in Ada have different representations. + then we need to perform the conversion manually, because + evaluate_subexp_standard doesn't do it. This conversion is + necessary in Ada because the different kinds of float/fixed + types in Ada have different representations. - Similarly, we need to perform the conversion from OP_LONG - ourselves. */ + Similarly, we need to perform the conversion from OP_LONG + ourselves. */ if ((op == OP_FLOAT || op == OP_LONG) && expect_type != NULL) - arg1 = ada_value_cast (expect_type, arg1); + arg1 = ada_value_cast (expect_type, arg1); return arg1; case OP_STRING: { - struct value *result; - - *pos -= 1; - result = evaluate_subexp_standard (expect_type, exp, pos, noside); - /* The result type will have code OP_STRING, bashed there from - OP_ARRAY. Bash it back. */ - if (value_type (result)->code () == TYPE_CODE_STRING) - value_type (result)->set_code (TYPE_CODE_ARRAY); - return result; + struct value *result; + + *pos -= 1; + result = evaluate_subexp_standard (expect_type, exp, pos, noside); + /* The result type will have code OP_STRING, bashed there from + OP_ARRAY. Bash it back. */ + if (value_type (result)->code () == TYPE_CODE_STRING) + value_type (result)->set_code (TYPE_CODE_ARRAY); + return result; } case UNOP_CAST: @@ -10125,51 +10125,51 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, return ada_value_assign (arg1, arg1); } /* Force the evaluation of the rhs ARG2 to the type of the lhs ARG1, - except if the lhs of our assignment is a convenience variable. - In the case of assigning to a convenience variable, the lhs - should be exactly the result of the evaluation of the rhs. */ + except if the lhs of our assignment is a convenience variable. + In the case of assigning to a convenience variable, the lhs + should be exactly the result of the evaluation of the rhs. */ type = value_type (arg1); if (VALUE_LVAL (arg1) == lval_internalvar) - type = NULL; + type = NULL; arg2 = evaluate_subexp (type, exp, pos, noside); if (noside == EVAL_SKIP || noside == EVAL_AVOID_SIDE_EFFECTS) - return arg1; + return arg1; if (VALUE_LVAL (arg1) == lval_internalvar) { /* Nothing. */ } else if (ada_is_gnat_encoded_fixed_point_type (value_type (arg1))) - arg2 = cast_to_gnat_encoded_fixed_point_type (value_type (arg1), arg2); + arg2 = cast_to_gnat_encoded_fixed_point_type (value_type (arg1), arg2); else if (ada_is_gnat_encoded_fixed_point_type (value_type (arg2))) - error - (_("Fixed-point values must be assigned to fixed-point variables")); + error + (_("Fixed-point values must be assigned to fixed-point variables")); else - arg2 = coerce_for_assign (value_type (arg1), arg2); + arg2 = coerce_for_assign (value_type (arg1), arg2); return ada_value_assign (arg1, arg2); case BINOP_ADD: arg1 = evaluate_subexp_with_coercion (exp, pos, noside); arg2 = evaluate_subexp_with_coercion (exp, pos, noside); if (noside == EVAL_SKIP) - goto nosideret; + goto nosideret; if (value_type (arg1)->code () == TYPE_CODE_PTR) - return (value_from_longest - (value_type (arg1), - value_as_long (arg1) + value_as_long (arg2))); + return (value_from_longest + (value_type (arg1), + value_as_long (arg1) + value_as_long (arg2))); if (value_type (arg2)->code () == TYPE_CODE_PTR) - return (value_from_longest - (value_type (arg2), - value_as_long (arg1) + value_as_long (arg2))); + return (value_from_longest + (value_type (arg2), + value_as_long (arg1) + value_as_long (arg2))); if ((ada_is_gnat_encoded_fixed_point_type (value_type (arg1)) - || ada_is_gnat_encoded_fixed_point_type (value_type (arg2))) - && value_type (arg1) != value_type (arg2)) - error (_("Operands of fixed-point addition must have the same type")); + || ada_is_gnat_encoded_fixed_point_type (value_type (arg2))) + && value_type (arg1) != value_type (arg2)) + error (_("Operands of fixed-point addition must have the same type")); /* Do the addition, and cast the result to the type of the first - argument. We cannot cast the result to a reference type, so if - ARG1 is a reference type, find its underlying type. */ + argument. We cannot cast the result to a reference type, so if + ARG1 is a reference type, find its underlying type. */ type = value_type (arg1); while (type->code () == TYPE_CODE_REF) - type = TYPE_TARGET_TYPE (type); + type = TYPE_TARGET_TYPE (type); binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2); return value_cast (type, value_binop (arg1, arg2, BINOP_ADD)); @@ -10177,26 +10177,26 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, arg1 = evaluate_subexp_with_coercion (exp, pos, noside); arg2 = evaluate_subexp_with_coercion (exp, pos, noside); if (noside == EVAL_SKIP) - goto nosideret; + goto nosideret; if (value_type (arg1)->code () == TYPE_CODE_PTR) - return (value_from_longest - (value_type (arg1), - value_as_long (arg1) - value_as_long (arg2))); + return (value_from_longest + (value_type (arg1), + value_as_long (arg1) - value_as_long (arg2))); if (value_type (arg2)->code () == TYPE_CODE_PTR) - return (value_from_longest - (value_type (arg2), - value_as_long (arg1) - value_as_long (arg2))); + return (value_from_longest + (value_type (arg2), + value_as_long (arg1) - value_as_long (arg2))); if ((ada_is_gnat_encoded_fixed_point_type (value_type (arg1)) - || ada_is_gnat_encoded_fixed_point_type (value_type (arg2))) - && value_type (arg1) != value_type (arg2)) - error (_("Operands of fixed-point subtraction " + || ada_is_gnat_encoded_fixed_point_type (value_type (arg2))) + && value_type (arg1) != value_type (arg2)) + error (_("Operands of fixed-point subtraction " "must have the same type")); /* Do the substraction, and cast the result to the type of the first - argument. We cannot cast the result to a reference type, so if - ARG1 is a reference type, find its underlying type. */ + argument. We cannot cast the result to a reference type, so if + ARG1 is a reference type, find its underlying type. */ type = value_type (arg1); while (type->code () == TYPE_CODE_REF) - type = TYPE_TARGET_TYPE (type); + type = TYPE_TARGET_TYPE (type); binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2); return value_cast (type, value_binop (arg1, arg2, BINOP_SUB)); @@ -10207,47 +10207,47 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, arg1 = evaluate_subexp (nullptr, exp, pos, noside); arg2 = evaluate_subexp (nullptr, exp, pos, noside); if (noside == EVAL_SKIP) - goto nosideret; + goto nosideret; else if (noside == EVAL_AVOID_SIDE_EFFECTS) - { - binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2); - return value_zero (value_type (arg1), not_lval); - } + { + binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2); + return value_zero (value_type (arg1), not_lval); + } else - { - type = builtin_type (exp->gdbarch)->builtin_double; - if (ada_is_gnat_encoded_fixed_point_type (value_type (arg1))) - arg1 = cast_from_gnat_encoded_fixed_point_type (type, arg1); - if (ada_is_gnat_encoded_fixed_point_type (value_type (arg2))) - arg2 = cast_from_gnat_encoded_fixed_point_type (type, arg2); - binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2); - return ada_value_binop (arg1, arg2, op); - } + { + type = builtin_type (exp->gdbarch)->builtin_double; + if (ada_is_gnat_encoded_fixed_point_type (value_type (arg1))) + arg1 = cast_from_gnat_encoded_fixed_point_type (type, arg1); + if (ada_is_gnat_encoded_fixed_point_type (value_type (arg2))) + arg2 = cast_from_gnat_encoded_fixed_point_type (type, arg2); + binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2); + return ada_value_binop (arg1, arg2, op); + } case BINOP_EQUAL: case BINOP_NOTEQUAL: arg1 = evaluate_subexp (nullptr, exp, pos, noside); arg2 = evaluate_subexp (value_type (arg1), exp, pos, noside); if (noside == EVAL_SKIP) - goto nosideret; + goto nosideret; if (noside == EVAL_AVOID_SIDE_EFFECTS) - tem = 0; + tem = 0; else { binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2); tem = ada_value_equal (arg1, arg2); } if (op == BINOP_NOTEQUAL) - tem = !tem; + tem = !tem; type = language_bool_type (exp->language_defn, exp->gdbarch); return value_from_longest (type, (LONGEST) tem); case UNOP_NEG: arg1 = evaluate_subexp (nullptr, exp, pos, noside); if (noside == EVAL_SKIP) - goto nosideret; + goto nosideret; else if (ada_is_gnat_encoded_fixed_point_type (value_type (arg1))) - return value_cast (value_type (arg1), value_neg (arg1)); + return value_cast (value_type (arg1), value_neg (arg1)); else { unop_promote (exp->language_defn, exp->gdbarch, &arg1); @@ -10258,54 +10258,54 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, case BINOP_LOGICAL_OR: case UNOP_LOGICAL_NOT: { - struct value *val; + struct value *val; - *pos -= 1; - val = evaluate_subexp_standard (expect_type, exp, pos, noside); + *pos -= 1; + val = evaluate_subexp_standard (expect_type, exp, pos, noside); type = language_bool_type (exp->language_defn, exp->gdbarch); - return value_cast (type, val); + return value_cast (type, val); } case BINOP_BITWISE_AND: case BINOP_BITWISE_IOR: case BINOP_BITWISE_XOR: { - struct value *val; + struct value *val; arg1 = evaluate_subexp (nullptr, exp, pos, EVAL_AVOID_SIDE_EFFECTS); *pos = pc; - val = evaluate_subexp_standard (expect_type, exp, pos, noside); + val = evaluate_subexp_standard (expect_type, exp, pos, noside); - return value_cast (value_type (arg1), val); + return value_cast (value_type (arg1), val); } case OP_VAR_VALUE: *pos -= 1; if (noside == EVAL_SKIP) - { - *pos += 4; - goto nosideret; - } + { + *pos += 4; + goto nosideret; + } if (SYMBOL_DOMAIN (exp->elts[pc + 2].symbol) == UNDEF_DOMAIN) - /* Only encountered when an unresolved symbol occurs in a - context other than a function call, in which case, it is - invalid. */ - error (_("Unexpected unresolved symbol, %s, during evaluation"), - exp->elts[pc + 2].symbol->print_name ()); + /* Only encountered when an unresolved symbol occurs in a + context other than a function call, in which case, it is + invalid. */ + error (_("Unexpected unresolved symbol, %s, during evaluation"), + exp->elts[pc + 2].symbol->print_name ()); if (noside == EVAL_AVOID_SIDE_EFFECTS) - { - type = static_unwrap_type (SYMBOL_TYPE (exp->elts[pc + 2].symbol)); - /* Check to see if this is a tagged type. We also need to handle - the case where the type is a reference to a tagged type, but - we have to be careful to exclude pointers to tagged types. - The latter should be shown as usual (as a pointer), whereas - a reference should mostly be transparent to the user. */ - if (ada_is_tagged_type (type, 0) - || (type->code () == TYPE_CODE_REF - && ada_is_tagged_type (TYPE_TARGET_TYPE (type), 0))) + { + type = static_unwrap_type (SYMBOL_TYPE (exp->elts[pc + 2].symbol)); + /* Check to see if this is a tagged type. We also need to handle + the case where the type is a reference to a tagged type, but + we have to be careful to exclude pointers to tagged types. + The latter should be shown as usual (as a pointer), whereas + a reference should mostly be transparent to the user. */ + if (ada_is_tagged_type (type, 0) + || (type->code () == TYPE_CODE_REF + && ada_is_tagged_type (TYPE_TARGET_TYPE (type), 0))) { /* Tagged types are a little special in the fact that the real type is dynamic and can only be determined by inspecting the @@ -10367,7 +10367,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, *pos += 4; return value_zero (to_static_fixed_type (type), not_lval); } - } + } arg1 = evaluate_subexp_standard (expect_type, exp, pos, noside); return ada_to_fixed_value (arg1); @@ -10376,33 +10376,33 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, (*pos) += 2; /* Allocate arg vector, including space for the function to be - called in argvec[0] and a terminating NULL. */ + called in argvec[0] and a terminating NULL. */ nargs = longest_to_int (exp->elts[pc + 1].longconst); argvec = XALLOCAVEC (struct value *, nargs + 2); if (exp->elts[*pos].opcode == OP_VAR_VALUE - && SYMBOL_DOMAIN (exp->elts[pc + 5].symbol) == UNDEF_DOMAIN) - error (_("Unexpected unresolved symbol, %s, during evaluation"), - exp->elts[pc + 5].symbol->print_name ()); + && SYMBOL_DOMAIN (exp->elts[pc + 5].symbol) == UNDEF_DOMAIN) + error (_("Unexpected unresolved symbol, %s, during evaluation"), + exp->elts[pc + 5].symbol->print_name ()); else - { - for (tem = 0; tem <= nargs; tem += 1) + { + for (tem = 0; tem <= nargs; tem += 1) argvec[tem] = evaluate_subexp (nullptr, exp, pos, noside); argvec[tem] = 0; - if (noside == EVAL_SKIP) - goto nosideret; - } + if (noside == EVAL_SKIP) + goto nosideret; + } if (ada_is_constrained_packed_array_type (desc_base_type (value_type (argvec[0])))) - argvec[0] = ada_coerce_to_simple_array (argvec[0]); + argvec[0] = ada_coerce_to_simple_array (argvec[0]); else if (value_type (argvec[0])->code () == TYPE_CODE_ARRAY - && TYPE_FIELD_BITSIZE (value_type (argvec[0]), 0) != 0) - /* This is a packed array that has already been fixed, and + && TYPE_FIELD_BITSIZE (value_type (argvec[0]), 0) != 0) + /* This is a packed array that has already been fixed, and therefore already coerced to a simple array. Nothing further to do. */ - ; + ; else if (value_type (argvec[0])->code () == TYPE_CODE_REF) { /* Make sure we dereference references so that all the code below @@ -10424,30 +10424,30 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, type = ada_typedef_target_type (type); if (type->code () == TYPE_CODE_PTR) - { - switch (ada_check_typedef (TYPE_TARGET_TYPE (type))->code ()) - { - case TYPE_CODE_FUNC: - type = ada_check_typedef (TYPE_TARGET_TYPE (type)); - break; - case TYPE_CODE_ARRAY: - break; - case TYPE_CODE_STRUCT: - if (noside != EVAL_AVOID_SIDE_EFFECTS) - argvec[0] = ada_value_ind (argvec[0]); - type = ada_check_typedef (TYPE_TARGET_TYPE (type)); - break; - default: - error (_("cannot subscript or call something of type `%s'"), - ada_type_name (value_type (argvec[0]))); - break; - } - } + { + switch (ada_check_typedef (TYPE_TARGET_TYPE (type))->code ()) + { + case TYPE_CODE_FUNC: + type = ada_check_typedef (TYPE_TARGET_TYPE (type)); + break; + case TYPE_CODE_ARRAY: + break; + case TYPE_CODE_STRUCT: + if (noside != EVAL_AVOID_SIDE_EFFECTS) + argvec[0] = ada_value_ind (argvec[0]); + type = ada_check_typedef (TYPE_TARGET_TYPE (type)); + break; + default: + error (_("cannot subscript or call something of type `%s'"), + ada_type_name (value_type (argvec[0]))); + break; + } + } switch (type->code ()) - { - case TYPE_CODE_FUNC: - if (noside == EVAL_AVOID_SIDE_EFFECTS) + { + case TYPE_CODE_FUNC: + if (noside == EVAL_AVOID_SIDE_EFFECTS) { if (TYPE_TARGET_TYPE (type) == NULL) error_call_unknown_return_type (NULL); @@ -10467,53 +10467,53 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, return call_internal_function (exp->gdbarch, exp->language_defn, argvec[0], nargs, argvec + 1); - case TYPE_CODE_STRUCT: - { - int arity; - - arity = ada_array_arity (type); - type = ada_array_element_type (type, nargs); - if (type == NULL) - error (_("cannot subscript or call a record")); - if (arity != nargs) - error (_("wrong number of subscripts; expecting %d"), arity); - if (noside == EVAL_AVOID_SIDE_EFFECTS) - return value_zero (ada_aligned_type (type), lval_memory); - return - unwrap_value (ada_value_subscript - (argvec[0], nargs, argvec + 1)); - } - case TYPE_CODE_ARRAY: - if (noside == EVAL_AVOID_SIDE_EFFECTS) - { - type = ada_array_element_type (type, nargs); - if (type == NULL) - error (_("element type of array unknown")); - else - return value_zero (ada_aligned_type (type), lval_memory); - } - return - unwrap_value (ada_value_subscript - (ada_coerce_to_simple_array (argvec[0]), - nargs, argvec + 1)); - case TYPE_CODE_PTR: /* Pointer to array */ - if (noside == EVAL_AVOID_SIDE_EFFECTS) - { + case TYPE_CODE_STRUCT: + { + int arity; + + arity = ada_array_arity (type); + type = ada_array_element_type (type, nargs); + if (type == NULL) + error (_("cannot subscript or call a record")); + if (arity != nargs) + error (_("wrong number of subscripts; expecting %d"), arity); + if (noside == EVAL_AVOID_SIDE_EFFECTS) + return value_zero (ada_aligned_type (type), lval_memory); + return + unwrap_value (ada_value_subscript + (argvec[0], nargs, argvec + 1)); + } + case TYPE_CODE_ARRAY: + if (noside == EVAL_AVOID_SIDE_EFFECTS) + { + type = ada_array_element_type (type, nargs); + if (type == NULL) + error (_("element type of array unknown")); + else + return value_zero (ada_aligned_type (type), lval_memory); + } + return + unwrap_value (ada_value_subscript + (ada_coerce_to_simple_array (argvec[0]), + nargs, argvec + 1)); + case TYPE_CODE_PTR: /* Pointer to array */ + if (noside == EVAL_AVOID_SIDE_EFFECTS) + { type = to_fixed_array_type (TYPE_TARGET_TYPE (type), NULL, 1); - type = ada_array_element_type (type, nargs); - if (type == NULL) - error (_("element type of array unknown")); - else - return value_zero (ada_aligned_type (type), lval_memory); - } - return - unwrap_value (ada_value_ptr_subscript (argvec[0], + type = ada_array_element_type (type, nargs); + if (type == NULL) + error (_("element type of array unknown")); + else + return value_zero (ada_aligned_type (type), lval_memory); + } + return + unwrap_value (ada_value_ptr_subscript (argvec[0], nargs, argvec + 1)); - default: - error (_("Attempt to index or call something other than an " + default: + error (_("Attempt to index or call something other than an " "array or function")); - } + } case TERNOP_SLICE: { @@ -10523,78 +10523,78 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, struct value *high_bound_val = evaluate_subexp (nullptr, exp, pos, noside); LONGEST low_bound; - LONGEST high_bound; - - low_bound_val = coerce_ref (low_bound_val); - high_bound_val = coerce_ref (high_bound_val); - low_bound = value_as_long (low_bound_val); - high_bound = value_as_long (high_bound_val); - - if (noside == EVAL_SKIP) - goto nosideret; - - /* If this is a reference to an aligner type, then remove all - the aligners. */ - if (value_type (array)->code () == TYPE_CODE_REF - && ada_is_aligner_type (TYPE_TARGET_TYPE (value_type (array)))) - TYPE_TARGET_TYPE (value_type (array)) = - ada_aligned_type (TYPE_TARGET_TYPE (value_type (array))); - - if (ada_is_constrained_packed_array_type (value_type (array))) - error (_("cannot slice a packed array")); - - /* If this is a reference to an array or an array lvalue, - convert to a pointer. */ - if (value_type (array)->code () == TYPE_CODE_REF - || (value_type (array)->code () == TYPE_CODE_ARRAY - && VALUE_LVAL (array) == lval_memory)) - array = value_addr (array); - - if (noside == EVAL_AVOID_SIDE_EFFECTS - && ada_is_array_descriptor_type (ada_check_typedef - (value_type (array)))) - return empty_array (ada_type_of_array (array, 0), low_bound, + LONGEST high_bound; + + low_bound_val = coerce_ref (low_bound_val); + high_bound_val = coerce_ref (high_bound_val); + low_bound = value_as_long (low_bound_val); + high_bound = value_as_long (high_bound_val); + + if (noside == EVAL_SKIP) + goto nosideret; + + /* If this is a reference to an aligner type, then remove all + the aligners. */ + if (value_type (array)->code () == TYPE_CODE_REF + && ada_is_aligner_type (TYPE_TARGET_TYPE (value_type (array)))) + TYPE_TARGET_TYPE (value_type (array)) = + ada_aligned_type (TYPE_TARGET_TYPE (value_type (array))); + + if (ada_is_constrained_packed_array_type (value_type (array))) + error (_("cannot slice a packed array")); + + /* If this is a reference to an array or an array lvalue, + convert to a pointer. */ + if (value_type (array)->code () == TYPE_CODE_REF + || (value_type (array)->code () == TYPE_CODE_ARRAY + && VALUE_LVAL (array) == lval_memory)) + array = value_addr (array); + + if (noside == EVAL_AVOID_SIDE_EFFECTS + && ada_is_array_descriptor_type (ada_check_typedef + (value_type (array)))) + return empty_array (ada_type_of_array (array, 0), low_bound, high_bound); - array = ada_coerce_to_simple_array_ptr (array); - - /* If we have more than one level of pointer indirection, - dereference the value until we get only one level. */ - while (value_type (array)->code () == TYPE_CODE_PTR - && (TYPE_TARGET_TYPE (value_type (array))->code () - == TYPE_CODE_PTR)) - array = value_ind (array); - - /* Make sure we really do have an array type before going further, - to avoid a SEGV when trying to get the index type or the target - type later down the road if the debug info generated by - the compiler is incorrect or incomplete. */ - if (!ada_is_simple_array_type (value_type (array))) - error (_("cannot take slice of non-array")); - - if (ada_check_typedef (value_type (array))->code () - == TYPE_CODE_PTR) - { - struct type *type0 = ada_check_typedef (value_type (array)); - - if (high_bound < low_bound || noside == EVAL_AVOID_SIDE_EFFECTS) - return empty_array (TYPE_TARGET_TYPE (type0), low_bound, high_bound); - else - { - struct type *arr_type0 = - to_fixed_array_type (TYPE_TARGET_TYPE (type0), NULL, 1); - - return ada_value_slice_from_ptr (array, arr_type0, - longest_to_int (low_bound), - longest_to_int (high_bound)); - } - } - else if (noside == EVAL_AVOID_SIDE_EFFECTS) - return array; - else if (high_bound < low_bound) - return empty_array (value_type (array), low_bound, high_bound); - else - return ada_value_slice (array, longest_to_int (low_bound), + array = ada_coerce_to_simple_array_ptr (array); + + /* If we have more than one level of pointer indirection, + dereference the value until we get only one level. */ + while (value_type (array)->code () == TYPE_CODE_PTR + && (TYPE_TARGET_TYPE (value_type (array))->code () + == TYPE_CODE_PTR)) + array = value_ind (array); + + /* Make sure we really do have an array type before going further, + to avoid a SEGV when trying to get the index type or the target + type later down the road if the debug info generated by + the compiler is incorrect or incomplete. */ + if (!ada_is_simple_array_type (value_type (array))) + error (_("cannot take slice of non-array")); + + if (ada_check_typedef (value_type (array))->code () + == TYPE_CODE_PTR) + { + struct type *type0 = ada_check_typedef (value_type (array)); + + if (high_bound < low_bound || noside == EVAL_AVOID_SIDE_EFFECTS) + return empty_array (TYPE_TARGET_TYPE (type0), low_bound, high_bound); + else + { + struct type *arr_type0 = + to_fixed_array_type (TYPE_TARGET_TYPE (type0), NULL, 1); + + return ada_value_slice_from_ptr (array, arr_type0, + longest_to_int (low_bound), + longest_to_int (high_bound)); + } + } + else if (noside == EVAL_AVOID_SIDE_EFFECTS) + return array; + else if (high_bound < low_bound) + return empty_array (value_type (array), low_bound, high_bound); + else + return ada_value_slice (array, longest_to_int (low_bound), longest_to_int (high_bound)); } @@ -10604,17 +10604,17 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, type = check_typedef (exp->elts[pc + 1].type); if (noside == EVAL_SKIP) - goto nosideret; + goto nosideret; switch (type->code ()) - { - default: - lim_warning (_("Membership test incompletely implemented; " + { + default: + lim_warning (_("Membership test incompletely implemented; " "always returns true")); type = language_bool_type (exp->language_defn, exp->gdbarch); return value_from_longest (type, (LONGEST) 1); - case TYPE_CODE_RANGE: + case TYPE_CODE_RANGE: arg2 = value_from_longest (type, type->bounds ()->low.const_val ()); arg3 = value_from_longest (type, @@ -10624,11 +10624,11 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, type = language_bool_type (exp->language_defn, exp->gdbarch); return value_from_longest (type, - (value_less (arg1, arg3) - || value_equal (arg1, arg3)) - && (value_less (arg2, arg1) - || value_equal (arg2, arg1))); - } + (value_less (arg1, arg3) + || value_equal (arg1, arg3)) + && (value_less (arg2, arg1) + || value_equal (arg2, arg1))); + } case BINOP_IN_BOUNDS: (*pos) += 2; @@ -10636,7 +10636,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, arg2 = evaluate_subexp (nullptr, exp, pos, noside); if (noside == EVAL_SKIP) - goto nosideret; + goto nosideret; if (noside == EVAL_AVOID_SIDE_EFFECTS) { @@ -10657,11 +10657,11 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg3); type = language_bool_type (exp->language_defn, exp->gdbarch); return - value_from_longest (type, - (value_less (arg1, arg3) - || value_equal (arg1, arg3)) - && (value_less (arg2, arg1) - || value_equal (arg2, arg1))); + value_from_longest (type, + (value_less (arg1, arg3) + || value_equal (arg1, arg3)) + && (value_less (arg2, arg1) + || value_equal (arg2, arg1))); case TERNOP_IN_RANGE: arg1 = evaluate_subexp (nullptr, exp, pos, noside); @@ -10669,49 +10669,49 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, arg3 = evaluate_subexp (nullptr, exp, pos, noside); if (noside == EVAL_SKIP) - goto nosideret; + goto nosideret; binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2); binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg3); type = language_bool_type (exp->language_defn, exp->gdbarch); return - value_from_longest (type, - (value_less (arg1, arg3) - || value_equal (arg1, arg3)) - && (value_less (arg2, arg1) - || value_equal (arg2, arg1))); + value_from_longest (type, + (value_less (arg1, arg3) + || value_equal (arg1, arg3)) + && (value_less (arg2, arg1) + || value_equal (arg2, arg1))); case OP_ATR_FIRST: case OP_ATR_LAST: case OP_ATR_LENGTH: { - struct type *type_arg; + struct type *type_arg; - if (exp->elts[*pos].opcode == OP_TYPE) - { + if (exp->elts[*pos].opcode == OP_TYPE) + { evaluate_subexp (nullptr, exp, pos, EVAL_SKIP); arg1 = NULL; - type_arg = check_typedef (exp->elts[pc + 2].type); - } - else - { + type_arg = check_typedef (exp->elts[pc + 2].type); + } + else + { arg1 = evaluate_subexp (nullptr, exp, pos, noside); type_arg = NULL; - } + } - if (exp->elts[*pos].opcode != OP_LONG) - error (_("Invalid operand to '%s"), ada_attribute_name (op)); - tem = longest_to_int (exp->elts[*pos + 2].longconst); - *pos += 4; + if (exp->elts[*pos].opcode != OP_LONG) + error (_("Invalid operand to '%s"), ada_attribute_name (op)); + tem = longest_to_int (exp->elts[*pos + 2].longconst); + *pos += 4; - if (noside == EVAL_SKIP) - goto nosideret; + if (noside == EVAL_SKIP) + goto nosideret; else if (noside == EVAL_AVOID_SIDE_EFFECTS) { if (type_arg == NULL) type_arg = value_type (arg1); - if (ada_is_constrained_packed_array_type (type_arg)) + if (ada_is_constrained_packed_array_type (type_arg)) type_arg = decode_constrained_packed_array_type (type_arg); if (!discrete_type_p (type_arg)) @@ -10733,14 +10733,14 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, return value_zero (type_arg, not_lval); } - else if (type_arg == NULL) - { - arg1 = ada_coerce_ref (arg1); + else if (type_arg == NULL) + { + arg1 = ada_coerce_ref (arg1); - if (ada_is_constrained_packed_array_type (value_type (arg1))) - arg1 = ada_coerce_to_simple_array (arg1); + if (ada_is_constrained_packed_array_type (value_type (arg1))) + arg1 = ada_coerce_to_simple_array (arg1); - if (op == OP_ATR_LENGTH) + if (op == OP_ATR_LENGTH) type = builtin_type (exp->gdbarch)->builtin_int; else { @@ -10750,53 +10750,53 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, type = builtin_type (exp->gdbarch)->builtin_int; } - switch (op) - { - default: /* Should never happen. */ - error (_("unexpected attribute encountered")); - case OP_ATR_FIRST: - return value_from_longest + switch (op) + { + default: /* Should never happen. */ + error (_("unexpected attribute encountered")); + case OP_ATR_FIRST: + return value_from_longest (type, ada_array_bound (arg1, tem, 0)); - case OP_ATR_LAST: - return value_from_longest + case OP_ATR_LAST: + return value_from_longest (type, ada_array_bound (arg1, tem, 1)); - case OP_ATR_LENGTH: - return value_from_longest + case OP_ATR_LENGTH: + return value_from_longest (type, ada_array_length (arg1, tem)); - } - } - else if (discrete_type_p (type_arg)) - { - struct type *range_type; - const char *name = ada_type_name (type_arg); - - range_type = NULL; - if (name != NULL && type_arg->code () != TYPE_CODE_ENUM) - range_type = to_fixed_range_type (type_arg, NULL); - if (range_type == NULL) - range_type = type_arg; - switch (op) - { - default: - error (_("unexpected attribute encountered")); - case OP_ATR_FIRST: + } + } + else if (discrete_type_p (type_arg)) + { + struct type *range_type; + const char *name = ada_type_name (type_arg); + + range_type = NULL; + if (name != NULL && type_arg->code () != TYPE_CODE_ENUM) + range_type = to_fixed_range_type (type_arg, NULL); + if (range_type == NULL) + range_type = type_arg; + switch (op) + { + default: + error (_("unexpected attribute encountered")); + case OP_ATR_FIRST: return value_from_longest (range_type, ada_discrete_type_low_bound (range_type)); - case OP_ATR_LAST: - return value_from_longest + case OP_ATR_LAST: + return value_from_longest (range_type, ada_discrete_type_high_bound (range_type)); - case OP_ATR_LENGTH: - error (_("the 'length attribute applies only to array types")); - } - } - else if (type_arg->code () == TYPE_CODE_FLT) - error (_("unimplemented type attribute")); - else - { - LONGEST low, high; - - if (ada_is_constrained_packed_array_type (type_arg)) - type_arg = decode_constrained_packed_array_type (type_arg); + case OP_ATR_LENGTH: + error (_("the 'length attribute applies only to array types")); + } + } + else if (type_arg->code () == TYPE_CODE_FLT) + error (_("unimplemented type attribute")); + else + { + LONGEST low, high; + + if (ada_is_constrained_packed_array_type (type_arg)) + type_arg = decode_constrained_packed_array_type (type_arg); if (op == OP_ATR_LENGTH) type = builtin_type (exp->gdbarch)->builtin_int; @@ -10807,31 +10807,31 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, type = builtin_type (exp->gdbarch)->builtin_int; } - switch (op) - { - default: - error (_("unexpected attribute encountered")); - case OP_ATR_FIRST: - low = ada_array_bound_from_type (type_arg, tem, 0); - return value_from_longest (type, low); - case OP_ATR_LAST: - high = ada_array_bound_from_type (type_arg, tem, 1); - return value_from_longest (type, high); - case OP_ATR_LENGTH: - low = ada_array_bound_from_type (type_arg, tem, 0); - high = ada_array_bound_from_type (type_arg, tem, 1); - return value_from_longest (type, high - low + 1); - } - } + switch (op) + { + default: + error (_("unexpected attribute encountered")); + case OP_ATR_FIRST: + low = ada_array_bound_from_type (type_arg, tem, 0); + return value_from_longest (type, low); + case OP_ATR_LAST: + high = ada_array_bound_from_type (type_arg, tem, 1); + return value_from_longest (type, high); + case OP_ATR_LENGTH: + low = ada_array_bound_from_type (type_arg, tem, 0); + high = ada_array_bound_from_type (type_arg, tem, 1); + return value_from_longest (type, high - low + 1); + } + } } case OP_ATR_TAG: arg1 = evaluate_subexp (nullptr, exp, pos, noside); if (noside == EVAL_SKIP) - goto nosideret; + goto nosideret; if (noside == EVAL_AVOID_SIDE_EFFECTS) - return value_zero (ada_tag_type (arg1), not_lval); + return value_zero (ada_tag_type (arg1), not_lval); return ada_value_tag (arg1); @@ -10841,9 +10841,9 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, arg1 = evaluate_subexp (nullptr, exp, pos, noside); arg2 = evaluate_subexp (nullptr, exp, pos, noside); if (noside == EVAL_SKIP) - goto nosideret; + goto nosideret; else if (noside == EVAL_AVOID_SIDE_EFFECTS) - return value_zero (value_type (arg1), not_lval); + return value_zero (value_type (arg1), not_lval); else { binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2); @@ -10853,17 +10853,17 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, case OP_ATR_MODULUS: { - struct type *type_arg = check_typedef (exp->elts[pc + 2].type); + struct type *type_arg = check_typedef (exp->elts[pc + 2].type); evaluate_subexp (nullptr, exp, pos, EVAL_SKIP); if (noside == EVAL_SKIP) - goto nosideret; + goto nosideret; - if (!ada_is_modular_type (type_arg)) - error (_("'modulus must be applied to modular type")); + if (!ada_is_modular_type (type_arg)) + error (_("'modulus must be applied to modular type")); - return value_from_longest (TYPE_TARGET_TYPE (type_arg), - ada_modulus (type_arg)); + return value_from_longest (TYPE_TARGET_TYPE (type_arg), + ada_modulus (type_arg)); } @@ -10871,7 +10871,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, evaluate_subexp (nullptr, exp, pos, EVAL_SKIP); arg1 = evaluate_subexp (nullptr, exp, pos, noside); if (noside == EVAL_SKIP) - goto nosideret; + goto nosideret; type = builtin_type (exp->gdbarch)->builtin_int; if (noside == EVAL_AVOID_SIDE_EFFECTS) return value_zero (type, not_lval); @@ -10883,37 +10883,37 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, type = value_type (arg1); /* If the argument is a reference, then dereference its type, since - the user is really asking for the size of the actual object, - not the size of the pointer. */ + the user is really asking for the size of the actual object, + not the size of the pointer. */ if (type->code () == TYPE_CODE_REF) - type = TYPE_TARGET_TYPE (type); + type = TYPE_TARGET_TYPE (type); if (noside == EVAL_SKIP) - goto nosideret; + goto nosideret; else if (noside == EVAL_AVOID_SIDE_EFFECTS) - return value_zero (builtin_type (exp->gdbarch)->builtin_int, not_lval); + return value_zero (builtin_type (exp->gdbarch)->builtin_int, not_lval); else - return value_from_longest (builtin_type (exp->gdbarch)->builtin_int, - TARGET_CHAR_BIT * TYPE_LENGTH (type)); + return value_from_longest (builtin_type (exp->gdbarch)->builtin_int, + TARGET_CHAR_BIT * TYPE_LENGTH (type)); case OP_ATR_VAL: evaluate_subexp (nullptr, exp, pos, EVAL_SKIP); arg1 = evaluate_subexp (nullptr, exp, pos, noside); type = exp->elts[pc + 2].type; if (noside == EVAL_SKIP) - goto nosideret; + goto nosideret; else if (noside == EVAL_AVOID_SIDE_EFFECTS) - return value_zero (type, not_lval); + return value_zero (type, not_lval); else - return value_val_atr (type, arg1); + return value_val_atr (type, arg1); case BINOP_EXP: arg1 = evaluate_subexp (nullptr, exp, pos, noside); arg2 = evaluate_subexp (nullptr, exp, pos, noside); if (noside == EVAL_SKIP) - goto nosideret; + goto nosideret; else if (noside == EVAL_AVOID_SIDE_EFFECTS) - return value_zero (value_type (arg1), not_lval); + return value_zero (value_type (arg1), not_lval); else { /* For integer exponentiation operations, @@ -10929,46 +10929,46 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, case UNOP_PLUS: arg1 = evaluate_subexp (nullptr, exp, pos, noside); if (noside == EVAL_SKIP) - goto nosideret; + goto nosideret; else - return arg1; + return arg1; case UNOP_ABS: arg1 = evaluate_subexp (nullptr, exp, pos, noside); if (noside == EVAL_SKIP) - goto nosideret; + goto nosideret; unop_promote (exp->language_defn, exp->gdbarch, &arg1); if (value_less (arg1, value_zero (value_type (arg1), not_lval))) - return value_neg (arg1); + return value_neg (arg1); else - return arg1; + return arg1; case UNOP_IND: preeval_pos = *pos; arg1 = evaluate_subexp (nullptr, exp, pos, noside); if (noside == EVAL_SKIP) - goto nosideret; + goto nosideret; type = ada_check_typedef (value_type (arg1)); if (noside == EVAL_AVOID_SIDE_EFFECTS) - { - if (ada_is_array_descriptor_type (type)) - /* GDB allows dereferencing GNAT array descriptors. */ - { - struct type *arrType = ada_type_of_array (arg1, 0); - - if (arrType == NULL) - error (_("Attempt to dereference null array pointer.")); - return value_at_lazy (arrType, 0); - } - else if (type->code () == TYPE_CODE_PTR - || type->code () == TYPE_CODE_REF - /* In C you can dereference an array to get the 1st elt. */ - || type->code () == TYPE_CODE_ARRAY) - { - /* As mentioned in the OP_VAR_VALUE case, tagged types can - only be determined by inspecting the object's tag. - This means that we need to evaluate completely the - expression in order to get its type. */ + { + if (ada_is_array_descriptor_type (type)) + /* GDB allows dereferencing GNAT array descriptors. */ + { + struct type *arrType = ada_type_of_array (arg1, 0); + + if (arrType == NULL) + error (_("Attempt to dereference null array pointer.")); + return value_at_lazy (arrType, 0); + } + else if (type->code () == TYPE_CODE_PTR + || type->code () == TYPE_CODE_REF + /* In C you can dereference an array to get the 1st elt. */ + || type->code () == TYPE_CODE_ARRAY) + { + /* As mentioned in the OP_VAR_VALUE case, tagged types can + only be determined by inspecting the object's tag. + This means that we need to evaluate completely the + expression in order to get its type. */ if ((type->code () == TYPE_CODE_REF || type->code () == TYPE_CODE_PTR) @@ -10985,9 +10985,9 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, (ada_check_typedef (TYPE_TARGET_TYPE (type)))); } ada_ensure_varsize_limit (type); - return value_zero (type, lval_memory); - } - else if (type->code () == TYPE_CODE_INT) + return value_zero (type, lval_memory); + } + else if (type->code () == TYPE_CODE_INT) { /* GDB allows dereferencing an int. */ if (expect_type == NULL) @@ -11000,30 +11000,30 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, return value_zero (expect_type, lval_memory); } } - else - error (_("Attempt to take contents of a non-pointer value.")); - } + else + error (_("Attempt to take contents of a non-pointer value.")); + } arg1 = ada_coerce_ref (arg1); /* FIXME: What is this for?? */ type = ada_check_typedef (value_type (arg1)); if (type->code () == TYPE_CODE_INT) - /* GDB allows dereferencing an int. If we were given - the expect_type, then use that as the target type. - Otherwise, assume that the target type is an int. */ - { - if (expect_type != NULL) + /* GDB allows dereferencing an int. If we were given + the expect_type, then use that as the target type. + Otherwise, assume that the target type is an int. */ + { + if (expect_type != NULL) return ada_value_ind (value_cast (lookup_pointer_type (expect_type), arg1)); else return value_at_lazy (builtin_type (exp->gdbarch)->builtin_int, (CORE_ADDR) value_as_address (arg1)); - } + } if (ada_is_array_descriptor_type (type)) - /* GDB allows dereferencing GNAT array descriptors. */ - return ada_coerce_to_simple_array (arg1); + /* GDB allows dereferencing GNAT array descriptors. */ + return ada_coerce_to_simple_array (arg1); else - return ada_value_ind (arg1); + return ada_value_ind (arg1); case STRUCTOP_STRUCT: tem = longest_to_int (exp->elts[pc + 1].longconst); @@ -11031,22 +11031,22 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, preeval_pos = *pos; arg1 = evaluate_subexp (nullptr, exp, pos, noside); if (noside == EVAL_SKIP) - goto nosideret; + goto nosideret; if (noside == EVAL_AVOID_SIDE_EFFECTS) - { - struct type *type1 = value_type (arg1); + { + struct type *type1 = value_type (arg1); - if (ada_is_tagged_type (type1, 1)) - { - type = ada_lookup_struct_elt_type (type1, - &exp->elts[pc + 2].string, - 1, 1); + if (ada_is_tagged_type (type1, 1)) + { + type = ada_lookup_struct_elt_type (type1, + &exp->elts[pc + 2].string, + 1, 1); /* If the field is not found, check if it exists in the extension of this object's type. This means that we need to evaluate completely the expression. */ - if (type == NULL) + if (type == NULL) { arg1 = evaluate_subexp (nullptr, exp, &preeval_pos, EVAL_NORMAL); @@ -11056,14 +11056,14 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, arg1 = unwrap_value (arg1); type = value_type (ada_to_fixed_value (arg1)); } - } - else - type = - ada_lookup_struct_elt_type (type1, &exp->elts[pc + 2].string, 1, - 0); - - return value_zero (ada_aligned_type (type), lval_memory); - } + } + else + type = + ada_lookup_struct_elt_type (type1, &exp->elts[pc + 2].string, 1, + 0); + + return value_zero (ada_aligned_type (type), lval_memory); + } else { arg1 = ada_value_struct_elt (arg1, &exp->elts[pc + 2].string, 0); @@ -11073,14 +11073,14 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, case OP_TYPE: /* The value is not supposed to be used. This is here to make it - easier to accommodate expressions that contain types. */ + easier to accommodate expressions that contain types. */ (*pos) += 2; if (noside == EVAL_SKIP) - goto nosideret; + goto nosideret; else if (noside == EVAL_AVOID_SIDE_EFFECTS) - return allocate_value (exp->elts[pc + 1].type); + return allocate_value (exp->elts[pc + 1].type); else - error (_("Attempt to use a type name as an expression")); + error (_("Attempt to use a type name as an expression")); case OP_AGGREGATE: case OP_CHOICES: @@ -11113,7 +11113,7 @@ nosideret: } - /* Fixed point */ + /* Fixed point */ /* If TYPE encodes an Ada fixed-point type, return the suffix of the type name that encodes the 'small and 'delta information. @@ -11130,9 +11130,9 @@ gnat_encoded_fixed_point_type_info (struct type *type) const char *tail = strstr (name, "___XF_"); if (tail == NULL) - return NULL; + return NULL; else - return tail + 5; + return tail + 5; } else if (code == TYPE_CODE_RANGE && TYPE_TARGET_TYPE (type) != type) return gnat_encoded_fixed_point_type_info (TYPE_TARGET_TYPE (type)); @@ -11212,7 +11212,7 @@ gnat_encoded_fixed_point_scaling_factor (struct type *type) - /* Range types */ + /* Range types */ /* Scan STR beginning at position K for a discriminant name, and return the value of that discriminant field of DVAL in *PX. If @@ -11222,7 +11222,7 @@ gnat_encoded_fixed_point_scaling_factor (struct type *type) static int scan_discrim_bound (const char *str, int k, struct value *dval, LONGEST * px, - int *pnew_k) + int *pnew_k) { static char *bound_buffer = NULL; static size_t bound_buffer_len = 0; @@ -11279,9 +11279,9 @@ get_var_value (const char *name, const char *err_msg) if (nsyms != 1) { if (err_msg == NULL) - return 0; + return 0; else - error (("%s"), err_msg); + error (("%s"), err_msg); } return value_of_variable (syms[0].symbol, syms[0].block); @@ -11360,47 +11360,47 @@ to_fixed_range_type (struct type *raw_type, struct value *dval) n = 1; if (*subtype_info == 'L') - { - if (!ada_scan_number (bounds_str, n, &L, &n) - && !scan_discrim_bound (bounds_str, n, dval, &L, &n)) - return raw_type; - if (bounds_str[n] == '_') - n += 2; - else if (bounds_str[n] == '.') /* FIXME? SGI Workshop kludge. */ - n += 1; - subtype_info += 1; - } + { + if (!ada_scan_number (bounds_str, n, &L, &n) + && !scan_discrim_bound (bounds_str, n, dval, &L, &n)) + return raw_type; + if (bounds_str[n] == '_') + n += 2; + else if (bounds_str[n] == '.') /* FIXME? SGI Workshop kludge. */ + n += 1; + subtype_info += 1; + } else - { - strcpy (name_buf + prefix_len, "___L"); - if (!get_int_var_value (name_buf, L)) - { - lim_warning (_("Unknown lower bound, using 1.")); - L = 1; - } - } + { + strcpy (name_buf + prefix_len, "___L"); + if (!get_int_var_value (name_buf, L)) + { + lim_warning (_("Unknown lower bound, using 1.")); + L = 1; + } + } if (*subtype_info == 'U') - { - if (!ada_scan_number (bounds_str, n, &U, &n) - && !scan_discrim_bound (bounds_str, n, dval, &U, &n)) - return raw_type; - } + { + if (!ada_scan_number (bounds_str, n, &U, &n) + && !scan_discrim_bound (bounds_str, n, dval, &U, &n)) + return raw_type; + } else - { - strcpy (name_buf + prefix_len, "___U"); - if (!get_int_var_value (name_buf, U)) - { - lim_warning (_("Unknown upper bound, using %ld."), (long) L); - U = L; - } - } + { + strcpy (name_buf + prefix_len, "___U"); + if (!get_int_var_value (name_buf, U)) + { + lim_warning (_("Unknown upper bound, using %ld."), (long) L); + U = L; + } + } type = create_static_range_type (alloc_type_copy (raw_type), base_type, L, U); /* create_static_range_type alters the resulting type's length - to match the size of the base_type, which is not what we want. - Set it back to the original range type's length. */ + to match the size of the base_type, which is not what we want. + Set it back to the original range type's length. */ TYPE_LENGTH (type) = TYPE_LENGTH (raw_type); type->set_name (name); return type; @@ -11416,7 +11416,7 @@ ada_is_range_type_name (const char *name) } - /* Modular types */ + /* Modular types */ /* True iff TYPE is an Ada modular type. */ @@ -11426,8 +11426,8 @@ ada_is_modular_type (struct type *type) struct type *subranged_type = get_base_type (type); return (subranged_type != NULL && type->code () == TYPE_CODE_RANGE - && subranged_type->code () == TYPE_CODE_INT - && subranged_type->is_unsigned ()); + && subranged_type->code () == TYPE_CODE_INT + && subranged_type->is_unsigned ()); } /* Assuming ada_is_modular_type (TYPE), the modulus of TYPE. */ @@ -11745,10 +11745,10 @@ is_known_support_routine (struct frame_info *frame) { re_comp (known_runtime_file_name_patterns[i]); if (re_exec (lbasename (sal.symtab->filename))) - return 1; + return 1; if (SYMTAB_OBJFILE (sal.symtab) != NULL - && re_exec (objfile_name (SYMTAB_OBJFILE (sal.symtab)))) - return 1; + && re_exec (objfile_name (SYMTAB_OBJFILE (sal.symtab)))) + return 1; } /* Check whether the function is a GNAT-generated entity. */ @@ -11777,10 +11777,10 @@ ada_find_printable_frame (struct frame_info *fi) for (; fi != NULL; fi = get_prev_frame (fi)) { if (!is_known_support_routine (fi)) - { - select_frame (fi); - break; - } + { + select_frame (fi); + break; + } } } @@ -11826,7 +11826,7 @@ ada_unhandled_exception_name_addr_from_raise (void) = find_frame_funname (fi, &func_lang, NULL); if (func_name != NULL) { - if (strcmp (func_name.get (), + if (strcmp (func_name.get (), data->exception_info->catch_exception_sym) == 0) break; /* We found the frame we were looking for... */ } @@ -11850,32 +11850,32 @@ ada_unhandled_exception_name_addr_from_raise (void) static CORE_ADDR ada_exception_name_addr_1 (enum ada_exception_catchpoint_kind ex, - struct breakpoint *b) + struct breakpoint *b) { struct ada_inferior_data *data = get_ada_inferior_data (current_inferior ()); switch (ex) { case ada_catch_exception: - return (parse_and_eval_address ("e.full_name")); - break; + return (parse_and_eval_address ("e.full_name")); + break; case ada_catch_exception_unhandled: - return data->exception_info->unhandled_exception_name_addr (); - break; + return data->exception_info->unhandled_exception_name_addr (); + break; case ada_catch_handlers: - return 0; /* The runtimes does not provide access to the exception + return 0; /* The runtimes does not provide access to the exception name. */ - break; + break; case ada_catch_assert: - return 0; /* Exception name is not relevant in this case. */ - break; + return 0; /* Exception name is not relevant in this case. */ + break; default: - internal_error (__FILE__, __LINE__, _("unexpected catchpoint type")); - break; + internal_error (__FILE__, __LINE__, _("unexpected catchpoint type")); + break; } return 0; /* Should never be reached. */ @@ -11949,7 +11949,7 @@ ada_exception_message (void) static CORE_ADDR ada_exception_name_addr (enum ada_exception_catchpoint_kind ex, - struct breakpoint *b) + struct breakpoint *b) { CORE_ADDR result = 0; @@ -12021,7 +12021,7 @@ struct ada_catchpoint : public breakpoint static void create_excep_cond_exprs (struct ada_catchpoint *c, - enum ada_exception_catchpoint_kind ex) + enum ada_exception_catchpoint_kind ex) { struct bp_location *bl; @@ -12278,40 +12278,40 @@ print_one_exception (struct breakpoint *b, struct bp_location **last_loc) switch (c->m_kind) { case ada_catch_exception: - if (!c->excep_string.empty ()) - { + if (!c->excep_string.empty ()) + { std::string msg = string_printf (_("`%s' Ada exception"), c->excep_string.c_str ()); - uiout->field_string ("what", msg); - } - else - uiout->field_string ("what", "all Ada exceptions"); - - break; + uiout->field_string ("what", msg); + } + else + uiout->field_string ("what", "all Ada exceptions"); + + break; case ada_catch_exception_unhandled: - uiout->field_string ("what", "unhandled Ada exceptions"); - break; + uiout->field_string ("what", "unhandled Ada exceptions"); + break; case ada_catch_handlers: - if (!c->excep_string.empty ()) - { + if (!c->excep_string.empty ()) + { uiout->field_fmt ("what", _("`%s' Ada exception handlers"), c->excep_string.c_str ()); - } - else + } + else uiout->field_string ("what", "all Ada exceptions handlers"); - break; + break; case ada_catch_assert: - uiout->field_string ("what", "failed Ada assertions"); - break; + uiout->field_string ("what", "failed Ada assertions"); + break; default: - internal_error (__FILE__, __LINE__, _("unexpected catchpoint type")); - break; + internal_error (__FILE__, __LINE__, _("unexpected catchpoint type")); + break; } } @@ -12325,46 +12325,46 @@ print_mention_exception (struct breakpoint *b) struct ui_out *uiout = current_uiout; uiout->text (b->disposition == disp_del ? _("Temporary catchpoint ") - : _("Catchpoint ")); + : _("Catchpoint ")); uiout->field_signed ("bkptno", b->number); uiout->text (": "); switch (c->m_kind) { case ada_catch_exception: - if (!c->excep_string.empty ()) + if (!c->excep_string.empty ()) { std::string info = string_printf (_("`%s' Ada exception"), c->excep_string.c_str ()); uiout->text (info.c_str ()); } - else - uiout->text (_("all Ada exceptions")); - break; + else + uiout->text (_("all Ada exceptions")); + break; case ada_catch_exception_unhandled: - uiout->text (_("unhandled Ada exceptions")); - break; + uiout->text (_("unhandled Ada exceptions")); + break; case ada_catch_handlers: - if (!c->excep_string.empty ()) + if (!c->excep_string.empty ()) { std::string info = string_printf (_("`%s' Ada exception handlers"), c->excep_string.c_str ()); uiout->text (info.c_str ()); } - else - uiout->text (_("all Ada exceptions handlers")); - break; + else + uiout->text (_("all Ada exceptions handlers")); + break; case ada_catch_assert: - uiout->text (_("failed Ada assertions")); - break; + uiout->text (_("failed Ada assertions")); + break; default: - internal_error (__FILE__, __LINE__, _("unexpected catchpoint type")); - break; + internal_error (__FILE__, __LINE__, _("unexpected catchpoint type")); + break; } } @@ -12432,7 +12432,7 @@ is_ada_exception_catchpoint (breakpoint *bp) static void catch_ada_exception_command_split (const char *args, bool is_catch_handlers_cmd, - enum ada_exception_catchpoint_kind *ex, + enum ada_exception_catchpoint_kind *ex, std::string *excep_string, std::string *cond_string) { @@ -12458,7 +12458,7 @@ catch_ada_exception_command_split (const char *args, args = skip_spaces (args); if (args[0] == '\0') - error (_("Condition missing after `if' keyword")); + error (_("Condition missing after `if' keyword")); *cond_string = args; args += strlen (args); @@ -12509,20 +12509,20 @@ ada_exception_sym_name (enum ada_exception_catchpoint_kind ex) switch (ex) { case ada_catch_exception: - return (data->exception_info->catch_exception_sym); - break; + return (data->exception_info->catch_exception_sym); + break; case ada_catch_exception_unhandled: - return (data->exception_info->catch_exception_unhandled_sym); - break; + return (data->exception_info->catch_exception_unhandled_sym); + break; case ada_catch_assert: - return (data->exception_info->catch_assert_sym); - break; + return (data->exception_info->catch_assert_sym); + break; case ada_catch_handlers: - return (data->exception_info->catch_handlers_sym); - break; + return (data->exception_info->catch_handlers_sym); + break; default: - internal_error (__FILE__, __LINE__, - _("unexpected catchpoint kind (%d)"), ex); + internal_error (__FILE__, __LINE__, + _("unexpected catchpoint kind (%d)"), ex); } } @@ -12535,20 +12535,20 @@ ada_exception_breakpoint_ops (enum ada_exception_catchpoint_kind ex) switch (ex) { case ada_catch_exception: - return (&catch_exception_breakpoint_ops); - break; + return (&catch_exception_breakpoint_ops); + break; case ada_catch_exception_unhandled: - return (&catch_exception_unhandled_breakpoint_ops); - break; + return (&catch_exception_unhandled_breakpoint_ops); + break; case ada_catch_assert: - return (&catch_assert_breakpoint_ops); - break; + return (&catch_assert_breakpoint_ops); + break; case ada_catch_handlers: - return (&catch_handlers_breakpoint_ops); - break; + return (&catch_handlers_breakpoint_ops); + break; default: - internal_error (__FILE__, __LINE__, - _("unexpected catchpoint kind (%d)"), ex); + internal_error (__FILE__, __LINE__, + _("unexpected catchpoint kind (%d)"), ex); } } @@ -12560,7 +12560,7 @@ ada_exception_breakpoint_ops (enum ada_exception_catchpoint_kind ex) static std::string ada_exception_catchpoint_cond_string (const char *excep_string, - enum ada_exception_catchpoint_kind ex) + enum ada_exception_catchpoint_kind ex) { int i; bool is_standard_exc = false; @@ -12569,7 +12569,7 @@ ada_exception_catchpoint_cond_string (const char *excep_string, if (ex == ada_catch_handlers) { /* For exception handlers catchpoints, the condition string does - not use the same parameter as for the other exceptions. */ + not use the same parameter as for the other exceptions. */ result = ("long_integer (GNAT_GCC_exception_Access" "(gcc_exception).all.occurrence.id)"); } @@ -12774,7 +12774,7 @@ catch_ada_assert_command_split (const char *args, std::string &cond_string) args += 2; args = skip_spaces (args); if (args[0] == '\0') - error (_("condition missing after `if' keyword")); + error (_("condition missing after `if' keyword")); cond_string.assign (args); } @@ -12814,10 +12814,10 @@ ada_is_exception_sym (struct symbol *sym) const char *type_name = SYMBOL_TYPE (sym)->name (); return (SYMBOL_CLASS (sym) != LOC_TYPEDEF - && SYMBOL_CLASS (sym) != LOC_BLOCK - && SYMBOL_CLASS (sym) != LOC_CONST - && SYMBOL_CLASS (sym) != LOC_UNRESOLVED - && type_name != NULL && strcmp (type_name, "exception") == 0); + && SYMBOL_CLASS (sym) != LOC_BLOCK + && SYMBOL_CLASS (sym) != LOC_CONST + && SYMBOL_CLASS (sym) != LOC_UNRESOLVED + && type_name != NULL && strcmp (type_name, "exception") == 0); } /* Given a global symbol SYM, return non-zero iff SYM is a non-standard @@ -13120,7 +13120,7 @@ info_exceptions_command (const char *regexp, int from_tty) printf_filtered ("%s: %s\n", info.name, paddress (gdbarch, info.addr)); } - /* Operators */ + /* Operators */ /* Information about operators given special treatment in functions below. */ /* Format: OP_DEFN (<operator>, <operator length>, <# args>, <binop>). */ @@ -13230,7 +13230,7 @@ ada_op_name (enum exp_opcode opcode) static void ada_forward_operator_length (struct expression *exp, int pc, - int *oplenp, int *argsp) + int *oplenp, int *argsp) { switch (exp->elts[pc].opcode) { @@ -13339,7 +13339,7 @@ ada_dump_subexp_body (struct expression *exp, struct ui_file *stream, int elt) static void ada_print_subexp (struct expression *exp, int *pos, - struct ui_file *stream, enum precedence prec) + struct ui_file *stream, enum precedence prec) { int oplen, nargs, i; int pc = *pos; @@ -13366,13 +13366,13 @@ ada_print_subexp (struct expression *exp, int *pos, print_subexp (exp, pos, stream, PREC_SUFFIX); fputs_filtered ("'range", stream); if (exp->elts[pc + 1].longconst > 1) - fprintf_filtered (stream, "(%ld)", - (long) exp->elts[pc + 1].longconst); + fprintf_filtered (stream, "(%ld)", + (long) exp->elts[pc + 1].longconst); return; case TERNOP_IN_RANGE: if (prec >= PREC_EQUAL) - fputs_filtered ("(", stream); + fputs_filtered ("(", stream); /* XXX: sprint_subexp */ print_subexp (exp, pos, stream, PREC_SUFFIX); fputs_filtered (" in ", stream); @@ -13380,7 +13380,7 @@ ada_print_subexp (struct expression *exp, int *pos, fputs_filtered (" .. ", stream); print_subexp (exp, pos, stream, PREC_EQUAL); if (prec >= PREC_EQUAL) - fputs_filtered (")", stream); + fputs_filtered (")", stream); return; case OP_ATR_FIRST: @@ -13395,26 +13395,26 @@ ada_print_subexp (struct expression *exp, int *pos, case OP_ATR_TAG: case OP_ATR_VAL: if (exp->elts[*pos].opcode == OP_TYPE) - { - if (exp->elts[*pos + 1].type->code () != TYPE_CODE_VOID) - LA_PRINT_TYPE (exp->elts[*pos + 1].type, "", stream, 0, 0, + { + if (exp->elts[*pos + 1].type->code () != TYPE_CODE_VOID) + LA_PRINT_TYPE (exp->elts[*pos + 1].type, "", stream, 0, 0, &type_print_raw_options); - *pos += 3; - } + *pos += 3; + } else - print_subexp (exp, pos, stream, PREC_SUFFIX); + print_subexp (exp, pos, stream, PREC_SUFFIX); fprintf_filtered (stream, "'%s", ada_attribute_name (op)); if (nargs > 1) - { - int tem; - - for (tem = 1; tem < nargs; tem += 1) - { - fputs_filtered ((tem == 1) ? " (" : ", ", stream); - print_subexp (exp, pos, stream, PREC_ABOVE_COMMA); - } - fputs_filtered (")", stream); - } + { + int tem; + + for (tem = 1; tem < nargs; tem += 1) + { + fputs_filtered ((tem == 1) ? " (" : ", ", stream); + print_subexp (exp, pos, stream, PREC_ABOVE_COMMA); + } + fputs_filtered (")", stream); + } return; case UNOP_QUAL: @@ -14286,10 +14286,10 @@ _initialize_ada_language () &show_ada_list, "show ada ", 0, &showlist); add_setshow_boolean_cmd ("trust-PAD-over-XVS", class_obscure, - &trust_pad_over_xvs, _("\ + &trust_pad_over_xvs, _("\ Enable or disable an optimization trusting PAD types over XVS types."), _("\ Show whether an optimization trusting PAD types over XVS types is activated."), - _("\ + _("\ This is related to the encoding used by the GNAT compiler. The debugger\n\ should normally trust the contents of PAD types, but certain older versions\n\ of GNAT have a bug that sometimes causes the information in the PAD type\n\ @@ -14297,7 +14297,7 @@ to be incorrect. Turning this setting \"off\" allows the debugger to\n\ work around this bug. It is always safe to turn this option \"off\", but\n\ this incurs a slight performance penalty, so it is recommended to NOT change\n\ this option to \"off\" unless necessary."), - NULL, NULL, &set_ada_list, &show_ada_list); + NULL, NULL, &set_ada_list, &show_ada_list); add_setshow_boolean_cmd ("print-signatures", class_vars, &print_signatures, _("\ @@ -14331,7 +14331,7 @@ With an argument, catch only exceptions with the given name.\n\ CONDITION is a boolean expression that is evaluated to see whether the\n\ exception should cause a stop."), catch_ada_handlers_command, - catch_ada_completer, + catch_ada_completer, CATCH_PERMANENT, CATCH_TEMPORARY); add_catch_command ("assert", _("\ @@ -14340,7 +14340,7 @@ Usage: catch assert [if CONDITION]\n\ CONDITION is a boolean expression that is evaluated to see whether the\n\ exception should cause a stop."), catch_assert_command, - NULL, + NULL, CATCH_PERMANENT, CATCH_TEMPORARY); |