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

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