]> git.pld-linux.org Git - packages/gdb.git/blame - gdb-6.6-buildid-locate-rpm.patch
- update some patches from gdb-7.2-51.fc14 (this fixes at least artifical arrays...
[packages/gdb.git] / gdb-6.6-buildid-locate-rpm.patch
CommitLineData
e5178960 1Index: gdb-7.2/gdb/event-top.c
3a58abaf 2===================================================================
e5178960
PS
3--- gdb-7.2.orig/gdb/event-top.c 2010-06-26 08:44:47.000000000 +0200
4+++ gdb-7.2/gdb/event-top.c 2010-10-06 22:39:32.000000000 +0200
3a58abaf
AM
5@@ -33,6 +33,7 @@
6 #include "cli/cli-script.h" /* for reset_command_nest_depth */
7 #include "main.h"
8 #include "gdbthread.h"
9+#include "symfile.h"
10
11 /* For dont_repeat() */
12 #include "gdbcmd.h"
13@@ -193,6 +194,8 @@ cli_command_loop (void)
14 char *a_prompt;
15 char *gdb_prompt = get_prompt ();
16
17+ debug_flush_missing ();
18+
19 /* Tell readline what the prompt to display is and what function it
20 will need to call after a whole line is read. This also displays
21 the first prompt. */
22@@ -264,6 +267,8 @@ display_gdb_prompt (char *new_prompt)
23 /* Reset the nesting depth used when trace-commands is set. */
24 reset_command_nest_depth ();
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 ())
e5178960 31Index: gdb-7.2/gdb/elfread.c
3a58abaf 32===================================================================
e5178960
PS
33--- gdb-7.2.orig/gdb/elfread.c 2010-10-06 22:39:32.000000000 +0200
34+++ gdb-7.2/gdb/elfread.c 2010-10-06 22:39:52.000000000 +0200
51a5ef0f
PS
35@@ -42,6 +42,7 @@
36 #include "gdbcore.h"
37 #include "gdbcmd.h"
38 #include "observer.h"
3a58abaf
AM
39+#include "elf/external.h"
40
51a5ef0f 41 extern void _initialize_elfread (void);
3a58abaf 42
e5178960 43@@ -1371,8 +1372,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
51a5ef0f
PS
261+ yum --disablerepo='*' --enablerepo='*-debuginfo' \
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 ...
51a5ef0f 402+ yum --disablerepo='*' --enablerepo='*-debuginfo' install ...
3a58abaf
AM
403 avoidance. */
404
405 struct missing_filepair
e5178960 406@@ -1426,11 +1780,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
e5178960 424@@ -1497,14 +1857,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"),
51a5ef0f
PS
461+ "yum --disablerepo='*' --enablerepo='*-debuginfo'"
462+ " install", debug);
3a58abaf
AM
463+ }
464 }
465
466 static char *
e5178960 467Index: gdb-7.2/gdb/symfile.h
3a58abaf 468===================================================================
e5178960
PS
469--- gdb-7.2.orig/gdb/symfile.h 2010-10-06 22:39:32.000000000 +0200
470+++ gdb-7.2/gdb/symfile.h 2010-10-06 22:39:52.000000000 +0200
471@@ -577,6 +577,8 @@ extern struct build_id *build_id_addr_ge
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
e5178960 480Index: gdb-7.2/gdb/testsuite/lib/gdb.exp
3a58abaf 481===================================================================
e5178960
PS
482--- gdb-7.2.orig/gdb/testsuite/lib/gdb.exp 2010-10-06 22:39:32.000000000 +0200
483+++ gdb-7.2/gdb/testsuite/lib/gdb.exp 2010-10-06 22:39:32.000000000 +0200
51a5ef0f 484@@ -1359,7 +1359,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 $" {
e5178960 493Index: gdb-7.2/gdb/testsuite/lib/mi-support.exp
7566401a 494===================================================================
e5178960
PS
495--- gdb-7.2.orig/gdb/testsuite/lib/mi-support.exp 2010-10-06 22:39:32.000000000 +0200
496+++ gdb-7.2/gdb/testsuite/lib/mi-support.exp 2010-10-06 22:39:32.000000000 +0200
d566d21e 497@@ -221,7 +221,7 @@ proc default_mi_gdb_start { args } {
498 }
499 }
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$" {
e5178960 506Index: gdb-7.2/gdb/tui/tui-interp.c
3a58abaf 507===================================================================
e5178960
PS
508--- gdb-7.2.orig/gdb/tui/tui-interp.c 2010-05-18 00:21:43.000000000 +0200
509+++ gdb-7.2/gdb/tui/tui-interp.c 2010-10-06 22:39:32.000000000 +0200
3a58abaf
AM
510@@ -30,6 +30,7 @@
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. */
51a5ef0f 518@@ -146,6 +147,8 @@ tui_command_loop (void *data)
3a58abaf
AM
519 char *a_prompt;
520 char *gdb_prompt = get_prompt ();
521
522+ debug_flush_missing ();
523+
524 /* Tell readline what the prompt to display is and what function
525 it will need to call after a whole line is read. This also
526 displays the first prompt. */
e5178960 527Index: gdb-7.2/gdb/aclocal.m4
3a58abaf 528===================================================================
e5178960
PS
529--- gdb-7.2.orig/gdb/aclocal.m4 2010-05-23 02:56:59.000000000 +0200
530+++ gdb-7.2/gdb/aclocal.m4 2010-10-06 22:39:32.000000000 +0200
7566401a
ER
531@@ -19,6 +19,162 @@ You have another version of autoconf. I
532 If you have problems, you may need to regenerate the build system entirely.
533 To do so, use the procedure documented by the package, typically `autoreconf'.])])
3a58abaf
AM
534
535+# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
536+#
537+# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
538+#
539+# This program is free software; you can redistribute it and/or modify
540+# it under the terms of the GNU General Public License as published by
541+# the Free Software Foundation; either version 2 of the License, or
542+# (at your option) any later version.
543+#
544+# This program is distributed in the hope that it will be useful, but
545+# WITHOUT ANY WARRANTY; without even the implied warranty of
546+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
547+# General Public License for more details.
548+#
549+# You should have received a copy of the GNU General Public License
550+# along with this program; if not, write to the Free Software
551+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
552+#
553+# As a special exception to the GNU General Public License, if you
554+# distribute this file as part of a program that contains a
555+# configuration script generated by Autoconf, you may include it under
556+# the same distribution terms that you use for the rest of that program.
557+
558+# PKG_PROG_PKG_CONFIG([MIN-VERSION])
559+# ----------------------------------
560+AC_DEFUN([PKG_PROG_PKG_CONFIG],
561+[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
562+m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
563+AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
564+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
565+ AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
566+fi
567+if test -n "$PKG_CONFIG"; then
568+ _pkg_min_version=m4_default([$1], [0.9.0])
569+ AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
570+ if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
571+ AC_MSG_RESULT([yes])
572+ else
573+ AC_MSG_RESULT([no])
574+ PKG_CONFIG=""
575+ fi
576+
577+fi[]dnl
578+])# PKG_PROG_PKG_CONFIG
579+
580+# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
581+#
582+# Check to see whether a particular set of modules exists. Similar
583+# to PKG_CHECK_MODULES(), but does not set variables or print errors.
584+#
585+#
586+# Similar to PKG_CHECK_MODULES, make sure that the first instance of
587+# this or PKG_CHECK_MODULES is called, or make sure to call
588+# PKG_CHECK_EXISTS manually
589+# --------------------------------------------------------------
590+AC_DEFUN([PKG_CHECK_EXISTS],
591+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
592+if test -n "$PKG_CONFIG" && \
593+ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
594+ m4_ifval([$2], [$2], [:])
595+m4_ifvaln([$3], [else
596+ $3])dnl
597+fi])
598+
599+
600+# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
601+# ---------------------------------------------
602+m4_define([_PKG_CONFIG],
603+[if test -n "$$1"; then
604+ pkg_cv_[]$1="$$1"
605+ elif test -n "$PKG_CONFIG"; then
606+ PKG_CHECK_EXISTS([$3],
607+ [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
608+ [pkg_failed=yes])
609+ else
610+ pkg_failed=untried
611+fi[]dnl
612+])# _PKG_CONFIG
613+
614+# _PKG_SHORT_ERRORS_SUPPORTED
615+# -----------------------------
616+AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
617+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
618+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
619+ _pkg_short_errors_supported=yes
620+else
621+ _pkg_short_errors_supported=no
622+fi[]dnl
623+])# _PKG_SHORT_ERRORS_SUPPORTED
624+
625+
626+# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
627+# [ACTION-IF-NOT-FOUND])
628+#
629+#
630+# Note that if there is a possibility the first call to
631+# PKG_CHECK_MODULES might not happen, you should be sure to include an
632+# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
633+#
634+#
635+# --------------------------------------------------------------
636+AC_DEFUN([PKG_CHECK_MODULES],
637+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
638+AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
639+AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
640+
641+pkg_failed=no
642+AC_MSG_CHECKING([for $1])
643+
644+_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
645+_PKG_CONFIG([$1][_LIBS], [libs], [$2])
646+
647+m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
648+and $1[]_LIBS to avoid the need to call pkg-config.
649+See the pkg-config man page for more details.])
650+
651+if test $pkg_failed = yes; then
652+ _PKG_SHORT_ERRORS_SUPPORTED
653+ if test $_pkg_short_errors_supported = yes; then
654+ $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
655+ else
656+ $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
657+ fi
658+ # Put the nasty error message in config.log where it belongs
659+ echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
660+
661+ ifelse([$4], , [AC_MSG_ERROR(dnl
662+[Package requirements ($2) were not met:
663+
664+$$1_PKG_ERRORS
665+
666+Consider adjusting the PKG_CONFIG_PATH environment variable if you
667+installed software in a non-standard prefix.
668+
669+_PKG_TEXT
670+])],
671+ [AC_MSG_RESULT([no])
672+ $4])
673+elif test $pkg_failed = untried; then
674+ ifelse([$4], , [AC_MSG_FAILURE(dnl
675+[The pkg-config script could not be found or is too old. Make sure it
676+is in your PATH or set the PKG_CONFIG environment variable to the full
677+path to pkg-config.
678+
679+_PKG_TEXT
680+
681+To get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
682+ [$4])
683+else
684+ $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
685+ $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
686+ AC_MSG_RESULT([yes])
687+ ifelse([$3], , :, [$3])
688+fi[]dnl
689+])# PKG_CHECK_MODULES
690+
7566401a 691 # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
3a58abaf
AM
692 #
693 # This file is free software; the Free Software Foundation
e5178960 694Index: gdb-7.2/gdb/config.in
3a58abaf 695===================================================================
e5178960
PS
696--- gdb-7.2.orig/gdb/config.in 2010-10-06 22:39:31.000000000 +0200
697+++ gdb-7.2/gdb/config.in 2010-10-06 22:39:32.000000000 +0200
51a5ef0f 698@@ -46,6 +46,9 @@
3a58abaf
AM
699 /* Define to BFD's default target vector. */
700 #undef DEFAULT_BFD_VEC
701
702+/* librpm version specific library name to dlopen. */
703+#undef DLOPEN_LIBRPM
704+
705 /* Define to 1 if translation of program messages to the user's native
706 language is requested. */
707 #undef ENABLE_NLS
51a5ef0f
PS
708@@ -231,6 +234,9 @@
709 /* Define if Python 2.7 is being used. */
710 #undef HAVE_LIBPYTHON2_7
3a58abaf
AM
711
712+/* Define if librpm library is being used. */
713+#undef HAVE_LIBRPM
714+
715 /* Define if libunwind library is being used. */
716 #undef HAVE_LIBUNWIND
717
e5178960 718Index: gdb-7.2/gdb/configure
3a58abaf 719===================================================================
e5178960
PS
720--- gdb-7.2.orig/gdb/configure 2010-10-06 22:39:31.000000000 +0200
721+++ gdb-7.2/gdb/configure 2010-10-06 22:39:32.000000000 +0200
51a5ef0f 722@@ -679,6 +679,9 @@ REPORT_BUGS_TO
7566401a
ER
723 PKGVERSION
724 TARGET_OBS
725 subdirs
726+RPM_LIBS
727+RPM_CFLAGS
728+PKG_CONFIG
729 pythondir
730 GDB_DATADIR_PATH
731 GDB_DATADIR
51a5ef0f 732@@ -948,6 +951,7 @@ with_separate_debug_dir
7566401a
ER
733 with_gdb_datadir
734 with_relocated_sources
735 with_pythondir
736+with_rpm
737 enable_targets
738 enable_64_bit_bfd
739 enable_gdbcli
51a5ef0f 740@@ -988,6 +992,9 @@ LDFLAGS
7566401a
ER
741 LIBS
742 CPPFLAGS
743 CPP
744+PKG_CONFIG
745+RPM_CFLAGS
746+RPM_LIBS
747 YACC
748 YFLAGS
749 XMKMF'
51a5ef0f 750@@ -1653,6 +1660,8 @@ Optional Packages:
3a58abaf
AM
751 [DATADIR/gdb]
752 --with-pythondir install Python data files in this path
753 [DATADIR/gdb/python]
7566401a
ER
754+ --with-rpm query rpm database for missing debuginfos (yes/no,
755+ def. auto=librpm.so)
756 --with-libunwind use libunwind frame unwinding support
757 --with-curses use the curses library instead of the termcap
758 library
51a5ef0f 759@@ -1688,6 +1697,9 @@ Some influential environment variables:
7566401a
ER
760 CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
761 you have headers in a nonstandard directory <include dir>
3a58abaf
AM
762 CPP C preprocessor
763+ PKG_CONFIG path to pkg-config utility
764+ RPM_CFLAGS C compiler flags for RPM, overriding pkg-config
765+ RPM_LIBS linker flags for RPM, overriding pkg-config
7566401a
ER
766 YACC The `Yet Another C Compiler' implementation to use. Defaults to
767 the first program found out of: `bison -y', `byacc', `yacc'.
768 YFLAGS The list of arguments that will be passed by default to $YACC.
51a5ef0f 769@@ -7951,6 +7963,485 @@ _ACEOF
3a58abaf
AM
770 fi
771
772
773+# Integration with rpm library to support missing debuginfo suggestions.
774+# --without-rpm: Disable any rpm support.
775+# --with-rpm=libname.so: Try to dynamically open `libname.so' during runtime.
776+# Even with runtime missing `libname.so' GDB will still other run correctly.
777+# Missing `libname.so' during ./configure will abort the configuration.
778+# --with-rpm=librpm.so: Like `--with-rpm=libname.so' but try to find specific
779+# minor version first such as `librpm-4.6.so' as minor version differences
780+# mean API+ABI incompatibility. If the specific match versioned library name
781+# could not be found still open dynamically at least `librpm.so'.
782+# --with-rpm: Like `--with-rpm=librpm.so' but if any of its detection fails try
783+# to find librpm for compilation-time linking by pkg-config. GDB binary will
784+# be probably linked with the version specific library (as `librpm-4.6.so').
785+# Failure to find librpm by pkg-config will abort the configuration.
786+# (default) --with-rpm=auto: Like `--with-rpm=librpm.so' but if even pkg-config
787+# cannot find librpm use to the rpmless compilation (like `--without-rpm').
788+
789+
7566401a
ER
790+# Check whether --with-rpm was given.
791+if test "${with_rpm+set}" = set; then :
792+ withval=$with_rpm;
3a58abaf
AM
793+else
794+ with_rpm="auto"
7566401a
ER
795+fi
796+
3a58abaf
AM
797+
798+
799+
800+if test "x$with_rpm" != "xno"; then
801+ if test "x$with_rpm" = "xyes"; then
802+ LIBRPM="librpm.so"
803+ RPM_REQUIRE=true
804+ DLOPEN_REQUIRE=false
805+ elif test "x$with_rpm" = "xauto"; then
806+ LIBRPM="librpm.so"
807+ RPM_REQUIRE=false
808+ DLOPEN_REQUIRE=false
809+ else
810+ LIBRPM="$with_rpm"
811+ RPM_REQUIRE=true
812+ DLOPEN_REQUIRE=true
813+ fi
814+ LIBRPM_STRING='"'"$LIBRPM"'"'
815+
7566401a
ER
816+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking specific librpm version" >&5
817+$as_echo_n "checking specific librpm version... " >&6; }
3a58abaf
AM
818+ HAVE_DLOPEN_LIBRPM=false
819+ save_LIBS="$LIBS"
820+ LIBS="$LIBS -ldl"
7566401a
ER
821+ if test "$cross_compiling" = yes; then :
822+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
823+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
824+as_fn_error "cannot run test program while cross compiling
825+See \`config.log' for more details." "$LINENO" 5; }
3a58abaf 826+else
7566401a 827+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
3a58abaf
AM
828+/* end confdefs.h. */
829+
830+#include <rpm/rpmlib.h>
831+#include <dlfcn.h>
832+#include <errno.h>
833+
834+int
835+main ()
836+{
837+
838+ void *h;
839+ const char *const *rpmverp;
840+ FILE *f;
841+
842+ f = fopen ("conftest.out", "w");
843+ if (!f)
844+ {
845+ fprintf (stderr, "Cannot write \"%s\": %s\n", "conftest.out",
846+ strerror (errno));
847+ return 1;
848+ }
849+ h = dlopen ($LIBRPM_STRING, RTLD_LAZY);
850+ if (!h)
851+ {
852+ fprintf (stderr, "dlopen (\"%s\"): %s\n", $LIBRPM_STRING, dlerror ());
853+ return 1;
854+ }
855+ rpmverp = dlsym (h, "RPMVERSION");
856+ if (!rpmverp)
857+ {
858+ fprintf (stderr, "dlsym (\"RPMVERSION\"): %s\n", dlerror ());
859+ return 1;
860+ }
861+ fprintf (stderr, "RPMVERSION is: \"");
862+ fprintf (stderr, "%s\"\n", *rpmverp);
863+
864+ /* Try to find the specific librpm version only for "librpm.so" as we do
865+ not know how to assemble the version string otherwise. */
866+
867+ if (strcmp ("librpm.so", $LIBRPM_STRING) != 0)
868+ {
869+ fprintf (f, "%s\n", $LIBRPM_STRING);
870+ return 0;
871+ }
872+ else
873+ {
874+ char *h2_name;
875+ void *h2;
876+ int major, minor;
877+
878+ if (sscanf (*rpmverp, "%d.%d", &major, &minor) != 2)
879+ {
880+ fprintf (stderr, "Unable to parse RPMVERSION.\n");
881+ fprintf (f, "%s\n", $LIBRPM_STRING);
882+ return 0;
883+ }
884+ /* Avoid the square brackets by malloc. */
885+ h2_name = malloc (64);
886+ sprintf (h2_name, "librpm-%d.%d.so", major, minor);
887+ h2 = dlopen (h2_name, RTLD_LAZY);
888+ if (!h2)
889+ {
890+ fprintf (stderr, "dlopen (\"%s\"): %s\n", h2_name, dlerror ());
891+ fprintf (f, "%s\n", $LIBRPM_STRING);
892+ return 0;
893+ }
894+ if (h2 != h)
895+ {
896+ fprintf (stderr, "dlopen of \"%s\" and \"%s\" are different.\n",
897+ $LIBRPM_STRING, h2_name);
898+ fprintf (f, "%s\n", $LIBRPM_STRING);
899+ return 0;
900+ }
901+ /* Found the valid .so name with a specific version. */
902+ fprintf (f, "%s\n", h2_name);
903+ return 0;
904+ }
905+
906+ ;
907+ return 0;
908+}
909+_ACEOF
7566401a 910+if ac_fn_c_try_run "$LINENO"; then :
3a58abaf
AM
911+
912+ DLOPEN_LIBRPM="`cat conftest.out`"
913+ if test "x$DLOPEN_LIBRPM" != "x"; then
914+ HAVE_DLOPEN_LIBRPM=true
7566401a
ER
915+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLOPEN_LIBRPM" >&5
916+$as_echo "$DLOPEN_LIBRPM" >&6; }
3a58abaf
AM
917+ fi
918+
3a58abaf 919+fi
7566401a
ER
920+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
921+ conftest.$ac_objext conftest.beam conftest.$ac_ext
3a58abaf 922+fi
7566401a 923+
3a58abaf
AM
924+ rm -f conftest.out
925+
926+
927+
928+ if $HAVE_DLOPEN_LIBRPM; then
929+
7566401a
ER
930+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking rpm library API compatibility" >&5
931+$as_echo_n "checking rpm library API compatibility... " >&6; }
3a58abaf
AM
932+ # The compilation requires -Werror to verify anything.
933+ save_CFLAGS="$CFLAGS"
934+ CFLAGS="$CFLAGS -Werror"
7566401a 935+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
3a58abaf
AM
936+/* end confdefs.h. */
937+
51a5ef0f 938+/* Duplicate here the declarations to verify they match "elfread.c". */
3a58abaf
AM
939+#include <rpm/rpmlib.h>
940+#include <rpm/rpmts.h>
941+#include <rpm/rpmdb.h>
942+#include <rpm/header.h>
943+extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
944+extern int rpmReadConfigFiles(const char * file, const char * target);
945+extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
946+extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
947+extern rpmts rpmtsCreate(void);
948+extern rpmts rpmtsFree(rpmts ts);
949+extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
950+ const void * keyp, size_t keylen);
951+
952+int
953+main ()
954+{
955+
956+ ;
957+ return 0;
958+}
959+_ACEOF
7566401a 960+if ac_fn_c_try_compile "$LINENO"; then :
3a58abaf
AM
961+
962+ LIBRPM_COMPAT=true
7566401a
ER
963+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
964+$as_echo "yes" >&6; }
3a58abaf
AM
965+
966+else
3a58abaf
AM
967+
968+ LIBRPM_COMPAT=false
7566401a
ER
969+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
970+$as_echo "no" >&6; }
3a58abaf
AM
971+
972+fi
7566401a 973+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
3a58abaf
AM
974+ CFLAGS="$save_CFLAGS"
975+
976+ if ! $LIBRPM_COMPAT; then
977+ HAVE_DLOPEN_LIBRPM=false
978+ fi
979+ fi
980+
981+ if $HAVE_DLOPEN_LIBRPM; then
982+ DLOPEN_LIBRPM_STRING='"'"$DLOPEN_LIBRPM"'"'
983+
984+cat >>confdefs.h <<_ACEOF
985+#define DLOPEN_LIBRPM $DLOPEN_LIBRPM_STRING
986+_ACEOF
987+
988+
7566401a 989+$as_echo "#define HAVE_LIBRPM 1" >>confdefs.h
3a58abaf
AM
990+
991+ else
7566401a
ER
992+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
993+$as_echo "no" >&6; }
3a58abaf
AM
994+ LIBS="$save_LIBS"
995+ if $DLOPEN_REQUIRE; then
7566401a 996+ as_fn_error "Specific name $LIBRPM was requested but it could not be opened." "$LINENO" 5
3a58abaf
AM
997+ fi
998+
999+
1000+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1001+ if test -n "$ac_tool_prefix"; then
1002+ # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
1003+set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
7566401a
ER
1004+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
1005+$as_echo_n "checking for $ac_word... " >&6; }
1006+if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
1007+ $as_echo_n "(cached) " >&6
3a58abaf
AM
1008+else
1009+ case $PKG_CONFIG in
1010+ [\\/]* | ?:[\\/]*)
1011+ ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
1012+ ;;
1013+ *)
1014+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1015+for as_dir in $PATH
1016+do
1017+ IFS=$as_save_IFS
1018+ test -z "$as_dir" && as_dir=.
7566401a
ER
1019+ for ac_exec_ext in '' $ac_executable_extensions; do
1020+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
3a58abaf 1021+ ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
7566401a 1022+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
3a58abaf
AM
1023+ break 2
1024+ fi
1025+done
7566401a
ER
1026+ done
1027+IFS=$as_save_IFS
3a58abaf
AM
1028+
1029+ ;;
1030+esac
1031+fi
1032+PKG_CONFIG=$ac_cv_path_PKG_CONFIG
3a58abaf 1033+if test -n "$PKG_CONFIG"; then
7566401a
ER
1034+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
1035+$as_echo "$PKG_CONFIG" >&6; }
3a58abaf 1036+else
7566401a
ER
1037+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
1038+$as_echo "no" >&6; }
3a58abaf
AM
1039+fi
1040+
7566401a 1041+
3a58abaf
AM
1042+fi
1043+if test -z "$ac_cv_path_PKG_CONFIG"; then
1044+ ac_pt_PKG_CONFIG=$PKG_CONFIG
1045+ # Extract the first word of "pkg-config", so it can be a program name with args.
1046+set dummy pkg-config; ac_word=$2
7566401a
ER
1047+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
1048+$as_echo_n "checking for $ac_word... " >&6; }
1049+if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then :
1050+ $as_echo_n "(cached) " >&6
3a58abaf
AM
1051+else
1052+ case $ac_pt_PKG_CONFIG in
1053+ [\\/]* | ?:[\\/]*)
1054+ ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
1055+ ;;
1056+ *)
1057+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1058+for as_dir in $PATH
1059+do
1060+ IFS=$as_save_IFS
1061+ test -z "$as_dir" && as_dir=.
7566401a
ER
1062+ for ac_exec_ext in '' $ac_executable_extensions; do
1063+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
3a58abaf 1064+ ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
7566401a 1065+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
3a58abaf
AM
1066+ break 2
1067+ fi
1068+done
7566401a
ER
1069+ done
1070+IFS=$as_save_IFS
3a58abaf
AM
1071+
1072+ ;;
1073+esac
1074+fi
1075+ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
3a58abaf 1076+if test -n "$ac_pt_PKG_CONFIG"; then
7566401a
ER
1077+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
1078+$as_echo "$ac_pt_PKG_CONFIG" >&6; }
3a58abaf 1079+else
7566401a
ER
1080+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
1081+$as_echo "no" >&6; }
3a58abaf
AM
1082+fi
1083+
7566401a
ER
1084+ if test "x$ac_pt_PKG_CONFIG" = x; then
1085+ PKG_CONFIG=""
1086+ else
1087+ case $cross_compiling:$ac_tool_warned in
1088+yes:)
1089+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
1090+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
1091+ac_tool_warned=yes ;;
1092+esac
1093+ PKG_CONFIG=$ac_pt_PKG_CONFIG
1094+ fi
3a58abaf
AM
1095+else
1096+ PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
1097+fi
1098+
1099+fi
1100+if test -n "$PKG_CONFIG"; then
1101+ _pkg_min_version=0.9.0
7566401a
ER
1102+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
1103+$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
3a58abaf 1104+ if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
7566401a
ER
1105+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
1106+$as_echo "yes" >&6; }
3a58abaf 1107+ else
7566401a
ER
1108+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
1109+$as_echo "no" >&6; }
3a58abaf
AM
1110+ PKG_CONFIG=""
1111+ fi
1112+
1113+fi
1114+
1115+pkg_failed=no
7566401a
ER
1116+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for RPM" >&5
1117+$as_echo_n "checking for RPM... " >&6; }
3a58abaf
AM
1118+
1119+if test -n "$RPM_CFLAGS"; then
1120+ pkg_cv_RPM_CFLAGS="$RPM_CFLAGS"
1121+ elif test -n "$PKG_CONFIG"; then
1122+ if test -n "$PKG_CONFIG" && \
7566401a 1123+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"rpm\""; } >&5
3a58abaf
AM
1124+ ($PKG_CONFIG --exists --print-errors "rpm") 2>&5
1125+ ac_status=$?
7566401a
ER
1126+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
1127+ test $ac_status = 0; }; then
3a58abaf
AM
1128+ pkg_cv_RPM_CFLAGS=`$PKG_CONFIG --cflags "rpm" 2>/dev/null`
1129+else
1130+ pkg_failed=yes
1131+fi
1132+ else
1133+ pkg_failed=untried
1134+fi
1135+if test -n "$RPM_LIBS"; then
1136+ pkg_cv_RPM_LIBS="$RPM_LIBS"
1137+ elif test -n "$PKG_CONFIG"; then
1138+ if test -n "$PKG_CONFIG" && \
7566401a 1139+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"rpm\""; } >&5
3a58abaf
AM
1140+ ($PKG_CONFIG --exists --print-errors "rpm") 2>&5
1141+ ac_status=$?
7566401a
ER
1142+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
1143+ test $ac_status = 0; }; then
3a58abaf
AM
1144+ pkg_cv_RPM_LIBS=`$PKG_CONFIG --libs "rpm" 2>/dev/null`
1145+else
1146+ pkg_failed=yes
1147+fi
1148+ else
1149+ pkg_failed=untried
1150+fi
1151+
1152+
1153+
1154+if test $pkg_failed = yes; then
1155+
1156+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1157+ _pkg_short_errors_supported=yes
1158+else
1159+ _pkg_short_errors_supported=no
1160+fi
1161+ if test $_pkg_short_errors_supported = yes; then
1162+ RPM_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "rpm" 2>&1`
1163+ else
1164+ RPM_PKG_ERRORS=`$PKG_CONFIG --print-errors "rpm" 2>&1`
1165+ fi
1166+ # Put the nasty error message in config.log where it belongs
1167+ echo "$RPM_PKG_ERRORS" >&5
1168+
7566401a
ER
1169+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
1170+$as_echo "no" >&6; }
3a58abaf
AM
1171+ HAVE_LIBRPM=false
1172+elif test $pkg_failed = untried; then
1173+ HAVE_LIBRPM=false
1174+else
1175+ RPM_CFLAGS=$pkg_cv_RPM_CFLAGS
1176+ RPM_LIBS=$pkg_cv_RPM_LIBS
7566401a
ER
1177+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
1178+$as_echo "yes" >&6; }
3a58abaf
AM
1179+ HAVE_LIBRPM=true
1180+fi
1181+
1182+ if $HAVE_LIBRPM; then
1183+
7566401a
ER
1184+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking rpm library API compatibility" >&5
1185+$as_echo_n "checking rpm library API compatibility... " >&6; }
3a58abaf
AM
1186+ # The compilation requires -Werror to verify anything.
1187+ save_CFLAGS="$CFLAGS"
1188+ CFLAGS="$CFLAGS -Werror"
7566401a 1189+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
3a58abaf
AM
1190+/* end confdefs.h. */
1191+
51a5ef0f 1192+/* Duplicate here the declarations to verify they match "elfread.c". */
3a58abaf
AM
1193+#include <rpm/rpmlib.h>
1194+#include <rpm/rpmts.h>
1195+#include <rpm/rpmdb.h>
1196+#include <rpm/header.h>
1197+extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
1198+extern int rpmReadConfigFiles(const char * file, const char * target);
1199+extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
1200+extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
1201+extern rpmts rpmtsCreate(void);
1202+extern rpmts rpmtsFree(rpmts ts);
1203+extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
1204+ const void * keyp, size_t keylen);
1205+
1206+int
1207+main ()
1208+{
1209+
1210+ ;
1211+ return 0;
1212+}
1213+_ACEOF
7566401a 1214+if ac_fn_c_try_compile "$LINENO"; then :
3a58abaf
AM
1215+
1216+ LIBRPM_COMPAT=true
7566401a
ER
1217+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
1218+$as_echo "yes" >&6; }
3a58abaf
AM
1219+
1220+else
3a58abaf
AM
1221+
1222+ LIBRPM_COMPAT=false
7566401a
ER
1223+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
1224+$as_echo "no" >&6; }
3a58abaf
AM
1225+
1226+fi
7566401a 1227+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
3a58abaf
AM
1228+ CFLAGS="$save_CFLAGS"
1229+
1230+ if ! $LIBRPM_COMPAT; then
1231+ HAVE_LIBRPM=false
1232+ RPM_PKG_ERRORS="Found $LIBRPM API is incompatibile with this GDB"
1233+ fi
1234+ fi
1235+
1236+ if $HAVE_LIBRPM; then
1237+
7566401a 1238+$as_echo "#define HAVE_LIBRPM 1" >>confdefs.h
3a58abaf
AM
1239+
1240+ CFLAGS="$CFLAGS $RPM_CFLAGS"
1241+ LIBS="$LIBS $RPM_LIBS"
1242+ else
1243+ if $RPM_REQUIRE; then
7566401a 1244+ as_fn_error "$RPM_PKG_ERRORS" "$LINENO" 5
3a58abaf 1245+ else
7566401a
ER
1246+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $RPM_PKG_ERRORS" >&5
1247+$as_echo "$as_me: WARNING: $RPM_PKG_ERRORS" >&2;}
3a58abaf
AM
1248+ fi
1249+ fi
1250+ fi
1251+fi
7566401a 1252
7566401a 1253
7566401a 1254
e5178960 1255Index: gdb-7.2/gdb/configure.ac
3a58abaf 1256===================================================================
e5178960
PS
1257--- gdb-7.2.orig/gdb/configure.ac 2010-10-06 22:39:31.000000000 +0200
1258+++ gdb-7.2/gdb/configure.ac 2010-10-06 22:39:32.000000000 +0200
51a5ef0f 1259@@ -152,6 +152,198 @@ else
3a58abaf
AM
1260 fi
1261 AC_SUBST(pythondir)
1262
1263+# Integration with rpm library to support missing debuginfo suggestions.
1264+# --without-rpm: Disable any rpm support.
1265+# --with-rpm=libname.so: Try to dynamically open `libname.so' during runtime.
1266+# Even with runtime missing `libname.so' GDB will still other run correctly.
1267+# Missing `libname.so' during ./configure will abort the configuration.
1268+# --with-rpm=librpm.so: Like `--with-rpm=libname.so' but try to find specific
1269+# minor version first such as `librpm-4.6.so' as minor version differences
1270+# mean API+ABI incompatibility. If the specific match versioned library name
1271+# could not be found still open dynamically at least `librpm.so'.
1272+# --with-rpm: Like `--with-rpm=librpm.so' but if any of its detection fails try
1273+# to find librpm for compilation-time linking by pkg-config. GDB binary will
1274+# be probably linked with the version specific library (as `librpm-4.6.so').
1275+# Failure to find librpm by pkg-config will abort the configuration.
1276+# (default) --with-rpm=auto: Like `--with-rpm=librpm.so' but if even pkg-config
1277+# cannot find librpm use to the rpmless compilation (like `--without-rpm').
1278+
1279+AC_ARG_WITH([rpm],
1280+ [AS_HELP_STRING([--with-rpm],
7566401a 1281+ [query rpm database for missing debuginfos (yes/no, def. auto=librpm.so)])], [], [with_rpm="auto"])
3a58abaf
AM
1282+
1283+m4_pattern_allow([^AC_MSG_ERROR$])
1284+m4_pattern_allow([^AC_MSG_WARN$])
1285+if test "x$with_rpm" != "xno"; then
1286+ if test "x$with_rpm" = "xyes"; then
1287+ LIBRPM="librpm.so"
1288+ RPM_REQUIRE=true
1289+ DLOPEN_REQUIRE=false
1290+ elif test "x$with_rpm" = "xauto"; then
1291+ LIBRPM="librpm.so"
1292+ RPM_REQUIRE=false
1293+ DLOPEN_REQUIRE=false
1294+ else
1295+ LIBRPM="$with_rpm"
1296+ RPM_REQUIRE=true
1297+ DLOPEN_REQUIRE=true
1298+ fi
1299+ LIBRPM_STRING='"'"$LIBRPM"'"'
1300+
1301+ AC_MSG_CHECKING([specific librpm version])
1302+ HAVE_DLOPEN_LIBRPM=false
1303+ save_LIBS="$LIBS"
1304+ LIBS="$LIBS -ldl"
1305+ AC_RUN_IFELSE(AC_LANG_PROGRAM([[
1306+#include <rpm/rpmlib.h>
1307+#include <dlfcn.h>
1308+#include <errno.h>
1309+ ]], [[
1310+ void *h;
1311+ const char *const *rpmverp;
1312+ FILE *f;
1313+
1314+ f = fopen ("conftest.out", "w");
1315+ if (!f)
1316+ {
1317+ fprintf (stderr, "Cannot write \"%s\": %s\n", "conftest.out",
1318+ strerror (errno));
1319+ return 1;
1320+ }
1321+ h = dlopen ($LIBRPM_STRING, RTLD_LAZY);
1322+ if (!h)
1323+ {
1324+ fprintf (stderr, "dlopen (\"%s\"): %s\n", $LIBRPM_STRING, dlerror ());
1325+ return 1;
1326+ }
1327+ rpmverp = dlsym (h, "RPMVERSION");
1328+ if (!rpmverp)
1329+ {
1330+ fprintf (stderr, "dlsym (\"RPMVERSION\"): %s\n", dlerror ());
1331+ return 1;
1332+ }
1333+ fprintf (stderr, "RPMVERSION is: \"");
1334+ fprintf (stderr, "%s\"\n", *rpmverp);
1335+
1336+ /* Try to find the specific librpm version only for "librpm.so" as we do
1337+ not know how to assemble the version string otherwise. */
1338+
1339+ if (strcmp ("librpm.so", $LIBRPM_STRING) != 0)
1340+ {
1341+ fprintf (f, "%s\n", $LIBRPM_STRING);
1342+ return 0;
1343+ }
1344+ else
1345+ {
1346+ char *h2_name;
1347+ void *h2;
1348+ int major, minor;
1349+
1350+ if (sscanf (*rpmverp, "%d.%d", &major, &minor) != 2)
1351+ {
1352+ fprintf (stderr, "Unable to parse RPMVERSION.\n");
1353+ fprintf (f, "%s\n", $LIBRPM_STRING);
1354+ return 0;
1355+ }
1356+ /* Avoid the square brackets by malloc. */
1357+ h2_name = malloc (64);
1358+ sprintf (h2_name, "librpm-%d.%d.so", major, minor);
1359+ h2 = dlopen (h2_name, RTLD_LAZY);
1360+ if (!h2)
1361+ {
1362+ fprintf (stderr, "dlopen (\"%s\"): %s\n", h2_name, dlerror ());
1363+ fprintf (f, "%s\n", $LIBRPM_STRING);
1364+ return 0;
1365+ }
1366+ if (h2 != h)
1367+ {
1368+ fprintf (stderr, "dlopen of \"%s\" and \"%s\" are different.\n",
1369+ $LIBRPM_STRING, h2_name);
1370+ fprintf (f, "%s\n", $LIBRPM_STRING);
1371+ return 0;
1372+ }
1373+ /* Found the valid .so name with a specific version. */
1374+ fprintf (f, "%s\n", h2_name);
1375+ return 0;
1376+ }
1377+ ]]), [
1378+ DLOPEN_LIBRPM="`cat conftest.out`"
1379+ if test "x$DLOPEN_LIBRPM" != "x"; then
1380+ HAVE_DLOPEN_LIBRPM=true
1381+ AC_MSG_RESULT($DLOPEN_LIBRPM)
1382+ fi
1383+ ])
1384+ rm -f conftest.out
1385+
1386+ m4_define([CHECK_LIBRPM_COMPAT], [
1387+ AC_MSG_CHECKING([rpm library API compatibility])
1388+ # The compilation requires -Werror to verify anything.
1389+ save_CFLAGS="$CFLAGS"
1390+ CFLAGS="$CFLAGS -Werror"
1391+ AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[
51a5ef0f 1392+/* Duplicate here the declarations to verify they match "elfread.c". */
3a58abaf
AM
1393+#include <rpm/rpmlib.h>
1394+#include <rpm/rpmts.h>
1395+#include <rpm/rpmdb.h>
1396+#include <rpm/header.h>
1397+extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
1398+extern int rpmReadConfigFiles(const char * file, const char * target);
1399+extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
1400+extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
1401+extern rpmts rpmtsCreate(void);
1402+extern rpmts rpmtsFree(rpmts ts);
1403+extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
1404+ const void * keyp, size_t keylen);
1405+ ]]), [
1406+ LIBRPM_COMPAT=true
1407+ AC_MSG_RESULT(yes)
1408+ ], [
1409+ LIBRPM_COMPAT=false
1410+ AC_MSG_RESULT(no)
1411+ ])
1412+ CFLAGS="$save_CFLAGS"
1413+ ])
1414+
1415+ if $HAVE_DLOPEN_LIBRPM; then
1416+ CHECK_LIBRPM_COMPAT
1417+ if ! $LIBRPM_COMPAT; then
1418+ HAVE_DLOPEN_LIBRPM=false
1419+ fi
1420+ fi
1421+
1422+ if $HAVE_DLOPEN_LIBRPM; then
1423+ DLOPEN_LIBRPM_STRING='"'"$DLOPEN_LIBRPM"'"'
1424+ AC_DEFINE_UNQUOTED(DLOPEN_LIBRPM, $DLOPEN_LIBRPM_STRING, [librpm version specific library name to dlopen.])
1425+ AC_DEFINE(HAVE_LIBRPM, 1, [Define if librpm library is being used.])
1426+ else
1427+ AC_MSG_RESULT(no)
1428+ LIBS="$save_LIBS"
1429+ if $DLOPEN_REQUIRE; then
1430+ AC_MSG_ERROR([Specific name $LIBRPM was requested but it could not be opened.])
1431+ fi
1432+ PKG_CHECK_MODULES(RPM, rpm, [HAVE_LIBRPM=true], [HAVE_LIBRPM=false])
1433+
1434+ if $HAVE_LIBRPM; then
1435+ CHECK_LIBRPM_COMPAT
1436+ if ! $LIBRPM_COMPAT; then
1437+ HAVE_LIBRPM=false
1438+ RPM_PKG_ERRORS="Found $LIBRPM API is incompatibile with this GDB"
1439+ fi
1440+ fi
1441+
1442+ if $HAVE_LIBRPM; then
1443+ AC_DEFINE(HAVE_LIBRPM, 1, [Define if librpm library is being used.])
1444+ CFLAGS="$CFLAGS $RPM_CFLAGS"
1445+ LIBS="$LIBS $RPM_LIBS"
1446+ else
1447+ if $RPM_REQUIRE; then
1448+ AC_MSG_ERROR($RPM_PKG_ERRORS)
1449+ else
1450+ AC_MSG_WARN($RPM_PKG_ERRORS)
1451+ fi
1452+ fi
1453+ fi
1454+fi
3a58abaf
AM
1455
1456 AC_CONFIG_SUBDIRS(doc testsuite)
1457
e5178960 1458Index: gdb-7.2/gdb/acinclude.m4
7566401a 1459===================================================================
e5178960
PS
1460--- gdb-7.2.orig/gdb/acinclude.m4 2010-05-27 05:40:45.000000000 +0200
1461+++ gdb-7.2/gdb/acinclude.m4 2010-10-06 22:39:32.000000000 +0200
7566401a
ER
1462@@ -1,3 +1,5 @@
1463+# serial 1
1464+
1465 dnl written by Rob Savoye <rob@cygnus.com> for Cygnus Support
1466 dnl major rewriting for Tcl 7.5 by Don Libes <libes@nist.gov>
1467
51a5ef0f 1468@@ -81,8 +83,6 @@ AC_MSG_RESULT(yes)
7566401a
ER
1469 # Foundation, Inc., 51 Franklin Street, Fifth Floor,
1470 # Boston, MA 02110-1301, USA.
1471
1472-# serial 1
1473-
1474 # @defmac AC_PROG_CC_STDC
1475 # @maindex PROG_CC_STDC
1476 # @ovindex CC
e5178960
PS
1477Index: gdb-7.2/gdb/corelow.c
1478===================================================================
1479--- gdb-7.2.orig/gdb/corelow.c 2010-10-06 22:39:39.000000000 +0200
1480+++ gdb-7.2/gdb/corelow.c 2010-10-06 22:39:52.000000000 +0200
1481@@ -331,7 +331,7 @@ build_id_locate_exec (int from_tty)
1482 symfile_objfile->flags |= OBJF_BUILD_ID_CORE_LOADED;
1483 }
1484 else
1485- debug_print_missing (_("the main executable file"), build_id_filename);
1486+ debug_print_missing (BUILD_ID_MAIN_EXECUTABLE_FILENAME, build_id_filename);
1487
1488 do_cleanups (back_to);
1489
This page took 0.646928 seconds and 4 git commands to generate.