Blame SOURCES/gdb-6.6-buildid-locate-rpm.patch

861f93
Index: gdb-7.6/gdb/event-top.c
861f93
===================================================================
861f93
--- gdb-7.6.orig/gdb/event-top.c	2013-01-31 19:37:37.000000000 +0100
861f93
+++ gdb-7.6/gdb/event-top.c	2013-07-17 19:51:02.679357656 +0200
861f93
@@ -36,6 +36,7 @@
861f93
 #include "continuations.h"
861f93
 #include "gdbcmd.h"		/* for dont_repeat() */
861f93
 #include "annotate.h"
861f93
+#include "symfile.h"
861f93
 
861f93
 /* readline include files.  */
861f93
 #include "readline/readline.h"
861f93
@@ -170,6 +171,8 @@ rl_callback_read_char_wrapper (gdb_clien
861f93
 void
861f93
 cli_command_loop (void)
861f93
 {
861f93
+  debug_flush_missing ();
861f93
+
861f93
   display_gdb_prompt (0);
861f93
 
861f93
   /* Now it's time to start the event loop.  */
861f93
@@ -237,6 +240,8 @@ display_gdb_prompt (char *new_prompt)
861f93
   /* Reset the nesting depth used when trace-commands is set.  */
861f93
   reset_command_nest_depth ();
861f93
 
861f93
+  debug_flush_missing ();
861f93
+
861f93
   /* Each interpreter has its own rules on displaying the command
861f93
      prompt.  */
861f93
   if (!current_interp_display_prompt_p ())
861f93
Index: gdb-7.6/gdb/elfread.c
861f93
===================================================================
861f93
--- gdb-7.6.orig/gdb/elfread.c	2013-07-17 19:51:02.639357629 +0200
861f93
+++ gdb-7.6/gdb/elfread.c	2013-07-17 19:51:50.738390068 +0200
861f93
@@ -49,6 +49,7 @@
861f93
 #include "gdbcore.h"
861f93
 #include "gdbcmd.h"
861f93
 #include "observer.h"
861f93
+#include "elf/external.h"
861f93
 #include <sys/stat.h>
861f93
 
861f93
 extern void _initialize_elfread (void);
861f93
@@ -1682,8 +1683,360 @@ build_id_to_filename (const struct elf_b
861f93
   return retval;
861f93
 }
861f93
 
861f93
+#ifdef HAVE_LIBRPM
861f93
+
861f93
+#include <rpm/rpmlib.h>
861f93
+#include <rpm/rpmts.h>
861f93
+#include <rpm/rpmdb.h>
861f93
+#include <rpm/header.h>
861f93
+#ifdef DLOPEN_LIBRPM
861f93
+#include <dlfcn.h>
861f93
+#endif
861f93
+
861f93
+/* This MISSING_RPM_HASH tracker is used to collect all the missing rpm files
861f93
+   and avoid their duplicities during a single inferior run.  */
861f93
+
861f93
+static struct htab *missing_rpm_hash;
861f93
+
861f93
+/* This MISSING_RPM_LIST tracker is used to collect and print as a single line
861f93
+   all the rpms right before the nearest GDB prompt.  It gets cleared after
861f93
+   each such print (it is questionable if we should clear it after the print).
861f93
+   */
861f93
+
861f93
+struct missing_rpm
861f93
+  {
861f93
+    struct missing_rpm *next;
861f93
+    char rpm[1];
861f93
+  };
861f93
+static struct missing_rpm *missing_rpm_list;
861f93
+static int missing_rpm_list_entries;
861f93
+
861f93
+/* Returns the count of newly added rpms.  */
861f93
+
861f93
+static int
861f93
+missing_rpm_enlist (const char *filename)
861f93
+{
861f93
+  static int rpm_init_done = 0;
861f93
+  rpmts ts;
861f93
+  rpmdbMatchIterator mi;
861f93
+  int count = 0;
861f93
+
861f93
+#ifdef DLOPEN_LIBRPM
861f93
+  /* Duplicate here the declarations to verify they match.  The same sanity
861f93
+     check is present also in `configure.ac'.  */
861f93
+  extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
861f93
+  static char *(*headerFormat_p) (Header h, const char * fmt, errmsg_t *errmsg);
861f93
+  extern int rpmReadConfigFiles(const char * file, const char * target);
861f93
+  static int (*rpmReadConfigFiles_p) (const char * file, const char * target);
861f93
+  extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
861f93
+  static rpmdbMatchIterator (*rpmdbFreeIterator_p) (rpmdbMatchIterator mi);
861f93
+  extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
861f93
+  static Header (*rpmdbNextIterator_p) (rpmdbMatchIterator mi);
861f93
+  extern rpmts rpmtsCreate(void);
861f93
+  static rpmts (*rpmtsCreate_p) (void);
861f93
+  extern rpmts rpmtsFree(rpmts ts);
861f93
+  static rpmts (*rpmtsFree_p) (rpmts ts);
861f93
+  extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
861f93
+                                              const void * keyp, size_t keylen);
861f93
+  static rpmdbMatchIterator (*rpmtsInitIterator_p) (const rpmts ts,
861f93
+						    rpmTag rpmtag,
861f93
+						    const void *keyp,
861f93
+						    size_t keylen);
861f93
+#else	/* !DLOPEN_LIBRPM */
861f93
+# define headerFormat_p headerFormat
861f93
+# define rpmReadConfigFiles_p rpmReadConfigFiles
861f93
+# define rpmdbFreeIterator_p rpmdbFreeIterator
861f93
+# define rpmdbNextIterator_p rpmdbNextIterator
861f93
+# define rpmtsCreate_p rpmtsCreate
861f93
+# define rpmtsFree_p rpmtsFree
861f93
+# define rpmtsInitIterator_p rpmtsInitIterator
861f93
+#endif	/* !DLOPEN_LIBRPM */
861f93
+
861f93
+  gdb_assert (filename != NULL);
861f93
+
861f93
+  if (strcmp (filename, BUILD_ID_MAIN_EXECUTABLE_FILENAME) == 0)
861f93
+    return 0;
861f93
+
861f93
+  if (filename[0] != '/')
861f93
+    {
861f93
+      warning (_("Ignoring non-absolute filename: <%s>"), filename);
861f93
+      return 0;
861f93
+    }
861f93
+
861f93
+  if (!rpm_init_done)
861f93
+    {
861f93
+      static int init_tried;
861f93
+
861f93
+      /* Already failed the initialization before?  */
861f93
+      if (init_tried)
861f93
+      	return 0;
861f93
+      init_tried = 1;
861f93
+
861f93
+#ifdef DLOPEN_LIBRPM
861f93
+      {
861f93
+	void *h;
861f93
+
861f93
+	h = dlopen (DLOPEN_LIBRPM, RTLD_LAZY);
861f93
+	if (!h)
861f93
+	  {
861f93
+	    warning (_("Unable to open \"%s\" (%s), "
861f93
+		      "missing debuginfos notifications will not be displayed"),
861f93
+		     DLOPEN_LIBRPM, dlerror ());
861f93
+	    return 0;
861f93
+	  }
861f93
+
861f93
+	if (!((headerFormat_p = dlsym (h, "headerFormat"))
861f93
+	      && (rpmReadConfigFiles_p = dlsym (h, "rpmReadConfigFiles"))
861f93
+	      && (rpmdbFreeIterator_p = dlsym (h, "rpmdbFreeIterator"))
861f93
+	      && (rpmdbNextIterator_p = dlsym (h, "rpmdbNextIterator"))
861f93
+	      && (rpmtsCreate_p = dlsym (h, "rpmtsCreate"))
861f93
+	      && (rpmtsFree_p = dlsym (h, "rpmtsFree"))
861f93
+	      && (rpmtsInitIterator_p = dlsym (h, "rpmtsInitIterator"))))
861f93
+	  {
861f93
+	    warning (_("Opened library \"%s\" is incompatible (%s), "
861f93
+		      "missing debuginfos notifications will not be displayed"),
861f93
+		     DLOPEN_LIBRPM, dlerror ());
861f93
+	    if (dlclose (h))
861f93
+	      warning (_("Error closing library \"%s\": %s\n"), DLOPEN_LIBRPM,
861f93
+		       dlerror ());
861f93
+	    return 0;
861f93
+	  }
861f93
+      }
861f93
+#endif	/* DLOPEN_LIBRPM */
861f93
+
861f93
+      if (rpmReadConfigFiles_p (NULL, NULL) != 0)
861f93
+	{
861f93
+	  warning (_("Error reading the rpm configuration files"));
861f93
+	  return 0;
861f93
+	}
861f93
+
861f93
+      rpm_init_done = 1;
861f93
+    }
861f93
+
861f93
+  ts = rpmtsCreate_p ();
861f93
+
861f93
+  mi = rpmtsInitIterator_p (ts, RPMTAG_BASENAMES, filename, 0);
861f93
+  if (mi != NULL)
861f93
+    {
861f93
+      for (;;)
861f93
+	{
861f93
+	  Header h;
861f93
+	  char *debuginfo, **slot, *s, *s2;
861f93
+	  errmsg_t err;
861f93
+	  size_t srcrpmlen = sizeof (".src.rpm") - 1;
861f93
+	  size_t debuginfolen = sizeof ("-debuginfo") - 1;
861f93
+	  rpmdbMatchIterator mi_debuginfo;
861f93
+
861f93
+	  h = rpmdbNextIterator_p (mi);
861f93
+	  if (h == NULL)
861f93
+	    break;
861f93
+
861f93
+	  /* Verify the debuginfo file is not already installed.  */
861f93
+
861f93
+	  debuginfo = headerFormat_p (h, "%{sourcerpm}-debuginfo.%{arch}",
861f93
+				      &err;;
861f93
+	  if (!debuginfo)
861f93
+	    {
861f93
+	      warning (_("Error querying the rpm file `%s': %s"), filename,
861f93
+	               err);
861f93
+	      continue;
861f93
+	    }
861f93
+	  /* s = `.src.rpm-debuginfo.%{arch}' */
861f93
+	  s = strrchr (debuginfo, '-') - srcrpmlen;
861f93
+	  s2 = NULL;
861f93
+	  if (s > debuginfo && memcmp (s, ".src.rpm", srcrpmlen) == 0)
861f93
+	    {
861f93
+	      /* s2 = `-%{release}.src.rpm-debuginfo.%{arch}' */
861f93
+	      s2 = memrchr (debuginfo, '-', s - debuginfo);
861f93
+	    }
861f93
+	  if (s2)
861f93
+	    {
861f93
+	      /* s2 = `-%{version}-%{release}.src.rpm-debuginfo.%{arch}' */
861f93
+	      s2 = memrchr (debuginfo, '-', s2 - debuginfo);
861f93
+	    }
861f93
+	  if (!s2)
861f93
+	    {
861f93
+	      warning (_("Error querying the rpm file `%s': %s"), filename,
861f93
+	               debuginfo);
861f93
+	      xfree (debuginfo);
861f93
+	      continue;
861f93
+	    }
861f93
+	  /* s = `.src.rpm-debuginfo.%{arch}' */
861f93
+	  /* s2 = `-%{version}-%{release}.src.rpm-debuginfo.%{arch}' */
861f93
+	  memmove (s2 + debuginfolen, s2, s - s2);
861f93
+	  memcpy (s2, "-debuginfo", debuginfolen);
861f93
+	  /* s = `XXXX.%{arch}' */
861f93
+	  /* strlen ("XXXX") == srcrpmlen + debuginfolen */
861f93
+	  /* s2 = `-debuginfo-%{version}-%{release}XX.%{arch}' */
861f93
+	  /* strlen ("XX") == srcrpmlen */
861f93
+	  memmove (s + debuginfolen, s + srcrpmlen + debuginfolen,
861f93
+		   strlen (s + srcrpmlen + debuginfolen) + 1);
861f93
+	  /* s = `-debuginfo-%{version}-%{release}.%{arch}' */
861f93
+
861f93
+	  /* RPMDBI_PACKAGES requires keylen == sizeof (int).  */
861f93
+	  /* RPMDBI_LABEL is an interface for NVR-based dbiFindByLabel().  */
861f93
+	  mi_debuginfo = rpmtsInitIterator_p (ts, RPMDBI_LABEL, debuginfo, 0);
861f93
+	  xfree (debuginfo);
861f93
+	  if (mi_debuginfo)
861f93
+	    {
861f93
+	      rpmdbFreeIterator_p (mi_debuginfo);
861f93
+	      count = 0;
861f93
+	      break;
861f93
+	    }
861f93
+
861f93
+	  /* The allocated memory gets utilized below for MISSING_RPM_HASH.  */
861f93
+	  debuginfo = headerFormat_p (h,
861f93
+				      "%{name}-%{version}-%{release}.%{arch}",
861f93
+				      &err;;
861f93
+	  if (!debuginfo)
861f93
+	    {
861f93
+	      warning (_("Error querying the rpm file `%s': %s"), filename,
861f93
+	               err);
861f93
+	      continue;
861f93
+	    }
861f93
+
861f93
+	  /* Base package name for `debuginfo-install'.  We do not use the
861f93
+	     `yum' command directly as the line
861f93
+		 yum --enablerepo='*debug*' install NAME-debuginfo.ARCH
861f93
+	     would be more complicated than just:
861f93
+		 debuginfo-install NAME-VERSION-RELEASE.ARCH
861f93
+	     Do not supply the rpm base name (derived from .src.rpm name) as
861f93
+	     debuginfo-install is unable to install the debuginfo package if
861f93
+	     the base name PKG binary rpm is not installed while for example
861f93
+	     PKG-libs would be installed (RH Bug 467901).
861f93
+	     FUTURE: After multiple debuginfo versions simultaneously installed
861f93
+	     get supported the support for the VERSION-RELEASE tags handling
861f93
+	     may need an update.  */
861f93
+
861f93
+	  if (missing_rpm_hash == NULL)
861f93
+	    {
861f93
+	      /* DEL_F is passed NULL as MISSING_RPM_LIST's HTAB_DELETE
861f93
+		 should not deallocate the entries.  */
861f93
+
861f93
+	      missing_rpm_hash = htab_create_alloc (64, htab_hash_string,
861f93
+			       (int (*) (const void *, const void *)) streq,
861f93
+						    NULL, xcalloc, xfree);
861f93
+	    }
861f93
+	  slot = (char **) htab_find_slot (missing_rpm_hash, debuginfo, INSERT);
861f93
+	  /* XCALLOC never returns NULL.  */
861f93
+	  gdb_assert (slot != NULL);
861f93
+	  if (*slot == NULL)
861f93
+	    {
861f93
+	      struct missing_rpm *missing_rpm;
861f93
+
861f93
+	      *slot = debuginfo;
861f93
+
861f93
+	      missing_rpm = xmalloc (sizeof (*missing_rpm) + strlen (debuginfo));
861f93
+	      strcpy (missing_rpm->rpm, debuginfo);
861f93
+	      missing_rpm->next = missing_rpm_list;
861f93
+	      missing_rpm_list = missing_rpm;
861f93
+	      missing_rpm_list_entries++;
861f93
+	    }
861f93
+	  else
861f93
+	    xfree (debuginfo);
861f93
+	  count++;
861f93
+	}
861f93
+
861f93
+      rpmdbFreeIterator_p (mi);
861f93
+    }
861f93
+
861f93
+  rpmtsFree_p (ts);
861f93
+
861f93
+  return count;
861f93
+}
861f93
+
861f93
+static int
861f93
+missing_rpm_list_compar (const char *const *ap, const char *const *bp)
861f93
+{
861f93
+  return strcoll (*ap, *bp);
861f93
+}
861f93
+
861f93
+/* It returns a NULL-terminated array of strings needing to be FREEd.  It may
861f93
+   also return only NULL.  */
861f93
+
861f93
+static void
861f93
+missing_rpm_list_print (void)
861f93
+{
861f93
+  char **array, **array_iter;
861f93
+  struct missing_rpm *list_iter;
861f93
+  struct cleanup *cleanups;
861f93
+
861f93
+  if (missing_rpm_list_entries == 0)
861f93
+    return;
861f93
+
861f93
+  array = xmalloc (sizeof (*array) * missing_rpm_list_entries);
861f93
+  cleanups = make_cleanup (xfree, array);
861f93
+
861f93
+  array_iter = array;
861f93
+  for (list_iter = missing_rpm_list; list_iter != NULL;
861f93
+       list_iter = list_iter->next)
861f93
+    {
861f93
+      *array_iter++ = list_iter->rpm;
861f93
+    }
861f93
+  gdb_assert (array_iter == array + missing_rpm_list_entries);
861f93
+
861f93
+  qsort (array, missing_rpm_list_entries, sizeof (*array),
861f93
+	 (int (*) (const void *, const void *)) missing_rpm_list_compar);
861f93
+
861f93
+  printf_unfiltered (_("Missing separate debuginfos, use: %s"),
861f93
+		     "debuginfo-install");
861f93
+  for (array_iter = array; array_iter < array + missing_rpm_list_entries;
861f93
+       array_iter++)
861f93
+    {
861f93
+      putchar_unfiltered (' ');
861f93
+      puts_unfiltered (*array_iter);
861f93
+    }
861f93
+  putchar_unfiltered ('\n');
861f93
+
861f93
+  while (missing_rpm_list != NULL)
861f93
+    {
861f93
+      list_iter = missing_rpm_list;
861f93
+      missing_rpm_list = list_iter->next;
861f93
+      xfree (list_iter);
861f93
+    }
861f93
+  missing_rpm_list_entries = 0;
861f93
+
861f93
+  do_cleanups (cleanups);
861f93
+}
861f93
+
861f93
+static void
861f93
+missing_rpm_change (void)
861f93
+{
861f93
+  debug_flush_missing ();
861f93
+
861f93
+  gdb_assert (missing_rpm_list == NULL);
861f93
+  if (missing_rpm_hash != NULL)
861f93
+    {
861f93
+      htab_delete (missing_rpm_hash);
861f93
+      missing_rpm_hash = NULL;
861f93
+    }
861f93
+}
861f93
+
861f93
+enum missing_exec
861f93
+  {
861f93
+    /* Init state.  EXEC_BFD also still could be NULL.  */
861f93
+    MISSING_EXEC_NOT_TRIED,
861f93
+    /* We saw a non-NULL EXEC_BFD but RPM has no info about it.  */
861f93
+    MISSING_EXEC_NOT_FOUND,
861f93
+    /* We found EXEC_BFD by RPM and we either have its symbols (either embedded
861f93
+       or separate) or the main executable's RPM is now contained in
861f93
+       MISSING_RPM_HASH.  */
861f93
+    MISSING_EXEC_ENLISTED
861f93
+  };
861f93
+static enum missing_exec missing_exec = MISSING_EXEC_NOT_TRIED;
861f93
+
861f93
+#endif	/* HAVE_LIBRPM */
861f93
+
861f93
+void
861f93
+debug_flush_missing (void)
861f93
+{
861f93
+#ifdef HAVE_LIBRPM
861f93
+  missing_rpm_list_print ();
861f93
+#endif
861f93
+}
861f93
+
861f93
 /* This MISSING_FILEPAIR_HASH tracker is used only for the duplicite messages
861f93
-     Try to install the hash file ...
861f93
+     yum --enablerepo='*debug*' install ...
861f93
    avoidance.  */
861f93
 
861f93
 struct missing_filepair
861f93
@@ -1737,11 +2090,17 @@ missing_filepair_change (void)
861f93
       /* All their memory came just from missing_filepair_OBSTACK.  */
861f93
       missing_filepair_hash = NULL;
861f93
     }
861f93
+#ifdef HAVE_LIBRPM
861f93
+  missing_exec = MISSING_EXEC_NOT_TRIED;
861f93
+#endif
861f93
 }
861f93
 
861f93
 static void
861f93
 debug_print_executable_changed (void)
861f93
 {
861f93
+#ifdef HAVE_LIBRPM
861f93
+  missing_rpm_change ();
861f93
+#endif
861f93
   missing_filepair_change ();
861f93
 }
861f93
 
861f93
@@ -1808,14 +2167,34 @@ debug_print_missing (const char *binary,
861f93
 
861f93
   *slot = missing_filepair;
861f93
 
861f93
-  /* We do not collect and flush these messages as each such message
861f93
-     already requires its own separate lines.  */
861f93
+#ifdef HAVE_LIBRPM
861f93
+  if (missing_exec == MISSING_EXEC_NOT_TRIED)
861f93
+    {
861f93
+      char *execfilename;
861f93
 
861f93
-  fprintf_unfiltered (gdb_stdlog,
861f93
-		      _("Missing separate debuginfo for %s\n"), binary);
861f93
-  if (debug != NULL)
861f93
-    fprintf_unfiltered (gdb_stdlog, _("Try to install the hash file %s\n"),
861f93
-			debug);
861f93
+      execfilename = get_exec_file (0);
861f93
+      if (execfilename != NULL)
861f93
+	{
861f93
+	  if (missing_rpm_enlist (execfilename) == 0)
861f93
+	    missing_exec = MISSING_EXEC_NOT_FOUND;
861f93
+	  else
861f93
+	    missing_exec = MISSING_EXEC_ENLISTED;
861f93
+	}
861f93
+    }
861f93
+  if (missing_exec != MISSING_EXEC_ENLISTED)
861f93
+    if ((binary[0] == 0 || missing_rpm_enlist (binary) == 0)
861f93
+	&& (debug == NULL || missing_rpm_enlist (debug) == 0))
861f93
+#endif	/* HAVE_LIBRPM */
861f93
+      {
861f93
+	/* We do not collect and flush these messages as each such message
861f93
+	   already requires its own separate lines.  */
861f93
+
861f93
+	fprintf_unfiltered (gdb_stdlog,
861f93
+			    _("Missing separate debuginfo for %s\n"), binary);
861f93
+        if (debug != NULL)
861f93
+	  fprintf_unfiltered (gdb_stdlog, _("Try: %s %s\n"),
861f93
+			      "yum --enablerepo='*debug*' install", debug);
861f93
+      }
861f93
 }
861f93
 
861f93
 static char *
861f93
Index: gdb-7.6/gdb/symfile.h
861f93
===================================================================
861f93
--- gdb-7.6.orig/gdb/symfile.h	2013-07-17 19:51:02.639357629 +0200
861f93
+++ gdb-7.6/gdb/symfile.h	2013-07-17 19:51:02.687357661 +0200
861f93
@@ -598,6 +598,8 @@ extern struct elf_build_id *build_id_add
861f93
 extern char *build_id_to_filename (const struct elf_build_id *build_id,
861f93
 				   char **link_return, int add_debug_suffix);
861f93
 extern void debug_print_missing (const char *binary, const char *debug);
861f93
+extern void debug_flush_missing (void);
861f93
+#define BUILD_ID_MAIN_EXECUTABLE_FILENAME _("the main executable file")
861f93
 
861f93
 /* From dwarf2read.c */
861f93
 
861f93
Index: gdb-7.6/gdb/testsuite/lib/gdb.exp
861f93
===================================================================
861f93
--- gdb-7.6.orig/gdb/testsuite/lib/gdb.exp	2013-07-17 19:51:02.640357629 +0200
861f93
+++ gdb-7.6/gdb/testsuite/lib/gdb.exp	2013-07-17 19:51:02.688357662 +0200
861f93
@@ -1482,7 +1482,7 @@ proc default_gdb_start { } {
861f93
 	    warning "Couldn't set the width to 0."
861f93
 	}
861f93
     }
