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

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