struct pending *m_local_symbols = nullptr;
};
-\f
+using buildsym_compunit_up = std::unique_ptr<buildsym_compunit>;
extern void add_symbol_to_list (struct symbol *symbol,
struct pending **listhead);
};
struct abbrev_table;
-typedef std::unique_ptr<struct abbrev_table> abbrev_table_up;
+using abbrev_table_up = std::unique_ptr<abbrev_table>;
/* Top level data structure to contain an abbreviation table.
}
cooked_index::cooked_index (dwarf2_per_objfile *per_objfile,
- std::unique_ptr<cooked_index_worker> &&worker)
+ cooked_index_worker_up &&worker)
: m_state (std::move (worker)),
m_per_bfd (per_objfile->per_bfd)
{
class cutu_reader;
+using cutu_reader_up = std::unique_ptr<cutu_reader>;
+
/* An instance of this is created when scanning DWARF to create a
cooked index. */
cutu_reader *get_reader (dwarf2_per_cu_data *per_cu);
/* Preserve READER by storing it in the local hash table. */
- cutu_reader *preserve (std::unique_ptr<cutu_reader> reader);
+ cutu_reader *preserve (cutu_reader_up reader);
/* Add an entry to the index. The arguments describe the entry; see
cooked-index.h. The new entry is returned. */
/* Install the current addrmap into the shard being constructed,
then transfer ownership of the index to the caller. */
- std::unique_ptr<cooked_index_shard> release ()
+ cooked_index_shard_up release ()
{
m_shard->install_addrmap (&m_addrmap);
return std::move (m_shard);
/* A hash table of cutu_reader objects. */
htab_up m_reader_hash;
/* The index shard that is being constructed. */
- std::unique_ptr<cooked_index_shard> m_shard;
+ cooked_index_shard_up m_shard;
/* Parent map for each CU that is read. */
parent_map m_parent_map;
thread-safe. run_on_main_thread could be used, but that would
mean the messages are printed after the prompt, which looks
weird. */
- using result_type = std::tuple<std::unique_ptr<cooked_index_shard>,
+ using result_type = std::tuple<cooked_index_shard_up,
complaint_collection,
std::vector<gdb_exception>,
parent_map>;
index_cache_store_context m_cache_store;
};
+using cooked_index_worker_up = std::unique_ptr<cooked_index_worker>;
+
/* The main index of DIEs.
The index is created by multiple threads. The overall process is
{
public:
cooked_index (dwarf2_per_objfile *per_objfile,
- std::unique_ptr<cooked_index_worker> &&worker);
+ cooked_index_worker_up &&worker);
~cooked_index () override;
DISABLE_COPY_AND_ASSIGN (cooked_index);
/* This tracks the current state. When this is nullptr, it means
that the state is CACHE_DONE -- it's important to note that only
the main thread may change the value of this pointer. */
- std::unique_ptr<cooked_index_worker> m_state;
+ cooked_index_worker_up m_state;
dwarf2_per_bfd *m_per_bfd;
};
private:
/* The symtab builder for this CU. This is only non-NULL when full
symbols are being read. */
- std::unique_ptr<buildsym_compunit> m_builder;
+ buildsym_compunit_up m_builder;
/* A set of pointers to dwarf2_per_cu_data objects for compilation
units referenced by this one. Only used during full symbol processing;
buildsym_compunit *get_builder ();
};
+using dwarf2_cu_up = std::unique_ptr<dwarf2_cu>;
+
#endif /* GDB_DWARF2_CU_H */
error (_("could not find '.gnu_debugaltlink' file for %s"),
bfd_get_filename (per_bfd->obfd));
- std::unique_ptr<struct dwz_file> result
- (new struct dwz_file (std::move (dwz_bfd)));
+ auto result = std::make_unique<dwz_file> (std::move (dwz_bfd));
for (asection *sec : gdb_bfd_sections (result->dwz_bfd))
locate_dwz_sections (per_objfile->objfile, result->dwz_bfd.get (),
/* If we loaded the index from an external file, this contains the
resources associated to the open file, memory mapping, etc. */
- std::unique_ptr<index_cache_resource> index_cache_res;
+ index_cache_resource_up index_cache_res;
/* Read a string at offset STR_OFFSET in the .debug_str section from
this dwz file. Throw an error if the offset is too large. If
const char *read_string (struct objfile *objfile, LONGEST str_offset);
};
+using dwz_file_up = std::unique_ptr<dwz_file>;
+
/* Return the separate '.dwz' debug file. If there is no
.gnu_debugaltlink section in the file, then the result depends on
REQUIRE: if REQUIRE is true, then error; if REQUIRE is false,
gdb::unique_xmalloc_ptr<char> m_fullname;
};
+using file_and_directory_up = std::unique_ptr<file_and_directory>;
+
#endif /* GDB_DWARF2_FILE_AND_DIR_H */
gdb::array_view<const gdb_byte>
index_cache::lookup_gdb_index (const bfd_build_id *build_id,
- std::unique_ptr<index_cache_resource> *resource)
+ index_cache_resource_up *resource)
{
if (!enabled ())
return {};
gdb::array_view<const gdb_byte>
index_cache::lookup_gdb_index (const bfd_build_id *build_id,
- std::unique_ptr<index_cache_resource> *resource)
+ index_cache_resource_up *resource)
{
return {};
}
virtual ~index_cache_resource () = 0;
};
+using index_cache_resource_up = std::unique_ptr<index_cache_resource>;
+
/* Information to be captured in the main thread, and to be used by worker
threads during store (). */
If no matching index file is found, return an empty array view. */
gdb::array_view<const gdb_byte>
lookup_gdb_index (const bfd_build_id *build_id,
- std::unique_ptr<index_cache_resource> *resource);
+ index_cache_resource_up *resource);
/* Return the number of cache hits. */
unsigned int n_hits () const
const char *m_comp_dir = nullptr;
};
-typedef std::unique_ptr<line_header> line_header_up;
+using line_header_up = std::unique_ptr<line_header>;
inline const char *
file_entry::include_dir (const line_header *lh) const
{ return nullptr; }
};
+using dwarf_scanner_base_up = std::unique_ptr<dwarf_scanner_base>;
+
#endif /* GDB_DWARF2_MAPPED_INDEX_H */
struct stmt_list_hash hash {};
};
+using type_unit_group_up = std::unique_ptr<type_unit_group>;
+
/* These sections are what may appear in a (real or virtual) DWO file. */
struct dwo_sections
htab_up tus;
};
+using dwo_file_up = std::unique_ptr<dwo_file>;
+
/* These sections are what may appear in a DWP file. */
struct dwp_sections
dwarf2_cu *existing_cu);
struct dwarf2_per_cu_data *m_this_cu;
- std::unique_ptr<dwarf2_cu> m_new_cu;
+ dwarf2_cu_up m_new_cu;
/* The ordinary abbreviation table. */
abbrev_table_up m_abbrev_table_holder;
static void queue_and_load_all_dwo_tus (dwarf2_cu *cu);
-/* A unique pointer to a dwo_file. */
-
-typedef std::unique_ptr<struct dwo_file> dwo_file_up;
-
static void process_cu_includes (dwarf2_per_objfile *per_objfile);
static void check_producer (struct dwarf2_cu *cu);
/* See dwarf2/read.h. */
void
-dwarf2_per_bfd::start_reading (std::unique_ptr<dwarf_scanner_base> new_table)
+dwarf2_per_bfd::start_reading (dwarf_scanner_base_up new_table)
{
gdb_assert (index_table == nullptr);
index_table = std::move (new_table);
/* Helper routine for get_type_unit_group.
Create the type_unit_group object used to hold one or more TUs. */
-static std::unique_ptr<type_unit_group>
+static type_unit_group_up
create_type_unit_group (struct dwarf2_cu *cu, sect_offset line_offset_struct)
{
auto tu_group = std::make_unique<type_unit_group> ();
if (*slot == nullptr)
{
sect_offset line_offset_struct = (sect_offset) line_offset;
- std::unique_ptr<type_unit_group> grp
- = create_type_unit_group (cu, line_offset_struct);
+ auto grp = create_type_unit_group (cu, line_offset_struct);
*slot = grp.release ();
++tu_stats->nr_symtabs;
}
}
cutu_reader *
-cooked_index_storage::preserve (std::unique_ptr<cutu_reader> reader)
+cooked_index_storage::preserve (cutu_reader_up reader)
{
m_abbrev_table_cache.add (reader->release_abbrev_table ());
if (new_reader.comp_unit_die == nullptr || new_reader.dummy_p)
return;
- std::unique_ptr<cutu_reader> copy
- (new cutu_reader (std::move (new_reader)));
+ auto copy = std::make_unique<cutu_reader> (std::move (new_reader));
reader = storage->preserve (std::move (copy));
}
{
/* Only handle the scanning results here. Complaints and exceptions
can only be dealt with on the main thread. */
- std::vector<std::unique_ptr<cooked_index_shard>> shards;
+ std::vector<cooked_index_shard_up> shards;
for (auto &one_result : m_results)
{
By convention the name of the DWP file is ${objfile}.dwp.
The result is NULL if it can't be found. */
-static std::unique_ptr<struct dwp_file>
+static dwp_file_up
open_and_init_dwp_file (dwarf2_per_objfile *per_objfile)
{
struct objfile *objfile = per_objfile->objfile;
{
dwarf_read_debug_printf ("DWP file not found: %s", dwp_name.c_str ());
- return std::unique_ptr<dwp_file> ();
+ return dwp_file_up ();
}
const char *name = bfd_get_filename (dbfd.get ());
- std::unique_ptr<struct dwp_file> dwp_file
- (new struct dwp_file (name, std::move (dbfd)));
+ auto dwp_file = std::make_unique<struct dwp_file> (name, std::move (dbfd));
dwp_file->num_sections = elf_numsections (dwp_file->dbfd);
dwp_file->elf_sections =
prepare_one_comp_unit (new_reader.cu, new_reader.comp_unit_die,
language_minimal);
- std::unique_ptr<cutu_reader> copy
- (new cutu_reader (std::move (new_reader)));
+ auto copy = std::make_unique<cutu_reader> (std::move (new_reader));
result = m_index_storage->preserve (std::move (copy));
}
/* Set the index table early so that sharing works even while
scanning; and then start the scanning. */
dwarf2_per_bfd *per_bfd = per_objfile->per_bfd;
- std::unique_ptr<cooked_index_worker> worker
- = std::make_unique<cooked_index_worker_debug_info> (per_objfile);
+ auto worker = std::make_unique<cooked_index_worker_debug_info> (per_objfile);
per_bfd->start_reading (std::make_unique<cooked_index> (per_objfile,
std::move (worker)));
}
void
dwarf2_per_objfile::set_cu (dwarf2_per_cu_data *per_cu,
- std::unique_ptr<dwarf2_cu> cu)
+ dwarf2_cu_up cu)
{
gdb_assert (this->get_cu (per_cu) == nullptr);
#include "dwarf2/mapped-index.h"
#include "dwarf2/section.h"
#include "dwarf2/cu.h"
+#include "dwarf2/dwz.h"
#include "gdbsupport/gdb_obstack.h"
#include "gdbsupport/function-view.h"
#include "gdbsupport/packed.h"
/* A specialization of unique_ptr for dwarf2_per_cu_data and
subclasses. */
-typedef std::unique_ptr<dwarf2_per_cu_data, dwarf2_per_cu_data_deleter>
- dwarf2_per_cu_data_up;
+using dwarf2_per_cu_data_up
+ = std::unique_ptr<dwarf2_per_cu_data, dwarf2_per_cu_data_deleter>;
/* Persistent data held for a compilation unit, even when not
processing it. We put a pointer to this structure in the
don't need to re-examine the DWO in some situations. This may be
nullptr, depending on the CU; for example a partial unit won't
have one. */
- std::unique_ptr<file_and_directory> fnd;
+ file_and_directory_up fnd;
/* The file table. This can be NULL if there was no file table
or it's currently not read in.
using signatured_type_up = std::unique_ptr<signatured_type>;
+struct dwp_file;
+
+using dwp_file_up = std::unique_ptr<dwp_file>;
+
/* Some DWARF data can be shared across objfiles who share the same BFD,
this data is stored in this object.
/* Set the 'index_table' member and then call start_reading on
it. */
- void start_reading (std::unique_ptr<dwarf_scanner_base> new_table);
+ void start_reading (dwarf_scanner_base_up new_table);
private:
/* This function is mapped across the sections and remembers the
bool dwp_checked = false;
/* The DWP file if there is one, or NULL. */
- std::unique_ptr<struct dwp_file> dwp_file;
+ dwp_file_up dwp_file;
/* The shared '.dwz' file, if one exists. This is used when the
original data was compressed using 'dwz -m'. */
- std::optional<std::unique_ptr<struct dwz_file>> dwz_file;
+ std::optional<dwz_file_up> dwz_file;
/* Whether copy relocations are supported by this object format. */
bool can_copy;
bool has_section_at_zero = false;
/* The mapped index, or NULL in the readnow case. */
- std::unique_ptr<dwarf_scanner_base> index_table;
+ dwarf_scanner_base_up index_table;
/* When using index_table, this keeps track of all quick_file_names entries.
TUs typically share line table entries with a CU, so we maintain a
/* If we loaded the index from an external file, this contains the
resources associated to the open file, memory mapping, etc. */
- std::unique_ptr<index_cache_resource> index_cache_res;
+ index_cache_resource_up index_cache_res;
/* Mapping from abstract origin DIE to concrete DIEs that reference it as
DW_AT_abstract_origin. */
struct symtab **symtabs = nullptr;
};
+using type_unit_group_unshareable_up
+ = std::unique_ptr<type_unit_group_unshareable>;
+
struct per_cu_and_offset
{
dwarf2_per_cu_data *per_cu;
dwarf2_cu *get_cu (dwarf2_per_cu_data *per_cu);
/* Set the dwarf2_cu matching PER_CU for this objfile. */
- void set_cu (dwarf2_per_cu_data *per_cu, std::unique_ptr<dwarf2_cu> cu);
+ void set_cu (dwarf2_per_cu_data *per_cu, dwarf2_cu_up cu);
/* Remove/free the dwarf2_cu matching PER_CU for this objfile. */
void remove_cu (dwarf2_per_cu_data *per_cu);
that the CU/TU has not been expanded yet. */
std::vector<compunit_symtab *> m_symtabs;
- /* Map from a type unit group to the corresponding unshared
- structure. */
- typedef std::unique_ptr<type_unit_group_unshareable>
- type_unit_group_unshareable_up;
-
+ /* Map from a type unit group to the corresponding unshared
+ structure. */
std::unordered_map<type_unit_group *, type_unit_group_unshareable_up>
m_type_units;
/* Map from the objfile-independent dwarf2_per_cu_data instances to the
corresponding objfile-dependent dwarf2_cu instances. */
- std::unordered_map<dwarf2_per_cu_data *,
- std::unique_ptr<dwarf2_cu>> m_dwarf2_cus;
+ std::unordered_map<dwarf2_per_cu_data *, dwarf2_cu_up> m_dwarf2_cus;
};
/* Converts DWARF language names to GDB language names. */