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

4416f5
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
4416f5
From: Fedora GDB patches <invalid@email.com>
4416f5
Date: Fri, 27 Oct 2017 21:07:50 +0200
4416f5
Subject: gdb-6.6-buildid-locate-rpm-scl.patch
4416f5
4416f5
;; [SCL] Skip deprecated .gdb_index warning for Red Hat built files (BZ 953585).
4416f5
;;=push+jan
4416f5
4416f5
warning: Skipping deprecated .gdb_index section
4416f5
https://bugzilla.redhat.com/show_bug.cgi?id=953585
4416f5
4416f5
diff --git a/gdb/build-id.c b/gdb/build-id.c
4416f5
--- a/gdb/build-id.c
4416f5
+++ b/gdb/build-id.c
4416f5
@@ -742,7 +742,11 @@ static int missing_rpm_list_entries;
4416f5
 /* Returns the count of newly added rpms.  */
4416f5
 
4416f5
 static int
4416f5
+#ifndef GDB_INDEX_VERIFY_VENDOR
4416f5
 missing_rpm_enlist (const char *filename)
4416f5
+#else
4416f5
+missing_rpm_enlist_1 (const char *filename, int verify_vendor)
4416f5
+#endif
4416f5
 {
4416f5
   static int rpm_init_done = 0;
4416f5
   rpmts ts;
4416f5
@@ -849,7 +853,11 @@ missing_rpm_enlist (const char *filename)
4416f5
   mi = rpmtsInitIterator_p (ts, RPMTAG_BASENAMES, filename, 0);
4416f5
   if (mi != NULL)
4416f5
     {
4416f5
+#ifndef GDB_INDEX_VERIFY_VENDOR
4416f5
       for (;;)
4416f5
+#else
4416f5
+      if (!verify_vendor) for (;;)
4416f5
+#endif
4416f5
 	{
4416f5
 	  Header h;
4416f5
 	  char *debuginfo, **slot, *s, *s2;
4416f5
@@ -967,6 +975,37 @@ missing_rpm_enlist (const char *filename)
4416f5
 	    xfree (debuginfo);
4416f5
 	  count++;
4416f5
 	}
4416f5
+#ifdef GDB_INDEX_VERIFY_VENDOR
4416f5
+      else /* verify_vendor */
4416f5
+	{
4416f5
+	  int vendor_pass = 0, vendor_fail = 0;
4416f5
+
4416f5
+	  for (;;)
4416f5
+	    {
4416f5
+	      Header h;
4416f5
+	      errmsg_t err;
4416f5
+	      char *vendor;
4416f5
+
4416f5
+	      h = rpmdbNextIterator_p (mi);
4416f5
+	      if (h == NULL)
4416f5
+		break;
4416f5
+
4416f5
+	      vendor = headerFormat_p (h, "%{vendor}", &err;;
4416f5
+	      if (!vendor)
4416f5
+		{
4416f5
+		  warning (_("Error querying the rpm file `%s': %s"), filename,
4416f5
+			   err);
4416f5
+		  continue;
4416f5
+		}
4416f5
+	      if (strcmp (vendor, "Red Hat, Inc.") == 0)
4416f5
+		vendor_pass = 1;
4416f5
+	      else
4416f5
+		vendor_fail = 1;
4416f5
+	      xfree (vendor);
4416f5
+	    }
4416f5
+	  count = vendor_pass != 0 && vendor_fail == 0;
4416f5
+	}
4416f5
+#endif
4416f5
 
4416f5
       rpmdbFreeIterator_p (mi);
4416f5
     }
4416f5
@@ -976,6 +1015,20 @@ missing_rpm_enlist (const char *filename)
4416f5
   return count;
4416f5
 }
4416f5
 
4416f5
+#ifdef GDB_INDEX_VERIFY_VENDOR
4416f5
+missing_rpm_enlist (const char *filename)
4416f5
+{
4416f5
+  return missing_rpm_enlist_1 (filename, 0);
4416f5
+}
4416f5
+
4416f5
+extern int rpm_verify_vendor (const char *filename);
4416f5
+int
4416f5
+rpm_verify_vendor (const char *filename)
4416f5
+{
4416f5
+  return missing_rpm_enlist_1 (filename, 1);
4416f5
+}
4416f5
+#endif
4416f5
+
4416f5
 static bool
4416f5
 missing_rpm_list_compar (const char *ap, const char *bp)
4416f5
 {
4416f5
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
4416f5
--- a/gdb/dwarf2/read.c
4416f5
+++ b/gdb/dwarf2/read.c
4416f5
@@ -3034,6 +3034,16 @@ read_gdb_index_from_buffer (const char *filename,
4416f5
      "set use-deprecated-index-sections on".  */
4416f5
   if (version < 6 && !deprecated_ok)
4416f5
     {
4416f5
+#ifdef GDB_INDEX_VERIFY_VENDOR
4416f5
+      extern int rpm_verify_vendor (const char *filename);
4416f5
+
4416f5
+      /* Red Hat Developer Toolset exception.  */
4416f5
+      if (rpm_verify_vendor (filename))
4416f5
+	{}
4416f5
+      else
4416f5
+      {
4416f5
+
4416f5
+#endif
4416f5
       static int warning_printed = 0;
4416f5
       if (!warning_printed)
4416f5
 	{
4416f5
@@ -3045,6 +3055,10 @@ to use the section anyway."),
4416f5
 	  warning_printed = 1;
4416f5
 	}
4416f5
       return 0;
4416f5
+#ifdef GDB_INDEX_VERIFY_VENDOR
4416f5
+
4416f5
+      }
4416f5
+#endif
4416f5
     }
4416f5
   /* Version 7 indices generated by gold refer to the CU for a symbol instead
4416f5
      of the TU (for symbols coming from TUs),