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

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