diff --git a/gdb/build-id.c b/gdb/build-id.c
--- a/gdb/build-id.c
+++ b/gdb/build-id.c
-@@ -35,6 +35,8 @@
- #include "elf/common.h"
- #include "elf-bfd.h"
- #include <sys/stat.h>
-+#include "elf/external.h"
+@@ -33,6 +33,7 @@
+ #include "gdb_bfd.h"
+ #include "gdbcmd.h"
+ #include "gdbcore.h"
+#include "inferior.h"
-
- #define BUILD_ID_VERBOSE_NONE 0
- #define BUILD_ID_VERBOSE_FILENAMES 1
-@@ -700,8 +702,366 @@ build_id_to_filename (const struct bfd_build_id *build_id, char **link_return)
+ #include "libbfd.h"
+ #include "objfiles.h"
+ #include "observable.h"
+@@ -698,8 +699,359 @@ build_id_to_filename (const struct bfd_build_id *build_id, char **link_return)
return result;
}
+ return count;
+}
+
-+static int
-+missing_rpm_list_compar (const char *const *ap, const char *const *bp)
++static bool
++missing_rpm_list_compar (const char *ap, const char *bp)
+{
-+ return strcoll (*ap, *bp);
++ return strcoll (ap, bp) < 0;
+}
+
+/* It returns a NULL-terminated array of strings needing to be FREEd. It may
+static void
+missing_rpm_list_print (void)
+{
-+ char **array, **array_iter;
+ struct missing_rpm *list_iter;
-+ struct cleanup *cleanups;
+
+ if (missing_rpm_list_entries == 0)
+ return;
+
-+ array = (char **) xmalloc (sizeof (*array) * missing_rpm_list_entries);
-+ cleanups = make_cleanup (xfree, array);
++ std::vector<const char *> array (missing_rpm_list_entries);
++ size_t idx = 0;
+
-+ array_iter = array;
+ for (list_iter = missing_rpm_list; list_iter != NULL;
+ list_iter = list_iter->next)
+ {
-+ *array_iter++ = list_iter->rpm;
++ array[idx++] = list_iter->rpm;
+ }
-+ gdb_assert (array_iter == array + missing_rpm_list_entries);
++ gdb_assert (idx == missing_rpm_list_entries);
+
-+ qsort (array, missing_rpm_list_entries, sizeof (*array),
-+ (int (*) (const void *, const void *)) missing_rpm_list_compar);
++ std::sort (array.begin (), array.end (), missing_rpm_list_compar);
+
+ printf_unfiltered (_("Missing separate debuginfos, use: %s"),
+#ifdef DNF_DEBUGINFO_INSTALL
+ "dnf "
+#endif
+ "debuginfo-install");
-+ for (array_iter = array; array_iter < array + missing_rpm_list_entries;
-+ array_iter++)
++ for (const char *el : array)
+ {
+ putchar_unfiltered (' ');
-+ puts_unfiltered (*array_iter);
++ puts_unfiltered (el);
+ }
+ putchar_unfiltered ('\n');
+
+ xfree (list_iter);
+ }
+ missing_rpm_list_entries = 0;
-+
-+ do_cleanups (cleanups);
+}
+
+static void
avoidance. */
struct missing_filepair
-@@ -755,11 +1115,17 @@ missing_filepair_change (void)
+@@ -753,11 +1105,17 @@ missing_filepair_change (void)
/* All their memory came just from missing_filepair_OBSTACK. */
missing_filepair_hash = NULL;
}
missing_filepair_change ();
}
-@@ -826,14 +1192,39 @@ debug_print_missing (const char *binary, const char *debug)
+@@ -824,14 +1182,38 @@ debug_print_missing (const char *binary, const char *debug)
*slot = missing_filepair;
+#ifdef HAVE_LIBRPM
+ if (missing_exec == MISSING_EXEC_NOT_TRIED)
+ {
-+ char *execfilename;
++ const char *execfilename = get_exec_file (0);
- fprintf_unfiltered (gdb_stdlog,
- _("Missing separate debuginfo for %s\n"), binary);
- if (debug != NULL)
- fprintf_unfiltered (gdb_stdlog, _("Try to install the hash file %s\n"),
- debug);
-+ execfilename = get_exec_file (0);
+ if (execfilename != NULL)
+ {
+ if (missing_rpm_enlist (execfilename) == 0)
diff --git a/gdb/config.in b/gdb/config.in
--- a/gdb/config.in
+++ b/gdb/config.in
-@@ -33,6 +33,9 @@
+@@ -36,6 +36,9 @@
/* Define to BFD's default target vector. */
#undef DEFAULT_BFD_VEC
/* Define to 1 if translation of program messages to the user's native
language is requested. */
#undef ENABLE_NLS
-@@ -255,6 +258,9 @@
- /* Define if Python 2.7 is being used. */
- #undef HAVE_LIBPYTHON2_7
+@@ -245,6 +248,9 @@
+ /* Define if you have the mpfr library. */
+ #undef HAVE_LIBMPFR
+/* Define if librpm library is being used. */
+#undef HAVE_LIBRPM
diff --git a/gdb/configure b/gdb/configure
--- a/gdb/configure
+++ b/gdb/configure
-@@ -751,6 +751,11 @@ CODESIGN_CERT
+@@ -761,6 +761,11 @@ CODESIGN_CERT
HAVE_NATIVE_GCORE_TARGET
TARGET_OBS
subdirs
GDB_DATADIR
DEBUGDIR
MAKEINFO_EXTRA_FLAGS
-@@ -855,6 +860,7 @@ with_gdb_datadir
+@@ -864,6 +869,7 @@ with_gdb_datadir
with_relocated_sources
with_auto_load_dir
with_auto_load_safe_path
enable_targets
enable_64_bit_bfd
enable_gdbmi
-@@ -914,6 +920,11 @@ CCC
+@@ -926,6 +932,11 @@ CCC
CPP
MAKEINFO
MAKEINFOFLAGS
YACC
YFLAGS
XMKMF'
-@@ -1585,6 +1596,8 @@ Optional Packages:
+@@ -1598,6 +1609,8 @@ Optional Packages:
[--with-auto-load-dir]
--without-auto-load-safe-path
do not restrict auto-loaded files locations
--with-libunwind-ia64 use libunwind frame unwinding for ia64 targets
--with-curses use the curses library instead of the termcap
library
-@@ -1642,6 +1655,13 @@ Some influential environment variables:
+@@ -1661,6 +1674,13 @@ Some influential environment variables:
MAKEINFO Parent configure detects if it is of sufficient version.
MAKEINFOFLAGS
Parameters for MAKEINFO.
YACC The `Yet Another Compiler Compiler' implementation to use.
Defaults to the first program found out of: `bison -y', `byacc',
`yacc'.
-@@ -6623,6 +6643,494 @@ _ACEOF
+@@ -6587,6 +6607,494 @@ _ACEOF
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_auto_load_safe_path" >&5
$as_echo "$with_auto_load_safe_path" >&6; }
diff --git a/gdb/configure.ac b/gdb/configure.ac
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
-@@ -166,6 +166,199 @@ AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escape_dir,
+@@ -144,6 +144,199 @@ AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escape_dir,
[Directories safe to hold auto-loaded files.])
AC_MSG_RESULT([$with_auto_load_safe_path])
AC_CONFIG_SUBDIRS(testsuite)
# Check whether to support alternative target configurations
-diff --git a/gdb/corelow.c b/gdb/corelow.c
---- a/gdb/corelow.c
-+++ b/gdb/corelow.c
-@@ -365,7 +365,7 @@ build_id_locate_exec (int from_tty)
- symfile_objfile->flags |= OBJF_BUILD_ID_CORE_LOADED;
- }
- else
-- debug_print_missing (_("the main executable file"), build_id_filename);
-+ debug_print_missing (BUILD_ID_MAIN_EXECUTABLE_FILENAME, build_id_filename);
-
- do_cleanups (back_to);
-
diff --git a/gdb/event-top.c b/gdb/event-top.c
--- a/gdb/event-top.c
+++ b/gdb/event-top.c
-@@ -40,6 +40,7 @@
- #include "common/buffer.h"
+@@ -41,6 +41,7 @@
#include "ser-event.h"
#include "gdb_select.h"
+ #include "gdbsupport/gdb-sigmask.h"
+#include "symfile.h"
/* readline include files. */
#include "readline/readline.h"
-@@ -359,6 +360,8 @@ display_gdb_prompt (const char *new_prompt)
+@@ -363,6 +364,8 @@ display_gdb_prompt (const char *new_prompt)
/* Reset the nesting depth used when trace-commands is set. */
reset_command_nest_depth ();
/* Do not call the python hook on an explicit prompt change as
passed to this function, as this forms a secondary/local prompt,
IE, displayed but not set. */
-@@ -770,7 +773,10 @@ command_line_handler (gdb::unique_xmalloc_ptr<char> &&rl)
+@@ -772,7 +775,10 @@ command_line_handler (gdb::unique_xmalloc_ptr<char> &&rl)
command_handler (cmd);
if (ui->prompt_state != PROMPTED)
diff --git a/gdb/symfile.h b/gdb/symfile.h
--- a/gdb/symfile.h
+++ b/gdb/symfile.h
-@@ -534,6 +534,8 @@ void map_symbol_filenames (symbol_filename_ftype *fun, void *data,
+@@ -542,6 +542,8 @@ extern void generic_load (const char *args, int from_tty);
/* build-id support. */
extern struct bfd_build_id *build_id_addr_get (CORE_ADDR addr);
extern void debug_print_missing (const char *binary, const char *debug);