+# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
+# serial 1 (pkg-config-0.24)
-+#
++#
+# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
+#
+# This program is free software; you can redistribute it and/or modify
+See the pkg-config man page for more details.])
+
+if test $pkg_failed = yes; then
-+ AC_MSG_RESULT([no])
++ AC_MSG_RESULT([no])
+ _PKG_SHORT_ERRORS_SUPPORTED
+ if test $_pkg_short_errors_supported = yes; then
+ $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
-+ else
++ else
+ $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
+ fi
+ # Put the nasty error message in config.log where it belongs
+_PKG_TEXT])[]dnl
+ ])
+elif test $pkg_failed = untried; then
-+ AC_MSG_RESULT([no])
++ AC_MSG_RESULT([no])
+ m4_default([$4], [AC_MSG_FAILURE(
+[The pkg-config script could not be found or is too old. Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
#include "gdbcmd.h"
#include "gdbcore.h"
+#include "inferior.h"
- #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)
+ #include "symfile.h"
+@@ -697,8 +698,374 @@ build_id_to_filename (const struct bfd_build_id *build_id, char **link_return)
return result;
}
+
+ /* Already failed the initialization before? */
+ if (init_tried)
-+ return 0;
++ return 0;
+ init_tried = 1;
+
+#ifdef DLOPEN_LIBRPM
+
+ std::sort (array.begin (), array.end (), missing_rpm_list_compar);
+
++ /* We zero out the number of missing RPMs here because of a nasty
++ bug (see RHBZ 1801974).
++
++ When we call 'puts_unfiltered' below, if pagination is on and if
++ the number of missing RPMs is big enough to trigger pagination,
++ we will end up in an infinite recursion. The call chain looks
++ like this:
++
++ missing_rpm_list_print -> puts_unfiltered -> fputs_maybe_filtered
++ -> prompt_for_continue -> display_gdb_prompt ->
++ debug_flush_missing -> missing_rpm_list_print ...
++
++ For this reason, we make sure MISSING_RPM_LIST_ENTRIES is zero
++ *before* calling any print function. */
++ missing_rpm_list_entries = 0;
++
+ printf_unfiltered (_("Missing separate debuginfos, use: %s"),
+#ifdef DNF_DEBUGINFO_INSTALL
+ "dnf "
+ "debuginfo-install");
+ for (const char *el : array)
+ {
-+ putchar_unfiltered (' ');
++ puts_unfiltered (" ");
+ puts_unfiltered (el);
+ }
-+ putchar_unfiltered ('\n');
++ puts_unfiltered ("\n");
+
+ while (missing_rpm_list != NULL)
+ {
+ missing_rpm_list = list_iter->next;
+ xfree (list_iter);
+ }
-+ missing_rpm_list_entries = 0;
+}
+
+static void
avoidance. */
struct missing_filepair
-@@ -753,11 +1105,17 @@ missing_filepair_change (void)
+@@ -752,11 +1119,17 @@ missing_filepair_change (void)
/* All their memory came just from missing_filepair_OBSTACK. */
missing_filepair_hash = NULL;
}
missing_filepair_change ();
}
-@@ -824,14 +1182,38 @@ debug_print_missing (const char *binary, const char *debug)
+@@ -823,14 +1196,38 @@ debug_print_missing (const char *binary, const char *debug)
*slot = missing_filepair;
diff --git a/gdb/config.in b/gdb/config.in
--- a/gdb/config.in
+++ b/gdb/config.in
-@@ -36,6 +36,9 @@
- /* Define to BFD's default target vector. */
- #undef DEFAULT_BFD_VEC
+@@ -39,6 +39,9 @@
+ /* Handle .ctf type-info sections */
+ #undef ENABLE_LIBCTF
+/* librpm version specific library name to dlopen. */
+#undef DLOPEN_LIBRPM
/* Define to 1 if translation of program messages to the user's native
language is requested. */
#undef ENABLE_NLS
-@@ -245,6 +248,9 @@
+@@ -247,6 +250,9 @@
/* Define if you have the mpfr library. */
#undef HAVE_LIBMPFR
diff --git a/gdb/configure b/gdb/configure
--- a/gdb/configure
+++ b/gdb/configure
-@@ -761,6 +761,11 @@ CODESIGN_CERT
+@@ -769,6 +769,11 @@ PKG_CONFIG
HAVE_NATIVE_GCORE_TARGET
TARGET_OBS
subdirs
GDB_DATADIR
DEBUGDIR
MAKEINFO_EXTRA_FLAGS
-@@ -864,6 +869,7 @@ with_gdb_datadir
+@@ -873,6 +878,7 @@ with_gdb_datadir
with_relocated_sources
with_auto_load_dir
with_auto_load_safe_path
enable_targets
enable_64_bit_bfd
enable_gdbmi
-@@ -926,6 +932,11 @@ CCC
- CPP
- MAKEINFO
- MAKEINFOFLAGS
-+PKG_CONFIG
-+PKG_CONFIG_PATH
-+PKG_CONFIG_LIBDIR
+@@ -949,6 +955,8 @@ PKG_CONFIG_PATH
+ PKG_CONFIG_LIBDIR
+ DEBUGINFOD_CFLAGS
+ DEBUGINFOD_LIBS
+RPM_CFLAGS
+RPM_LIBS
YACC
YFLAGS
XMKMF'
-@@ -1598,6 +1609,8 @@ Optional Packages:
- [--with-auto-load-dir]
- --without-auto-load-safe-path
+@@ -1621,6 +1629,8 @@ Optional Packages:
do not restrict auto-loaded files locations
+ --with-debuginfod Enable debuginfo lookups with debuginfod
+ (auto/yes/no)
+ --with-rpm query rpm database for missing debuginfos (yes/no,
+ def. auto=librpm.so)
--with-libunwind-ia64 use libunwind frame unwinding for ia64 targets
--with-curses use the curses library instead of the termcap
library
-@@ -1661,6 +1674,13 @@ Some influential environment variables:
- MAKEINFO Parent configure detects if it is of sufficient version.
- MAKEINFOFLAGS
- Parameters for MAKEINFO.
-+ PKG_CONFIG path to pkg-config utility
-+ PKG_CONFIG_PATH
-+ directories to add to pkg-config's search path
-+ PKG_CONFIG_LIBDIR
-+ path overriding pkg-config's built-in search path
+@@ -1702,6 +1712,8 @@ Some influential environment variables:
+ C compiler flags for DEBUGINFOD, overriding pkg-config
+ DEBUGINFOD_LIBS
+ linker flags for DEBUGINFOD, overriding pkg-config
+ RPM_CFLAGS C compiler flags for RPM, overriding pkg-config
+ RPM_LIBS linker flags for RPM, overriding pkg-config
YACC The `Yet Another Compiler Compiler' implementation to use.
Defaults to the first program found out of: `bison -y', `byacc',
`yacc'.
-@@ -6587,6 +6607,494 @@ _ACEOF
+@@ -6666,6 +6678,494 @@ _ACEOF
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_auto_load_safe_path" >&5
$as_echo "$with_auto_load_safe_path" >&6; }
+
+
+if test $pkg_failed = yes; then
-+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+
+ HAVE_LIBRPM=false
+elif test $pkg_failed = untried; then
-+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ HAVE_LIBRPM=false
+else
diff --git a/gdb/configure.ac b/gdb/configure.ac
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
-@@ -144,6 +144,199 @@ AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escape_dir,
+@@ -143,6 +143,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])
+ fi
+ fi
+fi
-+
++
AC_CONFIG_SUBDIRS(testsuite)
# Check whether to support alternative target configurations
diff --git a/gdb/event-top.c b/gdb/event-top.c
--- a/gdb/event-top.c
+++ b/gdb/event-top.c
-@@ -41,6 +41,7 @@
- #include "ser-event.h"
- #include "gdb_select.h"
+@@ -42,6 +42,7 @@
+ #include "gdbsupport/gdb_select.h"
#include "gdbsupport/gdb-sigmask.h"
+ #include "async-event.h"
+#include "symfile.h"
/* readline include files. */
#include "readline/readline.h"
-@@ -363,6 +364,8 @@ display_gdb_prompt (const char *new_prompt)
+@@ -364,6 +365,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. */
-@@ -772,7 +775,10 @@ command_line_handler (gdb::unique_xmalloc_ptr<char> &&rl)
+@@ -773,7 +776,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
-@@ -542,6 +542,8 @@ extern void generic_load (const char *args, int from_tty);
+@@ -560,6 +560,7 @@ 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);
+extern void debug_flush_missing (void);
-+#define BUILD_ID_MAIN_EXECUTABLE_FILENAME _("the main executable file")
+ #define BUILD_ID_MAIN_EXECUTABLE_FILENAME _("the main executable file")
/* From dwarf2read.c */
-