From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id 77CC53857B92 for ; Thu, 22 Sep 2022 13:00:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 77CC53857B92 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (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 B21521F8F2 for ; Thu, 22 Sep 2022 13:00:38 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (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 imap2.suse-dmz.suse.de (Postfix) with ESMTPS id A09681346B for ; Thu, 22 Sep 2022 13:00:38 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id xRYRJnZcLGNOaQAAMHmgww (envelope-from ) for ; Thu, 22 Sep 2022 13:00:38 +0000 Date: Thu, 22 Sep 2022 15:00:37 +0200 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH][gdb/testsuite] Add aranges to gdb.dwarf2/dw2-dir-file-name.exp Message-ID: <20220922130035.GA25136@delia.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Sep 2022 13:00:40 -0000 Hi, Since commit 52b920c5d20 ("[gdb/testsuite] Fix gdb.dwarf2/dw2-dir-file-name.exp for ppc64le"), the test-case fails with target board cc-with-debug-names, due to missing .debug_aranges info. Add the missing .debug_aranges info. Also add a file_id option to Dwarf::assemble, to make it possible to contribute to an already open file. Tested on x86_64-linux. Any comments? Thanks, - Tom [gdb/testsuite] Add aranges to gdb.dwarf2/dw2-dir-file-name.exp --- gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp | 16 ++++++++++++++++ gdb/testsuite/lib/dwarf.exp | 15 +++++++++++++-- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp b/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp index 3827ed744b5..d9d34440b16 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp @@ -317,6 +317,22 @@ puts -nonewline $f "\ " out_compdir out_cu +Dwarf::assemble { add_dummy_cus 0 file_id $f } { + global func_info_names + + foreach name $func_info_names { + global ${name}_start + global ${name}_end + set name_start [set ${name}_start] + set name_end [set ${name}_end] + + set cu_label .L${name}_begin + aranges {} cu_label { + arange {} $name_start "$name_end - $name_start" + } + } +} + puts $f " .section .debug_line" out_compdir out_line diff --git a/gdb/testsuite/lib/dwarf.exp b/gdb/testsuite/lib/dwarf.exp index 6db0ed28deb..8f42b0a8969 100644 --- a/gdb/testsuite/lib/dwarf.exp +++ b/gdb/testsuite/lib/dwarf.exp @@ -3193,6 +3193,9 @@ namespace eval Dwarf { # - the name of the file where the generated assembly # code is written. # default = "". + # file_id + # - on open file where the generated assemble core is written. + # default = "". # add_dummy_cus <0|1> # - Whether to add dummy CUs before and after the CUs # added in the BODY. @@ -3233,6 +3236,7 @@ namespace eval Dwarf { parse_options { { filename "" } + { file_id "" } { add_dummy_cus 1 } } @@ -3241,7 +3245,12 @@ namespace eval Dwarf { set _initialized 1 } - set _output_file [open $filename w] + if { $file_id != "" } { + set _output_file $file_id + } else { + set _output_file [open $filename w] + } + set _cu_count -1 _empty_array _deferred_output set _defer "" @@ -3274,7 +3283,9 @@ namespace eval Dwarf { _write_deferred_output - catch {close $_output_file} + if { $file_id == "" } { + catch {close $_output_file} + } set _output_file {} } }