861f93
-    # Turn off the missing warnings as the testsuite does not expect it.
861f93
+    # Turn off the missing RPMs warnings as the testsuite does not expect it.
861f93
     send_gdb "set build-id-verbose 0\n"
861f93
     gdb_expect 10 {
861f93
 	-re "$gdb_prompt $" {
861f93
Index: gdb-7.6/gdb/testsuite/lib/mi-support.exp
861f93
===================================================================
861f93
--- gdb-7.6.orig/gdb/testsuite/lib/mi-support.exp	2013-07-17 19:51:02.656357640 +0200
861f93
+++ gdb-7.6/gdb/testsuite/lib/mi-support.exp	2013-07-17 19:51:02.689357663 +0200
861f93
@@ -212,7 +212,7 @@ proc default_mi_gdb_start { args } {
861f93
 	    warning "Couldn't set the width to 0."
861f93
 	}
861f93
     }
861f93
-    # Turn off the missing warnings as the testsuite does not expect it.
861f93
+    # Turn off the missing RPMs warnings as the testsuite does not expect it.
861f93
     send_gdb "190-gdb-set build-id-verbose 0\n"
861f93
     gdb_expect 10 {
861f93
 	-re ".*190-gdb-set build-id-verbose 0\r\n190\\\^done\r\n$mi_gdb_prompt$" {
861f93
Index: gdb-7.6/gdb/tui/tui-interp.c
861f93
===================================================================
861f93
--- gdb-7.6.orig/gdb/tui/tui-interp.c	2013-01-01 07:41:30.000000000 +0100
861f93
+++ gdb-7.6/gdb/tui/tui-interp.c	2013-07-17 19:51:02.689357663 +0200
861f93
@@ -30,6 +30,7 @@
861f93
 #include "tui/tui.h"
861f93
 #include "tui/tui-io.h"
861f93
 #include "exceptions.h"
861f93
+#include "symfile.h"
861f93
 
861f93
 /* Set to 1 when the TUI mode must be activated when we first start
861f93
    gdb.  */
861f93
Index: gdb-7.6/gdb/aclocal.m4
861f93
===================================================================
861f93
--- gdb-7.6.orig/gdb/aclocal.m4	2013-01-17 12:06:26.000000000 +0100
861f93
+++ gdb-7.6/gdb/aclocal.m4	2013-07-17 19:51:02.689357663 +0200
861f93
@@ -11,6 +11,164 @@
861f93
 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
861f93
 # PARTICULAR PURPOSE.
861f93
 
861f93
+# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
861f93
+# serial 1 (pkg-config-0.24)
861f93
+# 
861f93
+# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
861f93
+#
861f93
+# This program is free software; you can redistribute it and/or modify
861f93
+# it under the terms of the GNU General Public License as published by
861f93
+# the Free Software Foundation; either version 2 of the License, or
861f93
+# (at your option) any later version.
861f93
+#
861f93
+# This program is distributed in the hope that it will be useful, but
861f93
+# WITHOUT ANY WARRANTY; without even the implied warranty of
861f93
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
861f93
+# General Public License for more details.
861f93
+#
861f93
+# You should have received a copy of the GNU General Public License
861f93
+# along with this program; if not, write to the Free Software
861f93
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
861f93
+#
861f93
+# As a special exception to the GNU General Public License, if you
861f93
+# distribute this file as part of a program that contains a
861f93
+# configuration script generated by Autoconf, you may include it under
861f93
+# the same distribution terms that you use for the rest of that program.
861f93
+
861f93
+# PKG_PROG_PKG_CONFIG([MIN-VERSION])
861f93
+# ----------------------------------
861f93
+AC_DEFUN([PKG_PROG_PKG_CONFIG],
861f93
+[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
861f93
+m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
861f93
+AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
861f93
+AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
861f93
+AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
861f93
+
861f93
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
861f93
+	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
861f93
+fi
861f93
+if test -n "$PKG_CONFIG"; then
861f93
+	_pkg_min_version=m4_default([$1], [0.9.0])
861f93
+	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
861f93
+	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
861f93
+		AC_MSG_RESULT([yes])
861f93
+	else
861f93
+		AC_MSG_RESULT([no])
861f93
+		PKG_CONFIG=""
861f93
+	fi
861f93
+fi[]dnl
861f93
+])# PKG_PROG_PKG_CONFIG
861f93
+
861f93
+# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
861f93
+#
861f93
+# Check to see whether a particular set of modules exists.  Similar
861f93
+# to PKG_CHECK_MODULES(), but does not set variables or print errors.
861f93
+#
861f93
+# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
861f93
+# only at the first occurence in configure.ac, so if the first place
861f93
+# it's called might be skipped (such as if it is within an "if", you
861f93
+# have to call PKG_CHECK_EXISTS manually
861f93
+# --------------------------------------------------------------
861f93
+AC_DEFUN([PKG_CHECK_EXISTS],
861f93
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
861f93
+if test -n "$PKG_CONFIG" && \
861f93
+    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
861f93
+  m4_default([$2], [:])
861f93
+m4_ifvaln([$3], [else
861f93
+  $3])dnl
861f93
+fi])
861f93
+
861f93
+# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
861f93
+# ---------------------------------------------
861f93
+m4_define([_PKG_CONFIG],
861f93
+[if test -n "$$1"; then
861f93
+    pkg_cv_[]$1="$$1"
861f93
+ elif test -n "$PKG_CONFIG"; then
861f93
+    PKG_CHECK_EXISTS([$3],
861f93
+                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
861f93
+		     [pkg_failed=yes])
861f93
+ else
861f93
+    pkg_failed=untried
861f93
+fi[]dnl
861f93
+])# _PKG_CONFIG
861f93
+
861f93
+# _PKG_SHORT_ERRORS_SUPPORTED
861f93
+# -----------------------------
861f93
+AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
861f93
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
861f93
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
861f93
+        _pkg_short_errors_supported=yes
861f93
+else
861f93
+        _pkg_short_errors_supported=no
861f93
+fi[]dnl
861f93
+])# _PKG_SHORT_ERRORS_SUPPORTED
861f93
+
861f93
+
861f93
+# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
861f93
+# [ACTION-IF-NOT-FOUND])
861f93
+#
861f93
+#
861f93
+# Note that if there is a possibility the first call to
861f93
+# PKG_CHECK_MODULES might not happen, you should be sure to include an
861f93
+# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
861f93
+#
861f93
+#
861f93
+# --------------------------------------------------------------
861f93
+AC_DEFUN([PKG_CHECK_MODULES],
861f93
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
861f93
+AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
861f93
+AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
861f93
+
861f93
+pkg_failed=no
861f93
+AC_MSG_CHECKING([for $1])
861f93
+
861f93
+_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
861f93
+_PKG_CONFIG([$1][_LIBS], [libs], [$2])
861f93
+
861f93
+m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
861f93
+and $1[]_LIBS to avoid the need to call pkg-config.
861f93
+See the pkg-config man page for more details.])
861f93
+
861f93
+if test $pkg_failed = yes; then
861f93
+   	AC_MSG_RESULT([no])
861f93
+        _PKG_SHORT_ERRORS_SUPPORTED
861f93
+        if test $_pkg_short_errors_supported = yes; then
861f93
+	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
861f93
+        else 
861f93
+	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
861f93
+        fi
861f93
+	# Put the nasty error message in config.log where it belongs
861f93
+	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
861f93
+
861f93
+	m4_default([$4], [AC_MSG_ERROR(
861f93
+[Package requirements ($2) were not met:
861f93
+
861f93
+$$1_PKG_ERRORS
861f93
+
861f93
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
861f93
+installed software in a non-standard prefix.
861f93
+
861f93
+_PKG_TEXT])
861f93
+        ])
861f93
+elif test $pkg_failed = untried; then
861f93
+     	AC_MSG_RESULT([no])
861f93
+	m4_default([$4], [AC_MSG_FAILURE(
861f93
+[The pkg-config script could not be found or is too old.  Make sure it
861f93
+is in your PATH or set the PKG_CONFIG environment variable to the full
861f93
+path to pkg-config.
861f93
+
861f93
+_PKG_TEXT
861f93
+
861f93
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.])
861f93
+        ])
861f93
+else
861f93
+	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
861f93
+	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
861f93
+        AC_MSG_RESULT([yes])
861f93
+	$3
861f93
+fi[]dnl
861f93
+])# PKG_CHECK_MODULES
861f93
+
861f93
 # AM_CONDITIONAL                                            -*- Autoconf -*-
