From patchwork Fri Jul 19 08:31:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 94188 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 A896E3860C33 for ; Fri, 19 Jul 2024 08:32:33 +0000 (GMT) X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by sourceware.org (Postfix) with ESMTPS id E3AEE385B508 for ; Fri, 19 Jul 2024 08:32:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E3AEE385B508 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 E3AEE385B508 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::535 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721377940; cv=none; b=lVrXMkNPs0y1KSESsGK3F/1zM5gJBvWNBb5qRC/kmzsbwVwYhf8FcvMnZigCqbU1LJrsO8eYRdDnZPdPTGvMhqzGsFhP23UOR6KUL0itWUyCDgjDg26/EANJEIrUWjNMTdww/AtVCNLQTcWbM1mFwyBOzofsP6cB6kE1FyWDR+k= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721377940; c=relaxed/simple; bh=8vQiclWFbsx+3K/weG4sVm5OTnKn5KkkGLuIdqwnPHQ=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=qMzkX8iwut3umuXgEald9K8HbOKSVrzrTRiH6USvjz8rM0Ypfk+TYHQ2qFQ4JjAXEPKryF2/m+Bdt/Zbc04U/s2oA5J6OnzDLXBbQG89lAnReP359mRHSQSxhcGnowv1D5jTqcxWGmmg3il6kMEr7iBRFFxcGTbvrL7k49Da4yM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pg1-x535.google.com with SMTP id 41be03b00d2f7-75cda3719efso1073280a12.3 for ; Fri, 19 Jul 2024 01:32:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osandov-com.20230601.gappssmtp.com; s=20230601; t=1721377935; x=1721982735; 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=LN9ULPnxQsXZqSDNuee/EjD+HZw3Z8xHBCzOorWQ43MaSfN9BmI13rdto9FWWk2ycw G+Hzcs9hQFiQbQy4VyQxowtXxb/u1V0tYr1g7MlBtnrugLl36vtdkmxmrIKv9H80RX8k XGqL04S0cx3JbPMHNyYPzP04S9ir0NjCYckcU4mbhRj+XmoNvBDDw4HNQkNBZgADS0cX uL/yUJ2jwzFvnpqX+3xgnp+LeQx/Cr+/MdQMoZ+dYxZDEyYT37DpAbZzpWh7ptDU8wb1 doJ/seLvLgJATSQO4Kqye+Jh0CdGsoBa2DIPYCQy6OvDeTG4AxX7djq41F9iUNeR/m8/ sOxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721377935; x=1721982735; 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=DNGhKjaNOfGWj9JpY+yJU3yME/6GyvLir4VHsJgLn8I2OwRdpSiXKBCRtMnUwVAP78 KAbhnf5yF4C33Eij4MQj0iVQ9Fj6RQkFwmxeauFPM920OD8oYGIG3fVDR/qXBwOHnUq9 7ggRac8T3yfMs8YWwBZxHUSVZgZcI9aw4eVMEerw+Aora1z3Ro7iyrkJuzpMFMXY3YvJ CASgwSRqVL8Ex5X9G9LhEAn2JOQI0WU3UikmzYR8A32NrqjUbCTGiAJ4sf87Vz0zcbZ1 HVq/TJuVrUn+MEMiDtownh1U90sQF37HJatp4rIHdwhqXff+7G81nPjDf6w2Q1d2xhgg nu9A== X-Gm-Message-State: AOJu0YxRCF5uVun/DCxaSroK/PpIvnTsIoK7//Dgai9eJP/JvVf/q+Y5 ECDr/G4GMfajWFsehXkHrotc4iiuNm9HBnlojd6Ywph8e3Kn+kkpaLba5hldsAtxXXWUg4Letr5 G X-Google-Smtp-Source: AGHT+IG8WIRpcIENng26Qn2G40U2KTpd5QpQ45/P0IITKemz6mAMUPvB21AZy6qRGXoSyObLPPq+rQ== X-Received: by 2002:a05:6a20:258c:b0:1c2:9cbf:cc3e with SMTP id adf61e73a8af0-1c3fdd3bdffmr8908224637.45.1721377934477; Fri, 19 Jul 2024 01:32:14 -0700 (PDT) Received: from telecaster.hsd1.wa.comcast.net ([2601:602:8980:9170::7a8e]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1fd64b49467sm8832375ad.6.2024.07.19.01.32.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jul 2024 01:32:14 -0700 (PDT) From: Omar Sandoval To: elfutils-devel@sourceware.org Cc: "Frank Ch . Eigler" , linux-debuggers@vger.kernel.org Subject: [PATCH v3 1/7] debuginfod: fix skipping source file Date: Fri, 19 Jul 2024 01:31:57 -0700 Message-ID: <46cae5909ccc3ed390e37bd68eb54d032a4ad8a2.1721377314.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.8 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)