From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [pushed] [gdb/testsuite] Fix gdb.dwarf2/dw-form-strx-out-of-bounds.exp
Date: Mon, 3 Aug 2026 19:52:22 +0200 [thread overview]
Message-ID: <20260803175222.2825911-1-tdevries@suse.de> (raw)
With test-case gdb.dwarf2/dw-form-strx-out-of-bounds.exp, I usually get:
...
(gdb) file dw-form-strx-out-of-bounds
Reading symbols from dw-form-strx-out-of-bounds...
(gdb) ptype global_var
DWARF Error: Offset from DW_FORM_GNU_str_index or DW_FORM_strx pointing \
outside of .debug_str_offsets section in CU at offset 0x2d1 [in module \
dw-form-strx-out-of-bounds]
No symbol "global_var" in current context.
(gdb) PASS: $exp: ptype global_var
...
But I just ran into:
...
(gdb) file dw-form-strx-out-of-bounds^M
Reading symbols from dw-form-strx-out-of-bounds...
DWARF Error: Offset from DW_FORM_GNU_str_index or DW_FORM_strx pointing \
outside of .debug_str_offsets section in CU at offset 0x2df [in module \
dw-form-strx-out-of-bounds]^M
(gdb) ptype global_var^M
No symbol "global_var" in current context.^M
(gdb) FAIL: $exp: ptype global_var
...
Fix this by:
- using "maint set dwarf synchronous on" to ensure that the error happens
during the file command
- updating the matching to check $gdb_file_cmd_msg
Tested gdb.dwarf2/dw-form-strx-out-of-bounds.exp and gdb.dwarf2/dw-form-strx.exp
using make-check-all.sh on x86_64-linux.
---
gdb/testsuite/gdb.dwarf2/dw-form-strx-out-of-bounds.exp | 7 +++----
gdb/testsuite/gdb.dwarf2/dw-form-strx.exp.tcl | 8 +++++++-
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/gdb/testsuite/gdb.dwarf2/dw-form-strx-out-of-bounds.exp b/gdb/testsuite/gdb.dwarf2/dw-form-strx-out-of-bounds.exp
index be7323bce95..e1e28eb432f 100644
--- a/gdb/testsuite/gdb.dwarf2/dw-form-strx-out-of-bounds.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw-form-strx-out-of-bounds.exp
@@ -34,8 +34,7 @@ set re_dwarf_error \
set re_in_module \
{in module [^\r\n]+}
set re_in_module [string_to_regexp {[}]$re_in_module[string_to_regexp {]}]
+gdb_assert {[regexp "$re_dwarf_error $re_in_module" $gdb_file_cmd_msg]}
+
set re_no_symbol [string_to_regexp {No symbol "global_var" in current context.}]
-gdb_test "ptype global_var" \
- [multi_line \
- "$re_dwarf_error $re_in_module"\
- $re_no_symbol]
+gdb_test "ptype global_var" $re_no_symbol
diff --git a/gdb/testsuite/gdb.dwarf2/dw-form-strx.exp.tcl b/gdb/testsuite/gdb.dwarf2/dw-form-strx.exp.tcl
index 931c935ccae..b261dc654af 100644
--- a/gdb/testsuite/gdb.dwarf2/dw-form-strx.exp.tcl
+++ b/gdb/testsuite/gdb.dwarf2/dw-form-strx.exp.tcl
@@ -54,11 +54,17 @@ Dwarf::assemble $asm_file {
}
}
-if { [prepare_for_testing "failed to prepare" ${testfile} \
+if { [build_executable "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
return
}
+clean_restart
+
+gdb_test_no_output "maint set dwarf synchronous on"
+
+gdb_load $binfile
+
# Let includers know prepare_for_testing was done, without having to check
# source return status.
set prepare_for_testing_done 1
base-commit: 8b3ea407f65571000c9fc3d79081b65d1b4e3759
--
2.51.0
reply other threads:[~2026-08-03 17:53 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260803175222.2825911-1-tdevries@suse.de \
--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