05b22fe
warning: Skipping deprecated .gdb_index section
05b22fe
https://bugzilla.redhat.com/show_bug.cgi?id=953585
05b22fe
46cc044
diff -dup -rup gdb-7.10.50.20160106-orig/gdb/build-id.c gdb-7.10.50.20160106/gdb/build-id.c
46cc044
--- gdb-7.10.50.20160106-orig/gdb/build-id.c	2016-01-09 14:40:39.420385241 +0100
46cc044
+++ gdb-7.10.50.20160106/gdb/build-id.c	2016-01-09 14:41:05.944549393 +0100
46cc044
@@ -713,7 +713,11 @@ static int missing_rpm_list_entries;
05b22fe
 /* Returns the count of newly added rpms.  */
05b22fe
 
05b22fe
 static int
46cc044
+#ifndef GDB_INDEX_VERIFY_VENDOR
46cc044
 missing_rpm_enlist (const char *filename)
46cc044
+#else
05b22fe
+missing_rpm_enlist_1 (const char *filename, int verify_vendor)
46cc044
+#endif
05b22fe
 {
05b22fe
   static int rpm_init_done = 0;
05b22fe
   rpmts ts;
46cc044
@@ -817,7 +821,11 @@ missing_rpm_enlist (const char *filename
05b22fe
   mi = rpmtsInitIterator_p (ts, RPMTAG_BASENAMES, filename, 0);
05b22fe
   if (mi != NULL)
05b22fe
     {
46cc044
+#ifndef GDB_INDEX_VERIFY_VENDOR
46cc044
       for (;;)
46cc044
+#else
05b22fe
+      if (!verify_vendor) for (;;)
46cc044
+#endif
05b22fe
 	{
05b22fe
 	  Header h;
05b22fe
 	  char *debuginfo, **slot, *s, *s2;
46cc044
@@ -935,6 +943,37 @@ missing_rpm_enlist (const char *filename
05b22fe
 	    xfree (debuginfo);
05b22fe
 	  count++;
05b22fe
 	}
46cc044
+#ifdef GDB_INDEX_VERIFY_VENDOR
05b22fe
+      else /* verify_vendor */
05b22fe
+	{
05b22fe
+	  int vendor_pass = 0, vendor_fail = 0;
05b22fe
+
05b22fe
+	  for (;;)
05b22fe
+	    {
05b22fe
+	      Header h;
05b22fe
+	      errmsg_t err;
05b22fe
+	      char *vendor;
05b22fe
+
05b22fe
+	      h = rpmdbNextIterator_p (mi);
05b22fe
+	      if (h == NULL)
05b22fe
+		break;
05b22fe
+
05b22fe
+	      vendor = headerFormat_p (h, "%{vendor}", &err;;
05b22fe
+	      if (!vendor)
05b22fe
+		{
05b22fe
+		  warning (_("Error querying the rpm file `%s': %s"), filename,
05b22fe
+			   err);
05b22fe
+		  continue;
05b22fe
+		}
05b22fe
+	      if (strcmp (vendor, "Red Hat, Inc.") == 0)
05b22fe
+		vendor_pass = 1;
05b22fe
+	      else
05b22fe
+		vendor_fail = 1;
05b22fe
+	      xfree (vendor);
05b22fe
+	    }
05b22fe
+	  count = vendor_pass != 0 && vendor_fail == 0;
05b22fe
+	}
46cc044
+#endif
05b22fe
 
05b22fe
       rpmdbFreeIterator_p (mi);
05b22fe
     }
46cc044
@@ -945,6 +984,21 @@ missing_rpm_enlist (const char *filename
05b22fe
 }
05b22fe
 
05b22fe
 static int
46cc044
+#ifdef GDB_INDEX_VERIFY_VENDOR
05b22fe
+missing_rpm_enlist (const char *filename)
05b22fe
+{
05b22fe
+  return missing_rpm_enlist_1 (filename, 0);
05b22fe
+}
05b22fe
+
05b22fe
+extern int rpm_verify_vendor (const char *filename);
05b22fe
+int
05b22fe
+rpm_verify_vendor (const char *filename)
05b22fe
+{
05b22fe
+  return missing_rpm_enlist_1 (filename, 1);
05b22fe
+}
05b22fe
+
05b22fe
+static int
46cc044
+#endif
05b22fe
 missing_rpm_list_compar (const char *const *ap, const char *const *bp)
05b22fe
 {
05b22fe
   return strcoll (*ap, *bp);
46cc044
diff -dup -rup gdb-7.10.50.20160106-orig/gdb/dwarf2read.c gdb-7.10.50.20160106/gdb/dwarf2read.c
46cc044
--- gdb-7.10.50.20160106-orig/gdb/dwarf2read.c	2016-01-09 14:40:39.416385216 +0100
46cc044
+++ gdb-7.10.50.20160106/gdb/dwarf2read.c	2016-01-09 14:41:05.942549381 +0100
46cc044
@@ -3111,6 +3111,16 @@ read_index_from_section (struct objfile
46cc044
      "set use-deprecated-index-sections on".  */
46cc044
   if (version < 6 && !deprecated_ok)
46cc044
     {
46cc044
+#ifdef GDB_INDEX_VERIFY_VENDOR
46cc044
+      extern int rpm_verify_vendor (const char *filename);
46cc044
+
46cc044
+      /* Red Hat Developer Toolset exception.  */
46cc044
+      if (rpm_verify_vendor (filename))
46cc044
+	{}
46cc044
+      else
46cc044
+      {
46cc044
+
46cc044
+#endif
46cc044
       static int warning_printed = 0;
46cc044
       if (!warning_printed)
46cc044
 	{
46cc044
@@ -3122,6 +3132,10 @@ to use the section anyway."),
46cc044
 	  warning_printed = 1;
46cc044
 	}
46cc044
       return 0;
46cc044
+#ifdef GDB_INDEX_VERIFY_VENDOR
46cc044
+
46cc044
+      }
46cc044
+#endif
46cc044
     }
46cc044
   /* Version 7 indices generated by gold refer to the CU for a symbol instead
46cc044
      of the TU (for symbols coming from TUs),