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
8 diff --git a/gdb/aclocal.m4 b/gdb/aclocal.m4
12 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
15 +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
16 +# serial 1 (pkg-config-0.24)
18 +# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
20 +# This program is free software; you can redistribute it and/or modify
21 +# it under the terms of the GNU General Public License as published by
22 +# the Free Software Foundation; either version 2 of the License, or
23 +# (at your option) any later version.
25 +# This program is distributed in the hope that it will be useful, but
26 +# WITHOUT ANY WARRANTY; without even the implied warranty of
27 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28 +# General Public License for more details.
30 +# You should have received a copy of the GNU General Public License
31 +# along with this program; if not, write to the Free Software
32 +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
34 +# As a special exception to the GNU General Public License, if you
35 +# distribute this file as part of a program that contains a
36 +# configuration script generated by Autoconf, you may include it under
37 +# the same distribution terms that you use for the rest of that program.
39 +# PKG_PROG_PKG_CONFIG([MIN-VERSION])
40 +# ----------------------------------
41 +AC_DEFUN([PKG_PROG_PKG_CONFIG],
42 +[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
43 +m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
44 +m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
45 +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
46 +AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
47 +AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
49 +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
50 + AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
52 +if test -n "$PKG_CONFIG"; then
53 + _pkg_min_version=m4_default([$1], [0.9.0])
54 + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
55 + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
56 + AC_MSG_RESULT([yes])
62 +])# PKG_PROG_PKG_CONFIG
64 +# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
66 +# Check to see whether a particular set of modules exists. Similar
67 +# to PKG_CHECK_MODULES(), but does not set variables or print errors.
69 +# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
70 +# only at the first occurence in configure.ac, so if the first place
71 +# it's called might be skipped (such as if it is within an "if", you
72 +# have to call PKG_CHECK_EXISTS manually
73 +# --------------------------------------------------------------
74 +AC_DEFUN([PKG_CHECK_EXISTS],
75 +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
76 +if test -n "$PKG_CONFIG" && \
77 + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
78 + m4_default([$2], [:])
79 +m4_ifvaln([$3], [else
83 +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
84 +# ---------------------------------------------
85 +m4_define([_PKG_CONFIG],
86 +[if test -n "$$1"; then
88 + elif test -n "$PKG_CONFIG"; then
89 + PKG_CHECK_EXISTS([$3],
90 + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
91 + test "x$?" != "x0" && pkg_failed=yes ],
98 +# _PKG_SHORT_ERRORS_SUPPORTED
99 +# -----------------------------
100 +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
101 +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
102 +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
103 + _pkg_short_errors_supported=yes
105 + _pkg_short_errors_supported=no
107 +])# _PKG_SHORT_ERRORS_SUPPORTED
110 +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
111 +# [ACTION-IF-NOT-FOUND])
114 +# Note that if there is a possibility the first call to
115 +# PKG_CHECK_MODULES might not happen, you should be sure to include an
116 +# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
119 +# --------------------------------------------------------------
120 +AC_DEFUN([PKG_CHECK_MODULES],
121 +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
122 +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
123 +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
126 +AC_MSG_CHECKING([for $1])
128 +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
129 +_PKG_CONFIG([$1][_LIBS], [libs], [$2])
131 +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
132 +and $1[]_LIBS to avoid the need to call pkg-config.
133 +See the pkg-config man page for more details.])
135 +if test $pkg_failed = yes; then
136 + AC_MSG_RESULT([no])
137 + _PKG_SHORT_ERRORS_SUPPORTED
138 + if test $_pkg_short_errors_supported = yes; then
139 + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
141 + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
143 + # Put the nasty error message in config.log where it belongs
144 + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
146 + m4_default([$4], [AC_MSG_ERROR(
147 +[Package requirements ($2) were not met:
151 +Consider adjusting the PKG_CONFIG_PATH environment variable if you
152 +installed software in a non-standard prefix.
156 +elif test $pkg_failed = untried; then
157 + AC_MSG_RESULT([no])
158 + m4_default([$4], [AC_MSG_FAILURE(
159 +[The pkg-config script could not be found or is too old. Make sure it
160 +is in your PATH or set the PKG_CONFIG environment variable to the full
165 +To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
168 + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
169 + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
170 + AC_MSG_RESULT([yes])
173 +])# PKG_CHECK_MODULES
176 +# PKG_INSTALLDIR(DIRECTORY)
177 +# -------------------------
178 +# Substitutes the variable pkgconfigdir as the location where a module
179 +# should install pkg-config .pc files. By default the directory is
180 +# $libdir/pkgconfig, but the default can be changed by passing
181 +# DIRECTORY. The user can override through the --with-pkgconfigdir
183 +AC_DEFUN([PKG_INSTALLDIR],
184 +[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
185 +m4_pushdef([pkg_description],
186 + [pkg-config installation directory @<:@]pkg_default[@:>@])
187 +AC_ARG_WITH([pkgconfigdir],
188 + [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
189 + [with_pkgconfigdir=]pkg_default)
190 +AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
191 +m4_popdef([pkg_default])
192 +m4_popdef([pkg_description])
193 +]) dnl PKG_INSTALLDIR
196 +# PKG_NOARCH_INSTALLDIR(DIRECTORY)
197 +# -------------------------
198 +# Substitutes the variable noarch_pkgconfigdir as the location where a
199 +# module should install arch-independent pkg-config .pc files. By
200 +# default the directory is $datadir/pkgconfig, but the default can be
201 +# changed by passing DIRECTORY. The user can override through the
202 +# --with-noarch-pkgconfigdir parameter.
203 +AC_DEFUN([PKG_NOARCH_INSTALLDIR],
204 +[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
205 +m4_pushdef([pkg_description],
206 + [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
207 +AC_ARG_WITH([noarch-pkgconfigdir],
208 + [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
209 + [with_noarch_pkgconfigdir=]pkg_default)
210 +AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
211 +m4_popdef([pkg_default])
212 +m4_popdef([pkg_description])
213 +]) dnl PKG_NOARCH_INSTALLDIR
216 +# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
217 +# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
218 +# -------------------------------------------
219 +# Retrieves the value of the pkg-config variable for the given module.
220 +AC_DEFUN([PKG_CHECK_VAR],
221 +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
222 +AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
224 +_PKG_CONFIG([$1], [variable="][$3]["], [$2])
225 +AS_VAR_COPY([$1], [pkg_cv_][$1])
227 +AS_VAR_IF([$1], [""], [$5], [$4])dnl
230 m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
232 # AM_AUX_DIR_EXPAND -*- Autoconf -*-
234 # Copyright (C) 2001-2017 Free Software Foundation, Inc.
235 diff --git a/gdb/config.in b/gdb/config.in
239 /* Handle .ctf type-info sections */
242 +/* librpm version specific library name to dlopen. */
243 +#undef DLOPEN_LIBRPM
245 /* Define to 1 if translation of program messages to the user's native
246 language is requested. */
249 /* Define if you have the mpfr library. */
252 +/* Define if librpm library is being used. */
255 /* Define to 1 if you have the <libunwind-ia64.h> header file. */
256 #undef HAVE_LIBUNWIND_IA64_H
258 diff --git a/gdb/configure b/gdb/configure
261 @@ -775,6 +775,11 @@ TARGET_OBS
262 ENABLE_BFD_64_BIT_FALSE
263 ENABLE_BFD_64_BIT_TRUE
273 @@ -880,6 +885,7 @@ with_gdb_datadir
274 with_relocated_sources
276 with_auto_load_safe_path
281 @@ -959,6 +965,8 @@ PKG_CONFIG_PATH
290 @@ -1635,6 +1643,8 @@ Optional Packages:
291 do not restrict auto-loaded files locations
292 --with-debuginfod Enable debuginfo lookups with debuginfod
294 + --with-rpm query rpm database for missing debuginfos (yes/no,
295 + def. auto=librpm.so)
296 --with-libunwind-ia64 use libunwind frame unwinding for ia64 targets
297 --with-curses use the curses library instead of the termcap
299 @@ -1715,6 +1725,8 @@ Some influential environment variables:
300 C compiler flags for DEBUGINFOD, overriding pkg-config
302 linker flags for DEBUGINFOD, overriding pkg-config
303 + RPM_CFLAGS C compiler flags for RPM, overriding pkg-config
304 + RPM_LIBS linker flags for RPM, overriding pkg-config
305 YACC The `Yet Another Compiler Compiler' implementation to use.
306 Defaults to the first program found out of: `bison -y', `byacc',
308 @@ -6634,6 +6646,494 @@ _ACEOF
309 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_auto_load_safe_path" >&5
310 $as_echo "$with_auto_load_safe_path" >&6; }
312 +# Integration with rpm library to support missing debuginfo suggestions.
313 +# --without-rpm: Disable any rpm support.
314 +# --with-rpm=libname.so: Try to dynamically open `libname.so' during runtime.
315 +# Even with runtime missing `libname.so' GDB will still other run correctly.
316 +# Missing `libname.so' during ./configure will abort the configuration.
317 +# --with-rpm=librpm.so: Like `--with-rpm=libname.so' but try to find specific
318 +# minor version first such as `librpm-4.6.so' as minor version differences
319 +# mean API+ABI incompatibility. If the specific match versioned library name
320 +# could not be found still open dynamically at least `librpm.so'.
321 +# --with-rpm: Like `--with-rpm=librpm.so' but if any of its detection fails try
322 +# to find librpm for compilation-time linking by pkg-config. GDB binary will
323 +# be probably linked with the version specific library (as `librpm-4.6.so').
324 +# Failure to find librpm by pkg-config will abort the configuration.
325 +# (default) --with-rpm=auto: Like `--with-rpm=librpm.so' but if even pkg-config
326 +# cannot find librpm use to the rpmless compilation (like `--without-rpm').
329 +# Check whether --with-rpm was given.
330 +if test "${with_rpm+set}" = set; then :
339 +if test "x$with_rpm" != "xno"; then
340 + if test "x$with_rpm" = "xyes"; then
343 + DLOPEN_REQUIRE=false
344 + elif test "x$with_rpm" = "xauto"; then
347 + DLOPEN_REQUIRE=false
351 + DLOPEN_REQUIRE=true
353 + LIBRPM_STRING='"'"$LIBRPM"'"'
355 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking specific librpm version" >&5
356 +$as_echo_n "checking specific librpm version... " >&6; }
357 + HAVE_DLOPEN_LIBRPM=false
360 + if test "$cross_compiling" = yes; then :
361 + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
362 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
363 +as_fn_error "cannot run test program while cross compiling
364 +See \`config.log' for more details." "$LINENO" 5; }
366 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext
367 +/* end confdefs.h. */
369 +#include <rpm/rpmlib.h>
378 + const char *const *rpmverp;
381 + f = fopen ("conftest.out", "w");
384 + fprintf (stderr, "Cannot write \"%s\": %s\n", "conftest.out",
388 + h = dlopen ($LIBRPM_STRING, RTLD_LAZY);
391 + fprintf (stderr, "dlopen (\"%s\"): %s\n", $LIBRPM_STRING, dlerror ());
394 + rpmverp = dlsym (h, "RPMVERSION");
397 + fprintf (stderr, "dlsym (\"RPMVERSION\"): %s\n", dlerror ());
400 + fprintf (stderr, "RPMVERSION is: \"");
401 + fprintf (stderr, "%s\"\n", *rpmverp);
403 + /* Try to find the specific librpm version only for "librpm.so" as we do
404 + not know how to assemble the version string otherwise. */
406 + if (strcmp ("librpm.so", $LIBRPM_STRING) != 0)
408 + fprintf (f, "%s\n", $LIBRPM_STRING);
417 + if (sscanf (*rpmverp, "%d.%d", &major, &minor) != 2)
419 + fprintf (stderr, "Unable to parse RPMVERSION.\n");
420 + fprintf (f, "%s\n", $LIBRPM_STRING);
423 + /* Avoid the square brackets by malloc. */
424 + h2_name = malloc (64);
425 + sprintf (h2_name, "librpm-%d.%d.so", major, minor);
426 + h2 = dlopen (h2_name, RTLD_LAZY);
429 + fprintf (stderr, "dlopen (\"%s\"): %s\n", h2_name, dlerror ());
430 + fprintf (f, "%s\n", $LIBRPM_STRING);
435 + fprintf (stderr, "dlopen of \"%s\" and \"%s\" are different.\n",
436 + $LIBRPM_STRING, h2_name);
437 + fprintf (f, "%s\n", $LIBRPM_STRING);
440 + /* Found the valid .so name with a specific version. */
441 + fprintf (f, "%s\n", h2_name);
449 +if ac_fn_c_try_run "$LINENO"; then :
451 + DLOPEN_LIBRPM="`cat conftest.out`"
452 + if test "x$DLOPEN_LIBRPM" != "x"; then
453 + HAVE_DLOPEN_LIBRPM=true
454 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLOPEN_LIBRPM" >&5
455 +$as_echo "$DLOPEN_LIBRPM" >&6; }
459 +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
460 + conftest.$ac_objext conftest.beam conftest.$ac_ext
467 + if $HAVE_DLOPEN_LIBRPM; then
469 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking rpm library API compatibility" >&5
470 +$as_echo_n "checking rpm library API compatibility... " >&6; }
471 + # The compilation requires -Werror to verify anything.
472 + save_CFLAGS="$CFLAGS"
473 + CFLAGS="$CFLAGS -Werror"
474 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext
475 +/* end confdefs.h. */
477 +/* Duplicate here the declarations to verify they match "elfread.c". */
478 +#include <rpm/rpmlib.h>
479 +#include <rpm/rpmts.h>
480 +#include <rpm/rpmdb.h>
481 +#include <rpm/header.h>
482 +extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
483 +extern int rpmReadConfigFiles(const char * file, const char * target);
484 +extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
485 +extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
486 +extern rpmts rpmtsCreate(void);
487 +extern rpmts rpmtsFree(rpmts ts);
488 +extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
489 + const void * keyp, size_t keylen);
499 +if ac_fn_c_try_compile "$LINENO"; then :
502 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
503 +$as_echo "yes" >&6; }
507 + LIBRPM_COMPAT=false
508 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
509 +$as_echo "no" >&6; }
512 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
513 + CFLAGS="$save_CFLAGS"
515 + if ! $LIBRPM_COMPAT; then
516 + HAVE_DLOPEN_LIBRPM=false
520 + if $HAVE_DLOPEN_LIBRPM; then
521 + DLOPEN_LIBRPM_STRING='"'"$DLOPEN_LIBRPM"'"'
523 +cat >>confdefs.h <<_ACEOF
524 +#define DLOPEN_LIBRPM $DLOPEN_LIBRPM_STRING
528 +$as_echo "#define HAVE_LIBRPM 1" >>confdefs.h
531 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
532 +$as_echo "no" >&6; }
534 + if $DLOPEN_REQUIRE; then
535 + as_fn_error "Specific name $LIBRPM was requested but it could not be opened." "$LINENO" 5
544 +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
545 + if test -n "$ac_tool_prefix"; then
546 + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
547 +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
548 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
549 +$as_echo_n "checking for $ac_word... " >&6; }
550 +if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
551 + $as_echo_n "(cached) " >&6
553 + case $PKG_CONFIG in
555 + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
558 + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
562 + test -z "$as_dir" && as_dir=.
563 + for ac_exec_ext in '' $ac_executable_extensions; do
564 + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
565 + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
566 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
576 +PKG_CONFIG=$ac_cv_path_PKG_CONFIG
577 +if test -n "$PKG_CONFIG"; then
578 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
579 +$as_echo "$PKG_CONFIG" >&6; }
581 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
582 +$as_echo "no" >&6; }
587 +if test -z "$ac_cv_path_PKG_CONFIG"; then
588 + ac_pt_PKG_CONFIG=$PKG_CONFIG
589 + # Extract the first word of "pkg-config", so it can be a program name with args.
590 +set dummy pkg-config; ac_word=$2
591 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
592 +$as_echo_n "checking for $ac_word... " >&6; }
593 +if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then :
594 + $as_echo_n "(cached) " >&6
596 + case $ac_pt_PKG_CONFIG in
598 + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
601 + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
605 + test -z "$as_dir" && as_dir=.
606 + for ac_exec_ext in '' $ac_executable_extensions; do
607 + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
608 + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
609 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
619 +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
620 +if test -n "$ac_pt_PKG_CONFIG"; then
621 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
622 +$as_echo "$ac_pt_PKG_CONFIG" >&6; }
624 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
625 +$as_echo "no" >&6; }
628 + if test "x$ac_pt_PKG_CONFIG" = x; then
631 + case $cross_compiling:$ac_tool_warned in
633 +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
634 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
635 +ac_tool_warned=yes ;;
637 + PKG_CONFIG=$ac_pt_PKG_CONFIG
640 + PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
644 +if test -n "$PKG_CONFIG"; then
645 + _pkg_min_version=0.9.0
646 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
647 +$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
648 + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
649 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
650 +$as_echo "yes" >&6; }
652 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
653 +$as_echo "no" >&6; }
659 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for RPM" >&5
660 +$as_echo_n "checking for RPM... " >&6; }
662 +if test -n "$RPM_CFLAGS"; then
663 + pkg_cv_RPM_CFLAGS="$RPM_CFLAGS"
664 + elif test -n "$PKG_CONFIG"; then
665 + if test -n "$PKG_CONFIG" && \
666 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"rpm\""; } >&5
667 + ($PKG_CONFIG --exists --print-errors "rpm") 2>&5
669 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
670 + test $ac_status = 0; }; then
671 + pkg_cv_RPM_CFLAGS=`$PKG_CONFIG --cflags "rpm" 2>/dev/null`
672 + test "x$?" != "x0" && pkg_failed=yes
679 +if test -n "$RPM_LIBS"; then
680 + pkg_cv_RPM_LIBS="$RPM_LIBS"
681 + elif test -n "$PKG_CONFIG"; then
682 + if test -n "$PKG_CONFIG" && \
683 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"rpm\""; } >&5
684 + ($PKG_CONFIG --exists --print-errors "rpm") 2>&5
686 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
687 + test $ac_status = 0; }; then
688 + pkg_cv_RPM_LIBS=`$PKG_CONFIG --libs "rpm" 2>/dev/null`
689 + test "x$?" != "x0" && pkg_failed=yes
699 +if test $pkg_failed = yes; then
700 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
701 +$as_echo "no" >&6; }
703 +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
704 + _pkg_short_errors_supported=yes
706 + _pkg_short_errors_supported=no
708 + if test $_pkg_short_errors_supported = yes; then
709 + RPM_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "rpm" 2>&1`
711 + RPM_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "rpm" 2>&1`
713 + # Put the nasty error message in config.log where it belongs
714 + echo "$RPM_PKG_ERRORS" >&5
717 +elif test $pkg_failed = untried; then
718 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
719 +$as_echo "no" >&6; }
722 + RPM_CFLAGS=$pkg_cv_RPM_CFLAGS
723 + RPM_LIBS=$pkg_cv_RPM_LIBS
724 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
725 +$as_echo "yes" >&6; }
729 + if $HAVE_LIBRPM; then
731 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking rpm library API compatibility" >&5
732 +$as_echo_n "checking rpm library API compatibility... " >&6; }
733 + # The compilation requires -Werror to verify anything.
734 + save_CFLAGS="$CFLAGS"
735 + CFLAGS="$CFLAGS -Werror"
736 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext
737 +/* end confdefs.h. */
739 +/* Duplicate here the declarations to verify they match "elfread.c". */
740 +#include <rpm/rpmlib.h>
741 +#include <rpm/rpmts.h>
742 +#include <rpm/rpmdb.h>
743 +#include <rpm/header.h>
744 +extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
745 +extern int rpmReadConfigFiles(const char * file, const char * target);
746 +extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
747 +extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
748 +extern rpmts rpmtsCreate(void);
749 +extern rpmts rpmtsFree(rpmts ts);
750 +extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
751 + const void * keyp, size_t keylen);
761 +if ac_fn_c_try_compile "$LINENO"; then :
764 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
765 +$as_echo "yes" >&6; }
769 + LIBRPM_COMPAT=false
770 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
771 +$as_echo "no" >&6; }
774 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
775 + CFLAGS="$save_CFLAGS"
777 + if ! $LIBRPM_COMPAT; then
779 + RPM_PKG_ERRORS="Found $LIBRPM API is incompatibile with this GDB"
783 + if $HAVE_LIBRPM; then
785 +$as_echo "#define HAVE_LIBRPM 1" >>confdefs.h
787 + CFLAGS="$CFLAGS $RPM_CFLAGS"
788 + LIBS="$LIBS $RPM_LIBS"
790 + if $RPM_REQUIRE; then
791 + as_fn_error "$RPM_PKG_ERRORS" "$LINENO" 5
793 + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $RPM_PKG_ERRORS" >&5
794 +$as_echo "$as_me: WARNING: $RPM_PKG_ERRORS" >&2;}
802 subdirs="$subdirs testsuite"
803 diff --git a/gdb/configure.ac b/gdb/configure.ac
804 --- a/gdb/configure.ac
805 +++ b/gdb/configure.ac
806 @@ -153,6 +153,199 @@ AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escape_dir,
807 [Directories safe to hold auto-loaded files.])
808 AC_MSG_RESULT([$with_auto_load_safe_path])
810 +# Integration with rpm library to support missing debuginfo suggestions.
811 +# --without-rpm: Disable any rpm support.
812 +# --with-rpm=libname.so: Try to dynamically open `libname.so' during runtime.
813 +# Even with runtime missing `libname.so' GDB will still other run correctly.
814 +# Missing `libname.so' during ./configure will abort the configuration.
815 +# --with-rpm=librpm.so: Like `--with-rpm=libname.so' but try to find specific
816 +# minor version first such as `librpm-4.6.so' as minor version differences
817 +# mean API+ABI incompatibility. If the specific match versioned library name
818 +# could not be found still open dynamically at least `librpm.so'.
819 +# --with-rpm: Like `--with-rpm=librpm.so' but if any of its detection fails try
820 +# to find librpm for compilation-time linking by pkg-config. GDB binary will
821 +# be probably linked with the version specific library (as `librpm-4.6.so').
822 +# Failure to find librpm by pkg-config will abort the configuration.
823 +# (default) --with-rpm=auto: Like `--with-rpm=librpm.so' but if even pkg-config
824 +# cannot find librpm use to the rpmless compilation (like `--without-rpm').
827 + [AS_HELP_STRING([--with-rpm],
828 + [query rpm database for missing debuginfos (yes/no, def. auto=librpm.so)])], [], [with_rpm="auto"])
830 +m4_pattern_allow([^AC_MSG_ERROR$])
831 +m4_pattern_allow([^AC_MSG_WARN$])
832 +if test "x$with_rpm" != "xno"; then
833 + if test "x$with_rpm" = "xyes"; then
836 + DLOPEN_REQUIRE=false
837 + elif test "x$with_rpm" = "xauto"; then
840 + DLOPEN_REQUIRE=false
844 + DLOPEN_REQUIRE=true
846 + LIBRPM_STRING='"'"$LIBRPM"'"'
848 + AC_MSG_CHECKING([specific librpm version])
849 + HAVE_DLOPEN_LIBRPM=false
852 + AC_RUN_IFELSE(AC_LANG_PROGRAM([[
853 +#include <rpm/rpmlib.h>
858 + const char *const *rpmverp;
861 + f = fopen ("conftest.out", "w");
864 + fprintf (stderr, "Cannot write \"%s\": %s\n", "conftest.out",
868 + h = dlopen ($LIBRPM_STRING, RTLD_LAZY);
871 + fprintf (stderr, "dlopen (\"%s\"): %s\n", $LIBRPM_STRING, dlerror ());
874 + rpmverp = dlsym (h, "RPMVERSION");
877 + fprintf (stderr, "dlsym (\"RPMVERSION\"): %s\n", dlerror ());
880 + fprintf (stderr, "RPMVERSION is: \"");
881 + fprintf (stderr, "%s\"\n", *rpmverp);
883 + /* Try to find the specific librpm version only for "librpm.so" as we do
884 + not know how to assemble the version string otherwise. */
886 + if (strcmp ("librpm.so", $LIBRPM_STRING) != 0)
888 + fprintf (f, "%s\n", $LIBRPM_STRING);
897 + if (sscanf (*rpmverp, "%d.%d", &major, &minor) != 2)
899 + fprintf (stderr, "Unable to parse RPMVERSION.\n");
900 + fprintf (f, "%s\n", $LIBRPM_STRING);
903 + /* Avoid the square brackets by malloc. */
904 + h2_name = malloc (64);
905 + sprintf (h2_name, "librpm-%d.%d.so", major, minor);
906 + h2 = dlopen (h2_name, RTLD_LAZY);
909 + fprintf (stderr, "dlopen (\"%s\"): %s\n", h2_name, dlerror ());
910 + fprintf (f, "%s\n", $LIBRPM_STRING);
915 + fprintf (stderr, "dlopen of \"%s\" and \"%s\" are different.\n",
916 + $LIBRPM_STRING, h2_name);
917 + fprintf (f, "%s\n", $LIBRPM_STRING);
920 + /* Found the valid .so name with a specific version. */
921 + fprintf (f, "%s\n", h2_name);
925 + DLOPEN_LIBRPM="`cat conftest.out`"
926 + if test "x$DLOPEN_LIBRPM" != "x"; then
927 + HAVE_DLOPEN_LIBRPM=true
928 + AC_MSG_RESULT($DLOPEN_LIBRPM)
933 + m4_define([CHECK_LIBRPM_COMPAT], [
934 + AC_MSG_CHECKING([rpm library API compatibility])
935 + # The compilation requires -Werror to verify anything.
936 + save_CFLAGS="$CFLAGS"
937 + CFLAGS="$CFLAGS -Werror"
938 + AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[
939 +/* Duplicate here the declarations to verify they match "elfread.c". */
940 +#include <rpm/rpmlib.h>
941 +#include <rpm/rpmts.h>
942 +#include <rpm/rpmdb.h>
943 +#include <rpm/header.h>
944 +extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
945 +extern int rpmReadConfigFiles(const char * file, const char * target);
946 +extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
947 +extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
948 +extern rpmts rpmtsCreate(void);
949 +extern rpmts rpmtsFree(rpmts ts);
950 +extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
951 + const void * keyp, size_t keylen);
956 + LIBRPM_COMPAT=false
959 + CFLAGS="$save_CFLAGS"
962 + if $HAVE_DLOPEN_LIBRPM; then
963 + CHECK_LIBRPM_COMPAT
964 + if ! $LIBRPM_COMPAT; then
965 + HAVE_DLOPEN_LIBRPM=false
969 + if $HAVE_DLOPEN_LIBRPM; then
970 + DLOPEN_LIBRPM_STRING='"'"$DLOPEN_LIBRPM"'"'
971 + AC_DEFINE_UNQUOTED(DLOPEN_LIBRPM, $DLOPEN_LIBRPM_STRING, [librpm version specific library name to dlopen.])
972 + AC_DEFINE(HAVE_LIBRPM, 1, [Define if librpm library is being used.])
976 + if $DLOPEN_REQUIRE; then
977 + AC_MSG_ERROR([Specific name $LIBRPM was requested but it could not be opened.])
979 + PKG_CHECK_MODULES(RPM, rpm, [HAVE_LIBRPM=true], [HAVE_LIBRPM=false])
981 + if $HAVE_LIBRPM; then
982 + CHECK_LIBRPM_COMPAT
983 + if ! $LIBRPM_COMPAT; then
985 + RPM_PKG_ERRORS="Found $LIBRPM API is incompatibile with this GDB"
989 + if $HAVE_LIBRPM; then
990 + AC_DEFINE(HAVE_LIBRPM, 1, [Define if librpm library is being used.])
991 + CFLAGS="$CFLAGS $RPM_CFLAGS"
992 + LIBS="$LIBS $RPM_LIBS"
994 + if $RPM_REQUIRE; then
995 + AC_MSG_ERROR($RPM_PKG_ERRORS)
997 + AC_MSG_WARN($RPM_PKG_ERRORS)
1003 AC_CONFIG_SUBDIRS(testsuite)
1005 # Check whether to support alternative target configurations
1006 diff --git a/gdb/event-top.c b/gdb/event-top.c
1007 --- a/gdb/event-top.c
1008 +++ b/gdb/event-top.c
1010 #include "gdbsupport/gdb-sigmask.h"
1011 #include "async-event.h"
1012 #include "bt-utils.h"
1013 +#include "symfile.h"
1015 /* readline include files. */
1016 #include "readline/readline.h"
1017 @@ -374,6 +375,8 @@ display_gdb_prompt (const char *new_prompt)
1018 /* Reset the nesting depth used when trace-commands is set. */
1019 reset_command_nest_depth ();
1021 + debug_flush_missing ();
1023 /* Do not call the python hook on an explicit prompt change as
1024 passed to this function, as this forms a secondary/local prompt,
1025 IE, displayed but not set. */
1026 @@ -800,7 +803,10 @@ command_line_handler (gdb::unique_xmalloc_ptr<char> &&rl)
1027 command_handler (cmd);
1029 if (ui->prompt_state != PROMPTED)
1030 - display_gdb_prompt (0);
1032 + debug_flush_missing ();
1033 + display_gdb_prompt (0);
1038 diff --git a/gdb/symfile.h b/gdb/symfile.h
1041 @@ -342,6 +342,7 @@ extern void generic_load (const char *args, int from_tty);
1042 /* build-id support. */
1043 extern struct bfd_build_id *build_id_addr_get (CORE_ADDR addr);
1044 extern void debug_print_missing (const char *binary, const char *debug);
1045 +extern void debug_flush_missing (void);
1046 #define BUILD_ID_MAIN_EXECUTABLE_FILENAME _("the main executable file")
1048 /* From minidebug.c. */