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

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