From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PATCH][gdb/testsuite] Fix gdb.dwarf2/fission-reread.exp with .gdb_index
Date: Mon, 1 Feb 2021 15:43:37 +0100 [thread overview]
Message-ID: <20210201144335.GA1920@delia> (raw)
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 <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/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.*"
next reply other threads:[~2021-02-01 14:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-01 14:43 Tom de Vries [this message]
2021-02-01 16:24 ` Simon Marchi via Gdb-patches
2021-02-02 8:26 ` Tom de Vries
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210201144335.GA1920@delia \
--to=tdevries@suse.de \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox