1 Index: gdb-7.6/gdb/event-top.c
2 ===================================================================
3 --- gdb-7.6.orig/gdb/event-top.c 2013-01-31 19:37:37.000000000 +0100
4 +++ gdb-7.6/gdb/event-top.c 2013-07-17 19:51:02.679357656 +0200
6 #include "continuations.h"
7 #include "gdbcmd.h" /* for dont_repeat() */
11 /* readline include files. */
12 #include "readline/readline.h"
13 @@ -170,6 +171,8 @@ rl_callback_read_char_wrapper (gdb_clien
15 cli_command_loop (void)
17 + debug_flush_missing ();
19 display_gdb_prompt (0);
21 /* Now it's time to start the event loop. */
22 @@ -237,6 +240,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 /* Each interpreter has its own rules on displaying the command
30 if (!current_interp_display_prompt_p ())
31 Index: gdb-7.6/gdb/elfread.c
32 ===================================================================
33 --- gdb-7.6.orig/gdb/elfread.c 2013-07-17 19:51:02.639357629 +0200
34 +++ gdb-7.6/gdb/elfread.c 2013-07-17 19:51:50.738390068 +0200
39 +#include "elf/external.h"
42 extern void _initialize_elfread (void);
43 @@ -1682,8 +1683,360 @@ build_id_to_filename (const struct elf_b
49 +#include <rpm/rpmlib.h>
50 +#include <rpm/rpmts.h>
51 +#include <rpm/rpmdb.h>
52 +#include <rpm/header.h>
57 +/* This MISSING_RPM_HASH tracker is used to collect all the missing rpm files
58 + and avoid their duplicities during a single inferior run. */
60 +static struct htab *missing_rpm_hash;
62 +/* This MISSING_RPM_LIST tracker is used to collect and print as a single line
63 + all the rpms right before the nearest GDB prompt. It gets cleared after
64 + each such print (it is questionable if we should clear it after the print).
69 + struct missing_rpm *next;
72 +static struct missing_rpm *missing_rpm_list;
73 +static int missing_rpm_list_entries;
75 +/* Returns the count of newly added rpms. */
78 +missing_rpm_enlist (const char *filename)
80 + static int rpm_init_done = 0;
82 + rpmdbMatchIterator mi;
86 + /* Duplicate here the declarations to verify they match. The same sanity
87 + check is present also in `configure.ac'. */
88 + extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
89 + static char *(*headerFormat_p) (Header h, const char * fmt, errmsg_t *errmsg);
90 + extern int rpmReadConfigFiles(const char * file, const char * target);
91 + static int (*rpmReadConfigFiles_p) (const char * file, const char * target);
92 + extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
93 + static rpmdbMatchIterator (*rpmdbFreeIterator_p) (rpmdbMatchIterator mi);
94 + extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
95 + static Header (*rpmdbNextIterator_p) (rpmdbMatchIterator mi);
96 + extern rpmts rpmtsCreate(void);
97 + static rpmts (*rpmtsCreate_p) (void);
98 + extern rpmts rpmtsFree(rpmts ts);
99 + static rpmts (*rpmtsFree_p) (rpmts ts);
100 + extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
101 + const void * keyp, size_t keylen);
102 + static rpmdbMatchIterator (*rpmtsInitIterator_p) (const rpmts ts,
106 +#else /* !DLOPEN_LIBRPM */
107 +# define headerFormat_p headerFormat
108 +# define rpmReadConfigFiles_p rpmReadConfigFiles
109 +# define rpmdbFreeIterator_p rpmdbFreeIterator
110 +# define rpmdbNextIterator_p rpmdbNextIterator
111 +# define rpmtsCreate_p rpmtsCreate
112 +# define rpmtsFree_p rpmtsFree
113 +# define rpmtsInitIterator_p rpmtsInitIterator
114 +#endif /* !DLOPEN_LIBRPM */
116 + gdb_assert (filename != NULL);
118 + if (strcmp (filename, BUILD_ID_MAIN_EXECUTABLE_FILENAME) == 0)
121 + if (filename[0] != '/')
123 + warning (_("Ignoring non-absolute filename: <%s>"), filename);
127 + if (!rpm_init_done)
129 + static int init_tried;
131 + /* Already failed the initialization before? */
136 +#ifdef DLOPEN_LIBRPM
140 + h = dlopen (DLOPEN_LIBRPM, RTLD_LAZY);
143 + warning (_("Unable to open \"%s\" (%s), "
144 + "missing debuginfos notifications will not be displayed"),
145 + DLOPEN_LIBRPM, dlerror ());
149 + if (!((headerFormat_p = dlsym (h, "headerFormat"))
150 + && (rpmReadConfigFiles_p = dlsym (h, "rpmReadConfigFiles"))
151 + && (rpmdbFreeIterator_p = dlsym (h, "rpmdbFreeIterator"))
152 + && (rpmdbNextIterator_p = dlsym (h, "rpmdbNextIterator"))
153 + && (rpmtsCreate_p = dlsym (h, "rpmtsCreate"))
154 + && (rpmtsFree_p = dlsym (h, "rpmtsFree"))
155 + && (rpmtsInitIterator_p = dlsym (h, "rpmtsInitIterator"))))
157 + warning (_("Opened library \"%s\" is incompatible (%s), "
158 + "missing debuginfos notifications will not be displayed"),
159 + DLOPEN_LIBRPM, dlerror ());
161 + warning (_("Error closing library \"%s\": %s\n"), DLOPEN_LIBRPM,
166 +#endif /* DLOPEN_LIBRPM */
168 + if (rpmReadConfigFiles_p (NULL, NULL) != 0)
170 + warning (_("Error reading the rpm configuration files"));
177 + ts = rpmtsCreate_p ();
179 + mi = rpmtsInitIterator_p (ts, RPMTAG_BASENAMES, filename, 0);
185 + char *debuginfo, **slot, *s, *s2;
187 + size_t srcrpmlen = sizeof (".src.rpm") - 1;
188 + size_t debuginfolen = sizeof ("-debuginfo") - 1;
189 + rpmdbMatchIterator mi_debuginfo;
191 + h = rpmdbNextIterator_p (mi);
195 + /* Verify the debuginfo file is not already installed. */
197 + debuginfo = headerFormat_p (h, "%{sourcerpm}-debuginfo.%{arch}",
201 + warning (_("Error querying the rpm file `%s': %s"), filename,
205 + /* s = `.src.rpm-debuginfo.%{arch}' */
206 + s = strrchr (debuginfo, '-') - srcrpmlen;
208 + if (s > debuginfo && memcmp (s, ".src.rpm", srcrpmlen) == 0)
210 + /* s2 = `-%{release}.src.rpm-debuginfo.%{arch}' */
211 + s2 = memrchr (debuginfo, '-', s - debuginfo);
215 + /* s2 = `-%{version}-%{release}.src.rpm-debuginfo.%{arch}' */
216 + s2 = memrchr (debuginfo, '-', s2 - debuginfo);
220 + warning (_("Error querying the rpm file `%s': %s"), filename,
225 + /* s = `.src.rpm-debuginfo.%{arch}' */
226 + /* s2 = `-%{version}-%{release}.src.rpm-debuginfo.%{arch}' */
227 + memmove (s2 + debuginfolen, s2, s - s2);
228 + memcpy (s2, "-debuginfo", debuginfolen);
229 + /* s = `XXXX.%{arch}' */
230 + /* strlen ("XXXX") == srcrpmlen + debuginfolen */
231 + /* s2 = `-debuginfo-%{version}-%{release}XX.%{arch}' */
232 + /* strlen ("XX") == srcrpmlen */
233 + memmove (s + debuginfolen, s + srcrpmlen + debuginfolen,
234 + strlen (s + srcrpmlen + debuginfolen) + 1);
235 + /* s = `-debuginfo-%{version}-%{release}.%{arch}' */
237 + /* RPMDBI_PACKAGES requires keylen == sizeof (int). */
238 + /* RPMDBI_LABEL is an interface for NVR-based dbiFindByLabel(). */
239 + mi_debuginfo = rpmtsInitIterator_p (ts, RPMDBI_LABEL, debuginfo, 0);
243 + rpmdbFreeIterator_p (mi_debuginfo);
248 + /* The allocated memory gets utilized below for MISSING_RPM_HASH. */
249 + debuginfo = headerFormat_p (h,
250 + "%{name}-%{version}-%{release}.%{arch}",
254 + warning (_("Error querying the rpm file `%s': %s"), filename,
259 + /* Base package name for `debuginfo-install'. We do not use the
260 + `yum' command directly as the line
261 + yum --enablerepo='*debug*' install NAME-debuginfo.ARCH
262 + would be more complicated than just:
263 + debuginfo-install NAME-VERSION-RELEASE.ARCH
264 + Do not supply the rpm base name (derived from .src.rpm name) as
265 + debuginfo-install is unable to install the debuginfo package if
266 + the base name PKG binary rpm is not installed while for example
267 + PKG-libs would be installed (RH Bug 467901).
268 + FUTURE: After multiple debuginfo versions simultaneously installed
269 + get supported the support for the VERSION-RELEASE tags handling
270 + may need an update. */
272 + if (missing_rpm_hash == NULL)
274 + /* DEL_F is passed NULL as MISSING_RPM_LIST's HTAB_DELETE
275 + should not deallocate the entries. */
277 + missing_rpm_hash = htab_create_alloc (64, htab_hash_string,
278 + (int (*) (const void *, const void *)) streq,
279 + NULL, xcalloc, xfree);
281 + slot = (char **) htab_find_slot (missing_rpm_hash, debuginfo, INSERT);
282 + /* XCALLOC never returns NULL. */
283 + gdb_assert (slot != NULL);
286 + struct missing_rpm *missing_rpm;
290 + missing_rpm = xmalloc (sizeof (*missing_rpm) + strlen (debuginfo));
291 + strcpy (missing_rpm->rpm, debuginfo);
292 + missing_rpm->next = missing_rpm_list;
293 + missing_rpm_list = missing_rpm;
294 + missing_rpm_list_entries++;
301 + rpmdbFreeIterator_p (mi);
310 +missing_rpm_list_compar (const char *const *ap, const char *const *bp)
312 + return strcoll (*ap, *bp);
315 +/* It returns a NULL-terminated array of strings needing to be FREEd. It may
316 + also return only NULL. */
319 +missing_rpm_list_print (void)
321 + char **array, **array_iter;
322 + struct missing_rpm *list_iter;
323 + struct cleanup *cleanups;
325 + if (missing_rpm_list_entries == 0)
328 + array = xmalloc (sizeof (*array) * missing_rpm_list_entries);
329 + cleanups = make_cleanup (xfree, array);
331 + array_iter = array;
332 + for (list_iter = missing_rpm_list; list_iter != NULL;
333 + list_iter = list_iter->next)
335 + *array_iter++ = list_iter->rpm;
337 + gdb_assert (array_iter == array + missing_rpm_list_entries);
339 + qsort (array, missing_rpm_list_entries, sizeof (*array),
340 + (int (*) (const void *, const void *)) missing_rpm_list_compar);
342 + printf_unfiltered (_("Missing separate debuginfos, use: %s"),
343 + "debuginfo-install");
344 + for (array_iter = array; array_iter < array + missing_rpm_list_entries;
347 + putchar_unfiltered (' ');
348 + puts_unfiltered (*array_iter);
350 + putchar_unfiltered ('\n');
352 + while (missing_rpm_list != NULL)
354 + list_iter = missing_rpm_list;
355 + missing_rpm_list = list_iter->next;
358 + missing_rpm_list_entries = 0;
360 + do_cleanups (cleanups);
364 +missing_rpm_change (void)
366 + debug_flush_missing ();
368 + gdb_assert (missing_rpm_list == NULL);
369 + if (missing_rpm_hash != NULL)
371 + htab_delete (missing_rpm_hash);
372 + missing_rpm_hash = NULL;
378 + /* Init state. EXEC_BFD also still could be NULL. */
379 + MISSING_EXEC_NOT_TRIED,
380 + /* We saw a non-NULL EXEC_BFD but RPM has no info about it. */
381 + MISSING_EXEC_NOT_FOUND,
382 + /* We found EXEC_BFD by RPM and we either have its symbols (either embedded
383 + or separate) or the main executable's RPM is now contained in
384 + MISSING_RPM_HASH. */
385 + MISSING_EXEC_ENLISTED
387 +static enum missing_exec missing_exec = MISSING_EXEC_NOT_TRIED;
389 +#endif /* HAVE_LIBRPM */
392 +debug_flush_missing (void)
395 + missing_rpm_list_print ();
399 /* This MISSING_FILEPAIR_HASH tracker is used only for the duplicite messages
400 - Try to install the hash file ...
401 + yum --enablerepo='*debug*' install ...
404 struct missing_filepair
405 @@ -1737,11 +2090,17 @@ missing_filepair_change (void)
406 /* All their memory came just from missing_filepair_OBSTACK. */
407 missing_filepair_hash = NULL;
410 + missing_exec = MISSING_EXEC_NOT_TRIED;
415 debug_print_executable_changed (void)
418 + missing_rpm_change ();
420 missing_filepair_change ();
423 @@ -1808,14 +2167,34 @@ debug_print_missing (const char *binary,
425 *slot = missing_filepair;
427 - /* We do not collect and flush these messages as each such message
428 - already requires its own separate lines. */
430 + if (missing_exec == MISSING_EXEC_NOT_TRIED)
432 + char *exec_filename;
434 - fprintf_unfiltered (gdb_stdlog,
435 - _("Missing separate debuginfo for %s\n"), binary);
437 - fprintf_unfiltered (gdb_stdlog, _("Try to install the hash file %s\n"),
439 + exec_filename = get_exec_file (0);
440 + if (exec_filename != NULL)
442 + if (missing_rpm_enlist (exec_filename) == 0)
443 + missing_exec = MISSING_EXEC_NOT_FOUND;
445 + missing_exec = MISSING_EXEC_ENLISTED;
448 + if (missing_exec != MISSING_EXEC_ENLISTED)
449 + if ((binary[0] == 0 || missing_rpm_enlist (binary) == 0)
450 + && (debug == NULL || missing_rpm_enlist (debug) == 0))
451 +#endif /* HAVE_LIBRPM */
453 + /* We do not collect and flush these messages as each such message
454 + already requires its own separate lines. */
456 + fprintf_unfiltered (gdb_stdlog,
457 + _("Missing separate debuginfo for %s\n"), binary);
459 + fprintf_unfiltered (gdb_stdlog, _("Try: %s %s\n"),
460 + "yum --enablerepo='*debug*' install", debug);
465 Index: gdb-7.6/gdb/symfile.h
466 ===================================================================
467 --- gdb-7.6.orig/gdb/symfile.h 2013-07-17 19:51:02.639357629 +0200
468 +++ gdb-7.6/gdb/symfile.h 2013-07-17 19:51:02.687357661 +0200
469 @@ -598,6 +598,8 @@ extern struct elf_build_id *build_id_add
470 extern char *build_id_to_filename (const struct elf_build_id *build_id,
471 char **link_return, int add_debug_suffix);
472 extern void debug_print_missing (const char *binary, const char *debug);
473 +extern void debug_flush_missing (void);
474 +#define BUILD_ID_MAIN_EXECUTABLE_FILENAME _("the main executable file")
476 /* From dwarf2read.c */
478 Index: gdb-7.6/gdb/testsuite/lib/gdb.exp
479 ===================================================================
480 --- gdb-7.6.orig/gdb/testsuite/lib/gdb.exp 2013-07-17 19:51:02.640357629 +0200
481 +++ gdb-7.6/gdb/testsuite/lib/gdb.exp 2013-07-17 19:51:02.688357662 +0200
482 @@ -1482,7 +1482,7 @@ proc default_gdb_start { } {
483 warning "Couldn't set the width to 0."
486 - # Turn off the missing warnings as the testsuite does not expect it.
487 + # Turn off the missing RPMs warnings as the testsuite does not expect it.
488 send_gdb "set build-id-verbose 0\n"
490 -re "$gdb_prompt $" {
491 Index: gdb-7.6/gdb/testsuite/lib/mi-support.exp
492 ===================================================================
493 --- gdb-7.6.orig/gdb/testsuite/lib/mi-support.exp 2013-07-17 19:51:02.656357640 +0200
494 +++ gdb-7.6/gdb/testsuite/lib/mi-support.exp 2013-07-17 19:51:02.689357663 +0200
495 @@ -212,7 +212,7 @@ proc default_mi_gdb_start { args } {
496 warning "Couldn't set the width to 0."
499 - # Turn off the missing warnings as the testsuite does not expect it.
500 + # Turn off the missing RPMs warnings as the testsuite does not expect it.
501 send_gdb "190-gdb-set build-id-verbose 0\n"
503 -re ".*190-gdb-set build-id-verbose 0\r\n190\\\^done\r\n$mi_gdb_prompt$" {
504 Index: gdb-7.6/gdb/tui/tui-interp.c
505 ===================================================================
506 --- gdb-7.6.orig/gdb/tui/tui-interp.c 2013-01-01 07:41:30.000000000 +0100
507 +++ gdb-7.6/gdb/tui/tui-interp.c 2013-07-17 19:51:02.689357663 +0200
510 #include "tui/tui-io.h"
511 #include "exceptions.h"
512 +#include "symfile.h"
514 /* Set to 1 when the TUI mode must be activated when we first start
516 Index: gdb-7.6/gdb/aclocal.m4
517 ===================================================================
518 --- gdb-7.6.orig/gdb/aclocal.m4 2013-01-17 12:06:26.000000000 +0100
519 +++ gdb-7.6/gdb/aclocal.m4 2013-07-17 19:51:02.689357663 +0200
521 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
522 # PARTICULAR PURPOSE.
524 +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
525 +# serial 1 (pkg-config-0.24)
527 +# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
529 +# This program is free software; you can redistribute it and/or modify
530 +# it under the terms of the GNU General Public License as published by
531 +# the Free Software Foundation; either version 2 of the License, or
532 +# (at your option) any later version.
534 +# This program is distributed in the hope that it will be useful, but
535 +# WITHOUT ANY WARRANTY; without even the implied warranty of
536 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
537 +# General Public License for more details.
539 +# You should have received a copy of the GNU General Public License
540 +# along with this program; if not, write to the Free Software
541 +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
543 +# As a special exception to the GNU General Public License, if you
544 +# distribute this file as part of a program that contains a
545 +# configuration script generated by Autoconf, you may include it under
546 +# the same distribution terms that you use for the rest of that program.
548 +# PKG_PROG_PKG_CONFIG([MIN-VERSION])
549 +# ----------------------------------
550 +AC_DEFUN([PKG_PROG_PKG_CONFIG],
551 +[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
552 +m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
553 +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
554 +AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
555 +AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
557 +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
558 + AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
560 +if test -n "$PKG_CONFIG"; then
561 + _pkg_min_version=m4_default([$1], [0.9.0])
562 + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
563 + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
564 + AC_MSG_RESULT([yes])
566 + AC_MSG_RESULT([no])
570 +])# PKG_PROG_PKG_CONFIG
572 +# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
574 +# Check to see whether a particular set of modules exists. Similar
575 +# to PKG_CHECK_MODULES(), but does not set variables or print errors.
577 +# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
578 +# only at the first occurence in configure.ac, so if the first place
579 +# it's called might be skipped (such as if it is within an "if", you
580 +# have to call PKG_CHECK_EXISTS manually
581 +# --------------------------------------------------------------
582 +AC_DEFUN([PKG_CHECK_EXISTS],
583 +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
584 +if test -n "$PKG_CONFIG" && \
585 + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
586 + m4_default([$2], [:])
587 +m4_ifvaln([$3], [else
591 +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
592 +# ---------------------------------------------
593 +m4_define([_PKG_CONFIG],
594 +[if test -n "$$1"; then
596 + elif test -n "$PKG_CONFIG"; then
597 + PKG_CHECK_EXISTS([$3],
598 + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
605 +# _PKG_SHORT_ERRORS_SUPPORTED
606 +# -----------------------------
607 +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
608 +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
609 +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
610 + _pkg_short_errors_supported=yes
612 + _pkg_short_errors_supported=no
614 +])# _PKG_SHORT_ERRORS_SUPPORTED
617 +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
618 +# [ACTION-IF-NOT-FOUND])
621 +# Note that if there is a possibility the first call to
622 +# PKG_CHECK_MODULES might not happen, you should be sure to include an
623 +# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
626 +# --------------------------------------------------------------
627 +AC_DEFUN([PKG_CHECK_MODULES],
628 +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
629 +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
630 +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
633 +AC_MSG_CHECKING([for $1])
635 +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
636 +_PKG_CONFIG([$1][_LIBS], [libs], [$2])
638 +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
639 +and $1[]_LIBS to avoid the need to call pkg-config.
640 +See the pkg-config man page for more details.])
642 +if test $pkg_failed = yes; then
643 + AC_MSG_RESULT([no])
644 + _PKG_SHORT_ERRORS_SUPPORTED
645 + if test $_pkg_short_errors_supported = yes; then
646 + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
648 + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
650 + # Put the nasty error message in config.log where it belongs
651 + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
653 + m4_default([$4], [AC_MSG_ERROR(
654 +[Package requirements ($2) were not met:
658 +Consider adjusting the PKG_CONFIG_PATH environment variable if you
659 +installed software in a non-standard prefix.
663 +elif test $pkg_failed = untried; then
664 + AC_MSG_RESULT([no])
665 + m4_default([$4], [AC_MSG_FAILURE(
666 +[The pkg-config script could not be found or is too old. Make sure it
667 +is in your PATH or set the PKG_CONFIG environment variable to the full
672 +To get pkg-config, see <http://pkg-config.freedesktop.org/>.])
675 + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
676 + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
677 + AC_MSG_RESULT([yes])
680 +])# PKG_CHECK_MODULES
682 # AM_CONDITIONAL -*- Autoconf -*-
684 # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
685 Index: gdb-7.6/gdb/config.in
686 ===================================================================
687 --- gdb-7.6.orig/gdb/config.in 2012-12-09 19:39:58.000000000 +0100
688 +++ gdb-7.6/gdb/config.in 2013-07-17 19:51:02.689357663 +0200
690 /* Define to BFD's default target vector. */
691 #undef DEFAULT_BFD_VEC
693 +/* librpm version specific library name to dlopen. */
694 +#undef DLOPEN_LIBRPM
696 /* Define to 1 if translation of program messages to the user's native
697 language is requested. */
700 /* Define if Python 2.7 is being used. */
701 #undef HAVE_LIBPYTHON2_7
703 +/* Define if librpm library is being used. */
706 /* Define to 1 if you have the <libunwind-ia64.h> header file. */
707 #undef HAVE_LIBUNWIND_IA64_H
709 Index: gdb-7.6/gdb/configure
710 ===================================================================
711 --- gdb-7.6.orig/gdb/configure 2013-07-17 19:51:01.665356963 +0200
712 +++ gdb-7.6/gdb/configure 2013-07-17 19:51:02.691357664 +0200
713 @@ -686,6 +686,11 @@ PKGVERSION
714 HAVE_NATIVE_GCORE_TARGET
725 @@ -786,6 +791,7 @@ with_gdb_datadir
726 with_relocated_sources
728 with_auto_load_safe_path
733 @@ -834,6 +840,11 @@ CPPFLAGS
745 @@ -1504,6 +1515,8 @@ Optional Packages:
746 [--with-auto-load-dir]
747 --without-auto-load-safe-path
748 do not restrict auto-loaded files locations
749 + --with-rpm query rpm database for missing debuginfos (yes/no,
750 + def. auto=librpm.so)
751 --with-libunwind-ia64 use libunwind frame unwinding for ia64 targets
752 --with-curses use the curses library instead of the termcap
754 @@ -1548,6 +1561,13 @@ Some influential environment variables:
755 MAKEINFO Parent configure detects if it is of sufficient version.
757 Parameters for MAKEINFO.
758 + PKG_CONFIG path to pkg-config utility
760 + directories to add to pkg-config's search path
762 + path overriding pkg-config's built-in search path
763 + RPM_CFLAGS C compiler flags for RPM, overriding pkg-config
764 + RPM_LIBS linker flags for RPM, overriding pkg-config
765 YACC The `Yet Another C Compiler' implementation to use. Defaults to
766 the first program found out of: `bison -y', `byacc', `yacc'.
767 YFLAGS The list of arguments that will be passed by default to $YACC.
768 @@ -5033,6 +5053,491 @@ _ACEOF
769 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_auto_load_safe_path" >&5
770 $as_echo "$with_auto_load_safe_path" >&6; }
772 +# Integration with rpm library to support missing debuginfo suggestions.
773 +# --without-rpm: Disable any rpm support.
774 +# --with-rpm=libname.so: Try to dynamically open `libname.so' during runtime.
775 +# Even with runtime missing `libname.so' GDB will still other run correctly.
776 +# Missing `libname.so' during ./configure will abort the configuration.
777 +# --with-rpm=librpm.so: Like `--with-rpm=libname.so' but try to find specific
778 +# minor version first such as `librpm-4.6.so' as minor version differences
779 +# mean API+ABI incompatibility. If the specific match versioned library name
780 +# could not be found still open dynamically at least `librpm.so'.
781 +# --with-rpm: Like `--with-rpm=librpm.so' but if any of its detection fails try
782 +# to find librpm for compilation-time linking by pkg-config. GDB binary will
783 +# be probably linked with the version specific library (as `librpm-4.6.so').
784 +# Failure to find librpm by pkg-config will abort the configuration.
785 +# (default) --with-rpm=auto: Like `--with-rpm=librpm.so' but if even pkg-config
786 +# cannot find librpm use to the rpmless compilation (like `--without-rpm').
789 +# Check whether --with-rpm was given.
790 +if test "${with_rpm+set}" = set; then :
799 +if test "x$with_rpm" != "xno"; then
800 + if test "x$with_rpm" = "xyes"; then
803 + DLOPEN_REQUIRE=false
804 + elif test "x$with_rpm" = "xauto"; then
807 + DLOPEN_REQUIRE=false
811 + DLOPEN_REQUIRE=true
813 + LIBRPM_STRING='"'"$LIBRPM"'"'
815 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking specific librpm version" >&5
816 +$as_echo_n "checking specific librpm version... " >&6; }
817 + HAVE_DLOPEN_LIBRPM=false
820 + if test "$cross_compiling" = yes; then :
821 + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
822 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
823 +as_fn_error "cannot run test program while cross compiling
824 +See \`config.log' for more details." "$LINENO" 5; }
826 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext
827 +/* end confdefs.h. */
829 +#include <rpm/rpmlib.h>
838 + const char *const *rpmverp;
841 + f = fopen ("conftest.out", "w");
844 + fprintf (stderr, "Cannot write \"%s\": %s\n", "conftest.out",
848 + h = dlopen ($LIBRPM_STRING, RTLD_LAZY);
851 + fprintf (stderr, "dlopen (\"%s\"): %s\n", $LIBRPM_STRING, dlerror ());
854 + rpmverp = dlsym (h, "RPMVERSION");
857 + fprintf (stderr, "dlsym (\"RPMVERSION\"): %s\n", dlerror ());
860 + fprintf (stderr, "RPMVERSION is: \"");
861 + fprintf (stderr, "%s\"\n", *rpmverp);
863 + /* Try to find the specific librpm version only for "librpm.so" as we do
864 + not know how to assemble the version string otherwise. */
866 + if (strcmp ("librpm.so", $LIBRPM_STRING) != 0)
868 + fprintf (f, "%s\n", $LIBRPM_STRING);
877 + if (sscanf (*rpmverp, "%d.%d", &major, &minor) != 2)
879 + fprintf (stderr, "Unable to parse RPMVERSION.\n");
880 + fprintf (f, "%s\n", $LIBRPM_STRING);
883 + /* Avoid the square brackets by malloc. */
884 + h2_name = malloc (64);
885 + sprintf (h2_name, "librpm-%d.%d.so", major, minor);
886 + h2 = dlopen (h2_name, RTLD_LAZY);
889 + fprintf (stderr, "dlopen (\"%s\"): %s\n", h2_name, dlerror ());
890 + fprintf (f, "%s\n", $LIBRPM_STRING);
895 + fprintf (stderr, "dlopen of \"%s\" and \"%s\" are different.\n",
896 + $LIBRPM_STRING, h2_name);
897 + fprintf (f, "%s\n", $LIBRPM_STRING);
900 + /* Found the valid .so name with a specific version. */
901 + fprintf (f, "%s\n", h2_name);
909 +if ac_fn_c_try_run "$LINENO"; then :
911 + DLOPEN_LIBRPM="`cat conftest.out`"
912 + if test "x$DLOPEN_LIBRPM" != "x"; then
913 + HAVE_DLOPEN_LIBRPM=true
914 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLOPEN_LIBRPM" >&5
915 +$as_echo "$DLOPEN_LIBRPM" >&6; }
919 +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
920 + conftest.$ac_objext conftest.beam conftest.$ac_ext
927 + if $HAVE_DLOPEN_LIBRPM; then
929 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking rpm library API compatibility" >&5
930 +$as_echo_n "checking rpm library API compatibility... " >&6; }
931 + # The compilation requires -Werror to verify anything.
932 + save_CFLAGS="$CFLAGS"
933 + CFLAGS="$CFLAGS -Werror"
934 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext
935 +/* end confdefs.h. */
937 +/* Duplicate here the declarations to verify they match "elfread.c". */
938 +#include <rpm/rpmlib.h>
939 +#include <rpm/rpmts.h>
940 +#include <rpm/rpmdb.h>
941 +#include <rpm/header.h>
942 +extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
943 +extern int rpmReadConfigFiles(const char * file, const char * target);
944 +extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
945 +extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
946 +extern rpmts rpmtsCreate(void);
947 +extern rpmts rpmtsFree(rpmts ts);
948 +extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
949 + const void * keyp, size_t keylen);
959 +if ac_fn_c_try_compile "$LINENO"; then :
962 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
963 +$as_echo "yes" >&6; }
967 + LIBRPM_COMPAT=false
968 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
969 +$as_echo "no" >&6; }
972 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
973 + CFLAGS="$save_CFLAGS"
975 + if ! $LIBRPM_COMPAT; then
976 + HAVE_DLOPEN_LIBRPM=false
980 + if $HAVE_DLOPEN_LIBRPM; then
981 + DLOPEN_LIBRPM_STRING='"'"$DLOPEN_LIBRPM"'"'
983 +cat >>confdefs.h <<_ACEOF
984 +#define DLOPEN_LIBRPM $DLOPEN_LIBRPM_STRING
988 +$as_echo "#define HAVE_LIBRPM 1" >>confdefs.h
991 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
992 +$as_echo "no" >&6; }
994 + if $DLOPEN_REQUIRE; then
995 + as_fn_error "Specific name $LIBRPM was requested but it could not be opened." "$LINENO" 5
1003 +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1004 + if test -n "$ac_tool_prefix"; then
1005 + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
1006 +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
1007 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
1008 +$as_echo_n "checking for $ac_word... " >&6; }
1009 +if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
1010 + $as_echo_n "(cached) " >&6
1012 + case $PKG_CONFIG in
1013 + [\\/]* | ?:[\\/]*)
1014 + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
1017 + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1018 +for as_dir in $PATH
1021 + test -z "$as_dir" && as_dir=.
1022 + for ac_exec_ext in '' $ac_executable_extensions; do
1023 + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
1024 + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
1025 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
1035 +PKG_CONFIG=$ac_cv_path_PKG_CONFIG
1036 +if test -n "$PKG_CONFIG"; then
1037 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
1038 +$as_echo "$PKG_CONFIG" >&6; }
1040 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
1041 +$as_echo "no" >&6; }
1046 +if test -z "$ac_cv_path_PKG_CONFIG"; then
1047 + ac_pt_PKG_CONFIG=$PKG_CONFIG
1048 + # Extract the first word of "pkg-config", so it can be a program name with args.
1049 +set dummy pkg-config; ac_word=$2
1050 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
1051 +$as_echo_n "checking for $ac_word... " >&6; }
1052 +if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then :
1053 + $as_echo_n "(cached) " >&6
1055 + case $ac_pt_PKG_CONFIG in
1056 + [\\/]* | ?:[\\/]*)
1057 + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
1060 + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1061 +for as_dir in $PATH
1064 + test -z "$as_dir" && as_dir=.
1065 + for ac_exec_ext in '' $ac_executable_extensions; do
1066 + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
1067 + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
1068 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
1078 +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
1079 +if test -n "$ac_pt_PKG_CONFIG"; then
1080 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
1081 +$as_echo "$ac_pt_PKG_CONFIG" >&6; }
1083 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
1084 +$as_echo "no" >&6; }
1087 + if test "x$ac_pt_PKG_CONFIG" = x; then
1090 + case $cross_compiling:$ac_tool_warned in
1092 +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
1093 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
1094 +ac_tool_warned=yes ;;
1096 + PKG_CONFIG=$ac_pt_PKG_CONFIG
1099 + PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
1103 +if test -n "$PKG_CONFIG"; then
1104 + _pkg_min_version=0.9.0
1105 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
1106 +$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
1107 + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1108 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
1109 +$as_echo "yes" >&6; }
1111 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
1112 +$as_echo "no" >&6; }
1118 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for RPM" >&5
1119 +$as_echo_n "checking for RPM... " >&6; }
1121 +if test -n "$RPM_CFLAGS"; then
1122 + pkg_cv_RPM_CFLAGS="$RPM_CFLAGS"
1123 + elif test -n "$PKG_CONFIG"; then
1124 + if test -n "$PKG_CONFIG" && \
1125 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"rpm\""; } >&5
1126 + ($PKG_CONFIG --exists --print-errors "rpm") 2>&5
1128 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
1129 + test $ac_status = 0; }; then
1130 + pkg_cv_RPM_CFLAGS=`$PKG_CONFIG --cflags "rpm" 2>/dev/null`
1135 + pkg_failed=untried
1137 +if test -n "$RPM_LIBS"; then
1138 + pkg_cv_RPM_LIBS="$RPM_LIBS"
1139 + elif test -n "$PKG_CONFIG"; then
1140 + if test -n "$PKG_CONFIG" && \
1141 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"rpm\""; } >&5
1142 + ($PKG_CONFIG --exists --print-errors "rpm") 2>&5
1144 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
1145 + test $ac_status = 0; }; then
1146 + pkg_cv_RPM_LIBS=`$PKG_CONFIG --libs "rpm" 2>/dev/null`
1151 + pkg_failed=untried
1156 +if test $pkg_failed = yes; then
1157 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
1158 +$as_echo "no" >&6; }
1160 +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1161 + _pkg_short_errors_supported=yes
1163 + _pkg_short_errors_supported=no
1165 + if test $_pkg_short_errors_supported = yes; then
1166 + RPM_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "rpm" 2>&1`
1168 + RPM_PKG_ERRORS=`$PKG_CONFIG --print-errors "rpm" 2>&1`
1170 + # Put the nasty error message in config.log where it belongs
1171 + echo "$RPM_PKG_ERRORS" >&5
1174 +elif test $pkg_failed = untried; then
1175 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
1176 +$as_echo "no" >&6; }
1179 + RPM_CFLAGS=$pkg_cv_RPM_CFLAGS
1180 + RPM_LIBS=$pkg_cv_RPM_LIBS
1181 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
1182 +$as_echo "yes" >&6; }
1186 + if $HAVE_LIBRPM; then
1188 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking rpm library API compatibility" >&5
1189 +$as_echo_n "checking rpm library API compatibility... " >&6; }
1190 + # The compilation requires -Werror to verify anything.
1191 + save_CFLAGS="$CFLAGS"
1192 + CFLAGS="$CFLAGS -Werror"
1193 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1194 +/* end confdefs.h. */
1196 +/* Duplicate here the declarations to verify they match "elfread.c". */
1197 +#include <rpm/rpmlib.h>
1198 +#include <rpm/rpmts.h>
1199 +#include <rpm/rpmdb.h>
1200 +#include <rpm/header.h>
1201 +extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
1202 +extern int rpmReadConfigFiles(const char * file, const char * target);
1203 +extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
1204 +extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
1205 +extern rpmts rpmtsCreate(void);
1206 +extern rpmts rpmtsFree(rpmts ts);
1207 +extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
1208 + const void * keyp, size_t keylen);
1218 +if ac_fn_c_try_compile "$LINENO"; then :
1220 + LIBRPM_COMPAT=true
1221 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
1222 +$as_echo "yes" >&6; }
1226 + LIBRPM_COMPAT=false
1227 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
1228 +$as_echo "no" >&6; }
1231 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
1232 + CFLAGS="$save_CFLAGS"
1234 + if ! $LIBRPM_COMPAT; then
1236 + RPM_PKG_ERRORS="Found $LIBRPM API is incompatibile with this GDB"
1240 + if $HAVE_LIBRPM; then
1242 +$as_echo "#define HAVE_LIBRPM 1" >>confdefs.h
1244 + CFLAGS="$CFLAGS $RPM_CFLAGS"
1245 + LIBS="$LIBS $RPM_LIBS"
1247 + if $RPM_REQUIRE; then
1248 + as_fn_error "$RPM_PKG_ERRORS" "$LINENO" 5
1250 + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $RPM_PKG_ERRORS" >&5
1251 +$as_echo "$as_me: WARNING: $RPM_PKG_ERRORS" >&2;}
1259 subdirs="$subdirs testsuite"
1260 Index: gdb-7.6/gdb/configure.ac
1261 ===================================================================
1262 --- gdb-7.6.orig/gdb/configure.ac 2013-07-17 19:51:01.666356964 +0200
1263 +++ gdb-7.6/gdb/configure.ac 2013-07-17 19:51:02.692357665 +0200
1264 @@ -166,6 +166,199 @@ AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escap
1265 [Directories safe to hold auto-loaded files.])
1266 AC_MSG_RESULT([$with_auto_load_safe_path])
1268 +# Integration with rpm library to support missing debuginfo suggestions.
1269 +# --without-rpm: Disable any rpm support.
1270 +# --with-rpm=libname.so: Try to dynamically open `libname.so' during runtime.
1271 +# Even with runtime missing `libname.so' GDB will still other run correctly.
1272 +# Missing `libname.so' during ./configure will abort the configuration.
1273 +# --with-rpm=librpm.so: Like `--with-rpm=libname.so' but try to find specific
1274 +# minor version first such as `librpm-4.6.so' as minor version differences
1275 +# mean API+ABI incompatibility. If the specific match versioned library name
1276 +# could not be found still open dynamically at least `librpm.so'.
1277 +# --with-rpm: Like `--with-rpm=librpm.so' but if any of its detection fails try
1278 +# to find librpm for compilation-time linking by pkg-config. GDB binary will
1279 +# be probably linked with the version specific library (as `librpm-4.6.so').
1280 +# Failure to find librpm by pkg-config will abort the configuration.
1281 +# (default) --with-rpm=auto: Like `--with-rpm=librpm.so' but if even pkg-config
1282 +# cannot find librpm use to the rpmless compilation (like `--without-rpm').
1285 + [AS_HELP_STRING([--with-rpm],
1286 + [query rpm database for missing debuginfos (yes/no, def. auto=librpm.so)])], [], [with_rpm="auto"])
1288 +m4_pattern_allow([^AC_MSG_ERROR$])
1289 +m4_pattern_allow([^AC_MSG_WARN$])
1290 +if test "x$with_rpm" != "xno"; then
1291 + if test "x$with_rpm" = "xyes"; then
1292 + LIBRPM="librpm.so"
1294 + DLOPEN_REQUIRE=false
1295 + elif test "x$with_rpm" = "xauto"; then
1296 + LIBRPM="librpm.so"
1298 + DLOPEN_REQUIRE=false
1300 + LIBRPM="$with_rpm"
1302 + DLOPEN_REQUIRE=true
1304 + LIBRPM_STRING='"'"$LIBRPM"'"'
1306 + AC_MSG_CHECKING([specific librpm version])
1307 + HAVE_DLOPEN_LIBRPM=false
1310 + AC_RUN_IFELSE(AC_LANG_PROGRAM([[
1311 +#include <rpm/rpmlib.h>
1316 + const char *const *rpmverp;
1319 + f = fopen ("conftest.out", "w");
1322 + fprintf (stderr, "Cannot write \"%s\": %s\n", "conftest.out",
1323 + strerror (errno));
1326 + h = dlopen ($LIBRPM_STRING, RTLD_LAZY);
1329 + fprintf (stderr, "dlopen (\"%s\"): %s\n", $LIBRPM_STRING, dlerror ());
1332 + rpmverp = dlsym (h, "RPMVERSION");
1335 + fprintf (stderr, "dlsym (\"RPMVERSION\"): %s\n", dlerror ());
1338 + fprintf (stderr, "RPMVERSION is: \"");
1339 + fprintf (stderr, "%s\"\n", *rpmverp);
1341 + /* Try to find the specific librpm version only for "librpm.so" as we do
1342 + not know how to assemble the version string otherwise. */
1344 + if (strcmp ("librpm.so", $LIBRPM_STRING) != 0)
1346 + fprintf (f, "%s\n", $LIBRPM_STRING);
1355 + if (sscanf (*rpmverp, "%d.%d", &major, &minor) != 2)
1357 + fprintf (stderr, "Unable to parse RPMVERSION.\n");
1358 + fprintf (f, "%s\n", $LIBRPM_STRING);
1361 + /* Avoid the square brackets by malloc. */
1362 + h2_name = malloc (64);
1363 + sprintf (h2_name, "librpm-%d.%d.so", major, minor);
1364 + h2 = dlopen (h2_name, RTLD_LAZY);
1367 + fprintf (stderr, "dlopen (\"%s\"): %s\n", h2_name, dlerror ());
1368 + fprintf (f, "%s\n", $LIBRPM_STRING);
1373 + fprintf (stderr, "dlopen of \"%s\" and \"%s\" are different.\n",
1374 + $LIBRPM_STRING, h2_name);
1375 + fprintf (f, "%s\n", $LIBRPM_STRING);
1378 + /* Found the valid .so name with a specific version. */
1379 + fprintf (f, "%s\n", h2_name);
1383 + DLOPEN_LIBRPM="`cat conftest.out`"
1384 + if test "x$DLOPEN_LIBRPM" != "x"; then
1385 + HAVE_DLOPEN_LIBRPM=true
1386 + AC_MSG_RESULT($DLOPEN_LIBRPM)
1389 + rm -f conftest.out
1391 + m4_define([CHECK_LIBRPM_COMPAT], [
1392 + AC_MSG_CHECKING([rpm library API compatibility])
1393 + # The compilation requires -Werror to verify anything.
1394 + save_CFLAGS="$CFLAGS"
1395 + CFLAGS="$CFLAGS -Werror"
1396 + AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[
1397 +/* Duplicate here the declarations to verify they match "elfread.c". */
1398 +#include <rpm/rpmlib.h>
1399 +#include <rpm/rpmts.h>
1400 +#include <rpm/rpmdb.h>
1401 +#include <rpm/header.h>
1402 +extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
1403 +extern int rpmReadConfigFiles(const char * file, const char * target);
1404 +extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
1405 +extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
1406 +extern rpmts rpmtsCreate(void);
1407 +extern rpmts rpmtsFree(rpmts ts);
1408 +extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
1409 + const void * keyp, size_t keylen);
1411 + LIBRPM_COMPAT=true
1412 + AC_MSG_RESULT(yes)
1414 + LIBRPM_COMPAT=false
1417 + CFLAGS="$save_CFLAGS"
1420 + if $HAVE_DLOPEN_LIBRPM; then
1421 + CHECK_LIBRPM_COMPAT
1422 + if ! $LIBRPM_COMPAT; then
1423 + HAVE_DLOPEN_LIBRPM=false
1427 + if $HAVE_DLOPEN_LIBRPM; then
1428 + DLOPEN_LIBRPM_STRING='"'"$DLOPEN_LIBRPM"'"'
1429 + AC_DEFINE_UNQUOTED(DLOPEN_LIBRPM, $DLOPEN_LIBRPM_STRING, [librpm version specific library name to dlopen.])
1430 + AC_DEFINE(HAVE_LIBRPM, 1, [Define if librpm library is being used.])
1434 + if $DLOPEN_REQUIRE; then
1435 + AC_MSG_ERROR([Specific name $LIBRPM was requested but it could not be opened.])
1437 + PKG_CHECK_MODULES(RPM, rpm, [HAVE_LIBRPM=true], [HAVE_LIBRPM=false])
1439 + if $HAVE_LIBRPM; then
1440 + CHECK_LIBRPM_COMPAT
1441 + if ! $LIBRPM_COMPAT; then
1443 + RPM_PKG_ERRORS="Found $LIBRPM API is incompatibile with this GDB"
1447 + if $HAVE_LIBRPM; then
1448 + AC_DEFINE(HAVE_LIBRPM, 1, [Define if librpm library is being used.])
1449 + CFLAGS="$CFLAGS $RPM_CFLAGS"
1450 + LIBS="$LIBS $RPM_LIBS"
1452 + if $RPM_REQUIRE; then
1453 + AC_MSG_ERROR($RPM_PKG_ERRORS)
1455 + AC_MSG_WARN($RPM_PKG_ERRORS)
1461 AC_CONFIG_SUBDIRS(testsuite)
1463 # Check whether to support alternative target configurations
1464 Index: gdb-7.6/gdb/corelow.c
1465 ===================================================================
1466 --- gdb-7.6.orig/gdb/corelow.c 2013-07-17 19:51:02.608357607 +0200
1467 +++ gdb-7.6/gdb/corelow.c 2013-07-17 19:51:02.692357665 +0200
1468 @@ -314,7 +314,7 @@ build_id_locate_exec (int from_tty)
1469 symfile_objfile->flags |= OBJF_BUILD_ID_CORE_LOADED;
1472 - debug_print_missing (_("the main executable file"), build_id_filename);
1473 + debug_print_missing (BUILD_ID_MAIN_EXECUTABLE_FILENAME, build_id_filename);
1475 do_cleanups (back_to);