861f93
 
861f93
 # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
861f93
Index: gdb-7.6/gdb/config.in
861f93
===================================================================
861f93
--- gdb-7.6.orig/gdb/config.in	2012-12-09 19:39:58.000000000 +0100
861f93
+++ gdb-7.6/gdb/config.in	2013-07-17 19:51:02.689357663 +0200
861f93
@@ -33,6 +33,9 @@
861f93
 /* Define to BFD's default target vector. */
861f93
 #undef DEFAULT_BFD_VEC
861f93
 
861f93
+/* librpm version specific library name to dlopen. */
861f93
+#undef DLOPEN_LIBRPM
861f93
+
861f93
 /* Define to 1 if translation of program messages to the user's native
861f93
    language is requested. */
861f93
 #undef ENABLE_NLS
861f93
@@ -210,6 +213,9 @@
861f93
 /* Define if Python 2.7 is being used. */
861f93
 #undef HAVE_LIBPYTHON2_7
861f93
 
861f93
+/* Define if librpm library is being used. */
861f93
+#undef HAVE_LIBRPM
861f93
+
861f93
 /* Define to 1 if you have the <libunwind-ia64.h> header file. */
861f93
 #undef HAVE_LIBUNWIND_IA64_H
861f93
 
861f93
Index: gdb-7.6/gdb/configure
861f93
===================================================================
861f93
--- gdb-7.6.orig/gdb/configure	2013-07-17 19:51:01.665356963 +0200
861f93
+++ gdb-7.6/gdb/configure	2013-07-17 19:51:02.691357664 +0200
861f93
@@ -686,6 +686,11 @@ PKGVERSION
861f93
 HAVE_NATIVE_GCORE_TARGET
