|
|
b94e32 |
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
|
|
b94e32 |
From: Fedora GDB patches <invalid@email.com>
|
|
|
b94e32 |
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
|
|
b94e32 |
Subject: gdb-6.6-buildid-locate-rpm.patch
|
|
|
b94e32 |
|
|
|
b94e32 |
;;=push+jan
|
|
|
b94e32 |
|
|
|
b94e32 |
diff --git a/gdb/aclocal.m4 b/gdb/aclocal.m4
|
|
|
b94e32 |
--- a/gdb/aclocal.m4
|
|
|
b94e32 |
+++ b/gdb/aclocal.m4
|
|
|
b94e32 |
@@ -11,7 +11,223 @@
|
|
|
b94e32 |
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
|
b94e32 |
# PARTICULAR PURPOSE.
|
|
|
b94e32 |
|
|
|
b94e32 |
+# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
|
|
|
b94e32 |
+# serial 1 (pkg-config-0.24)
|
|
|
b94e32 |
+#
|
|
|
b94e32 |
+# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
|
|
|
b94e32 |
+#
|
|
|
b94e32 |
+# This program is free software; you can redistribute it and/or modify
|
|
|
b94e32 |
+# it under the terms of the GNU General Public License as published by
|
|
|
b94e32 |
+# the Free Software Foundation; either version 2 of the License, or
|
|
|
b94e32 |
+# (at your option) any later version.
|
|
|
b94e32 |
+#
|
|
|
b94e32 |
+# This program is distributed in the hope that it will be useful, but
|
|
|
b94e32 |
+# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
b94e32 |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
b94e32 |
+# General Public License for more details.
|
|
|
b94e32 |
+#
|
|
|
b94e32 |
+# You should have received a copy of the GNU General Public License
|
|
|
b94e32 |
+# along with this program; if not, write to the Free Software
|
|
|
b94e32 |
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
b94e32 |
+#
|
|
|
b94e32 |
+# As a special exception to the GNU General Public License, if you
|
|
|
b94e32 |
+# distribute this file as part of a program that contains a
|
|
|
b94e32 |
+# configuration script generated by Autoconf, you may include it under
|
|
|
b94e32 |
+# the same distribution terms that you use for the rest of that program.
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+# PKG_PROG_PKG_CONFIG([MIN-VERSION])
|
|
|
b94e32 |
+# ----------------------------------
|
|
|
b94e32 |
+AC_DEFUN([PKG_PROG_PKG_CONFIG],
|
|
|
b94e32 |
+[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
|
|
|
b94e32 |
+m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
|
|
|
b94e32 |
+m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
|
|
|
b94e32 |
+AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
|
|
|
b94e32 |
+AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
|
|
|
b94e32 |
+AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
|
|
|
b94e32 |
+ AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
|
|
|
b94e32 |
+fi
|
|
|
b94e32 |
+if test -n "$PKG_CONFIG"; then
|
|
|
b94e32 |
+ _pkg_min_version=m4_default([$1], [0.9.0])
|
|
|
b94e32 |
+ AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
|
|
|
b94e32 |
+ if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
|
|
|
b94e32 |
+ AC_MSG_RESULT([yes])
|
|
|
b94e32 |
+ else
|
|
|
b94e32 |
+ AC_MSG_RESULT([no])
|
|
|
b94e32 |
+ PKG_CONFIG=""
|
|
|
b94e32 |
+ fi
|
|
|
b94e32 |
+fi[]dnl
|
|
|
b94e32 |
+])# PKG_PROG_PKG_CONFIG
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
|
|
|
b94e32 |
+#
|
|
|
b94e32 |
+# Check to see whether a particular set of modules exists. Similar
|
|
|
b94e32 |
+# to PKG_CHECK_MODULES(), but does not set variables or print errors.
|
|
|
b94e32 |
+#
|
|
|
b94e32 |
+# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
|
|
|
b94e32 |
+# only at the first occurence in configure.ac, so if the first place
|
|
|
b94e32 |
+# it's called might be skipped (such as if it is within an "if", you
|
|
|
b94e32 |
+# have to call PKG_CHECK_EXISTS manually
|
|
|
b94e32 |
+# --------------------------------------------------------------
|
|
|
b94e32 |
+AC_DEFUN([PKG_CHECK_EXISTS],
|
|
|
b94e32 |
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
|
|
|
b94e32 |
+if test -n "$PKG_CONFIG" && \
|
|
|
b94e32 |
+ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
|
|
|
b94e32 |
+ m4_default([$2], [:])
|
|
|
b94e32 |
+m4_ifvaln([$3], [else
|
|
|
b94e32 |
+ $3])dnl
|
|
|
b94e32 |
+fi])
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
|
|
|
b94e32 |
+# ---------------------------------------------
|
|
|
b94e32 |
+m4_define([_PKG_CONFIG],
|
|
|
b94e32 |
+[if test -n "$$1"; then
|
|
|
b94e32 |
+ pkg_cv_[]$1="$$1"
|
|
|
b94e32 |
+ elif test -n "$PKG_CONFIG"; then
|
|
|
b94e32 |
+ PKG_CHECK_EXISTS([$3],
|
|
|
b94e32 |
+ [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
|
|
|
b94e32 |
+ test "x$?" != "x0" && pkg_failed=yes ],
|
|
|
b94e32 |
+ [pkg_failed=yes])
|
|
|
b94e32 |
+ else
|
|
|
b94e32 |
+ pkg_failed=untried
|
|
|
b94e32 |
+fi[]dnl
|
|
|
b94e32 |
+])# _PKG_CONFIG
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+# _PKG_SHORT_ERRORS_SUPPORTED
|
|
|
b94e32 |
+# -----------------------------
|
|
|
b94e32 |
+AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
|
|
|
b94e32 |
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
|
|
|
b94e32 |
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
|
|
|
b94e32 |
+ _pkg_short_errors_supported=yes
|
|
|
b94e32 |
+else
|
|
|
b94e32 |
+ _pkg_short_errors_supported=no
|
|
|
b94e32 |
+fi[]dnl
|
|
|
b94e32 |
+])# _PKG_SHORT_ERRORS_SUPPORTED
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
|
|
|
b94e32 |
+# [ACTION-IF-NOT-FOUND])
|
|
|
b94e32 |
+#
|
|
|
b94e32 |
+#
|
|
|
b94e32 |
+# Note that if there is a possibility the first call to
|
|
|
b94e32 |
+# PKG_CHECK_MODULES might not happen, you should be sure to include an
|
|
|
b94e32 |
+# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
|
|
|
b94e32 |
+#
|
|
|
b94e32 |
+#
|
|
|
b94e32 |
+# --------------------------------------------------------------
|
|
|
b94e32 |
+AC_DEFUN([PKG_CHECK_MODULES],
|
|
|
b94e32 |
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
|
|
|
b94e32 |
+AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
|
|
|
b94e32 |
+AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+pkg_failed=no
|
|
|
b94e32 |
+AC_MSG_CHECKING([for $1])
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
|
|
|
b94e32 |
+_PKG_CONFIG([$1][_LIBS], [libs], [$2])
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
|
|
|
b94e32 |
+and $1[]_LIBS to avoid the need to call pkg-config.
|
|
|
b94e32 |
+See the pkg-config man page for more details.])
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+if test $pkg_failed = yes; then
|
|
|
b94e32 |
+ AC_MSG_RESULT([no])
|
|
|
b94e32 |
+ _PKG_SHORT_ERRORS_SUPPORTED
|
|
|
b94e32 |
+ if test $_pkg_short_errors_supported = yes; then
|
|
|
b94e32 |
+ $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
|
|
|
b94e32 |
+ else
|
|
|
b94e32 |
+ $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
|
|
|
b94e32 |
+ fi
|
|
|
b94e32 |
+ # Put the nasty error message in config.log where it belongs
|
|
|
b94e32 |
+ echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ m4_default([$4], [AC_MSG_ERROR(
|
|
|
b94e32 |
+[Package requirements ($2) were not met:
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+$$1_PKG_ERRORS
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
|
|
|
b94e32 |
+installed software in a non-standard prefix.
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+_PKG_TEXT])[]dnl
|
|
|
b94e32 |
+ ])
|
|
|
b94e32 |
+elif test $pkg_failed = untried; then
|
|
|
b94e32 |
+ AC_MSG_RESULT([no])
|
|
|
b94e32 |
+ m4_default([$4], [AC_MSG_FAILURE(
|
|
|
b94e32 |
+[The pkg-config script could not be found or is too old. Make sure it
|
|
|
b94e32 |
+is in your PATH or set the PKG_CONFIG environment variable to the full
|
|
|
b94e32 |
+path to pkg-config.
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+_PKG_TEXT
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
|
|
|
b94e32 |
+ ])
|
|
|
b94e32 |
+else
|
|
|
b94e32 |
+ $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
|
|
|
b94e32 |
+ $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
|
|
|
b94e32 |
+ AC_MSG_RESULT([yes])
|
|
|
b94e32 |
+ $3
|
|
|
b94e32 |
+fi[]dnl
|
|
|
b94e32 |
+])# PKG_CHECK_MODULES
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+# PKG_INSTALLDIR(DIRECTORY)
|
|
|
b94e32 |
+# -------------------------
|
|
|
b94e32 |
+# Substitutes the variable pkgconfigdir as the location where a module
|
|
|
b94e32 |
+# should install pkg-config .pc files. By default the directory is
|
|
|
b94e32 |
+# $libdir/pkgconfig, but the default can be changed by passing
|
|
|
b94e32 |
+# DIRECTORY. The user can override through the --with-pkgconfigdir
|
|
|
b94e32 |
+# parameter.
|
|
|
b94e32 |
+AC_DEFUN([PKG_INSTALLDIR],
|
|
|
b94e32 |
+[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
|
|
|
b94e32 |
+m4_pushdef([pkg_description],
|
|
|
b94e32 |
+ [pkg-config installation directory @<:@]pkg_default[@:>@])
|
|
|
b94e32 |
+AC_ARG_WITH([pkgconfigdir],
|
|
|
b94e32 |
+ [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
|
|
|
b94e32 |
+ [with_pkgconfigdir=]pkg_default)
|
|
|
b94e32 |
+AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
|
|
|
b94e32 |
+m4_popdef([pkg_default])
|
|
|
b94e32 |
+m4_popdef([pkg_description])
|
|
|
b94e32 |
+]) dnl PKG_INSTALLDIR
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+# PKG_NOARCH_INSTALLDIR(DIRECTORY)
|
|
|
b94e32 |
+# -------------------------
|
|
|
b94e32 |
+# Substitutes the variable noarch_pkgconfigdir as the location where a
|
|
|
b94e32 |
+# module should install arch-independent pkg-config .pc files. By
|
|
|
b94e32 |
+# default the directory is $datadir/pkgconfig, but the default can be
|
|
|
b94e32 |
+# changed by passing DIRECTORY. The user can override through the
|
|
|
b94e32 |
+# --with-noarch-pkgconfigdir parameter.
|
|
|
b94e32 |
+AC_DEFUN([PKG_NOARCH_INSTALLDIR],
|
|
|
b94e32 |
+[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
|
|
|
b94e32 |
+m4_pushdef([pkg_description],
|
|
|
b94e32 |
+ [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
|
|
|
b94e32 |
+AC_ARG_WITH([noarch-pkgconfigdir],
|
|
|
b94e32 |
+ [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
|
|
|
b94e32 |
+ [with_noarch_pkgconfigdir=]pkg_default)
|
|
|
b94e32 |
+AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
|
|
|
b94e32 |
+m4_popdef([pkg_default])
|
|
|
b94e32 |
+m4_popdef([pkg_description])
|
|
|
b94e32 |
+]) dnl PKG_NOARCH_INSTALLDIR
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
|
|
|
b94e32 |
+# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
|
|
|
b94e32 |
+# -------------------------------------------
|
|
|
b94e32 |
+# Retrieves the value of the pkg-config variable for the given module.
|
|
|
b94e32 |
+AC_DEFUN([PKG_CHECK_VAR],
|
|
|
b94e32 |
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
|
|
|
b94e32 |
+AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+_PKG_CONFIG([$1], [variable="][$3]["], [$2])
|
|
|
b94e32 |
+AS_VAR_COPY([$1], [pkg_cv_][$1])
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+AS_VAR_IF([$1], [""], [$5], [$4])dnl
|
|
|
b94e32 |
+])# PKG_CHECK_VAR
|
|
|
b94e32 |
+
|
|
|
b94e32 |
m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
|
|
|
b94e32 |
+
|
|
|
b94e32 |
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
|
|
|
b94e32 |
|
|
|
b94e32 |
# Copyright (C) 2001-2017 Free Software Foundation, Inc.
|
|
|
b94e32 |
diff --git a/gdb/build-id.c b/gdb/build-id.c
|
|
|
b94e32 |
--- a/gdb/build-id.c
|
|
|
b94e32 |
+++ b/gdb/build-id.c
|
|
|
b94e32 |
@@ -33,6 +33,7 @@
|
|
|
b94e32 |
#include "gdb_bfd.h"
|
|
|
b94e32 |
#include "gdbcmd.h"
|
|
|
b94e32 |
#include "gdbcore.h"
|
|
|
b94e32 |
+#include "inferior.h"
|
|
|
b94e32 |
#include "objfiles.h"
|
|
|
b94e32 |
#include "observable.h"
|
|
|
b94e32 |
#include "symfile.h"
|
|
|
b94e32 |
@@ -697,8 +698,374 @@ build_id_to_filename (const struct bfd_build_id *build_id, char **link_return)
|
|
|
b94e32 |
return result;
|
|
|
b94e32 |
}
|
|
|
b94e32 |
|
|
|
b94e32 |
+#ifdef HAVE_LIBRPM
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+#include <rpm/rpmlib.h>
|
|
|
b94e32 |
+#include <rpm/rpmts.h>
|
|
|
b94e32 |
+#include <rpm/rpmdb.h>
|
|
|
b94e32 |
+#include <rpm/header.h>
|
|
|
b94e32 |
+#ifdef DLOPEN_LIBRPM
|
|
|
b94e32 |
+#include <dlfcn.h>
|
|
|
b94e32 |
+#endif
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+/* This MISSING_RPM_HASH tracker is used to collect all the missing rpm files
|
|
|
b94e32 |
+ and avoid their duplicities during a single inferior run. */
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+static struct htab *missing_rpm_hash;
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+/* This MISSING_RPM_LIST tracker is used to collect and print as a single line
|
|
|
b94e32 |
+ all the rpms right before the nearest GDB prompt. It gets cleared after
|
|
|
b94e32 |
+ each such print (it is questionable if we should clear it after the print).
|
|
|
b94e32 |
+ */
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+struct missing_rpm
|
|
|
b94e32 |
+ {
|
|
|
b94e32 |
+ struct missing_rpm *next;
|
|
|
b94e32 |
+ char rpm[1];
|
|
|
b94e32 |
+ };
|
|
|
b94e32 |
+static struct missing_rpm *missing_rpm_list;
|
|
|
b94e32 |
+static int missing_rpm_list_entries;
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+/* Returns the count of newly added rpms. */
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+static int
|
|
|
b94e32 |
+missing_rpm_enlist (const char *filename)
|
|
|
b94e32 |
+{
|
|
|
b94e32 |
+ static int rpm_init_done = 0;
|
|
|
b94e32 |
+ rpmts ts;
|
|
|
b94e32 |
+ rpmdbMatchIterator mi;
|
|
|
b94e32 |
+ int count = 0;
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+#ifdef DLOPEN_LIBRPM
|
|
|
b94e32 |
+ /* Duplicate here the declarations to verify they match. The same sanity
|
|
|
b94e32 |
+ check is present also in `configure.ac'. */
|
|
|
b94e32 |
+ extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
|
|
|
b94e32 |
+ static char *(*headerFormat_p) (Header h, const char * fmt, errmsg_t *errmsg);
|
|
|
b94e32 |
+ extern int rpmReadConfigFiles(const char * file, const char * target);
|
|
|
b94e32 |
+ static int (*rpmReadConfigFiles_p) (const char * file, const char * target);
|
|
|
b94e32 |
+ extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
|
|
|
b94e32 |
+ static rpmdbMatchIterator (*rpmdbFreeIterator_p) (rpmdbMatchIterator mi);
|
|
|
b94e32 |
+ extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
|
|
|
b94e32 |
+ static Header (*rpmdbNextIterator_p) (rpmdbMatchIterator mi);
|
|
|
b94e32 |
+ extern rpmts rpmtsCreate(void);
|
|
|
b94e32 |
+ static rpmts (*rpmtsCreate_p) (void);
|
|
|
b94e32 |
+ extern rpmts rpmtsFree(rpmts ts);
|
|
|
b94e32 |
+ static rpmts (*rpmtsFree_p) (rpmts ts);
|
|
|
b94e32 |
+ extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
|
|
|
b94e32 |
+ const void * keyp, size_t keylen);
|
|
|
b94e32 |
+ static rpmdbMatchIterator (*rpmtsInitIterator_p) (const rpmts ts,
|
|
|
b94e32 |
+ rpmTag rpmtag,
|
|
|
b94e32 |
+ const void *keyp,
|
|
|
b94e32 |
+ size_t keylen);
|
|
|
b94e32 |
+#else /* !DLOPEN_LIBRPM */
|
|
|
b94e32 |
+# define headerFormat_p headerFormat
|
|
|
b94e32 |
+# define rpmReadConfigFiles_p rpmReadConfigFiles
|
|
|
b94e32 |
+# define rpmdbFreeIterator_p rpmdbFreeIterator
|
|
|
b94e32 |
+# define rpmdbNextIterator_p rpmdbNextIterator
|
|
|
b94e32 |
+# define rpmtsCreate_p rpmtsCreate
|
|
|
b94e32 |
+# define rpmtsFree_p rpmtsFree
|
|
|
b94e32 |
+# define rpmtsInitIterator_p rpmtsInitIterator
|
|
|
b94e32 |
+#endif /* !DLOPEN_LIBRPM */
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ gdb_assert (filename != NULL);
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ if (strcmp (filename, BUILD_ID_MAIN_EXECUTABLE_FILENAME) == 0)
|
|
|
b94e32 |
+ return 0;
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ if (is_target_filename (filename))
|
|
|
b94e32 |
+ return 0;
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ if (filename[0] != '/')
|
|
|
b94e32 |
+ {
|
|
|
b94e32 |
+ warning (_("Ignoring non-absolute filename: <%s>"), filename);
|
|
|
b94e32 |
+ return 0;
|
|
|
b94e32 |
+ }
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ if (!rpm_init_done)
|
|
|
b94e32 |
+ {
|
|
|
b94e32 |
+ static int init_tried;
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ /* Already failed the initialization before? */
|
|
|
b94e32 |
+ if (init_tried)
|
|
|
b94e32 |
+ return 0;
|
|
|
b94e32 |
+ init_tried = 1;
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+#ifdef DLOPEN_LIBRPM
|
|
|
b94e32 |
+ {
|
|
|
b94e32 |
+ void *h;
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ h = dlopen (DLOPEN_LIBRPM, RTLD_LAZY);
|
|
|
b94e32 |
+ if (!h)
|
|
|
b94e32 |
+ {
|
|
|
b94e32 |
+ warning (_("Unable to open \"%s\" (%s), "
|
|
|
b94e32 |
+ "missing debuginfos notifications will not be displayed"),
|
|
|
b94e32 |
+ DLOPEN_LIBRPM, dlerror ());
|
|
|
b94e32 |
+ return 0;
|
|
|
b94e32 |
+ }
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ if (!((headerFormat_p = (char *(*) (Header h, const char * fmt, errmsg_t *errmsg)) dlsym (h, "headerFormat"))
|
|
|
b94e32 |
+ && (rpmReadConfigFiles_p = (int (*) (const char * file, const char * target)) dlsym (h, "rpmReadConfigFiles"))
|
|
|
b94e32 |
+ && (rpmdbFreeIterator_p = (rpmdbMatchIterator (*) (rpmdbMatchIterator mi)) dlsym (h, "rpmdbFreeIterator"))
|
|
|
b94e32 |
+ && (rpmdbNextIterator_p = (Header (*) (rpmdbMatchIterator mi)) dlsym (h, "rpmdbNextIterator"))
|
|
|
b94e32 |
+ && (rpmtsCreate_p = (rpmts (*) (void)) dlsym (h, "rpmtsCreate"))
|
|
|
b94e32 |
+ && (rpmtsFree_p = (rpmts (*) (rpmts ts)) dlsym (h, "rpmtsFree"))
|
|
|
b94e32 |
+ && (rpmtsInitIterator_p = (rpmdbMatchIterator (*) (const rpmts ts, rpmTag rpmtag, const void *keyp, size_t keylen)) dlsym (h, "rpmtsInitIterator"))))
|
|
|
b94e32 |
+ {
|
|
|
b94e32 |
+ warning (_("Opened library \"%s\" is incompatible (%s), "
|
|
|
b94e32 |
+ "missing debuginfos notifications will not be displayed"),
|
|
|
b94e32 |
+ DLOPEN_LIBRPM, dlerror ());
|
|
|
b94e32 |
+ if (dlclose (h))
|
|
|
b94e32 |
+ warning (_("Error closing library \"%s\": %s\n"), DLOPEN_LIBRPM,
|
|
|
b94e32 |
+ dlerror ());
|
|
|
b94e32 |
+ return 0;
|
|
|
b94e32 |
+ }
|
|
|
b94e32 |
+ }
|
|
|
b94e32 |
+#endif /* DLOPEN_LIBRPM */
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ if (rpmReadConfigFiles_p (NULL, NULL) != 0)
|
|
|
b94e32 |
+ {
|
|
|
b94e32 |
+ warning (_("Error reading the rpm configuration files"));
|
|
|
b94e32 |
+ return 0;
|
|
|
b94e32 |
+ }
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ rpm_init_done = 1;
|
|
|
b94e32 |
+ }
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ ts = rpmtsCreate_p ();
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ mi = rpmtsInitIterator_p (ts, RPMTAG_BASENAMES, filename, 0);
|
|
|
b94e32 |
+ if (mi != NULL)
|
|
|
b94e32 |
+ {
|
|
|
b94e32 |
+ for (;;)
|
|
|
b94e32 |
+ {
|
|
|
b94e32 |
+ Header h;
|
|
|
b94e32 |
+ char *debuginfo, **slot, *s, *s2;
|
|
|
b94e32 |
+ errmsg_t err;
|
|
|
b94e32 |
+ size_t srcrpmlen = sizeof (".src.rpm") - 1;
|
|
|
b94e32 |
+ size_t debuginfolen = sizeof ("-debuginfo") - 1;
|
|
|
b94e32 |
+ rpmdbMatchIterator mi_debuginfo;
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ h = rpmdbNextIterator_p (mi);
|
|
|
b94e32 |
+ if (h == NULL)
|
|
|
b94e32 |
+ break;
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ /* Verify the debuginfo file is not already installed. */
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ debuginfo = headerFormat_p (h, "%{sourcerpm}-debuginfo.%{arch}",
|
|
|
b94e32 |
+ &err;;
|
|
|
b94e32 |
+ if (!debuginfo)
|
|
|
b94e32 |
+ {
|
|
|
b94e32 |
+ warning (_("Error querying the rpm file `%s': %s"), filename,
|
|
|
b94e32 |
+ err);
|
|
|
b94e32 |
+ continue;
|
|
|
b94e32 |
+ }
|
|
|
b94e32 |
+ /* s = `.src.rpm-debuginfo.%{arch}' */
|
|
|
b94e32 |
+ s = strrchr (debuginfo, '-') - srcrpmlen;
|
|
|
b94e32 |
+ s2 = NULL;
|
|
|
b94e32 |
+ if (s > debuginfo && memcmp (s, ".src.rpm", srcrpmlen) == 0)
|
|
|
b94e32 |
+ {
|
|
|
b94e32 |
+ /* s2 = `-%{release}.src.rpm-debuginfo.%{arch}' */
|
|
|
b94e32 |
+ s2 = (char *) memrchr (debuginfo, '-', s - debuginfo);
|
|
|
b94e32 |
+ }
|
|
|
b94e32 |
+ if (s2)
|
|
|
b94e32 |
+ {
|
|
|
b94e32 |
+ /* s2 = `-%{version}-%{release}.src.rpm-debuginfo.%{arch}' */
|
|
|
b94e32 |
+ s2 = (char *) memrchr (debuginfo, '-', s2 - debuginfo);
|
|
|
b94e32 |
+ }
|
|
|
b94e32 |
+ if (!s2)
|
|
|
b94e32 |
+ {
|
|
|
b94e32 |
+ warning (_("Error querying the rpm file `%s': %s"), filename,
|
|
|
b94e32 |
+ debuginfo);
|
|
|
b94e32 |
+ xfree (debuginfo);
|
|
|
b94e32 |
+ continue;
|
|
|
b94e32 |
+ }
|
|
|
b94e32 |
+ /* s = `.src.rpm-debuginfo.%{arch}' */
|
|
|
b94e32 |
+ /* s2 = `-%{version}-%{release}.src.rpm-debuginfo.%{arch}' */
|
|
|
b94e32 |
+ memmove (s2 + debuginfolen, s2, s - s2);
|
|
|
b94e32 |
+ memcpy (s2, "-debuginfo", debuginfolen);
|
|
|
b94e32 |
+ /* s = `XXXX.%{arch}' */
|
|
|
b94e32 |
+ /* strlen ("XXXX") == srcrpmlen + debuginfolen */
|
|
|
b94e32 |
+ /* s2 = `-debuginfo-%{version}-%{release}XX.%{arch}' */
|
|
|
b94e32 |
+ /* strlen ("XX") == srcrpmlen */
|
|
|
b94e32 |
+ memmove (s + debuginfolen, s + srcrpmlen + debuginfolen,
|
|
|
b94e32 |
+ strlen (s + srcrpmlen + debuginfolen) + 1);
|
|
|
b94e32 |
+ /* s = `-debuginfo-%{version}-%{release}.%{arch}' */
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ /* RPMDBI_PACKAGES requires keylen == sizeof (int). */
|
|
|
b94e32 |
+ /* RPMDBI_LABEL is an interface for NVR-based dbiFindByLabel(). */
|
|
|
b94e32 |
+ mi_debuginfo = rpmtsInitIterator_p (ts, (rpmTag) RPMDBI_LABEL, debuginfo, 0);
|
|
|
b94e32 |
+ xfree (debuginfo);
|
|
|
b94e32 |
+ if (mi_debuginfo)
|
|
|
b94e32 |
+ {
|
|
|
b94e32 |
+ rpmdbFreeIterator_p (mi_debuginfo);
|
|
|
b94e32 |
+ count = 0;
|
|
|
b94e32 |
+ break;
|
|
|
b94e32 |
+ }
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ /* The allocated memory gets utilized below for MISSING_RPM_HASH. */
|
|
|
b94e32 |
+ debuginfo = headerFormat_p (h,
|
|
|
b94e32 |
+ "%{name}-%{version}-%{release}.%{arch}",
|
|
|
b94e32 |
+ &err;;
|
|
|
b94e32 |
+ if (!debuginfo)
|
|
|
b94e32 |
+ {
|
|
|
b94e32 |
+ warning (_("Error querying the rpm file `%s': %s"), filename,
|
|
|
b94e32 |
+ err);
|
|
|
b94e32 |
+ continue;
|
|
|
b94e32 |
+ }
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ /* Base package name for `debuginfo-install'. We do not use the
|
|
|
b94e32 |
+ `yum' command directly as the line
|
|
|
b94e32 |
+ yum --enablerepo='*debug*' install NAME-debuginfo.ARCH
|
|
|
b94e32 |
+ would be more complicated than just:
|
|
|
b94e32 |
+ debuginfo-install NAME-VERSION-RELEASE.ARCH
|
|
|
b94e32 |
+ Do not supply the rpm base name (derived from .src.rpm name) as
|
|
|
b94e32 |
+ debuginfo-install is unable to install the debuginfo package if
|
|
|
b94e32 |
+ the base name PKG binary rpm is not installed while for example
|
|
|
b94e32 |
+ PKG-libs would be installed (RH Bug 467901).
|
|
|
b94e32 |
+ FUTURE: After multiple debuginfo versions simultaneously installed
|
|
|
b94e32 |
+ get supported the support for the VERSION-RELEASE tags handling
|
|
|
b94e32 |
+ may need an update. */
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ if (missing_rpm_hash == NULL)
|
|
|
b94e32 |
+ {
|
|
|
b94e32 |
+ /* DEL_F is passed NULL as MISSING_RPM_LIST's HTAB_DELETE
|
|
|
b94e32 |
+ should not deallocate the entries. */
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ missing_rpm_hash = htab_create_alloc (64, htab_hash_string,
|
|
|
b94e32 |
+ (int (*) (const void *, const void *)) streq,
|
|
|
b94e32 |
+ NULL, xcalloc, xfree);
|
|
|
b94e32 |
+ }
|
|
|
b94e32 |
+ slot = (char **) htab_find_slot (missing_rpm_hash, debuginfo, INSERT);
|
|
|
b94e32 |
+ /* XCALLOC never returns NULL. */
|
|
|
b94e32 |
+ gdb_assert (slot != NULL);
|
|
|
b94e32 |
+ if (*slot == NULL)
|
|
|
b94e32 |
+ {
|
|
|
b94e32 |
+ struct missing_rpm *missing_rpm;
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ *slot = debuginfo;
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ missing_rpm = (struct missing_rpm *) xmalloc (sizeof (*missing_rpm) + strlen (debuginfo));
|
|
|
b94e32 |
+ strcpy (missing_rpm->rpm, debuginfo);
|
|
|
b94e32 |
+ missing_rpm->next = missing_rpm_list;
|
|
|
b94e32 |
+ missing_rpm_list = missing_rpm;
|
|
|
b94e32 |
+ missing_rpm_list_entries++;
|
|
|
b94e32 |
+ }
|
|
|
b94e32 |
+ else
|
|
|
b94e32 |
+ xfree (debuginfo);
|
|
|
b94e32 |
+ count++;
|
|
|
b94e32 |
+ }
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ rpmdbFreeIterator_p (mi);
|
|
|
b94e32 |
+ }
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ rpmtsFree_p (ts);
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ return count;
|
|
|
b94e32 |
+}
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+static bool
|
|
|
b94e32 |
+missing_rpm_list_compar (const char *ap, const char *bp)
|
|
|
b94e32 |
+{
|
|
|
b94e32 |
+ return strcoll (ap, bp) < 0;
|
|
|
b94e32 |
+}
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+/* It returns a NULL-terminated array of strings needing to be FREEd. It may
|
|
|
b94e32 |
+ also return only NULL. */
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+static void
|
|
|
b94e32 |
+missing_rpm_list_print (void)
|
|
|
b94e32 |
+{
|
|
|
b94e32 |
+ struct missing_rpm *list_iter;
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ if (missing_rpm_list_entries == 0)
|
|
|
b94e32 |
+ return;
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ std::vector<const char *> array (missing_rpm_list_entries);
|
|
|
b94e32 |
+ size_t idx = 0;
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ for (list_iter = missing_rpm_list; list_iter != NULL;
|
|
|
b94e32 |
+ list_iter = list_iter->next)
|
|
|
b94e32 |
+ {
|
|
|
b94e32 |
+ array[idx++] = list_iter->rpm;
|
|
|
b94e32 |
+ }
|
|
|
b94e32 |
+ gdb_assert (idx == missing_rpm_list_entries);
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ std::sort (array.begin (), array.end (), missing_rpm_list_compar);
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ /* We zero out the number of missing RPMs here because of a nasty
|
|
|
b94e32 |
+ bug (see RHBZ 1801974).
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ When we call 'puts_unfiltered' below, if pagination is on and if
|
|
|
b94e32 |
+ the number of missing RPMs is big enough to trigger pagination,
|
|
|
b94e32 |
+ we will end up in an infinite recursion. The call chain looks
|
|
|
b94e32 |
+ like this:
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ missing_rpm_list_print -> puts_unfiltered -> fputs_maybe_filtered
|
|
|
b94e32 |
+ -> prompt_for_continue -> display_gdb_prompt ->
|
|
|
b94e32 |
+ debug_flush_missing -> missing_rpm_list_print ...
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ For this reason, we make sure MISSING_RPM_LIST_ENTRIES is zero
|
|
|
b94e32 |
+ *before* calling any print function. */
|
|
|
b94e32 |
+ missing_rpm_list_entries = 0;
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ printf_unfiltered (_("Missing separate debuginfos, use: %s"),
|
|
|
b94e32 |
+#ifdef DNF_DEBUGINFO_INSTALL
|
|
|
b94e32 |
+ "dnf "
|
|
|
b94e32 |
+#endif
|
|
|
b94e32 |
+ "debuginfo-install");
|
|
|
b94e32 |
+ for (const char *el : array)
|
|
|
b94e32 |
+ {
|
|
|
b94e32 |
+ puts_unfiltered (" ");
|
|
|
b94e32 |
+ puts_unfiltered (el);
|
|
|
b94e32 |
+ }
|
|
|
b94e32 |
+ puts_unfiltered ("\n");
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ while (missing_rpm_list != NULL)
|
|
|
b94e32 |
+ {
|
|
|
b94e32 |
+ list_iter = missing_rpm_list;
|
|
|
b94e32 |
+ missing_rpm_list = list_iter->next;
|
|
|
b94e32 |
+ xfree (list_iter);
|
|
|
b94e32 |
+ }
|
|
|
b94e32 |
+}
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+static void
|
|
|
b94e32 |
+missing_rpm_change (void)
|
|
|
b94e32 |
+{
|
|
|
b94e32 |
+ debug_flush_missing ();
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ gdb_assert (missing_rpm_list == NULL);
|
|
|
b94e32 |
+ if (missing_rpm_hash != NULL)
|
|
|
b94e32 |
+ {
|
|
|
b94e32 |
+ htab_delete (missing_rpm_hash);
|
|
|
b94e32 |
+ missing_rpm_hash = NULL;
|
|
|
b94e32 |
+ }
|
|
|
b94e32 |
+}
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+enum missing_exec
|
|
|
b94e32 |
+ {
|
|
|
b94e32 |
+ /* Init state. EXEC_BFD also still could be NULL. */
|
|
|
b94e32 |
+ MISSING_EXEC_NOT_TRIED,
|
|
|
b94e32 |
+ /* We saw a non-NULL EXEC_BFD but RPM has no info about it. */
|
|
|
b94e32 |
+ MISSING_EXEC_NOT_FOUND,
|
|
|
b94e32 |
+ /* We found EXEC_BFD by RPM and we either have its symbols (either embedded
|
|
|
b94e32 |
+ or separate) or the main executable's RPM is now contained in
|
|
|
b94e32 |
+ MISSING_RPM_HASH. */
|
|
|
b94e32 |
+ MISSING_EXEC_ENLISTED
|
|
|
b94e32 |
+ };
|
|
|
b94e32 |
+static enum missing_exec missing_exec = MISSING_EXEC_NOT_TRIED;
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+#endif /* HAVE_LIBRPM */
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+void
|
|
|
b94e32 |
+debug_flush_missing (void)
|
|
|
b94e32 |
+{
|
|
|
b94e32 |
+#ifdef HAVE_LIBRPM
|
|
|
b94e32 |
+ missing_rpm_list_print ();
|
|
|
b94e32 |
+#endif
|
|
|
b94e32 |
+}
|
|
|
b94e32 |
+
|
|
|
b94e32 |
/* This MISSING_FILEPAIR_HASH tracker is used only for the duplicite messages
|
|
|
b94e32 |
- Try to install the hash file ...
|
|
|
b94e32 |
+ yum --enablerepo='*debug*' install ...
|
|
|
b94e32 |
avoidance. */
|
|
|
b94e32 |
|
|
|
b94e32 |
struct missing_filepair
|
|
|
b94e32 |
@@ -752,11 +1119,17 @@ missing_filepair_change (void)
|
|
|
b94e32 |
/* All their memory came just from missing_filepair_OBSTACK. */
|
|
|
b94e32 |
missing_filepair_hash = NULL;
|
|
|
b94e32 |
}
|
|
|
b94e32 |
+#ifdef HAVE_LIBRPM
|
|
|
b94e32 |
+ missing_exec = MISSING_EXEC_NOT_TRIED;
|
|
|
b94e32 |
+#endif
|
|
|
b94e32 |
}
|
|
|
b94e32 |
|
|
|
b94e32 |
static void
|
|
|
b94e32 |
debug_print_executable_changed (void)
|
|
|
b94e32 |
{
|
|
|
b94e32 |
+#ifdef HAVE_LIBRPM
|
|
|
b94e32 |
+ missing_rpm_change ();
|
|
|
b94e32 |
+#endif
|
|
|
b94e32 |
missing_filepair_change ();
|
|
|
b94e32 |
}
|
|
|
b94e32 |
|
|
|
b94e32 |
@@ -823,14 +1196,38 @@ debug_print_missing (const char *binary, const char *debug)
|
|
|
b94e32 |
|
|
|
b94e32 |
*slot = missing_filepair;
|
|
|
b94e32 |
|
|
|
b94e32 |
- /* We do not collect and flush these messages as each such message
|
|
|
b94e32 |
- already requires its own separate lines. */
|
|
|
b94e32 |
+#ifdef HAVE_LIBRPM
|
|
|
b94e32 |
+ if (missing_exec == MISSING_EXEC_NOT_TRIED)
|
|
|
b94e32 |
+ {
|
|
|
b94e32 |
+ const char *execfilename = get_exec_file (0);
|
|
|
b94e32 |
|
|
|
b94e32 |
- fprintf_unfiltered (gdb_stdlog,
|
|
|
b94e32 |
- _("Missing separate debuginfo for %s\n"), binary);
|
|
|
b94e32 |
- if (debug != NULL)
|
|
|
b94e32 |
- fprintf_unfiltered (gdb_stdlog, _("Try to install the hash file %s\n"),
|
|
|
b94e32 |
- debug);
|
|
|
b94e32 |
+ if (execfilename != NULL)
|
|
|
b94e32 |
+ {
|
|
|
b94e32 |
+ if (missing_rpm_enlist (execfilename) == 0)
|
|
|
b94e32 |
+ missing_exec = MISSING_EXEC_NOT_FOUND;
|
|
|
b94e32 |
+ else
|
|
|
b94e32 |
+ missing_exec = MISSING_EXEC_ENLISTED;
|
|
|
b94e32 |
+ }
|
|
|
b94e32 |
+ }
|
|
|
b94e32 |
+ if (missing_exec != MISSING_EXEC_ENLISTED)
|
|
|
b94e32 |
+ if ((binary[0] == 0 || missing_rpm_enlist (binary) == 0)
|
|
|
b94e32 |
+ && (debug == NULL || missing_rpm_enlist (debug) == 0))
|
|
|
b94e32 |
+#endif /* HAVE_LIBRPM */
|
|
|
b94e32 |
+ {
|
|
|
b94e32 |
+ /* We do not collect and flush these messages as each such message
|
|
|
b94e32 |
+ already requires its own separate lines. */
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ fprintf_unfiltered (gdb_stdlog,
|
|
|
b94e32 |
+ _("Missing separate debuginfo for %s\n"), binary);
|
|
|
b94e32 |
+ if (debug != NULL)
|
|
|
b94e32 |
+ fprintf_unfiltered (gdb_stdlog, _("Try: %s %s\n"),
|
|
|
b94e32 |
+#ifdef DNF_DEBUGINFO_INSTALL
|
|
|
b94e32 |
+ "dnf"
|
|
|
b94e32 |
+#else
|
|
|
b94e32 |
+ "yum"
|
|
|
b94e32 |
+#endif
|
|
|
b94e32 |
+ " --enablerepo='*debug*' install", debug);
|
|
|
b94e32 |
+ }
|
|
|
b94e32 |
}
|
|
|
b94e32 |
|
|
|
b94e32 |
/* See build-id.h. */
|
|
|
b94e32 |
diff --git a/gdb/config.in b/gdb/config.in
|
|
|
b94e32 |
--- a/gdb/config.in
|
|
|
b94e32 |
+++ b/gdb/config.in
|
|
|
b94e32 |
@@ -39,6 +39,9 @@
|
|
|
b94e32 |
/* Handle .ctf type-info sections */
|
|
|
b94e32 |
#undef ENABLE_LIBCTF
|
|
|
b94e32 |
|
|
|
b94e32 |
+/* librpm version specific library name to dlopen. */
|
|
|
b94e32 |
+#undef DLOPEN_LIBRPM
|
|
|
b94e32 |
+
|
|
|
b94e32 |
/* Define to 1 if translation of program messages to the user's native
|
|
|
b94e32 |
language is requested. */
|
|
|
b94e32 |
#undef ENABLE_NLS
|
|
|
b94e32 |
@@ -250,6 +253,9 @@
|
|
|
b94e32 |
/* Define if you have the mpfr library. */
|
|
|
b94e32 |
#undef HAVE_LIBMPFR
|
|
|
b94e32 |
|
|
|
b94e32 |
+/* Define if librpm library is being used. */
|
|
|
b94e32 |
+#undef HAVE_LIBRPM
|
|
|
b94e32 |
+
|
|
|
b94e32 |
/* Define to 1 if you have the <libunwind-ia64.h> header file. */
|
|
|
b94e32 |
#undef HAVE_LIBUNWIND_IA64_H
|
|
|
b94e32 |
|
|
|
b94e32 |
diff --git a/gdb/configure b/gdb/configure
|
|
|
b94e32 |
--- a/gdb/configure
|
|
|
b94e32 |
+++ b/gdb/configure
|
|
|
b94e32 |
@@ -771,6 +771,11 @@ PKG_CONFIG
|
|
|
b94e32 |
HAVE_NATIVE_GCORE_TARGET
|
|
|
b94e32 |
TARGET_OBS
|
|
|
b94e32 |
subdirs
|
|
|
b94e32 |
+RPM_LIBS
|
|
|
b94e32 |
+RPM_CFLAGS
|
|
|
b94e32 |
+PKG_CONFIG_LIBDIR
|
|
|
b94e32 |
+PKG_CONFIG_PATH
|
|
|
b94e32 |
+PKG_CONFIG
|
|
|
b94e32 |
GDB_DATADIR
|
|
|
b94e32 |
DEBUGDIR
|
|
|
b94e32 |
MAKEINFO_EXTRA_FLAGS
|
|
|
b94e32 |
@@ -876,6 +881,7 @@ with_gdb_datadir
|
|
|
b94e32 |
with_relocated_sources
|
|
|
b94e32 |
with_auto_load_dir
|
|
|
b94e32 |
with_auto_load_safe_path
|
|
|
b94e32 |
+with_rpm
|
|
|
b94e32 |
enable_targets
|
|
|
b94e32 |
enable_64_bit_bfd
|
|
|
b94e32 |
enable_gdbmi
|
|
|
b94e32 |
@@ -953,6 +959,8 @@ PKG_CONFIG_PATH
|
|
|
b94e32 |
PKG_CONFIG_LIBDIR
|
|
|
b94e32 |
DEBUGINFOD_CFLAGS
|
|
|
b94e32 |
DEBUGINFOD_LIBS
|
|
|
b94e32 |
+RPM_CFLAGS
|
|
|
b94e32 |
+RPM_LIBS
|
|
|
b94e32 |
YACC
|
|
|
b94e32 |
YFLAGS
|
|
|
b94e32 |
XMKMF'
|
|
|
b94e32 |
@@ -1625,6 +1633,8 @@ Optional Packages:
|
|
|
b94e32 |
do not restrict auto-loaded files locations
|
|
|
b94e32 |
--with-debuginfod Enable debuginfo lookups with debuginfod
|
|
|
b94e32 |
(auto/yes/no)
|
|
|
b94e32 |
+ --with-rpm query rpm database for missing debuginfos (yes/no,
|
|
|
b94e32 |
+ def. auto=librpm.so)
|
|
|
b94e32 |
--with-libunwind-ia64 use libunwind frame unwinding for ia64 targets
|
|
|
b94e32 |
--with-curses use the curses library instead of the termcap
|
|
|
b94e32 |
library
|
|
|
b94e32 |
@@ -1705,6 +1715,8 @@ Some influential environment variables:
|
|
|
b94e32 |
C compiler flags for DEBUGINFOD, overriding pkg-config
|
|
|
b94e32 |
DEBUGINFOD_LIBS
|
|
|
b94e32 |
linker flags for DEBUGINFOD, overriding pkg-config
|
|
|
b94e32 |
+ RPM_CFLAGS C compiler flags for RPM, overriding pkg-config
|
|
|
b94e32 |
+ RPM_LIBS linker flags for RPM, overriding pkg-config
|
|
|
b94e32 |
YACC The `Yet Another Compiler Compiler' implementation to use.
|
|
|
b94e32 |
Defaults to the first program found out of: `bison -y', `byacc',
|
|
|
b94e32 |
`yacc'.
|
|
|
b94e32 |
@@ -6624,6 +6636,494 @@ _ACEOF
|
|
|
b94e32 |
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_auto_load_safe_path" >&5
|
|
|
b94e32 |
$as_echo "$with_auto_load_safe_path" >&6; }
|
|
|
b94e32 |
|
|
|
b94e32 |
+# Integration with rpm library to support missing debuginfo suggestions.
|
|
|
b94e32 |
+# --without-rpm: Disable any rpm support.
|
|
|
b94e32 |
+# --with-rpm=libname.so: Try to dynamically open `libname.so' during runtime.
|
|
|
b94e32 |
+# Even with runtime missing `libname.so' GDB will still other run correctly.
|
|
|
b94e32 |
+# Missing `libname.so' during ./configure will abort the configuration.
|
|
|
b94e32 |
+# --with-rpm=librpm.so: Like `--with-rpm=libname.so' but try to find specific
|
|
|
b94e32 |
+# minor version first such as `librpm-4.6.so' as minor version differences
|
|
|
b94e32 |
+# mean API+ABI incompatibility. If the specific match versioned library name
|
|
|
b94e32 |
+# could not be found still open dynamically at least `librpm.so'.
|
|
|
b94e32 |
+# --with-rpm: Like `--with-rpm=librpm.so' but if any of its detection fails try
|
|
|
b94e32 |
+# to find librpm for compilation-time linking by pkg-config. GDB binary will
|
|
|
b94e32 |
+# be probably linked with the version specific library (as `librpm-4.6.so').
|
|
|
b94e32 |
+# Failure to find librpm by pkg-config will abort the configuration.
|
|
|
b94e32 |
+# (default) --with-rpm=auto: Like `--with-rpm=librpm.so' but if even pkg-config
|
|
|
b94e32 |
+# cannot find librpm use to the rpmless compilation (like `--without-rpm').
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+# Check whether --with-rpm was given.
|
|
|
b94e32 |
+if test "${with_rpm+set}" = set; then :
|
|
|
b94e32 |
+ withval=$with_rpm;
|
|
|
b94e32 |
+else
|
|
|
b94e32 |
+ with_rpm="auto"
|
|
|
b94e32 |
+fi
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+if test "x$with_rpm" != "xno"; then
|
|
|
b94e32 |
+ if test "x$with_rpm" = "xyes"; then
|
|
|
b94e32 |
+ LIBRPM="librpm.so"
|
|
|
b94e32 |
+ RPM_REQUIRE=true
|
|
|
b94e32 |
+ DLOPEN_REQUIRE=false
|
|
|
b94e32 |
+ elif test "x$with_rpm" = "xauto"; then
|
|
|
b94e32 |
+ LIBRPM="librpm.so"
|
|
|
b94e32 |
+ RPM_REQUIRE=false
|
|
|
b94e32 |
+ DLOPEN_REQUIRE=false
|
|
|
b94e32 |
+ else
|
|
|
b94e32 |
+ LIBRPM="$with_rpm"
|
|
|
b94e32 |
+ RPM_REQUIRE=true
|
|
|
b94e32 |
+ DLOPEN_REQUIRE=true
|
|
|
b94e32 |
+ fi
|
|
|
b94e32 |
+ LIBRPM_STRING='"'"$LIBRPM"'"'
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking specific librpm version" >&5
|
|
|
b94e32 |
+$as_echo_n "checking specific librpm version... " >&6; }
|
|
|
b94e32 |
+ HAVE_DLOPEN_LIBRPM=false
|
|
|
b94e32 |
+ save_LIBS="$LIBS"
|
|
|
b94e32 |
+ LIBS="$LIBS -ldl"
|
|
|
b94e32 |
+ if test "$cross_compiling" = yes; then :
|
|
|
b94e32 |
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
|
|
|
b94e32 |
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
|
|
|
b94e32 |
+as_fn_error "cannot run test program while cross compiling
|
|
|
b94e32 |
+See \`config.log' for more details." "$LINENO" 5; }
|
|
|
b94e32 |
+else
|
|
|
b94e32 |
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
|
|
b94e32 |
+/* end confdefs.h. */
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+#include <rpm/rpmlib.h>
|
|
|
b94e32 |
+#include <dlfcn.h>
|
|
|
b94e32 |
+#include <errno.h>
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+int
|
|
|
b94e32 |
+main ()
|
|
|
b94e32 |
+{
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ void *h;
|
|
|
b94e32 |
+ const char *const *rpmverp;
|
|
|
b94e32 |
+ FILE *f;
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ f = fopen ("conftest.out", "w");
|
|
|
b94e32 |
+ if (!f)
|
|
|
b94e32 |
+ {
|
|
|
b94e32 |
+ fprintf (stderr, "Cannot write \"%s\": %s\n", "conftest.out",
|
|
|
b94e32 |
+ strerror (errno));
|
|
|
b94e32 |
+ return 1;
|
|
|
b94e32 |
+ }
|
|
|
b94e32 |
+ h = dlopen ($LIBRPM_STRING, RTLD_LAZY);
|
|
|
b94e32 |
+ if (!h)
|
|
|
b94e32 |
+ {
|
|
|
b94e32 |
+ fprintf (stderr, "dlopen (\"%s\"): %s\n", $LIBRPM_STRING, dlerror ());
|
|
|
b94e32 |
+ return 1;
|
|
|
b94e32 |
+ }
|
|
|
b94e32 |
+ rpmverp = dlsym (h, "RPMVERSION");
|
|
|
b94e32 |
+ if (!rpmverp)
|
|
|
b94e32 |
+ {
|
|
|
b94e32 |
+ fprintf (stderr, "dlsym (\"RPMVERSION\"): %s\n", dlerror ());
|
|
|
b94e32 |
+ return 1;
|
|
|
b94e32 |
+ }
|
|
|
b94e32 |
+ fprintf (stderr, "RPMVERSION is: \"");
|
|
|
b94e32 |
+ fprintf (stderr, "%s\"\n", *rpmverp);
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ /* Try to find the specific librpm version only for "librpm.so" as we do
|
|
|
b94e32 |
+ not know how to assemble the version string otherwise. */
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ if (strcmp ("librpm.so", $LIBRPM_STRING) != 0)
|
|
|
b94e32 |
+ {
|
|
|
b94e32 |
+ fprintf (f, "%s\n", $LIBRPM_STRING);
|
|
|
b94e32 |
+ return 0;
|
|
|
b94e32 |
+ }
|
|
|
b94e32 |
+ else
|
|
|
b94e32 |
+ {
|
|
|
b94e32 |
+ char *h2_name;
|
|
|
b94e32 |
+ void *h2;
|
|
|
b94e32 |
+ int major, minor;
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ if (sscanf (*rpmverp, "%d.%d", &major, &minor) != 2)
|
|
|
b94e32 |
+ {
|
|
|
b94e32 |
+ fprintf (stderr, "Unable to parse RPMVERSION.\n");
|
|
|
b94e32 |
+ fprintf (f, "%s\n", $LIBRPM_STRING);
|
|
|
b94e32 |
+ return 0;
|
|
|
b94e32 |
+ }
|
|
|
b94e32 |
+ /* Avoid the square brackets by malloc. */
|
|
|
b94e32 |
+ h2_name = malloc (64);
|
|
|
b94e32 |
+ sprintf (h2_name, "librpm-%d.%d.so", major, minor);
|
|
|
b94e32 |
+ h2 = dlopen (h2_name, RTLD_LAZY);
|
|
|
b94e32 |
+ if (!h2)
|
|
|
b94e32 |
+ {
|
|
|
b94e32 |
+ fprintf (stderr, "dlopen (\"%s\"): %s\n", h2_name, dlerror ());
|
|
|
b94e32 |
+ fprintf (f, "%s\n", $LIBRPM_STRING);
|
|
|
b94e32 |
+ return 0;
|
|
|
b94e32 |
+ }
|
|
|
b94e32 |
+ if (h2 != h)
|
|
|
b94e32 |
+ {
|
|
|
b94e32 |
+ fprintf (stderr, "dlopen of \"%s\" and \"%s\" are different.\n",
|
|
|
b94e32 |
+ $LIBRPM_STRING, h2_name);
|
|
|
b94e32 |
+ fprintf (f, "%s\n", $LIBRPM_STRING);
|
|
|
b94e32 |
+ return 0;
|
|
|
b94e32 |
+ }
|
|
|
b94e32 |
+ /* Found the valid .so name with a specific version. */
|
|
|
b94e32 |
+ fprintf (f, "%s\n", h2_name);
|
|
|
b94e32 |
+ return 0;
|
|
|
b94e32 |
+ }
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ ;
|
|
|
b94e32 |
+ return 0;
|
|
|
b94e32 |
+}
|
|
|
b94e32 |
+_ACEOF
|
|
|
b94e32 |
+if ac_fn_c_try_run "$LINENO"; then :
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ DLOPEN_LIBRPM="`cat conftest.out`"
|
|
|
b94e32 |
+ if test "x$DLOPEN_LIBRPM" != "x"; then
|
|
|
b94e32 |
+ HAVE_DLOPEN_LIBRPM=true
|
|
|
b94e32 |
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLOPEN_LIBRPM" >&5
|
|
|
b94e32 |
+$as_echo "$DLOPEN_LIBRPM" >&6; }
|
|
|
b94e32 |
+ fi
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+fi
|
|
|
b94e32 |
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
|
|
|
b94e32 |
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
|
|
|
b94e32 |
+fi
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ rm -f conftest.out
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ if $HAVE_DLOPEN_LIBRPM; then
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking rpm library API compatibility" >&5
|
|
|
b94e32 |
+$as_echo_n "checking rpm library API compatibility... " >&6; }
|
|
|
b94e32 |
+ # The compilation requires -Werror to verify anything.
|
|
|
b94e32 |
+ save_CFLAGS="$CFLAGS"
|
|
|
b94e32 |
+ CFLAGS="$CFLAGS -Werror"
|
|
|
b94e32 |
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
|
|
b94e32 |
+/* end confdefs.h. */
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+/* Duplicate here the declarations to verify they match "elfread.c". */
|
|
|
b94e32 |
+#include <rpm/rpmlib.h>
|
|
|
b94e32 |
+#include <rpm/rpmts.h>
|
|
|
b94e32 |
+#include <rpm/rpmdb.h>
|
|
|
b94e32 |
+#include <rpm/header.h>
|
|
|
b94e32 |
+extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
|
|
|
b94e32 |
+extern int rpmReadConfigFiles(const char * file, const char * target);
|
|
|
b94e32 |
+extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
|
|
|
b94e32 |
+extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
|
|
|
b94e32 |
+extern rpmts rpmtsCreate(void);
|
|
|
b94e32 |
+extern rpmts rpmtsFree(rpmts ts);
|
|
|
b94e32 |
+extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
|
|
|
b94e32 |
+ const void * keyp, size_t keylen);
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+int
|
|
|
b94e32 |
+main ()
|
|
|
b94e32 |
+{
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ ;
|
|
|
b94e32 |
+ return 0;
|
|
|
b94e32 |
+}
|
|
|
b94e32 |
+_ACEOF
|
|
|
b94e32 |
+if ac_fn_c_try_compile "$LINENO"; then :
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ LIBRPM_COMPAT=true
|
|
|
b94e32 |
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
|
|
b94e32 |
+$as_echo "yes" >&6; }
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+else
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ LIBRPM_COMPAT=false
|
|
|
b94e32 |
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
|
|
b94e32 |
+$as_echo "no" >&6; }
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+fi
|
|
|
b94e32 |
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
|
|
b94e32 |
+ CFLAGS="$save_CFLAGS"
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ if ! $LIBRPM_COMPAT; then
|
|
|
b94e32 |
+ HAVE_DLOPEN_LIBRPM=false
|
|
|
b94e32 |
+ fi
|
|
|
b94e32 |
+ fi
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ if $HAVE_DLOPEN_LIBRPM; then
|
|
|
b94e32 |
+ DLOPEN_LIBRPM_STRING='"'"$DLOPEN_LIBRPM"'"'
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+cat >>confdefs.h <<_ACEOF
|
|
|
b94e32 |
+#define DLOPEN_LIBRPM $DLOPEN_LIBRPM_STRING
|
|
|
b94e32 |
+_ACEOF
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+$as_echo "#define HAVE_LIBRPM 1" >>confdefs.h
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ else
|
|
|
b94e32 |
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
|
|
b94e32 |
+$as_echo "no" >&6; }
|
|
|
b94e32 |
+ LIBS="$save_LIBS"
|
|
|
b94e32 |
+ if $DLOPEN_REQUIRE; then
|
|
|
b94e32 |
+ as_fn_error "Specific name $LIBRPM was requested but it could not be opened." "$LINENO" 5
|
|
|
b94e32 |
+ fi
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
|
|
|
b94e32 |
+ if test -n "$ac_tool_prefix"; then
|
|
|
b94e32 |
+ # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
|
|
|
b94e32 |
+set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
|
|
|
b94e32 |
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
|
|
b94e32 |
+$as_echo_n "checking for $ac_word... " >&6; }
|
|
|
b94e32 |
+if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
|
|
|
b94e32 |
+ $as_echo_n "(cached) " >&6
|
|
|
b94e32 |
+else
|
|
|
b94e32 |
+ case $PKG_CONFIG in
|
|
|
b94e32 |
+ [\\/]* | ?:[\\/]*)
|
|
|
b94e32 |
+ ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
|
|
|
b94e32 |
+ ;;
|
|
|
b94e32 |
+ *)
|
|
|
b94e32 |
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
|
|
b94e32 |
+for as_dir in $PATH
|
|
|
b94e32 |
+do
|
|
|
b94e32 |
+ IFS=$as_save_IFS
|
|
|
b94e32 |
+ test -z "$as_dir" && as_dir=.
|
|
|
b94e32 |
+ for ac_exec_ext in '' $ac_executable_extensions; do
|
|
|
b94e32 |
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
|
|
b94e32 |
+ ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
|
|
|
b94e32 |
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
|
|
b94e32 |
+ break 2
|
|
|
b94e32 |
+ fi
|
|
|
b94e32 |
+done
|
|
|
b94e32 |
+ done
|
|
|
b94e32 |
+IFS=$as_save_IFS
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ ;;
|
|
|
b94e32 |
+esac
|
|
|
b94e32 |
+fi
|
|
|
b94e32 |
+PKG_CONFIG=$ac_cv_path_PKG_CONFIG
|
|
|
b94e32 |
+if test -n "$PKG_CONFIG"; then
|
|
|
b94e32 |
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
|
|
|
b94e32 |
+$as_echo "$PKG_CONFIG" >&6; }
|
|
|
b94e32 |
+else
|
|
|
b94e32 |
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
|
|
b94e32 |
+$as_echo "no" >&6; }
|
|
|
b94e32 |
+fi
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+fi
|
|
|
b94e32 |
+if test -z "$ac_cv_path_PKG_CONFIG"; then
|
|
|
b94e32 |
+ ac_pt_PKG_CONFIG=$PKG_CONFIG
|
|
|
b94e32 |
+ # Extract the first word of "pkg-config", so it can be a program name with args.
|
|
|
b94e32 |
+set dummy pkg-config; ac_word=$2
|
|
|
b94e32 |
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
|
|
b94e32 |
+$as_echo_n "checking for $ac_word... " >&6; }
|
|
|
b94e32 |
+if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then :
|
|
|
b94e32 |
+ $as_echo_n "(cached) " >&6
|
|
|
b94e32 |
+else
|
|
|
b94e32 |
+ case $ac_pt_PKG_CONFIG in
|
|
|
b94e32 |
+ [\\/]* | ?:[\\/]*)
|
|
|
b94e32 |
+ ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
|
|
|
b94e32 |
+ ;;
|
|
|
b94e32 |
+ *)
|
|
|
b94e32 |
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
|
|
b94e32 |
+for as_dir in $PATH
|
|
|
b94e32 |
+do
|
|
|
b94e32 |
+ IFS=$as_save_IFS
|
|
|
b94e32 |
+ test -z "$as_dir" && as_dir=.
|
|
|
b94e32 |
+ for ac_exec_ext in '' $ac_executable_extensions; do
|
|
|
b94e32 |
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
|
|
b94e32 |
+ ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
|
|
|
b94e32 |
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
|
|
b94e32 |
+ break 2
|
|
|
b94e32 |
+ fi
|
|
|
b94e32 |
+done
|
|
|
b94e32 |
+ done
|
|
|
b94e32 |
+IFS=$as_save_IFS
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ ;;
|
|
|
b94e32 |
+esac
|
|
|
b94e32 |
+fi
|
|
|
b94e32 |
+ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
|
|
|
b94e32 |
+if test -n "$ac_pt_PKG_CONFIG"; then
|
|
|
b94e32 |
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
|
|
|
b94e32 |
+$as_echo "$ac_pt_PKG_CONFIG" >&6; }
|
|
|
b94e32 |
+else
|
|
|
b94e32 |
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
|
|
b94e32 |
+$as_echo "no" >&6; }
|
|
|
b94e32 |
+fi
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ if test "x$ac_pt_PKG_CONFIG" = x; then
|
|
|
b94e32 |
+ PKG_CONFIG=""
|
|
|
b94e32 |
+ else
|
|
|
b94e32 |
+ case $cross_compiling:$ac_tool_warned in
|
|
|
b94e32 |
+yes:)
|
|
|
b94e32 |
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
|
|
|
b94e32 |
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
|
|
|
b94e32 |
+ac_tool_warned=yes ;;
|
|
|
b94e32 |
+esac
|
|
|
b94e32 |
+ PKG_CONFIG=$ac_pt_PKG_CONFIG
|
|
|
b94e32 |
+ fi
|
|
|
b94e32 |
+else
|
|
|
b94e32 |
+ PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
|
|
|
b94e32 |
+fi
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+fi
|
|
|
b94e32 |
+if test -n "$PKG_CONFIG"; then
|
|
|
b94e32 |
+ _pkg_min_version=0.9.0
|
|
|
b94e32 |
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
|
|
|
b94e32 |
+$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
|
|
|
b94e32 |
+ if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
|
|
|
b94e32 |
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
|
|
b94e32 |
+$as_echo "yes" >&6; }
|
|
|
b94e32 |
+ else
|
|
|
b94e32 |
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
|
|
b94e32 |
+$as_echo "no" >&6; }
|
|
|
b94e32 |
+ PKG_CONFIG=""
|
|
|
b94e32 |
+ fi
|
|
|
b94e32 |
+fi
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+pkg_failed=no
|
|
|
b94e32 |
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for RPM" >&5
|
|
|
b94e32 |
+$as_echo_n "checking for RPM... " >&6; }
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+if test -n "$RPM_CFLAGS"; then
|
|
|
b94e32 |
+ pkg_cv_RPM_CFLAGS="$RPM_CFLAGS"
|
|
|
b94e32 |
+ elif test -n "$PKG_CONFIG"; then
|
|
|
b94e32 |
+ if test -n "$PKG_CONFIG" && \
|
|
|
b94e32 |
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"rpm\""; } >&5
|
|
|
b94e32 |
+ ($PKG_CONFIG --exists --print-errors "rpm") 2>&5
|
|
|
b94e32 |
+ ac_status=$?
|
|
|
b94e32 |
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
|
|
b94e32 |
+ test $ac_status = 0; }; then
|
|
|
b94e32 |
+ pkg_cv_RPM_CFLAGS=`$PKG_CONFIG --cflags "rpm" 2>/dev/null`
|
|
|
b94e32 |
+ test "x$?" != "x0" && pkg_failed=yes
|
|
|
b94e32 |
+else
|
|
|
b94e32 |
+ pkg_failed=yes
|
|
|
b94e32 |
+fi
|
|
|
b94e32 |
+ else
|
|
|
b94e32 |
+ pkg_failed=untried
|
|
|
b94e32 |
+fi
|
|
|
b94e32 |
+if test -n "$RPM_LIBS"; then
|
|
|
b94e32 |
+ pkg_cv_RPM_LIBS="$RPM_LIBS"
|
|
|
b94e32 |
+ elif test -n "$PKG_CONFIG"; then
|
|
|
b94e32 |
+ if test -n "$PKG_CONFIG" && \
|
|
|
b94e32 |
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"rpm\""; } >&5
|
|
|
b94e32 |
+ ($PKG_CONFIG --exists --print-errors "rpm") 2>&5
|
|
|
b94e32 |
+ ac_status=$?
|
|
|
b94e32 |
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
|
|
b94e32 |
+ test $ac_status = 0; }; then
|
|
|
b94e32 |
+ pkg_cv_RPM_LIBS=`$PKG_CONFIG --libs "rpm" 2>/dev/null`
|
|
|
b94e32 |
+ test "x$?" != "x0" && pkg_failed=yes
|
|
|
b94e32 |
+else
|
|
|
b94e32 |
+ pkg_failed=yes
|
|
|
b94e32 |
+fi
|
|
|
b94e32 |
+ else
|
|
|
b94e32 |
+ pkg_failed=untried
|
|
|
b94e32 |
+fi
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+if test $pkg_failed = yes; then
|
|
|
b94e32 |
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
|
|
b94e32 |
+$as_echo "no" >&6; }
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
|
|
|
b94e32 |
+ _pkg_short_errors_supported=yes
|
|
|
b94e32 |
+else
|
|
|
b94e32 |
+ _pkg_short_errors_supported=no
|
|
|
b94e32 |
+fi
|
|
|
b94e32 |
+ if test $_pkg_short_errors_supported = yes; then
|
|
|
b94e32 |
+ RPM_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "rpm" 2>&1`
|
|
|
b94e32 |
+ else
|
|
|
b94e32 |
+ RPM_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "rpm" 2>&1`
|
|
|
b94e32 |
+ fi
|
|
|
b94e32 |
+ # Put the nasty error message in config.log where it belongs
|
|
|
b94e32 |
+ echo "$RPM_PKG_ERRORS" >&5
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ HAVE_LIBRPM=false
|
|
|
b94e32 |
+elif test $pkg_failed = untried; then
|
|
|
b94e32 |
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
|
|
b94e32 |
+$as_echo "no" >&6; }
|
|
|
b94e32 |
+ HAVE_LIBRPM=false
|
|
|
b94e32 |
+else
|
|
|
b94e32 |
+ RPM_CFLAGS=$pkg_cv_RPM_CFLAGS
|
|
|
b94e32 |
+ RPM_LIBS=$pkg_cv_RPM_LIBS
|
|
|
b94e32 |
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
|
|
b94e32 |
+$as_echo "yes" >&6; }
|
|
|
b94e32 |
+ HAVE_LIBRPM=true
|
|
|
b94e32 |
+fi
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ if $HAVE_LIBRPM; then
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking rpm library API compatibility" >&5
|
|
|
b94e32 |
+$as_echo_n "checking rpm library API compatibility... " >&6; }
|
|
|
b94e32 |
+ # The compilation requires -Werror to verify anything.
|
|
|
b94e32 |
+ save_CFLAGS="$CFLAGS"
|
|
|
b94e32 |
+ CFLAGS="$CFLAGS -Werror"
|
|
|
b94e32 |
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
|
|
b94e32 |
+/* end confdefs.h. */
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+/* Duplicate here the declarations to verify they match "elfread.c". */
|
|
|
b94e32 |
+#include <rpm/rpmlib.h>
|
|
|
b94e32 |
+#include <rpm/rpmts.h>
|
|
|
b94e32 |
+#include <rpm/rpmdb.h>
|
|
|
b94e32 |
+#include <rpm/header.h>
|
|
|
b94e32 |
+extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
|
|
|
b94e32 |
+extern int rpmReadConfigFiles(const char * file, const char * target);
|
|
|
b94e32 |
+extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
|
|
|
b94e32 |
+extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
|
|
|
b94e32 |
+extern rpmts rpmtsCreate(void);
|
|
|
b94e32 |
+extern rpmts rpmtsFree(rpmts ts);
|
|
|
b94e32 |
+extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
|
|
|
b94e32 |
+ const void * keyp, size_t keylen);
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+int
|
|
|
b94e32 |
+main ()
|
|
|
b94e32 |
+{
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ ;
|
|
|
b94e32 |
+ return 0;
|
|
|
b94e32 |
+}
|
|
|
b94e32 |
+_ACEOF
|
|
|
b94e32 |
+if ac_fn_c_try_compile "$LINENO"; then :
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ LIBRPM_COMPAT=true
|
|
|
b94e32 |
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
|
|
b94e32 |
+$as_echo "yes" >&6; }
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+else
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ LIBRPM_COMPAT=false
|
|
|
b94e32 |
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
|
|
b94e32 |
+$as_echo "no" >&6; }
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+fi
|
|
|
b94e32 |
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
|
|
b94e32 |
+ CFLAGS="$save_CFLAGS"
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ if ! $LIBRPM_COMPAT; then
|
|
|
b94e32 |
+ HAVE_LIBRPM=false
|
|
|
b94e32 |
+ RPM_PKG_ERRORS="Found $LIBRPM API is incompatibile with this GDB"
|
|
|
b94e32 |
+ fi
|
|
|
b94e32 |
+ fi
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ if $HAVE_LIBRPM; then
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+$as_echo "#define HAVE_LIBRPM 1" >>confdefs.h
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ CFLAGS="$CFLAGS $RPM_CFLAGS"
|
|
|
b94e32 |
+ LIBS="$LIBS $RPM_LIBS"
|
|
|
b94e32 |
+ else
|
|
|
b94e32 |
+ if $RPM_REQUIRE; then
|
|
|
b94e32 |
+ as_fn_error "$RPM_PKG_ERRORS" "$LINENO" 5
|
|
|
b94e32 |
+ else
|
|
|
b94e32 |
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $RPM_PKG_ERRORS" >&5
|
|
|
b94e32 |
+$as_echo "$as_me: WARNING: $RPM_PKG_ERRORS" >&2;}
|
|
|
b94e32 |
+ fi
|
|
|
b94e32 |
+ fi
|
|
|
b94e32 |
+ fi
|
|
|
b94e32 |
+fi
|
|
|
b94e32 |
+
|
|
|
b94e32 |
|
|
|
b94e32 |
|
|
|
b94e32 |
subdirs="$subdirs testsuite"
|
|
|
b94e32 |
diff --git a/gdb/configure.ac b/gdb/configure.ac
|
|
|
b94e32 |
--- a/gdb/configure.ac
|
|
|
b94e32 |
+++ b/gdb/configure.ac
|
|
|
b94e32 |
@@ -153,6 +153,199 @@ AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escape_dir,
|
|
|
b94e32 |
[Directories safe to hold auto-loaded files.])
|
|
|
b94e32 |
AC_MSG_RESULT([$with_auto_load_safe_path])
|
|
|
b94e32 |
|
|
|
b94e32 |
+# Integration with rpm library to support missing debuginfo suggestions.
|
|
|
b94e32 |
+# --without-rpm: Disable any rpm support.
|
|
|
b94e32 |
+# --with-rpm=libname.so: Try to dynamically open `libname.so' during runtime.
|
|
|
b94e32 |
+# Even with runtime missing `libname.so' GDB will still other run correctly.
|
|
|
b94e32 |
+# Missing `libname.so' during ./configure will abort the configuration.
|
|
|
b94e32 |
+# --with-rpm=librpm.so: Like `--with-rpm=libname.so' but try to find specific
|
|
|
b94e32 |
+# minor version first such as `librpm-4.6.so' as minor version differences
|
|
|
b94e32 |
+# mean API+ABI incompatibility. If the specific match versioned library name
|
|
|
b94e32 |
+# could not be found still open dynamically at least `librpm.so'.
|
|
|
b94e32 |
+# --with-rpm: Like `--with-rpm=librpm.so' but if any of its detection fails try
|
|
|
b94e32 |
+# to find librpm for compilation-time linking by pkg-config. GDB binary will
|
|
|
b94e32 |
+# be probably linked with the version specific library (as `librpm-4.6.so').
|
|
|
b94e32 |
+# Failure to find librpm by pkg-config will abort the configuration.
|
|
|
b94e32 |
+# (default) --with-rpm=auto: Like `--with-rpm=librpm.so' but if even pkg-config
|
|
|
b94e32 |
+# cannot find librpm use to the rpmless compilation (like `--without-rpm').
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+AC_ARG_WITH([rpm],
|
|
|
b94e32 |
+ [AS_HELP_STRING([--with-rpm],
|
|
|
b94e32 |
+ [query rpm database for missing debuginfos (yes/no, def. auto=librpm.so)])], [], [with_rpm="auto"])
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+m4_pattern_allow([^AC_MSG_ERROR$])
|
|
|
b94e32 |
+m4_pattern_allow([^AC_MSG_WARN$])
|
|
|
b94e32 |
+if test "x$with_rpm" != "xno"; then
|
|
|
b94e32 |
+ if test "x$with_rpm" = "xyes"; then
|
|
|
b94e32 |
+ LIBRPM="librpm.so"
|
|
|
b94e32 |
+ RPM_REQUIRE=true
|
|
|
b94e32 |
+ DLOPEN_REQUIRE=false
|
|
|
b94e32 |
+ elif test "x$with_rpm" = "xauto"; then
|
|
|
b94e32 |
+ LIBRPM="librpm.so"
|
|
|
b94e32 |
+ RPM_REQUIRE=false
|
|
|
b94e32 |
+ DLOPEN_REQUIRE=false
|
|
|
b94e32 |
+ else
|
|
|
b94e32 |
+ LIBRPM="$with_rpm"
|
|
|
b94e32 |
+ RPM_REQUIRE=true
|
|
|
b94e32 |
+ DLOPEN_REQUIRE=true
|
|
|
b94e32 |
+ fi
|
|
|
b94e32 |
+ LIBRPM_STRING='"'"$LIBRPM"'"'
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ AC_MSG_CHECKING([specific librpm version])
|
|
|
b94e32 |
+ HAVE_DLOPEN_LIBRPM=false
|
|
|
b94e32 |
+ save_LIBS="$LIBS"
|
|
|
b94e32 |
+ LIBS="$LIBS -ldl"
|
|
|
b94e32 |
+ AC_RUN_IFELSE(AC_LANG_PROGRAM([[
|
|
|
b94e32 |
+#include <rpm/rpmlib.h>
|
|
|
b94e32 |
+#include <dlfcn.h>
|
|
|
b94e32 |
+#include <errno.h>
|
|
|
b94e32 |
+ ]], [[
|
|
|
b94e32 |
+ void *h;
|
|
|
b94e32 |
+ const char *const *rpmverp;
|
|
|
b94e32 |
+ FILE *f;
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ f = fopen ("conftest.out", "w");
|
|
|
b94e32 |
+ if (!f)
|
|
|
b94e32 |
+ {
|
|
|
b94e32 |
+ fprintf (stderr, "Cannot write \"%s\": %s\n", "conftest.out",
|
|
|
b94e32 |
+ strerror (errno));
|
|
|
b94e32 |
+ return 1;
|
|
|
b94e32 |
+ }
|
|
|
b94e32 |
+ h = dlopen ($LIBRPM_STRING, RTLD_LAZY);
|
|
|
b94e32 |
+ if (!h)
|
|
|
b94e32 |
+ {
|
|
|
b94e32 |
+ fprintf (stderr, "dlopen (\"%s\"): %s\n", $LIBRPM_STRING, dlerror ());
|
|
|
b94e32 |
+ return 1;
|
|
|
b94e32 |
+ }
|
|
|
b94e32 |
+ rpmverp = dlsym (h, "RPMVERSION");
|
|
|
b94e32 |
+ if (!rpmverp)
|
|
|
b94e32 |
+ {
|
|
|
b94e32 |
+ fprintf (stderr, "dlsym (\"RPMVERSION\"): %s\n", dlerror ());
|
|
|
b94e32 |
+ return 1;
|
|
|
b94e32 |
+ }
|
|
|
b94e32 |
+ fprintf (stderr, "RPMVERSION is: \"");
|
|
|
b94e32 |
+ fprintf (stderr, "%s\"\n", *rpmverp);
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ /* Try to find the specific librpm version only for "librpm.so" as we do
|
|
|
b94e32 |
+ not know how to assemble the version string otherwise. */
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ if (strcmp ("librpm.so", $LIBRPM_STRING) != 0)
|
|
|
b94e32 |
+ {
|
|
|
b94e32 |
+ fprintf (f, "%s\n", $LIBRPM_STRING);
|
|
|
b94e32 |
+ return 0;
|
|
|
b94e32 |
+ }
|
|
|
b94e32 |
+ else
|
|
|
b94e32 |
+ {
|
|
|
b94e32 |
+ char *h2_name;
|
|
|
b94e32 |
+ void *h2;
|
|
|
b94e32 |
+ int major, minor;
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ if (sscanf (*rpmverp, "%d.%d", &major, &minor) != 2)
|
|
|
b94e32 |
+ {
|
|
|
b94e32 |
+ fprintf (stderr, "Unable to parse RPMVERSION.\n");
|
|
|
b94e32 |
+ fprintf (f, "%s\n", $LIBRPM_STRING);
|
|
|
b94e32 |
+ return 0;
|
|
|
b94e32 |
+ }
|
|
|
b94e32 |
+ /* Avoid the square brackets by malloc. */
|
|
|
b94e32 |
+ h2_name = malloc (64);
|
|
|
b94e32 |
+ sprintf (h2_name, "librpm-%d.%d.so", major, minor);
|
|
|
b94e32 |
+ h2 = dlopen (h2_name, RTLD_LAZY);
|
|
|
b94e32 |
+ if (!h2)
|
|
|
b94e32 |
+ {
|
|
|
b94e32 |
+ fprintf (stderr, "dlopen (\"%s\"): %s\n", h2_name, dlerror ());
|
|
|
b94e32 |
+ fprintf (f, "%s\n", $LIBRPM_STRING);
|
|
|
b94e32 |
+ return 0;
|
|
|
b94e32 |
+ }
|
|
|
b94e32 |
+ if (h2 != h)
|
|
|
b94e32 |
+ {
|
|
|
b94e32 |
+ fprintf (stderr, "dlopen of \"%s\" and \"%s\" are different.\n",
|
|
|
b94e32 |
+ $LIBRPM_STRING, h2_name);
|
|
|
b94e32 |
+ fprintf (f, "%s\n", $LIBRPM_STRING);
|
|
|
b94e32 |
+ return 0;
|
|
|
b94e32 |
+ }
|
|
|
b94e32 |
+ /* Found the valid .so name with a specific version. */
|
|
|
b94e32 |
+ fprintf (f, "%s\n", h2_name);
|
|
|
b94e32 |
+ return 0;
|
|
|
b94e32 |
+ }
|
|
|
b94e32 |
+ ]]), [
|
|
|
b94e32 |
+ DLOPEN_LIBRPM="`cat conftest.out`"
|
|
|
b94e32 |
+ if test "x$DLOPEN_LIBRPM" != "x"; then
|
|
|
b94e32 |
+ HAVE_DLOPEN_LIBRPM=true
|
|
|
b94e32 |
+ AC_MSG_RESULT($DLOPEN_LIBRPM)
|
|
|
b94e32 |
+ fi
|
|
|
b94e32 |
+ ])
|
|
|
b94e32 |
+ rm -f conftest.out
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ m4_define([CHECK_LIBRPM_COMPAT], [
|
|
|
b94e32 |
+ AC_MSG_CHECKING([rpm library API compatibility])
|
|
|
b94e32 |
+ # The compilation requires -Werror to verify anything.
|
|
|
b94e32 |
+ save_CFLAGS="$CFLAGS"
|
|
|
b94e32 |
+ CFLAGS="$CFLAGS -Werror"
|
|
|
b94e32 |
+ AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[
|
|
|
b94e32 |
+/* Duplicate here the declarations to verify they match "elfread.c". */
|
|
|
b94e32 |
+#include <rpm/rpmlib.h>
|
|
|
b94e32 |
+#include <rpm/rpmts.h>
|
|
|
b94e32 |
+#include <rpm/rpmdb.h>
|
|
|
b94e32 |
+#include <rpm/header.h>
|
|
|
b94e32 |
+extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
|
|
|
b94e32 |
+extern int rpmReadConfigFiles(const char * file, const char * target);
|
|
|
b94e32 |
+extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
|
|
|
b94e32 |
+extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
|
|
|
b94e32 |
+extern rpmts rpmtsCreate(void);
|
|
|
b94e32 |
+extern rpmts rpmtsFree(rpmts ts);
|
|
|
b94e32 |
+extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
|
|
|
b94e32 |
+ const void * keyp, size_t keylen);
|
|
|
b94e32 |
+ ]]), [
|
|
|
b94e32 |
+ LIBRPM_COMPAT=true
|
|
|
b94e32 |
+ AC_MSG_RESULT(yes)
|
|
|
b94e32 |
+ ], [
|
|
|
b94e32 |
+ LIBRPM_COMPAT=false
|
|
|
b94e32 |
+ AC_MSG_RESULT(no)
|
|
|
b94e32 |
+ ])
|
|
|
b94e32 |
+ CFLAGS="$save_CFLAGS"
|
|
|
b94e32 |
+ ])
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ if $HAVE_DLOPEN_LIBRPM; then
|
|
|
b94e32 |
+ CHECK_LIBRPM_COMPAT
|
|
|
b94e32 |
+ if ! $LIBRPM_COMPAT; then
|
|
|
b94e32 |
+ HAVE_DLOPEN_LIBRPM=false
|
|
|
b94e32 |
+ fi
|
|
|
b94e32 |
+ fi
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ if $HAVE_DLOPEN_LIBRPM; then
|
|
|
b94e32 |
+ DLOPEN_LIBRPM_STRING='"'"$DLOPEN_LIBRPM"'"'
|
|
|
b94e32 |
+ AC_DEFINE_UNQUOTED(DLOPEN_LIBRPM, $DLOPEN_LIBRPM_STRING, [librpm version specific library name to dlopen.])
|
|
|
b94e32 |
+ AC_DEFINE(HAVE_LIBRPM, 1, [Define if librpm library is being used.])
|
|
|
b94e32 |
+ else
|
|
|
b94e32 |
+ AC_MSG_RESULT(no)
|
|
|
b94e32 |
+ LIBS="$save_LIBS"
|
|
|
b94e32 |
+ if $DLOPEN_REQUIRE; then
|
|
|
b94e32 |
+ AC_MSG_ERROR([Specific name $LIBRPM was requested but it could not be opened.])
|
|
|
b94e32 |
+ fi
|
|
|
b94e32 |
+ PKG_CHECK_MODULES(RPM, rpm, [HAVE_LIBRPM=true], [HAVE_LIBRPM=false])
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ if $HAVE_LIBRPM; then
|
|
|
b94e32 |
+ CHECK_LIBRPM_COMPAT
|
|
|
b94e32 |
+ if ! $LIBRPM_COMPAT; then
|
|
|
b94e32 |
+ HAVE_LIBRPM=false
|
|
|
b94e32 |
+ RPM_PKG_ERRORS="Found $LIBRPM API is incompatibile with this GDB"
|
|
|
b94e32 |
+ fi
|
|
|
b94e32 |
+ fi
|
|
|
b94e32 |
+
|
|
|
b94e32 |
+ if $HAVE_LIBRPM; then
|
|
|
b94e32 |
+ AC_DEFINE(HAVE_LIBRPM, 1, [Define if librpm library is being used.])
|
|
|
b94e32 |
+ CFLAGS="$CFLAGS $RPM_CFLAGS"
|
|
|
b94e32 |
+ LIBS="$LIBS $RPM_LIBS"
|
|
|
b94e32 |
+ else
|
|
|
b94e32 |
+ if $RPM_REQUIRE; then
|
|
|
b94e32 |
+ AC_MSG_ERROR($RPM_PKG_ERRORS)
|
|
|
b94e32 |
+ else
|
|
|
b94e32 |
+ AC_MSG_WARN($RPM_PKG_ERRORS)
|
|
|
b94e32 |
+ fi
|
|
|
b94e32 |
+ fi
|
|
|
b94e32 |
+ fi
|
|
|
b94e32 |
+fi
|
|
|
b94e32 |
+
|
|
|
b94e32 |
AC_CONFIG_SUBDIRS(testsuite)
|
|
|
b94e32 |
|
|
|
b94e32 |
# Check whether to support alternative target configurations
|
|
|
b94e32 |
diff --git a/gdb/event-top.c b/gdb/event-top.c
|
|
|
b94e32 |
--- a/gdb/event-top.c
|
|
|
b94e32 |
+++ b/gdb/event-top.c
|
|
|
b94e32 |
@@ -41,6 +41,7 @@
|
|
|
b94e32 |
#include "gdbsupport/gdb_select.h"
|
|
|
b94e32 |
#include "gdbsupport/gdb-sigmask.h"
|
|
|
b94e32 |
#include "async-event.h"
|
|
|
b94e32 |
+#include "symfile.h"
|
|
|
b94e32 |
|
|
|
b94e32 |
/* readline include files. */
|
|
|
b94e32 |
#include "readline/readline.h"
|
|
|
b94e32 |
@@ -363,6 +364,8 @@ display_gdb_prompt (const char *new_prompt)
|
|
|
b94e32 |
/* Reset the nesting depth used when trace-commands is set. */
|
|
|
b94e32 |
reset_command_nest_depth ();
|
|
|
b94e32 |
|
|
|
b94e32 |
+ debug_flush_missing ();
|
|
|
b94e32 |
+
|
|
|
b94e32 |
/* Do not call the python hook on an explicit prompt change as
|
|
|
b94e32 |
passed to this function, as this forms a secondary/local prompt,
|
|
|
b94e32 |
IE, displayed but not set. */
|
|
|
b94e32 |
@@ -773,7 +776,10 @@ command_line_handler (gdb::unique_xmalloc_ptr<char> &&rl)
|
|
|
b94e32 |
command_handler (cmd);
|
|
|
b94e32 |
|
|
|
b94e32 |
if (ui->prompt_state != PROMPTED)
|
|
|
b94e32 |
- display_gdb_prompt (0);
|
|
|
b94e32 |
+ {
|
|
|
b94e32 |
+ debug_flush_missing ();
|
|
|
b94e32 |
+ display_gdb_prompt (0);
|
|
|
b94e32 |
+ }
|
|
|
b94e32 |
}
|
|
|
b94e32 |
}
|
|
|
b94e32 |
|
|
|
b94e32 |
diff --git a/gdb/symfile.h b/gdb/symfile.h
|
|
|
b94e32 |
--- a/gdb/symfile.h
|
|
|
b94e32 |
+++ b/gdb/symfile.h
|
|
|
b94e32 |
@@ -342,6 +342,7 @@ extern void generic_load (const char *args, int from_tty);
|
|
|
b94e32 |
/* build-id support. */
|
|
|
b94e32 |
extern struct bfd_build_id *build_id_addr_get (CORE_ADDR addr);
|
|
|
b94e32 |
extern void debug_print_missing (const char *binary, const char *debug);
|
|
|
b94e32 |
+extern void debug_flush_missing (void);
|
|
|
b94e32 |
#define BUILD_ID_MAIN_EXECUTABLE_FILENAME _("the main executable file")
|
|
|
b94e32 |
|
|
|
b94e32 |
/* From minidebug.c. */
|