File gdb-6.6-buildid-locate-rpm-scl.patch of Package gdb.783

warning: Skipping deprecated .gdb_index section
https://bugzilla.redhat.com/show_bug.cgi?id=953585

Index: gdb-7.6.90.20140127/gdb/dwarf2read.c
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/dwarf2read.c	2014-02-06 18:28:23.756232026 +0100
+++ gdb-7.6.90.20140127/gdb/dwarf2read.c	2014-02-06 18:28:48.969259122 +0100
@@ -3035,6 +3035,14 @@ read_index_from_section (struct objfile
      "set use-deprecated-index-sections on".  */
   if (version < 6 && !deprecated_ok)
     {
+      extern int rpm_verify_vendor (const char *filename);
+
+      /* Red Hat Developer Toolset exception.  */
+      if (rpm_verify_vendor (filename))
+	{}
+      else
+      {
+
       static int warning_printed = 0;
       if (!warning_printed)
 	{
@@ -3046,6 +3054,8 @@ to use the section anyway."),
 	  warning_printed = 1;
 	}
       return 0;
+
+      }
     }
   /* Version 7 indices generated by gold refer to the CU for a symbol instead
      of the TU (for symbols coming from TUs),
Index: gdb-7.6.90.20140127/gdb/build-id.c
===================================================================
--- gdb-7.6.90.20140127.orig/gdb/build-id.c	2014-02-06 18:28:23.758232029 +0100
+++ gdb-7.6.90.20140127/gdb/build-id.c	2014-02-06 18:28:26.814235312 +0100
@@ -711,7 +711,7 @@ static int missing_rpm_list_entries;
 /* Returns the count of newly added rpms.  */
 
 static int
-missing_rpm_enlist (const char *filename)
+missing_rpm_enlist_1 (const char *filename, int verify_vendor)
 {
   static int rpm_init_done = 0;
   rpmts ts;
@@ -815,7 +815,7 @@ missing_rpm_enlist (const char *filename
   mi = rpmtsInitIterator_p (ts, RPMTAG_BASENAMES, filename, 0);
   if (mi != NULL)
     {
-      for (;;)
+      if (!verify_vendor) for (;;)
 	{
 	  Header h;
 	  char *debuginfo, **slot, *s, *s2;
@@ -933,6 +933,35 @@ missing_rpm_enlist (const char *filename
 	    xfree (debuginfo);
 	  count++;
 	}
+      else /* verify_vendor */
+	{
+	  int vendor_pass = 0, vendor_fail = 0;
+
+	  for (;;)
+	    {
+	      Header h;
+	      errmsg_t err;
+	      char *vendor;
+
+	      h = rpmdbNextIterator_p (mi);
+	      if (h == NULL)
+		break;
+
+	      vendor = headerFormat_p (h, "%{vendor}", &err);
+	      if (!vendor)
+		{
+		  warning (_("Error querying the rpm file `%s': %s"), filename,
+			   err);
+		  continue;
+		}
+	      if (strcmp (vendor, "Red Hat, Inc.") == 0)
+		vendor_pass = 1;
+	      else
+		vendor_fail = 1;
+	      xfree (vendor);
+	    }
+	  count = vendor_pass != 0 && vendor_fail == 0;
+	}
 
       rpmdbFreeIterator_p (mi);
     }
@@ -943,6 +972,19 @@ missing_rpm_enlist (const char *filename
 }
 
 static int
+missing_rpm_enlist (const char *filename)
+{
+  return missing_rpm_enlist_1 (filename, 0);
+}
+
+extern int rpm_verify_vendor (const char *filename);
+int
+rpm_verify_vendor (const char *filename)
+{
+  return missing_rpm_enlist_1 (filename, 1);
+}
+
+static int
 missing_rpm_list_compar (const char *const *ap, const char *const *bp)
 {
   return strcoll (*ap, *bp);