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