1 Index: gdb-7.11.50.20160630/gdb/event-top.c
2 ===================================================================
3 --- gdb-7.11.50.20160630.orig/gdb/event-top.c 2016-07-02 23:43:24.085214144 +0200
4 +++ gdb-7.11.50.20160630/gdb/event-top.c 2016-07-03 14:37:12.572130734 +0200
8 #include "gdb_select.h"
11 /* readline include files. */
12 #include "readline/readline.h"
14 /* Reset the nesting depth used when trace-commands is set. */
15 reset_command_nest_depth ();
17 + debug_flush_missing ();
19 old_chain = make_cleanup (free_current_contents, &actual_gdb_prompt);
21 /* Do not call the python hook on an explicit prompt change as
23 command_handler (cmd);
25 if (ui->prompt_state != PROMPTED)
26 - display_gdb_prompt (0);
28 + debug_flush_missing ();
29 + display_gdb_prompt (0);
34 Index: gdb-7.11.50.20160630/gdb/symfile.h
35 ===================================================================
36 --- gdb-7.11.50.20160630.orig/gdb/symfile.h 2016-07-03 14:34:32.032753668 +0200
37 +++ gdb-7.11.50.20160630/gdb/symfile.h 2016-07-03 14:37:12.573130742 +0200
39 /* build-id support. */
40 extern struct bfd_build_id *build_id_addr_get (CORE_ADDR addr);
41 extern void debug_print_missing (const char *binary, const char *debug);
42 +extern void debug_flush_missing (void);
43 +#define BUILD_ID_MAIN_EXECUTABLE_FILENAME _("the main executable file")
45 /* From dwarf2read.c */
47 Index: gdb-7.11.50.20160630/gdb/aclocal.m4
48 ===================================================================
49 --- gdb-7.11.50.20160630.orig/gdb/aclocal.m4 2016-07-02 23:43:24.085214144 +0200
50 +++ gdb-7.11.50.20160630/gdb/aclocal.m4 2016-07-03 14:37:12.576130768 +0200
52 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
55 +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
56 +# serial 1 (pkg-config-0.24)
58 +# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
60 +# This program is free software; you can redistribute it and/or modify
61 +# it under the terms of the GNU General Public License as published by
62 +# the Free Software Foundation; either version 2 of the License, or
63 +# (at your option) any later version.
65 +# This program is distributed in the hope that it will be useful, but
66 +# WITHOUT ANY WARRANTY; without even the implied warranty of
67 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
68 +# General Public License for more details.
70 +# You should have received a copy of the GNU General Public License
71 +# along with this program; if not, write to the Free Software
72 +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
74 +# As a special exception to the GNU General Public License, if you
75 +# distribute this file as part of a program that contains a
76 +# configuration script generated by Autoconf, you may include it under
77 +# the same distribution terms that you use for the rest of that program.
79 +# PKG_PROG_PKG_CONFIG([MIN-VERSION])
80 +# ----------------------------------
81 +AC_DEFUN([PKG_PROG_PKG_CONFIG],
82 +[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
83 +m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
84 +m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
85 +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
86 +AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
87 +AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
89 +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
90 + AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
92 +if test -n "$PKG_CONFIG"; then
93 + _pkg_min_version=m4_default([$1], [0.9.0])
94 + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
95 + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
96 + AC_MSG_RESULT([yes])
102 +])# PKG_PROG_PKG_CONFIG
104 +# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
106 +# Check to see whether a particular set of modules exists. Similar
107 +# to PKG_CHECK_MODULES(), but does not set variables or print errors.
109 +# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
110 +# only at the first occurence in configure.ac, so if the first place
111 +# it's called might be skipped (such as if it is within an "if", you
112 +# have to call PKG_CHECK_EXISTS manually
113 +# --------------------------------------------------------------
114 +AC_DEFUN([PKG_CHECK_EXISTS],
115 +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
116 +if test -n "$PKG_CONFIG" && \
117 + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
118 + m4_default([$2], [:])
119 +m4_ifvaln([$3], [else
123 +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
124 +# ---------------------------------------------
125 +m4_define([_PKG_CONFIG],
126 +[if test -n "$$1"; then
128 + elif test -n "$PKG_CONFIG"; then
129 + PKG_CHECK_EXISTS([$3],
130 + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
131 + test "x$?" != "x0" && pkg_failed=yes ],
138 +# _PKG_SHORT_ERRORS_SUPPORTED
139 +# -----------------------------
140 +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
141 +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
142 +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
143 + _pkg_short_errors_supported=yes
145 + _pkg_short_errors_supported=no
147 +])# _PKG_SHORT_ERRORS_SUPPORTED
150 +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
151 +# [ACTION-IF-NOT-FOUND])
154 +# Note that if there is a possibility the first call to
155 +# PKG_CHECK_MODULES might not happen, you should be sure to include an
156 +# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
159 +# --------------------------------------------------------------
160 +AC_DEFUN([PKG_CHECK_MODULES],
161 +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
162 +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
163 +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
166 +AC_MSG_CHECKING([for $1])
168 +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
169 +_PKG_CONFIG([$1][_LIBS], [libs], [$2])
171 +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
172 +and $1[]_LIBS to avoid the need to call pkg-config.
173 +See the pkg-config man page for more details.])
175 +if test $pkg_failed = yes; then
176 + AC_MSG_RESULT([no])
177 + _PKG_SHORT_ERRORS_SUPPORTED
178 + if test $_pkg_short_errors_supported = yes; then
179 + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
181 + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
183 + # Put the nasty error message in config.log where it belongs
184 + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
186 + m4_default([$4], [AC_MSG_ERROR(
187 +[Package requirements ($2) were not met:
191 +Consider adjusting the PKG_CONFIG_PATH environment variable if you
192 +installed software in a non-standard prefix.
196 +elif test $pkg_failed = untried; then
197 + AC_MSG_RESULT([no])
198 + m4_default([$4], [AC_MSG_FAILURE(
199 +[The pkg-config script could not be found or is too old. Make sure it
200 +is in your PATH or set the PKG_CONFIG environment variable to the full
205 +To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
208 + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
209 + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
210 + AC_MSG_RESULT([yes])
213 +])# PKG_CHECK_MODULES
216 +# PKG_INSTALLDIR(DIRECTORY)
217 +# -------------------------
218 +# Substitutes the variable pkgconfigdir as the location where a module
219 +# should install pkg-config .pc files. By default the directory is
220 +# $libdir/pkgconfig, but the default can be changed by passing
221 +# DIRECTORY. The user can override through the --with-pkgconfigdir
223 +AC_DEFUN([PKG_INSTALLDIR],
224 +[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
225 +m4_pushdef([pkg_description],
226 + [pkg-config installation directory @<:@]pkg_default[@:>@])
227 +AC_ARG_WITH([pkgconfigdir],
228 + [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
229 + [with_pkgconfigdir=]pkg_default)
230 +AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
231 +m4_popdef([pkg_default])
232 +m4_popdef([pkg_description])
233 +]) dnl PKG_INSTALLDIR
236 +# PKG_NOARCH_INSTALLDIR(DIRECTORY)
237 +# -------------------------
238 +# Substitutes the variable noarch_pkgconfigdir as the location where a
239 +# module should install arch-independent pkg-config .pc files. By
240 +# default the directory is $datadir/pkgconfig, but the default can be
241 +# changed by passing DIRECTORY. The user can override through the
242 +# --with-noarch-pkgconfigdir parameter.
243 +AC_DEFUN([PKG_NOARCH_INSTALLDIR],
244 +[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
245 +m4_pushdef([pkg_description],
246 + [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
247 +AC_ARG_WITH([noarch-pkgconfigdir],
248 + [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
249 + [with_noarch_pkgconfigdir=]pkg_default)
250 +AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
251 +m4_popdef([pkg_default])
252 +m4_popdef([pkg_description])
253 +]) dnl PKG_NOARCH_INSTALLDIR
256 +# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
257 +# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
258 +# -------------------------------------------
259 +# Retrieves the value of the pkg-config variable for the given module.
260 +AC_DEFUN([PKG_CHECK_VAR],
261 +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
262 +AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
264 +_PKG_CONFIG([$1], [variable="][$3]["], [$2])
265 +AS_VAR_COPY([$1], [pkg_cv_][$1])
267 +AS_VAR_IF([$1], [""], [$5], [$4])dnl
270 # AM_AUX_DIR_EXPAND -*- Autoconf -*-
272 # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
273 Index: gdb-7.11.50.20160630/gdb/config.in
274 ===================================================================
275 --- gdb-7.11.50.20160630.orig/gdb/config.in 2016-07-02 23:43:24.085214144 +0200
276 +++ gdb-7.11.50.20160630/gdb/config.in 2016-07-03 14:37:12.576130768 +0200
278 /* Define to BFD's default target vector. */
279 #undef DEFAULT_BFD_VEC
281 +/* librpm version specific library name to dlopen. */
282 +#undef DLOPEN_LIBRPM
284 /* Define to 1 if translation of program messages to the user's native
285 language is requested. */
288 /* Define if Python 2.7 is being used. */
289 #undef HAVE_LIBPYTHON2_7
291 +/* Define if librpm library is being used. */
294 /* Define to 1 if you have the <libunwind-ia64.h> header file. */
295 #undef HAVE_LIBUNWIND_IA64_H
297 Index: gdb-7.11.50.20160630/gdb/configure
298 ===================================================================
299 --- gdb-7.11.50.20160630.orig/gdb/configure 2016-07-02 23:43:24.085214144 +0200
300 +++ gdb-7.11.50.20160630/gdb/configure 2016-07-03 14:37:12.581130811 +0200
302 HAVE_NATIVE_GCORE_TARGET
314 with_relocated_sources
316 with_auto_load_safe_path
333 @@ -1541,6 +1552,8 @@
334 [--with-auto-load-dir]
335 --without-auto-load-safe-path
336 do not restrict auto-loaded files locations
337 + --with-rpm query rpm database for missing debuginfos (yes/no,
338 + def. auto=librpm.so)
339 --with-libunwind-ia64 use libunwind frame unwinding for ia64 targets
340 --with-curses use the curses library instead of the termcap
342 @@ -1595,6 +1608,13 @@
343 MAKEINFO Parent configure detects if it is of sufficient version.
345 Parameters for MAKEINFO.
346 + PKG_CONFIG path to pkg-config utility
348 + directories to add to pkg-config's search path
350 + path overriding pkg-config's built-in search path
351 + RPM_CFLAGS C compiler flags for RPM, overriding pkg-config
352 + RPM_LIBS linker flags for RPM, overriding pkg-config
353 YACC The `Yet Another C Compiler' implementation to use. Defaults to
354 the first program found out of: `bison -y', `byacc', `yacc'.
355 YFLAGS The list of arguments that will be passed by default to $YACC.
356 @@ -5613,6 +5633,494 @@
357 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_auto_load_safe_path" >&5
358 $as_echo "$with_auto_load_safe_path" >&6; }
360 +# Integration with rpm library to support missing debuginfo suggestions.
361 +# --without-rpm: Disable any rpm support.
362 +# --with-rpm=libname.so: Try to dynamically open `libname.so' during runtime.
363 +# Even with runtime missing `libname.so' GDB will still other run correctly.
364 +# Missing `libname.so' during ./configure will abort the configuration.
365 +# --with-rpm=librpm.so: Like `--with-rpm=libname.so' but try to find specific
366 +# minor version first such as `librpm-4.6.so' as minor version differences
367 +# mean API+ABI incompatibility. If the specific match versioned library name
368 +# could not be found still open dynamically at least `librpm.so'.
369 +# --with-rpm: Like `--with-rpm=librpm.so' but if any of its detection fails try
370 +# to find librpm for compilation-time linking by pkg-config. GDB binary will
371 +# be probably linked with the version specific library (as `librpm-4.6.so').
372 +# Failure to find librpm by pkg-config will abort the configuration.
373 +# (default) --with-rpm=auto: Like `--with-rpm=librpm.so' but if even pkg-config
374 +# cannot find librpm use to the rpmless compilation (like `--without-rpm').
377 +# Check whether --with-rpm was given.
378 +if test "${with_rpm+set}" = set; then :
387 +if test "x$with_rpm" != "xno"; then
388 + if test "x$with_rpm" = "xyes"; then
391 + DLOPEN_REQUIRE=false
392 + elif test "x$with_rpm" = "xauto"; then
395 + DLOPEN_REQUIRE=false
399 + DLOPEN_REQUIRE=true
401 + LIBRPM_STRING='"'"$LIBRPM"'"'
403 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking specific librpm version" >&5
404 +$as_echo_n "checking specific librpm version... " >&6; }
405 + HAVE_DLOPEN_LIBRPM=false
408 + if test "$cross_compiling" = yes; then :
409 + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
410 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
411 +as_fn_error "cannot run test program while cross compiling
412 +See \`config.log' for more details." "$LINENO" 5; }
414 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext
415 +/* end confdefs.h. */
417 +#include <rpm/rpmlib.h>
426 + const char *const *rpmverp;
429 + f = fopen ("conftest.out", "w");
432 + fprintf (stderr, "Cannot write \"%s\": %s\n", "conftest.out",
436 + h = dlopen ($LIBRPM_STRING, RTLD_LAZY);
439 + fprintf (stderr, "dlopen (\"%s\"): %s\n", $LIBRPM_STRING, dlerror ());
442 + rpmverp = dlsym (h, "RPMVERSION");
445 + fprintf (stderr, "dlsym (\"RPMVERSION\"): %s\n", dlerror ());
448 + fprintf (stderr, "RPMVERSION is: \"");
449 + fprintf (stderr, "%s\"\n", *rpmverp);
451 + /* Try to find the specific librpm version only for "librpm.so" as we do
452 + not know how to assemble the version string otherwise. */
454 + if (strcmp ("librpm.so", $LIBRPM_STRING) != 0)
456 + fprintf (f, "%s\n", $LIBRPM_STRING);
465 + if (sscanf (*rpmverp, "%d.%d", &major, &minor) != 2)
467 + fprintf (stderr, "Unable to parse RPMVERSION.\n");
468 + fprintf (f, "%s\n", $LIBRPM_STRING);
471 + /* Avoid the square brackets by malloc. */
472 + h2_name = malloc (64);
473 + sprintf (h2_name, "librpm-%d.%d.so", major, minor);
474 + h2 = dlopen (h2_name, RTLD_LAZY);
477 + fprintf (stderr, "dlopen (\"%s\"): %s\n", h2_name, dlerror ());
478 + fprintf (f, "%s\n", $LIBRPM_STRING);
483 + fprintf (stderr, "dlopen of \"%s\" and \"%s\" are different.\n",
484 + $LIBRPM_STRING, h2_name);
485 + fprintf (f, "%s\n", $LIBRPM_STRING);
488 + /* Found the valid .so name with a specific version. */
489 + fprintf (f, "%s\n", h2_name);
497 +if ac_fn_c_try_run "$LINENO"; then :
499 + DLOPEN_LIBRPM="`cat conftest.out`"
500 + if test "x$DLOPEN_LIBRPM" != "x"; then
501 + HAVE_DLOPEN_LIBRPM=true
502 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLOPEN_LIBRPM" >&5
503 +$as_echo "$DLOPEN_LIBRPM" >&6; }
507 +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
508 + conftest.$ac_objext conftest.beam conftest.$ac_ext
515 + if $HAVE_DLOPEN_LIBRPM; then
517 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking rpm library API compatibility" >&5
518 +$as_echo_n "checking rpm library API compatibility... " >&6; }
519 + # The compilation requires -Werror to verify anything.
520 + save_CFLAGS="$CFLAGS"
521 + CFLAGS="$CFLAGS -Werror"
522 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext
523 +/* end confdefs.h. */
525 +/* Duplicate here the declarations to verify they match "elfread.c". */
526 +#include <rpm/rpmlib.h>
527 +#include <rpm/rpmts.h>
528 +#include <rpm/rpmdb.h>
529 +#include <rpm/header.h>
530 +extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
531 +extern int rpmReadConfigFiles(const char * file, const char * target);
532 +extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
533 +extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
534 +extern rpmts rpmtsCreate(void);
535 +extern rpmts rpmtsFree(rpmts ts);
536 +extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
537 + const void * keyp, size_t keylen);
547 +if ac_fn_c_try_compile "$LINENO"; then :
550 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
551 +$as_echo "yes" >&6; }
555 + LIBRPM_COMPAT=false
556 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
557 +$as_echo "no" >&6; }
560 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
561 + CFLAGS="$save_CFLAGS"
563 + if ! $LIBRPM_COMPAT; then
564 + HAVE_DLOPEN_LIBRPM=false
568 + if $HAVE_DLOPEN_LIBRPM; then
569 + DLOPEN_LIBRPM_STRING='"'"$DLOPEN_LIBRPM"'"'
571 +cat >>confdefs.h <<_ACEOF
572 +#define DLOPEN_LIBRPM $DLOPEN_LIBRPM_STRING
576 +$as_echo "#define HAVE_LIBRPM 1" >>confdefs.h
579 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
580 +$as_echo "no" >&6; }
582 + if $DLOPEN_REQUIRE; then
583 + as_fn_error "Specific name $LIBRPM was requested but it could not be opened." "$LINENO" 5
592 +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
593 + if test -n "$ac_tool_prefix"; then
594 + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
595 +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
596 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
597 +$as_echo_n "checking for $ac_word... " >&6; }
598 +if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
599 + $as_echo_n "(cached) " >&6
601 + case $PKG_CONFIG in
603 + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
606 + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
610 + test -z "$as_dir" && as_dir=.
611 + for ac_exec_ext in '' $ac_executable_extensions; do
612 + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
613 + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
614 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
624 +PKG_CONFIG=$ac_cv_path_PKG_CONFIG
625 +if test -n "$PKG_CONFIG"; then
626 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
627 +$as_echo "$PKG_CONFIG" >&6; }
629 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
630 +$as_echo "no" >&6; }
635 +if test -z "$ac_cv_path_PKG_CONFIG"; then
636 + ac_pt_PKG_CONFIG=$PKG_CONFIG
637 + # Extract the first word of "pkg-config", so it can be a program name with args.
638 +set dummy pkg-config; ac_word=$2
639 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
640 +$as_echo_n "checking for $ac_word... " >&6; }
641 +if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then :
642 + $as_echo_n "(cached) " >&6
644 + case $ac_pt_PKG_CONFIG in
646 + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
649 + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
653 + test -z "$as_dir" && as_dir=.
654 + for ac_exec_ext in '' $ac_executable_extensions; do
655 + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
656 + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
657 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
667 +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
668 +if test -n "$ac_pt_PKG_CONFIG"; then
669 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
670 +$as_echo "$ac_pt_PKG_CONFIG" >&6; }
672 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
673 +$as_echo "no" >&6; }
676 + if test "x$ac_pt_PKG_CONFIG" = x; then
679 + case $cross_compiling:$ac_tool_warned in
681 +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
682 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
683 +ac_tool_warned=yes ;;
685 + PKG_CONFIG=$ac_pt_PKG_CONFIG
688 + PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
692 +if test -n "$PKG_CONFIG"; then
693 + _pkg_min_version=0.9.0
694 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
695 +$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
696 + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
697 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
698 +$as_echo "yes" >&6; }
700 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
701 +$as_echo "no" >&6; }
707 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for RPM" >&5
708 +$as_echo_n "checking for RPM... " >&6; }
710 +if test -n "$RPM_CFLAGS"; then
711 + pkg_cv_RPM_CFLAGS="$RPM_CFLAGS"
712 + elif test -n "$PKG_CONFIG"; then
713 + if test -n "$PKG_CONFIG" && \
714 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"rpm\""; } >&5
715 + ($PKG_CONFIG --exists --print-errors "rpm") 2>&5
717 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
718 + test $ac_status = 0; }; then
719 + pkg_cv_RPM_CFLAGS=`$PKG_CONFIG --cflags "rpm" 2>/dev/null`
720 + test "x$?" != "x0" && pkg_failed=yes
727 +if test -n "$RPM_LIBS"; then
728 + pkg_cv_RPM_LIBS="$RPM_LIBS"
729 + elif test -n "$PKG_CONFIG"; then
730 + if test -n "$PKG_CONFIG" && \
731 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"rpm\""; } >&5
732 + ($PKG_CONFIG --exists --print-errors "rpm") 2>&5
734 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
735 + test $ac_status = 0; }; then
736 + pkg_cv_RPM_LIBS=`$PKG_CONFIG --libs "rpm" 2>/dev/null`
737 + test "x$?" != "x0" && pkg_failed=yes
747 +if test $pkg_failed = yes; then
748 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
749 +$as_echo "no" >&6; }
751 +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
752 + _pkg_short_errors_supported=yes
754 + _pkg_short_errors_supported=no
756 + if test $_pkg_short_errors_supported = yes; then
757 + RPM_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "rpm" 2>&1`
759 + RPM_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "rpm" 2>&1`
761 + # Put the nasty error message in config.log where it belongs
762 + echo "$RPM_PKG_ERRORS" >&5
765 +elif test $pkg_failed = untried; then
766 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
767 +$as_echo "no" >&6; }
770 + RPM_CFLAGS=$pkg_cv_RPM_CFLAGS
771 + RPM_LIBS=$pkg_cv_RPM_LIBS
772 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
773 +$as_echo "yes" >&6; }
777 + if $HAVE_LIBRPM; then
779 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking rpm library API compatibility" >&5
780 +$as_echo_n "checking rpm library API compatibility... " >&6; }
781 + # The compilation requires -Werror to verify anything.
782 + save_CFLAGS="$CFLAGS"
783 + CFLAGS="$CFLAGS -Werror"
784 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext
785 +/* end confdefs.h. */
787 +/* Duplicate here the declarations to verify they match "elfread.c". */
788 +#include <rpm/rpmlib.h>
789 +#include <rpm/rpmts.h>
790 +#include <rpm/rpmdb.h>
791 +#include <rpm/header.h>
792 +extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
793 +extern int rpmReadConfigFiles(const char * file, const char * target);
794 +extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
795 +extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
796 +extern rpmts rpmtsCreate(void);
797 +extern rpmts rpmtsFree(rpmts ts);
798 +extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
799 + const void * keyp, size_t keylen);
809 +if ac_fn_c_try_compile "$LINENO"; then :
812 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
813 +$as_echo "yes" >&6; }
817 + LIBRPM_COMPAT=false
818 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
819 +$as_echo "no" >&6; }
822 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
823 + CFLAGS="$save_CFLAGS"
825 + if ! $LIBRPM_COMPAT; then
827 + RPM_PKG_ERRORS="Found $LIBRPM API is incompatibile with this GDB"
831 + if $HAVE_LIBRPM; then
833 +$as_echo "#define HAVE_LIBRPM 1" >>confdefs.h
835 + CFLAGS="$CFLAGS $RPM_CFLAGS"
836 + LIBS="$LIBS $RPM_LIBS"
838 + if $RPM_REQUIRE; then
839 + as_fn_error "$RPM_PKG_ERRORS" "$LINENO" 5
841 + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $RPM_PKG_ERRORS" >&5
842 +$as_echo "$as_me: WARNING: $RPM_PKG_ERRORS" >&2;}
850 subdirs="$subdirs testsuite"
851 Index: gdb-7.11.50.20160630/gdb/configure.ac
852 ===================================================================
853 --- gdb-7.11.50.20160630.orig/gdb/configure.ac 2016-07-02 23:43:24.085214144 +0200
854 +++ gdb-7.11.50.20160630/gdb/configure.ac 2016-07-03 14:37:12.582130819 +0200
855 @@ -177,6 +177,199 @@
856 [Directories safe to hold auto-loaded files.])
857 AC_MSG_RESULT([$with_auto_load_safe_path])
859 +# Integration with rpm library to support missing debuginfo suggestions.
860 +# --without-rpm: Disable any rpm support.
861 +# --with-rpm=libname.so: Try to dynamically open `libname.so' during runtime.
862 +# Even with runtime missing `libname.so' GDB will still other run correctly.
863 +# Missing `libname.so' during ./configure will abort the configuration.
864 +# --with-rpm=librpm.so: Like `--with-rpm=libname.so' but try to find specific
865 +# minor version first such as `librpm-4.6.so' as minor version differences
866 +# mean API+ABI incompatibility. If the specific match versioned library name
867 +# could not be found still open dynamically at least `librpm.so'.
868 +# --with-rpm: Like `--with-rpm=librpm.so' but if any of its detection fails try
869 +# to find librpm for compilation-time linking by pkg-config. GDB binary will
870 +# be probably linked with the version specific library (as `librpm-4.6.so').
871 +# Failure to find librpm by pkg-config will abort the configuration.
872 +# (default) --with-rpm=auto: Like `--with-rpm=librpm.so' but if even pkg-config
873 +# cannot find librpm use to the rpmless compilation (like `--without-rpm').
876 + [AS_HELP_STRING([--with-rpm],
877 + [query rpm database for missing debuginfos (yes/no, def. auto=librpm.so)])], [], [with_rpm="auto"])
879 +m4_pattern_allow([^AC_MSG_ERROR$])
880 +m4_pattern_allow([^AC_MSG_WARN$])
881 +if test "x$with_rpm" != "xno"; then
882 + if test "x$with_rpm" = "xyes"; then
885 + DLOPEN_REQUIRE=false
886 + elif test "x$with_rpm" = "xauto"; then
889 + DLOPEN_REQUIRE=false
893 + DLOPEN_REQUIRE=true
895 + LIBRPM_STRING='"'"$LIBRPM"'"'
897 + AC_MSG_CHECKING([specific librpm version])
898 + HAVE_DLOPEN_LIBRPM=false
901 + AC_RUN_IFELSE(AC_LANG_PROGRAM([[
902 +#include <rpm/rpmlib.h>
907 + const char *const *rpmverp;
910 + f = fopen ("conftest.out", "w");
913 + fprintf (stderr, "Cannot write \"%s\": %s\n", "conftest.out",
917 + h = dlopen ($LIBRPM_STRING, RTLD_LAZY);
920 + fprintf (stderr, "dlopen (\"%s\"): %s\n", $LIBRPM_STRING, dlerror ());
923 + rpmverp = dlsym (h, "RPMVERSION");
926 + fprintf (stderr, "dlsym (\"RPMVERSION\"): %s\n", dlerror ());
929 + fprintf (stderr, "RPMVERSION is: \"");
930 + fprintf (stderr, "%s\"\n", *rpmverp);
932 + /* Try to find the specific librpm version only for "librpm.so" as we do
933 + not know how to assemble the version string otherwise. */
935 + if (strcmp ("librpm.so", $LIBRPM_STRING) != 0)
937 + fprintf (f, "%s\n", $LIBRPM_STRING);
946 + if (sscanf (*rpmverp, "%d.%d", &major, &minor) != 2)
948 + fprintf (stderr, "Unable to parse RPMVERSION.\n");
949 + fprintf (f, "%s\n", $LIBRPM_STRING);
952 + /* Avoid the square brackets by malloc. */
953 + h2_name = malloc (64);
954 + sprintf (h2_name, "librpm-%d.%d.so", major, minor);
955 + h2 = dlopen (h2_name, RTLD_LAZY);
958 + fprintf (stderr, "dlopen (\"%s\"): %s\n", h2_name, dlerror ());
959 + fprintf (f, "%s\n", $LIBRPM_STRING);
964 + fprintf (stderr, "dlopen of \"%s\" and \"%s\" are different.\n",
965 + $LIBRPM_STRING, h2_name);
966 + fprintf (f, "%s\n", $LIBRPM_STRING);
969 + /* Found the valid .so name with a specific version. */
970 + fprintf (f, "%s\n", h2_name);
974 + DLOPEN_LIBRPM="`cat conftest.out`"
975 + if test "x$DLOPEN_LIBRPM" != "x"; then
976 + HAVE_DLOPEN_LIBRPM=true
977 + AC_MSG_RESULT($DLOPEN_LIBRPM)
982 + m4_define([CHECK_LIBRPM_COMPAT], [
983 + AC_MSG_CHECKING([rpm library API compatibility])
984 + # The compilation requires -Werror to verify anything.
985 + save_CFLAGS="$CFLAGS"
986 + CFLAGS="$CFLAGS -Werror"
987 + AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[
988 +/* Duplicate here the declarations to verify they match "elfread.c". */
989 +#include <rpm/rpmlib.h>
990 +#include <rpm/rpmts.h>
991 +#include <rpm/rpmdb.h>
992 +#include <rpm/header.h>
993 +extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
994 +extern int rpmReadConfigFiles(const char * file, const char * target);
995 +extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
996 +extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
997 +extern rpmts rpmtsCreate(void);
998 +extern rpmts rpmtsFree(rpmts ts);
999 +extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
1000 + const void * keyp, size_t keylen);
1002 + LIBRPM_COMPAT=true
1003 + AC_MSG_RESULT(yes)
1005 + LIBRPM_COMPAT=false
1008 + CFLAGS="$save_CFLAGS"
1011 + if $HAVE_DLOPEN_LIBRPM; then
1012 + CHECK_LIBRPM_COMPAT
1013 + if ! $LIBRPM_COMPAT; then
1014 + HAVE_DLOPEN_LIBRPM=false
1018 + if $HAVE_DLOPEN_LIBRPM; then
1019 + DLOPEN_LIBRPM_STRING='"'"$DLOPEN_LIBRPM"'"'
1020 + AC_DEFINE_UNQUOTED(DLOPEN_LIBRPM, $DLOPEN_LIBRPM_STRING, [librpm version specific library name to dlopen.])
1021 + AC_DEFINE(HAVE_LIBRPM, 1, [Define if librpm library is being used.])
1025 + if $DLOPEN_REQUIRE; then
1026 + AC_MSG_ERROR([Specific name $LIBRPM was requested but it could not be opened.])
1028 + PKG_CHECK_MODULES(RPM, rpm, [HAVE_LIBRPM=true], [HAVE_LIBRPM=false])
1030 + if $HAVE_LIBRPM; then
1031 + CHECK_LIBRPM_COMPAT
1032 + if ! $LIBRPM_COMPAT; then
1034 + RPM_PKG_ERRORS="Found $LIBRPM API is incompatibile with this GDB"
1038 + if $HAVE_LIBRPM; then
1039 + AC_DEFINE(HAVE_LIBRPM, 1, [Define if librpm library is being used.])
1040 + CFLAGS="$CFLAGS $RPM_CFLAGS"
1041 + LIBS="$LIBS $RPM_LIBS"
1043 + if $RPM_REQUIRE; then
1044 + AC_MSG_ERROR($RPM_PKG_ERRORS)
1046 + AC_MSG_WARN($RPM_PKG_ERRORS)
1052 AC_CONFIG_SUBDIRS(testsuite)
1054 # Check whether to support alternative target configurations
1055 Index: gdb-7.11.50.20160630/gdb/corelow.c
1056 ===================================================================
1057 --- gdb-7.11.50.20160630.orig/gdb/corelow.c 2016-07-03 14:34:32.022753582 +0200
1058 +++ gdb-7.11.50.20160630/gdb/corelow.c 2016-07-03 14:37:12.582130819 +0200
1060 symfile_objfile->flags |= OBJF_BUILD_ID_CORE_LOADED;
1063 - debug_print_missing (_("the main executable file"), build_id_filename);
1064 + debug_print_missing (BUILD_ID_MAIN_EXECUTABLE_FILENAME, build_id_filename);
1066 do_cleanups (back_to);
1068 Index: gdb-7.11.50.20160630/gdb/build-id.c
1069 ===================================================================
1070 --- gdb-7.11.50.20160630.orig/gdb/build-id.c 2016-07-03 14:36:50.124938187 +0200
1071 +++ gdb-7.11.50.20160630/gdb/build-id.c 2016-07-03 14:42:25.171812134 +0200
1073 #include "elf/common.h"
1074 #include "elf-bfd.h"
1075 #include <sys/stat.h>
1076 +#include "elf/external.h"
1078 #define BUILD_ID_VERBOSE_NONE 0
1079 #define BUILD_ID_VERBOSE_FILENAMES 1
1080 @@ -665,8 +666,366 @@
1086 +#include <rpm/rpmlib.h>
1087 +#include <rpm/rpmts.h>
1088 +#include <rpm/rpmdb.h>
1089 +#include <rpm/header.h>
1090 +#ifdef DLOPEN_LIBRPM
1094 +/* This MISSING_RPM_HASH tracker is used to collect all the missing rpm files
1095 + and avoid their duplicities during a single inferior run. */
1097 +static struct htab *missing_rpm_hash;
1099 +/* This MISSING_RPM_LIST tracker is used to collect and print as a single line
1100 + all the rpms right before the nearest GDB prompt. It gets cleared after
1101 + each such print (it is questionable if we should clear it after the print).
1106 + struct missing_rpm *next;
1109 +static struct missing_rpm *missing_rpm_list;
1110 +static int missing_rpm_list_entries;
1112 +/* Returns the count of newly added rpms. */
1115 +missing_rpm_enlist (const char *filename)
1117 + static int rpm_init_done = 0;
1119 + rpmdbMatchIterator mi;
1122 +#ifdef DLOPEN_LIBRPM
1123 + /* Duplicate here the declarations to verify they match. The same sanity
1124 + check is present also in `configure.ac'. */
1125 + extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
1126 + static char *(*headerFormat_p) (Header h, const char * fmt, errmsg_t *errmsg);
1127 + extern int rpmReadConfigFiles(const char * file, const char * target);
1128 + static int (*rpmReadConfigFiles_p) (const char * file, const char * target);
1129 + extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
1130 + static rpmdbMatchIterator (*rpmdbFreeIterator_p) (rpmdbMatchIterator mi);
1131 + extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
1132 + static Header (*rpmdbNextIterator_p) (rpmdbMatchIterator mi);
1133 + extern rpmts rpmtsCreate(void);
1134 + static rpmts (*rpmtsCreate_p) (void);
1135 + extern rpmts rpmtsFree(rpmts ts);
1136 + static rpmts (*rpmtsFree_p) (rpmts ts);
1137 + extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
1138 + const void * keyp, size_t keylen);
1139 + static rpmdbMatchIterator (*rpmtsInitIterator_p) (const rpmts ts,
1143 +#else /* !DLOPEN_LIBRPM */
1144 +# define headerFormat_p headerFormat
1145 +# define rpmReadConfigFiles_p rpmReadConfigFiles
1146 +# define rpmdbFreeIterator_p rpmdbFreeIterator
1147 +# define rpmdbNextIterator_p rpmdbNextIterator
1148 +# define rpmtsCreate_p rpmtsCreate
1149 +# define rpmtsFree_p rpmtsFree
1150 +# define rpmtsInitIterator_p rpmtsInitIterator
1151 +#endif /* !DLOPEN_LIBRPM */
1153 + gdb_assert (filename != NULL);
1155 + if (strcmp (filename, BUILD_ID_MAIN_EXECUTABLE_FILENAME) == 0)
1158 + if (is_target_filename (filename))
1161 + if (filename[0] != '/')
1163 + warning (_("Ignoring non-absolute filename: <%s>"), filename);
1167 + if (!rpm_init_done)
1169 + static int init_tried;
1171 + /* Already failed the initialization before? */
1176 +#ifdef DLOPEN_LIBRPM
1180 + h = dlopen (DLOPEN_LIBRPM, RTLD_LAZY);
1183 + warning (_("Unable to open \"%s\" (%s), "
1184 + "missing debuginfos notifications will not be displayed"),
1185 + DLOPEN_LIBRPM, dlerror ());
1189 + if (!((headerFormat_p = (char *(*) (Header h, const char * fmt, errmsg_t *errmsg)) dlsym (h, "headerFormat"))
1190 + && (rpmReadConfigFiles_p = (int (*) (const char * file, const char * target)) dlsym (h, "rpmReadConfigFiles"))
1191 + && (rpmdbFreeIterator_p = (rpmdbMatchIterator (*) (rpmdbMatchIterator mi)) dlsym (h, "rpmdbFreeIterator"))
1192 + && (rpmdbNextIterator_p = (Header (*) (rpmdbMatchIterator mi)) dlsym (h, "rpmdbNextIterator"))
1193 + && (rpmtsCreate_p = (rpmts (*) (void)) dlsym (h, "rpmtsCreate"))
1194 + && (rpmtsFree_p = (rpmts (*) (rpmts ts)) dlsym (h, "rpmtsFree"))
1195 + && (rpmtsInitIterator_p = (rpmdbMatchIterator (*) (const rpmts ts, rpmTag rpmtag, const void *keyp, size_t keylen)) dlsym (h, "rpmtsInitIterator"))))
1197 + warning (_("Opened library \"%s\" is incompatible (%s), "
1198 + "missing debuginfos notifications will not be displayed"),
1199 + DLOPEN_LIBRPM, dlerror ());
1201 + warning (_("Error closing library \"%s\": %s\n"), DLOPEN_LIBRPM,
1206 +#endif /* DLOPEN_LIBRPM */
1208 + if (rpmReadConfigFiles_p (NULL, NULL) != 0)
1210 + warning (_("Error reading the rpm configuration files"));
1214 + rpm_init_done = 1;
1217 + ts = rpmtsCreate_p ();
1219 + mi = rpmtsInitIterator_p (ts, RPMTAG_BASENAMES, filename, 0);
1225 + char *debuginfo, **slot, *s, *s2;
1227 + size_t srcrpmlen = sizeof (".src.rpm") - 1;
1228 + size_t debuginfolen = sizeof ("-debuginfo") - 1;
1229 + rpmdbMatchIterator mi_debuginfo;
1231 + h = rpmdbNextIterator_p (mi);
1235 + /* Verify the debuginfo file is not already installed. */
1237 + debuginfo = headerFormat_p (h, "%{sourcerpm}-debuginfo.%{arch}",
1241 + warning (_("Error querying the rpm file `%s': %s"), filename,
1245 + /* s = `.src.rpm-debuginfo.%{arch}' */
1246 + s = strrchr (debuginfo, '-') - srcrpmlen;
1248 + if (s > debuginfo && memcmp (s, ".src.rpm", srcrpmlen) == 0)
1250 + /* s2 = `-%{release}.src.rpm-debuginfo.%{arch}' */
1251 + s2 = (char *) memrchr (debuginfo, '-', s - debuginfo);
1255 + /* s2 = `-%{version}-%{release}.src.rpm-debuginfo.%{arch}' */
1256 + s2 = (char *) memrchr (debuginfo, '-', s2 - debuginfo);
1260 + warning (_("Error querying the rpm file `%s': %s"), filename,
1262 + xfree (debuginfo);
1265 + /* s = `.src.rpm-debuginfo.%{arch}' */
1266 + /* s2 = `-%{version}-%{release}.src.rpm-debuginfo.%{arch}' */
1267 + memmove (s2 + debuginfolen, s2, s - s2);
1268 + memcpy (s2, "-debuginfo", debuginfolen);
1269 + /* s = `XXXX.%{arch}' */
1270 + /* strlen ("XXXX") == srcrpmlen + debuginfolen */
1271 + /* s2 = `-debuginfo-%{version}-%{release}XX.%{arch}' */
1272 + /* strlen ("XX") == srcrpmlen */
1273 + memmove (s + debuginfolen, s + srcrpmlen + debuginfolen,
1274 + strlen (s + srcrpmlen + debuginfolen) + 1);
1275 + /* s = `-debuginfo-%{version}-%{release}.%{arch}' */
1277 + /* RPMDBI_PACKAGES requires keylen == sizeof (int). */
1278 + /* RPMDBI_LABEL is an interface for NVR-based dbiFindByLabel(). */
1279 + mi_debuginfo = rpmtsInitIterator_p (ts, (rpmTag) RPMDBI_LABEL, debuginfo, 0);
1280 + xfree (debuginfo);
1283 + rpmdbFreeIterator_p (mi_debuginfo);
1288 + /* The allocated memory gets utilized below for MISSING_RPM_HASH. */
1289 + debuginfo = headerFormat_p (h,
1290 + "%{name}-%{version}-%{release}.%{arch}",
1294 + warning (_("Error querying the rpm file `%s': %s"), filename,
1299 + /* Base package name for `debuginfo-install'. We do not use the
1300 + `yum' command directly as the line
1301 + yum --enablerepo='*debug*' install NAME-debuginfo.ARCH
1302 + would be more complicated than just:
1303 + debuginfo-install NAME-VERSION-RELEASE.ARCH
1304 + Do not supply the rpm base name (derived from .src.rpm name) as
1305 + debuginfo-install is unable to install the debuginfo package if
1306 + the base name PKG binary rpm is not installed while for example
1307 + PKG-libs would be installed (RH Bug 467901).
1308 + FUTURE: After multiple debuginfo versions simultaneously installed
1309 + get supported the support for the VERSION-RELEASE tags handling
1310 + may need an update. */
1312 + if (missing_rpm_hash == NULL)
1314 + /* DEL_F is passed NULL as MISSING_RPM_LIST's HTAB_DELETE
1315 + should not deallocate the entries. */
1317 + missing_rpm_hash = htab_create_alloc (64, htab_hash_string,
1318 + (int (*) (const void *, const void *)) streq,
1319 + NULL, xcalloc, xfree);
1321 + slot = (char **) htab_find_slot (missing_rpm_hash, debuginfo, INSERT);
1322 + /* XCALLOC never returns NULL. */
1323 + gdb_assert (slot != NULL);
1324 + if (*slot == NULL)
1326 + struct missing_rpm *missing_rpm;
1328 + *slot = debuginfo;
1330 + missing_rpm = (struct missing_rpm *) xmalloc (sizeof (*missing_rpm) + strlen (debuginfo));
1331 + strcpy (missing_rpm->rpm, debuginfo);
1332 + missing_rpm->next = missing_rpm_list;
1333 + missing_rpm_list = missing_rpm;
1334 + missing_rpm_list_entries++;
1337 + xfree (debuginfo);
1341 + rpmdbFreeIterator_p (mi);
1350 +missing_rpm_list_compar (const char *const *ap, const char *const *bp)
1352 + return strcoll (*ap, *bp);
1355 +/* It returns a NULL-terminated array of strings needing to be FREEd. It may
1356 + also return only NULL. */
1359 +missing_rpm_list_print (void)
1361 + char **array, **array_iter;
1362 + struct missing_rpm *list_iter;
1363 + struct cleanup *cleanups;
1365 + if (missing_rpm_list_entries == 0)
1368 + array = (char **) xmalloc (sizeof (*array) * missing_rpm_list_entries);
1369 + cleanups = make_cleanup (xfree, array);
1371 + array_iter = array;
1372 + for (list_iter = missing_rpm_list; list_iter != NULL;
1373 + list_iter = list_iter->next)
1375 + *array_iter++ = list_iter->rpm;
1377 + gdb_assert (array_iter == array + missing_rpm_list_entries);
1379 + qsort (array, missing_rpm_list_entries, sizeof (*array),
1380 + (int (*) (const void *, const void *)) missing_rpm_list_compar);
1382 + printf_unfiltered (_("Missing separate debuginfos, use: %s"),
1383 +#ifdef DNF_DEBUGINFO_INSTALL
1386 + "debuginfo-install");
1387 + for (array_iter = array; array_iter < array + missing_rpm_list_entries;
1390 + putchar_unfiltered (' ');
1391 + puts_unfiltered (*array_iter);
1393 + putchar_unfiltered ('\n');
1395 + while (missing_rpm_list != NULL)
1397 + list_iter = missing_rpm_list;
1398 + missing_rpm_list = list_iter->next;
1399 + xfree (list_iter);
1401 + missing_rpm_list_entries = 0;
1403 + do_cleanups (cleanups);
1407 +missing_rpm_change (void)
1409 + debug_flush_missing ();
1411 + gdb_assert (missing_rpm_list == NULL);
1412 + if (missing_rpm_hash != NULL)
1414 + htab_delete (missing_rpm_hash);
1415 + missing_rpm_hash = NULL;
1421 + /* Init state. EXEC_BFD also still could be NULL. */
1422 + MISSING_EXEC_NOT_TRIED,
1423 + /* We saw a non-NULL EXEC_BFD but RPM has no info about it. */
1424 + MISSING_EXEC_NOT_FOUND,
1425 + /* We found EXEC_BFD by RPM and we either have its symbols (either embedded
1426 + or separate) or the main executable's RPM is now contained in
1427 + MISSING_RPM_HASH. */
1428 + MISSING_EXEC_ENLISTED
1430 +static enum missing_exec missing_exec = MISSING_EXEC_NOT_TRIED;
1432 +#endif /* HAVE_LIBRPM */
1435 +debug_flush_missing (void)
1438 + missing_rpm_list_print ();
1442 /* This MISSING_FILEPAIR_HASH tracker is used only for the duplicite messages
1443 - Try to install the hash file ...
1444 + yum --enablerepo='*debug*' install ...
1447 struct missing_filepair
1448 @@ -720,11 +1079,17 @@
1449 /* All their memory came just from missing_filepair_OBSTACK. */
1450 missing_filepair_hash = NULL;
1453 + missing_exec = MISSING_EXEC_NOT_TRIED;
1458 debug_print_executable_changed (void)
1461 + missing_rpm_change ();
1463 missing_filepair_change ();
1466 @@ -791,14 +1156,39 @@
1468 *slot = missing_filepair;
1470 - /* We do not collect and flush these messages as each such message
1471 - already requires its own separate lines. */
1473 + if (missing_exec == MISSING_EXEC_NOT_TRIED)
1475 + char *execfilename;
1477 - fprintf_unfiltered (gdb_stdlog,
1478 - _("Missing separate debuginfo for %s\n"), binary);
1479 - if (debug != NULL)
1480 - fprintf_unfiltered (gdb_stdlog, _("Try to install the hash file %s\n"),
1482 + execfilename = get_exec_file (0);
1483 + if (execfilename != NULL)
1485 + if (missing_rpm_enlist (execfilename) == 0)
1486 + missing_exec = MISSING_EXEC_NOT_FOUND;
1488 + missing_exec = MISSING_EXEC_ENLISTED;
1491 + if (missing_exec != MISSING_EXEC_ENLISTED)
1492 + if ((binary[0] == 0 || missing_rpm_enlist (binary) == 0)
1493 + && (debug == NULL || missing_rpm_enlist (debug) == 0))
1494 +#endif /* HAVE_LIBRPM */
1496 + /* We do not collect and flush these messages as each such message
1497 + already requires its own separate lines. */
1499 + fprintf_unfiltered (gdb_stdlog,
1500 + _("Missing separate debuginfo for %s\n"), binary);
1501 + if (debug != NULL)
1502 + fprintf_unfiltered (gdb_stdlog, _("Try: %s %s\n"),
1503 +#ifdef DNF_DEBUGINFO_INSTALL
1508 + " --enablerepo='*debug*' install", debug);
1512 /* See build-id.h. */