]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Add changes to ensure that a DebugInfo that has been archived cannot be archived...
authorJulian Seward <jseward@acm.org>
Fri, 17 Aug 2018 07:09:21 +0000 (09:09 +0200)
committerJulian Seward <jseward@acm.org>
Fri, 17 Aug 2018 07:09:21 +0000 (09:09 +0200)
* discard_or_archive_marked_DebugInfos: clear the mark bit for a Debuginfo
  that will be archived

* discard_DebugInfos_which_overlap_with: when selecting DebugInfos to be
  discarded or archived, fix a mistake in which some mark bits wouldn't be
  changed at all, meaning their "old" value was used to influence the current
  operation.

These may (or may not) fix #393146; at the very least, they are somehow
related.

coregrind/m_debuginfo/debuginfo.c

index 55c05cbe06fd58af02fe02cb22ceab8dadf8c4c2..a4e660d0b56ba4933ea63c75933f8fdc8db49a63 100644 (file)
@@ -40,6 +40,7 @@
 #include "pub_core_libcprint.h"
 #include "pub_core_libcfile.h"
 #include "pub_core_libcproc.h"   // VG_(getenv)
+#include "pub_core_rangemap.h"
 #include "pub_core_seqmatch.h"
 #include "pub_core_options.h"
 #include "pub_core_redir.h"      // VG_(redir_notify_{new,delete}_SegInfo)
@@ -449,7 +450,7 @@ static void discard_or_archive_DebugInfo ( DebugInfo* di )
    DebugInfo*  curr          =  debugInfo_list;
 
    /* It must be active! */
-   vg_assert( is_DebugInfo_active(di));
+   vg_assert(is_DebugInfo_active(di));
    while (curr) {
       if (curr == di) {
          /* Found it; (remove from list and free it), or archive it. */
@@ -475,6 +476,7 @@ static void discard_or_archive_DebugInfo ( DebugInfo* di )
             di->last_epoch = VG_(current_DiEpoch)();
             VG_(archive_ExeContext_in_range) (di->last_epoch,
                                               di->text_avma, di->text_size);
+            vg_assert(is_DebugInfo_archived(di));
          } else {
             free_DebugInfo(curr);
          }
@@ -586,6 +588,13 @@ static void discard_or_archive_marked_DebugInfos ( void )
       }
 
       if (!curr) break;
+
+      // If |curr| is going to remain in the debugInfo_list, and merely change
+      // state, then we need to clear its mark bit so we don't subsequently
+      // try to archive it again later.  Possibly related to #393146.
+      if (VG_(clo_keep_debuginfo))
+         curr->mark = False;
+
       discard_or_archive_DebugInfo( curr );
 
    }
@@ -603,6 +612,7 @@ static void discard_DebugInfos_which_overlap_with ( DebugInfo* diRef )
       overlap with siRef.  Since siRef itself is in this list we at
       least expect its own mark bit to be set. */
    for (di = debugInfo_list; di; di = di->next) {
+      di->mark = False;
       if (is_DebugInfo_archived(di))
          continue;
       di->mark = do_DebugInfos_overlap( di, diRef );