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