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

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