1 Index: gdb-7.7.50.20140609/gdb/event-top.c
2 ===================================================================
3 --- gdb-7.7.50.20140609.orig/gdb/event-top.c 2014-06-13 20:10:19.632787642 +0200
4 +++ gdb-7.7.50.20140609/gdb/event-top.c 2014-06-13 20:11:49.605878557 +0200
6 #include "gdbcmd.h" /* for dont_repeat() */
11 /* readline include files. */
12 #include "readline/readline.h"
13 @@ -176,6 +177,8 @@ rl_callback_read_char_wrapper (gdb_clien
15 cli_command_loop (void *data)
17 + debug_flush_missing ();
19 display_gdb_prompt (0);
21 /* Now it's time to start the event loop. */
22 @@ -243,6 +246,8 @@ display_gdb_prompt (char *new_prompt)
23 /* Reset the nesting depth used when trace-commands is set. */
24 reset_command_nest_depth ();
26 + debug_flush_missing ();
28 old_chain = make_cleanup (free_current_contents, &actual_gdb_prompt);
30 /* Do not call the python hook on an explicit prompt change as
31 Index: gdb-7.7.50.20140609/gdb/symfile.h
32 ===================================================================
33 --- gdb-7.7.50.20140609.orig/gdb/symfile.h 2014-06-13 20:10:19.633787643 +0200
34 +++ gdb-7.7.50.20140609/gdb/symfile.h 2014-06-13 20:10:31.066799158 +0200
35 @@ -573,6 +573,8 @@ void map_symbol_filenames (symbol_filena
36 /* build-id support. */
37 extern struct elf_build_id *build_id_addr_get (CORE_ADDR addr);
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")
42 /* From dwarf2read.c */
44 Index: gdb-7.7.50.20140609/gdb/testsuite/lib/gdb.exp
45 ===================================================================
46 --- gdb-7.7.50.20140609.orig/gdb/testsuite/lib/gdb.exp 2014-06-13 20:10:19.634787644 +0200
47 +++ gdb-7.7.50.20140609/gdb/testsuite/lib/gdb.exp 2014-06-13 20:10:31.067799159 +0200
48 @@ -1492,7 +1492,7 @@ proc default_gdb_start { } {
49 warning "Couldn't set the width to 0."
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"
57 Index: gdb-7.7.50.20140609/gdb/testsuite/lib/mi-support.exp
58 ===================================================================
59 --- gdb-7.7.50.20140609.orig/gdb/testsuite/lib/mi-support.exp 2014-06-13 20:10:19.635787645 +0200
60 +++ gdb-7.7.50.20140609/gdb/testsuite/lib/mi-support.exp 2014-06-13 20:10:31.068799160 +0200
61 @@ -212,7 +212,7 @@ proc default_mi_gdb_start { args } {
62 warning "Couldn't set the width to 0."
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"
69 -re ".*190-gdb-set build-id-verbose 0\r\n190\\\^done\r\n$mi_gdb_prompt$" {
70 Index: gdb-7.7.50.20140609/gdb/tui/tui-interp.c
71 ===================================================================
72 --- gdb-7.7.50.20140609.orig/gdb/tui/tui-interp.c 2014-06-13 20:10:31.068799160 +0200
73 +++ gdb-7.7.50.20140609/gdb/tui/tui-interp.c 2014-06-13 20:10:47.806816542 +0200
75 #include "exceptions.h"
80 static struct ui_out *tui_ui_out (struct interp *self);
82 Index: gdb-7.7.50.20140609/gdb/aclocal.m4
83 ===================================================================
84 --- gdb-7.7.50.20140609.orig/gdb/aclocal.m4 2014-06-13 20:10:19.636787646 +0200
85 +++ gdb-7.7.50.20140609/gdb/aclocal.m4 2014-06-13 20:10:31.069799161 +0200
87 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
90 +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
91 +# serial 1 (pkg-config-0.24)
93 +# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
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.
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.
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.
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.
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])
124 +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
125 + AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
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])
133 + AC_MSG_RESULT([no])
137 +])# PKG_PROG_PKG_CONFIG
139 +# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
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.
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
158 +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
159 +# ---------------------------------------------
160 +m4_define([_PKG_CONFIG],
161 +[if test -n "$$1"; then
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 ],
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
180 + _pkg_short_errors_supported=no
182 +])# _PKG_SHORT_ERRORS_SUPPORTED
185 +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
186 +# [ACTION-IF-NOT-FOUND])
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
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
201 +AC_MSG_CHECKING([for $1])
203 +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
204 +_PKG_CONFIG([$1][_LIBS], [libs], [$2])
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.])
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`
216 + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
218 + # Put the nasty error message in config.log where it belongs
219 + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
221 + m4_default([$4], [AC_MSG_ERROR(
222 +[Package requirements ($2) were not met:
226 +Consider adjusting the PKG_CONFIG_PATH environment variable if you
227 +installed software in a non-standard prefix.
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
240 +To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
243 + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
244 + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
245 + AC_MSG_RESULT([yes])
248 +])# PKG_CHECK_MODULES
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
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
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
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
299 +_PKG_CONFIG([$1], [variable="][$3]["], [$2])
300 +AS_VAR_COPY([$1], [pkg_cv_][$1])
302 +AS_VAR_IF([$1], [""], [$5], [$4])dnl
305 # AM_AUX_DIR_EXPAND -*- Autoconf -*-
307 # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
308 Index: gdb-7.7.50.20140609/gdb/config.in
309 ===================================================================
310 --- gdb-7.7.50.20140609.orig/gdb/config.in 2014-06-13 20:10:19.637787647 +0200
311 +++ gdb-7.7.50.20140609/gdb/config.in 2014-06-13 20:10:31.069799161 +0200
313 /* Define to BFD's default target vector. */
314 #undef DEFAULT_BFD_VEC
316 +/* librpm version specific library name to dlopen. */
317 +#undef DLOPEN_LIBRPM
319 /* Define to 1 if translation of program messages to the user's native
320 language is requested. */
323 /* Define if Python 2.7 is being used. */
324 #undef HAVE_LIBPYTHON2_7
326 +/* Define if librpm library is being used. */
329 /* Define to 1 if you have the <libunwind-ia64.h> header file. */
330 #undef HAVE_LIBUNWIND_IA64_H
332 Index: gdb-7.7.50.20140609/gdb/configure
333 ===================================================================
334 --- gdb-7.7.50.20140609.orig/gdb/configure 2014-06-13 20:10:19.642787652 +0200
335 +++ gdb-7.7.50.20140609/gdb/configure 2014-06-13 20:10:31.073799165 +0200
336 @@ -692,6 +692,11 @@ PKGVERSION
337 HAVE_NATIVE_GCORE_TARGET
348 @@ -795,6 +800,7 @@ with_gdb_datadir
349 with_relocated_sources
351 with_auto_load_safe_path
356 @@ -846,6 +852,11 @@ CPPFLAGS
368 @@ -1516,6 +1527,8 @@ Optional Packages:
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
377 @@ -1565,6 +1578,13 @@ Some influential environment variables:
378 MAKEINFO Parent configure detects if it is of sufficient version.
380 Parameters for MAKEINFO.
381 + PKG_CONFIG path to pkg-config utility
383 + directories to add to pkg-config's search path
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.
391 @@ -5160,6 +5180,491 @@ _ACEOF
392 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_auto_load_safe_path" >&5
393 $as_echo "$with_auto_load_safe_path" >&6; }
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').
412 +# Check whether --with-rpm was given.
413 +if test "${with_rpm+set}" = set; then :
422 +if test "x$with_rpm" != "xno"; then
423 + if test "x$with_rpm" = "xyes"; then
426 + DLOPEN_REQUIRE=false
427 + elif test "x$with_rpm" = "xauto"; then
430 + DLOPEN_REQUIRE=false
434 + DLOPEN_REQUIRE=true
436 + LIBRPM_STRING='"'"$LIBRPM"'"'
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
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; }
449 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext
450 +/* end confdefs.h. */
452 +#include <rpm/rpmlib.h>
461 + const char *const *rpmverp;
464 + f = fopen ("conftest.out", "w");
467 + fprintf (stderr, "Cannot write \"%s\": %s\n", "conftest.out",
471 + h = dlopen ($LIBRPM_STRING, RTLD_LAZY);
474 + fprintf (stderr, "dlopen (\"%s\"): %s\n", $LIBRPM_STRING, dlerror ());
477 + rpmverp = dlsym (h, "RPMVERSION");
480 + fprintf (stderr, "dlsym (\"RPMVERSION\"): %s\n", dlerror ());
483 + fprintf (stderr, "RPMVERSION is: \"");
484 + fprintf (stderr, "%s\"\n", *rpmverp);
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. */
489 + if (strcmp ("librpm.so", $LIBRPM_STRING) != 0)
491 + fprintf (f, "%s\n", $LIBRPM_STRING);
500 + if (sscanf (*rpmverp, "%d.%d", &major, &minor) != 2)
502 + fprintf (stderr, "Unable to parse RPMVERSION.\n");
503 + fprintf (f, "%s\n", $LIBRPM_STRING);
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);
512 + fprintf (stderr, "dlopen (\"%s\"): %s\n", h2_name, dlerror ());
513 + fprintf (f, "%s\n", $LIBRPM_STRING);
518 + fprintf (stderr, "dlopen of \"%s\" and \"%s\" are different.\n",
519 + $LIBRPM_STRING, h2_name);
520 + fprintf (f, "%s\n", $LIBRPM_STRING);
523 + /* Found the valid .so name with a specific version. */
524 + fprintf (f, "%s\n", h2_name);
532 +if ac_fn_c_try_run "$LINENO"; then :
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; }
542 +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
543 + conftest.$ac_objext conftest.beam conftest.$ac_ext
550 + if $HAVE_DLOPEN_LIBRPM; then
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. */
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);
582 +if ac_fn_c_try_compile "$LINENO"; then :
585 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
586 +$as_echo "yes" >&6; }
590 + LIBRPM_COMPAT=false
591 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
592 +$as_echo "no" >&6; }
595 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
596 + CFLAGS="$save_CFLAGS"
598 + if ! $LIBRPM_COMPAT; then
599 + HAVE_DLOPEN_LIBRPM=false
603 + if $HAVE_DLOPEN_LIBRPM; then
604 + DLOPEN_LIBRPM_STRING='"'"$DLOPEN_LIBRPM"'"'
606 +cat >>confdefs.h <<_ACEOF
607 +#define DLOPEN_LIBRPM $DLOPEN_LIBRPM_STRING
611 +$as_echo "#define HAVE_LIBRPM 1" >>confdefs.h
614 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
615 +$as_echo "no" >&6; }
617 + if $DLOPEN_REQUIRE; then
618 + as_fn_error "Specific name $LIBRPM was requested but it could not be opened." "$LINENO" 5
626 +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
627 + if test -n "$ac_tool_prefix"; then
628 + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
629 +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
630 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
631 +$as_echo_n "checking for $ac_word... " >&6; }
632 +if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
633 + $as_echo_n "(cached) " >&6
635 + case $PKG_CONFIG in
637 + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
640 + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
644 + test -z "$as_dir" && as_dir=.
645 + for ac_exec_ext in '' $ac_executable_extensions; do
646 + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
647 + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
648 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
658 +PKG_CONFIG=$ac_cv_path_PKG_CONFIG
659 +if test -n "$PKG_CONFIG"; then
660 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
661 +$as_echo "$PKG_CONFIG" >&6; }
663 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
664 +$as_echo "no" >&6; }
669 +if test -z "$ac_cv_path_PKG_CONFIG"; then
670 + ac_pt_PKG_CONFIG=$PKG_CONFIG
671 + # Extract the first word of "pkg-config", so it can be a program name with args.
672 +set dummy pkg-config; ac_word=$2
673 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
674 +$as_echo_n "checking for $ac_word... " >&6; }
675 +if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then :
676 + $as_echo_n "(cached) " >&6
678 + case $ac_pt_PKG_CONFIG in
680 + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
683 + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
687 + test -z "$as_dir" && as_dir=.
688 + for ac_exec_ext in '' $ac_executable_extensions; do
689 + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
690 + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
691 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
701 +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
702 +if test -n "$ac_pt_PKG_CONFIG"; then
703 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
704 +$as_echo "$ac_pt_PKG_CONFIG" >&6; }
706 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
707 +$as_echo "no" >&6; }
710 + if test "x$ac_pt_PKG_CONFIG" = x; then
713 + case $cross_compiling:$ac_tool_warned in
715 +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
716 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
717 +ac_tool_warned=yes ;;
719 + PKG_CONFIG=$ac_pt_PKG_CONFIG
722 + PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
726 +if test -n "$PKG_CONFIG"; then
727 + _pkg_min_version=0.9.0
728 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
729 +$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
730 + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
731 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
732 +$as_echo "yes" >&6; }
734 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
735 +$as_echo "no" >&6; }
741 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for RPM" >&5
742 +$as_echo_n "checking for RPM... " >&6; }
744 +if test -n "$RPM_CFLAGS"; then
745 + pkg_cv_RPM_CFLAGS="$RPM_CFLAGS"
746 + elif test -n "$PKG_CONFIG"; then
747 + if test -n "$PKG_CONFIG" && \
748 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"rpm\""; } >&5
749 + ($PKG_CONFIG --exists --print-errors "rpm") 2>&5
751 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
752 + test $ac_status = 0; }; then
753 + pkg_cv_RPM_CFLAGS=`$PKG_CONFIG --cflags "rpm" 2>/dev/null`
760 +if test -n "$RPM_LIBS"; then
761 + pkg_cv_RPM_LIBS="$RPM_LIBS"
762 + elif test -n "$PKG_CONFIG"; then
763 + if test -n "$PKG_CONFIG" && \
764 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"rpm\""; } >&5
765 + ($PKG_CONFIG --exists --print-errors "rpm") 2>&5
767 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
768 + test $ac_status = 0; }; then
769 + pkg_cv_RPM_LIBS=`$PKG_CONFIG --libs "rpm" 2>/dev/null`
779 +if test $pkg_failed = yes; then
780 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
781 +$as_echo "no" >&6; }
783 +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
784 + _pkg_short_errors_supported=yes
786 + _pkg_short_errors_supported=no
788 + if test $_pkg_short_errors_supported = yes; then
789 + RPM_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "rpm" 2>&1`
791 + RPM_PKG_ERRORS=`$PKG_CONFIG --print-errors "rpm" 2>&1`
793 + # Put the nasty error message in config.log where it belongs
794 + echo "$RPM_PKG_ERRORS" >&5
797 +elif test $pkg_failed = untried; then
798 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
799 +$as_echo "no" >&6; }
802 + RPM_CFLAGS=$pkg_cv_RPM_CFLAGS
803 + RPM_LIBS=$pkg_cv_RPM_LIBS
804 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
805 +$as_echo "yes" >&6; }
809 + if $HAVE_LIBRPM; then
811 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking rpm library API compatibility" >&5
812 +$as_echo_n "checking rpm library API compatibility... " >&6; }
813 + # The compilation requires -Werror to verify anything.
814 + save_CFLAGS="$CFLAGS"
815 + CFLAGS="$CFLAGS -Werror"
816 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext
817 +/* end confdefs.h. */
819 +/* Duplicate here the declarations to verify they match "elfread.c". */
820 +#include <rpm/rpmlib.h>
821 +#include <rpm/rpmts.h>
822 +#include <rpm/rpmdb.h>
823 +#include <rpm/header.h>
824 +extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
825 +extern int rpmReadConfigFiles(const char * file, const char * target);
826 +extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
827 +extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
828 +extern rpmts rpmtsCreate(void);
829 +extern rpmts rpmtsFree(rpmts ts);
830 +extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
831 + const void * keyp, size_t keylen);
841 +if ac_fn_c_try_compile "$LINENO"; then :
844 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
845 +$as_echo "yes" >&6; }
849 + LIBRPM_COMPAT=false
850 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
851 +$as_echo "no" >&6; }
854 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
855 + CFLAGS="$save_CFLAGS"
857 + if ! $LIBRPM_COMPAT; then
859 + RPM_PKG_ERRORS="Found $LIBRPM API is incompatibile with this GDB"
863 + if $HAVE_LIBRPM; then
865 +$as_echo "#define HAVE_LIBRPM 1" >>confdefs.h
867 + CFLAGS="$CFLAGS $RPM_CFLAGS"
868 + LIBS="$LIBS $RPM_LIBS"
870 + if $RPM_REQUIRE; then
871 + as_fn_error "$RPM_PKG_ERRORS" "$LINENO" 5
873 + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $RPM_PKG_ERRORS" >&5
874 +$as_echo "$as_me: WARNING: $RPM_PKG_ERRORS" >&2;}
882 subdirs="$subdirs testsuite"
883 Index: gdb-7.7.50.20140609/gdb/configure.ac
884 ===================================================================
885 --- gdb-7.7.50.20140609.orig/gdb/configure.ac 2014-06-13 20:10:19.643787653 +0200
886 +++ gdb-7.7.50.20140609/gdb/configure.ac 2014-06-13 20:10:31.074799166 +0200
887 @@ -165,6 +165,199 @@ AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escap
888 [Directories safe to hold auto-loaded files.])
889 AC_MSG_RESULT([$with_auto_load_safe_path])
891 +# Integration with rpm library to support missing debuginfo suggestions.
892 +# --without-rpm: Disable any rpm support.
893 +# --with-rpm=libname.so: Try to dynamically open `libname.so' during runtime.
894 +# Even with runtime missing `libname.so' GDB will still other run correctly.
895 +# Missing `libname.so' during ./configure will abort the configuration.
896 +# --with-rpm=librpm.so: Like `--with-rpm=libname.so' but try to find specific
897 +# minor version first such as `librpm-4.6.so' as minor version differences
898 +# mean API+ABI incompatibility. If the specific match versioned library name
899 +# could not be found still open dynamically at least `librpm.so'.
900 +# --with-rpm: Like `--with-rpm=librpm.so' but if any of its detection fails try
901 +# to find librpm for compilation-time linking by pkg-config. GDB binary will
902 +# be probably linked with the version specific library (as `librpm-4.6.so').
903 +# Failure to find librpm by pkg-config will abort the configuration.
904 +# (default) --with-rpm=auto: Like `--with-rpm=librpm.so' but if even pkg-config
905 +# cannot find librpm use to the rpmless compilation (like `--without-rpm').
908 + [AS_HELP_STRING([--with-rpm],
909 + [query rpm database for missing debuginfos (yes/no, def. auto=librpm.so)])], [], [with_rpm="auto"])
911 +m4_pattern_allow([^AC_MSG_ERROR$])
912 +m4_pattern_allow([^AC_MSG_WARN$])
913 +if test "x$with_rpm" != "xno"; then
914 + if test "x$with_rpm" = "xyes"; then
917 + DLOPEN_REQUIRE=false
918 + elif test "x$with_rpm" = "xauto"; then
921 + DLOPEN_REQUIRE=false
925 + DLOPEN_REQUIRE=true
927 + LIBRPM_STRING='"'"$LIBRPM"'"'
929 + AC_MSG_CHECKING([specific librpm version])
930 + HAVE_DLOPEN_LIBRPM=false
933 + AC_RUN_IFELSE(AC_LANG_PROGRAM([[
934 +#include <rpm/rpmlib.h>
939 + const char *const *rpmverp;
942 + f = fopen ("conftest.out", "w");
945 + fprintf (stderr, "Cannot write \"%s\": %s\n", "conftest.out",
949 + h = dlopen ($LIBRPM_STRING, RTLD_LAZY);
952 + fprintf (stderr, "dlopen (\"%s\"): %s\n", $LIBRPM_STRING, dlerror ());
955 + rpmverp = dlsym (h, "RPMVERSION");
958 + fprintf (stderr, "dlsym (\"RPMVERSION\"): %s\n", dlerror ());
961 + fprintf (stderr, "RPMVERSION is: \"");
962 + fprintf (stderr, "%s\"\n", *rpmverp);
964 + /* Try to find the specific librpm version only for "librpm.so" as we do
965 + not know how to assemble the version string otherwise. */
967 + if (strcmp ("librpm.so", $LIBRPM_STRING) != 0)
969 + fprintf (f, "%s\n", $LIBRPM_STRING);
978 + if (sscanf (*rpmverp, "%d.%d", &major, &minor) != 2)
980 + fprintf (stderr, "Unable to parse RPMVERSION.\n");
981 + fprintf (f, "%s\n", $LIBRPM_STRING);
984 + /* Avoid the square brackets by malloc. */
985 + h2_name = malloc (64);
986 + sprintf (h2_name, "librpm-%d.%d.so", major, minor);
987 + h2 = dlopen (h2_name, RTLD_LAZY);
990 + fprintf (stderr, "dlopen (\"%s\"): %s\n", h2_name, dlerror ());
991 + fprintf (f, "%s\n", $LIBRPM_STRING);
996 + fprintf (stderr, "dlopen of \"%s\" and \"%s\" are different.\n",
997 + $LIBRPM_STRING, h2_name);
998 + fprintf (f, "%s\n", $LIBRPM_STRING);
1001 + /* Found the valid .so name with a specific version. */
1002 + fprintf (f, "%s\n", h2_name);
1006 + DLOPEN_LIBRPM="`cat conftest.out`"
1007 + if test "x$DLOPEN_LIBRPM" != "x"; then
1008 + HAVE_DLOPEN_LIBRPM=true
1009 + AC_MSG_RESULT($DLOPEN_LIBRPM)
1012 + rm -f conftest.out
1014 + m4_define([CHECK_LIBRPM_COMPAT], [
1015 + AC_MSG_CHECKING([rpm library API compatibility])
1016 + # The compilation requires -Werror to verify anything.
1017 + save_CFLAGS="$CFLAGS"
1018 + CFLAGS="$CFLAGS -Werror"
1019 + AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[
1020 +/* Duplicate here the declarations to verify they match "elfread.c". */
1021 +#include <rpm/rpmlib.h>
1022 +#include <rpm/rpmts.h>
1023 +#include <rpm/rpmdb.h>
1024 +#include <rpm/header.h>
1025 +extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
1026 +extern int rpmReadConfigFiles(const char * file, const char * target);
1027 +extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
1028 +extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
1029 +extern rpmts rpmtsCreate(void);
1030 +extern rpmts rpmtsFree(rpmts ts);
1031 +extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
1032 + const void * keyp, size_t keylen);
1034 + LIBRPM_COMPAT=true
1035 + AC_MSG_RESULT(yes)
1037 + LIBRPM_COMPAT=false
1040 + CFLAGS="$save_CFLAGS"
1043 + if $HAVE_DLOPEN_LIBRPM; then
1044 + CHECK_LIBRPM_COMPAT
1045 + if ! $LIBRPM_COMPAT; then
1046 + HAVE_DLOPEN_LIBRPM=false
1050 + if $HAVE_DLOPEN_LIBRPM; then
1051 + DLOPEN_LIBRPM_STRING='"'"$DLOPEN_LIBRPM"'"'
1052 + AC_DEFINE_UNQUOTED(DLOPEN_LIBRPM, $DLOPEN_LIBRPM_STRING, [librpm version specific library name to dlopen.])
1053 + AC_DEFINE(HAVE_LIBRPM, 1, [Define if librpm library is being used.])
1057 + if $DLOPEN_REQUIRE; then
1058 + AC_MSG_ERROR([Specific name $LIBRPM was requested but it could not be opened.])
1060 + PKG_CHECK_MODULES(RPM, rpm, [HAVE_LIBRPM=true], [HAVE_LIBRPM=false])
1062 + if $HAVE_LIBRPM; then
1063 + CHECK_LIBRPM_COMPAT
1064 + if ! $LIBRPM_COMPAT; then
1066 + RPM_PKG_ERRORS="Found $LIBRPM API is incompatibile with this GDB"
1070 + if $HAVE_LIBRPM; then
1071 + AC_DEFINE(HAVE_LIBRPM, 1, [Define if librpm library is being used.])
1072 + CFLAGS="$CFLAGS $RPM_CFLAGS"
1073 + LIBS="$LIBS $RPM_LIBS"
1075 + if $RPM_REQUIRE; then
1076 + AC_MSG_ERROR($RPM_PKG_ERRORS)
1078 + AC_MSG_WARN($RPM_PKG_ERRORS)
1084 AC_CONFIG_SUBDIRS(testsuite)
1086 # Check whether to support alternative target configurations
1087 Index: gdb-7.7.50.20140609/gdb/corelow.c
1088 ===================================================================
1089 --- gdb-7.7.50.20140609.orig/gdb/corelow.c 2014-06-13 20:10:19.644787654 +0200
1090 +++ gdb-7.7.50.20140609/gdb/corelow.c 2014-06-13 20:10:31.074799166 +0200
1091 @@ -316,7 +316,7 @@ build_id_locate_exec (int from_tty)
1092 symfile_objfile->flags |= OBJF_BUILD_ID_CORE_LOADED;
1095 - debug_print_missing (_("the main executable file"), build_id_filename);
1096 + debug_print_missing (BUILD_ID_MAIN_EXECUTABLE_FILENAME, build_id_filename);
1098 do_cleanups (back_to);
1100 Index: gdb-7.7.50.20140609/gdb/build-id.c
1101 ===================================================================
1102 --- gdb-7.7.50.20140609.orig/gdb/build-id.c 2014-06-13 20:10:19.644787654 +0200
1103 +++ gdb-7.7.50.20140609/gdb/build-id.c 2014-06-13 20:10:31.075799167 +0200
1106 #include "observer.h"
1107 #include <sys/stat.h>
1108 +#include "elf/external.h"
1110 #define BUILD_ID_VERBOSE_NONE 0
1111 #define BUILD_ID_VERBOSE_FILENAMES 1
1112 @@ -666,8 +667,360 @@ build_id_to_filename (const struct elf_b
1118 +#include <rpm/rpmlib.h>
1119 +#include <rpm/rpmts.h>
1120 +#include <rpm/rpmdb.h>
1121 +#include <rpm/header.h>
1122 +#ifdef DLOPEN_LIBRPM
1126 +/* This MISSING_RPM_HASH tracker is used to collect all the missing rpm files
1127 + and avoid their duplicities during a single inferior run. */
1129 +static struct htab *missing_rpm_hash;
1131 +/* This MISSING_RPM_LIST tracker is used to collect and print as a single line
1132 + all the rpms right before the nearest GDB prompt. It gets cleared after
1133 + each such print (it is questionable if we should clear it after the print).
1138 + struct missing_rpm *next;
1141 +static struct missing_rpm *missing_rpm_list;
1142 +static int missing_rpm_list_entries;
1144 +/* Returns the count of newly added rpms. */
1147 +missing_rpm_enlist (const char *filename)
1149 + static int rpm_init_done = 0;
1151 + rpmdbMatchIterator mi;
1154 +#ifdef DLOPEN_LIBRPM
1155 + /* Duplicate here the declarations to verify they match. The same sanity
1156 + check is present also in `configure.ac'. */
1157 + extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
1158 + static char *(*headerFormat_p) (Header h, const char * fmt, errmsg_t *errmsg);
1159 + extern int rpmReadConfigFiles(const char * file, const char * target);
1160 + static int (*rpmReadConfigFiles_p) (const char * file, const char * target);
1161 + extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
1162 + static rpmdbMatchIterator (*rpmdbFreeIterator_p) (rpmdbMatchIterator mi);
1163 + extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
1164 + static Header (*rpmdbNextIterator_p) (rpmdbMatchIterator mi);
1165 + extern rpmts rpmtsCreate(void);
1166 + static rpmts (*rpmtsCreate_p) (void);
1167 + extern rpmts rpmtsFree(rpmts ts);
1168 + static rpmts (*rpmtsFree_p) (rpmts ts);
1169 + extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
1170 + const void * keyp, size_t keylen);
1171 + static rpmdbMatchIterator (*rpmtsInitIterator_p) (const rpmts ts,
1175 +#else /* !DLOPEN_LIBRPM */
1176 +# define headerFormat_p headerFormat
1177 +# define rpmReadConfigFiles_p rpmReadConfigFiles
1178 +# define rpmdbFreeIterator_p rpmdbFreeIterator
1179 +# define rpmdbNextIterator_p rpmdbNextIterator
1180 +# define rpmtsCreate_p rpmtsCreate
1181 +# define rpmtsFree_p rpmtsFree
1182 +# define rpmtsInitIterator_p rpmtsInitIterator
1183 +#endif /* !DLOPEN_LIBRPM */
1185 + gdb_assert (filename != NULL);
1187 + if (strcmp (filename, BUILD_ID_MAIN_EXECUTABLE_FILENAME) == 0)
1190 + if (filename[0] != '/')
1192 + warning (_("Ignoring non-absolute filename: <%s>"), filename);
1196 + if (!rpm_init_done)
1198 + static int init_tried;
1200 + /* Already failed the initialization before? */
1205 +#ifdef DLOPEN_LIBRPM
1209 + h = dlopen (DLOPEN_LIBRPM, RTLD_LAZY);
1212 + warning (_("Unable to open \"%s\" (%s), "
1213 + "missing debuginfos notifications will not be displayed"),
1214 + DLOPEN_LIBRPM, dlerror ());
1218 + if (!((headerFormat_p = dlsym (h, "headerFormat"))
1219 + && (rpmReadConfigFiles_p = dlsym (h, "rpmReadConfigFiles"))
1220 + && (rpmdbFreeIterator_p = dlsym (h, "rpmdbFreeIterator"))
1221 + && (rpmdbNextIterator_p = dlsym (h, "rpmdbNextIterator"))
1222 + && (rpmtsCreate_p = dlsym (h, "rpmtsCreate"))
1223 + && (rpmtsFree_p = dlsym (h, "rpmtsFree"))
1224 + && (rpmtsInitIterator_p = dlsym (h, "rpmtsInitIterator"))))
1226 + warning (_("Opened library \"%s\" is incompatible (%s), "
1227 + "missing debuginfos notifications will not be displayed"),
1228 + DLOPEN_LIBRPM, dlerror ());
1230 + warning (_("Error closing library \"%s\": %s\n"), DLOPEN_LIBRPM,
1235 +#endif /* DLOPEN_LIBRPM */
1237 + if (rpmReadConfigFiles_p (NULL, NULL) != 0)
1239 + warning (_("Error reading the rpm configuration files"));
1243 + rpm_init_done = 1;
1246 + ts = rpmtsCreate_p ();
1248 + mi = rpmtsInitIterator_p (ts, RPMTAG_BASENAMES, filename, 0);
1254 + char *debuginfo, **slot, *s, *s2;
1256 + size_t srcrpmlen = sizeof (".src.rpm") - 1;
1257 + size_t debuginfolen = sizeof ("-debuginfo") - 1;
1258 + rpmdbMatchIterator mi_debuginfo;
1260 + h = rpmdbNextIterator_p (mi);
1264 + /* Verify the debuginfo file is not already installed. */
1266 + debuginfo = headerFormat_p (h, "%{sourcerpm}-debuginfo.%{arch}",
1270 + warning (_("Error querying the rpm file `%s': %s"), filename,
1274 + /* s = `.src.rpm-debuginfo.%{arch}' */
1275 + s = strrchr (debuginfo, '-') - srcrpmlen;
1277 + if (s > debuginfo && memcmp (s, ".src.rpm", srcrpmlen) == 0)
1279 + /* s2 = `-%{release}.src.rpm-debuginfo.%{arch}' */
1280 + s2 = memrchr (debuginfo, '-', s - debuginfo);
1284 + /* s2 = `-%{version}-%{release}.src.rpm-debuginfo.%{arch}' */
1285 + s2 = memrchr (debuginfo, '-', s2 - debuginfo);
1289 + warning (_("Error querying the rpm file `%s': %s"), filename,
1291 + xfree (debuginfo);
1294 + /* s = `.src.rpm-debuginfo.%{arch}' */
1295 + /* s2 = `-%{version}-%{release}.src.rpm-debuginfo.%{arch}' */
1296 + memmove (s2 + debuginfolen, s2, s - s2);
1297 + memcpy (s2, "-debuginfo", debuginfolen);
1298 + /* s = `XXXX.%{arch}' */
1299 + /* strlen ("XXXX") == srcrpmlen + debuginfolen */
1300 + /* s2 = `-debuginfo-%{version}-%{release}XX.%{arch}' */
1301 + /* strlen ("XX") == srcrpmlen */
1302 + memmove (s + debuginfolen, s + srcrpmlen + debuginfolen,
1303 + strlen (s + srcrpmlen + debuginfolen) + 1);
1304 + /* s = `-debuginfo-%{version}-%{release}.%{arch}' */
1306 + /* RPMDBI_PACKAGES requires keylen == sizeof (int). */
1307 + /* RPMDBI_LABEL is an interface for NVR-based dbiFindByLabel(). */
1308 + mi_debuginfo = rpmtsInitIterator_p (ts, RPMDBI_LABEL, debuginfo, 0);
1309 + xfree (debuginfo);
1312 + rpmdbFreeIterator_p (mi_debuginfo);
1317 + /* The allocated memory gets utilized below for MISSING_RPM_HASH. */
1318 + debuginfo = headerFormat_p (h,
1319 + "%{name}-%{version}-%{release}.%{arch}",
1323 + warning (_("Error querying the rpm file `%s': %s"), filename,
1328 + /* Base package name for `debuginfo-install'. We do not use the
1329 + `yum' command directly as the line
1330 + yum --enablerepo='*debug*' install NAME-debuginfo.ARCH
1331 + would be more complicated than just:
1332 + debuginfo-install NAME-VERSION-RELEASE.ARCH
1333 + Do not supply the rpm base name (derived from .src.rpm name) as
1334 + debuginfo-install is unable to install the debuginfo package if
1335 + the base name PKG binary rpm is not installed while for example
1336 + PKG-libs would be installed (RH Bug 467901).
1337 + FUTURE: After multiple debuginfo versions simultaneously installed
1338 + get supported the support for the VERSION-RELEASE tags handling
1339 + may need an update. */
1341 + if (missing_rpm_hash == NULL)
1343 + /* DEL_F is passed NULL as MISSING_RPM_LIST's HTAB_DELETE
1344 + should not deallocate the entries. */
1346 + missing_rpm_hash = htab_create_alloc (64, htab_hash_string,
1347 + (int (*) (const void *, const void *)) streq,
1348 + NULL, xcalloc, xfree);
1350 + slot = (char **) htab_find_slot (missing_rpm_hash, debuginfo, INSERT);
1351 + /* XCALLOC never returns NULL. */
1352 + gdb_assert (slot != NULL);
1353 + if (*slot == NULL)
1355 + struct missing_rpm *missing_rpm;
1357 + *slot = debuginfo;
1359 + missing_rpm = xmalloc (sizeof (*missing_rpm) + strlen (debuginfo));
1360 + strcpy (missing_rpm->rpm, debuginfo);
1361 + missing_rpm->next = missing_rpm_list;
1362 + missing_rpm_list = missing_rpm;
1363 + missing_rpm_list_entries++;
1366 + xfree (debuginfo);
1370 + rpmdbFreeIterator_p (mi);
1379 +missing_rpm_list_compar (const char *const *ap, const char *const *bp)
1381 + return strcoll (*ap, *bp);
1384 +/* It returns a NULL-terminated array of strings needing to be FREEd. It may
1385 + also return only NULL. */
1388 +missing_rpm_list_print (void)
1390 + char **array, **array_iter;
1391 + struct missing_rpm *list_iter;
1392 + struct cleanup *cleanups;
1394 + if (missing_rpm_list_entries == 0)
1397 + array = xmalloc (sizeof (*array) * missing_rpm_list_entries);
1398 + cleanups = make_cleanup (xfree, array);
1400 + array_iter = array;
1401 + for (list_iter = missing_rpm_list; list_iter != NULL;
1402 + list_iter = list_iter->next)
1404 + *array_iter++ = list_iter->rpm;
1406 + gdb_assert (array_iter == array + missing_rpm_list_entries);
1408 + qsort (array, missing_rpm_list_entries, sizeof (*array),
1409 + (int (*) (const void *, const void *)) missing_rpm_list_compar);
1411 + printf_unfiltered (_("Missing separate debuginfos, use: %s"),
1412 + "debuginfo-install");
1413 + for (array_iter = array; array_iter < array + missing_rpm_list_entries;
1416 + putchar_unfiltered (' ');
1417 + puts_unfiltered (*array_iter);
1419 + putchar_unfiltered ('\n');
1421 + while (missing_rpm_list != NULL)
1423 + list_iter = missing_rpm_list;
1424 + missing_rpm_list = list_iter->next;
1425 + xfree (list_iter);
1427 + missing_rpm_list_entries = 0;
1429 + do_cleanups (cleanups);
1433 +missing_rpm_change (void)
1435 + debug_flush_missing ();
1437 + gdb_assert (missing_rpm_list == NULL);
1438 + if (missing_rpm_hash != NULL)
1440 + htab_delete (missing_rpm_hash);
1441 + missing_rpm_hash = NULL;
1447 + /* Init state. EXEC_BFD also still could be NULL. */
1448 + MISSING_EXEC_NOT_TRIED,
1449 + /* We saw a non-NULL EXEC_BFD but RPM has no info about it. */
1450 + MISSING_EXEC_NOT_FOUND,
1451 + /* We found EXEC_BFD by RPM and we either have its symbols (either embedded
1452 + or separate) or the main executable's RPM is now contained in
1453 + MISSING_RPM_HASH. */
1454 + MISSING_EXEC_ENLISTED
1456 +static enum missing_exec missing_exec = MISSING_EXEC_NOT_TRIED;
1458 +#endif /* HAVE_LIBRPM */
1461 +debug_flush_missing (void)
1464 + missing_rpm_list_print ();
1468 /* This MISSING_FILEPAIR_HASH tracker is used only for the duplicite messages
1469 - Try to install the hash file ...
1470 + yum --enablerepo='*debug*' install ...
1473 struct missing_filepair
1474 @@ -721,11 +1074,17 @@ missing_filepair_change (void)
1475 /* All their memory came just from missing_filepair_OBSTACK. */
1476 missing_filepair_hash = NULL;
1479 + missing_exec = MISSING_EXEC_NOT_TRIED;
1484 debug_print_executable_changed (void)
1487 + missing_rpm_change ();
1489 missing_filepair_change ();
1492 @@ -792,14 +1151,34 @@ debug_print_missing (const char *binary,
1494 *slot = missing_filepair;
1496 - /* We do not collect and flush these messages as each such message
1497 - already requires its own separate lines. */
1499 + if (missing_exec == MISSING_EXEC_NOT_TRIED)
1501 + char *execfilename;
1503 - fprintf_unfiltered (gdb_stdlog,
1504 - _("Missing separate debuginfo for %s\n"), binary);
1505 - if (debug != NULL)
1506 - fprintf_unfiltered (gdb_stdlog, _("Try to install the hash file %s\n"),
1508 + execfilename = get_exec_file (0);
1509 + if (execfilename != NULL)
1511 + if (missing_rpm_enlist (execfilename) == 0)
1512 + missing_exec = MISSING_EXEC_NOT_FOUND;
1514 + missing_exec = MISSING_EXEC_ENLISTED;
1517 + if (missing_exec != MISSING_EXEC_ENLISTED)
1518 + if ((binary[0] == 0 || missing_rpm_enlist (binary) == 0)
1519 + && (debug == NULL || missing_rpm_enlist (debug) == 0))
1520 +#endif /* HAVE_LIBRPM */
1522 + /* We do not collect and flush these messages as each such message
1523 + already requires its own separate lines. */
1525 + fprintf_unfiltered (gdb_stdlog,
1526 + _("Missing separate debuginfo for %s\n"), binary);
1527 + if (debug != NULL)
1528 + fprintf_unfiltered (gdb_stdlog, _("Try: %s %s\n"),
1529 + "yum --enablerepo='*debug*' install", debug);
1533 /* See build-id.h. */