From patchwork Fri Apr 26 02:52:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thiago Jung Bauermann X-Patchwork-Id: 89020 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 E03463858414 for ; Fri, 26 Apr 2024 02:53:17 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-oi1-x230.google.com (mail-oi1-x230.google.com [IPv6:2607:f8b0:4864:20::230]) by sourceware.org (Postfix) with ESMTPS id 6F3993858C50 for ; Fri, 26 Apr 2024 02:52:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6F3993858C50 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6F3993858C50 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::230 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714099977; cv=none; b=ZbyoxB+ID7/kuBziUO5dTfokof5BexcB/WP9i4V3SWKm/whR51pn/zcJxNcGUN+bhhiOQLCeldkxG32FspZSWxvIqf9nGvbSOsqB9TakYkRu8ZaeZSS6WGtfZueNWJPN58x6XFmleFkqzPAUjpEkbSBPhQgWgGIiyz//X3G0Uic= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714099977; c=relaxed/simple; bh=kMJ7dix4lS+FjshdPsKj9e4W0SzCoeG4WS8JQZhNrhk=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=RBF3T7U3tNtxYRS7xP/t+CU00wq+JKBPdW2VBQmkGrUk1fNUrMmgaP9U5DCW3tivRYQ59mCUPLR6xod98V0h4b1a8wZjLyvOxlgDvFfBqzH4eqd5ohxqdqeBtmP+g6bIhVb++51ZlJQujaRtwYOOOWnHBq1HY6vqi/c6NTPB4cs= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-oi1-x230.google.com with SMTP id 5614622812f47-3c74fd6fb92so1173203b6e.3 for ; Thu, 25 Apr 2024 19:52:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714099974; x=1714704774; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=STd3L0PvXdADUYfVo7ansEh/LOp7j3KuPIfVihQP2cE=; b=Ysscf2C/kNxjWQ80Aqp4Zd8t/UPhEmVmxhGkdaawitZcqU8VZPeHPHslp+CurodlY7 wzBMBXrRqAl2kCqTj1Sj9Tv5Y4dMkkeHyvc6I9iwXz2+du16mpJNj11vPIS05pVaYej3 g25f4KUDR3aqXfwZFu4Wf5XYbDssyraN3EJQlylO5UcGTUJSxH2B9Iu3uQJvdzeaAnfo fyS5+GnHg2v7+YJccsH4Qcp/Sgq1VNKNy7QD4HVvn9+6mE+aoH3C+qUF8u810oPhh5At j31qhX0wRxf4Q1V3VC1RQfkVXX21LXSx+0UpOpXR1kjI6rBealKZES/qdd744DqRzR5M 2CRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714099974; x=1714704774; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=STd3L0PvXdADUYfVo7ansEh/LOp7j3KuPIfVihQP2cE=; b=LwriF+aH754StYWsW7wV0VXIIYIQ6DkgL8NKAIZzjLNS/4GNn+QWiCnEtDFC5kjgIe KbHPSWHrZ/YdtVkUuPRBJ7r5o68a9Zm0IbvXKVs/4K23s5v7/ZA66QtL9iJKxA7VJb/L Xrukn1k/VO/BU3woUhHW5HutkhOeaqTHnzO5/WJ5OpGcTDy17N5sGdRQ6SOtvm+9sORS 2zk4ZYVTbkd3RxANyJG3NRrcYhKzxAwBmSwqMvwo+lYgRrZuQ5QnqqLiz4MY15Mz6nJF U+JxIYzFqLpq1u2GJXqfuTQLVUczRUztMHzpGjyutpFe0bcFqxhVWl9++/vfVqpi66Bn Q61Q== X-Gm-Message-State: AOJu0YwB8gkTknNei1fc6hGU05V1dbD4yBcELAXaILzwSSiphV+eQvGH vw8f0DvEAiQiwSO1joAV65Cosvxz1MpL91hXBB6akIbTLzST/h39gWwHLXT6J/gnOkOXrjUYkoO g X-Google-Smtp-Source: AGHT+IH+VH9qkpnQlsOJX1afp+dtvuDrfPyROpTn6oJnozbQN+5mtRlWmGxwHx4DoDTOUD8JBHdGdQ== X-Received: by 2002:a05:6808:43:b0:3c5:e66b:1f79 with SMTP id v3-20020a056808004300b003c5e66b1f79mr1684073oic.16.1714099974541; Thu, 25 Apr 2024 19:52:54 -0700 (PDT) Received: from localhost ([2804:14d:7e39:8470:8e77:627f:e823:2d9f]) by smtp.gmail.com with ESMTPSA id gr6-20020a056a004d0600b006ed1ea5219csm13848789pfb.130.2024.04.25.19.52.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 19:52:54 -0700 (PDT) From: Thiago Jung Bauermann To: gdb-patches@sourceware.org Cc: Bernd Edlinger Subject: [PATCH] gdb/testsuite: Fix libc_has_debug_info when there's no libc Date: Thu, 25 Apr 2024 23:52:51 -0300 Message-ID: <20240426025251.1679310-1-thiago.bauermann@linaro.org> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, 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: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Bernd reported a Tcl error when running gdb.base/relativedebug.exp with a riscv-unknown-elf target with newlib (so there is no libc) because of commit f5ef12c3f1af ("gdb/testsuite: Add libc_has_debug_info require helper"): Running /home/ed/gnu/binutils-build-riscv64/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.base/relativedebug.exp ... FAIL: gdb.base/relativedebug.exp: info sharedlibrary libc.so ERROR: tcl error sourcing /home/ed/gnu/binutils-build-riscv64/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.base/relativedebug.exp. ERROR: tcl error code TCL READ VARNAME ERROR: can't read "libc_has_debug_info": no such variable while executing "verbose "$me: returning $libc_has_debug_info" 2" (procedure "gdb_real__libc_has_debug_info" line 47) invoked from within "gdb_real__libc_has_debug_info" ("uplevel" body line 1) invoked from within "uplevel 2 [list $real_name {*}$args]" invoked from within "gdb_do_cache_wrap $real_name {*}$args" (procedure "gdb_do_cache" line 48) invoked from within "gdb_do_cache libc_has_debug_info" (procedure "libc_has_debug_info" line 1) invoked from within "libc_has_debug_info" ("uplevel" body line 1) invoked from within "uplevel 1 $fn" (procedure "require" line 11) invoked from within "require {!target_info exists gdb,nosignals} libc_has_debug_info" (file "/home/ed/gnu/binutils-build-riscv64/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.base/relativedebug.exp" line 16) The problem is that when there's no libc.so in the inferior, "info sharedlibrary libc.so" responds with an output that doesn't match any of the patterns provided in libc_has_debug_info so gdb_test_multiple matches an internal pattern for the GDB prompt and thus the $libc_has_debug_info variable doesn't get set in the default pattern. Fix by: - always defining libc_has_debug_info and message with a default value, - adding a pattern for the case where there's no libc.so in the inferior, and - removing the default pattern, which doesn't serve a purpose anymore. Also, remove a couple of verbose messages which aren't really useful because they're redundant with the $message variable. Tested-By: Bernd Edlinger --- gdb/testsuite/lib/gdb.exp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) base-commit: cd0dbe767775fdbfdc875a14f9080fdea0841c92 diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 1e26937c0dcf..35e4de9e3b9d 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -3726,20 +3726,20 @@ gdb_caching_proc libc_has_debug_info {} { gdb_reinitialize_dir $srcdir/$subdir gdb_load "$obj" runto_main + set libc_has_debug_info 0 + set message "unable to get information on libc.so" set test "info sharedlibrary libc.so" gdb_test_multiple $test $test { -re ".*\(\\*\)\[^\r\n\]*/libc\.so.*$gdb_prompt $" { # Matched the "(*)" in the "Syms Read" columns which means: # "(*): Shared library is missing debugging information." - verbose -log "$me: libc doesn't have debug info" set libc_has_debug_info 0 set message "libc doesn't have debug info" } -re ".*Yes\[ \t\]+\[^\r\n\]*/libc\.so.*$gdb_prompt $" { - verbose -log "$me: libc has debug info" set libc_has_debug_info 1 } - default { + -re -wrap "No shared libraries matched." { set libc_has_debug_info 0 set message "libc not found in the inferior" }