861f93
 TARGET_OBS
861f93
 subdirs
861f93
+RPM_LIBS
861f93
+RPM_CFLAGS
861f93
+PKG_CONFIG_LIBDIR
861f93
+PKG_CONFIG_PATH
861f93
+PKG_CONFIG
861f93
 GDB_DATADIR
861f93
 DEBUGDIR
861f93
 MAKEINFO_EXTRA_FLAGS
861f93
@@ -786,6 +791,7 @@ with_gdb_datadir
861f93
 with_relocated_sources
861f93
 with_auto_load_dir
861f93
 with_auto_load_safe_path
861f93
+with_rpm
861f93
 enable_targets
861f93
 enable_64_bit_bfd
861f93
 enable_gdbcli
861f93
@@ -834,6 +840,11 @@ CPPFLAGS
861f93
 CPP
861f93
 MAKEINFO
861f93
 MAKEINFOFLAGS
861f93
+PKG_CONFIG
861f93
+PKG_CONFIG_PATH
861f93
+PKG_CONFIG_LIBDIR
861f93
+RPM_CFLAGS
861f93
+RPM_LIBS
861f93
 YACC
861f93
 YFLAGS
861f93
 XMKMF'
861f93
@@ -1504,6 +1515,8 @@ Optional Packages:
861f93
                           [--with-auto-load-dir]
