unwind-dw2-fde-glibc.c (_Unwind_IteratePhdrCallback): Guard against prev_cache_entry...
authorAndrew Haley <aph@redhat.com>
Thu, 15 Dec 2005 16:17:50 +0000 (16:17 +0000)
committerAndrew Haley <aph@gcc.gnu.org>
Thu, 15 Dec 2005 16:17:50 +0000 (16:17 +0000)
2005-12-15  Andrew Haley  <aph@redhat.com>

        * unwind-dw2-fde-glibc.c (_Unwind_IteratePhdrCallback): Guard
        against prev_cache_entry == NULL when moving a cache entry to the
        head of the list.

From-SVN: r108582

gcc/ChangeLog
gcc/unwind-dw2-fde-glibc.c

index 3a79601e17972ed3cd4d24d1b7062fcb1b6fa8c2..7c5d580c3ca31351df4c472553087b0a008553df 100644 (file)
@@ -1,3 +1,9 @@
+2005-12-15  Andrew Haley  <aph@redhat.com>
+
+       * unwind-dw2-fde-glibc.c (_Unwind_IteratePhdrCallback): Guard
+       against prev_cache_entry == NULL when moving a cache entry to the
+       head of the list.
+       
 2005-12-15  Nathan Sidwell  <nathan@codesourcery.com>
 
        * config/mt/mt.c (mt_override_options): Require lower case
index e7bd31b15835dd004856740e977ff4cf564e9d4d..25bf2bb1bce41194603db705e3a4a9f4ad49b6e9 100644 (file)
@@ -257,7 +257,10 @@ _Unwind_IteratePhdrCallback (struct dl_phdr_info *info, size_t size, void *ptr)
 
   if (size >= sizeof (struct ext_dl_phdr_info))
     {
-      if (last_cache_entry != NULL)
+      /* Move the cache entry we're about to overwrite to the head of
+        the list.  If either last_cache_entry or prev_cache_entry are
+        NULL, that cache entry is already at the head.  */
+      if (last_cache_entry != NULL && prev_cache_entry != NULL)
        {
          prev_cache_entry->link = last_cache_entry->link;
          last_cache_entry->link = frame_hdr_cache_head;