static void ada_add_block_symbols (struct obstack *,
struct block *, const char *,
- domain_enum, struct objfile *,
- struct symtab *, int);
+ domain_enum, struct objfile *, int);
static int is_nonfunction (struct ada_symbol_info *, int);
static void add_defn_to_vec (struct obstack *, struct symbol *,
- struct block *, struct symtab *);
+ struct block *);
static int num_defns_collected (struct obstack *);
}
/* The largest value in the domain of TYPE, a discrete type, as an integer. */
-static struct value *
+static LONGEST
discrete_type_high_bound (struct type *type)
{
switch (TYPE_CODE (type))
{
case TYPE_CODE_RANGE:
- return value_from_longest (TYPE_TARGET_TYPE (type),
- TYPE_HIGH_BOUND (type));
+ return TYPE_HIGH_BOUND (type);
case TYPE_CODE_ENUM:
- return
- value_from_longest (type,
- TYPE_FIELD_BITPOS (type,
- TYPE_NFIELDS (type) - 1));
+ return TYPE_FIELD_BITPOS (type, TYPE_NFIELDS (type) - 1);
+ case TYPE_CODE_BOOL:
+ return 1;
+ case TYPE_CODE_CHAR:
case TYPE_CODE_INT:
- return value_from_longest (type, max_of_type (type));
+ return max_of_type (type);
default:
error (_("Unexpected type in discrete_type_high_bound."));
}
}
/* The largest value in the domain of TYPE, a discrete type, as an integer. */
-static struct value *
+static LONGEST
discrete_type_low_bound (struct type *type)
{
switch (TYPE_CODE (type))
{
case TYPE_CODE_RANGE:
- return value_from_longest (TYPE_TARGET_TYPE (type),
- TYPE_LOW_BOUND (type));
+ return TYPE_LOW_BOUND (type);
case TYPE_CODE_ENUM:
- return value_from_longest (type, TYPE_FIELD_BITPOS (type, 0));
+ return TYPE_FIELD_BITPOS (type, 0);
+ case TYPE_CODE_BOOL:
+ return 0;
+ case TYPE_CODE_CHAR:
case TYPE_CODE_INT:
- return value_from_longest (type, min_of_type (type));
+ return min_of_type (type);
default:
error (_("Unexpected type in discrete_type_low_bound."));
}
if (*resultp == NULL)
{
const char *decoded = ada_decode (gsymbol->name);
- if (gsymbol->bfd_section != NULL)
+ if (gsymbol->obj_section != NULL)
{
- bfd *obfd = gsymbol->bfd_section->owner;
- if (obfd != NULL)
- {
- struct objfile *objf;
- ALL_OBJFILES (objf)
- {
- if (obfd == objf->obfd)
- {
- *resultp = obsavestring (decoded, strlen (decoded),
- &objf->objfile_obstack);
- break;
- }
- }
- }
+ struct objfile *objf = gsymbol->obj_section->objfile;
+ *resultp = obsavestring (decoded, strlen (decoded),
+ &objf->objfile_obstack);
}
/* Sometimes, we can't find a corresponding objfile, in which
case, we put the result on the heap. Since we only decode
(*elt_bits + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT;
}
- TYPE_FLAGS (new_type) |= TYPE_FLAG_FIXED_INSTANCE;
+ TYPE_FIXED_INSTANCE (new_type) = 1;
return new_type;
}
{
int len = (value_bitpos (toval)
+ bits + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT;
+ int from_size;
char *buffer = (char *) alloca (len);
struct value *val;
CORE_ADDR to_addr = VALUE_ADDRESS (toval) + value_offset (toval);
fromval = value_cast (type, fromval);
read_memory (to_addr, buffer, len);
+ from_size = value_bitsize (fromval);
+ if (from_size == 0)
+ from_size = TYPE_LENGTH (value_type (fromval)) * TARGET_CHAR_BIT;
if (gdbarch_bits_big_endian (current_gdbarch))
move_bits (buffer, value_bitpos (toval),
- value_contents (fromval),
- TYPE_LENGTH (value_type (fromval)) * TARGET_CHAR_BIT -
- bits, bits);
+ value_contents (fromval), from_size - bits, bits);
else
move_bits (buffer, value_bitpos (toval), value_contents (fromval),
0, bits);
case LOC_REGISTER:
case LOC_ARG:
case LOC_REF_ARG:
- case LOC_REGPARM:
case LOC_REGPARM_ADDR:
case LOC_LOCAL:
- case LOC_LOCAL_ARG:
- case LOC_BASEREG:
- case LOC_BASEREG_ARG:
case LOC_COMPUTED:
- case LOC_COMPUTED_ARG:
goto FoundNonType;
default:
break;
static int
lookup_cached_symbol (const char *name, domain_enum namespace,
- struct symbol **sym, struct block **block,
- struct symtab **symtab)
+ struct symbol **sym, struct block **block)
{
return 0;
}
static void
cache_symbol (const char *name, domain_enum namespace, struct symbol *sym,
- struct block *block, struct symtab *symtab)
+ struct block *block)
{
}
\f
domain_enum domain)
{
struct symbol *sym;
- struct symtab *symtab;
- if (lookup_cached_symbol (name, domain, &sym, NULL, NULL))
+ if (lookup_cached_symbol (name, domain, &sym, NULL))
return sym;
- sym =
- lookup_symbol_in_language (name, block, domain, language_c, 0, &symtab);
- cache_symbol (name, domain, sym, block_found, symtab);
+ sym = lookup_symbol_in_language (name, block, domain, language_c, 0);
+ cache_symbol (name, domain, sym, block_found);
return sym;
}
static void
add_defn_to_vec (struct obstack *obstackp,
struct symbol *sym,
- struct block *block, struct symtab *symtab)
+ struct block *block)
{
int i;
size_t tmp;
{
prevDefns[i].sym = sym;
prevDefns[i].block = block;
- prevDefns[i].symtab = symtab;
return;
}
}
info.sym = sym;
info.block = block;
- info.symtab = symtab;
obstack_grow (obstackp, &info, sizeof (struct ada_symbol_info));
}
}
case LOC_REGISTER:
case LOC_ARG:
case LOC_REF_ARG:
- case LOC_REGPARM:
case LOC_REGPARM_ADDR:
case LOC_LOCAL:
case LOC_TYPEDEF:
- case LOC_LOCAL_ARG:
- case LOC_BASEREG:
- case LOC_BASEREG_ARG:
case LOC_COMPUTED:
- case LOC_COMPUTED_ARG:
for (j = FIRST_LOCAL_BLOCK;
j < BLOCKVECTOR_NBLOCKS (BLOCKVECTOR (s)); j += 1)
{
if (current_block == NULL)
return nsyms;
- current_function = block_function (current_block);
+ current_function = block_linkage_function (current_block);
if (current_function == NULL)
return nsyms;
/* Find symbols in DOMAIN matching NAME0, in BLOCK0 and enclosing
scope and in global scopes, returning the number of matches. Sets
- *RESULTS to point to a vector of (SYM,BLOCK,SYMTAB) triples,
+ *RESULTS to point to a vector of (SYM,BLOCK) tuples,
indicating the symbols found and the blocks and symbol tables (if
any) in which they were found. This vector are transient---good only to
the next call of ada_lookup_symbol_list. Any non-function/non-enumeral
{
block_depth += 1;
ada_add_block_symbols (&symbol_list_obstack, block, name,
- namespace, NULL, NULL, wild_match);
+ namespace, NULL, wild_match);
/* If we found a non-function match, assume that's the one. */
if (is_nonfunction (defns_collected (&symbol_list_obstack, 0),
goto done;
cacheIfUnique = 1;
- if (lookup_cached_symbol (name0, namespace, &sym, &block, &s))
+ if (lookup_cached_symbol (name0, namespace, &sym, &block))
{
if (sym != NULL)
- add_defn_to_vec (&symbol_list_obstack, sym, block, s);
+ add_defn_to_vec (&symbol_list_obstack, sym, block);
goto done;
}
bv = BLOCKVECTOR (s);
block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
ada_add_block_symbols (&symbol_list_obstack, block, name, namespace,
- objfile, s, wild_match);
+ objfile, wild_match);
}
if (namespace == VAR_DOMAIN)
block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
ada_add_block_symbols (&symbol_list_obstack, block,
SYMBOL_LINKAGE_NAME (msymbol),
- namespace, objfile, s, wild_match);
+ namespace, objfile, wild_match);
if (num_defns_collected (&symbol_list_obstack) == ndefns0)
{
block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
ada_add_block_symbols (&symbol_list_obstack, block,
SYMBOL_LINKAGE_NAME (msymbol),
- namespace, objfile, s,
+ namespace, objfile,
wild_match);
}
}
bv = BLOCKVECTOR (s);
block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
ada_add_block_symbols (&symbol_list_obstack, block, name,
- namespace, objfile, s, wild_match);
+ namespace, objfile, wild_match);
}
}
bv = BLOCKVECTOR (s);
block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
ada_add_block_symbols (&symbol_list_obstack, block, name, namespace,
- objfile, s, wild_match);
+ objfile, wild_match);
}
ALL_PSYMTABS (objfile, ps)
continue;
block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
ada_add_block_symbols (&symbol_list_obstack, block, name,
- namespace, objfile, s, wild_match);
+ namespace, objfile, wild_match);
}
}
}
ndefns = remove_extra_symbols (*results, ndefns);
if (ndefns == 0)
- cache_symbol (name0, namespace, NULL, NULL, NULL);
+ cache_symbol (name0, namespace, NULL, NULL);
if (ndefns == 1 && cacheIfUnique)
- cache_symbol (name0, namespace, (*results)[0].sym, (*results)[0].block,
- (*results)[0].symtab);
+ cache_symbol (name0, namespace, (*results)[0].sym, (*results)[0].block);
ndefns = remove_irrelevant_renamings (*results, ndefns, block0);
ada_add_block_symbols (struct obstack *obstackp,
struct block *block, const char *name,
domain_enum domain, struct objfile *objfile,
- struct symtab *symtab, int wild)
+ int wild)
{
struct dict_iterator iter;
int name_len = strlen (name);
SYMBOL_DOMAIN (sym), domain)
&& wild_match (name, name_len, SYMBOL_LINKAGE_NAME (sym)))
{
- switch (SYMBOL_CLASS (sym))
- {
- case LOC_ARG:
- case LOC_LOCAL_ARG:
- case LOC_REF_ARG:
- case LOC_REGPARM:
- case LOC_REGPARM_ADDR:
- case LOC_BASEREG_ARG:
- case LOC_COMPUTED_ARG:
- arg_sym = sym;
- break;
- case LOC_UNRESOLVED:
- continue;
- default:
+ if (SYMBOL_CLASS (sym) == LOC_UNRESOLVED)
+ continue;
+ else if (SYMBOL_IS_ARGUMENT (sym))
+ arg_sym = sym;
+ else
+ {
found_sym = 1;
add_defn_to_vec (obstackp,
fixup_symbol_section (sym, objfile),
- block, symtab);
- break;
+ block);
}
}
}
if (cmp == 0
&& is_name_suffix (SYMBOL_LINKAGE_NAME (sym) + name_len))
{
- switch (SYMBOL_CLASS (sym))
- {
- case LOC_ARG:
- case LOC_LOCAL_ARG:
- case LOC_REF_ARG:
- case LOC_REGPARM:
- case LOC_REGPARM_ADDR:
- case LOC_BASEREG_ARG:
- case LOC_COMPUTED_ARG:
- arg_sym = sym;
- break;
- case LOC_UNRESOLVED:
- break;
- default:
- found_sym = 1;
- add_defn_to_vec (obstackp,
- fixup_symbol_section (sym, objfile),
- block, symtab);
- break;
- }
+ if (SYMBOL_CLASS (sym) != LOC_UNRESOLVED)
+ {
+ if (SYMBOL_IS_ARGUMENT (sym))
+ arg_sym = sym;
+ else
+ {
+ found_sym = 1;
+ add_defn_to_vec (obstackp,
+ fixup_symbol_section (sym, objfile),
+ block);
+ }
+ }
}
}
}
{
add_defn_to_vec (obstackp,
fixup_symbol_section (arg_sym, objfile),
- block, symtab);
+ block);
}
if (!wild)
if (cmp == 0
&& is_name_suffix (SYMBOL_LINKAGE_NAME (sym) + name_len + 5))
{
- switch (SYMBOL_CLASS (sym))
- {
- case LOC_ARG:
- case LOC_LOCAL_ARG:
- case LOC_REF_ARG:
- case LOC_REGPARM:
- case LOC_REGPARM_ADDR:
- case LOC_BASEREG_ARG:
- case LOC_COMPUTED_ARG:
- arg_sym = sym;
- break;
- case LOC_UNRESOLVED:
- break;
- default:
- found_sym = 1;
- add_defn_to_vec (obstackp,
- fixup_symbol_section (sym, objfile),
- block, symtab);
- break;
- }
+ if (SYMBOL_CLASS (sym) != LOC_UNRESOLVED)
+ {
+ if (SYMBOL_IS_ARGUMENT (sym))
+ arg_sym = sym;
+ else
+ {
+ found_sym = 1;
+ add_defn_to_vec (obstackp,
+ fixup_symbol_section (sym, objfile),
+ block);
+ }
+ }
}
}
}
{
add_defn_to_vec (obstackp,
fixup_symbol_section (arg_sym, objfile),
- block, symtab);
+ block);
}
}
}
static struct symbol *
find_old_style_renaming_symbol (const char *name, struct block *block)
{
- const struct symbol *function_sym = block_function (block);
+ const struct symbol *function_sym = block_linkage_function (block);
char *rename;
if (function_sym != NULL)
TYPE_FIELDS (type) = NULL;
TYPE_NAME (type) = "<empty>";
TYPE_TAG_NAME (type) = NULL;
- TYPE_FLAGS (type) = 0;
TYPE_LENGTH (type) = 0;
return type;
}
memset (TYPE_FIELDS (rtype), 0, sizeof (struct field) * nfields);
TYPE_NAME (rtype) = ada_type_name (type);
TYPE_TAG_NAME (rtype) = NULL;
- TYPE_FLAGS (rtype) |= TYPE_FLAG_FIXED_INSTANCE;
+ TYPE_FIXED_INSTANCE (rtype) = 1;
off = 0;
bit_len = 0;
sizeof (struct field) * nfields);
TYPE_NAME (type) = ada_type_name (type0);
TYPE_TAG_NAME (type) = NULL;
- TYPE_FLAGS (type) |= TYPE_FLAG_FIXED_INSTANCE;
+ TYPE_FIXED_INSTANCE (type) = 1;
TYPE_LENGTH (type) = 0;
}
TYPE_FIELD_TYPE (type, f) = new_type;
sizeof (struct field) * nfields);
TYPE_NAME (rtype) = ada_type_name (type);
TYPE_TAG_NAME (rtype) = NULL;
- TYPE_FLAGS (rtype) |= TYPE_FLAG_FIXED_INSTANCE;
+ TYPE_FIXED_INSTANCE (rtype) = 1;
TYPE_LENGTH (rtype) = TYPE_LENGTH (type);
branch_type = to_fixed_variant_branch_type
{
struct type *templ_type;
- if (TYPE_FLAGS (type0) & TYPE_FLAG_FIXED_INSTANCE)
+ if (TYPE_FIXED_INSTANCE (type0))
return type0;
templ_type = dynamic_template_type (type0);
}
else
{
- TYPE_FLAGS (type0) |= TYPE_FLAG_FIXED_INSTANCE;
+ TYPE_FIXED_INSTANCE (type0) = 1;
return type0;
}
struct type *result;
if (ada_is_packed_array_type (type0) /* revisit? */
- || (TYPE_FLAGS (type0) & TYPE_FLAG_FIXED_INSTANCE))
+ || TYPE_FIXED_INSTANCE (type0))
return type0;
index_type_desc = ada_find_parallel_type (type0, "___XA");
error (_("array type with dynamic size is larger than varsize-limit"));
}
- TYPE_FLAGS (result) |= TYPE_FLAG_FIXED_INSTANCE;
+ TYPE_FIXED_INSTANCE (result) = 1;
return result;
}
if (type0 == NULL)
return NULL;
- if (TYPE_FLAGS (type0) & TYPE_FLAG_FIXED_INSTANCE)
+ if (TYPE_FIXED_INSTANCE (type0))
return type0;
type0 = ada_check_typedef (type0);
static LONGEST
pos_atr (struct value *arg)
{
- struct type *type = value_type (arg);
+ struct value *val = coerce_ref (arg);
+ struct type *type = value_type (val);
if (!discrete_type_p (type))
error (_("'POS only defined on discrete types"));
if (TYPE_CODE (type) == TYPE_CODE_ENUM)
{
int i;
- LONGEST v = value_as_long (arg);
+ LONGEST v = value_as_long (val);
for (i = 0; i < TYPE_NFIELDS (type); i += 1)
{
error (_("enumeration value is invalid: can't find 'POS"));
}
else
- return value_as_long (arg);
+ return value_as_long (val);
}
static struct value *
default:
error (_("unexpected attribute encountered"));
case OP_ATR_FIRST:
- return discrete_type_low_bound (range_type);
+ return value_from_longest
+ (range_type, discrete_type_low_bound (range_type));
case OP_ATR_LAST:
- return discrete_type_high_bound (range_type);
+ return value_from_longest
+ (range_type, discrete_type_high_bound (range_type));
case OP_ATR_LENGTH:
error (_("the 'length attribute applies only to array types"));
}
subtype_info = strstr (name, "___XD");
if (subtype_info == NULL)
- return raw_type;
+ {
+ LONGEST L = discrete_type_low_bound (raw_type);
+ LONGEST U = discrete_type_high_bound (raw_type);
+ if (L < INT_MIN || U > INT_MAX)
+ return raw_type;
+ else
+ return create_range_type (alloc_type (objfile), raw_type,
+ discrete_type_low_bound (raw_type),
+ discrete_type_high_bound (raw_type));
+ }
else
{
static char *name_buf = NULL;
struct type *subranged_type = base_type (type);
return (subranged_type != NULL && TYPE_CODE (type) == TYPE_CODE_RANGE
- && TYPE_CODE (subranged_type) != TYPE_CODE_ENUM
+ && TYPE_CODE (subranged_type) == TYPE_CODE_INT
&& TYPE_UNSIGNED (subranged_type));
}
each time a new executable is loaded by GDB. */
static void
-ada_executable_changed_observer (void *unused)
+ada_executable_changed_observer (void)
{
/* If the executable changed, then it is possible that the Ada runtime
is different. So we need to invalidate the exception support info