From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id gKUTNaATGGAeCgAAWB0awg (envelope-from ) for ; Mon, 01 Feb 2021 09:43:44 -0500 Received: by simark.ca (Postfix, from userid 112) id D5C701EF80; Mon, 1 Feb 2021 09:43:44 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=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 A01471E939 for ; Mon, 1 Feb 2021 09:43:43 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 82AC83861969; Mon, 1 Feb 2021 14:43:42 +0000 (GMT) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id D4CF43861836 for ; Mon, 1 Feb 2021 14:43:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D4CF43861836 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tdevries@suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id EF16CAB92 for ; Mon, 1 Feb 2021 14:43:38 +0000 (UTC) Date: Mon, 1 Feb 2021 15:43:37 +0100 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH][gdb/testsuite] Fix gdb.dwarf2/fission-reread.exp with .gdb_index Message-ID: <20210201144335.GA1920@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: , Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" Hi, When running test-case gdb.dwarf2/fission-reread.exp with target board cc-with-gdb-index, we run into: ... gdb compile failed, warning: Could not find DWO TU \ fission-reread.dwo(0x9022f1ceac7e8b19) referenced by TU at offset 0x0 \ [in module outputs/gdb.dwarf2/fission-reread/fission-reread] ... The problem is that the .dwo file is not found. There's code added in the .exp file to make sure the .dwo can be found: ... # Make sure we can find the .dwo file, regardless of whether we're # running in parallel mode. gdb_test_no_output "set debug-file-directory [file dirname $binfile]" \ "set debug-file-directory" ... This works normally, but not for the gdb invocation done by cc-with-tweaks.sh for target board cc-with-gdb-index. Fix this by finding the full path to the .dwo file and passing it to the compilation. Tested on x86_64-linux with native and target boards cc-with-gdb-index, cc-with-debug-names and readnow. Any comments? Thanks, - Tom [gdb/testsuite] Fix gdb.dwarf2/fission-reread.exp with .gdb_index gdb/testsuite/ChangeLog: 2021-02-01 Tom de Vries * gdb.dwarf2/fission-base.S: Pass -DDWO=$dwo. * gdb.dwarf2/fission-loclists-pie.S: Same. * gdb.dwarf2/fission-loclists.S: Same. * gdb.dwarf2/fission-multi-cu.S: Same. * gdb.dwarf2/fission-reread.S: Same. * gdb.dwarf2/fission-base.exp: Use DWO. * gdb.dwarf2/fission-loclists-pie.exp: Same. * gdb.dwarf2/fission-loclists.exp: Same. * gdb.dwarf2/fission-multi-cu.exp: Same. * gdb.dwarf2/fission-reread.exp: Same. --- gdb/testsuite/gdb.dwarf2/fission-base.S | 5 ++++- gdb/testsuite/gdb.dwarf2/fission-base.exp | 14 +++++--------- gdb/testsuite/gdb.dwarf2/fission-loclists-pie.S | 4 +++- gdb/testsuite/gdb.dwarf2/fission-loclists-pie.exp | 13 ++++--------- gdb/testsuite/gdb.dwarf2/fission-loclists.S | 5 ++++- gdb/testsuite/gdb.dwarf2/fission-loclists.exp | 14 +++++--------- gdb/testsuite/gdb.dwarf2/fission-multi-cu.S | 5 ++++- gdb/testsuite/gdb.dwarf2/fission-multi-cu.exp | 14 +++++--------- gdb/testsuite/gdb.dwarf2/fission-reread.S | 7 +++++-- gdb/testsuite/gdb.dwarf2/fission-reread.exp | 21 +++++++++++---------- 10 files changed, 50 insertions(+), 52 deletions(-) diff --git a/gdb/testsuite/gdb.dwarf2/fission-base.S b/gdb/testsuite/gdb.dwarf2/fission-base.S index e65cc5ec3b4..5790d086adf 100644 --- a/gdb/testsuite/gdb.dwarf2/fission-base.S +++ b/gdb/testsuite/gdb.dwarf2/fission-base.S @@ -20,6 +20,9 @@ and then massaging the output. */ +#define XSTR(s) STR(s) +#define STR(s) #s + .file "fission-base.c" .text @@ -143,7 +146,7 @@ main: .8byte .Letext0-.Ltext0 # DW_AT_high_pc .4byte .Ldebug_line0 # DW_AT_stmt_list .ascii "/tmp/src/gdb/testsuite\0" # DW_AT_comp_dir - .ascii "fission-base.dwo\0" # DW_AT_GNU_dwo_name + .asciz XSTR(DWO) # DW_AT_GNU_dwo_name .4byte .Ldebug_pubnames0 # DW_AT_GNU_pubnames .4byte .Ldebug_pubtypes0 # DW_AT_GNU_pubtypes .4byte .Ldebug_addr0_begin # DW_AT_GNU_addr_base diff --git a/gdb/testsuite/gdb.dwarf2/fission-base.exp b/gdb/testsuite/gdb.dwarf2/fission-base.exp index 01b5c823844..40a7e2a4e3c 100644 --- a/gdb/testsuite/gdb.dwarf2/fission-base.exp +++ b/gdb/testsuite/gdb.dwarf2/fission-base.exp @@ -32,19 +32,15 @@ if {![istarget x86_64-*] || ![is_lp64_target]} { standard_testfile .S +set dwo [standard_output_file "fission-base.dwo"] + if [build_executable_from_fission_assembler \ - "$testfile.exp" "$binfile" "$srcfile" {nodebug}] { + "$testfile.exp" "$binfile" "$srcfile" \ + [list nodebug additional_flags=-DDWO=$dwo]] { return -1 } -gdb_exit -gdb_start -gdb_reinitialize_dir $srcdir/$subdir -# Make sure we can find the .dwo file, regardless of whether we're -# running in parallel mode. -gdb_test_no_output "set debug-file-directory [file dirname $binfile]" \ - "set debug-file-directory" -gdb_load $binfile +clean_restart $binfile if ![runto_main] { return -1 diff --git a/gdb/testsuite/gdb.dwarf2/fission-loclists-pie.S b/gdb/testsuite/gdb.dwarf2/fission-loclists-pie.S index 698176013b5..e87ca369bf7 100644 --- a/gdb/testsuite/gdb.dwarf2/fission-loclists-pie.S +++ b/gdb/testsuite/gdb.dwarf2/fission-loclists-pie.S @@ -33,6 +33,8 @@ return init (&argc); } */ +#define XSTR(s) STR(s) +#define STR(s) #s .file "fission-loclists-pie.c" .text @@ -461,7 +463,7 @@ main: .LASF1: .string "/tmp/19999/obj64/gdb/testsuite" .LASF0: - .string "fission-loclists-pie.dwo" + .string XSTR(DWO) .section .debug_str_offsets.dwo,"e",@progbits .long 0 # indexed string 0x0: argv .long 0x5 # indexed string 0x1: argc diff --git a/gdb/testsuite/gdb.dwarf2/fission-loclists-pie.exp b/gdb/testsuite/gdb.dwarf2/fission-loclists-pie.exp index e2f3c69938c..c0a7785985b 100644 --- a/gdb/testsuite/gdb.dwarf2/fission-loclists-pie.exp +++ b/gdb/testsuite/gdb.dwarf2/fission-loclists-pie.exp @@ -37,20 +37,15 @@ if {![istarget x86_64-*] || ![is_lp64_target]} { standard_testfile .S +set dwo [standard_output_file "fission-loclists-pie.dwo"] + if [build_executable_from_fission_assembler \ "$testfile.exp" "$binfile" "$srcfile" \ - [list "nodebug" "ldflags=-pie"]] { + [list "nodebug" "ldflags=-pie" additional_flags=-DDWO=$dwo]] { return -1 } -gdb_exit -gdb_start -gdb_reinitialize_dir $srcdir/$subdir -# Make sure we can find the .dwo file, regardless of whether we're -# running in parallel mode. -gdb_test_no_output "set debug-file-directory [file dirname $binfile]" \ - "set debug-file-directory" -gdb_load $binfile +clean_restart $binfile if ![runto_main] { return -1 diff --git a/gdb/testsuite/gdb.dwarf2/fission-loclists.S b/gdb/testsuite/gdb.dwarf2/fission-loclists.S index b4d954b7038..c40b956dc4e 100644 --- a/gdb/testsuite/gdb.dwarf2/fission-loclists.S +++ b/gdb/testsuite/gdb.dwarf2/fission-loclists.S @@ -33,6 +33,9 @@ } */ +#define XSTR(s) STR(s) +#define STR(s) #s + .file "fission-loclists.c" .text .Ltext0: @@ -240,7 +243,7 @@ main: .byte 0x5 .4byte .Ldebug_ranges0 # DW_AT_GNU_ranges_base .ascii "/tmp/src/gdb/testsuite\0" # DW_AT_comp_dir - .ascii "fission-loclists.dwo\0" # DW_AT_GNU_dwo_name + .asciz XSTR(DWO) # DW_AT_GNU_dwo_name .4byte .Ldebug_pubnames0 # DW_AT_GNU_pubnames .4byte .Ldebug_pubtypes0 # DW_AT_GNU_pubtypes .4byte .Ldebug_addr0 # DW_AT_GNU_addr_base diff --git a/gdb/testsuite/gdb.dwarf2/fission-loclists.exp b/gdb/testsuite/gdb.dwarf2/fission-loclists.exp index 8e6b999070d..54eace0496c 100644 --- a/gdb/testsuite/gdb.dwarf2/fission-loclists.exp +++ b/gdb/testsuite/gdb.dwarf2/fission-loclists.exp @@ -32,19 +32,15 @@ if {![istarget x86_64-*] || ![is_lp64_target]} { standard_testfile .S +set dwo [standard_output_file "fission-loclists.dwo"] + if [build_executable_from_fission_assembler \ - "$testfile.exp" "$binfile" "$srcfile" {nodebug}] { + "$testfile.exp" "$binfile" "$srcfile" \ + [list nodebug additional_flags=-DDWO=$dwo]] { return -1 } -gdb_exit -gdb_start -gdb_reinitialize_dir $srcdir/$subdir -# Make sure we can find the .dwo file, regardless of whether we're -# running in parallel mode. -gdb_test_no_output "set debug-file-directory [file dirname $binfile]" \ - "set debug-file-directory" -gdb_load $binfile +clean_restart $binfile if ![runto_main] { return -1 diff --git a/gdb/testsuite/gdb.dwarf2/fission-multi-cu.S b/gdb/testsuite/gdb.dwarf2/fission-multi-cu.S index c9bb07efec5..e26dbdb36e0 100644 --- a/gdb/testsuite/gdb.dwarf2/fission-multi-cu.S +++ b/gdb/testsuite/gdb.dwarf2/fission-multi-cu.S @@ -23,6 +23,9 @@ and then massaging the output. */ +#define XSTR(s) STR(s) +#define STR(s) #s + .text .file "llvm-link" .globl func @@ -80,7 +83,7 @@ main: # @main .section .debug_str,"MS",@progbits,1 .Lskel_string0: - .asciz "fission-multi-cu.dwo" # string offset=0 + .asciz XSTR(DWO) # string offset=0 .Lskel_string1: .asciz "/tmp/src/gdb/testsuite" # string offset=21 .section .debug_loc.dwo,"",@progbits diff --git a/gdb/testsuite/gdb.dwarf2/fission-multi-cu.exp b/gdb/testsuite/gdb.dwarf2/fission-multi-cu.exp index d1db1c9c8a3..dec754798b6 100644 --- a/gdb/testsuite/gdb.dwarf2/fission-multi-cu.exp +++ b/gdb/testsuite/gdb.dwarf2/fission-multi-cu.exp @@ -32,19 +32,15 @@ if {![istarget x86_64-*] || ![is_lp64_target]} { standard_testfile .S +set dwo [standard_output_file "fission-multi-cu.dwo"] + if [build_executable_from_fission_assembler \ - "$testfile.exp" "$binfile" "$srcfile" {nodebug}] { + "$testfile.exp" "$binfile" "$srcfile" \ + [list nodebug additional_flags=-DDWO=$dwo]] { return -1 } -gdb_exit -gdb_start -gdb_reinitialize_dir $srcdir/$subdir -# Make sure we can find the .dwo file, regardless of whether we're -# running in parallel mode. -gdb_test_no_output "set debug-file-directory [file dirname $binfile]" \ - "set debug-file-directory" -gdb_load $binfile +clean_restart $binfile if ![runto_main] { return -1 diff --git a/gdb/testsuite/gdb.dwarf2/fission-reread.S b/gdb/testsuite/gdb.dwarf2/fission-reread.S index 92087aa7ad9..a80f6bb596f 100644 --- a/gdb/testsuite/gdb.dwarf2/fission-reread.S +++ b/gdb/testsuite/gdb.dwarf2/fission-reread.S @@ -47,6 +47,9 @@ # define SYMBOL(str) str #endif +#define XSTR(s) STR(s) +#define STR(s) #s + .file "fission-reread.cc" .globl SYMBOL(baz) @@ -143,7 +146,7 @@ SYMBOL(main): .4byte 0 /* Offset to Type DIE */ .uleb128 0x2 /* (DIE (0) DW_TAG_type_unit) */ .ascii "/tmp/src/gdb/testsuite\0" /* DW_AT_comp_dir */ - .ascii "fission-reread.dwo\0" /* DW_AT_GNU_dwo_name */ + .asciz XSTR(DWO) /* DW_AT_GNU_dwo_name */ .4byte .Ldebug_pubnames0 /* DW_AT_GNU_pubnames */ .4byte .Ldebug_pubtypes0 /* DW_AT_GNU_pubtypes */ .4byte .Ldebug_addr0 /* DW_AT_GNU_addr_base */ @@ -214,7 +217,7 @@ SYMBOL(main): .4byte .Letext0-.Ltext0 /* DW_AT_high_pc */ .4byte .Ldebug_line0 /* DW_AT_stmt_list */ .ascii "/tmp/src/gdb/testsuite\0" /* DW_AT_comp_dir */ - .ascii "fission-reread.dwo\0" /* DW_AT_GNU_dwo_name */ + .asciz XSTR(DWO) /* DW_AT_GNU_dwo_name */ .4byte .Ldebug_pubnames0 /* DW_AT_GNU_pubnames */ .4byte .Ldebug_pubtypes0 /* DW_AT_GNU_pubtypes */ .4byte .Ldebug_addr0 /* DW_AT_GNU_addr_base */ diff --git a/gdb/testsuite/gdb.dwarf2/fission-reread.exp b/gdb/testsuite/gdb.dwarf2/fission-reread.exp index 074e5354f50..b97c48ad1b3 100644 --- a/gdb/testsuite/gdb.dwarf2/fission-reread.exp +++ b/gdb/testsuite/gdb.dwarf2/fission-reread.exp @@ -30,20 +30,21 @@ set additional_flags [gdb_target_symbol_prefix_flags_asm] standard_testfile .S +set dwo [standard_output_file "fission-reread.dwo"] + +set options [list] +lappend options nodebug +if { $additional_flags != "" } { + lappend options $additional_flags +} +lappend options additional_flags=-DDWO=$dwo + if [build_executable_from_fission_assembler \ - "$testfile.exp" "$binfile" "$srcfile" \ - [list nodebug $additional_flags]] { + "$testfile.exp" "$binfile" "$srcfile" $options] { return -1 } -gdb_exit -gdb_start -gdb_reinitialize_dir $srcdir/$subdir -# Make sure we can find the .dwo file, regardless of whether we're -# running in parallel mode. -gdb_test_no_output "set debug-file-directory [file dirname $binfile]" \ - "set debug-file-directory" -gdb_load $binfile +clean_restart $binfile gdb_test "break -q main" "Breakpoint.*at.*"