1 Index: gdb-7.2/gdb/event-top.c
2 ===================================================================
3 --- gdb-7.2.orig/gdb/event-top.c 2010-06-26 08:44:47.000000000 +0200
4 +++ gdb-7.2/gdb/event-top.c 2010-10-06 22:39:32.000000000 +0200
6 #include "cli/cli-script.h" /* for reset_command_nest_depth */
11 /* For dont_repeat() */
13 @@ -193,6 +194,8 @@ cli_command_loop (void)
15 char *gdb_prompt = get_prompt ();
17 + debug_flush_missing ();
19 /* Tell readline what the prompt to display is and what function it
20 will need to call after a whole line is read. This also displays
22 @@ -264,6 +267,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.2/gdb/elfread.c
32 ===================================================================
33 --- gdb-7.2.orig/gdb/elfread.c 2010-10-06 22:39:32.000000000 +0200
34 +++ gdb-7.2/gdb/elfread.c 2010-10-06 22:39:52.000000000 +0200
39 +#include "elf/external.h"
41 extern void _initialize_elfread (void);
43 @@ -1371,8 +1372,361 @@ build_id_to_filename (struct build_id *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 --disablerepo='*' --enablerepo='*-debuginfo' \
262 + install NAME-debuginfo.ARCH
263 + would be more complicated than just:
264 + debuginfo-install NAME-VERSION-RELEASE.ARCH
265 + Do not supply the rpm base name (derived from .src.rpm name) as
266 + debuginfo-install is unable to install the debuginfo package if
267 + the base name PKG binary rpm is not installed while for example
268 + PKG-libs would be installed (RH Bug 467901).
269 + FUTURE: After multiple debuginfo versions simultaneously installed
270 + get supported the support for the VERSION-RELEASE tags handling
271 + may need an update. */
273 + if (missing_rpm_hash == NULL)
275 + /* DEL_F is passed NULL as MISSING_RPM_LIST's HTAB_DELETE
276 + should not deallocate the entries. */
278 + missing_rpm_hash = htab_create_alloc (64, htab_hash_string,
279 + (int (*) (const void *, const void *)) streq,
280 + NULL, xcalloc, xfree);
282 + slot = (char **) htab_find_slot (missing_rpm_hash, debuginfo, INSERT);
283 + /* XCALLOC never returns NULL. */
284 + gdb_assert (slot != NULL);
287 + struct missing_rpm *missing_rpm;
291 + missing_rpm = xmalloc (sizeof (*missing_rpm) + strlen (debuginfo));
292 + strcpy (missing_rpm->rpm, debuginfo);
293 + missing_rpm->next = missing_rpm_list;
294 + missing_rpm_list = missing_rpm;
295 + missing_rpm_list_entries++;
302 + rpmdbFreeIterator_p (mi);
311 +missing_rpm_list_compar (const char *const *ap, const char *const *bp)
313 + return strcoll (*ap, *bp);
316 +/* It returns a NULL-terminated array of strings needing to be FREEd. It may
317 + also return only NULL. */
320 +missing_rpm_list_print (void)
322 + char **array, **array_iter;
323 + struct missing_rpm *list_iter;
324 + struct cleanup *cleanups;
326 + if (missing_rpm_list_entries == 0)
329 + array = xmalloc (sizeof (*array) * missing_rpm_list_entries);
330 + cleanups = make_cleanup (xfree, array);
332 + array_iter = array;
333 + for (list_iter = missing_rpm_list; list_iter != NULL;
334 + list_iter = list_iter->next)
336 + *array_iter++ = list_iter->rpm;
338 + gdb_assert (array_iter == array + missing_rpm_list_entries);
340 + qsort (array, missing_rpm_list_entries, sizeof (*array),
341 + (int (*) (const void *, const void *)) missing_rpm_list_compar);
343 + printf_unfiltered (_("Missing separate debuginfos, use: %s"),
344 + "debuginfo-install");
345 + for (array_iter = array; array_iter < array + missing_rpm_list_entries;
348 + putchar_unfiltered (' ');
349 + puts_unfiltered (*array_iter);
351 + putchar_unfiltered ('\n');
353 + while (missing_rpm_list != NULL)
355 + list_iter = missing_rpm_list;
356 + missing_rpm_list = list_iter->next;
359 + missing_rpm_list_entries = 0;
361 + do_cleanups (cleanups);
365 +missing_rpm_change (void)
367 + debug_flush_missing ();
369 + gdb_assert (missing_rpm_list == NULL);
370 + if (missing_rpm_hash != NULL)
372 + htab_delete (missing_rpm_hash);
373 + missing_rpm_hash = NULL;
379 + /* Init state. EXEC_BFD also still could be NULL. */
380 + MISSING_EXEC_NOT_TRIED,
381 + /* We saw a non-NULL EXEC_BFD but RPM has no info about it. */
382 + MISSING_EXEC_NOT_FOUND,
383 + /* We found EXEC_BFD by RPM and we either have its symbols (either embedded
384 + or separate) or the main executable's RPM is now contained in
385 + MISSING_RPM_HASH. */
386 + MISSING_EXEC_ENLISTED
388 +static enum missing_exec missing_exec = MISSING_EXEC_NOT_TRIED;
390 +#endif /* HAVE_LIBRPM */
393 +debug_flush_missing (void)
396 + missing_rpm_list_print ();
400 /* This MISSING_FILEPAIR_HASH tracker is used only for the duplicite messages
401 - Try to install the hash file ...
402 + yum --disablerepo='*' --enablerepo='*-debuginfo' install ...
405 struct missing_filepair
406 @@ -1426,11 +1780,17 @@ missing_filepair_change (void)
407 /* All their memory came just from missing_filepair_OBSTACK. */
408 missing_filepair_hash = NULL;
411 + missing_exec = MISSING_EXEC_NOT_TRIED;
416 debug_print_executable_changed (void)
419 + missing_rpm_change ();
421 missing_filepair_change ();
424 @@ -1497,14 +1857,35 @@ debug_print_missing (const char *binary,
426 *slot = missing_filepair;
428 - /* We do not collect and flush these messages as each such message
429 - already requires its own separate lines. */
431 + if (missing_exec == MISSING_EXEC_NOT_TRIED)
433 + char *exec_filename;
435 - fprintf_unfiltered (gdb_stdlog,
436 - _("Missing separate debuginfo for %s\n"), binary);
438 - fprintf_unfiltered (gdb_stdlog, _("Try to install the hash file %s\n"),
440 + exec_filename = get_exec_file (0);
441 + if (exec_filename != NULL)
443 + if (missing_rpm_enlist (exec_filename) == 0)
444 + missing_exec = MISSING_EXEC_NOT_FOUND;
446 + missing_exec = MISSING_EXEC_ENLISTED;
449 + if (missing_exec != MISSING_EXEC_ENLISTED)
450 + if ((binary[0] == 0 || missing_rpm_enlist (binary) == 0)
451 + && (debug == NULL || missing_rpm_enlist (debug) == 0))
452 +#endif /* HAVE_LIBRPM */
454 + /* We do not collect and flush these messages as each such message
455 + already requires its own separate lines. */
457 + fprintf_unfiltered (gdb_stdlog,
458 + _("Missing separate debuginfo for %s\n"), binary);
460 + fprintf_unfiltered (gdb_stdlog, _("Try: %s %s\n"),
461 + "yum --disablerepo='*' --enablerepo='*-debuginfo'"
462 + " install", debug);
467 Index: gdb-7.2/gdb/symfile.h
468 ===================================================================
469 --- gdb-7.2.orig/gdb/symfile.h 2010-10-06 22:39:32.000000000 +0200
470 +++ gdb-7.2/gdb/symfile.h 2010-10-06 22:39:52.000000000 +0200
471 @@ -577,6 +577,8 @@ extern struct build_id *build_id_addr_ge
472 extern char *build_id_to_filename (struct build_id *build_id,
473 char **link_return, int add_debug_suffix);
474 extern void debug_print_missing (const char *binary, const char *debug);
475 +extern void debug_flush_missing (void);
476 +#define BUILD_ID_MAIN_EXECUTABLE_FILENAME _("the main executable file")
478 /* From dwarf2read.c */
480 Index: gdb-7.2/gdb/testsuite/lib/gdb.exp
481 ===================================================================
482 --- gdb-7.2.orig/gdb/testsuite/lib/gdb.exp 2010-10-06 22:39:32.000000000 +0200
483 +++ gdb-7.2/gdb/testsuite/lib/gdb.exp 2010-10-06 22:39:32.000000000 +0200
484 @@ -1359,7 +1359,7 @@ proc default_gdb_start { } {
485 warning "Couldn't set the width to 0."
488 - # Turn off the missing warnings as the testsuite does not expect it.
489 + # Turn off the missing RPMs warnings as the testsuite does not expect it.
490 send_gdb "set build-id-verbose 0\n"
492 -re "$gdb_prompt $" {
493 Index: gdb-7.2/gdb/testsuite/lib/mi-support.exp
494 ===================================================================
495 --- gdb-7.2.orig/gdb/testsuite/lib/mi-support.exp 2010-10-06 22:39:32.000000000 +0200
496 +++ gdb-7.2/gdb/testsuite/lib/mi-support.exp 2010-10-06 22:39:32.000000000 +0200
497 @@ -221,7 +221,7 @@ proc default_mi_gdb_start { args } {
501 - # Turn off the missing warnings as the testsuite does not expect it.
502 + # Turn off the missing RPMs warnings as the testsuite does not expect it.
503 send_gdb "190-gdb-set build-id-verbose 0\n"
505 -re ".*190-gdb-set build-id-verbose 0\r\n190\\\^done\r\n$mi_gdb_prompt$" {
506 Index: gdb-7.2/gdb/tui/tui-interp.c
507 ===================================================================
508 --- gdb-7.2.orig/gdb/tui/tui-interp.c 2010-05-18 00:21:43.000000000 +0200
509 +++ gdb-7.2/gdb/tui/tui-interp.c 2010-10-06 22:39:32.000000000 +0200
512 #include "tui/tui-io.h"
513 #include "exceptions.h"
514 +#include "symfile.h"
516 /* Set to 1 when the TUI mode must be activated when we first start
518 @@ -146,6 +147,8 @@ tui_command_loop (void *data)
520 char *gdb_prompt = get_prompt ();
522 + debug_flush_missing ();
524 /* Tell readline what the prompt to display is and what function
525 it will need to call after a whole line is read. This also
526 displays the first prompt. */
527 Index: gdb-7.2/gdb/aclocal.m4
528 ===================================================================
529 --- gdb-7.2.orig/gdb/aclocal.m4 2010-05-23 02:56:59.000000000 +0200
530 +++ gdb-7.2/gdb/aclocal.m4 2010-10-06 22:39:32.000000000 +0200
531 @@ -19,6 +19,162 @@ You have another version of autoconf. I
532 If you have problems, you may need to regenerate the build system entirely.
533 To do so, use the procedure documented by the package, typically `autoreconf'.])])
535 +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
537 +# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
539 +# This program is free software; you can redistribute it and/or modify
540 +# it under the terms of the GNU General Public License as published by
541 +# the Free Software Foundation; either version 2 of the License, or
542 +# (at your option) any later version.
544 +# This program is distributed in the hope that it will be useful, but
545 +# WITHOUT ANY WARRANTY; without even the implied warranty of
546 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
547 +# General Public License for more details.
549 +# You should have received a copy of the GNU General Public License
550 +# along with this program; if not, write to the Free Software
551 +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
553 +# As a special exception to the GNU General Public License, if you
554 +# distribute this file as part of a program that contains a
555 +# configuration script generated by Autoconf, you may include it under
556 +# the same distribution terms that you use for the rest of that program.
558 +# PKG_PROG_PKG_CONFIG([MIN-VERSION])
559 +# ----------------------------------
560 +AC_DEFUN([PKG_PROG_PKG_CONFIG],
561 +[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
562 +m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
563 +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
564 +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
565 + AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
567 +if test -n "$PKG_CONFIG"; then
568 + _pkg_min_version=m4_default([$1], [0.9.0])
569 + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
570 + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
571 + AC_MSG_RESULT([yes])
573 + AC_MSG_RESULT([no])
578 +])# PKG_PROG_PKG_CONFIG
580 +# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
582 +# Check to see whether a particular set of modules exists. Similar
583 +# to PKG_CHECK_MODULES(), but does not set variables or print errors.
586 +# Similar to PKG_CHECK_MODULES, make sure that the first instance of
587 +# this or PKG_CHECK_MODULES is called, or make sure to call
588 +# PKG_CHECK_EXISTS manually
589 +# --------------------------------------------------------------
590 +AC_DEFUN([PKG_CHECK_EXISTS],
591 +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
592 +if test -n "$PKG_CONFIG" && \
593 + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
594 + m4_ifval([$2], [$2], [:])
595 +m4_ifvaln([$3], [else
600 +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
601 +# ---------------------------------------------
602 +m4_define([_PKG_CONFIG],
603 +[if test -n "$$1"; then
605 + elif test -n "$PKG_CONFIG"; then
606 + PKG_CHECK_EXISTS([$3],
607 + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
614 +# _PKG_SHORT_ERRORS_SUPPORTED
615 +# -----------------------------
616 +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
617 +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
618 +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
619 + _pkg_short_errors_supported=yes
621 + _pkg_short_errors_supported=no
623 +])# _PKG_SHORT_ERRORS_SUPPORTED
626 +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
627 +# [ACTION-IF-NOT-FOUND])
630 +# Note that if there is a possibility the first call to
631 +# PKG_CHECK_MODULES might not happen, you should be sure to include an
632 +# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
635 +# --------------------------------------------------------------
636 +AC_DEFUN([PKG_CHECK_MODULES],
637 +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
638 +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
639 +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
642 +AC_MSG_CHECKING([for $1])
644 +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
645 +_PKG_CONFIG([$1][_LIBS], [libs], [$2])
647 +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
648 +and $1[]_LIBS to avoid the need to call pkg-config.
649 +See the pkg-config man page for more details.])
651 +if test $pkg_failed = yes; then
652 + _PKG_SHORT_ERRORS_SUPPORTED
653 + if test $_pkg_short_errors_supported = yes; then
654 + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
656 + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
658 + # Put the nasty error message in config.log where it belongs
659 + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
661 + ifelse([$4], , [AC_MSG_ERROR(dnl
662 +[Package requirements ($2) were not met:
666 +Consider adjusting the PKG_CONFIG_PATH environment variable if you
667 +installed software in a non-standard prefix.
671 + [AC_MSG_RESULT([no])
673 +elif test $pkg_failed = untried; then
674 + ifelse([$4], , [AC_MSG_FAILURE(dnl
675 +[The pkg-config script could not be found or is too old. Make sure it
676 +is in your PATH or set the PKG_CONFIG environment variable to the full
681 +To get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
684 + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
685 + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
686 + AC_MSG_RESULT([yes])
687 + ifelse([$3], , :, [$3])
689 +])# PKG_CHECK_MODULES
691 # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
693 # This file is free software; the Free Software Foundation
694 Index: gdb-7.2/gdb/config.in
695 ===================================================================
696 --- gdb-7.2.orig/gdb/config.in 2010-10-06 22:39:31.000000000 +0200
697 +++ gdb-7.2/gdb/config.in 2010-10-06 22:39:32.000000000 +0200
699 /* Define to BFD's default target vector. */
700 #undef DEFAULT_BFD_VEC
702 +/* librpm version specific library name to dlopen. */
703 +#undef DLOPEN_LIBRPM
705 /* Define to 1 if translation of program messages to the user's native
706 language is requested. */
709 /* Define if Python 2.7 is being used. */
710 #undef HAVE_LIBPYTHON2_7
712 +/* Define if librpm library is being used. */
715 /* Define if libunwind library is being used. */
716 #undef HAVE_LIBUNWIND
718 Index: gdb-7.2/gdb/configure
719 ===================================================================
720 --- gdb-7.2.orig/gdb/configure 2010-10-06 22:39:31.000000000 +0200
721 +++ gdb-7.2/gdb/configure 2010-10-06 22:39:32.000000000 +0200
722 @@ -679,6 +679,9 @@ REPORT_BUGS_TO
732 @@ -948,6 +951,7 @@ with_separate_debug_dir
734 with_relocated_sources
740 @@ -988,6 +992,9 @@ LDFLAGS
750 @@ -1653,6 +1660,8 @@ Optional Packages:
752 --with-pythondir install Python data files in this path
754 + --with-rpm query rpm database for missing debuginfos (yes/no,
755 + def. auto=librpm.so)
756 --with-libunwind use libunwind frame unwinding support
757 --with-curses use the curses library instead of the termcap
759 @@ -1688,6 +1697,9 @@ Some influential environment variables:
760 CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
761 you have headers in a nonstandard directory <include dir>
763 + PKG_CONFIG path to pkg-config utility
764 + RPM_CFLAGS C compiler flags for RPM, overriding pkg-config
765 + RPM_LIBS linker flags for RPM, overriding pkg-config
766 YACC The `Yet Another C Compiler' implementation to use. Defaults to
767 the first program found out of: `bison -y', `byacc', `yacc'.
768 YFLAGS The list of arguments that will be passed by default to $YACC.
769 @@ -7951,6 +7963,485 @@ _ACEOF
773 +# Integration with rpm library to support missing debuginfo suggestions.
774 +# --without-rpm: Disable any rpm support.
775 +# --with-rpm=libname.so: Try to dynamically open `libname.so' during runtime.
776 +# Even with runtime missing `libname.so' GDB will still other run correctly.
777 +# Missing `libname.so' during ./configure will abort the configuration.
778 +# --with-rpm=librpm.so: Like `--with-rpm=libname.so' but try to find specific
779 +# minor version first such as `librpm-4.6.so' as minor version differences
780 +# mean API+ABI incompatibility. If the specific match versioned library name
781 +# could not be found still open dynamically at least `librpm.so'.
782 +# --with-rpm: Like `--with-rpm=librpm.so' but if any of its detection fails try
783 +# to find librpm for compilation-time linking by pkg-config. GDB binary will
784 +# be probably linked with the version specific library (as `librpm-4.6.so').
785 +# Failure to find librpm by pkg-config will abort the configuration.
786 +# (default) --with-rpm=auto: Like `--with-rpm=librpm.so' but if even pkg-config
787 +# cannot find librpm use to the rpmless compilation (like `--without-rpm').
790 +# Check whether --with-rpm was given.
791 +if test "${with_rpm+set}" = set; then :
800 +if test "x$with_rpm" != "xno"; then
801 + if test "x$with_rpm" = "xyes"; then
804 + DLOPEN_REQUIRE=false
805 + elif test "x$with_rpm" = "xauto"; then
808 + DLOPEN_REQUIRE=false
812 + DLOPEN_REQUIRE=true
814 + LIBRPM_STRING='"'"$LIBRPM"'"'
816 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking specific librpm version" >&5
817 +$as_echo_n "checking specific librpm version... " >&6; }
818 + HAVE_DLOPEN_LIBRPM=false
821 + if test "$cross_compiling" = yes; then :
822 + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
823 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
824 +as_fn_error "cannot run test program while cross compiling
825 +See \`config.log' for more details." "$LINENO" 5; }
827 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext
828 +/* end confdefs.h. */
830 +#include <rpm/rpmlib.h>
839 + const char *const *rpmverp;
842 + f = fopen ("conftest.out", "w");
845 + fprintf (stderr, "Cannot write \"%s\": %s\n", "conftest.out",
849 + h = dlopen ($LIBRPM_STRING, RTLD_LAZY);
852 + fprintf (stderr, "dlopen (\"%s\"): %s\n", $LIBRPM_STRING, dlerror ());
855 + rpmverp = dlsym (h, "RPMVERSION");
858 + fprintf (stderr, "dlsym (\"RPMVERSION\"): %s\n", dlerror ());
861 + fprintf (stderr, "RPMVERSION is: \"");
862 + fprintf (stderr, "%s\"\n", *rpmverp);
864 + /* Try to find the specific librpm version only for "librpm.so" as we do
865 + not know how to assemble the version string otherwise. */
867 + if (strcmp ("librpm.so", $LIBRPM_STRING) != 0)
869 + fprintf (f, "%s\n", $LIBRPM_STRING);
878 + if (sscanf (*rpmverp, "%d.%d", &major, &minor) != 2)
880 + fprintf (stderr, "Unable to parse RPMVERSION.\n");
881 + fprintf (f, "%s\n", $LIBRPM_STRING);
884 + /* Avoid the square brackets by malloc. */
885 + h2_name = malloc (64);
886 + sprintf (h2_name, "librpm-%d.%d.so", major, minor);
887 + h2 = dlopen (h2_name, RTLD_LAZY);
890 + fprintf (stderr, "dlopen (\"%s\"): %s\n", h2_name, dlerror ());
891 + fprintf (f, "%s\n", $LIBRPM_STRING);
896 + fprintf (stderr, "dlopen of \"%s\" and \"%s\" are different.\n",
897 + $LIBRPM_STRING, h2_name);
898 + fprintf (f, "%s\n", $LIBRPM_STRING);
901 + /* Found the valid .so name with a specific version. */
902 + fprintf (f, "%s\n", h2_name);
910 +if ac_fn_c_try_run "$LINENO"; then :
912 + DLOPEN_LIBRPM="`cat conftest.out`"
913 + if test "x$DLOPEN_LIBRPM" != "x"; then
914 + HAVE_DLOPEN_LIBRPM=true
915 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLOPEN_LIBRPM" >&5
916 +$as_echo "$DLOPEN_LIBRPM" >&6; }
920 +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
921 + conftest.$ac_objext conftest.beam conftest.$ac_ext
928 + if $HAVE_DLOPEN_LIBRPM; then
930 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking rpm library API compatibility" >&5
931 +$as_echo_n "checking rpm library API compatibility... " >&6; }
932 + # The compilation requires -Werror to verify anything.
933 + save_CFLAGS="$CFLAGS"
934 + CFLAGS="$CFLAGS -Werror"
935 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext
936 +/* end confdefs.h. */
938 +/* Duplicate here the declarations to verify they match "elfread.c". */
939 +#include <rpm/rpmlib.h>
940 +#include <rpm/rpmts.h>
941 +#include <rpm/rpmdb.h>
942 +#include <rpm/header.h>
943 +extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
944 +extern int rpmReadConfigFiles(const char * file, const char * target);
945 +extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
946 +extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
947 +extern rpmts rpmtsCreate(void);
948 +extern rpmts rpmtsFree(rpmts ts);
949 +extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
950 + const void * keyp, size_t keylen);
960 +if ac_fn_c_try_compile "$LINENO"; then :
963 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
964 +$as_echo "yes" >&6; }
968 + LIBRPM_COMPAT=false
969 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
970 +$as_echo "no" >&6; }
973 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
974 + CFLAGS="$save_CFLAGS"
976 + if ! $LIBRPM_COMPAT; then
977 + HAVE_DLOPEN_LIBRPM=false
981 + if $HAVE_DLOPEN_LIBRPM; then
982 + DLOPEN_LIBRPM_STRING='"'"$DLOPEN_LIBRPM"'"'
984 +cat >>confdefs.h <<_ACEOF
985 +#define DLOPEN_LIBRPM $DLOPEN_LIBRPM_STRING
989 +$as_echo "#define HAVE_LIBRPM 1" >>confdefs.h
992 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
993 +$as_echo "no" >&6; }
995 + if $DLOPEN_REQUIRE; then
996 + as_fn_error "Specific name $LIBRPM was requested but it could not be opened." "$LINENO" 5
1000 +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1001 + if test -n "$ac_tool_prefix"; then
1002 + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
1003 +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
1004 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
1005 +$as_echo_n "checking for $ac_word... " >&6; }
1006 +if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
1007 + $as_echo_n "(cached) " >&6
1009 + case $PKG_CONFIG in
1010 + [\\/]* | ?:[\\/]*)
1011 + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
1014 + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1015 +for as_dir in $PATH
1018 + test -z "$as_dir" && as_dir=.
1019 + for ac_exec_ext in '' $ac_executable_extensions; do
1020 + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
1021 + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
1022 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
1032 +PKG_CONFIG=$ac_cv_path_PKG_CONFIG
1033 +if test -n "$PKG_CONFIG"; then
1034 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
1035 +$as_echo "$PKG_CONFIG" >&6; }
1037 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
1038 +$as_echo "no" >&6; }
1043 +if test -z "$ac_cv_path_PKG_CONFIG"; then
1044 + ac_pt_PKG_CONFIG=$PKG_CONFIG
1045 + # Extract the first word of "pkg-config", so it can be a program name with args.
1046 +set dummy pkg-config; ac_word=$2
1047 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
1048 +$as_echo_n "checking for $ac_word... " >&6; }
1049 +if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then :
1050 + $as_echo_n "(cached) " >&6
1052 + case $ac_pt_PKG_CONFIG in
1053 + [\\/]* | ?:[\\/]*)
1054 + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
1057 + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1058 +for as_dir in $PATH
1061 + test -z "$as_dir" && as_dir=.
1062 + for ac_exec_ext in '' $ac_executable_extensions; do
1063 + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
1064 + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
1065 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
1075 +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
1076 +if test -n "$ac_pt_PKG_CONFIG"; then
1077 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
1078 +$as_echo "$ac_pt_PKG_CONFIG" >&6; }
1080 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
1081 +$as_echo "no" >&6; }
1084 + if test "x$ac_pt_PKG_CONFIG" = x; then
1087 + case $cross_compiling:$ac_tool_warned in
1089 +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
1090 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
1091 +ac_tool_warned=yes ;;
1093 + PKG_CONFIG=$ac_pt_PKG_CONFIG
1096 + PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
1100 +if test -n "$PKG_CONFIG"; then
1101 + _pkg_min_version=0.9.0
1102 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
1103 +$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
1104 + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1105 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
1106 +$as_echo "yes" >&6; }
1108 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
1109 +$as_echo "no" >&6; }
1116 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for RPM" >&5
1117 +$as_echo_n "checking for RPM... " >&6; }
1119 +if test -n "$RPM_CFLAGS"; then
1120 + pkg_cv_RPM_CFLAGS="$RPM_CFLAGS"
1121 + elif test -n "$PKG_CONFIG"; then
1122 + if test -n "$PKG_CONFIG" && \
1123 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"rpm\""; } >&5
1124 + ($PKG_CONFIG --exists --print-errors "rpm") 2>&5
1126 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
1127 + test $ac_status = 0; }; then
1128 + pkg_cv_RPM_CFLAGS=`$PKG_CONFIG --cflags "rpm" 2>/dev/null`
1133 + pkg_failed=untried
1135 +if test -n "$RPM_LIBS"; then
1136 + pkg_cv_RPM_LIBS="$RPM_LIBS"
1137 + elif test -n "$PKG_CONFIG"; then
1138 + if test -n "$PKG_CONFIG" && \
1139 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"rpm\""; } >&5
1140 + ($PKG_CONFIG --exists --print-errors "rpm") 2>&5
1142 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
1143 + test $ac_status = 0; }; then
1144 + pkg_cv_RPM_LIBS=`$PKG_CONFIG --libs "rpm" 2>/dev/null`
1149 + pkg_failed=untried
1154 +if test $pkg_failed = yes; then
1156 +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1157 + _pkg_short_errors_supported=yes
1159 + _pkg_short_errors_supported=no
1161 + if test $_pkg_short_errors_supported = yes; then
1162 + RPM_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "rpm" 2>&1`
1164 + RPM_PKG_ERRORS=`$PKG_CONFIG --print-errors "rpm" 2>&1`
1166 + # Put the nasty error message in config.log where it belongs
1167 + echo "$RPM_PKG_ERRORS" >&5
1169 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
1170 +$as_echo "no" >&6; }
1172 +elif test $pkg_failed = untried; then
1175 + RPM_CFLAGS=$pkg_cv_RPM_CFLAGS
1176 + RPM_LIBS=$pkg_cv_RPM_LIBS
1177 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
1178 +$as_echo "yes" >&6; }
1182 + if $HAVE_LIBRPM; then
1184 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking rpm library API compatibility" >&5
1185 +$as_echo_n "checking rpm library API compatibility... " >&6; }
1186 + # The compilation requires -Werror to verify anything.
1187 + save_CFLAGS="$CFLAGS"
1188 + CFLAGS="$CFLAGS -Werror"
1189 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1190 +/* end confdefs.h. */
1192 +/* Duplicate here the declarations to verify they match "elfread.c". */
1193 +#include <rpm/rpmlib.h>
1194 +#include <rpm/rpmts.h>
1195 +#include <rpm/rpmdb.h>
1196 +#include <rpm/header.h>
1197 +extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
1198 +extern int rpmReadConfigFiles(const char * file, const char * target);
1199 +extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
1200 +extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
1201 +extern rpmts rpmtsCreate(void);
1202 +extern rpmts rpmtsFree(rpmts ts);
1203 +extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
1204 + const void * keyp, size_t keylen);
1214 +if ac_fn_c_try_compile "$LINENO"; then :
1216 + LIBRPM_COMPAT=true
1217 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
1218 +$as_echo "yes" >&6; }
1222 + LIBRPM_COMPAT=false
1223 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
1224 +$as_echo "no" >&6; }
1227 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
1228 + CFLAGS="$save_CFLAGS"
1230 + if ! $LIBRPM_COMPAT; then
1232 + RPM_PKG_ERRORS="Found $LIBRPM API is incompatibile with this GDB"
1236 + if $HAVE_LIBRPM; then
1238 +$as_echo "#define HAVE_LIBRPM 1" >>confdefs.h
1240 + CFLAGS="$CFLAGS $RPM_CFLAGS"
1241 + LIBS="$LIBS $RPM_LIBS"
1243 + if $RPM_REQUIRE; then
1244 + as_fn_error "$RPM_PKG_ERRORS" "$LINENO" 5
1246 + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $RPM_PKG_ERRORS" >&5
1247 +$as_echo "$as_me: WARNING: $RPM_PKG_ERRORS" >&2;}
1255 Index: gdb-7.2/gdb/configure.ac
1256 ===================================================================
1257 --- gdb-7.2.orig/gdb/configure.ac 2010-10-06 22:39:31.000000000 +0200
1258 +++ gdb-7.2/gdb/configure.ac 2010-10-06 22:39:32.000000000 +0200
1259 @@ -152,6 +152,198 @@ else
1263 +# Integration with rpm library to support missing debuginfo suggestions.
1264 +# --without-rpm: Disable any rpm support.
1265 +# --with-rpm=libname.so: Try to dynamically open `libname.so' during runtime.
1266 +# Even with runtime missing `libname.so' GDB will still other run correctly.
1267 +# Missing `libname.so' during ./configure will abort the configuration.
1268 +# --with-rpm=librpm.so: Like `--with-rpm=libname.so' but try to find specific
1269 +# minor version first such as `librpm-4.6.so' as minor version differences
1270 +# mean API+ABI incompatibility. If the specific match versioned library name
1271 +# could not be found still open dynamically at least `librpm.so'.
1272 +# --with-rpm: Like `--with-rpm=librpm.so' but if any of its detection fails try
1273 +# to find librpm for compilation-time linking by pkg-config. GDB binary will
1274 +# be probably linked with the version specific library (as `librpm-4.6.so').
1275 +# Failure to find librpm by pkg-config will abort the configuration.
1276 +# (default) --with-rpm=auto: Like `--with-rpm=librpm.so' but if even pkg-config
1277 +# cannot find librpm use to the rpmless compilation (like `--without-rpm').
1280 + [AS_HELP_STRING([--with-rpm],
1281 + [query rpm database for missing debuginfos (yes/no, def. auto=librpm.so)])], [], [with_rpm="auto"])
1283 +m4_pattern_allow([^AC_MSG_ERROR$])
1284 +m4_pattern_allow([^AC_MSG_WARN$])
1285 +if test "x$with_rpm" != "xno"; then
1286 + if test "x$with_rpm" = "xyes"; then
1287 + LIBRPM="librpm.so"
1289 + DLOPEN_REQUIRE=false
1290 + elif test "x$with_rpm" = "xauto"; then
1291 + LIBRPM="librpm.so"
1293 + DLOPEN_REQUIRE=false
1295 + LIBRPM="$with_rpm"
1297 + DLOPEN_REQUIRE=true
1299 + LIBRPM_STRING='"'"$LIBRPM"'"'
1301 + AC_MSG_CHECKING([specific librpm version])
1302 + HAVE_DLOPEN_LIBRPM=false
1305 + AC_RUN_IFELSE(AC_LANG_PROGRAM([[
1306 +#include <rpm/rpmlib.h>
1311 + const char *const *rpmverp;
1314 + f = fopen ("conftest.out", "w");
1317 + fprintf (stderr, "Cannot write \"%s\": %s\n", "conftest.out",
1318 + strerror (errno));
1321 + h = dlopen ($LIBRPM_STRING, RTLD_LAZY);
1324 + fprintf (stderr, "dlopen (\"%s\"): %s\n", $LIBRPM_STRING, dlerror ());
1327 + rpmverp = dlsym (h, "RPMVERSION");
1330 + fprintf (stderr, "dlsym (\"RPMVERSION\"): %s\n", dlerror ());
1333 + fprintf (stderr, "RPMVERSION is: \"");
1334 + fprintf (stderr, "%s\"\n", *rpmverp);
1336 + /* Try to find the specific librpm version only for "librpm.so" as we do
1337 + not know how to assemble the version string otherwise. */
1339 + if (strcmp ("librpm.so", $LIBRPM_STRING) != 0)
1341 + fprintf (f, "%s\n", $LIBRPM_STRING);
1350 + if (sscanf (*rpmverp, "%d.%d", &major, &minor) != 2)
1352 + fprintf (stderr, "Unable to parse RPMVERSION.\n");
1353 + fprintf (f, "%s\n", $LIBRPM_STRING);
1356 + /* Avoid the square brackets by malloc. */
1357 + h2_name = malloc (64);
1358 + sprintf (h2_name, "librpm-%d.%d.so", major, minor);
1359 + h2 = dlopen (h2_name, RTLD_LAZY);
1362 + fprintf (stderr, "dlopen (\"%s\"): %s\n", h2_name, dlerror ());
1363 + fprintf (f, "%s\n", $LIBRPM_STRING);
1368 + fprintf (stderr, "dlopen of \"%s\" and \"%s\" are different.\n",
1369 + $LIBRPM_STRING, h2_name);
1370 + fprintf (f, "%s\n", $LIBRPM_STRING);
1373 + /* Found the valid .so name with a specific version. */
1374 + fprintf (f, "%s\n", h2_name);
1378 + DLOPEN_LIBRPM="`cat conftest.out`"
1379 + if test "x$DLOPEN_LIBRPM" != "x"; then
1380 + HAVE_DLOPEN_LIBRPM=true
1381 + AC_MSG_RESULT($DLOPEN_LIBRPM)
1384 + rm -f conftest.out
1386 + m4_define([CHECK_LIBRPM_COMPAT], [
1387 + AC_MSG_CHECKING([rpm library API compatibility])
1388 + # The compilation requires -Werror to verify anything.
1389 + save_CFLAGS="$CFLAGS"
1390 + CFLAGS="$CFLAGS -Werror"
1391 + AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[
1392 +/* Duplicate here the declarations to verify they match "elfread.c". */
1393 +#include <rpm/rpmlib.h>
1394 +#include <rpm/rpmts.h>
1395 +#include <rpm/rpmdb.h>
1396 +#include <rpm/header.h>
1397 +extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
1398 +extern int rpmReadConfigFiles(const char * file, const char * target);
1399 +extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
1400 +extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
1401 +extern rpmts rpmtsCreate(void);
1402 +extern rpmts rpmtsFree(rpmts ts);
1403 +extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
1404 + const void * keyp, size_t keylen);
1406 + LIBRPM_COMPAT=true
1407 + AC_MSG_RESULT(yes)
1409 + LIBRPM_COMPAT=false
1412 + CFLAGS="$save_CFLAGS"
1415 + if $HAVE_DLOPEN_LIBRPM; then
1416 + CHECK_LIBRPM_COMPAT
1417 + if ! $LIBRPM_COMPAT; then
1418 + HAVE_DLOPEN_LIBRPM=false
1422 + if $HAVE_DLOPEN_LIBRPM; then
1423 + DLOPEN_LIBRPM_STRING='"'"$DLOPEN_LIBRPM"'"'
1424 + AC_DEFINE_UNQUOTED(DLOPEN_LIBRPM, $DLOPEN_LIBRPM_STRING, [librpm version specific library name to dlopen.])
1425 + AC_DEFINE(HAVE_LIBRPM, 1, [Define if librpm library is being used.])
1429 + if $DLOPEN_REQUIRE; then
1430 + AC_MSG_ERROR([Specific name $LIBRPM was requested but it could not be opened.])
1432 + PKG_CHECK_MODULES(RPM, rpm, [HAVE_LIBRPM=true], [HAVE_LIBRPM=false])
1434 + if $HAVE_LIBRPM; then
1435 + CHECK_LIBRPM_COMPAT
1436 + if ! $LIBRPM_COMPAT; then
1438 + RPM_PKG_ERRORS="Found $LIBRPM API is incompatibile with this GDB"
1442 + if $HAVE_LIBRPM; then
1443 + AC_DEFINE(HAVE_LIBRPM, 1, [Define if librpm library is being used.])
1444 + CFLAGS="$CFLAGS $RPM_CFLAGS"
1445 + LIBS="$LIBS $RPM_LIBS"
1447 + if $RPM_REQUIRE; then
1448 + AC_MSG_ERROR($RPM_PKG_ERRORS)
1450 + AC_MSG_WARN($RPM_PKG_ERRORS)
1456 AC_CONFIG_SUBDIRS(doc testsuite)
1458 Index: gdb-7.2/gdb/acinclude.m4
1459 ===================================================================
1460 --- gdb-7.2.orig/gdb/acinclude.m4 2010-05-27 05:40:45.000000000 +0200
1461 +++ gdb-7.2/gdb/acinclude.m4 2010-10-06 22:39:32.000000000 +0200
1465 dnl written by Rob Savoye <rob@cygnus.com> for Cygnus Support
1466 dnl major rewriting for Tcl 7.5 by Don Libes <libes@nist.gov>
1468 @@ -81,8 +83,6 @@ AC_MSG_RESULT(yes)
1469 # Foundation, Inc., 51 Franklin Street, Fifth Floor,
1470 # Boston, MA 02110-1301, USA.
1474 # @defmac AC_PROG_CC_STDC
1475 # @maindex PROG_CC_STDC
1477 Index: gdb-7.2/gdb/corelow.c
1478 ===================================================================
1479 --- gdb-7.2.orig/gdb/corelow.c 2010-10-06 22:39:39.000000000 +0200
1480 +++ gdb-7.2/gdb/corelow.c 2010-10-06 22:39:52.000000000 +0200
1481 @@ -331,7 +331,7 @@ build_id_locate_exec (int from_tty)
1482 symfile_objfile->flags |= OBJF_BUILD_ID_CORE_LOADED;
1485 - debug_print_missing (_("the main executable file"), build_id_filename);
1486 + debug_print_missing (BUILD_ID_MAIN_EXECUTABLE_FILENAME, build_id_filename);
1488 do_cleanups (back_to);