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