861f93
   --without-auto-load-safe-path
861f93
                           do not restrict auto-loaded files locations
861f93
+  --with-rpm              query rpm database for missing debuginfos (yes/no,
861f93
+                          def. auto=librpm.so)
861f93
   --with-libunwind-ia64   use libunwind frame unwinding for ia64 targets
861f93
   --with-curses           use the curses library instead of the termcap
861f93
                           library
861f93
@@ -1548,6 +1561,13 @@ Some influential environment variables:
861f93
   MAKEINFO    Parent configure detects if it is of sufficient version.
861f93
   MAKEINFOFLAGS
861f93
               Parameters for MAKEINFO.
861f93
+  PKG_CONFIG  path to pkg-config utility
861f93
+  PKG_CONFIG_PATH
861f93
+              directories to add to pkg-config's search path
861f93
+  PKG_CONFIG_LIBDIR
861f93
+              path overriding pkg-config's built-in search path
861f93
+  RPM_CFLAGS  C compiler flags for RPM, overriding pkg-config
861f93
+  RPM_LIBS    linker flags for RPM, overriding pkg-config
861f93
   YACC        The `Yet Another C Compiler' implementation to use. Defaults to
861f93
               the first program found out of: `bison -y', `byacc', `yacc'.
861f93
   YFLAGS      The list of arguments that will be passed by default to $YACC.
861f93
@@ -5033,6 +5053,491 @@ _ACEOF
861f93
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_auto_load_safe_path" >&5
861f93
 $as_echo "$with_auto_load_safe_path" >&6; }
861f93
 
861f93
+# Integration with rpm library to support missing debuginfo suggestions.
861f93
+# --without-rpm: Disable any rpm support.
861f93
+# --with-rpm=libname.so: Try to dynamically open `libname.so' during runtime.
861f93
+#   Even with runtime missing `libname.so' GDB will still other run correctly.
861f93
+#   Missing `libname.so' during ./configure will abort the configuration.
861f93
+# --with-rpm=librpm.so: Like `--with-rpm=libname.so' but try to find specific
861f93
+#   minor version first such as `librpm-4.6.so' as minor version differences
861f93
+#   mean API+ABI incompatibility.  If the specific match versioned library name
861f93
+#   could not be found still open dynamically at least `librpm.so'.
861f93
+# --with-rpm: Like `--with-rpm=librpm.so' but if any of its detection fails try
861f93
+#   to find librpm for compilation-time linking by pkg-config.  GDB binary will
861f93
+#   be probably linked with the version specific library (as `librpm-4.6.so').
861f93
+#   Failure to find librpm by pkg-config will abort the configuration.
861f93
+# (default) --with-rpm=auto: Like `--with-rpm=librpm.so' but if even pkg-config
861f93
+#   cannot find librpm use to the rpmless compilation (like `--without-rpm').
861f93
+
861f93
+
861f93
+# Check whether --with-rpm was given.
861f93
+if test "${with_rpm+set}" = set; then :
861f93
+  withval=$with_rpm;
861f93
+else
861f93
+  with_rpm="auto"
861f93
+fi
861f93
+
861f93
+
861f93
+
861f93
+
861f93
+if test "x$with_rpm" != "xno"; then
861f93
+  if test "x$with_rpm" = "xyes"; then
861f93
+    LIBRPM="librpm.so"
861f93
+    RPM_REQUIRE=true
861f93
+    DLOPEN_REQUIRE=false
861f93
+  elif test "x$with_rpm" = "xauto"; then
861f93
+    LIBRPM="librpm.so"
861f93
+    RPM_REQUIRE=false
861f93
+    DLOPEN_REQUIRE=false
861f93
+  else
861f93
+    LIBRPM="$with_rpm"
861f93
+    RPM_REQUIRE=true
861f93
+    DLOPEN_REQUIRE=true
861f93
+  fi
861f93
+  LIBRPM_STRING='"'"$LIBRPM"'"'
861f93
+
861f93
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking specific librpm version" >&5
861f93
+$as_echo_n "checking specific librpm version... " >&6; }
861f93
+  HAVE_DLOPEN_LIBRPM=false
861f93
+  save_LIBS="$LIBS"
861f93
+  LIBS="$LIBS -ldl"
861f93
+  if test "$cross_compiling" = yes; then :
861f93
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
861f93
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
861f93
+as_fn_error "cannot run test program while cross compiling
861f93
+See \`config.log' for more details." "$LINENO" 5; }
861f93
+else
861f93
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
861f93
+/* end confdefs.h.  */
861f93
+
861f93
+#include <rpm/rpmlib.h>
861f93
+#include <dlfcn.h>
861f93
+#include <errno.h>
861f93
+
861f93
+int
861f93
+main ()
861f93
+{
861f93
+
861f93
+    void *h;
861f93
+    const char *const *rpmverp;
861f93
+    FILE *f;
861f93
+
861f93
+    f = fopen ("conftest.out", "w");
861f93
+    if (!f)
861f93
+      {
861f93
+	fprintf (stderr, "Cannot write \"%s\": %s\n", "conftest.out",
861f93
+		 strerror (errno));
861f93
+	return 1;
861f93
+      }
861f93
+    h = dlopen ($LIBRPM_STRING, RTLD_LAZY);
861f93
+    if (!h)
861f93
+      {
861f93
+	fprintf (stderr, "dlopen (\"%s\"): %s\n", $LIBRPM_STRING, dlerror ());
861f93
+	return 1;
861f93
+      }
861f93
+    rpmverp = dlsym (h, "RPMVERSION");
861f93
+    if (!rpmverp)
861f93
+      {
861f93
+	fprintf (stderr, "dlsym (\"RPMVERSION\"): %s\n", dlerror ());
861f93
+	return 1;
861f93
+      }
861f93
+    fprintf (stderr, "RPMVERSION is: \"");
861f93
+    fprintf (stderr, "%s\"\n", *rpmverp);
861f93
+
861f93
+    /* Try to find the specific librpm version only for "librpm.so" as we do
861f93
+       not know how to assemble the version string otherwise.  */
861f93
+
861f93
+    if (strcmp ("librpm.so", $LIBRPM_STRING) != 0)
861f93
+      {
861f93
+	fprintf (f, "%s\n", $LIBRPM_STRING);
861f93
+	return 0;
861f93
+      }
861f93
+    else
861f93
+      {
861f93
+	char *h2_name;
861f93
+	void *h2;
861f93
+	int major, minor;
861f93
+
861f93
+	if (sscanf (*rpmverp, "%d.%d", &major, &minor) != 2)
861f93
+	  {
861f93
+	    fprintf (stderr, "Unable to parse RPMVERSION.\n");
861f93
+	    fprintf (f, "%s\n", $LIBRPM_STRING);
861f93
+	    return 0;
861f93
+	  }
861f93
+	/* Avoid the square brackets by malloc.  */
861f93
+	h2_name = malloc (64);
861f93
+	sprintf (h2_name, "librpm-%d.%d.so", major, minor);
861f93
+	h2 = dlopen (h2_name, RTLD_LAZY);
861f93
+	if (!h2)
861f93
+	  {
861f93
+	    fprintf (stderr, "dlopen (\"%s\"): %s\n", h2_name, dlerror ());
861f93
+	    fprintf (f, "%s\n", $LIBRPM_STRING);
861f93
+	    return 0;
861f93
+	  }
861f93
+	if (h2 != h)
861f93
+	  {
861f93
+	    fprintf (stderr, "dlopen of \"%s\" and \"%s\" are different.\n",
861f93
+		     $LIBRPM_STRING, h2_name);
861f93
+	    fprintf (f, "%s\n", $LIBRPM_STRING);
861f93
+	    return 0;
861f93
+	  }
861f93
+	/* Found the valid .so name with a specific version.  */
861f93
+	fprintf (f, "%s\n", h2_name);
861f93
+	return 0;
861f93
+      }
861f93
+
861f93
+  ;
861f93
+  return 0;
861f93
+}
861f93
+_ACEOF
861f93
+if ac_fn_c_try_run "$LINENO"; then :
861f93
+
861f93
+    DLOPEN_LIBRPM="`cat conftest.out`"
861f93
+    if test "x$DLOPEN_LIBRPM" != "x"; then
861f93
+      HAVE_DLOPEN_LIBRPM=true
861f93
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLOPEN_LIBRPM" >&5
861f93
+$as_echo "$DLOPEN_LIBRPM" >&6; }
861f93
+    fi
861f93
+
861f93
+fi
861f93
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
861f93
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
861f93
+fi
861f93
+
861f93
+  rm -f conftest.out
861f93
+
861f93
+
861f93
+
861f93
+  if $HAVE_DLOPEN_LIBRPM; then
861f93
+
861f93
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking rpm library API compatibility" >&5
861f93
+$as_echo_n "checking rpm library API compatibility... " >&6; }
861f93
+    # The compilation requires -Werror to verify anything.
861f93
+    save_CFLAGS="$CFLAGS"
861f93
+    CFLAGS="$CFLAGS -Werror"
861f93
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
861f93
+/* end confdefs.h.  */
861f93
+
861f93
+/* Duplicate here the declarations to verify they match "elfread.c".  */
861f93
+#include <rpm/rpmlib.h>
861f93
+#include <rpm/rpmts.h>
861f93
+#include <rpm/rpmdb.h>
861f93
+#include <rpm/header.h>
861f93
+extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
861f93
+extern int rpmReadConfigFiles(const char * file, const char * target);
861f93
+extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
861f93
+extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
861f93
+extern rpmts rpmtsCreate(void);
861f93
+extern rpmts rpmtsFree(rpmts ts);
861f93
+extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
861f93
+					    const void * keyp, size_t keylen);
861f93
+
861f93
+int
861f93
+main ()
861f93
+{
861f93
+
861f93
+  ;
861f93
+  return 0;
861f93
+}
861f93
+_ACEOF
861f93
+if ac_fn_c_try_compile "$LINENO"; then :
861f93
+
861f93
+      LIBRPM_COMPAT=true
861f93
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
861f93
+$as_echo "yes" >&6; }
861f93
+
861f93
+else
861f93
+
861f93
+      LIBRPM_COMPAT=false
861f93
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
861f93
+$as_echo "no" >&6; }
861f93
+
861f93
+fi
861f93
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
861f93
+    CFLAGS="$save_CFLAGS"
861f93
+
861f93
+    if ! $LIBRPM_COMPAT; then
861f93
+      HAVE_DLOPEN_LIBRPM=false
861f93
+    fi
861f93
+  fi
861f93
+
861f93
+  if $HAVE_DLOPEN_LIBRPM; then
861f93
+    DLOPEN_LIBRPM_STRING='"'"$DLOPEN_LIBRPM"'"'
861f93
+
861f93
+cat >>confdefs.h <<_ACEOF
861f93
+#define DLOPEN_LIBRPM $DLOPEN_LIBRPM_STRING
861f93
+_ACEOF
861f93
+
861f93
+
861f93
+$as_echo "#define HAVE_LIBRPM 1" >>confdefs.h
861f93
+
861f93
+  else
861f93
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
861f93
+$as_echo "no" >&6; }
861f93
+    LIBS="$save_LIBS"
861f93
+    if $DLOPEN_REQUIRE; then
861f93
+      as_fn_error "Specific name $LIBRPM was requested but it could not be opened." "$LINENO" 5
861f93
+    fi
861f93
+
861f93
+
861f93
+
861f93
+
861f93
+
861f93
+
861f93
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
861f93
+	if test -n "$ac_tool_prefix"; then
861f93
+  # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
861f93
+set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
861f93
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
861f93
+$as_echo_n "checking for $ac_word... " >&6; }
861f93
+if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
861f93
+  $as_echo_n "(cached) " >&6
861f93
+else
861f93
+  case $PKG_CONFIG in
861f93
+  [\\/]* | ?:[\\/]*)
861f93
+  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
861f93
+  ;;
861f93
+  *)
861f93
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
861f93
+for as_dir in $PATH
861f93
+do
861f93
+  IFS=$as_save_IFS
861f93
+  test -z "$as_dir" && as_dir=.
861f93
+    for ac_exec_ext in '' $ac_executable_extensions; do
861f93
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
861f93
+    ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
861f93
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
861f93
+    break 2
861f93
+  fi
861f93
+done
861f93
+  done
861f93
+IFS=$as_save_IFS
861f93
+
861f93
+  ;;
861f93
+esac
861f93
+fi
861f93
+PKG_CONFIG=$ac_cv_path_PKG_CONFIG
861f93
+if test -n "$PKG_CONFIG"; then
861f93
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
861f93
+$as_echo "$PKG_CONFIG" >&6; }
861f93
+else
861f93
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
861f93
+$as_echo "no" >&6; }
861f93
+fi
861f93
+
861f93
+
861f93
+fi
861f93
+if test -z "$ac_cv_path_PKG_CONFIG"; then
861f93
+  ac_pt_PKG_CONFIG=$PKG_CONFIG
861f93
+  # Extract the first word of "pkg-config", so it can be a program name with args.
861f93
+set dummy pkg-config; ac_word=$2
861f93
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
861f93
+$as_echo_n "checking for $ac_word... " >&6; }
861f93
+if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then :
861f93
+  $as_echo_n "(cached) " >&6
861f93
+else
861f93
+  case $ac_pt_PKG_CONFIG in
861f93
+  [\\/]* | ?:[\\/]*)
861f93
+  ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
861f93
+  ;;
861f93
+  *)
861f93
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
861f93
+for as_dir in $PATH
861f93
+do
861f93
+  IFS=$as_save_IFS
861f93
+  test -z "$as_dir" && as_dir=.
861f93
+    for ac_exec_ext in '' $ac_executable_extensions; do
861f93
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
861f93
+    ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
861f93
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
861f93
+    break 2
861f93
+  fi
861f93
+done
861f93
+  done
861f93
+IFS=$as_save_IFS
861f93
+
861f93
+  ;;
861f93
+esac
861f93
+fi
861f93
+ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
861f93
+if test -n "$ac_pt_PKG_CONFIG"; then
861f93
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
861f93
+$as_echo "$ac_pt_PKG_CONFIG" >&6; }
861f93
+else
861f93
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
861f93
+$as_echo "no" >&6; }
861f93
+fi
861f93
+
861f93
+  if test "x$ac_pt_PKG_CONFIG" = x; then
861f93
+    PKG_CONFIG=""
861f93
+  else
861f93
+    case $cross_compiling:$ac_tool_warned in
861f93
+yes:)
861f93
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
861f93
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
861f93
+ac_tool_warned=yes ;;
861f93
+esac
861f93
+    PKG_CONFIG=$ac_pt_PKG_CONFIG
861f93
+  fi
861f93
+else
861f93
+  PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
861f93
+fi
861f93
+
861f93
+fi
861f93
+if test -n "$PKG_CONFIG"; then
861f93
+	_pkg_min_version=0.9.0
861f93
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
861f93
+$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
861f93
+	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
861f93
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
861f93
+$as_echo "yes" >&6; }
861f93
+	else
861f93
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
861f93
+$as_echo "no" >&6; }
861f93
+		PKG_CONFIG=""
861f93
+	fi
861f93
+fi
861f93
+
861f93
+pkg_failed=no
861f93
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for RPM" >&5
861f93
+$as_echo_n "checking for RPM... " >&6; }
861f93
+
861f93
+if test -n "$RPM_CFLAGS"; then
861f93
+    pkg_cv_RPM_CFLAGS="$RPM_CFLAGS"
861f93
+ elif test -n "$PKG_CONFIG"; then
861f93
+    if test -n "$PKG_CONFIG" && \
861f93
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"rpm\""; } >&5
861f93
+  ($PKG_CONFIG --exists --print-errors "rpm") 2>&5
861f93
+  ac_status=$?
861f93
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
861f93
+  test $ac_status = 0; }; then
861f93
+  pkg_cv_RPM_CFLAGS=`$PKG_CONFIG --cflags "rpm" 2>/dev/null`
861f93
+else
861f93
+  pkg_failed=yes
861f93
+fi
861f93
+ else
861f93
+    pkg_failed=untried
861f93
+fi
861f93
+if test -n "$RPM_LIBS"; then
861f93
+    pkg_cv_RPM_LIBS="$RPM_LIBS"
861f93
+ elif test -n "$PKG_CONFIG"; then
861f93
+    if test -n "$PKG_CONFIG" && \
861f93
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"rpm\""; } >&5
861f93
+  ($PKG_CONFIG --exists --print-errors "rpm") 2>&5
861f93
+  ac_status=$?
861f93
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
861f93
+  test $ac_status = 0; }; then
861f93
+  pkg_cv_RPM_LIBS=`$PKG_CONFIG --libs "rpm" 2>/dev/null`
861f93
+else
861f93
+  pkg_failed=yes
861f93
+fi
861f93
+ else
861f93
+    pkg_failed=untried
861f93
+fi
861f93
+
861f93
+
861f93
+
861f93
+if test $pkg_failed = yes; then
861f93
+   	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
861f93
+$as_echo "no" >&6; }
861f93
+
861f93
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
861f93
+        _pkg_short_errors_supported=yes
861f93
+else
861f93
+        _pkg_short_errors_supported=no
861f93
+fi
861f93
+        if test $_pkg_short_errors_supported = yes; then
861f93
+	        RPM_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "rpm" 2>&1`
861f93
+        else
861f93
+	        RPM_PKG_ERRORS=`$PKG_CONFIG --print-errors "rpm" 2>&1`
861f93
+        fi
861f93
+	# Put the nasty error message in config.log where it belongs
861f93
+	echo "$RPM_PKG_ERRORS" >&5
861f93
+
861f93
+	HAVE_LIBRPM=false
861f93
+elif test $pkg_failed = untried; then
861f93
+     	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
861f93
+$as_echo "no" >&6; }
861f93
+	HAVE_LIBRPM=false
861f93
+else
861f93
+	RPM_CFLAGS=$pkg_cv_RPM_CFLAGS
861f93
+	RPM_LIBS=$pkg_cv_RPM_LIBS
861f93
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
861f93
+$as_echo "yes" >&6; }
861f93
+	HAVE_LIBRPM=true
861f93
+fi
861f93
+
861f93
+    if $HAVE_LIBRPM; then
861f93
+
861f93
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking rpm library API compatibility" >&5
861f93
+$as_echo_n "checking rpm library API compatibility... " >&6; }
861f93
+    # The compilation requires -Werror to verify anything.
861f93
+    save_CFLAGS="$CFLAGS"
861f93
+    CFLAGS="$CFLAGS -Werror"
861f93
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
861f93
+/* end confdefs.h.  */
861f93
+
861f93
+/* Duplicate here the declarations to verify they match "elfread.c".  */
861f93
+#include <rpm/rpmlib.h>
861f93
+#include <rpm/rpmts.h>
861f93
+#include <rpm/rpmdb.h>
861f93
+#include <rpm/header.h>
861f93
+extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
861f93
+extern int rpmReadConfigFiles(const char * file, const char * target);
861f93
+extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
861f93
+extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
861f93
+extern rpmts rpmtsCreate(void);
861f93
+extern rpmts rpmtsFree(rpmts ts);
861f93
+extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
861f93
+					    const void * keyp, size_t keylen);
861f93
+
861f93
+int
861f93
+main ()
861f93
+{
861f93
+
861f93
+  ;
861f93
+  return 0;
861f93
+}
861f93
+_ACEOF
861f93
+if ac_fn_c_try_compile "$LINENO"; then :
861f93
+
861f93
+      LIBRPM_COMPAT=true
861f93
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
861f93
+$as_echo "yes" >&6; }
861f93
+
861f93
+else
861f93
+
861f93
+      LIBRPM_COMPAT=false
861f93
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
861f93
+$as_echo "no" >&6; }
861f93
+
861f93
+fi
861f93
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
861f93
+    CFLAGS="$save_CFLAGS"
861f93
+
861f93
+      if ! $LIBRPM_COMPAT; then
861f93
+	HAVE_LIBRPM=false
861f93
+	RPM_PKG_ERRORS="Found $LIBRPM API is incompatibile with this GDB"
861f93
+      fi
861f93
+    fi
861f93
+
861f93
+    if $HAVE_LIBRPM; then
861f93
+
861f93
+$as_echo "#define HAVE_LIBRPM 1" >>confdefs.h
861f93
+
861f93
+      CFLAGS="$CFLAGS $RPM_CFLAGS"
861f93
+      LIBS="$LIBS $RPM_LIBS"
861f93
+    else
861f93
+      if $RPM_REQUIRE; then
861f93
+	as_fn_error "$RPM_PKG_ERRORS" "$LINENO" 5
861f93
+      else
861f93
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $RPM_PKG_ERRORS" >&5
861f93
+$as_echo "$as_me: WARNING: $RPM_PKG_ERRORS" >&2;}
861f93
+      fi
861f93
+    fi
861f93
+  fi
861f93
+fi
861f93
+
861f93
 
