update_breakpoint_locations (b, sals, sals_end);
}
-struct build_id
- {
- size_t size;
- gdb_byte data[1];
- };
-
/* Locate NT_GNU_BUILD_ID from ABFD and return its content. */
-static struct build_id *
+static struct elf_build_id *
build_id_bfd_get (bfd *abfd)
{
- struct build_id *retval;
-
if (!bfd_check_format (abfd, bfd_object)
|| bfd_get_flavour (abfd) != bfd_target_elf_flavour
- || elf_tdata (abfd)->build_id == NULL)
+ || elf_tdata (abfd)->build_id == NULL
+ || elf_tdata (abfd)->build_id->u.i.size == 0)
return NULL;
- retval = xmalloc (sizeof *retval - 1 + elf_tdata (abfd)->build_id_size);
- retval->size = elf_tdata (abfd)->build_id_size;
- memcpy (retval->data, elf_tdata (abfd)->build_id, retval->size);
-
- return retval;
+ return &elf_tdata (abfd)->build_id->u.i;
}
/* Return if FILENAME has NT_GNU_BUILD_ID matching the CHECK value. */
static int
-build_id_verify (const char *filename, struct build_id *check)
+build_id_verify (const char *filename, struct elf_build_id *check)
{
bfd *abfd;
- struct build_id *found = NULL;
+ struct elf_build_id *found;
int retval = 0;
/* We expect to be silent on the non-existing files. */
gdb_bfd_unref (abfd);
- xfree (found);
-
return retval;
}
static char *
-build_id_to_debug_filename (struct build_id *build_id)
+build_id_to_debug_filename (struct elf_build_id *build_id)
{
char *link, *debugdir, *retval = NULL;
VEC (char_ptr) *debugdir_vec;
static char *
find_separate_debug_file_by_buildid (struct objfile *objfile)
{
- struct build_id *build_id;
+ struct elf_build_id *build_id;
build_id = build_id_bfd_get (objfile->obfd);
if (build_id != NULL)
char *build_id_name;
build_id_name = build_id_to_debug_filename (build_id);
- xfree (build_id);
/* Prevent looping on a stripped .debug file. */
if (build_id_name != NULL
&& filename_cmp (build_id_name, objfile->name) == 0)