]> git.pld-linux.org Git - packages/gdb.git/blame - gdb-6.6-buildid-locate-rpm.patch
up to 11.1
[packages/gdb.git] / gdb-6.6-buildid-locate-rpm.patch
CommitLineData
4b0e5c1b
AM
1From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
2From: Fedora GDB patches <invalid@email.com>
3Date: Fri, 27 Oct 2017 21:07:50 +0200
4Subject: gdb-6.6-buildid-locate-rpm.patch
5
4b0e5c1b 6;;=push+jan
4b0e5c1b
AM
7
8diff --git a/gdb/aclocal.m4 b/gdb/aclocal.m4
4b0e5c1b
AM
9--- a/gdb/aclocal.m4
10+++ b/gdb/aclocal.m4
ed003b1c 11@@ -11,7 +11,223 @@
321e94d6
BS
12 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13 # PARTICULAR PURPOSE.
14
15+# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
16+# serial 1 (pkg-config-0.24)
174fe25c 17+#
321e94d6
BS
18+# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
19+#
20+# This program is free software; you can redistribute it and/or modify
21+# it under the terms of the GNU General Public License as published by
22+# the Free Software Foundation; either version 2 of the License, or
23+# (at your option) any later version.
24+#
25+# This program is distributed in the hope that it will be useful, but
26+# WITHOUT ANY WARRANTY; without even the implied warranty of
27+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28+# General Public License for more details.
29+#
30+# You should have received a copy of the GNU General Public License
31+# along with this program; if not, write to the Free Software
32+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
33+#
34+# As a special exception to the GNU General Public License, if you
35+# distribute this file as part of a program that contains a
36+# configuration script generated by Autoconf, you may include it under
37+# the same distribution terms that you use for the rest of that program.
3a58abaf 38+
321e94d6
BS
39+# PKG_PROG_PKG_CONFIG([MIN-VERSION])
40+# ----------------------------------
41+AC_DEFUN([PKG_PROG_PKG_CONFIG],
42+[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
43+m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
44+m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
45+AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
46+AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
47+AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
3a58abaf 48+
321e94d6
BS
49+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
50+ AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
51+fi
52+if test -n "$PKG_CONFIG"; then
53+ _pkg_min_version=m4_default([$1], [0.9.0])
54+ AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
55+ if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
56+ AC_MSG_RESULT([yes])
57+ else
58+ AC_MSG_RESULT([no])
59+ PKG_CONFIG=""
60+ fi
61+fi[]dnl
62+])# PKG_PROG_PKG_CONFIG
3a58abaf 63+
321e94d6
BS
64+# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
65+#
66+# Check to see whether a particular set of modules exists. Similar
67+# to PKG_CHECK_MODULES(), but does not set variables or print errors.
68+#
69+# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
70+# only at the first occurence in configure.ac, so if the first place
71+# it's called might be skipped (such as if it is within an "if", you
72+# have to call PKG_CHECK_EXISTS manually
73+# --------------------------------------------------------------
74+AC_DEFUN([PKG_CHECK_EXISTS],
75+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
76+if test -n "$PKG_CONFIG" && \
77+ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
78+ m4_default([$2], [:])
79+m4_ifvaln([$3], [else
80+ $3])dnl
81+fi])
3a58abaf 82+
321e94d6
BS
83+# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
84+# ---------------------------------------------
85+m4_define([_PKG_CONFIG],
86+[if test -n "$$1"; then
87+ pkg_cv_[]$1="$$1"
88+ elif test -n "$PKG_CONFIG"; then
89+ PKG_CHECK_EXISTS([$3],
90+ [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
91+ test "x$?" != "x0" && pkg_failed=yes ],
92+ [pkg_failed=yes])
93+ else
94+ pkg_failed=untried
95+fi[]dnl
96+])# _PKG_CONFIG
3a58abaf 97+
321e94d6
BS
98+# _PKG_SHORT_ERRORS_SUPPORTED
99+# -----------------------------
100+AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
101+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
102+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
103+ _pkg_short_errors_supported=yes
104+else
105+ _pkg_short_errors_supported=no
106+fi[]dnl
107+])# _PKG_SHORT_ERRORS_SUPPORTED
3a58abaf 108+
3a58abaf 109+
321e94d6
BS
110+# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
111+# [ACTION-IF-NOT-FOUND])
112+#
113+#
114+# Note that if there is a possibility the first call to
115+# PKG_CHECK_MODULES might not happen, you should be sure to include an
116+# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
117+#
118+#
119+# --------------------------------------------------------------
120+AC_DEFUN([PKG_CHECK_MODULES],
121+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
122+AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
123+AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
3a58abaf 124+
321e94d6
BS
125+pkg_failed=no
126+AC_MSG_CHECKING([for $1])
3a58abaf 127+
321e94d6
BS
128+_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
129+_PKG_CONFIG([$1][_LIBS], [libs], [$2])
e5178960 130+
321e94d6
BS
131+m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
132+and $1[]_LIBS to avoid the need to call pkg-config.
133+See the pkg-config man page for more details.])
e5178960 134+
321e94d6 135+if test $pkg_failed = yes; then
174fe25c 136+ AC_MSG_RESULT([no])
321e94d6
BS
137+ _PKG_SHORT_ERRORS_SUPPORTED
138+ if test $_pkg_short_errors_supported = yes; then
139+ $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
174fe25c 140+ else
321e94d6
BS
141+ $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
142+ fi
143+ # Put the nasty error message in config.log where it belongs
144+ echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
3a58abaf 145+
321e94d6
BS
146+ m4_default([$4], [AC_MSG_ERROR(
147+[Package requirements ($2) were not met:
3a58abaf 148+
321e94d6 149+$$1_PKG_ERRORS
3a58abaf 150+
321e94d6
BS
151+Consider adjusting the PKG_CONFIG_PATH environment variable if you
152+installed software in a non-standard prefix.
3a58abaf 153+
321e94d6
BS
154+_PKG_TEXT])[]dnl
155+ ])
156+elif test $pkg_failed = untried; then
174fe25c 157+ AC_MSG_RESULT([no])
321e94d6
BS
158+ m4_default([$4], [AC_MSG_FAILURE(
159+[The pkg-config script could not be found or is too old. Make sure it
160+is in your PATH or set the PKG_CONFIG environment variable to the full
161+path to pkg-config.
3a58abaf 162+
321e94d6 163+_PKG_TEXT
3a58abaf 164+
321e94d6
BS
165+To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
166+ ])
167+else
168+ $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
169+ $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
170+ AC_MSG_RESULT([yes])
171+ $3
172+fi[]dnl
173+])# PKG_CHECK_MODULES
3a58abaf 174+
3a58abaf 175+
321e94d6
BS
176+# PKG_INSTALLDIR(DIRECTORY)
177+# -------------------------
178+# Substitutes the variable pkgconfigdir as the location where a module
179+# should install pkg-config .pc files. By default the directory is
180+# $libdir/pkgconfig, but the default can be changed by passing
181+# DIRECTORY. The user can override through the --with-pkgconfigdir
182+# parameter.
183+AC_DEFUN([PKG_INSTALLDIR],
184+[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
185+m4_pushdef([pkg_description],
186+ [pkg-config installation directory @<:@]pkg_default[@:>@])
187+AC_ARG_WITH([pkgconfigdir],
188+ [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
189+ [with_pkgconfigdir=]pkg_default)
190+AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
191+m4_popdef([pkg_default])
192+m4_popdef([pkg_description])
193+]) dnl PKG_INSTALLDIR
194+
195+
196+# PKG_NOARCH_INSTALLDIR(DIRECTORY)
197+# -------------------------
198+# Substitutes the variable noarch_pkgconfigdir as the location where a
199+# module should install arch-independent pkg-config .pc files. By
200+# default the directory is $datadir/pkgconfig, but the default can be
201+# changed by passing DIRECTORY. The user can override through the
202+# --with-noarch-pkgconfigdir parameter.
203+AC_DEFUN([PKG_NOARCH_INSTALLDIR],
204+[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
205+m4_pushdef([pkg_description],
206+ [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
207+AC_ARG_WITH([noarch-pkgconfigdir],
208+ [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
209+ [with_noarch_pkgconfigdir=]pkg_default)
210+AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
211+m4_popdef([pkg_default])
212+m4_popdef([pkg_description])
213+]) dnl PKG_NOARCH_INSTALLDIR
214+
215+
216+# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
217+# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
218+# -------------------------------------------
219+# Retrieves the value of the pkg-config variable for the given module.
220+AC_DEFUN([PKG_CHECK_VAR],
221+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
222+AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
3a58abaf 223+
321e94d6
BS
224+_PKG_CONFIG([$1], [variable="][$3]["], [$2])
225+AS_VAR_COPY([$1], [pkg_cv_][$1])
3a58abaf 226+
321e94d6
BS
227+AS_VAR_IF([$1], [""], [$5], [$4])dnl
228+])# PKG_CHECK_VAR
ed003b1c
AM
229+
230 m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
3a58abaf 231+
321e94d6
BS
232 # AM_AUX_DIR_EXPAND -*- Autoconf -*-
233
ed003b1c 234 # Copyright (C) 2001-2017 Free Software Foundation, Inc.
4b0e5c1b 235diff --git a/gdb/build-id.c b/gdb/build-id.c
4b0e5c1b
AM
236--- a/gdb/build-id.c
237+++ b/gdb/build-id.c
e28f2cc1
AM
238@@ -33,6 +33,7 @@
239 #include "gdb_bfd.h"
240 #include "gdbcmd.h"
241 #include "gdbcore.h"
4b0e5c1b 242+#include "inferior.h"
e28f2cc1
AM
243 #include "objfiles.h"
244 #include "observable.h"
174fe25c
JP
245 #include "symfile.h"
246@@ -697,8 +698,374 @@ build_id_to_filename (const struct bfd_build_id *build_id, char **link_return)
4b0e5c1b
AM
247 return result;
248 }
321e94d6 249
4b0e5c1b 250+#ifdef HAVE_LIBRPM
3a58abaf 251+
4b0e5c1b
AM
252+#include <rpm/rpmlib.h>
253+#include <rpm/rpmts.h>
254+#include <rpm/rpmdb.h>
255+#include <rpm/header.h>
256+#ifdef DLOPEN_LIBRPM
257+#include <dlfcn.h>
258+#endif
3a58abaf 259+
4b0e5c1b
AM
260+/* This MISSING_RPM_HASH tracker is used to collect all the missing rpm files
261+ and avoid their duplicities during a single inferior run. */
3a58abaf 262+
4b0e5c1b 263+static struct htab *missing_rpm_hash;
3a58abaf 264+
4b0e5c1b
AM
265+/* This MISSING_RPM_LIST tracker is used to collect and print as a single line
266+ all the rpms right before the nearest GDB prompt. It gets cleared after
267+ each such print (it is questionable if we should clear it after the print).
268+ */
3a58abaf 269+
4b0e5c1b
AM
270+struct missing_rpm
271+ {
272+ struct missing_rpm *next;
273+ char rpm[1];
274+ };
275+static struct missing_rpm *missing_rpm_list;
276+static int missing_rpm_list_entries;
3a58abaf 277+
4b0e5c1b 278+/* Returns the count of newly added rpms. */
3a58abaf 279+
4b0e5c1b
AM
280+static int
281+missing_rpm_enlist (const char *filename)
282+{
283+ static int rpm_init_done = 0;
284+ rpmts ts;
285+ rpmdbMatchIterator mi;
286+ int count = 0;
3a58abaf 287+
4b0e5c1b
AM
288+#ifdef DLOPEN_LIBRPM
289+ /* Duplicate here the declarations to verify they match. The same sanity
290+ check is present also in `configure.ac'. */
291+ extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
292+ static char *(*headerFormat_p) (Header h, const char * fmt, errmsg_t *errmsg);
293+ extern int rpmReadConfigFiles(const char * file, const char * target);
294+ static int (*rpmReadConfigFiles_p) (const char * file, const char * target);
295+ extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
296+ static rpmdbMatchIterator (*rpmdbFreeIterator_p) (rpmdbMatchIterator mi);
297+ extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
298+ static Header (*rpmdbNextIterator_p) (rpmdbMatchIterator mi);
299+ extern rpmts rpmtsCreate(void);
300+ static rpmts (*rpmtsCreate_p) (void);
301+ extern rpmts rpmtsFree(rpmts ts);
302+ static rpmts (*rpmtsFree_p) (rpmts ts);
303+ extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
304+ const void * keyp, size_t keylen);
305+ static rpmdbMatchIterator (*rpmtsInitIterator_p) (const rpmts ts,
306+ rpmTag rpmtag,
307+ const void *keyp,
308+ size_t keylen);
309+#else /* !DLOPEN_LIBRPM */
310+# define headerFormat_p headerFormat
311+# define rpmReadConfigFiles_p rpmReadConfigFiles
312+# define rpmdbFreeIterator_p rpmdbFreeIterator
313+# define rpmdbNextIterator_p rpmdbNextIterator
314+# define rpmtsCreate_p rpmtsCreate
315+# define rpmtsFree_p rpmtsFree
316+# define rpmtsInitIterator_p rpmtsInitIterator
317+#endif /* !DLOPEN_LIBRPM */
3a58abaf 318+
4b0e5c1b 319+ gdb_assert (filename != NULL);
3a58abaf 320+
4b0e5c1b
AM
321+ if (strcmp (filename, BUILD_ID_MAIN_EXECUTABLE_FILENAME) == 0)
322+ return 0;
3a58abaf 323+
4b0e5c1b
AM
324+ if (is_target_filename (filename))
325+ return 0;
3a58abaf 326+
4b0e5c1b
AM
327+ if (filename[0] != '/')
328+ {
329+ warning (_("Ignoring non-absolute filename: <%s>"), filename);
330+ return 0;
331+ }
332+
333+ if (!rpm_init_done)
334+ {
335+ static int init_tried;
336+
337+ /* Already failed the initialization before? */
338+ if (init_tried)
174fe25c 339+ return 0;
4b0e5c1b
AM
340+ init_tried = 1;
341+
342+#ifdef DLOPEN_LIBRPM
321e94d6 343+ {
4b0e5c1b 344+ void *h;
3a58abaf 345+
4b0e5c1b
AM
346+ h = dlopen (DLOPEN_LIBRPM, RTLD_LAZY);
347+ if (!h)
321e94d6 348+ {
4b0e5c1b
AM
349+ warning (_("Unable to open \"%s\" (%s), "
350+ "missing debuginfos notifications will not be displayed"),
351+ DLOPEN_LIBRPM, dlerror ());
321e94d6
BS
352+ return 0;
353+ }
4b0e5c1b
AM
354+
355+ if (!((headerFormat_p = (char *(*) (Header h, const char * fmt, errmsg_t *errmsg)) dlsym (h, "headerFormat"))
356+ && (rpmReadConfigFiles_p = (int (*) (const char * file, const char * target)) dlsym (h, "rpmReadConfigFiles"))
357+ && (rpmdbFreeIterator_p = (rpmdbMatchIterator (*) (rpmdbMatchIterator mi)) dlsym (h, "rpmdbFreeIterator"))
358+ && (rpmdbNextIterator_p = (Header (*) (rpmdbMatchIterator mi)) dlsym (h, "rpmdbNextIterator"))
359+ && (rpmtsCreate_p = (rpmts (*) (void)) dlsym (h, "rpmtsCreate"))
360+ && (rpmtsFree_p = (rpmts (*) (rpmts ts)) dlsym (h, "rpmtsFree"))
361+ && (rpmtsInitIterator_p = (rpmdbMatchIterator (*) (const rpmts ts, rpmTag rpmtag, const void *keyp, size_t keylen)) dlsym (h, "rpmtsInitIterator"))))
321e94d6 362+ {
4b0e5c1b
AM
363+ warning (_("Opened library \"%s\" is incompatible (%s), "
364+ "missing debuginfos notifications will not be displayed"),
365+ DLOPEN_LIBRPM, dlerror ());
366+ if (dlclose (h))
367+ warning (_("Error closing library \"%s\": %s\n"), DLOPEN_LIBRPM,
368+ dlerror ());
321e94d6
BS
369+ return 0;
370+ }
321e94d6 371+ }
4b0e5c1b 372+#endif /* DLOPEN_LIBRPM */
3a58abaf 373+
4b0e5c1b
AM
374+ if (rpmReadConfigFiles_p (NULL, NULL) != 0)
375+ {
376+ warning (_("Error reading the rpm configuration files"));
377+ return 0;
378+ }
3a58abaf 379+
4b0e5c1b
AM
380+ rpm_init_done = 1;
381+ }
3a58abaf 382+
4b0e5c1b 383+ ts = rpmtsCreate_p ();
3a58abaf 384+
4b0e5c1b
AM
385+ mi = rpmtsInitIterator_p (ts, RPMTAG_BASENAMES, filename, 0);
386+ if (mi != NULL)
387+ {
388+ for (;;)
389+ {
390+ Header h;
391+ char *debuginfo, **slot, *s, *s2;
392+ errmsg_t err;
393+ size_t srcrpmlen = sizeof (".src.rpm") - 1;
394+ size_t debuginfolen = sizeof ("-debuginfo") - 1;
395+ rpmdbMatchIterator mi_debuginfo;
3a58abaf 396+
4b0e5c1b
AM
397+ h = rpmdbNextIterator_p (mi);
398+ if (h == NULL)
399+ break;
3a58abaf 400+
4b0e5c1b 401+ /* Verify the debuginfo file is not already installed. */
3a58abaf 402+
4b0e5c1b
AM
403+ debuginfo = headerFormat_p (h, "%{sourcerpm}-debuginfo.%{arch}",
404+ &err);
405+ if (!debuginfo)
406+ {
407+ warning (_("Error querying the rpm file `%s': %s"), filename,
408+ err);
409+ continue;
410+ }
411+ /* s = `.src.rpm-debuginfo.%{arch}' */
412+ s = strrchr (debuginfo, '-') - srcrpmlen;
413+ s2 = NULL;
414+ if (s > debuginfo && memcmp (s, ".src.rpm", srcrpmlen) == 0)
415+ {
416+ /* s2 = `-%{release}.src.rpm-debuginfo.%{arch}' */
417+ s2 = (char *) memrchr (debuginfo, '-', s - debuginfo);
418+ }
419+ if (s2)
420+ {
421+ /* s2 = `-%{version}-%{release}.src.rpm-debuginfo.%{arch}' */
422+ s2 = (char *) memrchr (debuginfo, '-', s2 - debuginfo);
423+ }
424+ if (!s2)
425+ {
426+ warning (_("Error querying the rpm file `%s': %s"), filename,
427+ debuginfo);
428+ xfree (debuginfo);
429+ continue;
430+ }
431+ /* s = `.src.rpm-debuginfo.%{arch}' */
432+ /* s2 = `-%{version}-%{release}.src.rpm-debuginfo.%{arch}' */
433+ memmove (s2 + debuginfolen, s2, s - s2);
434+ memcpy (s2, "-debuginfo", debuginfolen);
435+ /* s = `XXXX.%{arch}' */
436+ /* strlen ("XXXX") == srcrpmlen + debuginfolen */
437+ /* s2 = `-debuginfo-%{version}-%{release}XX.%{arch}' */
438+ /* strlen ("XX") == srcrpmlen */
439+ memmove (s + debuginfolen, s + srcrpmlen + debuginfolen,
440+ strlen (s + srcrpmlen + debuginfolen) + 1);
441+ /* s = `-debuginfo-%{version}-%{release}.%{arch}' */
3a58abaf 442+
4b0e5c1b
AM
443+ /* RPMDBI_PACKAGES requires keylen == sizeof (int). */
444+ /* RPMDBI_LABEL is an interface for NVR-based dbiFindByLabel(). */
445+ mi_debuginfo = rpmtsInitIterator_p (ts, (rpmTag) RPMDBI_LABEL, debuginfo, 0);
446+ xfree (debuginfo);
447+ if (mi_debuginfo)
448+ {
449+ rpmdbFreeIterator_p (mi_debuginfo);
450+ count = 0;
451+ break;
452+ }
3a58abaf 453+
4b0e5c1b
AM
454+ /* The allocated memory gets utilized below for MISSING_RPM_HASH. */
455+ debuginfo = headerFormat_p (h,
456+ "%{name}-%{version}-%{release}.%{arch}",
457+ &err);
458+ if (!debuginfo)
459+ {
460+ warning (_("Error querying the rpm file `%s': %s"), filename,
461+ err);
462+ continue;
463+ }
321e94d6 464+
4b0e5c1b
AM
465+ /* Base package name for `debuginfo-install'. We do not use the
466+ `yum' command directly as the line
467+ yum --enablerepo='*debug*' install NAME-debuginfo.ARCH
468+ would be more complicated than just:
469+ debuginfo-install NAME-VERSION-RELEASE.ARCH
470+ Do not supply the rpm base name (derived from .src.rpm name) as
471+ debuginfo-install is unable to install the debuginfo package if
472+ the base name PKG binary rpm is not installed while for example
473+ PKG-libs would be installed (RH Bug 467901).
474+ FUTURE: After multiple debuginfo versions simultaneously installed
475+ get supported the support for the VERSION-RELEASE tags handling
476+ may need an update. */
321e94d6 477+
4b0e5c1b
AM
478+ if (missing_rpm_hash == NULL)
479+ {
480+ /* DEL_F is passed NULL as MISSING_RPM_LIST's HTAB_DELETE
481+ should not deallocate the entries. */
3a58abaf 482+
4b0e5c1b
AM
483+ missing_rpm_hash = htab_create_alloc (64, htab_hash_string,
484+ (int (*) (const void *, const void *)) streq,
485+ NULL, xcalloc, xfree);
486+ }
487+ slot = (char **) htab_find_slot (missing_rpm_hash, debuginfo, INSERT);
488+ /* XCALLOC never returns NULL. */
489+ gdb_assert (slot != NULL);
490+ if (*slot == NULL)
491+ {
492+ struct missing_rpm *missing_rpm;
3a58abaf 493+
4b0e5c1b 494+ *slot = debuginfo;
3a58abaf 495+
4b0e5c1b
AM
496+ missing_rpm = (struct missing_rpm *) xmalloc (sizeof (*missing_rpm) + strlen (debuginfo));
497+ strcpy (missing_rpm->rpm, debuginfo);
498+ missing_rpm->next = missing_rpm_list;
499+ missing_rpm_list = missing_rpm;
500+ missing_rpm_list_entries++;
501+ }
502+ else
503+ xfree (debuginfo);
504+ count++;
505+ }
a7de96f0 506+
4b0e5c1b
AM
507+ rpmdbFreeIterator_p (mi);
508+ }
3a58abaf 509+
4b0e5c1b 510+ rpmtsFree_p (ts);
3a58abaf 511+
4b0e5c1b
AM
512+ return count;
513+}
3a58abaf 514+
e28f2cc1
AM
515+static bool
516+missing_rpm_list_compar (const char *ap, const char *bp)
4b0e5c1b 517+{
e28f2cc1 518+ return strcoll (ap, bp) < 0;
4b0e5c1b 519+}
3a58abaf 520+
4b0e5c1b
AM
521+/* It returns a NULL-terminated array of strings needing to be FREEd. It may
522+ also return only NULL. */
3a58abaf 523+
4b0e5c1b
AM
524+static void
525+missing_rpm_list_print (void)
526+{
4b0e5c1b 527+ struct missing_rpm *list_iter;
3a58abaf 528+
4b0e5c1b
AM
529+ if (missing_rpm_list_entries == 0)
530+ return;
321e94d6 531+
e28f2cc1
AM
532+ std::vector<const char *> array (missing_rpm_list_entries);
533+ size_t idx = 0;
321e94d6 534+
4b0e5c1b
AM
535+ for (list_iter = missing_rpm_list; list_iter != NULL;
536+ list_iter = list_iter->next)
537+ {
e28f2cc1 538+ array[idx++] = list_iter->rpm;
4b0e5c1b 539+ }
e28f2cc1 540+ gdb_assert (idx == missing_rpm_list_entries);
321e94d6 541+
e28f2cc1 542+ std::sort (array.begin (), array.end (), missing_rpm_list_compar);
321e94d6 543+
174fe25c
JP
544+ /* We zero out the number of missing RPMs here because of a nasty
545+ bug (see RHBZ 1801974).
546+
547+ When we call 'puts_unfiltered' below, if pagination is on and if
548+ the number of missing RPMs is big enough to trigger pagination,
549+ we will end up in an infinite recursion. The call chain looks
550+ like this:
551+
552+ missing_rpm_list_print -> puts_unfiltered -> fputs_maybe_filtered
553+ -> prompt_for_continue -> display_gdb_prompt ->
554+ debug_flush_missing -> missing_rpm_list_print ...
555+
556+ For this reason, we make sure MISSING_RPM_LIST_ENTRIES is zero
557+ *before* calling any print function. */
558+ missing_rpm_list_entries = 0;
559+
4b0e5c1b
AM
560+ printf_unfiltered (_("Missing separate debuginfos, use: %s"),
561+#ifdef DNF_DEBUGINFO_INSTALL
562+ "dnf "
563+#endif
564+ "debuginfo-install");
e28f2cc1 565+ for (const char *el : array)
4b0e5c1b 566+ {
174fe25c 567+ puts_unfiltered (" ");
e28f2cc1 568+ puts_unfiltered (el);
4b0e5c1b 569+ }
174fe25c 570+ puts_unfiltered ("\n");
321e94d6 571+
4b0e5c1b
AM
572+ while (missing_rpm_list != NULL)
573+ {
574+ list_iter = missing_rpm_list;
575+ missing_rpm_list = list_iter->next;
576+ xfree (list_iter);
577+ }
4b0e5c1b 578+}
3a58abaf 579+
4b0e5c1b
AM
580+static void
581+missing_rpm_change (void)
3a58abaf 582+{
4b0e5c1b 583+ debug_flush_missing ();
3a58abaf 584+
4b0e5c1b
AM
585+ gdb_assert (missing_rpm_list == NULL);
586+ if (missing_rpm_hash != NULL)
587+ {
588+ htab_delete (missing_rpm_hash);
589+ missing_rpm_hash = NULL;
590+ }
321e94d6 591+}
321e94d6 592+
4b0e5c1b
AM
593+enum missing_exec
594+ {
595+ /* Init state. EXEC_BFD also still could be NULL. */
596+ MISSING_EXEC_NOT_TRIED,
597+ /* We saw a non-NULL EXEC_BFD but RPM has no info about it. */
598+ MISSING_EXEC_NOT_FOUND,
599+ /* We found EXEC_BFD by RPM and we either have its symbols (either embedded
600+ or separate) or the main executable's RPM is now contained in
601+ MISSING_RPM_HASH. */
602+ MISSING_EXEC_ENLISTED
603+ };
604+static enum missing_exec missing_exec = MISSING_EXEC_NOT_TRIED;
321e94d6 605+
4b0e5c1b 606+#endif /* HAVE_LIBRPM */
321e94d6 607+
4b0e5c1b
AM
608+void
609+debug_flush_missing (void)
610+{
611+#ifdef HAVE_LIBRPM
612+ missing_rpm_list_print ();
613+#endif
614+}
321e94d6 615+
4b0e5c1b
AM
616 /* This MISSING_FILEPAIR_HASH tracker is used only for the duplicite messages
617- Try to install the hash file ...
618+ yum --enablerepo='*debug*' install ...
619 avoidance. */
620
621 struct missing_filepair
174fe25c 622@@ -752,11 +1119,17 @@ missing_filepair_change (void)
4b0e5c1b
AM
623 /* All their memory came just from missing_filepair_OBSTACK. */
624 missing_filepair_hash = NULL;
625 }
626+#ifdef HAVE_LIBRPM
627+ missing_exec = MISSING_EXEC_NOT_TRIED;
628+#endif
629 }
630
631 static void
632 debug_print_executable_changed (void)
633 {
634+#ifdef HAVE_LIBRPM
635+ missing_rpm_change ();
636+#endif
637 missing_filepair_change ();
638 }
639
174fe25c 640@@ -823,14 +1196,38 @@ debug_print_missing (const char *binary, const char *debug)
4b0e5c1b
AM
641
642 *slot = missing_filepair;
643
644- /* We do not collect and flush these messages as each such message
645- already requires its own separate lines. */
646+#ifdef HAVE_LIBRPM
647+ if (missing_exec == MISSING_EXEC_NOT_TRIED)
648+ {
e28f2cc1 649+ const char *execfilename = get_exec_file (0);
4b0e5c1b
AM
650
651- fprintf_unfiltered (gdb_stdlog,
652- _("Missing separate debuginfo for %s\n"), binary);
653- if (debug != NULL)
654- fprintf_unfiltered (gdb_stdlog, _("Try to install the hash file %s\n"),
655- debug);
4b0e5c1b
AM
656+ if (execfilename != NULL)
657+ {
658+ if (missing_rpm_enlist (execfilename) == 0)
659+ missing_exec = MISSING_EXEC_NOT_FOUND;
660+ else
661+ missing_exec = MISSING_EXEC_ENLISTED;
662+ }
663+ }
664+ if (missing_exec != MISSING_EXEC_ENLISTED)
665+ if ((binary[0] == 0 || missing_rpm_enlist (binary) == 0)
666+ && (debug == NULL || missing_rpm_enlist (debug) == 0))
667+#endif /* HAVE_LIBRPM */
668+ {
669+ /* We do not collect and flush these messages as each such message
670+ already requires its own separate lines. */
321e94d6 671+
4b0e5c1b
AM
672+ fprintf_unfiltered (gdb_stdlog,
673+ _("Missing separate debuginfo for %s\n"), binary);
674+ if (debug != NULL)
675+ fprintf_unfiltered (gdb_stdlog, _("Try: %s %s\n"),
676+#ifdef DNF_DEBUGINFO_INSTALL
677+ "dnf"
678+#else
679+ "yum"
680+#endif
681+ " --enablerepo='*debug*' install", debug);
682+ }
683 }
684
685 /* See build-id.h. */
686diff --git a/gdb/config.in b/gdb/config.in
4b0e5c1b
AM
687--- a/gdb/config.in
688+++ b/gdb/config.in
174fe25c
JP
689@@ -39,6 +39,9 @@
690 /* Handle .ctf type-info sections */
691 #undef ENABLE_LIBCTF
4b0e5c1b
AM
692
693+/* librpm version specific library name to dlopen. */
694+#undef DLOPEN_LIBRPM
321e94d6 695+
4b0e5c1b
AM
696 /* Define to 1 if translation of program messages to the user's native
697 language is requested. */
698 #undef ENABLE_NLS
1d2a824d 699@@ -246,6 +249,9 @@
e28f2cc1
AM
700 /* Define if you have the mpfr library. */
701 #undef HAVE_LIBMPFR
321e94d6 702
4b0e5c1b
AM
703+/* Define if librpm library is being used. */
704+#undef HAVE_LIBRPM
705+
706 /* Define to 1 if you have the <libunwind-ia64.h> header file. */
707 #undef HAVE_LIBUNWIND_IA64_H
321e94d6 708
4b0e5c1b 709diff --git a/gdb/configure b/gdb/configure
4b0e5c1b
AM
710--- a/gdb/configure
711+++ b/gdb/configure
1d2a824d 712@@ -771,6 +771,11 @@ PKG_CONFIG
4b0e5c1b
AM
713 HAVE_NATIVE_GCORE_TARGET
714 TARGET_OBS
715 subdirs
716+RPM_LIBS
717+RPM_CFLAGS
718+PKG_CONFIG_LIBDIR
719+PKG_CONFIG_PATH
720+PKG_CONFIG
721 GDB_DATADIR
722 DEBUGDIR
723 MAKEINFO_EXTRA_FLAGS
1d2a824d 724@@ -876,6 +881,7 @@ with_gdb_datadir
4b0e5c1b
AM
725 with_relocated_sources
726 with_auto_load_dir
727 with_auto_load_safe_path
728+with_rpm
729 enable_targets
730 enable_64_bit_bfd
77d10998 731 enable_gdbmi
1d2a824d 732@@ -953,6 +959,8 @@ PKG_CONFIG_PATH
174fe25c
JP
733 PKG_CONFIG_LIBDIR
734 DEBUGINFOD_CFLAGS
735 DEBUGINFOD_LIBS
4b0e5c1b
AM
736+RPM_CFLAGS
737+RPM_LIBS
738 YACC
739 YFLAGS
740 XMKMF'
1d2a824d 741@@ -1625,6 +1633,8 @@ Optional Packages:
4b0e5c1b 742 do not restrict auto-loaded files locations
174fe25c
JP
743 --with-debuginfod Enable debuginfo lookups with debuginfod
744 (auto/yes/no)
4b0e5c1b
AM
745+ --with-rpm query rpm database for missing debuginfos (yes/no,
746+ def. auto=librpm.so)
747 --with-libunwind-ia64 use libunwind frame unwinding for ia64 targets
748 --with-curses use the curses library instead of the termcap
749 library
1d2a824d 750@@ -1705,6 +1715,8 @@ Some influential environment variables:
174fe25c
JP
751 C compiler flags for DEBUGINFOD, overriding pkg-config
752 DEBUGINFOD_LIBS
753 linker flags for DEBUGINFOD, overriding pkg-config
4b0e5c1b
AM
754+ RPM_CFLAGS C compiler flags for RPM, overriding pkg-config
755+ RPM_LIBS linker flags for RPM, overriding pkg-config
ed003b1c
AM
756 YACC The `Yet Another Compiler Compiler' implementation to use.
757 Defaults to the first program found out of: `bison -y', `byacc',
758 `yacc'.
1d2a824d 759@@ -6616,6 +6628,494 @@ _ACEOF
4b0e5c1b
AM
760 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_auto_load_safe_path" >&5
761 $as_echo "$with_auto_load_safe_path" >&6; }
321e94d6
BS
762
763+# Integration with rpm library to support missing debuginfo suggestions.
764+# --without-rpm: Disable any rpm support.
765+# --with-rpm=libname.so: Try to dynamically open `libname.so' during runtime.
766+# Even with runtime missing `libname.so' GDB will still other run correctly.
767+# Missing `libname.so' during ./configure will abort the configuration.
768+# --with-rpm=librpm.so: Like `--with-rpm=libname.so' but try to find specific
769+# minor version first such as `librpm-4.6.so' as minor version differences
770+# mean API+ABI incompatibility. If the specific match versioned library name
771+# could not be found still open dynamically at least `librpm.so'.
772+# --with-rpm: Like `--with-rpm=librpm.so' but if any of its detection fails try
773+# to find librpm for compilation-time linking by pkg-config. GDB binary will
774+# be probably linked with the version specific library (as `librpm-4.6.so').
775+# Failure to find librpm by pkg-config will abort the configuration.
776+# (default) --with-rpm=auto: Like `--with-rpm=librpm.so' but if even pkg-config
777+# cannot find librpm use to the rpmless compilation (like `--without-rpm').
778+
321e94d6 779+
4b0e5c1b
AM
780+# Check whether --with-rpm was given.
781+if test "${with_rpm+set}" = set; then :
782+ withval=$with_rpm;
783+else
784+ with_rpm="auto"
785+fi
786+
787+
788+
789+
321e94d6
BS
790+if test "x$with_rpm" != "xno"; then
791+ if test "x$with_rpm" = "xyes"; then
792+ LIBRPM="librpm.so"
793+ RPM_REQUIRE=true
794+ DLOPEN_REQUIRE=false
795+ elif test "x$with_rpm" = "xauto"; then
796+ LIBRPM="librpm.so"
797+ RPM_REQUIRE=false
798+ DLOPEN_REQUIRE=false
799+ else
800+ LIBRPM="$with_rpm"
801+ RPM_REQUIRE=true
802+ DLOPEN_REQUIRE=true
803+ fi
804+ LIBRPM_STRING='"'"$LIBRPM"'"'
805+
4b0e5c1b
AM
806+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking specific librpm version" >&5
807+$as_echo_n "checking specific librpm version... " >&6; }
321e94d6
BS
808+ HAVE_DLOPEN_LIBRPM=false
809+ save_LIBS="$LIBS"
810+ LIBS="$LIBS -ldl"
4b0e5c1b
AM
811+ if test "$cross_compiling" = yes; then :
812+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
813+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
814+as_fn_error "cannot run test program while cross compiling
815+See \`config.log' for more details." "$LINENO" 5; }
816+else
817+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
818+/* end confdefs.h. */
819+
321e94d6
BS
820+#include <rpm/rpmlib.h>
821+#include <dlfcn.h>
822+#include <errno.h>
4b0e5c1b
AM
823+
824+int
825+main ()
826+{
827+
321e94d6 828+ void *h;
3a58abaf
AM
829+ const char *const *rpmverp;
830+ FILE *f;
831+
832+ f = fopen ("conftest.out", "w");
833+ if (!f)
834+ {
835+ fprintf (stderr, "Cannot write \"%s\": %s\n", "conftest.out",
836+ strerror (errno));
837+ return 1;
838+ }
839+ h = dlopen ($LIBRPM_STRING, RTLD_LAZY);
840+ if (!h)
841+ {
842+ fprintf (stderr, "dlopen (\"%s\"): %s\n", $LIBRPM_STRING, dlerror ());
843+ return 1;
844+ }
845+ rpmverp = dlsym (h, "RPMVERSION");
846+ if (!rpmverp)
847+ {
848+ fprintf (stderr, "dlsym (\"RPMVERSION\"): %s\n", dlerror ());
849+ return 1;
850+ }
851+ fprintf (stderr, "RPMVERSION is: \"");
852+ fprintf (stderr, "%s\"\n", *rpmverp);
853+
854+ /* Try to find the specific librpm version only for "librpm.so" as we do
855+ not know how to assemble the version string otherwise. */
856+
857+ if (strcmp ("librpm.so", $LIBRPM_STRING) != 0)
858+ {
859+ fprintf (f, "%s\n", $LIBRPM_STRING);
860+ return 0;
861+ }
862+ else
863+ {
864+ char *h2_name;
865+ void *h2;
866+ int major, minor;
867+
868+ if (sscanf (*rpmverp, "%d.%d", &major, &minor) != 2)
869+ {
870+ fprintf (stderr, "Unable to parse RPMVERSION.\n");
871+ fprintf (f, "%s\n", $LIBRPM_STRING);
872+ return 0;
873+ }
874+ /* Avoid the square brackets by malloc. */
875+ h2_name = malloc (64);
876+ sprintf (h2_name, "librpm-%d.%d.so", major, minor);
877+ h2 = dlopen (h2_name, RTLD_LAZY);
878+ if (!h2)
879+ {
880+ fprintf (stderr, "dlopen (\"%s\"): %s\n", h2_name, dlerror ());
881+ fprintf (f, "%s\n", $LIBRPM_STRING);
882+ return 0;
883+ }
884+ if (h2 != h)
885+ {
886+ fprintf (stderr, "dlopen of \"%s\" and \"%s\" are different.\n",
887+ $LIBRPM_STRING, h2_name);
888+ fprintf (f, "%s\n", $LIBRPM_STRING);
889+ return 0;
890+ }
891+ /* Found the valid .so name with a specific version. */
892+ fprintf (f, "%s\n", h2_name);
893+ return 0;
894+ }
4b0e5c1b
AM
895+
896+ ;
897+ return 0;
898+}
899+_ACEOF
900+if ac_fn_c_try_run "$LINENO"; then :
901+
3a58abaf
AM
902+ DLOPEN_LIBRPM="`cat conftest.out`"
903+ if test "x$DLOPEN_LIBRPM" != "x"; then
904+ HAVE_DLOPEN_LIBRPM=true
4b0e5c1b
AM
905+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLOPEN_LIBRPM" >&5
906+$as_echo "$DLOPEN_LIBRPM" >&6; }
3a58abaf 907+ fi
4b0e5c1b
AM
908+
909+fi
910+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
911+ conftest.$ac_objext conftest.beam conftest.$ac_ext
912+fi
913+
3a58abaf
AM
914+ rm -f conftest.out
915+
4b0e5c1b
AM
916+
917+
918+ if $HAVE_DLOPEN_LIBRPM; then
919+
920+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking rpm library API compatibility" >&5
921+$as_echo_n "checking rpm library API compatibility... " >&6; }
3a58abaf
AM
922+ # The compilation requires -Werror to verify anything.
923+ save_CFLAGS="$CFLAGS"
924+ CFLAGS="$CFLAGS -Werror"
4b0e5c1b
AM
925+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
926+/* end confdefs.h. */
927+
51a5ef0f 928+/* Duplicate here the declarations to verify they match "elfread.c". */
3a58abaf
AM
929+#include <rpm/rpmlib.h>
930+#include <rpm/rpmts.h>
931+#include <rpm/rpmdb.h>
932+#include <rpm/header.h>
933+extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
934+extern int rpmReadConfigFiles(const char * file, const char * target);
935+extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
936+extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
937+extern rpmts rpmtsCreate(void);
938+extern rpmts rpmtsFree(rpmts ts);
939+extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
940+ const void * keyp, size_t keylen);
4b0e5c1b
AM
941+
942+int
943+main ()
944+{
945+
946+ ;
947+ return 0;
948+}
949+_ACEOF
950+if ac_fn_c_try_compile "$LINENO"; then :
951+
3a58abaf 952+ LIBRPM_COMPAT=true
4b0e5c1b
AM
953+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
954+$as_echo "yes" >&6; }
955+
956+else
957+
3a58abaf 958+ LIBRPM_COMPAT=false
4b0e5c1b
AM
959+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
960+$as_echo "no" >&6; }
961+
962+fi
963+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
3a58abaf
AM
964+ CFLAGS="$save_CFLAGS"
965+
966+ if ! $LIBRPM_COMPAT; then
967+ HAVE_DLOPEN_LIBRPM=false
968+ fi
969+ fi
970+
971+ if $HAVE_DLOPEN_LIBRPM; then
972+ DLOPEN_LIBRPM_STRING='"'"$DLOPEN_LIBRPM"'"'
3a58abaf 973+
4b0e5c1b
AM
974+cat >>confdefs.h <<_ACEOF
975+#define DLOPEN_LIBRPM $DLOPEN_LIBRPM_STRING
976+_ACEOF
3a58abaf 977+
3a58abaf 978+
4b0e5c1b 979+$as_echo "#define HAVE_LIBRPM 1" >>confdefs.h
3a58abaf 980+
4b0e5c1b
AM
981+ else
982+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
983+$as_echo "no" >&6; }
984+ LIBS="$save_LIBS"
985+ if $DLOPEN_REQUIRE; then
986+ as_fn_error "Specific name $LIBRPM was requested but it could not be opened." "$LINENO" 5
987+ fi
28b292e9 988+
3a58abaf
AM
989+
990+
991+
3a58abaf 992+
3a58abaf 993+
3a58abaf 994+
4b0e5c1b
AM
995+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
996+ if test -n "$ac_tool_prefix"; then
997+ # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
998+set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
999+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
1000+$as_echo_n "checking for $ac_word... " >&6; }
1001+if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
1002+ $as_echo_n "(cached) " >&6
1003+else
1004+ case $PKG_CONFIG in
1005+ [\\/]* | ?:[\\/]*)
1006+ ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
1007+ ;;
1008+ *)
1009+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1010+for as_dir in $PATH
1011+do
1012+ IFS=$as_save_IFS
1013+ test -z "$as_dir" && as_dir=.
1014+ for ac_exec_ext in '' $ac_executable_extensions; do
1015+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
1016+ ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
1017+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
1018+ break 2
1019+ fi
1020+done
1021+ done
1022+IFS=$as_save_IFS
3a58abaf 1023+
4b0e5c1b
AM
1024+ ;;
1025+esac
1026+fi
1027+PKG_CONFIG=$ac_cv_path_PKG_CONFIG
1028+if test -n "$PKG_CONFIG"; then
1029+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
1030+$as_echo "$PKG_CONFIG" >&6; }
1031+else
1032+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
1033+$as_echo "no" >&6; }
1034+fi
3a58abaf 1035+
3a58abaf 1036+
4b0e5c1b
AM
1037+fi
1038+if test -z "$ac_cv_path_PKG_CONFIG"; then
1039+ ac_pt_PKG_CONFIG=$PKG_CONFIG
1040+ # Extract the first word of "pkg-config", so it can be a program name with args.
1041+set dummy pkg-config; ac_word=$2
1042+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
1043+$as_echo_n "checking for $ac_word... " >&6; }
1044+if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then :
1045+ $as_echo_n "(cached) " >&6
1046+else
1047+ case $ac_pt_PKG_CONFIG in
1048+ [\\/]* | ?:[\\/]*)
1049+ ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
1050+ ;;
1051+ *)
1052+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1053+for as_dir in $PATH
1054+do
1055+ IFS=$as_save_IFS
1056+ test -z "$as_dir" && as_dir=.
1057+ for ac_exec_ext in '' $ac_executable_extensions; do
1058+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
1059+ ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
1060+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
1061+ break 2
1062+ fi
1063+done
1064+ done
1065+IFS=$as_save_IFS
3a58abaf 1066+
4b0e5c1b
AM
1067+ ;;
1068+esac
1069+fi
1070+ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
1071+if test -n "$ac_pt_PKG_CONFIG"; then
1072+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
1073+$as_echo "$ac_pt_PKG_CONFIG" >&6; }
1074+else
1075+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
1076+$as_echo "no" >&6; }
1077+fi
3a58abaf 1078+
4b0e5c1b
AM
1079+ if test "x$ac_pt_PKG_CONFIG" = x; then
1080+ PKG_CONFIG=""
1081+ else
1082+ case $cross_compiling:$ac_tool_warned in
1083+yes:)
1084+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
1085+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
1086+ac_tool_warned=yes ;;
1087+esac
1088+ PKG_CONFIG=$ac_pt_PKG_CONFIG
1089+ fi
1090+else
1091+ PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
1092+fi
3a58abaf 1093+
4b0e5c1b
AM
1094+fi
1095+if test -n "$PKG_CONFIG"; then
1096+ _pkg_min_version=0.9.0
1097+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
1098+$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
1099+ if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1100+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
1101+$as_echo "yes" >&6; }
1102+ else
1103+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
1104+$as_echo "no" >&6; }
1105+ PKG_CONFIG=""
1106+ fi
1107+fi
1108+
1109+pkg_failed=no
1110+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for RPM" >&5
1111+$as_echo_n "checking for RPM... " >&6; }
1112+
1113+if test -n "$RPM_CFLAGS"; then
1114+ pkg_cv_RPM_CFLAGS="$RPM_CFLAGS"
1115+ elif test -n "$PKG_CONFIG"; then
1116+ if test -n "$PKG_CONFIG" && \
1117+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"rpm\""; } >&5
1118+ ($PKG_CONFIG --exists --print-errors "rpm") 2>&5
1119+ ac_status=$?
1120+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
1121+ test $ac_status = 0; }; then
1122+ pkg_cv_RPM_CFLAGS=`$PKG_CONFIG --cflags "rpm" 2>/dev/null`
1123+ test "x$?" != "x0" && pkg_failed=yes
1124+else
1125+ pkg_failed=yes
1126+fi
1127+ else
1128+ pkg_failed=untried
1129+fi
1130+if test -n "$RPM_LIBS"; then
1131+ pkg_cv_RPM_LIBS="$RPM_LIBS"
1132+ elif test -n "$PKG_CONFIG"; then
1133+ if test -n "$PKG_CONFIG" && \
1134+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"rpm\""; } >&5
1135+ ($PKG_CONFIG --exists --print-errors "rpm") 2>&5
1136+ ac_status=$?
1137+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
1138+ test $ac_status = 0; }; then
1139+ pkg_cv_RPM_LIBS=`$PKG_CONFIG --libs "rpm" 2>/dev/null`
1140+ test "x$?" != "x0" && pkg_failed=yes
1141+else
1142+ pkg_failed=yes
1143+fi
1144+ else
1145+ pkg_failed=untried
1146+fi
3a58abaf 1147+
3a58abaf 1148+
3a58abaf 1149+
4b0e5c1b 1150+if test $pkg_failed = yes; then
174fe25c 1151+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
4b0e5c1b 1152+$as_echo "no" >&6; }
3a58abaf 1153+
4b0e5c1b
AM
1154+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1155+ _pkg_short_errors_supported=yes
1156+else
1157+ _pkg_short_errors_supported=no
1158+fi
1159+ if test $_pkg_short_errors_supported = yes; then
1160+ RPM_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "rpm" 2>&1`
1161+ else
1162+ RPM_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "rpm" 2>&1`
1163+ fi
1164+ # Put the nasty error message in config.log where it belongs
1165+ echo "$RPM_PKG_ERRORS" >&5
3a58abaf 1166+
4b0e5c1b
AM
1167+ HAVE_LIBRPM=false
1168+elif test $pkg_failed = untried; then
174fe25c 1169+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
4b0e5c1b
AM
1170+$as_echo "no" >&6; }
1171+ HAVE_LIBRPM=false
1172+else
1173+ RPM_CFLAGS=$pkg_cv_RPM_CFLAGS
1174+ RPM_LIBS=$pkg_cv_RPM_LIBS
1175+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
1176+$as_echo "yes" >&6; }
1177+ HAVE_LIBRPM=true
1178+fi
3a58abaf 1179+
4b0e5c1b 1180+ if $HAVE_LIBRPM; then
6ed6bacf 1181+
4b0e5c1b
AM
1182+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking rpm library API compatibility" >&5
1183+$as_echo_n "checking rpm library API compatibility... " >&6; }
1184+ # The compilation requires -Werror to verify anything.
1185+ save_CFLAGS="$CFLAGS"
1186+ CFLAGS="$CFLAGS -Werror"
1187+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1188+/* end confdefs.h. */
3a58abaf 1189+
4b0e5c1b
AM
1190+/* Duplicate here the declarations to verify they match "elfread.c". */
1191+#include <rpm/rpmlib.h>
1192+#include <rpm/rpmts.h>
1193+#include <rpm/rpmdb.h>
1194+#include <rpm/header.h>
1195+extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
1196+extern int rpmReadConfigFiles(const char * file, const char * target);
1197+extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
1198+extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
1199+extern rpmts rpmtsCreate(void);
1200+extern rpmts rpmtsFree(rpmts ts);
1201+extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
1202+ const void * keyp, size_t keylen);
3a58abaf 1203+
4b0e5c1b
AM
1204+int
1205+main ()
1206+{
3a58abaf 1207+
4b0e5c1b
AM
1208+ ;
1209+ return 0;
321e94d6 1210+}
4b0e5c1b
AM
1211+_ACEOF
1212+if ac_fn_c_try_compile "$LINENO"; then :
3a58abaf 1213+
4b0e5c1b
AM
1214+ LIBRPM_COMPAT=true
1215+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
1216+$as_echo "yes" >&6; }
3a58abaf 1217+
4b0e5c1b 1218+else
3a58abaf 1219+
4b0e5c1b
AM
1220+ LIBRPM_COMPAT=false
1221+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
1222+$as_echo "no" >&6; }
3a58abaf 1223+
4b0e5c1b
AM
1224+fi
1225+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
1226+ CFLAGS="$save_CFLAGS"
3a58abaf 1227+
4b0e5c1b
AM
1228+ if ! $LIBRPM_COMPAT; then
1229+ HAVE_LIBRPM=false
1230+ RPM_PKG_ERRORS="Found $LIBRPM API is incompatibile with this GDB"
1231+ fi
1232+ fi
3a58abaf 1233+
4b0e5c1b 1234+ if $HAVE_LIBRPM; then
3a58abaf 1235+
4b0e5c1b 1236+$as_echo "#define HAVE_LIBRPM 1" >>confdefs.h
3a58abaf 1237+
4b0e5c1b
AM
1238+ CFLAGS="$CFLAGS $RPM_CFLAGS"
1239+ LIBS="$LIBS $RPM_LIBS"
1240+ else
1241+ if $RPM_REQUIRE; then
1242+ as_fn_error "$RPM_PKG_ERRORS" "$LINENO" 5
1243+ else
1244+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $RPM_PKG_ERRORS" >&5
1245+$as_echo "$as_me: WARNING: $RPM_PKG_ERRORS" >&2;}
1246+ fi
1247+ fi
1248+ fi
1249+fi
1250+
1251
1252
1253 subdirs="$subdirs testsuite"
1254diff --git a/gdb/configure.ac b/gdb/configure.ac
4b0e5c1b
AM
1255--- a/gdb/configure.ac
1256+++ b/gdb/configure.ac
1d2a824d 1257@@ -153,6 +153,199 @@ AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escape_dir,
4b0e5c1b
AM
1258 [Directories safe to hold auto-loaded files.])
1259 AC_MSG_RESULT([$with_auto_load_safe_path])
1260
1261+# Integration with rpm library to support missing debuginfo suggestions.
1262+# --without-rpm: Disable any rpm support.
1263+# --with-rpm=libname.so: Try to dynamically open `libname.so' during runtime.
1264+# Even with runtime missing `libname.so' GDB will still other run correctly.
1265+# Missing `libname.so' during ./configure will abort the configuration.
1266+# --with-rpm=librpm.so: Like `--with-rpm=libname.so' but try to find specific
1267+# minor version first such as `librpm-4.6.so' as minor version differences
1268+# mean API+ABI incompatibility. If the specific match versioned library name
1269+# could not be found still open dynamically at least `librpm.so'.
1270+# --with-rpm: Like `--with-rpm=librpm.so' but if any of its detection fails try
1271+# to find librpm for compilation-time linking by pkg-config. GDB binary will
1272+# be probably linked with the version specific library (as `librpm-4.6.so').
1273+# Failure to find librpm by pkg-config will abort the configuration.
1274+# (default) --with-rpm=auto: Like `--with-rpm=librpm.so' but if even pkg-config
1275+# cannot find librpm use to the rpmless compilation (like `--without-rpm').
1276+
1277+AC_ARG_WITH([rpm],
1278+ [AS_HELP_STRING([--with-rpm],
1279+ [query rpm database for missing debuginfos (yes/no, def. auto=librpm.so)])], [], [with_rpm="auto"])
1280+
1281+m4_pattern_allow([^AC_MSG_ERROR$])
1282+m4_pattern_allow([^AC_MSG_WARN$])
1283+if test "x$with_rpm" != "xno"; then
1284+ if test "x$with_rpm" = "xyes"; then
1285+ LIBRPM="librpm.so"
1286+ RPM_REQUIRE=true
1287+ DLOPEN_REQUIRE=false
1288+ elif test "x$with_rpm" = "xauto"; then
1289+ LIBRPM="librpm.so"
1290+ RPM_REQUIRE=false
1291+ DLOPEN_REQUIRE=false
1292+ else
1293+ LIBRPM="$with_rpm"
1294+ RPM_REQUIRE=true
1295+ DLOPEN_REQUIRE=true
1296+ fi
1297+ LIBRPM_STRING='"'"$LIBRPM"'"'
1298+
1299+ AC_MSG_CHECKING([specific librpm version])
1300+ HAVE_DLOPEN_LIBRPM=false
1301+ save_LIBS="$LIBS"
1302+ LIBS="$LIBS -ldl"
1303+ AC_RUN_IFELSE(AC_LANG_PROGRAM([[
1304+#include <rpm/rpmlib.h>
1305+#include <dlfcn.h>
1306+#include <errno.h>
1307+ ]], [[
1308+ void *h;
1309+ const char *const *rpmverp;
1310+ FILE *f;
1311+
1312+ f = fopen ("conftest.out", "w");
1313+ if (!f)
1314+ {
1315+ fprintf (stderr, "Cannot write \"%s\": %s\n", "conftest.out",
1316+ strerror (errno));
1317+ return 1;
1318+ }
1319+ h = dlopen ($LIBRPM_STRING, RTLD_LAZY);
1320+ if (!h)
1321+ {
1322+ fprintf (stderr, "dlopen (\"%s\"): %s\n", $LIBRPM_STRING, dlerror ());
1323+ return 1;
1324+ }
1325+ rpmverp = dlsym (h, "RPMVERSION");
1326+ if (!rpmverp)
1327+ {
1328+ fprintf (stderr, "dlsym (\"RPMVERSION\"): %s\n", dlerror ());
1329+ return 1;
1330+ }
1331+ fprintf (stderr, "RPMVERSION is: \"");
1332+ fprintf (stderr, "%s\"\n", *rpmverp);
3a58abaf 1333+
4b0e5c1b
AM
1334+ /* Try to find the specific librpm version only for "librpm.so" as we do
1335+ not know how to assemble the version string otherwise. */
321e94d6 1336+
4b0e5c1b
AM
1337+ if (strcmp ("librpm.so", $LIBRPM_STRING) != 0)
1338+ {
1339+ fprintf (f, "%s\n", $LIBRPM_STRING);
1340+ return 0;
1341+ }
1342+ else
1343+ {
1344+ char *h2_name;
1345+ void *h2;
1346+ int major, minor;
321e94d6 1347+
4b0e5c1b
AM
1348+ if (sscanf (*rpmverp, "%d.%d", &major, &minor) != 2)
1349+ {
1350+ fprintf (stderr, "Unable to parse RPMVERSION.\n");
1351+ fprintf (f, "%s\n", $LIBRPM_STRING);
1352+ return 0;
1353+ }
1354+ /* Avoid the square brackets by malloc. */
1355+ h2_name = malloc (64);
1356+ sprintf (h2_name, "librpm-%d.%d.so", major, minor);
1357+ h2 = dlopen (h2_name, RTLD_LAZY);
1358+ if (!h2)
1359+ {
1360+ fprintf (stderr, "dlopen (\"%s\"): %s\n", h2_name, dlerror ());
1361+ fprintf (f, "%s\n", $LIBRPM_STRING);
1362+ return 0;
1363+ }
1364+ if (h2 != h)
1365+ {
1366+ fprintf (stderr, "dlopen of \"%s\" and \"%s\" are different.\n",
1367+ $LIBRPM_STRING, h2_name);
1368+ fprintf (f, "%s\n", $LIBRPM_STRING);
1369+ return 0;
1370+ }
1371+ /* Found the valid .so name with a specific version. */
1372+ fprintf (f, "%s\n", h2_name);
1373+ return 0;
1374+ }
1375+ ]]), [
1376+ DLOPEN_LIBRPM="`cat conftest.out`"
1377+ if test "x$DLOPEN_LIBRPM" != "x"; then
1378+ HAVE_DLOPEN_LIBRPM=true
1379+ AC_MSG_RESULT($DLOPEN_LIBRPM)
1380+ fi
1381+ ])
1382+ rm -f conftest.out
321e94d6 1383+
4b0e5c1b
AM
1384+ m4_define([CHECK_LIBRPM_COMPAT], [
1385+ AC_MSG_CHECKING([rpm library API compatibility])
1386+ # The compilation requires -Werror to verify anything.
1387+ save_CFLAGS="$CFLAGS"
1388+ CFLAGS="$CFLAGS -Werror"
1389+ AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[
1390+/* Duplicate here the declarations to verify they match "elfread.c". */
1391+#include <rpm/rpmlib.h>
1392+#include <rpm/rpmts.h>
1393+#include <rpm/rpmdb.h>
1394+#include <rpm/header.h>
1395+extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
1396+extern int rpmReadConfigFiles(const char * file, const char * target);
1397+extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
1398+extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
1399+extern rpmts rpmtsCreate(void);
1400+extern rpmts rpmtsFree(rpmts ts);
1401+extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
1402+ const void * keyp, size_t keylen);
1403+ ]]), [
1404+ LIBRPM_COMPAT=true
1405+ AC_MSG_RESULT(yes)
1406+ ], [
1407+ LIBRPM_COMPAT=false
1408+ AC_MSG_RESULT(no)
1409+ ])
1410+ CFLAGS="$save_CFLAGS"
1411+ ])
321e94d6 1412+
4b0e5c1b
AM
1413+ if $HAVE_DLOPEN_LIBRPM; then
1414+ CHECK_LIBRPM_COMPAT
1415+ if ! $LIBRPM_COMPAT; then
1416+ HAVE_DLOPEN_LIBRPM=false
1417+ fi
1418+ fi
321e94d6 1419+
4b0e5c1b
AM
1420+ if $HAVE_DLOPEN_LIBRPM; then
1421+ DLOPEN_LIBRPM_STRING='"'"$DLOPEN_LIBRPM"'"'
1422+ AC_DEFINE_UNQUOTED(DLOPEN_LIBRPM, $DLOPEN_LIBRPM_STRING, [librpm version specific library name to dlopen.])
1423+ AC_DEFINE(HAVE_LIBRPM, 1, [Define if librpm library is being used.])
1424+ else
1425+ AC_MSG_RESULT(no)
1426+ LIBS="$save_LIBS"
1427+ if $DLOPEN_REQUIRE; then
1428+ AC_MSG_ERROR([Specific name $LIBRPM was requested but it could not be opened.])
1429+ fi
1430+ PKG_CHECK_MODULES(RPM, rpm, [HAVE_LIBRPM=true], [HAVE_LIBRPM=false])
321e94d6 1431+
4b0e5c1b
AM
1432+ if $HAVE_LIBRPM; then
1433+ CHECK_LIBRPM_COMPAT
1434+ if ! $LIBRPM_COMPAT; then
1435+ HAVE_LIBRPM=false
1436+ RPM_PKG_ERRORS="Found $LIBRPM API is incompatibile with this GDB"
1437+ fi
1438+ fi
321e94d6 1439+
4b0e5c1b
AM
1440+ if $HAVE_LIBRPM; then
1441+ AC_DEFINE(HAVE_LIBRPM, 1, [Define if librpm library is being used.])
1442+ CFLAGS="$CFLAGS $RPM_CFLAGS"
1443+ LIBS="$LIBS $RPM_LIBS"
1444+ else
1445+ if $RPM_REQUIRE; then
1446+ AC_MSG_ERROR($RPM_PKG_ERRORS)
1447+ else
1448+ AC_MSG_WARN($RPM_PKG_ERRORS)
1449+ fi
1450+ fi
1451+ fi
1452+fi
174fe25c 1453+
4b0e5c1b 1454 AC_CONFIG_SUBDIRS(testsuite)
3a58abaf 1455
4b0e5c1b 1456 # Check whether to support alternative target configurations
4b0e5c1b 1457diff --git a/gdb/event-top.c b/gdb/event-top.c
4b0e5c1b
AM
1458--- a/gdb/event-top.c
1459+++ b/gdb/event-top.c
1d2a824d 1460@@ -41,6 +41,7 @@
174fe25c 1461 #include "gdbsupport/gdb_select.h"
e28f2cc1 1462 #include "gdbsupport/gdb-sigmask.h"
174fe25c 1463 #include "async-event.h"
4b0e5c1b 1464+#include "symfile.h"
321e94d6 1465
4b0e5c1b
AM
1466 /* readline include files. */
1467 #include "readline/readline.h"
1d2a824d 1468@@ -363,6 +364,8 @@ display_gdb_prompt (const char *new_prompt)
4b0e5c1b
AM
1469 /* Reset the nesting depth used when trace-commands is set. */
1470 reset_command_nest_depth ();
321e94d6 1471
4b0e5c1b
AM
1472+ debug_flush_missing ();
1473+
1474 /* Do not call the python hook on an explicit prompt change as
1475 passed to this function, as this forms a secondary/local prompt,
1476 IE, displayed but not set. */
174fe25c 1477@@ -773,7 +776,10 @@ command_line_handler (gdb::unique_xmalloc_ptr<char> &&rl)
4b0e5c1b 1478 command_handler (cmd);
321e94d6 1479
4b0e5c1b
AM
1480 if (ui->prompt_state != PROMPTED)
1481- display_gdb_prompt (0);
321e94d6 1482+ {
4b0e5c1b
AM
1483+ debug_flush_missing ();
1484+ display_gdb_prompt (0);
321e94d6 1485+ }
4b0e5c1b 1486 }
321e94d6 1487 }
e5178960 1488
4b0e5c1b 1489diff --git a/gdb/symfile.h b/gdb/symfile.h
4b0e5c1b
AM
1490--- a/gdb/symfile.h
1491+++ b/gdb/symfile.h
1d2a824d 1492@@ -342,6 +342,7 @@ extern void generic_load (const char *args, int from_tty);
4b0e5c1b
AM
1493 /* build-id support. */
1494 extern struct bfd_build_id *build_id_addr_get (CORE_ADDR addr);
1495 extern void debug_print_missing (const char *binary, const char *debug);
1496+extern void debug_flush_missing (void);
174fe25c 1497 #define BUILD_ID_MAIN_EXECUTABLE_FILENAME _("the main executable file")
4b0e5c1b 1498
1d2a824d 1499 /* From minidebug.c. */
This page took 0.301992 seconds and 4 git commands to generate.