861f93
 
861f93
 subdirs="$subdirs testsuite"
861f93
Index: gdb-7.6/gdb/configure.ac
861f93
===================================================================
861f93
--- gdb-7.6.orig/gdb/configure.ac	2013-07-17 19:51:01.666356964 +0200
861f93
+++ gdb-7.6/gdb/configure.ac	2013-07-17 19:51:02.692357665 +0200
861f93
@@ -166,6 +166,199 @@ AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escap
861f93
 	      [Directories safe to hold auto-loaded files.])
861f93
 AC_MSG_RESULT([$with_auto_load_safe_path])
861f93
 
861f93
+# Integration with rpm library to support missing debuginfo suggestions.
861f93
+# --without-rpm: Disable any rpm support.
861f93
+# --with-rpm=libname.so: Try to dynamically open `libname.so' during runtime.
861f93
+#   Even with runtime missing `libname.so' GDB will still other run correctly.
861f93
+#   Missing `libname.so' during ./configure will abort the configuration.
861f93
+# --with-rpm=librpm.so: Like `--with-rpm=libname.so' but try to find specific
861f93
+#   minor version first such as `librpm-4.6.so' as minor version differences
861f93
+#   mean API+ABI incompatibility.  If the specific match versioned library name
861f93
+#   could not be found still open dynamically at least `librpm.so'.
861f93
+# --with-rpm: Like `--with-rpm=librpm.so' but if any of its detection fails try
861f93
+#   to find librpm for compilation-time linking by pkg-config.  GDB binary will
861f93
+#   be probably linked with the version specific library (as `librpm-4.6.so').
861f93
+#   Failure to find librpm by pkg-config will abort the configuration.
861f93
+# (default) --with-rpm=auto: Like `--with-rpm=librpm.so' but if even pkg-config
861f93
+#   cannot find librpm use to the rpmless compilation (like `--without-rpm').
861f93
+
861f93
+AC_ARG_WITH([rpm],
861f93
+  [AS_HELP_STRING([--with-rpm],
861f93
+                  [query rpm database for missing debuginfos (yes/no, def. auto=librpm.so)])], [], [with_rpm="auto"])
861f93
+
861f93
+m4_pattern_allow([^AC_MSG_ERROR$])
861f93
+m4_pattern_allow([^AC_MSG_WARN$])
861f93
+if test "x$with_rpm" != "xno"; then
861f93
+  if test "x$with_rpm" = "xyes"; then
861f93
+    LIBRPM="librpm.so"
861f93
+    RPM_REQUIRE=true
861f93
+    DLOPEN_REQUIRE=false
861f93
+  elif test "x$with_rpm" = "xauto"; then
861f93
+    LIBRPM="librpm.so"
861f93
+    RPM_REQUIRE=false
861f93
+    DLOPEN_REQUIRE=false
861f93
+  else
861f93
+    LIBRPM="$with_rpm"
861f93
+    RPM_REQUIRE=true
861f93
+    DLOPEN_REQUIRE=true
861f93
+  fi
861f93
+  LIBRPM_STRING='"'"$LIBRPM"'"'
861f93
+
861f93
+  AC_MSG_CHECKING([specific librpm version])
861f93
+  HAVE_DLOPEN_LIBRPM=false
861f93
+  save_LIBS="$LIBS"
861f93
+  LIBS="$LIBS -ldl"
861f93
+  AC_RUN_IFELSE(AC_LANG_PROGRAM([[
861f93
+#include <rpm/rpmlib.h>
861f93
+#include <dlfcn.h>
861f93
+#include <errno.h>
861f93
+  ]], [[
861f93
+    void *h;
861f93
+    const char *const *rpmverp;
861f93
+    FILE *f;
861f93
+
861f93
+    f = fopen ("conftest.out", "w");
861f93
+    if (!f)
861f93
+      {
861f93
+	fprintf (stderr, "Cannot write \"%s\": %s\n", "conftest.out",
861f93
+		 strerror (errno));
861f93
+	return 1;
861f93
+      }
861f93
+    h = dlopen ($LIBRPM_STRING, RTLD_LAZY);
861f93
+    if (!h)
861f93
+      {
861f93
+	fprintf (stderr, "dlopen (\"%s\"): %s\n", $LIBRPM_STRING, dlerror ());
861f93
+	return 1;
861f93
+      }
861f93
+    rpmverp = dlsym (h, "RPMVERSION");
861f93
+    if (!rpmverp)
861f93
+      {
861f93
+	fprintf (stderr, "dlsym (\"RPMVERSION\"): %s\n", dlerror ());
861f93
+	return 1;
861f93
+      }
861f93
+    fprintf (stderr, "RPMVERSION is: \"");
861f93
+    fprintf (stderr, "%s\"\n", *rpmverp);
861f93
+
861f93
+    /* Try to find the specific librpm version only for "librpm.so" as we do
861f93
+       not know how to assemble the version string otherwise.  */
861f93
+
861f93
+    if (strcmp ("librpm.so", $LIBRPM_STRING) != 0)
861f93
+      {
861f93
+	fprintf (f, "%s\n", $LIBRPM_STRING);
861f93
+	return 0;
861f93
+      }
861f93
+    else
861f93
+      {
861f93
+	char *h2_name;
861f93
+	void *h2;
861f93
+	int major, minor;
861f93
+
861f93
+	if (sscanf (*rpmverp, "%d.%d", &major, &minor) != 2)
861f93
+	  {
861f93
+	    fprintf (stderr, "Unable to parse RPMVERSION.\n");
861f93
+	    fprintf (f, "%s\n", $LIBRPM_STRING);
861f93
+	    return 0;
861f93
+	  }
861f93
+	/* Avoid the square brackets by malloc.  */
861f93
+	h2_name = malloc (64);
861f93
+	sprintf (h2_name, "librpm-%d.%d.so", major, minor);
861f93
+	h2 = dlopen (h2_name, RTLD_LAZY);
861f93
+	if (!h2)
861f93
+	  {
861f93
+	    fprintf (stderr, "dlopen (\"%s\"): %s\n", h2_name, dlerror ());
861f93
+	    fprintf (f, "%s\n", $LIBRPM_STRING);
861f93
+	    return 0;
861f93
+	  }
861f93
+	if (h2 != h)
861f93
+	  {
861f93
+	    fprintf (stderr, "dlopen of \"%s\" and \"%s\" are different.\n",
861f93
+		     $LIBRPM_STRING, h2_name);
861f93
+	    fprintf (f, "%s\n", $LIBRPM_STRING);
861f93
+	    return 0;
861f93
+	  }
861f93
+	/* Found the valid .so name with a specific version.  */
861f93
+	fprintf (f, "%s\n", h2_name);
861f93
+	return 0;
861f93
+      }
861f93
+  ]]), [
861f93
+    DLOPEN_LIBRPM="`cat conftest.out`"
861f93
+    if test "x$DLOPEN_LIBRPM" != "x"; then
861f93
+      HAVE_DLOPEN_LIBRPM=true
861f93
+      AC_MSG_RESULT($DLOPEN_LIBRPM)
861f93
+    fi
861f93
+  ])
861f93
+  rm -f conftest.out
861f93
+
861f93
+  m4_define([CHECK_LIBRPM_COMPAT], [
861f93
+    AC_MSG_CHECKING([rpm library API compatibility])
861f93
+    # The compilation requires -Werror to verify anything.
861f93
+    save_CFLAGS="$CFLAGS"
861f93
+    CFLAGS="$CFLAGS -Werror"
861f93
+    AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[
861f93
+/* Duplicate here the declarations to verify they match "elfread.c".  */
861f93
+#include <rpm/rpmlib.h>
861f93
+#include <rpm/rpmts.h>
861f93
+#include <rpm/rpmdb.h>
861f93
+#include <rpm/header.h>
861f93
+extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
861f93
+extern int rpmReadConfigFiles(const char * file, const char * target);
861f93
+extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
861f93
+extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
861f93
+extern rpmts rpmtsCreate(void);
861f93
+extern rpmts rpmtsFree(rpmts ts);
861f93
+extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
861f93
+					    const void * keyp, size_t keylen);
861f93
+    ]]), [
861f93
+      LIBRPM_COMPAT=true
861f93
+      AC_MSG_RESULT(yes)
861f93
+    ], [
861f93
+      LIBRPM_COMPAT=false
861f93
+      AC_MSG_RESULT(no)
861f93
+    ])
861f93
+    CFLAGS="$save_CFLAGS"
861f93
+  ])
861f93
+
861f93
+  if $HAVE_DLOPEN_LIBRPM; then
861f93
+    CHECK_LIBRPM_COMPAT
861f93
+    if ! $LIBRPM_COMPAT; then
861f93
+      HAVE_DLOPEN_LIBRPM=false
861f93
+    fi
861f93
+  fi
861f93
+
861f93
+  if $HAVE_DLOPEN_LIBRPM; then
861f93
+    DLOPEN_LIBRPM_STRING='"'"$DLOPEN_LIBRPM"'"'
861f93
+    AC_DEFINE_UNQUOTED(DLOPEN_LIBRPM, $DLOPEN_LIBRPM_STRING, [librpm version specific library name to dlopen.])
861f93
+    AC_DEFINE(HAVE_LIBRPM, 1, [Define if librpm library is being used.])
861f93
+  else
861f93
+    AC_MSG_RESULT(no)
861f93
+    LIBS="$save_LIBS"
861f93
+    if $DLOPEN_REQUIRE; then
861f93
+      AC_MSG_ERROR([Specific name $LIBRPM was requested but it could not be opened.])
861f93
+    fi
861f93
+    PKG_CHECK_MODULES(RPM, rpm, [HAVE_LIBRPM=true], [HAVE_LIBRPM=false])
861f93
+
861f93
+    if $HAVE_LIBRPM; then
861f93
+      CHECK_LIBRPM_COMPAT
861f93
+      if ! $LIBRPM_COMPAT; then
861f93
+	HAVE_LIBRPM=false
861f93
+	RPM_PKG_ERRORS="Found $LIBRPM API is incompatibile with this GDB"
861f93
+      fi
861f93
+    fi
861f93
+
861f93
+    if $HAVE_LIBRPM; then
861f93
+      AC_DEFINE(HAVE_LIBRPM, 1, [Define if librpm library is being used.])
861f93
+      CFLAGS="$CFLAGS $RPM_CFLAGS"
861f93
+      LIBS="$LIBS $RPM_LIBS"
861f93
+    else
861f93
+      if $RPM_REQUIRE; then
861f93
+	AC_MSG_ERROR($RPM_PKG_ERRORS)
861f93
+      else
861f93
+	AC_MSG_WARN($RPM_PKG_ERRORS)
861f93
+      fi
861f93
+    fi
861f93
+  fi
861f93
+fi
861f93
+ 
861f93
 AC_CONFIG_SUBDIRS(testsuite)
861f93
 
861f93
 # Check whether to support alternative target configurations
861f93
Index: gdb-7.6/gdb/corelow.c
861f93
===================================================================
861f93
--- gdb-7.6.orig/gdb/corelow.c	2013-07-17 19:51:02.608357607 +0200
861f93
+++ gdb-7.6/gdb/corelow.c	2013-07-17 19:51:02.692357665 +0200
861f93
@@ -314,7 +314,7 @@ build_id_locate_exec (int from_tty)
861f93
         symfile_objfile->flags |= OBJF_BUILD_ID_CORE_LOADED;
861f93
     }
861f93
   else
861f93
-    debug_print_missing (_("the main executable file"), build_id_filename);
861f93
+    debug_print_missing (BUILD_ID_MAIN_EXECUTABLE_FILENAME, build_id_filename);
861f93
 
861f93
   do_cleanups (back_to);
861f93