From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id s36uLKIHK2oN/QEAWB0awg (envelope-from ) for ; Thu, 11 Jun 2026 15:08:18 -0400 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=YHbhier3; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id A42561E070; Thu, 11 Jun 2026 15:08:18 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) 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.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (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 5B05D1E070 for ; Thu, 11 Jun 2026 15:08:17 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B6F404BA79A0 for ; Thu, 11 Jun 2026 19:08:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B6F404BA79A0 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=YHbhier3 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 6856B4BA2E05 for ; Thu, 11 Jun 2026 19:07:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6856B4BA2E05 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine 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 6856B4BA2E05 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1781204865; cv=none; b=WP2GiJ+sKZFpuPbT/g44/uYGHK4MsTVPjfybaceM1N4SYc/wW+FlLfyVuyeXGxP7NuEyWLpmO5A8BDmk/M4PFJuGc9tPCYq/DagwJJUssWlhxdBBiNuW4TnI5Ww91NBYCIvGVgxJDTxnTT7RepqxaVsiosS02vUxPGwJ75o3T9g= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1781204865; c=relaxed/simple; bh=wVA48A+QkuWUN6tCrMmQbqdltABOCGljHaM5WUMiH6E=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=Q4j1bQHBCNpJTe8ACP9sAm8YCOs04H9WBLr5IOzUSt8m/OYTt7VsMjjNXCIBI4ozdORA9sRZnMdQT/+UIJU+JdGzB6etjZdQviYpI9m3OWi9p2aaFgXTCZHgns23CSJBbfvpe2cVON1DHjs+OOEY805HPgvmP+hLWsl9/kOSB6I= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=YHbhier3 DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6856B4BA2E05 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1781204865; 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=V3xeZSW4MvUUTB6mJOspMnPtf1DQjmS3nQpjKvOH6Pc=; b=YHbhier3bW2ZRAliHGbrAzZcCLhYbmFOcQZs6NGEzFclZPOfsL4NcRtcmZFhaLaLNOCbLA bBaG5L/E/vU+gP/65HAhWrP2mBTE1PjyiQGu5OeiKDZVz9gw7UzI1j4MHJ1sD35exnywJj v2tQ0txxrXLVmERt8dymPyDEDVzsvDA= Received: from mail-dy1-f199.google.com (mail-dy1-f199.google.com [74.125.82.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-479-NTcZlblENWi9sBBx4_W9Ew-1; Thu, 11 Jun 2026 15:07:43 -0400 X-MC-Unique: NTcZlblENWi9sBBx4_W9Ew-1 X-Mimecast-MFC-AGG-ID: NTcZlblENWi9sBBx4_W9Ew_1781204862 Received: by mail-dy1-f199.google.com with SMTP id 5a478bee46e88-304d8613efbso305193eec.1 for ; Thu, 11 Jun 2026 12:07:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781204862; x=1781809662; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=V3xeZSW4MvUUTB6mJOspMnPtf1DQjmS3nQpjKvOH6Pc=; b=Cy/1dZxGwFt0QzuLlGXf6Cc64P3MniphicUkLdRJg8QVHrZ+60MPo7AnbRj19fF9ny GdB2f9yxbyjBBxQRnWFSyiAx1E3EK54O4fPVS7QkPnyQ76H7cYKJg3tKVaPvYUIjxVbq Y0oNPTqH5Dzpkftzois8ueY6VqFfnVY5k+jp5NfDEjLG1rPNkXM+xeMmsjsfx7u1SVgj de9oOw1amxE8Wb07EppNnRggBx5voRGckhUXB2B5zki4Y8k/M4S16kfQ6BfDjxNbqhj1 HqZLh14TWdETKUeg/UJDhZukpQCrEKQulVAy3TxY0SnWgqqqnFDdf9iwJaLYSuglfL11 4qew== X-Forwarded-Encrypted: i=1; AFNElJ8kEkEiIkYyZWMVyZ3Xisa/2AcG+gidqf0JfapjthNZE8pHcq1V9FRBPDtzIMEXHqvVjTjE1DCcmkcDIQ==@sourceware.org X-Gm-Message-State: AOJu0Yy/SoNmu4rJzDphtmzMc0mORt6od+8jPMM6iLLwr0mu/W9PVkvW Mr9Zd+vsn2vbScqE5aVtc6CUvwBpdYZjDABRlC29BNUVo0tZi5Co4xMvEhOJRx6X4mhhJRlHQEW q8omxQcNmmcxsL9MKMy/bvyoxyptBwl6T/P56yh6oIu0AoIrjPxpaUsyzyGu+h8Zr0mFJMFY= X-Gm-Gg: Acq92OFDCmmBverMFQOZ6u2RyDFLOMATqcNKPGeeMvkqk5WhypXBNdM++ys8XYGYoNO xFsPeA+RYQasvpweIClYwJApdZLhIV/nKq90UYrSnxzMXKWL4d/RkxsZeJoh0hioJbklP6KC/nq NVJo3sTc25A8wRSuWB0QNBZrsbAp1kIDR+N9vqiLhgKRRrUaAKmO/WxfPTbunIOCpQ8ivM7/jvj 0+rP561jlfJBrR/70poDX9eXpdGvO2t1B9mUhL0Op+44SKgLhaM/HhZ4Dswry+ivWbX91DnvpBt hLSV07uFX31MW28SVMHTxobx3JT7RPOx2AEr42uu77WhOvEYu8SlVSvU+PfoUBHULIA4vtukS7m hM0ay0XQbm7+Ab54GcHz5MIlU4T4g3ku3WS0/9vstBRL00n9GjaEO/CkY3rxEV8zirQ7V X-Received: by 2002:a05:7301:19a2:b0:304:caa4:3559 with SMTP id 5a478bee46e88-308049ebf35mr3400424eec.22.1781204862229; Thu, 11 Jun 2026 12:07:42 -0700 (PDT) X-Received: by 2002:a05:7301:19a2:b0:304:caa4:3559 with SMTP id 5a478bee46e88-308049ebf35mr3400399eec.22.1781204861535; Thu, 11 Jun 2026 12:07:41 -0700 (PDT) Received: from ?IPV6:2804:14d:8084:993e:2d5d:7adb:2b6:a50e? ([2804:14d:8084:993e:2d5d:7adb:2b6:a50e]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-30806eb846esm2917678eec.22.2026.06.11.12.07.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 11 Jun 2026 12:07:40 -0700 (PDT) Message-ID: Date: Thu, 11 Jun 2026 16:07:36 -0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] [gdb/testsuite] Convert gdb.dwarf2/dw2-strp.exp to dwarf assembly To: Tom de Vries , gdb-patches@sourceware.org References: <20260608182016.3993784-1-tdevries@suse.de> From: Guinevere Larsen In-Reply-To: <20260608182016.3993784-1-tdevries@suse.de> X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 5m-xoBC8ZfnDk0KxjNUWlVAZ4YURycjHsKCv5kb9Fbc_1781204862 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 6/8/26 3:20 PM, Tom de Vries wrote: > Convert gdb.dwarf2/dw2-strp.exp to dwarf assembly using > gdb/contrib/dwarf-to-dwarf-assembler.py. > > Tested on x86_64-linux. Hi! Thanks for doing this! I looked over the generated dwarf output using readelf and it seems that everything that is tested by the testcase is still exactly the same so this I think this is just an upgrade! Reviewed-By: Guinevere Larsen -- Cheers, Guinevere Larsen it/its she/her (deprecated) > --- > gdb/testsuite/gdb.dwarf2/dw2-strp.S | 187 -------------------------- > gdb/testsuite/gdb.dwarf2/dw2-strp.exp | 65 ++++++++- > 2 files changed, 59 insertions(+), 193 deletions(-) > delete mode 100644 gdb/testsuite/gdb.dwarf2/dw2-strp.S > > diff --git a/gdb/testsuite/gdb.dwarf2/dw2-strp.S b/gdb/testsuite/gdb.dwarf2/dw2-strp.S > deleted file mode 100644 > index 69a790f036b..00000000000 > --- a/gdb/testsuite/gdb.dwarf2/dw2-strp.S > +++ /dev/null > @@ -1,187 +0,0 @@ > -/* This testcase is part of GDB, the GNU debugger. > - > - Copyright 2008-2026 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 . */ > - > -/* Debug information */ > - > - .section .debug_info > -.Lcu1_begin: > - .4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */ > -.Lcu1_start: > - .2byte 2 /* DWARF version number */ > - .4byte .Ldebug_abbrev0 /* Offset Into Abbrev. Section */ > - .byte 4 /* Pointer Size (in bytes) */ > - > - /* CU die */ > - .uleb128 1 /* Abbrev: DW_TAG_compile_unit */ > - .4byte .Lproducer /* DW_AT_producer */ > - /* Use C++ to exploit a bug in parsing DW_AT_name "". */ > - .byte 4 /* DW_AT_language (C++) - */ > - > -.Larray_type: > - .uleb128 2 /* Abbrev: DW_TAG_array_type */ > - .4byte .Lchar_type-.Lcu1_begin /* DW_AT_type */ > - > - .uleb128 3 /* Abbrev: DW_TAG_subrange_type */ > - .4byte .Luint_type-.Lcu1_begin /* DW_AT_type */ > - .byte 0xd /* DW_AT_upper_bound */ > - .byte 0 /* End of children of die */ > - > -.Luint_type: > - .uleb128 4 /* Abbrev: DW_TAG_base_type */ > - .4byte .Luint_str /* DW_AT_name */ > - .byte 4 /* DW_AT_byte_size */ > - .byte 7 /* DW_AT_encoding */ > - > -.Lchar_type: > - .uleb128 4 /* Abbrev: DW_TAG_base_type */ > - .4byte .Lchar_str /* DW_AT_name */ > - .byte 1 /* DW_AT_byte_size */ > - .byte 6 /* DW_AT_encoding */ > - > - .uleb128 5 /* Abbrev: DW_TAG_variable DW_FORM_strp */ > - .4byte .Lvarname /* DW_AT_name */ > - .4byte .Lconst_type-.Lcu1_begin/* DW_AT_type */ > - .4byte .Lvarcontents /* DW_AT_const_value */ > - .byte 1 /* DW_AT_external */ > - > - .uleb128 6 /* Abbrev: DW_TAG_variable DW_FORM_string */ > - .string "a_string2" /* DW_AT_name */ > - .4byte .Lconst_type-.Lcu1_begin/* DW_AT_type */ > - .string "hello world2\n" /* DW_AT_const_value */ > - .byte 1 /* DW_AT_external */ > - > -.Lconst_type: > - .uleb128 7 /* Abbrev: DW_TAG_const_type */ > - .4byte .Larray_type-.Lcu1_begin/* DW_AT_type */ > - > - .uleb128 8 /* Abbrev: DW_TAG_variable (name "") */ > - .4byte .Lemptyname /* DW_AT_name */ > - > - .byte 0 /* End of children of CU */ > -.Lcu1_end: > - > - .section .debug_abbrev > -.Ldebug_abbrev0: > - .uleb128 1 /* Abbrev code */ > - .uleb128 0x11 /* DW_TAG_compile_unit */ > - .byte 0x1 /* has_children */ > - .uleb128 0x25 /* DW_AT_producer */ > - .uleb128 0xe /* DW_FORM_strp */ > - .uleb128 0x13 /* DW_AT_language */ > - .uleb128 0xb /* DW_FORM_data1 */ > - .byte 0x0 /* Terminator */ > - .byte 0x0 /* Terminator */ > - > - .uleb128 2 /* Abbrev code */ > - .uleb128 0x1 /* TAG: DW_TAG_array_type */ > - .byte 0x1 /* DW_children_yes */ > - .uleb128 0x49 /* DW_AT_type */ > - .uleb128 0x13 /* DW_FORM_ref4 */ > - .byte 0x0 /* Terminator */ > - .byte 0x0 /* Terminator */ > - > - .uleb128 3 /* Abbrev code */ > - .uleb128 0x21 /* DW_TAG_subrange_type */ > - .byte 0x0 /* no children */ > - .uleb128 0x49 /* DW_AT_type */ > - .uleb128 0x13 /* DW_FORM_ref4 */ > - .uleb128 0x2f /* DW_AT_upper_bound */ > - .uleb128 0xb /* DW_FORM_data1 */ > - .byte 0x0 /* Terminator */ > - .byte 0x0 /* Terminator */ > - > - .uleb128 4 /* Abbrev code */ > - .uleb128 0x24 /* DW_TAG_base_type */ > - .byte 0x0 /* no_children */ > - .uleb128 0x3 /* DW_AT_name */ > - .uleb128 0xe /* DW_FORM_strp */ > - .uleb128 0xb /* DW_AT_byte_size */ > - .uleb128 0xb /* DW_FORM_data1 */ > - .uleb128 0x3e /* DW_AT_encoding */ > - .uleb128 0xb /* DW_FORM_data1 */ > - .byte 0x0 /* Terminator */ > - .byte 0x0 /* Terminator */ > - > - .uleb128 5 /* Abbrev code */ > - .uleb128 0x34 /* DW_TAG_variable */ > - .byte 0x0 /* no_children */ > - .uleb128 0x3 /* DW_AT_name */ > - .uleb128 0xe /* DW_FORM_strp */ > - .uleb128 0x49 /* DW_AT_type */ > - .uleb128 0x13 /* DW_FORM_ref4 */ > - .uleb128 0x1c /* DW_AT_const_value */ > - .uleb128 0xe /* DW_FORM_strp */ > - .uleb128 0x3f /* DW_AT_external */ > - .uleb128 0xc /* DW_FORM_flag */ > - .byte 0x0 /* Terminator */ > - .byte 0x0 /* Terminator */ > - > - .uleb128 6 /* Abbrev code */ > - .uleb128 0x34 /* DW_TAG_variable */ > - .byte 0x0 /* no_children */ > - .uleb128 0x3 /* DW_AT_name */ > - .uleb128 0x8 /* DW_FORM_string */ > - .uleb128 0x49 /* DW_AT_type */ > - .uleb128 0x13 /* DW_FORM_ref4 */ > - .uleb128 0x1c /* DW_AT_const_value */ > - .uleb128 0x8 /* DW_FORM_string */ > - .uleb128 0x3f /* DW_AT_external */ > - .uleb128 0xc /* DW_FORM_flag */ > - .byte 0x0 /* Terminator */ > - .byte 0x0 /* Terminator */ > - > - .uleb128 7 /* Abbrev code */ > - .uleb128 0x26 /* DW_TAG_const_type */ > - .byte 0x0 /* DW_children_no */ > - .uleb128 0x49 /* DW_AT_type */ > - .uleb128 0x13 /* DW_FORM_ref4 */ > - .byte 0x0 /* Terminator */ > - .byte 0x0 /* Terminator */ > - > - .uleb128 8 /* Abbrev code */ > - .uleb128 0x34 /* DW_TAG_variable */ > - .byte 0x0 /* DW_children_no */ > - .uleb128 0x3 /* DW_AT_name */ > - .uleb128 0xe /* DW_FORM_strp */ > - .byte 0x0 /* Terminator */ > - .byte 0x0 /* Terminator */ > - > - .byte 0x0 /* Terminator */ > - > -/* String table */ > -#ifdef __arm__ > - .section .debug_str,"MS",%progbits,1 > -#else > - .section .debug_str,"MS",@progbits,1 > -#endif > -.Lproducer: > - .string "GNU C 3.3.3" > -.Lchar_str: > - .string "char" > -.Luint_str: > - .string "unsigned int" > -.Lvarname: > - .string "a_string" > -.Lvarcontents: > - .string "hello world!\n" > -.Lemptyname: > - .string "" > -#ifdef __arm__ > - .section .note.GNU-stack,"",%progbits > -#else > - .section .note.GNU-stack,"",@progbits > -#endif > diff --git a/gdb/testsuite/gdb.dwarf2/dw2-strp.exp b/gdb/testsuite/gdb.dwarf2/dw2-strp.exp > index 7dbc94f57ca..991c6323197 100644 > --- a/gdb/testsuite/gdb.dwarf2/dw2-strp.exp > +++ b/gdb/testsuite/gdb.dwarf2/dw2-strp.exp > @@ -20,15 +20,68 @@ load_lib dwarf.exp > # This test can only be run on targets which support DWARF-2 and use gas. > require dwarf2_support > > -standard_testfile .S > +standard_testfile main.c .S > + > +set asm_file [standard_output_file $srcfile2] > +Dwarf::assemble $asm_file { > + declare_labels char const_type array_type unsigned_int > + > + cu {version 2} { > + DW_TAG_compile_unit { > + DW_AT_producer {GNU C 3.3.3} DW_FORM_strp > + DW_AT_language @DW_LANG_C_plus_plus > + } { > + array_type: DW_TAG_array_type { > + DW_AT_type :$char > + } { > + DW_TAG_subrange_type { > + DW_AT_type :$unsigned_int > + DW_AT_upper_bound 13 DW_FORM_data1 > + } > + } > + unsigned_int: DW_TAG_base_type { > + DW_AT_name {unsigned int} DW_FORM_strp > + DW_AT_byte_size 4 DW_FORM_data1 > + DW_AT_encoding @DW_ATE_unsigned > + } > + char: DW_TAG_base_type { > + DW_AT_name char DW_FORM_strp > + DW_AT_byte_size 1 DW_FORM_data1 > + DW_AT_encoding @DW_ATE_signed_char > + } > + DW_TAG_variable { > + DW_AT_name a_string DW_FORM_strp > + DW_AT_type :$const_type > + DW_AT_const_value {hello world!\n} DW_FORM_strp > + DW_AT_external 1 DW_FORM_flag > + } > + DW_TAG_variable { > + DW_AT_name a_string2 DW_FORM_string > + DW_AT_type :$const_type > + DW_AT_const_value {hello world2\n} DW_FORM_string > + DW_AT_external 1 DW_FORM_flag > + } > + const_type: DW_TAG_const_type { > + DW_AT_type :$array_type > + } > + DW_TAG_variable { > + DW_AT_name DW_FORM_strp > + } > + } > + } > +} > > if {[prepare_for_testing_full "failed to prepare" \ > - [list $testfile debug main.c debug $srcfile nodebug]]} { > + [list $testfile debug $srcfile nodebug $asm_file nodebug]]} { > return > } > > -gdb_test "p a_string" " = \"hello world!\\\\n\"" > -gdb_test "ptype a_string" "type = const char \\\[14\\\]" > +gdb_test "p a_string" \ > + [string_to_regexp { = "hello world!\n"}] > +gdb_test "ptype a_string" \ > + [string_to_regexp {type = const char [14]}] > > -gdb_test "p a_string2" " = \"hello world2\\\\n\"" > -gdb_test "ptype a_string2" "type = const char \\\[14\\\]" > +gdb_test "p a_string2" \ > + [string_to_regexp { = "hello world2\n"}] > +gdb_test "ptype a_string2" \ > + [string_to_regexp {type = const char [14]}] > > base-commit: 748350ae9e20d4698527c57bb3d3d76a33242cab