rpms/gdb/F-9 gdb-bz505163-unbound-array-deref.patch, NONE, 1.1 gdb-6.6-buildid-locate.patch, 1.13, 1.14 gdb.spec, 1.298, 1.299

Jan Kratochvil jkratoch at fedoraproject.org
Sat Jun 13 09:53:58 UTC 2009


Author: jkratoch

Update of /cvs/pkgs/rpms/gdb/F-9
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv23925

Modified Files:
	gdb-6.6-buildid-locate.patch gdb.spec 
Added Files:
	gdb-bz505163-unbound-array-deref.patch 
Log Message:
* Sat Jun 13 2009 Jan Kratochvil <jan.kratochvil at redhat.com> - 6.8-24
- Fix an occasional crash during printing of missing debuginfo rpms (BZ 505401).
- Fix dereferencing unbound C arrays (BZ 505163).


gdb-bz505163-unbound-array-deref.patch:

--- NEW FILE gdb-bz505163-unbound-array-deref.patch ---
>From 30c13da4efe18f43ee34aa4b29bc86e1a53de548 Mon Sep 17 00:00:00 2001
From: Jan Kratochvil <jkratoch at host1.dyn.jankratochvil.net>
Date: Thu, 11 Jun 2009 00:23:54 +0200
Subject: [PATCH] cherry-pick: Fix dereferencing unbound C arrays (RHBZ#505163).

gdb/
	* gdbtypes.c (get_discrete_bounds): Remove the VLA-introduced check for
	TYPE_RANGE_UPPER_BOUND_IS_UNDEFINED and
	TYPE_RANGE_LOWER_BOUND_IS_UNDEFINED.

gdb/testsuite/
	* gdb.base/arrayidx.c (unbound): New variable.
	* gdb.base/arrayidx.exp (p unbound.a == &unbound.a[0]): New test.
---
 gdb/gdbtypes.c                      |    3 ---
 gdb/testsuite/gdb.base/arrayidx.c   |    7 +++++++
 gdb/testsuite/gdb.base/arrayidx.exp |   10 +++++++++-
 3 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 012485c..9899727 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -769,9 +769,6 @@ get_discrete_bounds (struct type *type, LONGEST *lowp, LONGEST *highp)
   switch (TYPE_CODE (type))
     {
     case TYPE_CODE_RANGE:
-      if (TYPE_RANGE_UPPER_BOUND_IS_UNDEFINED (type) 
-	  || TYPE_RANGE_LOWER_BOUND_IS_UNDEFINED (type))
-	return -1;
       *lowp = TYPE_LOW_BOUND (type);
       *highp = TYPE_HIGH_BOUND (type);
       return 1;
diff --git a/gdb/testsuite/gdb.base/arrayidx.c b/gdb/testsuite/gdb.base/arrayidx.c
index 98d4d35..f98a656 100644
--- a/gdb/testsuite/gdb.base/arrayidx.c
+++ b/gdb/testsuite/gdb.base/arrayidx.c
@@ -17,6 +17,13 @@
 
 int array[] = {1, 2, 3, 4};
 
+#ifdef __GNUC__
+struct
+  {
+    int a[0];
+  } unbound;
+#endif
+
 int
 main (void)
 {
diff --git a/gdb/testsuite/gdb.base/arrayidx.exp b/gdb/testsuite/gdb.base/arrayidx.exp
index 71ce4aa..af0e5f8 100644
--- a/gdb/testsuite/gdb.base/arrayidx.exp
+++ b/gdb/testsuite/gdb.base/arrayidx.exp
@@ -59,4 +59,12 @@ gdb_test "print array" \
          "\\{\\\[0\\\] = 1, \\\[1\\\] = 2, \\\[2\\\] = 3, \\\[3\\\] = 4\\}" \
          "Print array with array-indexes on"
 
-
+set test "p unbound.a == &unbound.a\[0\]"
+gdb_test_multiple $test $test {
+    -re " = 1\r\n$gdb_prompt $" {
+	pass $test
+    }
+    -re "No symbol \"unbound\" in current context.\r\n$gdb_prompt $" {
+	unsupported "$test (no GCC)"
+    }
+}
-- 
1.6.0.6


gdb-6.6-buildid-locate.patch:

Index: gdb-6.6-buildid-locate.patch
===================================================================
RCS file: /cvs/pkgs/rpms/gdb/F-9/gdb-6.6-buildid-locate.patch,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -p -r1.13 -r1.14
--- gdb-6.6-buildid-locate.patch	23 Aug 2008 12:42:33 -0000	1.13
+++ gdb-6.6-buildid-locate.patch	13 Jun 2009 09:53:57 -0000	1.14
@@ -782,7 +782,7 @@
  
    if (retval != NULL && !build_id_verify (retval, build_id))
      {
-@@ -1314,9 +1714,438 @@ build_id_to_debug_filename (struct build
+@@ -1314,9 +1714,446 @@ build_id_to_debug_filename (struct build
        retval = NULL;
      }
  
@@ -1113,8 +1113,8 @@
 +		       const struct missing_filepair *elem2)
 +{
 +  return strcmp (elem1->binary, elem2->binary) == 0
-+         && ((elem1->debug == NULL && elem2->debug == NULL)
-+	     || strcmp (elem1->debug, elem2->debug) == 0);
++         && ((elem1->debug == NULL) == (elem2->debug == NULL))
++         && (elem1->debug == NULL || strcmp (elem1->debug, elem2->debug) == 0);
 +}
 +
 +static void
@@ -1147,6 +1147,7 @@
 +{
 +  size_t binary_len0 = strlen (binary) + 1;
 +  size_t debug_len0 = debug ? strlen (debug) + 1 : 0;
++  struct missing_filepair missing_filepair_find;
 +  struct missing_filepair *missing_filepair;
 +  struct missing_filepair **slot;
 +
@@ -1162,6 +1163,27 @@
 +	missing_filepair_xcalloc, NULL);
 +    }
 +
++  /* Use MISSING_FILEPAIR_FIND first instead of calling obstack_alloc with
++     obstack_free in the case of a (rare) match.  The problem is ALLOC_F for
++     MISSING_FILEPAIR_HASH allocates from MISSING_FILEPAIR_OBSTACK maintenance
++     structures for MISSING_FILEPAIR_HASH.  Calling obstack_free would possibly
++     not to free only MISSING_FILEPAIR but also some such structures (allocated
++     during the htab_find_slot call).  */
++
++  missing_filepair_find.binary = (char *) binary;
++  missing_filepair_find.debug = (char *) debug;
++  slot = (struct missing_filepair **) htab_find_slot (missing_filepair_hash,
++						      &missing_filepair_find,
++						      INSERT);
++
++  /* While it may be still printed duplicitely with the missing debuginfo file
++   * it is due to once printing about the binary file build-id link and once
++   * about the .debug file build-id link as both the build-id symlinks are
++   * located in the debuginfo package.  */
++
++  if (*slot != NULL)
++    return;
++
 +  missing_filepair = obstack_alloc (&missing_filepair_obstack,
 +				      sizeof (*missing_filepair) - 1
 +				      + binary_len0 + debug_len0);
@@ -1175,20 +1197,6 @@
 +  else
 +    missing_filepair->debug = NULL;
 +
-+  slot = (struct missing_filepair **) htab_find_slot (missing_filepair_hash,
-+							missing_filepair,
-+							INSERT);
-+
-+  /* While it may be still printed duplicitely with the missing debuginfo file
-+   * it is due to once printing about the binary file build-id link and once
-+   * about the .debug file build-id link as both the build-id symlinks are
-+   * located in the debuginfo package.  */
-+
-+  if (*slot != NULL)
-+    {
-+      obstack_free (&missing_filepair_obstack, missing_filepair);
-+      return;
-+    }
 +  *slot = missing_filepair;
 +
 +  if (missing_exec == MISSING_EXEC_NOT_TRIED)


Index: gdb.spec
===================================================================
RCS file: /cvs/pkgs/rpms/gdb/F-9/gdb.spec,v
retrieving revision 1.298
retrieving revision 1.299
diff -u -p -r1.298 -r1.299
--- gdb.spec	9 Nov 2008 14:03:53 -0000	1.298
+++ gdb.spec	13 Jun 2009 09:53:57 -0000	1.299
@@ -16,7 +16,7 @@ Version: 6.8
 
 # The release always contains a leading reserved number, start it at 1.
 # `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing.
-Release: 23%{?_with_upstream:.upstream}%{?dist}
+Release: 24%{?_with_upstream:.upstream}%{?dist}
 
 License: GPLv3+
 Group: Development/Debuggers
@@ -398,6 +398,9 @@ Patch338: gdb-6.8-breakpoint-gone.patch
 # Test the watchpoints conditionals works.
 Patch343: gdb-6.8-watchpoint-conditionals-test.patch
 
+# Fix dereferencing unbound C arrays (BZ 505163).
+Patch372: gdb-bz505163-unbound-array-deref.patch
+
 BuildRequires: ncurses-devel glibc-devel gcc make gzip texinfo dejagnu gettext
 BuildRequires: flex bison sharutils expat-devel
 Requires: readline
@@ -591,6 +594,7 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc
 %patch337 -p1
 %patch338 -p1
 %patch343 -p1
+%patch372 -p1
 %patch124 -p1
 
 find -name "*.orig" | xargs rm -f
@@ -843,6 +847,10 @@ fi
 %endif
 
 %changelog
+* Sat Jun 13 2009 Jan Kratochvil <jan.kratochvil at redhat.com> - 6.8-24
+- Fix an occasional crash during printing of missing debuginfo rpms (BZ 505401).
+- Fix dereferencing unbound C arrays (BZ 505163).
+
 * Sun Nov  9 2008 Jan Kratochvil <jan.kratochvil at redhat.com> - 6.8-23
 - Fix the variable-length-arrays support (BZ 468266, feature BZ 377541).
 - Fix the watchpoints conditionals.




More information about the fedora-extras-commits mailing list