]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/testsuite] Fix gdb.base/dlmopen.exp on native-gdbserver
authorTom de Vries <tdevries@suse.de>
Thu, 14 Aug 2025 20:31:06 +0000 (22:31 +0200)
committerTom de Vries <tdevries@suse.de>
Thu, 14 Aug 2025 20:31:06 +0000 (22:31 +0200)
With test-case gdb.base/dlmopen.exp and target board native-gdbserver, I get:
...
(gdb) info breakpoints 3^M
Num     Type           Disp Enb Address            What^M
3       breakpoint     keep y   0x00007ffff7fc8000 ^M
        stop only if (0) (target evals)^M
(gdb) FAIL: $exp: test_solib_unmap_events: check b/p status
...

The problem is that the regexp doesn't allow for the "(target evals)" part:
...
-re -wrap "$bpnum\\s+breakpoint\\s+keep\\s+y\\s+$::hex\\s*\[^\r\n\]+\r\n\\s+stop o
nly if \\(0\\)" {
...

Fix this by updating the regexp.

While we're at it:
- rewrite the regexp using multiline, string_to_regexp, join and string cat to
  make it more readable, and
- remove the redundant failure clause from the same gdb_test_multiple.

Tested on x86_64-linux using make-check-all.sh.

Approved-By: Tom Tromey <tom@tromey.com>
gdb/testsuite/gdb.base/dlmopen.exp

index da17002dae7d5af27f4ac5969cb53524a546082f..e7bf6f3f7bc59b7565e96a8c1a2221b39b0e92e7 100644 (file)
@@ -358,15 +358,19 @@ proc_with_prefix test_solib_unmap_events { } {
     # dynamic linker as pending when some instances of the library were
     # unloaded, despite there really only being one copy of the dynamic
     # linker actually loaded into the inferior's address space.
-    gdb_test_multiple "info breakpoints $bpnum" "check b/p status" {
-       -re -wrap "$bpnum\\s+breakpoint\\s+keep\\s+y\\s+<PENDING>\\s+\\*$::hex\\s*\r\n\\s+stop only if \\(0\\)" {
-           fail $gdb_test_name
-       }
-
-       -re -wrap "$bpnum\\s+breakpoint\\s+keep\\s+y\\s+$::hex\\s*\[^\r\n\]+\r\n\\s+stop only if \\(0\\)" {
-           pass $gdb_test_name
-       }
-    }
+    set hs {[^\r\n]}
+    set re_pass \
+       [multi_line \
+            "" \
+            [join \
+                 [list \
+                      "$bpnum" "breakpoint" "keep" "y" "$::hex$hs+"] \
+                 {\s+}] \
+            [string cat \
+                 {\s+} \
+                 [string_to_regexp "stop only if (0)"] \
+                 ([string_to_regexp " (target evals)"])?]]
+    gdb_test "info breakpoints $bpnum" $re_pass "check b/p status"
 
     # With all the dlclose calls now complete, we should be back to a
     # single copy of the dynamic linker.