Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [committed][gdb/testsuite] Fix gdb.dwarf2/dw2-using-debug-str.exp with cc-with-gdb-index
Date: Mon, 2 Aug 2021 15:33:20 +0200	[thread overview]
Message-ID: <20210802133318.GA8640@delia> (raw)

Hi,

When running with target board cc-with-gdb-index, we run into:
...
(gdb) file dw2-using-debug-str-no-debug-str^M
Reading symbols from dw2-using-debug-str-no-debug-str...^M
Dwarf Error: DW_FORM_strp used without required section^M
(gdb) FAIL: gdb.dwarf2/dw2-using-debug-str.exp: file dw2-using-debug-str
...

The test expects the dwarf error, but has no matching pattern for the entire
output.

Fix this by updating the regexp.

Tested on x86_64-linux.

Committed to trunk.

Thanks,
- Tom

[gdb/testsuite] Fix gdb.dwarf2/dw2-using-debug-str.exp with cc-with-gdb-index

gdb/testsuite/ChangeLog:

2021-08-02  Tom de Vries  <tdevries@suse.de>

	* gdb.dwarf2/dw2-using-debug-str.exp: Update regexp to match
	cc-with-gdb-index output.

---
 gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp | 28 ++++++++++++++----------
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp b/gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp
index 62febdb0a99..09f58d38f7b 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp
@@ -115,28 +115,32 @@ if {[run_on_host "objcopy" [gdb_find_objcopy] "$args"]} {
 # executable we're going to get an error, which we check for below.
 clean_restart
 
+set line1 "Reading symbols from \[^\r\n\]+"
+set dwarf_error "Dwarf Error: DW_FORM_strp used without required section"
+
 # This pattern is hit when GDB does not use -readnow (i.e. the default
 # behaviour).
 set pattern1 \
     [multi_line \
-        "Reading symbols from \[^\r\n\]+" \
-        "Dwarf Error: DW_FORM_strp used without required section" \
+         $line1 \
+         $dwarf_error \
         "\\(No debugging symbols \[^\r\n\]+\\)"]
 
 # This pattern is hit when GDB does use -readnow (e.g. running with
 # --target_board=readnow).
 set pattern2 \
     [multi_line \
-        "Reading symbols from \[^\r\n\]+" \
+        $line1 \
         "Expanding full symbols from \[^\r\n\]+" \
-        "Dwarf Error: DW_FORM_strp used without required section"]
+        $dwarf_error]
+
+# This pattern is hit when gcc adds an index (e.g. running with
+# --target_board=cc-with-gdb-index).
+set pattern3 \
+    [multi_line \
+        $line1 \
+        $dwarf_error]
 
 # Load the executable, we expect an error from the DWARF parser.
-gdb_test_multiple "file $binfile_no_debug_str" "file $testfile" {
-    -wrap -re $pattern1 {
-       pass $gdb_test_name
-    }
-    -re -wrap "$pattern2" {
-       pass $gdb_test_name
-    }
-}
+gdb_test "file $binfile_no_debug_str" "($pattern1|$pattern2|$pattern3)" \
+    "file $testfile"

                 reply	other threads:[~2021-08-02 13:36 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=20210802133318.GA8640@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