1 From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
2 From: Fedora GDB patches <invalid@email.com>
3 Date: Fri, 27 Oct 2017 21:07:50 +0200
4 Subject: gdb-6.6-buildid-locate-rpm.patch
6 FileName: gdb-6.6-buildid-locate-rpm.patch
10 gdb/aclocal.m4 | 215 +++++++++++++++++++++++
11 gdb/build-id.c | 407 +++++++++++++++++++++++++++++++++++++++++++-
13 gdb/configure | 508 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
14 gdb/configure.ac | 193 +++++++++++++++++++++
16 gdb/event-top.c | 8 +-
18 8 files changed, 1331 insertions(+), 10 deletions(-)
20 diff --git a/gdb/aclocal.m4 b/gdb/aclocal.m4
21 index e0d38ea267..da5ac313e3 100644
25 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
28 +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
29 +# serial 1 (pkg-config-0.24)
31 +# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
33 +# This program is free software; you can redistribute it and/or modify
34 +# it under the terms of the GNU General Public License as published by
35 +# the Free Software Foundation; either version 2 of the License, or
36 +# (at your option) any later version.
38 +# This program is distributed in the hope that it will be useful, but
39 +# WITHOUT ANY WARRANTY; without even the implied warranty of
40 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
41 +# General Public License for more details.
43 +# You should have received a copy of the GNU General Public License
44 +# along with this program; if not, write to the Free Software
45 +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
47 +# As a special exception to the GNU General Public License, if you
48 +# distribute this file as part of a program that contains a
49 +# configuration script generated by Autoconf, you may include it under
50 +# the same distribution terms that you use for the rest of that program.
52 +# PKG_PROG_PKG_CONFIG([MIN-VERSION])
53 +# ----------------------------------
54 +AC_DEFUN([PKG_PROG_PKG_CONFIG],
55 +[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
56 +m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
57 +m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
58 +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
59 +AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
60 +AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
62 +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
63 + AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
65 +if test -n "$PKG_CONFIG"; then
66 + _pkg_min_version=m4_default([$1], [0.9.0])
67 + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
68 + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
69 + AC_MSG_RESULT([yes])
75 +])# PKG_PROG_PKG_CONFIG
77 +# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
79 +# Check to see whether a particular set of modules exists. Similar
80 +# to PKG_CHECK_MODULES(), but does not set variables or print errors.
82 +# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
83 +# only at the first occurence in configure.ac, so if the first place
84 +# it's called might be skipped (such as if it is within an "if", you
85 +# have to call PKG_CHECK_EXISTS manually
86 +# --------------------------------------------------------------
87 +AC_DEFUN([PKG_CHECK_EXISTS],
88 +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
89 +if test -n "$PKG_CONFIG" && \
90 + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
91 + m4_default([$2], [:])
92 +m4_ifvaln([$3], [else
96 +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
97 +# ---------------------------------------------
98 +m4_define([_PKG_CONFIG],
99 +[if test -n "$$1"; then
101 + elif test -n "$PKG_CONFIG"; then
102 + PKG_CHECK_EXISTS([$3],
103 + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
104 + test "x$?" != "x0" && pkg_failed=yes ],
111 +# _PKG_SHORT_ERRORS_SUPPORTED
112 +# -----------------------------
113 +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
114 +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
115 +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
116 + _pkg_short_errors_supported=yes
118 + _pkg_short_errors_supported=no
120 +])# _PKG_SHORT_ERRORS_SUPPORTED
123 +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
124 +# [ACTION-IF-NOT-FOUND])
127 +# Note that if there is a possibility the first call to
128 +# PKG_CHECK_MODULES might not happen, you should be sure to include an
129 +# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
132 +# --------------------------------------------------------------
133 +AC_DEFUN([PKG_CHECK_MODULES],
134 +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
135 +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
136 +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
139 +AC_MSG_CHECKING([for $1])
141 +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
142 +_PKG_CONFIG([$1][_LIBS], [libs], [$2])
144 +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
145 +and $1[]_LIBS to avoid the need to call pkg-config.
146 +See the pkg-config man page for more details.])
148 +if test $pkg_failed = yes; then
149 + AC_MSG_RESULT([no])
150 + _PKG_SHORT_ERRORS_SUPPORTED
151 + if test $_pkg_short_errors_supported = yes; then
152 + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
154 + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
156 + # Put the nasty error message in config.log where it belongs
157 + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
159 + m4_default([$4], [AC_MSG_ERROR(
160 +[Package requirements ($2) were not met:
164 +Consider adjusting the PKG_CONFIG_PATH environment variable if you
165 +installed software in a non-standard prefix.
169 +elif test $pkg_failed = untried; then
170 + AC_MSG_RESULT([no])
171 + m4_default([$4], [AC_MSG_FAILURE(
172 +[The pkg-config script could not be found or is too old. Make sure it
173 +is in your PATH or set the PKG_CONFIG environment variable to the full
178 +To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
181 + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
182 + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
183 + AC_MSG_RESULT([yes])
186 +])# PKG_CHECK_MODULES
189 +# PKG_INSTALLDIR(DIRECTORY)
190 +# -------------------------
191 +# Substitutes the variable pkgconfigdir as the location where a module
192 +# should install pkg-config .pc files. By default the directory is
193 +# $libdir/pkgconfig, but the default can be changed by passing
194 +# DIRECTORY. The user can override through the --with-pkgconfigdir
196 +AC_DEFUN([PKG_INSTALLDIR],
197 +[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
198 +m4_pushdef([pkg_description],
199 + [pkg-config installation directory @<:@]pkg_default[@:>@])
200 +AC_ARG_WITH([pkgconfigdir],
201 + [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
202 + [with_pkgconfigdir=]pkg_default)
203 +AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
204 +m4_popdef([pkg_default])
205 +m4_popdef([pkg_description])
206 +]) dnl PKG_INSTALLDIR
209 +# PKG_NOARCH_INSTALLDIR(DIRECTORY)
210 +# -------------------------
211 +# Substitutes the variable noarch_pkgconfigdir as the location where a
212 +# module should install arch-independent pkg-config .pc files. By
213 +# default the directory is $datadir/pkgconfig, but the default can be
214 +# changed by passing DIRECTORY. The user can override through the
215 +# --with-noarch-pkgconfigdir parameter.
216 +AC_DEFUN([PKG_NOARCH_INSTALLDIR],
217 +[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
218 +m4_pushdef([pkg_description],
219 + [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
220 +AC_ARG_WITH([noarch-pkgconfigdir],
221 + [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
222 + [with_noarch_pkgconfigdir=]pkg_default)
223 +AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
224 +m4_popdef([pkg_default])
225 +m4_popdef([pkg_description])
226 +]) dnl PKG_NOARCH_INSTALLDIR
229 +# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
230 +# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
231 +# -------------------------------------------
232 +# Retrieves the value of the pkg-config variable for the given module.
233 +AC_DEFUN([PKG_CHECK_VAR],
234 +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
235 +AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
237 +_PKG_CONFIG([$1], [variable="][$3]["], [$2])
238 +AS_VAR_COPY([$1], [pkg_cv_][$1])
240 +AS_VAR_IF([$1], [""], [$5], [$4])dnl
243 # AM_AUX_DIR_EXPAND -*- Autoconf -*-
245 # Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
246 diff --git a/gdb/build-id.c b/gdb/build-id.c
247 index 5740628386..d60cf622dc 100644
251 #include "elf/common.h"
253 #include <sys/stat.h>
254 +#include "elf/external.h"
255 +#include "inferior.h"
257 #define BUILD_ID_VERBOSE_NONE 0
258 #define BUILD_ID_VERBOSE_FILENAMES 1
259 @@ -666,8 +668,366 @@ build_id_to_filename (const struct bfd_build_id *build_id, char **link_return)
265 +#include <rpm/rpmlib.h>
266 +#include <rpm/rpmts.h>
267 +#include <rpm/rpmdb.h>
268 +#include <rpm/header.h>
269 +#ifdef DLOPEN_LIBRPM
273 +/* This MISSING_RPM_HASH tracker is used to collect all the missing rpm files
274 + and avoid their duplicities during a single inferior run. */
276 +static struct htab *missing_rpm_hash;
278 +/* This MISSING_RPM_LIST tracker is used to collect and print as a single line
279 + all the rpms right before the nearest GDB prompt. It gets cleared after
280 + each such print (it is questionable if we should clear it after the print).
285 + struct missing_rpm *next;
288 +static struct missing_rpm *missing_rpm_list;
289 +static int missing_rpm_list_entries;
291 +/* Returns the count of newly added rpms. */
294 +missing_rpm_enlist (const char *filename)
296 + static int rpm_init_done = 0;
298 + rpmdbMatchIterator mi;
301 +#ifdef DLOPEN_LIBRPM
302 + /* Duplicate here the declarations to verify they match. The same sanity
303 + check is present also in `configure.ac'. */
304 + extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
305 + static char *(*headerFormat_p) (Header h, const char * fmt, errmsg_t *errmsg);
306 + extern int rpmReadConfigFiles(const char * file, const char * target);
307 + static int (*rpmReadConfigFiles_p) (const char * file, const char * target);
308 + extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
309 + static rpmdbMatchIterator (*rpmdbFreeIterator_p) (rpmdbMatchIterator mi);
310 + extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
311 + static Header (*rpmdbNextIterator_p) (rpmdbMatchIterator mi);
312 + extern rpmts rpmtsCreate(void);
313 + static rpmts (*rpmtsCreate_p) (void);
314 + extern rpmts rpmtsFree(rpmts ts);
315 + static rpmts (*rpmtsFree_p) (rpmts ts);
316 + extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
317 + const void * keyp, size_t keylen);
318 + static rpmdbMatchIterator (*rpmtsInitIterator_p) (const rpmts ts,
322 +#else /* !DLOPEN_LIBRPM */
323 +# define headerFormat_p headerFormat
324 +# define rpmReadConfigFiles_p rpmReadConfigFiles
325 +# define rpmdbFreeIterator_p rpmdbFreeIterator
326 +# define rpmdbNextIterator_p rpmdbNextIterator
327 +# define rpmtsCreate_p rpmtsCreate
328 +# define rpmtsFree_p rpmtsFree
329 +# define rpmtsInitIterator_p rpmtsInitIterator
330 +#endif /* !DLOPEN_LIBRPM */
332 + gdb_assert (filename != NULL);
334 + if (strcmp (filename, BUILD_ID_MAIN_EXECUTABLE_FILENAME) == 0)
337 + if (is_target_filename (filename))
340 + if (filename[0] != '/')
342 + warning (_("Ignoring non-absolute filename: <%s>"), filename);
346 + if (!rpm_init_done)
348 + static int init_tried;
350 + /* Already failed the initialization before? */
355 +#ifdef DLOPEN_LIBRPM
359 + h = dlopen (DLOPEN_LIBRPM, RTLD_LAZY);
362 + warning (_("Unable to open \"%s\" (%s), "
363 + "missing debuginfos notifications will not be displayed"),
364 + DLOPEN_LIBRPM, dlerror ());
368 + if (!((headerFormat_p = (char *(*) (Header h, const char * fmt, errmsg_t *errmsg)) dlsym (h, "headerFormat"))
369 + && (rpmReadConfigFiles_p = (int (*) (const char * file, const char * target)) dlsym (h, "rpmReadConfigFiles"))
370 + && (rpmdbFreeIterator_p = (rpmdbMatchIterator (*) (rpmdbMatchIterator mi)) dlsym (h, "rpmdbFreeIterator"))
371 + && (rpmdbNextIterator_p = (Header (*) (rpmdbMatchIterator mi)) dlsym (h, "rpmdbNextIterator"))
372 + && (rpmtsCreate_p = (rpmts (*) (void)) dlsym (h, "rpmtsCreate"))
373 + && (rpmtsFree_p = (rpmts (*) (rpmts ts)) dlsym (h, "rpmtsFree"))
374 + && (rpmtsInitIterator_p = (rpmdbMatchIterator (*) (const rpmts ts, rpmTag rpmtag, const void *keyp, size_t keylen)) dlsym (h, "rpmtsInitIterator"))))
376 + warning (_("Opened library \"%s\" is incompatible (%s), "
377 + "missing debuginfos notifications will not be displayed"),
378 + DLOPEN_LIBRPM, dlerror ());
380 + warning (_("Error closing library \"%s\": %s\n"), DLOPEN_LIBRPM,
385 +#endif /* DLOPEN_LIBRPM */
387 + if (rpmReadConfigFiles_p (NULL, NULL) != 0)
389 + warning (_("Error reading the rpm configuration files"));
396 + ts = rpmtsCreate_p ();
398 + mi = rpmtsInitIterator_p (ts, RPMTAG_BASENAMES, filename, 0);
404 + char *debuginfo, **slot, *s, *s2;
406 + size_t srcrpmlen = sizeof (".src.rpm") - 1;
407 + size_t debuginfolen = sizeof ("-debuginfo") - 1;
408 + rpmdbMatchIterator mi_debuginfo;
410 + h = rpmdbNextIterator_p (mi);
414 + /* Verify the debuginfo file is not already installed. */
416 + debuginfo = headerFormat_p (h, "%{sourcerpm}-debuginfo.%{arch}",
420 + warning (_("Error querying the rpm file `%s': %s"), filename,
424 + /* s = `.src.rpm-debuginfo.%{arch}' */
425 + s = strrchr (debuginfo, '-') - srcrpmlen;
427 + if (s > debuginfo && memcmp (s, ".src.rpm", srcrpmlen) == 0)
429 + /* s2 = `-%{release}.src.rpm-debuginfo.%{arch}' */
430 + s2 = (char *) memrchr (debuginfo, '-', s - debuginfo);
434 + /* s2 = `-%{version}-%{release}.src.rpm-debuginfo.%{arch}' */
435 + s2 = (char *) memrchr (debuginfo, '-', s2 - debuginfo);
439 + warning (_("Error querying the rpm file `%s': %s"), filename,
444 + /* s = `.src.rpm-debuginfo.%{arch}' */
445 + /* s2 = `-%{version}-%{release}.src.rpm-debuginfo.%{arch}' */
446 + memmove (s2 + debuginfolen, s2, s - s2);
447 + memcpy (s2, "-debuginfo", debuginfolen);
448 + /* s = `XXXX.%{arch}' */
449 + /* strlen ("XXXX") == srcrpmlen + debuginfolen */
450 + /* s2 = `-debuginfo-%{version}-%{release}XX.%{arch}' */
451 + /* strlen ("XX") == srcrpmlen */
452 + memmove (s + debuginfolen, s + srcrpmlen + debuginfolen,
453 + strlen (s + srcrpmlen + debuginfolen) + 1);
454 + /* s = `-debuginfo-%{version}-%{release}.%{arch}' */
456 + /* RPMDBI_PACKAGES requires keylen == sizeof (int). */
457 + /* RPMDBI_LABEL is an interface for NVR-based dbiFindByLabel(). */
458 + mi_debuginfo = rpmtsInitIterator_p (ts, (rpmTag) RPMDBI_LABEL, debuginfo, 0);
462 + rpmdbFreeIterator_p (mi_debuginfo);
467 + /* The allocated memory gets utilized below for MISSING_RPM_HASH. */
468 + debuginfo = headerFormat_p (h,
469 + "%{name}-%{version}-%{release}.%{arch}",
473 + warning (_("Error querying the rpm file `%s': %s"), filename,
478 + /* Base package name for `debuginfo-install'. We do not use the
479 + `yum' command directly as the line
480 + yum --enablerepo='*debug*' install NAME-debuginfo.ARCH
481 + would be more complicated than just:
482 + debuginfo-install NAME-VERSION-RELEASE.ARCH
483 + Do not supply the rpm base name (derived from .src.rpm name) as
484 + debuginfo-install is unable to install the debuginfo package if
485 + the base name PKG binary rpm is not installed while for example
486 + PKG-libs would be installed (RH Bug 467901).
487 + FUTURE: After multiple debuginfo versions simultaneously installed
488 + get supported the support for the VERSION-RELEASE tags handling
489 + may need an update. */
491 + if (missing_rpm_hash == NULL)
493 + /* DEL_F is passed NULL as MISSING_RPM_LIST's HTAB_DELETE
494 + should not deallocate the entries. */
496 + missing_rpm_hash = htab_create_alloc (64, htab_hash_string,
497 + (int (*) (const void *, const void *)) streq,
498 + NULL, xcalloc, xfree);
500 + slot = (char **) htab_find_slot (missing_rpm_hash, debuginfo, INSERT);
501 + /* XCALLOC never returns NULL. */
502 + gdb_assert (slot != NULL);
505 + struct missing_rpm *missing_rpm;
509 + missing_rpm = (struct missing_rpm *) xmalloc (sizeof (*missing_rpm) + strlen (debuginfo));
510 + strcpy (missing_rpm->rpm, debuginfo);
511 + missing_rpm->next = missing_rpm_list;
512 + missing_rpm_list = missing_rpm;
513 + missing_rpm_list_entries++;
520 + rpmdbFreeIterator_p (mi);
529 +missing_rpm_list_compar (const char *const *ap, const char *const *bp)
531 + return strcoll (*ap, *bp);
534 +/* It returns a NULL-terminated array of strings needing to be FREEd. It may
535 + also return only NULL. */
538 +missing_rpm_list_print (void)
540 + char **array, **array_iter;
541 + struct missing_rpm *list_iter;
542 + struct cleanup *cleanups;
544 + if (missing_rpm_list_entries == 0)
547 + array = (char **) xmalloc (sizeof (*array) * missing_rpm_list_entries);
548 + cleanups = make_cleanup (xfree, array);
550 + array_iter = array;
551 + for (list_iter = missing_rpm_list; list_iter != NULL;
552 + list_iter = list_iter->next)
554 + *array_iter++ = list_iter->rpm;
556 + gdb_assert (array_iter == array + missing_rpm_list_entries);
558 + qsort (array, missing_rpm_list_entries, sizeof (*array),
559 + (int (*) (const void *, const void *)) missing_rpm_list_compar);
561 + printf_unfiltered (_("Missing separate debuginfos, use: %s"),
562 +#ifdef DNF_DEBUGINFO_INSTALL
565 + "debuginfo-install");
566 + for (array_iter = array; array_iter < array + missing_rpm_list_entries;
569 + putchar_unfiltered (' ');
570 + puts_unfiltered (*array_iter);
572 + putchar_unfiltered ('\n');
574 + while (missing_rpm_list != NULL)
576 + list_iter = missing_rpm_list;
577 + missing_rpm_list = list_iter->next;
580 + missing_rpm_list_entries = 0;
582 + do_cleanups (cleanups);
586 +missing_rpm_change (void)
588 + debug_flush_missing ();
590 + gdb_assert (missing_rpm_list == NULL);
591 + if (missing_rpm_hash != NULL)
593 + htab_delete (missing_rpm_hash);
594 + missing_rpm_hash = NULL;
600 + /* Init state. EXEC_BFD also still could be NULL. */
601 + MISSING_EXEC_NOT_TRIED,
602 + /* We saw a non-NULL EXEC_BFD but RPM has no info about it. */
603 + MISSING_EXEC_NOT_FOUND,
604 + /* We found EXEC_BFD by RPM and we either have its symbols (either embedded
605 + or separate) or the main executable's RPM is now contained in
606 + MISSING_RPM_HASH. */
607 + MISSING_EXEC_ENLISTED
609 +static enum missing_exec missing_exec = MISSING_EXEC_NOT_TRIED;
611 +#endif /* HAVE_LIBRPM */
614 +debug_flush_missing (void)
617 + missing_rpm_list_print ();
621 /* This MISSING_FILEPAIR_HASH tracker is used only for the duplicite messages
622 - Try to install the hash file ...
623 + yum --enablerepo='*debug*' install ...
626 struct missing_filepair
627 @@ -721,11 +1081,17 @@ missing_filepair_change (void)
628 /* All their memory came just from missing_filepair_OBSTACK. */
629 missing_filepair_hash = NULL;
632 + missing_exec = MISSING_EXEC_NOT_TRIED;
637 debug_print_executable_changed (void)
640 + missing_rpm_change ();
642 missing_filepair_change ();
645 @@ -792,14 +1158,39 @@ debug_print_missing (const char *binary, const char *debug)
647 *slot = missing_filepair;
649 - /* We do not collect and flush these messages as each such message
650 - already requires its own separate lines. */
652 + if (missing_exec == MISSING_EXEC_NOT_TRIED)
654 + char *execfilename;
656 - fprintf_unfiltered (gdb_stdlog,
657 - _("Missing separate debuginfo for %s\n"), binary);
659 - fprintf_unfiltered (gdb_stdlog, _("Try to install the hash file %s\n"),
661 + execfilename = get_exec_file (0);
662 + if (execfilename != NULL)
664 + if (missing_rpm_enlist (execfilename) == 0)
665 + missing_exec = MISSING_EXEC_NOT_FOUND;
667 + missing_exec = MISSING_EXEC_ENLISTED;
670 + if (missing_exec != MISSING_EXEC_ENLISTED)
671 + if ((binary[0] == 0 || missing_rpm_enlist (binary) == 0)
672 + && (debug == NULL || missing_rpm_enlist (debug) == 0))
673 +#endif /* HAVE_LIBRPM */
675 + /* We do not collect and flush these messages as each such message
676 + already requires its own separate lines. */
678 + fprintf_unfiltered (gdb_stdlog,
679 + _("Missing separate debuginfo for %s\n"), binary);
681 + fprintf_unfiltered (gdb_stdlog, _("Try: %s %s\n"),
682 +#ifdef DNF_DEBUGINFO_INSTALL
687 + " --enablerepo='*debug*' install", debug);
691 /* See build-id.h. */
692 diff --git a/gdb/config.in b/gdb/config.in
693 index 1d11a97080..edd7028f76 100644
697 /* Define to BFD's default target vector. */
698 #undef DEFAULT_BFD_VEC
700 +/* librpm version specific library name to dlopen. */
701 +#undef DLOPEN_LIBRPM
703 /* Define to 1 if translation of program messages to the user's native
704 language is requested. */
707 /* Define if Python 2.7 is being used. */
708 #undef HAVE_LIBPYTHON2_7
710 +/* Define if librpm library is being used. */
713 /* Define to 1 if you have the <libunwind-ia64.h> header file. */
714 #undef HAVE_LIBUNWIND_IA64_H
716 diff --git a/gdb/configure b/gdb/configure
717 index 092893d757..1cecdbc3b5 100755
720 @@ -716,6 +716,11 @@ PKGVERSION
721 HAVE_NATIVE_GCORE_TARGET
732 @@ -820,6 +825,7 @@ with_gdb_datadir
733 with_relocated_sources
735 with_auto_load_safe_path
740 @@ -878,6 +884,11 @@ CCC
752 @@ -1548,6 +1559,8 @@ Optional Packages:
753 [--with-auto-load-dir]
754 --without-auto-load-safe-path
755 do not restrict auto-loaded files locations
756 + --with-rpm query rpm database for missing debuginfos (yes/no,
757 + def. auto=librpm.so)
758 --with-libunwind-ia64 use libunwind frame unwinding for ia64 targets
759 --with-curses use the curses library instead of the termcap
761 @@ -1605,6 +1618,13 @@ Some influential environment variables:
762 MAKEINFO Parent configure detects if it is of sufficient version.
764 Parameters for MAKEINFO.
765 + PKG_CONFIG path to pkg-config utility
767 + directories to add to pkg-config's search path
769 + path overriding pkg-config's built-in search path
770 + RPM_CFLAGS C compiler flags for RPM, overriding pkg-config
771 + RPM_LIBS linker flags for RPM, overriding pkg-config
772 YACC The `Yet Another C Compiler' implementation to use. Defaults to
773 the first program found out of: `bison -y', `byacc', `yacc'.
774 YFLAGS The list of arguments that will be passed by default to $YACC.
775 @@ -6486,6 +6506,494 @@ _ACEOF
776 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_auto_load_safe_path" >&5
777 $as_echo "$with_auto_load_safe_path" >&6; }
779 +# Integration with rpm library to support missing debuginfo suggestions.
780 +# --without-rpm: Disable any rpm support.
781 +# --with-rpm=libname.so: Try to dynamically open `libname.so' during runtime.
782 +# Even with runtime missing `libname.so' GDB will still other run correctly.
783 +# Missing `libname.so' during ./configure will abort the configuration.
784 +# --with-rpm=librpm.so: Like `--with-rpm=libname.so' but try to find specific
785 +# minor version first such as `librpm-4.6.so' as minor version differences
786 +# mean API+ABI incompatibility. If the specific match versioned library name
787 +# could not be found still open dynamically at least `librpm.so'.
788 +# --with-rpm: Like `--with-rpm=librpm.so' but if any of its detection fails try
789 +# to find librpm for compilation-time linking by pkg-config. GDB binary will
790 +# be probably linked with the version specific library (as `librpm-4.6.so').
791 +# Failure to find librpm by pkg-config will abort the configuration.
792 +# (default) --with-rpm=auto: Like `--with-rpm=librpm.so' but if even pkg-config
793 +# cannot find librpm use to the rpmless compilation (like `--without-rpm').
796 +# Check whether --with-rpm was given.
797 +if test "${with_rpm+set}" = set; then :
806 +if test "x$with_rpm" != "xno"; then
807 + if test "x$with_rpm" = "xyes"; then
810 + DLOPEN_REQUIRE=false
811 + elif test "x$with_rpm" = "xauto"; then
814 + DLOPEN_REQUIRE=false
818 + DLOPEN_REQUIRE=true
820 + LIBRPM_STRING='"'"$LIBRPM"'"'
822 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking specific librpm version" >&5
823 +$as_echo_n "checking specific librpm version... " >&6; }
824 + HAVE_DLOPEN_LIBRPM=false
827 + if test "$cross_compiling" = yes; then :
828 + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
829 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
830 +as_fn_error "cannot run test program while cross compiling
831 +See \`config.log' for more details." "$LINENO" 5; }
833 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext
834 +/* end confdefs.h. */
836 +#include <rpm/rpmlib.h>
845 + const char *const *rpmverp;
848 + f = fopen ("conftest.out", "w");
851 + fprintf (stderr, "Cannot write \"%s\": %s\n", "conftest.out",
855 + h = dlopen ($LIBRPM_STRING, RTLD_LAZY);
858 + fprintf (stderr, "dlopen (\"%s\"): %s\n", $LIBRPM_STRING, dlerror ());
861 + rpmverp = dlsym (h, "RPMVERSION");
864 + fprintf (stderr, "dlsym (\"RPMVERSION\"): %s\n", dlerror ());
867 + fprintf (stderr, "RPMVERSION is: \"");
868 + fprintf (stderr, "%s\"\n", *rpmverp);
870 + /* Try to find the specific librpm version only for "librpm.so" as we do
871 + not know how to assemble the version string otherwise. */
873 + if (strcmp ("librpm.so", $LIBRPM_STRING) != 0)
875 + fprintf (f, "%s\n", $LIBRPM_STRING);
884 + if (sscanf (*rpmverp, "%d.%d", &major, &minor) != 2)
886 + fprintf (stderr, "Unable to parse RPMVERSION.\n");
887 + fprintf (f, "%s\n", $LIBRPM_STRING);
890 + /* Avoid the square brackets by malloc. */
891 + h2_name = malloc (64);
892 + sprintf (h2_name, "librpm-%d.%d.so", major, minor);
893 + h2 = dlopen (h2_name, RTLD_LAZY);
896 + fprintf (stderr, "dlopen (\"%s\"): %s\n", h2_name, dlerror ());
897 + fprintf (f, "%s\n", $LIBRPM_STRING);
902 + fprintf (stderr, "dlopen of \"%s\" and \"%s\" are different.\n",
903 + $LIBRPM_STRING, h2_name);
904 + fprintf (f, "%s\n", $LIBRPM_STRING);
907 + /* Found the valid .so name with a specific version. */
908 + fprintf (f, "%s\n", h2_name);
916 +if ac_fn_c_try_run "$LINENO"; then :
918 + DLOPEN_LIBRPM="`cat conftest.out`"
919 + if test "x$DLOPEN_LIBRPM" != "x"; then
920 + HAVE_DLOPEN_LIBRPM=true
921 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLOPEN_LIBRPM" >&5
922 +$as_echo "$DLOPEN_LIBRPM" >&6; }
926 +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
927 + conftest.$ac_objext conftest.beam conftest.$ac_ext
934 + if $HAVE_DLOPEN_LIBRPM; then
936 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking rpm library API compatibility" >&5
937 +$as_echo_n "checking rpm library API compatibility... " >&6; }
938 + # The compilation requires -Werror to verify anything.
939 + save_CFLAGS="$CFLAGS"
940 + CFLAGS="$CFLAGS -Werror"
941 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext
942 +/* end confdefs.h. */
944 +/* Duplicate here the declarations to verify they match "elfread.c". */
945 +#include <rpm/rpmlib.h>
946 +#include <rpm/rpmts.h>
947 +#include <rpm/rpmdb.h>
948 +#include <rpm/header.h>
949 +extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
950 +extern int rpmReadConfigFiles(const char * file, const char * target);
951 +extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
952 +extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
953 +extern rpmts rpmtsCreate(void);
954 +extern rpmts rpmtsFree(rpmts ts);
955 +extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
956 + const void * keyp, size_t keylen);
966 +if ac_fn_c_try_compile "$LINENO"; then :
969 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
970 +$as_echo "yes" >&6; }
974 + LIBRPM_COMPAT=false
975 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
976 +$as_echo "no" >&6; }
979 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
980 + CFLAGS="$save_CFLAGS"
982 + if ! $LIBRPM_COMPAT; then
983 + HAVE_DLOPEN_LIBRPM=false
987 + if $HAVE_DLOPEN_LIBRPM; then
988 + DLOPEN_LIBRPM_STRING='"'"$DLOPEN_LIBRPM"'"'
990 +cat >>confdefs.h <<_ACEOF
991 +#define DLOPEN_LIBRPM $DLOPEN_LIBRPM_STRING
995 +$as_echo "#define HAVE_LIBRPM 1" >>confdefs.h
998 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
999 +$as_echo "no" >&6; }
1001 + if $DLOPEN_REQUIRE; then
1002 + as_fn_error "Specific name $LIBRPM was requested but it could not be opened." "$LINENO" 5
1011 +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1012 + if test -n "$ac_tool_prefix"; then
1013 + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
1014 +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
1015 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
1016 +$as_echo_n "checking for $ac_word... " >&6; }
1017 +if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
1018 + $as_echo_n "(cached) " >&6
1020 + case $PKG_CONFIG in
1021 + [\\/]* | ?:[\\/]*)
1022 + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
1025 + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1026 +for as_dir in $PATH
1029 + test -z "$as_dir" && as_dir=.
1030 + for ac_exec_ext in '' $ac_executable_extensions; do
1031 + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
1032 + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
1033 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
1043 +PKG_CONFIG=$ac_cv_path_PKG_CONFIG
1044 +if test -n "$PKG_CONFIG"; then
1045 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
1046 +$as_echo "$PKG_CONFIG" >&6; }
1048 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
1049 +$as_echo "no" >&6; }
1054 +if test -z "$ac_cv_path_PKG_CONFIG"; then
1055 + ac_pt_PKG_CONFIG=$PKG_CONFIG
1056 + # Extract the first word of "pkg-config", so it can be a program name with args.
1057 +set dummy pkg-config; ac_word=$2
1058 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
1059 +$as_echo_n "checking for $ac_word... " >&6; }
1060 +if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then :
1061 + $as_echo_n "(cached) " >&6
1063 + case $ac_pt_PKG_CONFIG in
1064 + [\\/]* | ?:[\\/]*)
1065 + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
1068 + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1069 +for as_dir in $PATH
1072 + test -z "$as_dir" && as_dir=.
1073 + for ac_exec_ext in '' $ac_executable_extensions; do
1074 + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
1075 + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
1076 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
1086 +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
1087 +if test -n "$ac_pt_PKG_CONFIG"; then
1088 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
1089 +$as_echo "$ac_pt_PKG_CONFIG" >&6; }
1091 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
1092 +$as_echo "no" >&6; }
1095 + if test "x$ac_pt_PKG_CONFIG" = x; then
1098 + case $cross_compiling:$ac_tool_warned in
1100 +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
1101 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
1102 +ac_tool_warned=yes ;;
1104 + PKG_CONFIG=$ac_pt_PKG_CONFIG
1107 + PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
1111 +if test -n "$PKG_CONFIG"; then
1112 + _pkg_min_version=0.9.0
1113 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
1114 +$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
1115 + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1116 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
1117 +$as_echo "yes" >&6; }
1119 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
1120 +$as_echo "no" >&6; }
1126 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for RPM" >&5
1127 +$as_echo_n "checking for RPM... " >&6; }
1129 +if test -n "$RPM_CFLAGS"; then
1130 + pkg_cv_RPM_CFLAGS="$RPM_CFLAGS"
1131 + elif test -n "$PKG_CONFIG"; then
1132 + if test -n "$PKG_CONFIG" && \
1133 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"rpm\""; } >&5
1134 + ($PKG_CONFIG --exists --print-errors "rpm") 2>&5
1136 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
1137 + test $ac_status = 0; }; then
1138 + pkg_cv_RPM_CFLAGS=`$PKG_CONFIG --cflags "rpm" 2>/dev/null`
1139 + test "x$?" != "x0" && pkg_failed=yes
1144 + pkg_failed=untried
1146 +if test -n "$RPM_LIBS"; then
1147 + pkg_cv_RPM_LIBS="$RPM_LIBS"
1148 + elif test -n "$PKG_CONFIG"; then
1149 + if test -n "$PKG_CONFIG" && \
1150 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"rpm\""; } >&5
1151 + ($PKG_CONFIG --exists --print-errors "rpm") 2>&5
1153 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
1154 + test $ac_status = 0; }; then
1155 + pkg_cv_RPM_LIBS=`$PKG_CONFIG --libs "rpm" 2>/dev/null`
1156 + test "x$?" != "x0" && pkg_failed=yes
1161 + pkg_failed=untried
1166 +if test $pkg_failed = yes; then
1167 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
1168 +$as_echo "no" >&6; }
1170 +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1171 + _pkg_short_errors_supported=yes
1173 + _pkg_short_errors_supported=no
1175 + if test $_pkg_short_errors_supported = yes; then
1176 + RPM_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "rpm" 2>&1`
1178 + RPM_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "rpm" 2>&1`
1180 + # Put the nasty error message in config.log where it belongs
1181 + echo "$RPM_PKG_ERRORS" >&5
1184 +elif test $pkg_failed = untried; then
1185 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
1186 +$as_echo "no" >&6; }
1189 + RPM_CFLAGS=$pkg_cv_RPM_CFLAGS
1190 + RPM_LIBS=$pkg_cv_RPM_LIBS
1191 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
1192 +$as_echo "yes" >&6; }
1196 + if $HAVE_LIBRPM; then
1198 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking rpm library API compatibility" >&5
1199 +$as_echo_n "checking rpm library API compatibility... " >&6; }
1200 + # The compilation requires -Werror to verify anything.
1201 + save_CFLAGS="$CFLAGS"
1202 + CFLAGS="$CFLAGS -Werror"
1203 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1204 +/* end confdefs.h. */
1206 +/* Duplicate here the declarations to verify they match "elfread.c". */
1207 +#include <rpm/rpmlib.h>
1208 +#include <rpm/rpmts.h>
1209 +#include <rpm/rpmdb.h>
1210 +#include <rpm/header.h>
1211 +extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
1212 +extern int rpmReadConfigFiles(const char * file, const char * target);
1213 +extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
1214 +extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
1215 +extern rpmts rpmtsCreate(void);
1216 +extern rpmts rpmtsFree(rpmts ts);
1217 +extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
1218 + const void * keyp, size_t keylen);
1228 +if ac_fn_c_try_compile "$LINENO"; then :
1230 + LIBRPM_COMPAT=true
1231 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
1232 +$as_echo "yes" >&6; }
1236 + LIBRPM_COMPAT=false
1237 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
1238 +$as_echo "no" >&6; }
1241 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
1242 + CFLAGS="$save_CFLAGS"
1244 + if ! $LIBRPM_COMPAT; then
1246 + RPM_PKG_ERRORS="Found $LIBRPM API is incompatibile with this GDB"
1250 + if $HAVE_LIBRPM; then
1252 +$as_echo "#define HAVE_LIBRPM 1" >>confdefs.h
1254 + CFLAGS="$CFLAGS $RPM_CFLAGS"
1255 + LIBS="$LIBS $RPM_LIBS"
1257 + if $RPM_REQUIRE; then
1258 + as_fn_error "$RPM_PKG_ERRORS" "$LINENO" 5
1260 + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $RPM_PKG_ERRORS" >&5
1261 +$as_echo "$as_me: WARNING: $RPM_PKG_ERRORS" >&2;}
1269 subdirs="$subdirs testsuite"
1270 diff --git a/gdb/configure.ac b/gdb/configure.ac
1271 index d4133ea71e..e232c1adcb 100644
1272 --- a/gdb/configure.ac
1273 +++ b/gdb/configure.ac
1274 @@ -167,6 +167,199 @@ AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escape_dir,
1275 [Directories safe to hold auto-loaded files.])
1276 AC_MSG_RESULT([$with_auto_load_safe_path])
1278 +# Integration with rpm library to support missing debuginfo suggestions.
1279 +# --without-rpm: Disable any rpm support.
1280 +# --with-rpm=libname.so: Try to dynamically open `libname.so' during runtime.
1281 +# Even with runtime missing `libname.so' GDB will still other run correctly.
1282 +# Missing `libname.so' during ./configure will abort the configuration.
1283 +# --with-rpm=librpm.so: Like `--with-rpm=libname.so' but try to find specific
1284 +# minor version first such as `librpm-4.6.so' as minor version differences
1285 +# mean API+ABI incompatibility. If the specific match versioned library name
1286 +# could not be found still open dynamically at least `librpm.so'.
1287 +# --with-rpm: Like `--with-rpm=librpm.so' but if any of its detection fails try
1288 +# to find librpm for compilation-time linking by pkg-config. GDB binary will
1289 +# be probably linked with the version specific library (as `librpm-4.6.so').
1290 +# Failure to find librpm by pkg-config will abort the configuration.
1291 +# (default) --with-rpm=auto: Like `--with-rpm=librpm.so' but if even pkg-config
1292 +# cannot find librpm use to the rpmless compilation (like `--without-rpm').
1295 + [AS_HELP_STRING([--with-rpm],
1296 + [query rpm database for missing debuginfos (yes/no, def. auto=librpm.so)])], [], [with_rpm="auto"])
1298 +m4_pattern_allow([^AC_MSG_ERROR$])
1299 +m4_pattern_allow([^AC_MSG_WARN$])
1300 +if test "x$with_rpm" != "xno"; then
1301 + if test "x$with_rpm" = "xyes"; then
1302 + LIBRPM="librpm.so"
1304 + DLOPEN_REQUIRE=false
1305 + elif test "x$with_rpm" = "xauto"; then
1306 + LIBRPM="librpm.so"
1308 + DLOPEN_REQUIRE=false
1310 + LIBRPM="$with_rpm"
1312 + DLOPEN_REQUIRE=true
1314 + LIBRPM_STRING='"'"$LIBRPM"'"'
1316 + AC_MSG_CHECKING([specific librpm version])
1317 + HAVE_DLOPEN_LIBRPM=false
1320 + AC_RUN_IFELSE(AC_LANG_PROGRAM([[
1321 +#include <rpm/rpmlib.h>
1326 + const char *const *rpmverp;
1329 + f = fopen ("conftest.out", "w");
1332 + fprintf (stderr, "Cannot write \"%s\": %s\n", "conftest.out",
1333 + strerror (errno));
1336 + h = dlopen ($LIBRPM_STRING, RTLD_LAZY);
1339 + fprintf (stderr, "dlopen (\"%s\"): %s\n", $LIBRPM_STRING, dlerror ());
1342 + rpmverp = dlsym (h, "RPMVERSION");
1345 + fprintf (stderr, "dlsym (\"RPMVERSION\"): %s\n", dlerror ());
1348 + fprintf (stderr, "RPMVERSION is: \"");
1349 + fprintf (stderr, "%s\"\n", *rpmverp);
1351 + /* Try to find the specific librpm version only for "librpm.so" as we do
1352 + not know how to assemble the version string otherwise. */
1354 + if (strcmp ("librpm.so", $LIBRPM_STRING) != 0)
1356 + fprintf (f, "%s\n", $LIBRPM_STRING);
1365 + if (sscanf (*rpmverp, "%d.%d", &major, &minor) != 2)
1367 + fprintf (stderr, "Unable to parse RPMVERSION.\n");
1368 + fprintf (f, "%s\n", $LIBRPM_STRING);
1371 + /* Avoid the square brackets by malloc. */
1372 + h2_name = malloc (64);
1373 + sprintf (h2_name, "librpm-%d.%d.so", major, minor);
1374 + h2 = dlopen (h2_name, RTLD_LAZY);
1377 + fprintf (stderr, "dlopen (\"%s\"): %s\n", h2_name, dlerror ());
1378 + fprintf (f, "%s\n", $LIBRPM_STRING);
1383 + fprintf (stderr, "dlopen of \"%s\" and \"%s\" are different.\n",
1384 + $LIBRPM_STRING, h2_name);
1385 + fprintf (f, "%s\n", $LIBRPM_STRING);
1388 + /* Found the valid .so name with a specific version. */
1389 + fprintf (f, "%s\n", h2_name);
1393 + DLOPEN_LIBRPM="`cat conftest.out`"
1394 + if test "x$DLOPEN_LIBRPM" != "x"; then
1395 + HAVE_DLOPEN_LIBRPM=true
1396 + AC_MSG_RESULT($DLOPEN_LIBRPM)
1399 + rm -f conftest.out
1401 + m4_define([CHECK_LIBRPM_COMPAT], [
1402 + AC_MSG_CHECKING([rpm library API compatibility])
1403 + # The compilation requires -Werror to verify anything.
1404 + save_CFLAGS="$CFLAGS"
1405 + CFLAGS="$CFLAGS -Werror"
1406 + AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[
1407 +/* Duplicate here the declarations to verify they match "elfread.c". */
1408 +#include <rpm/rpmlib.h>
1409 +#include <rpm/rpmts.h>
1410 +#include <rpm/rpmdb.h>
1411 +#include <rpm/header.h>
1412 +extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
1413 +extern int rpmReadConfigFiles(const char * file, const char * target);
1414 +extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
1415 +extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
1416 +extern rpmts rpmtsCreate(void);
1417 +extern rpmts rpmtsFree(rpmts ts);
1418 +extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
1419 + const void * keyp, size_t keylen);
1421 + LIBRPM_COMPAT=true
1422 + AC_MSG_RESULT(yes)
1424 + LIBRPM_COMPAT=false
1427 + CFLAGS="$save_CFLAGS"
1430 + if $HAVE_DLOPEN_LIBRPM; then
1431 + CHECK_LIBRPM_COMPAT
1432 + if ! $LIBRPM_COMPAT; then
1433 + HAVE_DLOPEN_LIBRPM=false
1437 + if $HAVE_DLOPEN_LIBRPM; then
1438 + DLOPEN_LIBRPM_STRING='"'"$DLOPEN_LIBRPM"'"'
1439 + AC_DEFINE_UNQUOTED(DLOPEN_LIBRPM, $DLOPEN_LIBRPM_STRING, [librpm version specific library name to dlopen.])
1440 + AC_DEFINE(HAVE_LIBRPM, 1, [Define if librpm library is being used.])
1444 + if $DLOPEN_REQUIRE; then
1445 + AC_MSG_ERROR([Specific name $LIBRPM was requested but it could not be opened.])
1447 + PKG_CHECK_MODULES(RPM, rpm, [HAVE_LIBRPM=true], [HAVE_LIBRPM=false])
1449 + if $HAVE_LIBRPM; then
1450 + CHECK_LIBRPM_COMPAT
1451 + if ! $LIBRPM_COMPAT; then
1453 + RPM_PKG_ERRORS="Found $LIBRPM API is incompatibile with this GDB"
1457 + if $HAVE_LIBRPM; then
1458 + AC_DEFINE(HAVE_LIBRPM, 1, [Define if librpm library is being used.])
1459 + CFLAGS="$CFLAGS $RPM_CFLAGS"
1460 + LIBS="$LIBS $RPM_LIBS"
1462 + if $RPM_REQUIRE; then
1463 + AC_MSG_ERROR($RPM_PKG_ERRORS)
1465 + AC_MSG_WARN($RPM_PKG_ERRORS)
1471 AC_CONFIG_SUBDIRS(testsuite)
1473 # Check whether to support alternative target configurations
1474 diff --git a/gdb/corelow.c b/gdb/corelow.c
1475 index c5b642db81..6e027c12e2 100644
1478 @@ -309,7 +309,7 @@ build_id_locate_exec (int from_tty)
1479 symfile_objfile->flags |= OBJF_BUILD_ID_CORE_LOADED;
1482 - debug_print_missing (_("the main executable file"), build_id_filename);
1483 + debug_print_missing (BUILD_ID_MAIN_EXECUTABLE_FILENAME, build_id_filename);
1485 do_cleanups (back_to);
1487 diff --git a/gdb/event-top.c b/gdb/event-top.c
1488 index 0c1528e5eb..0d668f35e0 100644
1489 --- a/gdb/event-top.c
1490 +++ b/gdb/event-top.c
1493 #include "ser-event.h"
1494 #include "gdb_select.h"
1495 +#include "symfile.h"
1497 /* readline include files. */
1498 #include "readline/readline.h"
1499 @@ -359,6 +360,8 @@ display_gdb_prompt (const char *new_prompt)
1500 /* Reset the nesting depth used when trace-commands is set. */
1501 reset_command_nest_depth ();
1503 + debug_flush_missing ();
1505 /* Do not call the python hook on an explicit prompt change as
1506 passed to this function, as this forms a secondary/local prompt,
1507 IE, displayed but not set. */
1508 @@ -774,7 +777,10 @@ command_line_handler (char *rl)
1509 command_handler (cmd);
1511 if (ui->prompt_state != PROMPTED)
1512 - display_gdb_prompt (0);
1514 + debug_flush_missing ();
1515 + display_gdb_prompt (0);
1520 diff --git a/gdb/symfile.h b/gdb/symfile.h
1521 index 0d51f46d78..82c76431e1 100644
1524 @@ -546,6 +546,8 @@ void map_symbol_filenames (symbol_filename_ftype *fun, void *data,
1525 /* build-id support. */
1526 extern struct bfd_build_id *build_id_addr_get (CORE_ADDR addr);
1527 extern void debug_print_missing (const char *binary, const char *debug);
1528 +extern void debug_flush_missing (void);
1529 +#define BUILD_ID_MAIN_EXECUTABLE_FILENAME _("the main executable file")
1531 /* From dwarf2read.c */