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: 792332 Delivered-To: patch@linaro.org Received: by 2002:adf:cc13:0:b0:346:15ad:a2a with SMTP id x19csp249164wrh; Thu, 25 Apr 2024 19:53:14 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUJ7bJGmnPgdik8ggZwKG8o0F9Pc5BI7niuyLzk2bOZAx0crWz9ao5gkd7sbAn15QXbu3mnn7JWrALQdwoj+rVr X-Google-Smtp-Source: AGHT+IGYjjdprb5uErjDZF0w+LaS8G4bSS1QFdiUIri9ffUlwnGP+hLEFwoI4djExffkWr9j2U0+ X-Received: by 2002:ac8:7f87:0:b0:43a:43c8:6688 with SMTP id z7-20020ac87f87000000b0043a43c86688mr1678186qtj.20.1714099994296; Thu, 25 Apr 2024 19:53:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714099994; cv=pass; d=google.com; s=arc-20160816; b=Gp7ziW/c+QJYGn4gD75i+JHlY6x3fb2XJjbTxc6r/sPi3rEC59HDixamRePglVAht3 RwXi4Qip0kVxY9m0XxxlQ/13+NrQ5gocqxQT6yPfyDf9Ugg4oUCjPOSxLV9V9VDZXTsw tKqbdwRVNl5lKJX3GOfQ7tzvJ6SgsIkA6dX8dkNf0b9Fs1umNCM5Axvuv9yZEqezkrro 9fFxBflxVD8caZ/aT4y3DHB64/kgdOwQ1m3ulesnmpdE5zFxp2LBLbRa4zYT0xZyctNA l5vpZsV2AEZcP8gQQ49NWthNIZDt7nju+VptIUAQzCRhza1PshV8xEsCcXlkdT5W5jV/ K5rw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=STd3L0PvXdADUYfVo7ansEh/LOp7j3KuPIfVihQP2cE=; fh=D+CYjNeNNCwKnMdhx8STS1KBIHLcH+d6WPH4mXJjOqQ=; b=H3VKMNc6mIpvs5agYw8JeHcVLIQ2mNTWgGihni0D1Qi5LNX58fqBUTfANkMA8gk0MT SoMGFYDOSHepXNk7yUvCjVxvZmb4utVrvrp9YWJKP9v8GFtg3AAgk08BDDm42flMCtFI O5grd0TC+RrtiFhq0UzJ7ckzuTqbV/K6Xl1zjlxwH4E3P1eb2SctHi2/aU7QfKpT0i7e bAXp/klv6rgmKVtYJKSkVPUZeNQ7tsaCyG9vH02W/KXKAwD8r/s6wDq0PWuK5JhOmnBk leztC7+XPLds9rC3azEd77rvZrInmrwZ7kQ8immsLR+wMIY0ji9nWTQHW0tfTBdtbmLx 2AOw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Ysscf2C/"; arc=pass (i=1); spf=pass (google.com: domain of gdb-patches-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gdb-patches-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id j11-20020a05622a038b00b00437c2794e98si17181601qtx.48.2024.04.25.19.53.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 19:53:14 -0700 (PDT) Received-SPF: pass (google.com: domain of gdb-patches-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Ysscf2C/"; arc=pass (i=1); spf=pass (google.com: domain of gdb-patches-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gdb-patches-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AE319385840F for ; Fri, 26 Apr 2024 02:53:13 +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-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+patch=linaro.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" }