return &file_names[vec_index];
}
- /* Const version of the above. */
- const file_entry *file_name_at (unsigned int index) const
- {
- if (index >= file_names.size ())
- return NULL;
- return &file_names[index];
- }
-
/* Offset of line number information in .debug_line section. */
sect_offset sect_off {};
static unsigned int read_2_bytes (bfd *, const gdb_byte *);
+/* Read the next three bytes (little-endian order) as an unsigned integer. */
+static unsigned int read_3_bytes (bfd *, const gdb_byte *);
+
static unsigned int read_4_bytes (bfd *, const gdb_byte *);
static ULONGEST read_8_bytes (bfd *, const gdb_byte *);
{
CORE_ADDR addr;
- if (attr->form != DW_FORM_addr && attr->form != DW_FORM_GNU_addr_index)
+ if (attr->form != DW_FORM_addr && attr->form != DW_FORM_addrx
+ && attr->form != DW_FORM_GNU_addr_index)
{
/* Aside from a few clearly defined exceptions, attributes that
contain an address must always be in DW_FORM_addr form.
init_psymbol_list (objfile, 1024);
- TRY
+ try
{
/* This isn't really ideal: all the data we allocate on the
objfile's obstack is still uselessly kept around. However,
/* (maybe) store an index in the cache. */
global_index_cache.store (dwarf2_per_objfile);
}
- CATCH (except, RETURN_MASK_ERROR)
+ catch (const gdb_exception_error &except)
{
exception_print (gdb_stderr, except);
}
- END_CATCH
}
/* Return the total length of the CU described by HEADER. */
comp_dir = dwarf2_attr (stub_comp_unit_die, DW_AT_comp_dir, cu);
/* There should be a DW_AT_addr_base attribute here (if needed).
- We need the value before we can process DW_FORM_GNU_addr_index. */
+ We need the value before we can process DW_FORM_GNU_addr_index
+ or DW_FORM_addrx. */
cu->addr_base = 0;
attr = dwarf2_attr (stub_comp_unit_die, DW_AT_GNU_addr_base, cu);
if (attr)
case DW_FORM_block4:
info_ptr += 4 + read_4_bytes (abfd, info_ptr);
break;
+ case DW_FORM_addrx:
+ case DW_FORM_strx:
case DW_FORM_sdata:
case DW_FORM_udata:
case DW_FORM_ref_udata:
field for our sole member child. */
struct attribute *discr = dwarf2_attr (child_die, DW_AT_discr_value, cu);
- for (struct die_info *variant_child = child_die->child;
+ for (die_info *variant_child = child_die->child;
variant_child != NULL;
variant_child = sibling_die (variant_child))
{
if (has_template_parameters)
{
- /* Make sure that the symtab is set on the new symbols.
- Even though they don't appear in this symtab directly,
- other parts of gdb assume that symbols do, and this is
- reasonably true. */
- for (int i = 0; i < TYPE_N_TEMPLATE_ARGUMENTS (type); ++i)
- symbol_set_symtab (TYPE_TEMPLATE_ARGUMENT (type, i),
- symbol_symtab (sym));
+ struct symtab *symtab;
+ if (sym != nullptr)
+ symtab = symbol_symtab (sym);
+ else if (cu->line_header != nullptr)
+ {
+ /* Any related symtab will do. */
+ symtab
+ = cu->line_header->file_name_at (file_name_index (1))->symtab;
+ }
+ else
+ {
+ symtab = nullptr;
+ complaint (_("could not find suitable "
+ "symtab for template parameter"
+ " - DIE at %s [in module %s]"),
+ sect_offset_str (die->sect_off),
+ objfile_name (objfile));
+ }
+
+ if (symtab != nullptr)
+ {
+ /* Make sure that the symtab is set on the new symbols.
+ Even though they don't appear in this symtab directly,
+ other parts of gdb assume that symbols do, and this is
+ reasonably true. */
+ for (int i = 0; i < TYPE_N_TEMPLATE_ARGUMENTS (type); ++i)
+ symbol_set_symtab (TYPE_TEMPLATE_ARGUMENT (type, i), symtab);
+ }
}
}
}
gdbarch *gdbarch = get_objfile_arch (objfile);
struct type *tt = nullptr;
- switch (bits)
+ /* Try to find a suitable floating point builtin type of size BITS.
+ We're going to use the name of this type as the name for the complex
+ target type that we are about to create. */
+ switch (cu->language)
{
- case 32:
- tt = builtin_type (gdbarch)->builtin_float;
- break;
- case 64:
- tt = builtin_type (gdbarch)->builtin_double;
+ case language_fortran:
+ switch (bits)
+ {
+ case 32:
+ tt = builtin_f_type (gdbarch)->builtin_real;
+ break;
+ case 64:
+ tt = builtin_f_type (gdbarch)->builtin_real_s8;
+ break;
+ case 96: /* The x86-32 ABI specifies 96-bit long double. */
+ case 128:
+ tt = builtin_f_type (gdbarch)->builtin_real_s16;
+ break;
+ }
break;
- case 128:
- tt = builtin_type (gdbarch)->builtin_long_double;
+ default:
+ switch (bits)
+ {
+ case 32:
+ tt = builtin_type (gdbarch)->builtin_float;
+ break;
+ case 64:
+ tt = builtin_type (gdbarch)->builtin_double;
+ break;
+ case 96: /* The x86-32 ABI specifies 96-bit long double. */
+ case 128:
+ tt = builtin_type (gdbarch)->builtin_long_double;
+ break;
+ }
break;
}
+ /* If the type we found doesn't match the size we were looking for, then
+ pretend we didn't find a type at all, the complex target type we
+ create will then be nameless. */
+ if (tt != nullptr && TYPE_LENGTH (tt) * TARGET_CHAR_BIT != bits)
+ tt = nullptr;
+
const char *name = (tt == nullptr) ? nullptr : TYPE_NAME (tt);
return dwarf2_init_float_type (objfile, bits, name, name_hint);
}
case DW_FORM_implicit_const:
DW_SND (attr) = implicit_const;
break;
+ case DW_FORM_addrx:
case DW_FORM_GNU_addr_index:
if (reader->dwo_file == NULL)
{
DW_ADDR (attr) = read_addr_index_from_leb128 (cu, info_ptr, &bytes_read);
info_ptr += bytes_read;
break;
+ case DW_FORM_strx:
+ case DW_FORM_strx1:
+ case DW_FORM_strx2:
+ case DW_FORM_strx3:
+ case DW_FORM_strx4:
case DW_FORM_GNU_str_index:
if (reader->dwo_file == NULL)
{
bfd_get_filename (abfd));
}
{
- ULONGEST str_index =
- read_unsigned_leb128 (abfd, info_ptr, &bytes_read);
-
+ ULONGEST str_index;
+ if (form == DW_FORM_strx1)
+ {
+ str_index = read_1_byte (abfd, info_ptr);
+ info_ptr += 1;
+ }
+ else if (form == DW_FORM_strx2)
+ {
+ str_index = read_2_bytes (abfd, info_ptr);
+ info_ptr += 2;
+ }
+ else if (form == DW_FORM_strx3)
+ {
+ str_index = read_3_bytes (abfd, info_ptr);
+ info_ptr += 3;
+ }
+ else if (form == DW_FORM_strx4)
+ {
+ str_index = read_4_bytes (abfd, info_ptr);
+ info_ptr += 4;
+ }
+ else
+ {
+ str_index = read_unsigned_leb128 (abfd, info_ptr, &bytes_read);
+ info_ptr += bytes_read;
+ }
DW_STRING (attr) = read_str_index (reader, str_index);
DW_STRING_IS_CANONICAL (attr) = 0;
- info_ptr += bytes_read;
}
break;
default:
return bfd_get_signed_16 (abfd, buf);
}
+static unsigned int
+read_3_bytes (bfd *abfd, const gdb_byte *buf)
+{
+ unsigned int result = 0;
+ for (int i = 0; i < 3; ++i)
+ {
+ unsigned char byte = bfd_get_8 (abfd, buf);
+ buf++;
+ result |= ((unsigned int) byte << (i * 8));
+ }
+ return result;
+}
+
static unsigned int
read_4_bytes (bfd *abfd, const gdb_byte *buf)
{
addr_size);
}
-/* Given a DW_FORM_GNU_str_index, fetch the string.
+/* Given a DW_FORM_GNU_str_index or DW_FORM_strx, fetch the string.
This is only used by the Fission support. */
static const char *
&reader->dwo_file->sections.str_offsets;
const gdb_byte *info_ptr;
ULONGEST str_offset;
- static const char form_name[] = "DW_FORM_GNU_str_index";
+ static const char form_name[] = "DW_FORM_GNU_str_index or DW_FORM_strx";
dwarf2_read_section (objfile, str_section);
dwarf2_read_section (objfile, str_offsets_section);
{
if (attr->form == DW_FORM_strp || attr->form == DW_FORM_line_strp
|| attr->form == DW_FORM_string
+ || attr->form == DW_FORM_strx
|| attr->form == DW_FORM_GNU_str_index
|| attr->form == DW_FORM_GNU_strp_alt)
str = DW_STRING (attr);
/* Handle one degenerate form of location expression specially, to
preserve GDB's previous behavior when section offsets are
- specified. If this is just a DW_OP_addr or DW_OP_GNU_addr_index
- then mark this symbol as LOC_STATIC. */
+ specified. If this is just a DW_OP_addr, DW_OP_addrx, or
+ DW_OP_GNU_addr_index then mark this symbol as LOC_STATIC. */
if (attr_form_is_block (attr)
&& ((DW_BLOCK (attr)->data[0] == DW_OP_addr
&& DW_BLOCK (attr)->size == 1 + cu_header->addr_size)
- || (DW_BLOCK (attr)->data[0] == DW_OP_GNU_addr_index
+ || ((DW_BLOCK (attr)->data[0] == DW_OP_GNU_addr_index
+ || DW_BLOCK (attr)->data[0] == DW_OP_addrx)
&& (DW_BLOCK (attr)->size
== 1 + leb128_size (&DW_BLOCK (attr)->data[1])))))
{
switch (attr->form)
{
case DW_FORM_addr:
+ case DW_FORM_addrx:
case DW_FORM_GNU_addr_index:
{
gdb_byte *data;
break;
case DW_FORM_string:
case DW_FORM_strp:
+ case DW_FORM_strx:
case DW_FORM_GNU_str_index:
case DW_FORM_GNU_strp_alt:
/* DW_STRING is already allocated on the objfile obstack, point
switch (die->attrs[i].form)
{
case DW_FORM_addr:
+ case DW_FORM_addrx:
case DW_FORM_GNU_addr_index:
fprintf_unfiltered (f, "address: ");
fputs_filtered (hex_string (DW_ADDR (&die->attrs[i])), f);
case DW_FORM_string:
case DW_FORM_strp:
case DW_FORM_line_strp:
+ case DW_FORM_strx:
case DW_FORM_GNU_str_index:
case DW_FORM_GNU_strp_alt:
fprintf_unfiltered (f, "string: \"%s\" (%s canonicalized)",
switch (attr->form)
{
case DW_FORM_addr:
+ case DW_FORM_addrx:
case DW_FORM_GNU_addr_index:
{
gdb_byte *tem;
break;
case DW_FORM_string:
case DW_FORM_strp:
+ case DW_FORM_strx:
case DW_FORM_GNU_str_index:
case DW_FORM_GNU_strp_alt:
/* DW_STRING is already allocated on the objfile obstack, point
case DW_OP_GNU_uninit:
break;
+ case DW_OP_addrx:
case DW_OP_GNU_addr_index:
case DW_OP_GNU_const_index:
stack[++stacki] = read_addr_index_from_leb128 (cu, &data[i],
bytes += 4 + read_4_bytes (abfd, bytes);
break;
+ case DW_FORM_addrx:
case DW_FORM_sdata:
+ case DW_FORM_strx:
case DW_FORM_udata:
case DW_FORM_GNU_addr_index:
case DW_FORM_GNU_str_index: