From patchwork Fri Jul 19 18:24:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 94238 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6C9B1384A45E for ; Fri, 19 Jul 2024 18:25:05 +0000 (GMT) X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by sourceware.org (Postfix) with ESMTPS id 4F757384AB75 for ; Fri, 19 Jul 2024 18:24:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4F757384AB75 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=osandov.com Authentication-Results: sourceware.org; spf=none smtp.mailfrom=osandov.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 4F757384AB75 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::42d ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721413491; cv=none; b=fqQRsTyV8D547DPYCnE/9vheWfnCl0O3zZsjqajDtEBLV4zEFQL5K/dlAZ5FmsEVFh2nli+dfXBYKTXf6r/iPbg5pQ2PtR89f/AUjlXfGAYD4U0yd0HM6QXoZzmLA0YNjC+XOt08IqGTszw+EtUmlCsfWceaLASWXAb4nG7ZiCs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721413491; c=relaxed/simple; bh=8vQiclWFbsx+3K/weG4sVm5OTnKn5KkkGLuIdqwnPHQ=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=cITCMA8r78DAnhPW2ScEkGuDcJ7LimJApPloY72FCPB5v22eBzhbvHSX00tyH+Zi3ndH61Cv7iXR4yrJyqL8suzmXQ1Yntwj+d4wr785kngsNhWbsk8X/b3VdmnmjDVPnGyUsLi1T4MDxGGBg5wBmda/I23/bAm4L6CE2feloYM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-70b4267ccfcso900141b3a.3 for ; Fri, 19 Jul 2024 11:24:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osandov-com.20230601.gappssmtp.com; s=20230601; t=1721413487; x=1722018287; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jVyuRH8a24N2shL0mW04I1Et6TNCY2O7iCoC94+iBck=; b=JofKFuBn1CuK03LvelA8l45X43MGvfPrn4kWf3WIA7CgKCtX6BbbTiZoLjSgDuF28Q sEB0bqsQxMYOZY2y20ljNn1/qOEwri3w9mUAn/WgJtK4UxKvxTRYailxhDsfTECApqv8 +bgYy07om4KPjYCsYs6zh1V1g2gao+PtgfyXGOsrribvj1gbkwhe638qRKxf8sjpLmAu b9US1veEOYgePVt3S86C0GZZJtNICyWY3cIyPHLzEyGxcmx6RMt9EUULY+ShiERPFRbz xQTjloP+UiCpxbIAZ/cdl+RBgvLteFfugrwxwnCybj23jzcWiK2GXMoIqvErnl9UI4Cm rlKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721413487; x=1722018287; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jVyuRH8a24N2shL0mW04I1Et6TNCY2O7iCoC94+iBck=; b=XZovzJIc9Du43VBraS8lqqeqnT+a02Grj+zQyLQmsztdUPs0lePrVCrgDSykvI6icn OkEK8C1/TvLOmyrFfhK0WpsX/Hy0oyEAHhXg0Yqnvy0oHop691dL2+eADplFAh8rEhWk WOy7Fz0XyoytHSScM6D+/VVHtMbBS8hEIIjTYuwbPbjbj6fXg59uw50Xx0JA+fm6QcTJ WX8+Ew5TvMCTBE7EKWEyj/EmTPAMp0+NUV6hFjj7eVVVtqlTc6tqerhPMZMOVlaiW9Q9 eqJlDroDs3Yn5+OwixqGwqE8tPLOEY+4aQ7FpX0vkUlRALwM3MlTL1DsN1rWb0KIYY40 /q2A== X-Gm-Message-State: AOJu0Yz+Gxw4Si3z3jvco1awuqm+v6RSlbBQwFkCokuw08dII3RGh4Xu dV9qIOj/bhF8HndFqYNGfuEq2405A+eyoCHu1WCEK/wG1qhanOMF27fhIQzq1e0ONu1fB+VX9Gp W X-Google-Smtp-Source: AGHT+IGbmvfluW/xmcOhiPwk3zXBC7E5J1CArz7QJFI/ZehOxkBQB2KdZkKgvyKJe7E9mz5j1kPlyA== X-Received: by 2002:a05:6a00:2353:b0:70b:8190:d555 with SMTP id d2e1a72fcca58-70ce4f43908mr10801772b3a.32.1721413486801; Fri, 19 Jul 2024 11:24:46 -0700 (PDT) Received: from telecaster.thefacebook.com ([2620:10d:c090:500::7:5d79]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70cff4b2f40sm1476344b3a.63.2024.07.19.11.24.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jul 2024 11:24:46 -0700 (PDT) From: Omar Sandoval To: elfutils-devel@sourceware.org Cc: "Frank Ch . Eigler" , linux-debuggers@vger.kernel.org Subject: [PATCH v4 1/7] debuginfod: fix skipping source file Date: Fri, 19 Jul 2024 11:24:32 -0700 Message-ID: <46cae5909ccc3ed390e37bd68eb54d032a4ad8a2.1721413308.git.osandov@fb.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: elfutils-devel-bounces~patchwork=sourceware.org@sourceware.org From: Omar Sandoval dwarf_extract_source_paths explicitly skips source files that equal "", but dwarf_filesrc may return a path like "dir/". 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 --- 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& debug_sourcefiles) if (hat == NULL) continue; - if (string(hat) == "") // gcc intrinsics, don't bother record + if (string(hat) == "" + || string_endswith(hat, "")) // 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)