From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id xQMhAlquK2f23icAWB0awg (envelope-from ) for ; Wed, 06 Nov 2024 12:58:50 -0500 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=h3t600NJ; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id DA27B1E5FC; Wed, 6 Nov 2024 12:58:49 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.0 Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 70D751E0C0 for ; Wed, 6 Nov 2024 12:58:47 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0CE383858402 for ; Wed, 6 Nov 2024 17:58:47 +0000 (GMT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id 4D95B3858D20 for ; Wed, 6 Nov 2024 17:58:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4D95B3858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 4D95B3858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1730915907; cv=none; b=X2n+dgWCi9G6G5XJPj9iQkG/uD7PRRnHIyY9e1oVnDfpQ6DlnG9NjX0hu64laTinTqdRaSnb6W6QImlzon92OvlRwUEgYL+TT5V7i0r129aoIeKr5vsBxvUmXebM/ZoHfFf5pj+Dxtwju4T+Qx4EdvzogCdOcmVv//QUGROOsXs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1730915907; c=relaxed/simple; bh=WqL164EE1bcS7I/Z7e4zPFbZnIxDGcOtP5vwGe1itAg=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=suAmU/9ogDxaiwCQvi/vLKQKEqmpnhIuRb5wlWsXDx/7qFdb0ZShZ1a+S06pD2iTBmI21vm/Zy53IEHxOuXhd5T4PSdGJtL4IQr9Eax4ZbEZd3OBG0NwPQBLiilKXUBJNE6Gig+XI93JGV80QdA8VIaZMVq+oUAuJiSEDIms1QE= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1730915905; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=t1gAjU2KLt9pLFnPS/lXerqQ1EIui8alp1+Eoryj9Nw=; b=h3t600NJtKuirgfNiBrHKMnQ/yz45B0sIbOLHqftRlsAwLv2EZGLmsdeR/Fp+5DYxEYP1R EjYHIpuyVjayp3yiSB4pbpGiwZQ6dYjVEj1MXyT4JVEMPIC5KHR1pymQZ0N1EogHLOxIlu yv/Wtcc65hU+p4H/o2ZG0fvXapbkpnI= Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-179-xsZmItYoMFiK5Xv1jNxYtQ-1; Wed, 06 Nov 2024 12:58:24 -0500 X-MC-Unique: xsZmItYoMFiK5Xv1jNxYtQ-1 X-Mimecast-MFC-AGG-ID: xsZmItYoMFiK5Xv1jNxYtQ Received: by mail-pl1-f200.google.com with SMTP id d9443c01a7336-20ca1692cb7so634225ad.3 for ; Wed, 06 Nov 2024 09:58:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730915902; x=1731520702; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=t1gAjU2KLt9pLFnPS/lXerqQ1EIui8alp1+Eoryj9Nw=; b=InpjgisSh9LKcB31gIo3rXqhN/3qpCFF7qGJInVxEjcCh/beUgJ1WZEExKW5w+IE7X k5DCiFDyXDDUr65/bPQCaGTdqNCM1UN36QtRtPgdMbfFAHQCKRkIrTi2pEuAeq0GGR1t CSJi6JzF0i3icHGtPdWM+XJwCKe3pEkXrJB+2Q/lKSSls830mn8gQTWDaEzA9H8Qf37b it2vhH7N1MYEeNKqOWLAzK0YaNuG9WHPKma4pEY4FyKRZTYWAtfCQ5MMY/0t2ZMlgDvV tjzZC2KCm7B7DH48khh6WawFzsdSDh7AdWalsov/3+7Y88hEGb1MEM8cBOAl8NzdZMDW FZbA== X-Forwarded-Encrypted: i=1; AJvYcCUmNeGSXqXSArzx7L7vMoL2LxFOC2aB4kPkVPgSK0HXwUWzcY6wcNZPty1yAxXkVXG8a/u45oZaTl/TiA==@sourceware.org X-Gm-Message-State: AOJu0YwA3g4zIDOipZJXNdBGmbxpMNxCwaWdGri5sC7dS8oImQLyEUEL JVxCxxmkC5Y7rVIc/DrSLnHPJOkRzYNr7DaJvYz/rF+4b86zszvnKku3y4Lk1cOZLXlfUHExPoh UJUXTo2Su6S2bbTzZPqbBJc/EuK2pXUfdt3EyyPMX7neWAeRH8oHIepJj5FedwI2Em9A= X-Received: by 2002:a17:902:f641:b0:20e:71ee:568e with SMTP id d9443c01a7336-2111af2f09amr284748635ad.13.1730915902485; Wed, 06 Nov 2024 09:58:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IGflKitn/bEroMbwmqdmnwzLIg2NDBaM4cSUds6LbxseHfiFBhfh+cnpaR86R6Vn/yTsKCkIg== X-Received: by 2002:a17:902:f641:b0:20e:71ee:568e with SMTP id d9443c01a7336-2111af2f09amr284748415ad.13.1730915902133; Wed, 06 Nov 2024 09:58:22 -0800 (PST) Received: from [150.1.200.127] (174-21-139-113.tukw.qwest.net. [174.21.139.113]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2110570a1dfsm99134185ad.108.2024.11.06.09.58.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 06 Nov 2024 09:58:21 -0800 (PST) Message-ID: Date: Wed, 6 Nov 2024 09:58:21 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] Add dw2-aranges.exp To: =?UTF-8?Q?Alexandra_H=C3=A1jkov=C3=A1?= , gdb-patches@sourceware.org References: <20241106163255.2619114-1-ahajkova@redhat.com> From: Keith Seitz In-Reply-To: <20241106163255.2619114-1-ahajkova@redhat.com> X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: BTlW_RJF_7zu653R3P92ui_k_rdWhUo8tl7UwmzJeOI_1730915903 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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~public-inbox=simark.ca@sourceware.org On 11/6/24 8:32 AM, Alexandra Hájková wrote: > > I modified the DWARF assembler to make it possible > to set the Addres size to zero in a .debug_aranges section > and used a DWARF assembler to produce the assembly file. Nice. I've only had a quick glance at this, but something obvious did grab my attention. Please make change locally. You don't need a v2 just for this. > diff --git a/gdb/testsuite/gdb.dwarf2/dw2-aranges.exp b/gdb/testsuite/gdb.dwarf2/dw2-aranges.exp > new file mode 100644 > index 00000000000..59e7e27ac96 > --- /dev/null > +++ b/gdb/testsuite/gdb.dwarf2/dw2-aranges.exp > @@ -0,0 +1,44 @@ > +# Copyright 2004-2024 Free Software Foundation, Inc. > + > +# This program is free software; you can redistribute it and/or modify > +# it under the terms of the GNU General Public License as published by > +# the Free Software Foundation; either version 3 of the License, or > +# (at your option) any later version. > +# > +# This program is distributed in the hope that it will be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +# GNU General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License > +# along with this program. If not, see . > + > +# Test .debug_aranges containing zero address_size. > + > +# This test can only be run on targets which support DWARF-2 and use gas. > +# For now pick a sampling of likely targets. > +load_lib dwarf.exp > + > +if {![dwarf2_support]} { > + verbose "Skipping $gdb_test_file_name." > + return 0 > +} Nowadays, we use "require dwarf2_support". Keith > + > +standard_testfile .c -2.S > +set asm_file [standard_output_file $srcfile2] > + > +Dwarf::assemble $asm_file { > + cu { label cu_start } { > + compile_unit {{language @DW_LANG_C}} { > + } > + } > + aranges { addr_zero true } cu_start { > + } > +} > + > +if { [prepare_for_testing "failed to prepare" $binfile [list $asm_file $srcfile ]] } { > + return -1 > +} > + > +# Failed gdb_load would abort the testcase execution earlier. > +pass "file loaded" > diff --git a/gdb/testsuite/lib/dwarf.exp b/gdb/testsuite/lib/dwarf.exp > index 6a5afec3fc8..1002c75dd09 100644 > --- a/gdb/testsuite/lib/dwarf.exp > +++ b/gdb/testsuite/lib/dwarf.exp > @@ -2759,8 +2759,11 @@ namespace eval Dwarf { > set addr_op .4byte > } > > - _op $addr_op $arange_start "Address range start$comment" > - _op $addr_op $arange_length "Address range length$comment" > + # Do not emit address ranges when the Address size is set to 0. > + if { $_addr_size > 0 } { > + _op $addr_op $arange_start "Address range start$comment" > + _op $addr_op $arange_length "Address range length$comment" > + } > } > > # Emit a DWARF .debug_aranges unit. > @@ -2797,6 +2800,7 @@ namespace eval Dwarf { > { cu_is_64 0 } > { section_version 2 } > { seg_size 0 } > + { addr_zero false } > } > set _seg_size $seg_size > > @@ -2806,6 +2810,10 @@ namespace eval Dwarf { > set _addr_size 4 > } > > + if { $addr_zero } { > + set _addr_size 0 > + } > + > # Switch to .debug_aranges section. > _section .debug_aranges > > @@ -2853,6 +2861,9 @@ namespace eval Dwarf { > > # Padding. > set tuple_size [expr 2 * $_addr_size + $_seg_size] > + if {$tuple_size == 0} { > + set tuple_size 1 > + } > while { 1 } { > if { [expr $offset % $tuple_size] == 0 } { > break