From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 0A4SI96BJ2FQKQAAWB0awg (envelope-from ) for ; Thu, 26 Aug 2021 07:58:22 -0400 Received: by simark.ca (Postfix, from userid 112) id 8D88E1EE1B; Thu, 26 Aug 2021 07:58:22 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from 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 RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id AC2201EDEE for ; Thu, 26 Aug 2021 07:58:21 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2C6253857C6D for ; Thu, 26 Aug 2021 11:58:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2C6253857C6D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1629979101; bh=FI/1FjJsCxA7bYmflGa10ZLEXCChfgSYzqx9GwT7Is8=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=cEz1dyy4s3oBK6ah7EQ7U3CctVODTeEGHjBMsEAVoztUc8GWZY9i1sBndWi98ho4w 6Efry9sbm7F+uILf27Aw7X6JQTcuL1zUGXIHMwV9Ou+mqNCsNs1ntGU9RltDcQzPxg Ept3s7y4RDnCgwMCTXBYHWv/mzwHXjrKDVO8GXvs= Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id 3EA793857C71 for ; Thu, 26 Aug 2021 11:57:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3EA793857C71 Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 6A20920192 for ; Thu, 26 Aug 2021 11:57:12 +0000 (UTC) Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap1.suse-dmz.suse.de (Postfix) with ESMTPS id 574B113318 for ; Thu, 26 Aug 2021 11:57:12 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap1.suse-dmz.suse.de with ESMTPSA id xzNOFJiBJ2HYPQAAGKfGzw (envelope-from ) for ; Thu, 26 Aug 2021 11:57:12 +0000 Date: Thu, 26 Aug 2021 13:57:10 +0200 To: gdb-patches@sourceware.org Subject: [PATCH][gdb/testsuite] Generate .debug_aranges in gdb.dlang/watch-loc.exp Message-ID: <20210826115653.GA22747@delia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Tom de Vries via Gdb-patches Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" Hi, Before commit 5ef670d81fd "[gdb/testsuite] Add dummy start and end CUs in dwarf assembly" we had in exec outputs/gdb.dlang/watch-loc/watch-loc a D compilation unit at offset 0xc7: ... Compilation Unit @ offset 0xc7: Length: 0x4c (32-bit) Version: 4 Abbrev Offset: 0x64 Pointer Size: 8 <0>: Abbrev Number: 2 (DW_TAG_compile_unit) DW_AT_language : 19 (D) ... with a corresponding .debug_aranges entry: ... Offset into .debug_info: 0xc7 Pointer Size: 4 Segment Size: 0 Address Length 004004a7 0000000b 00000000 00000000 ... After that commit we have a dummy CU at offset 0xc7 and the D compilation unit at offset 0xd2: ... Compilation Unit @ offset 0xc7: Length: 0x7 (32-bit) Version: 4 Abbrev Offset: 0x64 Pointer Size: 8 Compilation Unit @ offset 0xd2: Length: 0x4c (32-bit) Version: 4 Abbrev Offset: 0x65 Pointer Size: 8 <0>
: Abbrev Number: 2 (DW_TAG_compile_unit) DW_AT_language : 19 (D) ... while the .debug_aranges entry still points to 0xc7. The problem is that the test-case uses a hack (quoting from commit 75f06e9dc59): ... [ Note: this is a non-trivial test-case. The file watch-loc-dw.S contains a .debug_info section, but not an .debug_aranges section or any actual code. The file watch-loc.c contains code and a .debug_aranges section, but no other debug section. So, the intent for the .debug_aranges section in watch-loc.c is to refer to a compilation unit in the .debug_info section in watch-loc-dw.S. ] ... and adding the dummy CU caused that hack to stop working. Fix this by moving the generation of .debug_aranges from watch-loc.c to watch-loc.exp, such that we have: ... Offset into .debug_info: 0xd2 Pointer Size: 4 Segment Size: 0 Address Length 004004a7 0000000b 00000000 00000000 ... Tested on x86_64-linux. Any comments? Thanks, - Tom [gdb/testsuite] Generate .debug_aranges in gdb.dlang/watch-loc.exp --- gdb/testsuite/gdb.dlang/watch-loc.c | 28 ---------------------------- gdb/testsuite/gdb.dlang/watch-loc.exp | 22 +++++++++------------- 2 files changed, 9 insertions(+), 41 deletions(-) diff --git a/gdb/testsuite/gdb.dlang/watch-loc.c b/gdb/testsuite/gdb.dlang/watch-loc.c index 6fd7cf135d5..b008967381b 100644 --- a/gdb/testsuite/gdb.dlang/watch-loc.c +++ b/gdb/testsuite/gdb.dlang/watch-loc.c @@ -35,31 +35,3 @@ main (void) { return _Dmain (); } - -#ifdef WITH_DEBUG_SECTIONS -#define xstr(s) str(s) -#define str(s) #s -/* The .debug_names-based index support depends on .debug_aranges - generated by GCC. (.gdb_index includes a gdb-generated map - instead.) */ -asm ( -" .pushsection .debug_info,\"\",%progbits \n" -".Lcu1_begin:" -" .popsection \n" -" .pushsection .debug_aranges,\"\",%progbits \n" -" .4byte .Laranges_end - .Laranges_start \n" // Length of Address Ranges Info -".Laranges_start: \n" -" .2byte 0x2 \n" // DWARF Version -" .4byte .Lcu1_begin\n" // .Ldebug_info0 - Offset of Compilation Unit Info -" .byte 4 \n" // Size of Address -" .byte 0 \n" // Size of Segment Descriptor -" .2byte 0 \n" // Pad to 16 byte boundary -" .2byte 0 \n" -" .4byte " xstr(DMAIN_START_0) xstr(DMAIN_START_1) xstr(DMAIN_START_2) "\n" // Address -" .4byte " xstr(DMAIN_LENGTH) "\n" // Length -" .4byte 0 \n" -" .4byte 0 \n" -".Laranges_end: \n" -" .popsection \n" -); -#endif diff --git a/gdb/testsuite/gdb.dlang/watch-loc.exp b/gdb/testsuite/gdb.dlang/watch-loc.exp index 6100975b986..0ba2d89e15a 100644 --- a/gdb/testsuite/gdb.dlang/watch-loc.exp +++ b/gdb/testsuite/gdb.dlang/watch-loc.exp @@ -34,7 +34,10 @@ lassign [function_range _Dmain ${srcdir}/${subdir}/${srcfile}] \ # Make some DWARF for the test. set asm_file [standard_output_file $srcfile2] Dwarf::assemble $asm_file { - cu {} { + global dmain_start dmain_length + + declare_labels cu_start + cu { label cu_start } { compile_unit { {language @DW_LANG_D} } { @@ -64,21 +67,14 @@ Dwarf::assemble $asm_file { } } } -} -set dmain_start_list [split $dmain_start] -set dmain_start_0 [lindex $dmain_start_list 0] -set dmain_start_1 [lindex $dmain_start_list 1] -set dmain_start_2 [lindex $dmain_start_list 2] + aranges {} cu_start { + arange $dmain_start $dmain_length + } +} if { [prepare_for_testing "failed to prepare" ${testfile} \ - [list $srcfile $asm_file] \ - "nodebug \ - additional_flags=-DWITH_DEBUG_SECTIONS \ - additional_flags=-DDMAIN_START_0=$dmain_start_0 \ - additional_flags=-DDMAIN_START_1=$dmain_start_1 \ - additional_flags=-DDMAIN_START_2=$dmain_start_2 \ - additional_flags=-DDMAIN_LENGTH=$dmain_length"] } { + [list $srcfile $asm_file] {nodebug}] } { return -1 }