]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
libdwfl: Report core module segment even when NT_FILE build-id doesn't match.
authorMark Wielaard <mjw@redhat.com>
Sat, 6 Jun 2015 13:06:22 +0000 (15:06 +0200)
committerMark Wielaard <mjw@redhat.com>
Mon, 8 Jun 2015 09:18:14 +0000 (11:18 +0200)
dwfl_segment_report_module can take the NT_FILE note contents to find
the matching file for the module on the file system from the core file.
If the file exists but the build-id didn't match we would not report the
module. But we should just report the module anyway, ignore the file,
and try to match the ELF image another way.

This issue can be replicated by building and running make check in
/tmp/elfutils with run-backtrace-core-aarch64.sh since that core file
includes a NT_FILE note pointing to /tmp/elfutils/tests/backtrace-child.
Which won't match if it was just recompiled.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
libdwfl/ChangeLog
libdwfl/dwfl_segment_report_module.c

index 4de383246da3de54f402fb48dbaad70b00a485dd..0daf893c292348dd83650255ac0bb6d567c1da78 100644 (file)
@@ -1,3 +1,9 @@
+2015-06-05  Mark Wielaard  <mjw@redhat.com>
+
+       * dwfl_segment_report_module.c (dwfl_segment_report_module):
+       If the note_file exists, but the build_id doesn't match discard
+       the file and continue reporting.
+
 2015-06-01  Mark Wielaard  <mjw@redhat.com>
 
        * dwfl_build_id_find_elf.c (__libdwfl_open_by_build_id): Copy path
index 705639d26c5f0540c3add7ecd2d6e3bef5ef9ed4..a0f07ada790f926844f58c22897e91f9c203eae4 100644 (file)
@@ -696,8 +696,13 @@ dwfl_segment_report_module (Dwfl *dwfl, int ndx, const char *name,
        }
       if (invalid)
        {
-         free (build_id);
-         return finish ();
+         /* The file was there, but the build_id didn't match.  We
+            still want to report the module, but need to get the ELF
+            some other way if possible.  */
+         close (fd);
+         fd = -1;
+         elf_end (elf);
+         elf = NULL;
        }
     }