]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/testsuite] Fix gdb.dwarf2/fission-reread.exp with .gdb_index
authorTom de Vries <tdevries@suse.de>
Mon, 1 Feb 2021 17:24:49 +0000 (18:24 +0100)
committerTom de Vries <tdevries@suse.de>
Mon, 1 Feb 2021 17:24:49 +0000 (18:24 +0100)
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  <tdevries@suse.de>

* 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
gdb/testsuite/gdb.dwarf2/fission-base.S
gdb/testsuite/gdb.dwarf2/fission-base.exp
gdb/testsuite/gdb.dwarf2/fission-loclists-pie.S
gdb/testsuite/gdb.dwarf2/fission-loclists-pie.exp
gdb/testsuite/gdb.dwarf2/fission-loclists.S
gdb/testsuite/gdb.dwarf2/fission-loclists.exp
gdb/testsuite/gdb.dwarf2/fission-multi-cu.S
gdb/testsuite/gdb.dwarf2/fission-multi-cu.exp
gdb/testsuite/gdb.dwarf2/fission-reread.S
gdb/testsuite/gdb.dwarf2/fission-reread.exp

index 36ba5d01c4020bb5effac68f27099259cca4ffa9..a557765c4b6c2d800f5d045623d9c808d6e121a1 100644 (file)
@@ -1,3 +1,16 @@
+2021-02-01  Tom de Vries  <tdevries@suse.de>
+
+       * 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  <tdevries@suse.de>
 
        PR breakpoints/26063
index e65cc5ec3b471b34b2e72b271b6bdca01eb1572f..5e10713e938f3d51661753e4a20b82b851d6e9de 100644 (file)
@@ -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
index 01b5c823844ab499a3d3e4427d3590664d731ea1..40a7e2a4e3c40088e348a4c18229556212b30652 100644 (file)
@@ -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
index 698176013b5e2b55119aed2c4ec1eb5630c42aaa..e87ca369bf749c89dd7a3415b4996a2190e4b6fe 100644 (file)
@@ -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
index e2f3c69938ce561ac332edafb8905e842cc0bdaa..c0a7785985be3c20423de0afe6d75a904a79b4c0 100644 (file)
@@ -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
index b4d954b70385b1230e4d9fbb3730159f565b8832..c40b956dc4e2a51b10524c76dc3742bfa2b5ece4 100644 (file)
@@ -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
index 8e6b999070d5f94e675e38911b291dc5242b2d99..54eace0496cc1d7f9f7905e5cb9f552af68b860f 100644 (file)
@@ -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
index c9bb07efec5a086dfeecb58f62f6d49774b5dc63..df83613831e460393dba14b13eb26c14948ff597 100644 (file)
 
    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
index d1db1c9c8a3f6971148e46d80bacf606727c2f71..dec754798b670566607600ede7902453e4babec5 100644 (file)
@@ -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
index 92087aa7ad91d39eb43c30bcbf845fa5e75f4bda..dd1ffcd05e86b745fe5ab625fc5e6a503734277e 100644 (file)
@@ -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 */
index 074e5354f5039fa21f2c580daec19409e227e448..b97c48ad1b36733ef89cf6c0cd9adedc9514aff7 100644 (file)
@@ -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.*"