if (!IS_ABSOLUTE_PATH (filename.c_str ()))
{
- gdb::unique_xmalloc_ptr<char> abs
- = gdb_realpath (bfd_get_filename (per_bfd->obfd));
+ gdb::unique_xmalloc_ptr<char> abs = gdb_realpath (per_bfd->filename ());
filename = ldirname (abs.get ()) + SLASH_STRING + filename;
}
if (dwz_bfd == nullptr)
{
gdb::unique_xmalloc_ptr<char> alt_filename;
- const char *origname = bfd_get_filename (per_bfd->obfd);
-
- scoped_fd fd (debuginfod_debuginfo_query (buildid,
- buildid_len,
- origname,
- &alt_filename));
+ scoped_fd fd
+ = debuginfod_debuginfo_query (buildid, buildid_len,
+ per_bfd->filename (), &alt_filename);
if (fd.get () >= 0)
{
if (dwz_bfd == NULL)
error (_("could not find '.gnu_debugaltlink' file for %s"),
- bfd_get_filename (per_bfd->obfd));
+ per_bfd->filename ());
auto result = std::make_unique<dwz_file> (std::move (dwz_bfd));
const bfd_build_id *build_id = build_id_bfd_get (per_bfd->obfd);
if (build_id == nullptr)
{
- index_cache_debug ("objfile %s has no build id",
- bfd_get_filename (per_bfd->obfd));
+ index_cache_debug ("objfile %s has no build id", per_bfd->filename ());
m_enabled = false;
return;
}
catch (const gdb_exception_error &except)
{
index_cache_debug ("couldn't store index cache for objfile %s: %s",
- bfd_get_filename (per_bfd->obfd), except.what ());
+ per_bfd->filename (), except.what ());
m_enabled = false;
}
}
try
{
index_cache_debug ("writing index cache for objfile %s",
- bfd_get_filename (m_per_bfd->obfd));
+ m_per_bfd->filename ());
/* Write the index itself to the directory, using the build id as the
filename. */
catch (const gdb_exception_error &except)
{
index_cache_debug ("couldn't store index cache for objfile %s: %s",
- bfd_get_filename (m_per_bfd->obfd), except.what ());
+ m_per_bfd->filename (), except.what ());
}
}
error (_(DWARF_ERROR_PREFIX
"missing dwo_id for dwo_name %s"
" [in module %s]"),
- dwo_name, bfd_get_filename (per_cu->per_bfd->obfd));
+ dwo_name, per_cu->per_bfd->filename ());
dwo_unit = lookup_dwo_comp_unit (cu, dwo_name, comp_dir, *signature);
}
"Bad DWP V2 or V5 section info, doesn't fit in section %s"
" [in module %s]"),
sectp ? bfd_section_name (sectp) : "<unknown>",
- bfd_get_filename (per_bfd->obfd));
+ per_bfd->filename ());
}
result.virtual_offset = offset;
search_path = per_bfd->captured_debug_dir.c_str ();
/* Add the path for the executable binary to the list of search paths. */
- std::string objfile_dir = ldirname (bfd_get_filename (per_bfd->obfd));
+ std::string objfile_dir = ldirname (per_bfd->filename ());
search_path_holder.reset (concat (objfile_dir.c_str (),
dirname_separator_string,
search_path, nullptr));
error (_(DWARF_ERROR_PREFIX
"could not find CU containing offset %s [in module %s]"),
sect_offset_str (sect_off),
- bfd_get_filename (per_bfd->obfd));
+ per_bfd->filename ());
gdb_assert (per_bfd->all_units[low-1]->sect_off
<= sect_off);
DISABLE_COPY_AND_ASSIGN (dwarf2_per_bfd);
+ /* Return the filename of the BFD. */
+ const char *filename () const
+ { return bfd_get_filename (this->obfd); }
+
/* Return the CU given its index. */
dwarf2_per_cu_data *get_cu (int index) const
{