#include "macrotab.h"
#include "language.h"
#include "complaints.h"
-#include "bcache.h"
#include "dwarf2expr.h"
#include "dwarf2loc.h"
#include "cp-support.h"
#include "psympriv.h"
#include <sys/stat.h>
#include "completer.h"
-#include "vec.h"
+#include "common/vec.h"
#include "c-lang.h"
#include "go-lang.h"
#include "valprint.h"
#include "gdb_bfd.h"
#include "f-lang.h"
#include "source.h"
-#include "filestuff.h"
+#include "common/filestuff.h"
#include "build-id.h"
#include "namespace.h"
#include "common/gdb_unlinker.h"
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
-#include "selftest.h"
+#include "common/selftest.h"
#include <cmath>
#include <set>
#include <forward_list>
if (dwz_bfd != NULL)
{
if (!build_id_verify (dwz_bfd.get (), buildid_len, buildid))
- dwz_bfd.release ();
+ dwz_bfd.reset (nullptr);
}
if (dwz_bfd == NULL)
struct symbol *sym, *with_opaque = NULL;
struct compunit_symtab *stab = dw2_instantiate_symtab (per_cu, false);
const struct blockvector *bv = COMPUNIT_BLOCKVECTOR (stab);
- struct block *block = BLOCKVECTOR_BLOCK (bv, block_index);
+ const struct block *block = BLOCKVECTOR_BLOCK (bv, block_index);
sym = block_find_symbol (block, name, domain,
block_find_non_opaque_type_preferred,
dw2_map_matching_symbols (struct objfile *objfile,
const char * name, domain_enum domain,
int global,
- int (*callback) (struct block *,
+ int (*callback) (const struct block *,
struct symbol *, void *),
void *data, symbol_name_match_type match,
symbol_compare_ftype *ordered_compare)
struct symbol *sym, *with_opaque = NULL;
struct compunit_symtab *stab = dw2_instantiate_symtab (per_cu, false);
const struct blockvector *bv = COMPUNIT_BLOCKVECTOR (stab);
- struct block *block = BLOCKVECTOR_BLOCK (bv, block_index);
+ const struct block *block = BLOCKVECTOR_BLOCK (bv, block_index);
sym = block_find_symbol (block, name, domain,
block_find_non_opaque_type_preferred,
std::unique_ptr<struct dwp_file> dwp_file
(new struct dwp_file (name, std::move (dbfd)));
- /* +1: section 0 is unused */
- dwp_file->num_sections = bfd_count_sections (dwp_file->dbfd) + 1;
+ dwp_file->num_sections = elf_numsections (dwp_file->dbfd);
dwp_file->elf_sections =
OBSTACK_CALLOC (&objfile->objfile_obstack,
dwp_file->num_sections, asection *);
return type;
}
+/* Initialise and return a floating point type of size BITS suitable for
+ use as a component of a complex number. The NAME_HINT is passed through
+ when initialising the floating point type and is the name of the complex
+ type.
+
+ As DWARF doesn't currently provide an explicit name for the components
+ of a complex number, but it can be helpful to have these components
+ named, we try to select a suitable name based on the size of the
+ component. */
+static struct type *
+dwarf2_init_complex_target_type (struct dwarf2_cu *cu,
+ struct objfile *objfile,
+ int bits, const char *name_hint)
+{
+ gdbarch *gdbarch = get_objfile_arch (objfile);
+ struct type *tt = nullptr;
+
+ switch (bits)
+ {
+ case 32:
+ tt = builtin_type (gdbarch)->builtin_float;
+ break;
+ case 64:
+ tt = builtin_type (gdbarch)->builtin_double;
+ break;
+ case 128:
+ tt = builtin_type (gdbarch)->builtin_long_double;
+ break;
+ }
+
+ const char *name = (tt == nullptr) ? nullptr : TYPE_NAME (tt);
+ return dwarf2_init_float_type (objfile, bits, name, name_hint);
+}
+
/* Find a representation of a given base type and install
it in the TYPE field of the die. */
type = init_boolean_type (objfile, bits, 1, name);
break;
case DW_ATE_complex_float:
- type = dwarf2_init_float_type (objfile, bits / 2, NULL, name);
+ type = dwarf2_init_complex_target_type (cu, objfile, bits / 2, name);
type = init_complex_type (objfile, name, type);
break;
case DW_ATE_decimal_float:
main_subprogram = DW_UNSND (&attr);
break;
+ case DW_AT_ranges:
+ {
+ /* It would be nice to reuse dwarf2_get_pc_bounds here,
+ but that requires a full DIE, so instead we just
+ reimplement it. */
+ int need_ranges_base = tag != DW_TAG_compile_unit;
+ unsigned int ranges_offset = (DW_UNSND (&attr)
+ + (need_ranges_base
+ ? cu->ranges_base
+ : 0));
+
+ /* Value of the DW_AT_ranges attribute is the offset in the
+ .debug_ranges section. */
+ if (dwarf2_ranges_read (ranges_offset, &lowpc, &highpc, cu,
+ nullptr))
+ has_pc_info = 1;
+ }
+ break;
+
default:
break;
}
}
else
{
- this_cu = dwarf2_per_objfile->all_comp_units[low];
if (low == dwarf2_per_objfile->all_comp_units.size () - 1
&& sect_off >= this_cu->sect_off + this_cu->length)
error (_("invalid dwarf2 offset %s"), sect_offset_str (sect_off));