+ if (debug_bfd == NULL)
+ {
+ if (separate_debug_file_debug)
+ printf_unfiltered (_(" no, unable to open.\n"));
+
+ return {};
+ }
+
+ if (!build_id_verify (debug_bfd.get(), build_id_len, build_id))
+ {
+ if (separate_debug_file_debug)
+ printf_unfiltered (_(" no, build-id does not match.\n"));
+
+ return {};
+ }
+
+ if (separate_debug_file_debug)
+ printf_unfiltered (_(" yes!\n"));
+
+ return debug_bfd;
+}
+
+/* Common code for finding BFDs of a given build-id. This function
+ works with both debuginfo files (SUFFIX == ".debug") and executable
+ files (SUFFIX == ""). */
+
+static gdb_bfd_ref_ptr
+build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
+ const char *suffix)
+{