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

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