/* Size of .debug_rnglists section header for 64-bit DWARF format. */
#define RNGLIST_HEADER_SIZE64 20
-/* An index into a (C++) symbol name component in a symbol name as
- recorded in the mapped_index's symbol table. For each C++ symbol
- in the symbol table, we record one entry for the start of each
- component in the symbol in a table of name components, and then
- sort the table, in order to be able to binary search symbol names,
- ignoring leading namespaces, both completion and regular look up.
- For example, for symbol "A::B::C", we'll have an entry that points
- to "A::B::C", another that points to "B::C", and another for "C".
- Note that function symbols in GDB index have no parameter
- information, just the function/method names. You can convert a
- name_component to a "const char *" using the
- 'mapped_index::symbol_name_at(offset_type)' method. */
-
-struct name_component
-{
- /* Offset in the symbol name where the component starts. Stored as
- a (32-bit) offset instead of a pointer to save memory and improve
- locality on 64-bit architectures. */
- offset_type name_offset;
-
- /* The symbol's index in the symbol and constant pool tables of a
- mapped_index. */
- offset_type idx;
-};
-
-/* Base class containing bits shared by both .gdb_index and
- .debug_name indexes. */
-
-struct mapped_index_base
-{
- mapped_index_base () = default;
- DISABLE_COPY_AND_ASSIGN (mapped_index_base);
-
- /* The name_component table (a sorted vector). See name_component's
- description above. */
- std::vector<name_component> name_components;
-
- /* How NAME_COMPONENTS is sorted. */
- enum case_sensitivity name_components_casing;
-
- /* Return the number of names in the symbol table. */
- virtual size_t symbol_name_count () const = 0;
-
- /* Get the name of the symbol at IDX in the symbol table. */
- virtual const char *symbol_name_at
- (offset_type idx, dwarf2_per_objfile *per_objfile) const = 0;
-
- /* Return whether the name at IDX in the symbol table should be
- ignored. */
- virtual bool symbol_name_slot_invalid (offset_type idx) const
- {
- return false;
- }
-
- /* Build the symbol name component sorted vector, if we haven't
- yet. */
- void build_name_components (dwarf2_per_objfile *per_objfile);
-
- /* Returns the lower (inclusive) and upper (exclusive) bounds of the
- possible matches for LN_NO_PARAMS in the name component
- vector. */
- std::pair<std::vector<name_component>::const_iterator,
- std::vector<name_component>::const_iterator>
- find_name_components_bounds (const lookup_name_info &ln_no_params,
- enum language lang,
- dwarf2_per_objfile *per_objfile) const;
-
- /* Prevent deleting/destroying via a base class pointer. */
-protected:
- ~mapped_index_base() = default;
-};
-
/* This is a view into the index that converts from bytes to an
offset_type, and allows indexing. Unaligned bytes are specifically
allowed here, and handled via unpacking. */
size_t symbol_name_count () const override
{ return this->symbol_table.size () / 2; }
+
+ quick_symbol_functions_up make_quick_functions () const override;
+
+ bool version_check () const override
+ {
+ return version >= 8;
+ }
};
/* A description of the mapped .debug_names.
size_t symbol_name_count () const override
{ return this->name_count; }
+
+ quick_symbol_functions_up make_quick_functions () const override;
};
/* See dwarf2/read.h. */
(const struct line_header *lh,
const file_entry &fe,
const file_and_directory &cu_info,
- gdb::unique_xmalloc_ptr<char> *name_holder);
+ std::string &name_holder);
static htab_up allocate_signatured_type_table ();
bool need_fullname) override;
};
+/* With OBJF_READNOW, the DWARF reader expands all CUs immediately.
+ It's handy in this case to have an empty implementation of the
+ quick symbol functions, to avoid special cases in the rest of the
+ code. */
+
+struct readnow_functions : public dwarf2_base_index_functions
+{
+ void dump (struct objfile *objfile) override
+ {
+ }
+
+ void expand_matching_symbols
+ (struct objfile *,
+ const lookup_name_info &lookup_name,
+ domain_enum domain,
+ int global,
+ symbol_compare_ftype *ordered_compare) override
+ {
+ }
+
+ bool expand_symtabs_matching
+ (struct objfile *objfile,
+ gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
+ const lookup_name_info *lookup_name,
+ gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
+ gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
+ block_search_flags search_flags,
+ domain_enum domain,
+ enum search_domain kind) override
+ {
+ return true;
+ }
+};
+
struct dwarf2_gdb_index : public dwarf2_base_index_functions
{
void dump (struct objfile *objfile) override;
enum search_domain kind) override;
};
-static quick_symbol_functions_up
-make_dwarf_gdb_index ()
+quick_symbol_functions_up
+mapped_index::make_quick_functions () const
{
return quick_symbol_functions_up (new dwarf2_gdb_index);
}
-static quick_symbol_functions_up
-make_dwarf_debug_names ()
+quick_symbol_functions_up
+mapped_debug_names::make_quick_functions () const
{
return quick_symbol_functions_up (new dwarf2_debug_names_index);
}
&& cu != NULL
&& cu->dwo_unit != NULL
&& per_objfile->per_bfd->index_table != NULL
- && per_objfile->per_bfd->index_table->version <= 7
+ && !per_objfile->per_bfd->index_table->version_check ()
/* DWP files aren't supported yet. */
&& get_dwp_file (per_objfile) == NULL)
queue_and_load_all_dwo_tus (cu);
bytes. */
addr += (entry_end - addr) % (2 * address_size);
- for (;;)
+ while (addr < entry_end)
{
if (addr + 2 * address_size > entry_end)
{
dwarf5_byte_order);
addr += address_size;
if (start == 0 && length == 0)
- break;
+ {
+ /* This can happen on some targets with --gc-sections.
+ This pair of values is also used to mark the end of
+ the entries for a given CU, but we ignore it and
+ instead handle termination using the check at the top
+ of the loop. */
+ continue;
+ }
if (start == 0 && !per_bfd->has_section_at_zero)
{
/* Symbol was eliminated due to a COMDAT group. */
{
for (const auto &entry : lh->file_names ())
{
- gdb::unique_xmalloc_ptr<char> name_holder;
+ std::string name_holder;
const char *include_name =
- compute_include_file_name (lh.get (), entry, fnd, &name_holder);
+ compute_include_file_name (lh.get (), entry, fnd, name_holder);
if (include_name != nullptr)
{
include_name = per_objfile->objfile->intern (include_name);
dw2_symtab_iter_init (struct dw2_symtab_iterator *iter,
dwarf2_per_objfile *per_objfile,
gdb::optional<block_enum> block_index,
- domain_enum domain, offset_type namei)
+ domain_enum domain, offset_type namei,
+ mapped_index &index)
{
iter->per_objfile = per_objfile;
iter->block_index = block_index;
iter->vec = {};
iter->length = 0;
- mapped_index *index = per_objfile->per_bfd->index_table.get ();
- /* index is NULL if OBJF_READNOW. */
- if (index == NULL)
- return;
-
- gdb_assert (!index->symbol_name_slot_invalid (namei));
- offset_type vec_idx = index->symbol_vec_index (namei);
+ gdb_assert (!index.symbol_name_slot_invalid (namei));
+ offset_type vec_idx = index.symbol_vec_index (namei);
- iter->vec = offset_view (index->constant_pool.slice (vec_idx));
+ iter->vec = offset_view (index.constant_pool.slice (vec_idx));
iter->length = iter->vec[0];
}
/* Return the next matching CU or NULL if there are no more. */
static struct dwarf2_per_cu_data *
-dw2_symtab_iter_next (struct dw2_symtab_iterator *iter)
+dw2_symtab_iter_next (struct dw2_symtab_iterator *iter,
+ mapped_index &index)
{
dwarf2_per_objfile *per_objfile = iter->per_objfile;
Indices prior to version 7 don't record them,
and indices >= 7 may elide them for certain symbols
(gold does this). */
- int attrs_valid =
- (per_objfile->per_bfd->index_table->version >= 7
- && symbol_kind != GDB_INDEX_SYMBOL_KIND_NONE);
+ int attrs_valid = (index.version >= 7
+ && symbol_kind != GDB_INDEX_SYMBOL_KIND_NONE);
/* Don't crash on bad data. */
if (cu_index >= per_objfile->per_bfd->all_comp_units.size ())
{
dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
- gdb_printf (".gdb_index:");
- if (per_objfile->per_bfd->index_table != NULL)
- {
- gdb_printf (" version %d\n",
- per_objfile->per_bfd->index_table->version);
- }
- else
- gdb_printf (" faked for \"readnow\"\n");
+ mapped_index *index = (static_cast<mapped_index *>
+ (per_objfile->per_bfd->index_table.get ()));
+ gdb_printf (".gdb_index: version %d\n", index->version);
gdb_printf ("\n");
}
const block_enum block_kind = global ? GLOBAL_BLOCK : STATIC_BLOCK;
- if (per_objfile->per_bfd->index_table != nullptr)
- {
- mapped_index &index = *per_objfile->per_bfd->index_table;
+ mapped_index &index
+ = (static_cast<mapped_index &>
+ (*per_objfile->per_bfd->index_table.get ()));
- const char *match_name = name.ada ().lookup_name ().c_str ();
- auto matcher = [&] (const char *symname)
- {
- if (ordered_compare == nullptr)
- return true;
- return ordered_compare (symname, match_name) == 0;
- };
+ const char *match_name = name.ada ().lookup_name ().c_str ();
+ auto matcher = [&] (const char *symname)
+ {
+ if (ordered_compare == nullptr)
+ return true;
+ return ordered_compare (symname, match_name) == 0;
+ };
- dw2_expand_symtabs_matching_symbol (index, name, matcher,
- [&] (offset_type namei)
- {
- struct dw2_symtab_iterator iter;
- struct dwarf2_per_cu_data *per_cu;
-
- dw2_symtab_iter_init (&iter, per_objfile, block_kind, domain,
- namei);
- while ((per_cu = dw2_symtab_iter_next (&iter)) != NULL)
- dw2_expand_symtabs_matching_one (per_cu, per_objfile, nullptr,
- nullptr);
- return true;
- }, per_objfile);
- }
- else
+ dw2_expand_symtabs_matching_symbol (index, name, matcher,
+ [&] (offset_type namei)
{
- /* We have -readnow: no .gdb_index, but no partial symtabs either. So,
- proceed assuming all symtabs have been read in. */
- }
+ struct dw2_symtab_iterator iter;
+ struct dwarf2_per_cu_data *per_cu;
+
+ dw2_symtab_iter_init (&iter, per_objfile, block_kind, domain, namei,
+ index);
+ while ((per_cu = dw2_symtab_iter_next (&iter, index)) != NULL)
+ dw2_expand_symtabs_matching_one (per_cu, per_objfile, nullptr,
+ nullptr);
+ return true;
+ }, per_objfile);
}
/* Starting from a search name, return the string that finds the upper
return m_symbol_table[idx];
}
+ quick_symbol_functions_up make_quick_functions () const override
+ {
+ return nullptr;
+ }
+
private:
gdb::array_view<const char *> m_symbol_table;
};
{
offset_type vec_len, vec_idx;
bool global_seen = false;
- mapped_index &index = *per_objfile->per_bfd->index_table;
+ mapped_index &index
+ = (static_cast<mapped_index &>
+ (*per_objfile->per_bfd->index_table.get ()));
offset_view vec (index.constant_pool.slice (index.symbol_vec_index (idx)));
vec_len = vec[0];
{
dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
- /* index_table is NULL if OBJF_READNOW. */
- if (!per_objfile->per_bfd->index_table)
- return true;
-
dw_expand_symtabs_matching_file_matcher (per_objfile, file_matcher);
/* This invariant is documented in quick-functions.h. */
return true;
}
- mapped_index &index = *per_objfile->per_bfd->index_table;
+ mapped_index &index
+ = (static_cast<mapped_index &>
+ (*per_objfile->per_bfd->index_table.get ()));
bool result
= dw2_expand_symtabs_matching_symbol (index, *lookup_name,
create_addrmap_from_aranges (per_objfile, &per_bfd->debug_aranges);
- per_bfd->debug_names_table = std::move (map);
+ per_bfd->index_table = std::move (map);
per_bfd->quick_file_names_table =
create_quick_file_names_table (per_bfd->all_comp_units.size ());
void
dwarf2_debug_names_index::dump (struct objfile *objfile)
{
- dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
-
- gdb_printf (".debug_names:");
- if (per_objfile->per_bfd->debug_names_table)
- gdb_printf (" exists\n");
- else
- gdb_printf (" faked for \"readnow\"\n");
- gdb_printf ("\n");
+ gdb_printf (".debug_names: exists\n");
}
void
{
dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
- /* debug_names_table is NULL if OBJF_READNOW. */
- if (!per_objfile->per_bfd->debug_names_table)
- return;
-
- mapped_debug_names &map = *per_objfile->per_bfd->debug_names_table;
+ mapped_debug_names &map
+ = (static_cast<mapped_debug_names &>
+ (*per_objfile->per_bfd->index_table.get ()));
const block_search_flags block_flags
= global ? SEARCH_GLOBAL_BLOCK : SEARCH_STATIC_BLOCK;
{
dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
- /* debug_names_table is NULL if OBJF_READNOW. */
- if (!per_objfile->per_bfd->debug_names_table)
- return true;
-
dw_expand_symtabs_matching_file_matcher (per_objfile, file_matcher);
/* This invariant is documented in quick-functions.h. */
return true;
}
- mapped_debug_names &map = *per_objfile->per_bfd->debug_names_table;
+ mapped_debug_names &map
+ = (static_cast<mapped_debug_names &>
+ (*per_objfile->per_bfd->index_table.get ()));
bool result
= dw2_expand_symtabs_matching_symbol (map, *lookup_name,
per_bfd->quick_file_names_table
= create_quick_file_names_table (per_bfd->all_comp_units.size ());
- /* Arrange for gdb to see the "quick" functions. However, these
- functions will be no-ops because we will have expanded all
- symtabs. */
- objfile->qf.push_front (make_dwarf_gdb_index ());
- return;
- }
-
- /* Was a debug names index already read when we processed an objfile sharing
- PER_BFD? */
- if (per_bfd->debug_names_table != nullptr)
- {
- dwarf_read_debug_printf ("re-using shared debug names table");
- objfile->qf.push_front (make_dwarf_debug_names ());
+ objfile->qf.emplace_front (new readnow_functions);
return;
}
PER_BFD? */
if (per_bfd->index_table != nullptr)
{
- dwarf_read_debug_printf ("re-using shared index table");
- objfile->qf.push_front (make_dwarf_gdb_index ());
- return;
- }
-
- if (per_bfd->cooked_index_table != nullptr)
- {
- dwarf_read_debug_printf ("re-using cooked index table");
- objfile->qf.push_front (make_cooked_index_funcs ());
+ dwarf_read_debug_printf ("re-using symbols");
+ objfile->qf.push_front (per_bfd->index_table->make_quick_functions ());
return;
}
if (dwarf2_read_debug_names (per_objfile))
{
dwarf_read_debug_printf ("found debug names");
- objfile->qf.push_front (make_dwarf_debug_names ());
+ objfile->qf.push_front
+ (per_bfd->index_table->make_quick_functions ());
return;
}
get_gdb_index_contents_from_section<dwz_file>))
{
dwarf_read_debug_printf ("found gdb index from file");
- objfile->qf.push_front (make_dwarf_gdb_index ());
+ objfile->qf.push_front (per_bfd->index_table->make_quick_functions ());
return;
}
{
dwarf_read_debug_printf ("found gdb index from cache");
global_index_cache.hit ();
- objfile->qf.push_front (make_dwarf_gdb_index ());
+ objfile->qf.push_front (per_bfd->index_table->make_quick_functions ());
return;
}
if (already_attached)
{
- if (per_objfile->per_bfd->cooked_index_table != nullptr)
+ if (per_objfile->per_bfd->index_table != nullptr)
return;
}
else
/* Ensure that complaints are handled correctly. */
complaint_interceptor complaint_handler;
- using iter_type = typeof (per_bfd->all_comp_units.begin ());
+ using iter_type = decltype (per_bfd->all_comp_units.begin ());
/* Each thread returns a pair holding a cooked index, and a vector
of errors that should be printed. The latter is done because
}),
indexes.end ());
indexes.shrink_to_fit ();
- per_bfd->cooked_index_table.reset
- (new cooked_index_vector (std::move (indexes)));
- const cooked_index_entry *main_entry
- = per_bfd->cooked_index_table->get_main ();
+ cooked_index_vector *vec = new cooked_index_vector (std::move (indexes));
+ per_bfd->index_table.reset (vec);
+
+ const cooked_index_entry *main_entry = vec->get_main ();
if (main_entry != nullptr)
set_objfile_main_name (objfile, main_entry->name,
main_entry->per_cu->lang);
struct objfile *objfile = cu->per_objfile->objfile;
if (strcmp (package_name.get (), this_package_name.get ()) != 0)
complaint (_("Symtab %s has objects from two different Go packages: %s and %s"),
- (symbol_symtab (sym) != NULL
+ (sym->symtab () != NULL
? symtab_to_filename_for_display
- (symbol_symtab (sym))
+ (sym->symtab ())
: objfile_name (objfile)),
this_package_name.get (), package_name.get ());
}
assume there's a simple mapping from
cu->line_header->file_names to subfiles, plus
cu->line_header->file_names may contain dups. */
- b->get_current_subfile ()->symtab
- = allocate_symtab (cust, b->get_current_subfile ()->name);
+ const char *name = b->get_current_subfile ()->name.c_str ();
+ b->get_current_subfile ()->symtab = allocate_symtab (cust, name);
}
fe.symtab = b->get_current_subfile ()->symtab;
if (comp_dir != NULL)
{
- gdb::unique_xmalloc_ptr<char> path_to_try
- (concat (comp_dir, SLASH_STRING, file_name, (char *) NULL));
+ std::string path_to_try = path_join (comp_dir, file_name);
/* NOTE: If comp_dir is a relative path, this will also try the
search path, which seems useful. */
- gdb_bfd_ref_ptr abfd (try_open_dwop_file (per_objfile, path_to_try.get (),
- 0 /*is_dwp*/,
- 1 /*search_cwd*/));
+ gdb_bfd_ref_ptr abfd (try_open_dwop_file
+ (per_objfile, path_to_try.c_str (), 0 /*is_dwp*/, 1 /*search_cwd*/));
+
if (abfd != NULL)
return abfd;
}
of gdb assume that symbols do, and this is reasonably
true. */
for (symbol *sym : template_args)
- symbol_set_symtab (sym, symbol_symtab (templ_func));
+ sym->set_symtab (templ_func->symtab ());
}
/* In C++, we can have functions nested inside functions (e.g., when
{
struct symtab *symtab;
if (sym != nullptr)
- symtab = symbol_symtab (sym);
+ symtab = sym->symtab ();
else if (cu->line_header != nullptr)
{
/* Any related symtab will do. */
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);
+ TYPE_TEMPLATE_ARGUMENT (type, i)->set_symtab (symtab);
}
}
}
int warn_if_readin)
{
dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
- if (per_objfile->per_bfd->cooked_index_table == nullptr)
+ if (per_objfile->per_bfd->index_table == nullptr)
return nullptr;
CORE_ADDR baseaddr = objfile->text_section_offset ();
- dwarf2_per_cu_data *per_cu
- = per_objfile->per_bfd->cooked_index_table->lookup (pc - baseaddr);
+ cooked_index_vector *table
+ = (static_cast<cooked_index_vector *>
+ (per_objfile->per_bfd->index_table.get ()));
+ dwarf2_per_cu_data *per_cu = table->lookup (pc - baseaddr);
if (per_cu == nullptr)
return nullptr;
return nullptr;
dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
- if (per_objfile->per_bfd->cooked_index_table == nullptr)
+ if (per_objfile->per_bfd->index_table == nullptr)
return nullptr;
CORE_ADDR baseaddr = objfile->data_section_offset ();
- dwarf2_per_cu_data *per_cu
- = per_objfile->per_bfd->cooked_index_table->lookup (address - baseaddr);
+ cooked_index_vector *table
+ = (static_cast<cooked_index_vector *>
+ (per_objfile->per_bfd->index_table.get ()));
+ dwarf2_per_cu_data *per_cu = table->lookup (address - baseaddr);
if (per_cu == nullptr)
return nullptr;
symbol_compare_ftype *ordered_compare)
{
dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
- if (per_objfile->per_bfd->cooked_index_table == nullptr)
+ if (per_objfile->per_bfd->index_table == nullptr)
return;
const block_search_flags search_flags = (global
? SEARCH_GLOBAL_BLOCK
symbol_name_matcher_ftype *name_match
= lang->get_symbol_name_matcher (lookup_name);
- for (const cooked_index_entry *entry
- : per_objfile->per_bfd->cooked_index_table->all_entries ())
+ cooked_index_vector *table
+ = (static_cast<cooked_index_vector *>
+ (per_objfile->per_bfd->index_table.get ()));
+ for (const cooked_index_entry *entry : table->all_entries ())
{
if (entry->parent_entry != nullptr)
continue;
enum search_domain kind)
{
dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
- if (per_objfile->per_bfd->cooked_index_table == nullptr)
+ if (per_objfile->per_bfd->index_table == nullptr)
return true;
dw_expand_symtabs_matching_file_matcher (per_objfile, file_matcher);
language_ada
};
+ cooked_index_vector *table
+ = (static_cast<cooked_index_vector *>
+ (per_objfile->per_bfd->index_table.get ()));
for (enum language lang : unique_styles)
{
std::vector<gdb::string_view> name_vec
= lookup_name_without_params.split_name (lang);
- for (const cooked_index_entry *entry
- : per_objfile->per_bfd->cooked_index_table->find (name_vec.back (),
- completing))
+ for (const cooked_index_entry *entry : table->find (name_vec.back (),
+ completing))
{
/* No need to consider symbols from expanded CUs. */
if (per_objfile->symtab_set_p (entry->per_cu))
return quick_symbol_functions_up (new cooked_index_functions);
}
+quick_symbol_functions_up
+cooked_index_vector::make_quick_functions () const
+{
+ return make_cooked_index_funcs ();
+}
+
\f
/* Read the .debug_loclists or .debug_rnglists header (they are the same format)
static const char *
compute_include_file_name (const struct line_header *lh, const file_entry &fe,
const file_and_directory &cu_info,
- gdb::unique_xmalloc_ptr<char> *name_holder)
+ std::string &name_holder)
{
const char *include_name = fe.name;
const char *include_name_to_compare = include_name;
const char *dir_name = fe.include_dir (lh);
- gdb::unique_xmalloc_ptr<char> hold_compare;
+ std::string hold_compare;
if (!IS_ABSOLUTE_PATH (include_name)
&& (dir_name != nullptr || cu_info.get_comp_dir () != nullptr))
{
if (dir_name != NULL)
{
- name_holder->reset (concat (dir_name, SLASH_STRING,
- include_name, (char *) NULL));
- include_name = name_holder->get ();
+ name_holder = path_join (dir_name, include_name);
+ include_name = name_holder.c_str ();
include_name_to_compare = include_name;
}
if (!IS_ABSOLUTE_PATH (include_name)
&& cu_info.get_comp_dir () != nullptr)
{
- hold_compare.reset (concat (cu_info.get_comp_dir (), SLASH_STRING,
- include_name, (char *) NULL));
- include_name_to_compare = hold_compare.get ();
+ hold_compare = path_join (cu_info.get_comp_dir (), include_name);
+ include_name_to_compare = hold_compare.c_str ();
}
}
- gdb::unique_xmalloc_ptr<char> copied_name;
+ std::string copied_name;
const char *cu_filename = cu_info.get_name ();
if (!IS_ABSOLUTE_PATH (cu_filename) && cu_info.get_comp_dir () != nullptr)
{
- copied_name.reset (concat (cu_info.get_comp_dir (), SLASH_STRING,
- cu_filename, (char *) NULL));
- cu_filename = copied_name.get ();
+ copied_name = path_join (cu_info.get_comp_dir (), cu_filename);
+ cu_filename = copied_name.c_str ();
}
if (FILENAME_CMP (include_name_to_compare, cu_filename) == 0)
{
gdb_printf (gdb_stdlog,
"Recording line %u, file %s, address %s\n",
- line, lbasename (subfile->name),
+ line, lbasename (subfile->name.c_str ()),
paddress (gdbarch, address));
}
{
gdb_printf (gdb_stdlog,
"Finishing current line, file %s, address %s\n",
- lbasename (subfile->name),
+ lbasename (subfile->name.c_str ()),
paddress (gdbarch, address));
}
{
builder->get_current_subfile ()->symtab
= allocate_symtab (cust,
- builder->get_current_subfile ()->name);
+ builder->get_current_subfile ()->name.c_str ());
}
fe.symtab = builder->get_current_subfile ()->symtab;
}
dwarf2_start_subfile (struct dwarf2_cu *cu, const char *filename,
const char *dirname)
{
- gdb::unique_xmalloc_ptr<char> copy;
+ std::string copy;
/* In order not to lose the line information directory,
we concatenate it to the filename when it makes sense.
if (!IS_ABSOLUTE_PATH (filename) && dirname != NULL)
{
- copy.reset (concat (dirname, SLASH_STRING, filename, (char *) NULL));
- filename = copy.get ();
+ copy = path_join (dirname, filename);
+ filename = copy.c_str ();
}
cu->get_builder ()->start_subfile (filename);
/* Handle DW_AT_artificial. */
attr = dwarf2_attr (die, DW_AT_artificial, cu);
if (attr != nullptr)
- sym->artificial = attr->as_boolean ();
+ sym->set_is_artificial (attr->as_boolean ());
/* Default assumptions.
Use the passed type or decode it from the die. */
if (fe == NULL)
complaint (_("file index out of range"));
else
- symbol_set_symtab (sym, fe->symtab);
+ sym->set_symtab (fe->symtab);
}
switch (die->tag)
/* For .gdb_index version 7 keep track of included TUs.
http://sourceware.org/bugzilla/show_bug.cgi?id=15021. */
if (per_objfile->per_bfd->index_table != NULL
- && per_objfile->per_bfd->index_table->version <= 7)
+ && !per_objfile->per_bfd->index_table->version_check ())
{
(*ref_cu)->per_cu->imported_symtabs_push (sig_cu->per_cu);
}