From c39c86378fca7ea4cf8b5766e5b317e55d3d6e72 Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Mon, 1 Feb 2021 18:24:49 +0100 Subject: [PATCH] [gdb/testsuite] Fix gdb.dwarf2/fission-reread.exp with .gdb_index 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. 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/ChangeLog | 13 ++++++++++++ gdb/testsuite/gdb.dwarf2/fission-base.S | 5 ++++- gdb/testsuite/gdb.dwarf2/fission-base.exp | 14 +++++-------- .../gdb.dwarf2/fission-loclists-pie.S | 4 +++- .../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 | 6 +++++- 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 ++++++++++--------- 11 files changed, 64 insertions(+), 52 deletions(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 36ba5d01c40..a557765c4b6 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,16 @@ +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. + 2021-01-29 Tom de Vries PR breakpoints/26063 diff --git a/gdb/testsuite/gdb.dwarf2/fission-base.S b/gdb/testsuite/gdb.dwarf2/fission-base.S index e65cc5ec3b4..5e10713e938 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..df83613831e 100644 --- a/gdb/testsuite/gdb.dwarf2/fission-multi-cu.S +++ b/gdb/testsuite/gdb.dwarf2/fission-multi-cu.S @@ -23,6 +23,10 @@ and then massaging the output. */ + +#define XSTR(s) STR(s) +#define STR(s) #s + .text .file "llvm-link" .globl func @@ -80,7 +84,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..dd1ffcd05e8 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.*" -- 2.30.2