]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Always check crc in open_debug_file for now. Bug #338791 followup.
authorMark Wielaard <mark@klomp.org>
Fri, 5 Sep 2014 22:50:51 +0000 (22:50 +0000)
committerMark Wielaard <mark@klomp.org>
Fri, 5 Sep 2014 22:50:51 +0000 (22:50 +0000)
Revision r14464 made it so that debug alt files could be found by their
build-id or their (relative) file path. Debug alt files are matched using
the given build-id, but by crc. Calculating the full CRC is costly, but
currently still needed to avoid misidentifying the main file as debug
file. Slightly more efficient would be to use fstat to check we aren't
actually opening the main file under any other name (but that only works
for local DiImages). Or we could check that the file being opened actually
has at least one .debug* section. But this change was the minimal patch
to make things work as before.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14474

coregrind/m_debuginfo/readelf.c

index 86186d3b42b357b13c5228ca41cb2dc8cef836ca..75fa469714d4f7a8ece0ee14f5d4026b70df1055 100644 (file)
@@ -1180,7 +1180,12 @@ DiImage* open_debug_file( const HChar* name, const HChar* buildid, UInt crc,
          VG_(message)(Vg_DebugMsg, "  Considering %s ..\n", name);
    }
 
-   if (buildid) {
+   /* We will always check the crc if we have one (altfiles don't have one)
+      for now because we might be opening the main file again by any other
+      name, and that obviously also has the same buildid. More efficient
+      would be an fstat bases check or a check that the file actually
+      contains .debug* sections. */
+   if (buildid && crc == 0) {
       HChar* debug_buildid = find_buildid(dimg, rel_ok, True);
       if (debug_buildid == NULL || VG_(strcmp)(buildid, debug_buildid) != 0) {
          ML_(img_done)(dimg);