From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2205) id C4C733858D1E; Fri, 30 Sep 2022 03:58:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C4C733858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1664510326; bh=+fvnMeOBGoPiikw3fr7buVTf596fspQLPEw9MGZHwUk=; h=From:To:Subject:Date:From; b=KUOeJNqUEv0CnrDtfS7Hneqa8RIfPpzqnybKSkYAAUDgEfsKeId74zKDhuoSXzegM PqSNUpvQE/YnU5En2xpu0/942XiRS2yI9ycxojUmBHU611BgltZxctToBaUyjJtdly S0SCzjghbIvZXsNlpu9oeoMQApe4ldZgxDKj5Ck0= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom de Vries To: gdb-cvs@sourceware.org Subject: [binutils-gdb] [gdb/testsuite] Add aranges to gdb.dwarf2/dw2-dir-file-name.exp X-Act-Checkin: binutils-gdb X-Git-Author: Tom de Vries X-Git-Refname: refs/heads/master X-Git-Oldrev: 137c886e9a624f68cba212ebdb156298957c25c4 X-Git-Newrev: 511f4ff4d9bcaed1ed53ee64211d7c9f80f07fed Message-Id: <20220930035846.C4C733858D1E@sourceware.org> Date: Fri, 30 Sep 2022 03:58:46 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D511f4ff4d9bc= aed1ed53ee64211d7c9f80f07fed commit 511f4ff4d9bcaed1ed53ee64211d7c9f80f07fed Author: Tom de Vries Date: Fri Sep 30 05:58:43 2022 +0200 [gdb/testsuite] Add aranges to gdb.dwarf2/dw2-dir-file-name.exp =20 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-name= s, due to missing .debug_aranges info. =20 Add the missing .debug_aranges info. =20 Also add a file_id option to Dwarf::assemble, to make it possible to co= ntribute to an already open file. =20 Tested on x86_64-linux. Diff: --- 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 =20 +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 =20 diff --git a/gdb/testsuite/lib/dwarf.exp b/gdb/testsuite/lib/dwarf.exp index 6db0ed28deb..b85ec290299 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 =3D "". + # file_id + # - open file where the generated assemble core is written. + # default =3D "". # 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 { =20 parse_options { { filename "" } + { file_id "" } { add_dummy_cus 1 } } =20 @@ -3241,7 +3245,12 @@ namespace eval Dwarf { set _initialized 1 } =20 - set _output_file [open $filename w] + if { $file_id !=3D "" } { + 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 { =20 _write_deferred_output =20 - catch {close $_output_file} + if { $file_id =3D=3D "" } { + catch {close $_output_file} + } set _output_file {} } }