static void extract_string (CORE_ADDR addr, char *buf);
-static void modify_general_field (char *, LONGEST, int, int);
+static void modify_general_field (struct type *, char *, LONGEST, int, int);
static struct type *desc_base_type (struct type *);
static struct value *value_subscript_packed (struct value *, int,
struct value **);
-static void move_bits (gdb_byte *, int, const gdb_byte *, int, int);
+static void move_bits (gdb_byte *, int, const gdb_byte *, int, int, int);
static struct value *coerce_unspec_val_to_type (struct value *,
struct type *);
/* Like modify_field, but allows bitpos > wordlength. */
static void
-modify_general_field (char *addr, LONGEST fieldval, int bitpos, int bitsize)
+modify_general_field (struct type *type, char *addr,
+ LONGEST fieldval, int bitpos, int bitsize)
{
- modify_field (addr + bitpos / 8, fieldval, bitpos % 8, bitsize);
+ modify_field (type, addr + bitpos / 8, fieldval, bitpos % 8, bitsize);
}
struct type *elt_type;
int arity;
struct value *descriptor;
- struct objfile *objf = TYPE_OBJFILE (value_type (arr));
elt_type = ada_array_element_type (value_type (arr), -1);
arity = ada_array_arity (value_type (arr));
return NULL;
while (arity > 0)
{
- struct type *range_type = alloc_type (objf);
- struct type *array_type = alloc_type (objf);
+ 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;
if (TYPE_CODE (type) != TYPE_CODE_ARRAY)
return type;
- new_type = alloc_type (TYPE_OBJFILE (type));
+ new_type = alloc_type_copy (type);
new_elt_type = packed_array_type (ada_check_typedef (TYPE_TARGET_TYPE (type)),
elt_bits);
create_array_type (new_type, new_elt_type, TYPE_INDEX_TYPE (type));
return NULL;
}
- if (gdbarch_bits_big_endian (current_gdbarch)
+ if (gdbarch_bits_big_endian (get_type_arch (value_type (arr)))
&& ada_is_modular_type (value_type (arr)))
{
/* This is a (right-justified) modular type representing a packed
int len = (bit_size + bit_offset + HOST_CHAR_BIT - 1) / 8;
/* Transmit bytes from least to most significant; delta is the direction
the indices move. */
- int delta = gdbarch_bits_big_endian (current_gdbarch) ? -1 : 1;
+ int delta = gdbarch_bits_big_endian (get_type_arch (type)) ? -1 : 1;
type = ada_check_typedef (type);
memset (unpacked, 0, TYPE_LENGTH (type));
return v;
}
- else if (gdbarch_bits_big_endian (current_gdbarch))
+ else if (gdbarch_bits_big_endian (get_type_arch (type)))
{
src = len - 1;
if (has_negatives (type)
not overlap. */
static void
move_bits (gdb_byte *target, int targ_offset, const gdb_byte *source,
- int src_offset, int n)
+ int src_offset, int n, int bits_big_endian_p)
{
unsigned int accum, mask;
int accum_bits, chunk_size;
targ_offset %= HOST_CHAR_BIT;
source += src_offset / HOST_CHAR_BIT;
src_offset %= HOST_CHAR_BIT;
- if (gdbarch_bits_big_endian (current_gdbarch))
+ if (bits_big_endian_p)
{
accum = (unsigned char) *source;
source += 1;
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))
+ if (gdbarch_bits_big_endian (get_type_arch (type)))
move_bits (buffer, value_bitpos (toval),
- value_contents (fromval), from_size - bits, bits);
+ value_contents (fromval), from_size - bits, bits, 1);
else
- move_bits (buffer, value_bitpos (toval), value_contents (fromval),
- 0, bits);
+ move_bits (buffer, value_bitpos (toval),
+ value_contents (fromval), 0, bits, 0);
write_memory (to_addr, buffer, len);
if (deprecated_memory_changed_hook)
deprecated_memory_changed_hook (to_addr, len);
else
bits = value_bitsize (component);
- if (gdbarch_bits_big_endian (current_gdbarch))
+ if (gdbarch_bits_big_endian (get_type_arch (value_type (container))))
move_bits (value_contents_writeable (container) + offset_in_container,
value_bitpos (container) + bit_offset_in_container,
value_contents (val),
TYPE_LENGTH (value_type (component)) * TARGET_CHAR_BIT - bits,
- bits);
+ bits, 1);
else
move_bits (value_contents_writeable (container) + offset_in_container,
value_bitpos (container) + bit_offset_in_container,
- value_contents (val), 0, bits);
+ value_contents (val), 0, bits, 0);
}
/* The value of the element of array ARR at the ARITY indices given in IND.
for (i = ada_array_arity (ada_check_typedef (value_type (arr))); i > 0; i -= 1)
{
- modify_general_field (value_contents_writeable (bounds),
+ modify_general_field (value_type (bounds),
+ value_contents_writeable (bounds),
ada_array_bound (arr, i, 0),
desc_bound_bitpos (bounds_type, i, 0),
desc_bound_bitsize (bounds_type, i, 0));
- modify_general_field (value_contents_writeable (bounds),
+ modify_general_field (value_type (bounds),
+ value_contents_writeable (bounds),
ada_array_bound (arr, i, 1),
desc_bound_bitpos (bounds_type, i, 1),
desc_bound_bitsize (bounds_type, i, 1));
bounds = ensure_lval (bounds, gdbarch, sp);
- modify_general_field (value_contents_writeable (descriptor),
+ modify_general_field (value_type (descriptor),
+ value_contents_writeable (descriptor),
value_address (ensure_lval (arr, gdbarch, sp)),
fat_pntr_data_bitpos (desc_type),
fat_pntr_data_bitsize (desc_type));
- modify_general_field (value_contents_writeable (descriptor),
+ modify_general_field (value_type (descriptor),
+ value_contents_writeable (descriptor),
value_address (bounds),
fat_pntr_bounds_bitpos (desc_type),
fat_pntr_bounds_bitsize (desc_type));
/* A record type with no fields. */
static struct type *
-empty_record (struct objfile *objfile)
+empty_record (struct type *template)
{
- struct type *type = alloc_type (objfile);
+ struct type *type = alloc_type_copy (template);
TYPE_CODE (type) = TYPE_CODE_STRUCT;
TYPE_NFIELDS (type) = 0;
TYPE_FIELDS (type) = NULL;
nfields++;
}
- rtype = alloc_type (TYPE_OBJFILE (type));
+ rtype = alloc_type_copy (type);
TYPE_CODE (rtype) = TYPE_CODE_STRUCT;
INIT_CPLUS_SPECIFIC (rtype);
TYPE_NFIELDS (rtype) = nfields;
new_type = static_unwrap_type (field_type);
if (type == type0 && new_type != field_type)
{
- TYPE_TARGET_TYPE (type0) = type = alloc_type (TYPE_OBJFILE (type0));
+ TYPE_TARGET_TYPE (type0) = type = alloc_type_copy (type0);
TYPE_CODE (type) = TYPE_CODE (type0);
INIT_CPLUS_SPECIFIC (type);
TYPE_NFIELDS (type) = nfields;
else
dval = dval0;
- rtype = alloc_type (TYPE_OBJFILE (type));
+ rtype = alloc_type_copy (type);
TYPE_CODE (rtype) = TYPE_CODE_STRUCT;
INIT_CPLUS_SPECIFIC (rtype);
TYPE_NFIELDS (rtype) = nfields;
value_type (dval), value_contents (dval));
if (which < 0)
- return empty_record (TYPE_OBJFILE (var_type));
+ return empty_record (var_type);
else if (is_dynamic_field (var_type, which))
return to_fixed_record_type
(TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (var_type, which)),
if (elt_type0 == elt_type && !packed_array_p)
result = type0;
else
- result = create_array_type (alloc_type (TYPE_OBJFILE (type0)),
+ result = create_array_type (alloc_type_copy (type0),
elt_type, TYPE_INDEX_TYPE (type0));
}
else
struct type *range_type =
to_fixed_range_type (TYPE_FIELD_NAME (index_type_desc, i),
dval, TYPE_INDEX_TYPE (elt_type0));
- result = create_array_type (alloc_type (TYPE_OBJFILE (elt_type0)),
+ result = create_array_type (alloc_type_copy (elt_type0),
result, range_type);
elt_type0 = TYPE_TARGET_TYPE (elt_type0);
}
val = allocate_value (type1);
store_unsigned_integer (value_contents_raw (val),
- TYPE_LENGTH (value_type (val)), v);
+ TYPE_LENGTH (value_type (val)),
+ gdbarch_byte_order (get_type_arch (type1)), v);
return val;
}
if (L < INT_MIN || U > INT_MAX)
return raw_type;
else
- return create_range_type (alloc_type (TYPE_OBJFILE (orig_type)),
- raw_type,
+ return create_range_type (alloc_type_copy (orig_type), raw_type,
discrete_type_low_bound (raw_type),
discrete_type_high_bound (raw_type));
}
}
}
- type = create_range_type (alloc_type (TYPE_OBJFILE (orig_type)),
- base_type, L, U);
+ type = create_range_type (alloc_type_copy (orig_type), base_type, L, U);
TYPE_NAME (type) = name;
return type;
}
static void
print_one_exception (enum exception_catchpoint_kind ex,
- struct breakpoint *b, CORE_ADDR *last_addr)
+ struct breakpoint *b, struct bp_location **last_loc)
{
struct value_print_options opts;
if (opts.addressprint)
{
annotate_field (4);
- ui_out_field_core_addr (uiout, "addr", b->loc->address);
+ ui_out_field_core_addr (uiout, "addr", b->loc->gdbarch, b->loc->address);
}
annotate_field (5);
- *last_addr = b->loc->address;
+ *last_loc = b->loc;
switch (ex)
{
case ex_catch_exception:
}
static void
-print_one_catch_exception (struct breakpoint *b, CORE_ADDR *last_addr)
+print_one_catch_exception (struct breakpoint *b, struct bp_location **last_loc)
{
- print_one_exception (ex_catch_exception, b, last_addr);
+ print_one_exception (ex_catch_exception, b, last_loc);
}
static void
}
static void
-print_one_catch_exception_unhandled (struct breakpoint *b, CORE_ADDR *last_addr)
+print_one_catch_exception_unhandled (struct breakpoint *b,
+ struct bp_location **last_loc)
{
- print_one_exception (ex_catch_exception_unhandled, b, last_addr);
+ print_one_exception (ex_catch_exception_unhandled, b, last_loc);
}
static void
}
static void
-print_one_catch_assert (struct breakpoint *b, CORE_ADDR *last_addr)
+print_one_catch_assert (struct breakpoint *b, struct bp_location **last_loc)
{
- print_one_exception (ex_catch_assert, b, last_addr);
+ print_one_exception (ex_catch_assert, b, last_loc);
}
static void
lai->primitive_type_vector
= GDBARCH_OBSTACK_CALLOC (gdbarch, nr_ada_primitive_types + 1,
struct type *);
- lai->primitive_type_vector [ada_primitive_type_int] =
- init_type (TYPE_CODE_INT,
- gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
- 0, "integer", (struct objfile *) NULL);
- lai->primitive_type_vector [ada_primitive_type_long] =
- init_type (TYPE_CODE_INT,
- gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT,
- 0, "long_integer", (struct objfile *) NULL);
- lai->primitive_type_vector [ada_primitive_type_short] =
- init_type (TYPE_CODE_INT,
- gdbarch_short_bit (gdbarch) / TARGET_CHAR_BIT,
- 0, "short_integer", (struct objfile *) NULL);
- lai->string_char_type =
- lai->primitive_type_vector [ada_primitive_type_char] =
- init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
- 0, "character", (struct objfile *) NULL);
- lai->primitive_type_vector [ada_primitive_type_float] =
- init_float_type (gdbarch_float_bit (gdbarch),
- "float", NULL);
- lai->primitive_type_vector [ada_primitive_type_double] =
- init_float_type (gdbarch_double_bit (gdbarch),
- "long_float", NULL);
- lai->primitive_type_vector [ada_primitive_type_long_long] =
- init_type (TYPE_CODE_INT,
- gdbarch_long_long_bit (gdbarch) / TARGET_CHAR_BIT,
- 0, "long_long_integer", (struct objfile *) NULL);
- lai->primitive_type_vector [ada_primitive_type_long_double] =
- init_float_type (gdbarch_double_bit (gdbarch),
- "long_long_float", NULL);
- lai->primitive_type_vector [ada_primitive_type_natural] =
- init_type (TYPE_CODE_INT,
- gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
- 0, "natural", (struct objfile *) NULL);
- lai->primitive_type_vector [ada_primitive_type_positive] =
- init_type (TYPE_CODE_INT,
- gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
- 0, "positive", (struct objfile *) NULL);
- lai->primitive_type_vector [ada_primitive_type_void] = builtin->builtin_void;
-
- lai->primitive_type_vector [ada_primitive_type_system_address] =
- lookup_pointer_type (init_type (TYPE_CODE_VOID, 1, 0, "void",
- (struct objfile *) NULL));
+
+ lai->primitive_type_vector [ada_primitive_type_int]
+ = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch),
+ 0, "integer");
+ lai->primitive_type_vector [ada_primitive_type_long]
+ = arch_integer_type (gdbarch, gdbarch_long_bit (gdbarch),
+ 0, "long_integer");
+ lai->primitive_type_vector [ada_primitive_type_short]
+ = arch_integer_type (gdbarch, gdbarch_short_bit (gdbarch),
+ 0, "short_integer");
+ lai->string_char_type
+ = lai->primitive_type_vector [ada_primitive_type_char]
+ = arch_integer_type (gdbarch, TARGET_CHAR_BIT, 0, "character");
+ lai->primitive_type_vector [ada_primitive_type_float]
+ = arch_float_type (gdbarch, gdbarch_float_bit (gdbarch),
+ "float", NULL);
+ lai->primitive_type_vector [ada_primitive_type_double]
+ = arch_float_type (gdbarch, gdbarch_double_bit (gdbarch),
+ "long_float", NULL);
+ lai->primitive_type_vector [ada_primitive_type_long_long]
+ = arch_integer_type (gdbarch, gdbarch_long_long_bit (gdbarch),
+ 0, "long_long_integer");
+ lai->primitive_type_vector [ada_primitive_type_long_double]
+ = arch_float_type (gdbarch, gdbarch_double_bit (gdbarch),
+ "long_long_float", NULL);
+ lai->primitive_type_vector [ada_primitive_type_natural]
+ = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch),
+ 0, "natural");
+ lai->primitive_type_vector [ada_primitive_type_positive]
+ = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch),
+ 0, "positive");
+ lai->primitive_type_vector [ada_primitive_type_void]
+ = builtin->builtin_void;
+
+ lai->primitive_type_vector [ada_primitive_type_system_address]
+ = lookup_pointer_type (arch_type (gdbarch, TYPE_CODE_VOID, 1, "void"));
TYPE_NAME (lai->primitive_type_vector [ada_primitive_type_system_address])
= "system__address";