/* DWARF 2 debugging format support for GDB.
- Copyright (C) 1994-2015 Free Software Foundation, Inc.
+ Copyright (C) 1994-2016 Free Software Foundation, Inc.
Adapted by Gary Funck (gary@intrepid.com), Intrepid Technology,
Inc. with support from Florida State University (under contract
struct dwarf2_cu *ref_cu = cu;
/* DW_FORM_ref_addr is using section offset. */
- attr.name = 0;
+ attr.name = (enum dwarf_attribute) 0;
attr.form = DW_FORM_ref_addr;
attr.u.unsnd = pdi->offset.sect_off;
die = follow_die_ref (NULL, &attr, &ref_cu);
{
/* Irix 6.2 native cc prepends <machine>.: to the compilation
directory, get rid of it. */
- char *cp = strchr (*comp_dir, ':');
+ const char *cp = strchr (*comp_dir, ':');
if (cp && cp != *comp_dir && cp[-1] == '.' && cp[1] == '/')
*comp_dir = cp + 1;
int found_base;
unsigned int dummy;
const gdb_byte *buffer;
- CORE_ADDR marker;
int low_set;
CORE_ADDR low = 0;
CORE_ADDR high = 0;
}
buffer = dwarf2_per_objfile->ranges.buffer + offset;
- /* Read in the largest possible address. */
- marker = read_address (obfd, buffer, cu, &dummy);
- if ((marker & mask) == mask)
- {
- /* If we found the largest possible address, then
- read the base address. */
- base = read_address (obfd, buffer + addr_size, cu, &dummy);
- buffer += 2 * addr_size;
- offset += 2 * addr_size;
- found_base = 1;
- }
-
low_set = 0;
baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
the base address. Check for a base address here. */
if ((range_beginning & mask) == mask)
{
- /* If we found the largest possible address, then
- read the base address. */
- base = read_address (obfd, buffer + addr_size, cu, &dummy);
+ /* If we found the largest possible address, then we already
+ have the base address in range_end. */
+ base = range_end;
found_base = 1;
continue;
}
attr = dwarf2_attr (die, DW_AT_byte_size, cu);
if (attr)
{
- TYPE_LENGTH (type) = DW_UNSND (attr);
+ if (attr_form_is_constant (attr))
+ TYPE_LENGTH (type) = DW_UNSND (attr);
+ else
+ {
+ /* For the moment, dynamic type sizes are not supported
+ by GDB's struct type. The actual size is determined
+ on-demand when resolving the type of a given object,
+ so set the type's length to zero for now. Otherwise,
+ we record an expression as the length, and that expression
+ could lead to a very large value, which could eventually
+ lead to us trying to allocate that much memory when creating
+ a value of that type. */
+ TYPE_LENGTH (type) = 0;
+ }
}
else
{
the bounds as signed, and thus sign-extend their values, when
the base type is signed. */
negative_mask =
- (LONGEST) -1 << (TYPE_LENGTH (base_type) * TARGET_CHAR_BIT - 1);
+ -((LONGEST) 1 << (TYPE_LENGTH (base_type) * TARGET_CHAR_BIT - 1));
if (low.kind == PROP_CONST
&& !TYPE_UNSIGNED (base_type) && (low.data.const_val & negative_mask))
low.data.const_val |= negative_mask;
compilers pick up the new representation, we'll support this
practice. */
if (DW_UNSND (&attr) == DW_CC_program
- && cu->language == language_fortran)
+ && cu->language == language_fortran
+ && part_die->name != NULL)
set_objfile_main_name (objfile, part_die->name, language_fortran);
break;
case DW_AT_inline:
anonymous_struct_prefix (struct die_info *die, struct dwarf2_cu *cu)
{
struct attribute *attr;
- char *base;
+ const char *base;
if (die->tag != DW_TAG_class_type && die->tag != DW_TAG_interface_type
&& die->tag != DW_TAG_structure_type && die->tag != DW_TAG_union_type)
if (demangled)
{
- char *base;
+ const char *base;
/* FIXME: we already did this for the partial symbol... */
DW_STRING (attr)
&& !HAVE_GNAT_AUX_INFO (type))
INIT_GNAT_SPECIFIC (type);
+ /* Read DW_AT_allocated and set in type. */
+ attr = dwarf2_attr (die, DW_AT_allocated, cu);
+ if (attr_form_is_block (attr))
+ {
+ if (attr_to_dynamic_prop (attr, die, cu, &prop))
+ add_dyn_prop (DYN_PROP_ALLOCATED, prop, type, objfile);
+ }
+ else if (attr != NULL)
+ {
+ complaint (&symfile_complaints,
+ _("DW_AT_allocated has the wrong form (%s) at DIE 0x%x"),
+ (attr != NULL ? dwarf_form_name (attr->form) : "n/a"),
+ die->offset.sect_off);
+ }
+
+ /* Read DW_AT_associated and set in type. */
+ attr = dwarf2_attr (die, DW_AT_associated, cu);
+ if (attr_form_is_block (attr))
+ {
+ if (attr_to_dynamic_prop (attr, die, cu, &prop))
+ add_dyn_prop (DYN_PROP_ASSOCIATED, prop, type, objfile);
+ }
+ else if (attr != NULL)
+ {
+ complaint (&symfile_complaints,
+ _("DW_AT_associated has the wrong form (%s) at DIE 0x%x"),
+ (attr != NULL ? dwarf_form_name (attr->form) : "n/a"),
+ die->offset.sect_off);
+ }
+
/* Read DW_AT_data_location and set in type. */
attr = dwarf2_attr (die, DW_AT_data_location, cu);
if (attr_to_dynamic_prop (attr, die, cu, &prop))