Linux debuggers
 help / color / mirror / Atom feed
From: Omar Sandoval <osandov@osandov.com>
To: elfutils-devel@sourceware.org
Cc: "Frank Ch . Eigler" <fche@redhat.com>, linux-debuggers@vger.kernel.org
Subject: [PATCH v3 1/7] debuginfod: fix skipping <built-in> source file
Date: Fri, 19 Jul 2024 01:31:57 -0700	[thread overview]
Message-ID: <46cae5909ccc3ed390e37bd68eb54d032a4ad8a2.1721377314.git.osandov@fb.com> (raw)
In-Reply-To: <cover.1721377314.git.osandov@fb.com>

From: Omar Sandoval <osandov@fb.com>

dwarf_extract_source_paths explicitly skips source files that equal
"<built-in>", but dwarf_filesrc may return a path like "dir/<built-in>".
Check for and skip that case, too.

In particular, the test debuginfod RPMs have paths like this.  However,
the test cases didn't catch this because they have a bug, too: they
follow symlinks, which results in double-counting every file.  Fix that,
too.

Signed-off-by: Omar Sandoval <osandov@fb.com>
---
 debuginfod/debuginfod.cxx             | 3 ++-
 tests/run-debuginfod-archive-groom.sh | 2 +-
 tests/run-debuginfod-extraction.sh    | 2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx
index 305edde8..92022f3d 100644
--- a/debuginfod/debuginfod.cxx
+++ b/debuginfod/debuginfod.cxx
@@ -3446,7 +3446,8 @@ dwarf_extract_source_paths (Elf *elf, set<string>& debug_sourcefiles)
           if (hat == NULL)
             continue;
 
-          if (string(hat) == "<built-in>") // gcc intrinsics, don't bother record
+          if (string(hat) == "<built-in>"
+              || string_endswith(hat, "<built-in>")) // gcc intrinsics, don't bother record
             continue;
 
           string waldo;
diff --git a/tests/run-debuginfod-archive-groom.sh b/tests/run-debuginfod-archive-groom.sh
index e2c394ef..0131158f 100755
--- a/tests/run-debuginfod-archive-groom.sh
+++ b/tests/run-debuginfod-archive-groom.sh
@@ -109,7 +109,7 @@ for i in $newrpms; do
     rpm2cpio ../$i | cpio -ivd;
     cd ..;
 done
-sourcefiles=$(find -name \*\\.debug \
+sourcefiles=$(find -name \*\\.debug -type f \
               | env LD_LIBRARY_PATH=$ldpath xargs \
                 ${abs_top_builddir}/src/readelf --debug-dump=decodedline \
               | grep mtime: | wc --lines)
diff --git a/tests/run-debuginfod-extraction.sh b/tests/run-debuginfod-extraction.sh
index da6b25cf..f49dc6f6 100755
--- a/tests/run-debuginfod-extraction.sh
+++ b/tests/run-debuginfod-extraction.sh
@@ -94,7 +94,7 @@ for i in $newrpms; do
     rpm2cpio ../$i | cpio -ivd;
     cd ..;
 done
-sourcefiles=$(find -name \*\\.debug \
+sourcefiles=$(find -name \*\\.debug -type f \
               | env LD_LIBRARY_PATH=$ldpath xargs \
                 ${abs_top_builddir}/src/readelf --debug-dump=decodedline \
               | grep mtime: | wc --lines)
-- 
2.45.2


  reply	other threads:[~2024-07-19  8:32 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-19  8:31 [PATCH v3 0/7] debuginfod: speed up extraction from kernel debuginfo packages by 200x Omar Sandoval
2024-07-19  8:31 ` Omar Sandoval [this message]
2024-07-19  8:31 ` [PATCH v3 2/7] tests/run-debuginfod-fd-prefetch-caches.sh: disable fdcache limit check Omar Sandoval
2024-07-19  8:31 ` [PATCH v3 3/7] debuginfod: factor out common code for responding from an archive Omar Sandoval
2024-07-19  8:32 ` [PATCH v3 4/7] debugifod: add new table and views for seekable archives Omar Sandoval
2024-07-19  8:32 ` [PATCH v3 5/7] debuginfod: optimize extraction from seekable xz archives Omar Sandoval
2024-07-19  8:32 ` [PATCH v3 6/7] debuginfod: populate _r_seekable on scan Omar Sandoval
2024-07-19  8:32 ` [PATCH v3 7/7] debuginfod: populate _r_seekable on request Omar Sandoval
2024-07-19 17:34 ` [PATCH v3 0/7] debuginfod: speed up extraction from kernel debuginfo packages by 200x Frank Ch. Eigler
2024-07-19 18:04   ` Omar Sandoval

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46cae5909ccc3ed390e37bd68eb54d032a4ad8a2.1721377314.git.osandov@fb.com \
    --to=osandov@osandov.com \
    --cc=elfutils-devel@sourceware.org \
    --cc=fche@redhat.com \
    --cc=linux-debuggers@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox