30#include "gdbsupport/pathstuff.h"
31#include "gdbsupport/scoped_fd.h"
38 if (
str.buffer == NULL)
39 error (_(
"DW_FORM_GNU_strp_alt used without .debug_str "
40 "section [in module %s]"),
41 bfd_get_filename (
dwz_bfd.get ()));
42 if (str_offset >=
str.size)
43 error (_(
"DW_FORM_GNU_strp_alt pointing outside of "
44 ".debug_str section [in module %s]"),
45 bfd_get_filename (
dwz_bfd.get ()));
46 gdb_assert (HOST_CHAR_BIT == 8);
47 if (
str.buffer[str_offset] ==
'\0')
49 return (
const char *) (
str.buffer + str_offset);
114 size_t dwz_pos =
filename.find (
"/.dwz/");
116 if (dwz_pos == std::string::npos)
122 gdb_assert (IS_DIR_SEPARATOR (
filename[dwz_pos]));
125 std::vector<gdb::unique_xmalloc_ptr<char>> debugdir_vec
128 for (
const gdb::unique_xmalloc_ptr<char> &debugdir : debugdir_vec)
147 std::string ddir = debugdir.get ();
157 if (!IS_DIR_SEPARATOR (ddir.back ()))
158 ddir += SLASH_STRING;
165 &&
filename.compare (0, ddir.size (), ddir) == 0)
170 std::string new_filename = ddir + &
filename[dwz_pos + 1];
195 bfd_size_type buildid_len_arg;
202 bfd_set_error (bfd_error_no_error);
203 gdb::unique_xmalloc_ptr<char> data
204 (bfd_get_alt_debug_link_info (per_bfd->
obfd,
205 &buildid_len_arg, &buildid));
208 if (bfd_get_error () == bfd_error_no_error)
212 error (_(
"could not read '.gnu_debugaltlink' section"));
214 error (_(
"could not read '.gnu_debugaltlink' section: %s"),
215 bfd_errmsg (bfd_get_error ()));
218 gdb::unique_xmalloc_ptr<bfd_byte> buildid_holder (buildid);
220 buildid_len = (size_t) buildid_len_arg;
224 if (!IS_ABSOLUTE_PATH (
filename.c_str ()))
226 gdb::unique_xmalloc_ptr<char> abs
227 = gdb_realpath (bfd_get_filename (per_bfd->
obfd));
253 gdb::unique_xmalloc_ptr<char> alt_filename;
254 const char *origname = bfd_get_filename (per_bfd->
obfd);
267 warning (_(
"File \"%s\" from debuginfod cannot be opened as bfd"),
268 alt_filename.get ());
275 error (_(
"could not find '.gnu_debugaltlink' file for %s"),
276 bfd_get_filename (per_bfd->
obfd));
278 std::unique_ptr<struct dwz_file> result
285 per_bfd->
dwz_file = std::move (result);
int build_id_verify(bfd *abfd, size_t check_len, const bfd_byte *check)
gdb_bfd_ref_ptr build_id_to_debug_bfd(size_t build_id_len, const bfd_byte *build_id)
scoped_fd debuginfod_debuginfo_query(const unsigned char *build_id, int build_id_len, const char *filename, gdb::unique_xmalloc_ptr< char > *destname)
std::string debug_file_directory
struct dwz_file * dwarf2_get_dwz_file(dwarf2_per_bfd *per_bfd, bool require)
static gdb_bfd_ref_ptr dwz_search_other_debugdirs(std::string &filename, bfd_byte *buildid, size_t buildid_len)
static void locate_dwz_sections(bfd *abfd, asection *sectp, dwz_file *dwz_file)
void gdb_bfd_record_inclusion(bfd *includer, bfd *includee)
gdb_bfd_ref_ptr gdb_bfd_open(const char *name, const char *target, int fd, bool warn_if_slow)
gdb::ref_ptr< struct bfd, gdb_bfd_ref_policy > gdb_bfd_ref_ptr
static gdb_bfd_section_range gdb_bfd_sections(bfd *abfd)
const struct dwarf2_debug_sections dwarf2_elf_names
struct dwarf2_section_names types
struct dwarf2_section_names gdb_index
struct dwarf2_section_names debug_names
struct dwarf2_section_names macro
struct dwarf2_section_names info
struct dwarf2_section_names str
struct dwarf2_section_names abbrev
struct dwarf2_section_names line
std::unique_ptr< struct dwz_file > dwz_file
bool matches(const char *name) const
const char * read_string(struct objfile *objfile, LONGEST str_offset)
const char * filename() const
std::string ldirname(const char *filename)