public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] [gdb/testsuite] Fix gdb.cp/namespace.exp with read1
@ 2024-01-14  8:35 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2024-01-14  8:35 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ef3a9d685e677e18c36a30c3d3bd7a4206b30003

commit ef3a9d685e677e18c36a30c3d3bd7a4206b30003
Author: Tom de Vries <tdevries@suse.de>
Date:   Sun Jan 14 09:36:12 2024 +0100

    [gdb/testsuite] Fix gdb.cp/namespace.exp with read1
    
    With check-read1 we run into:
    ...
    (gdb) break DNE>::DNE^M
    Function "DNE>::DNE" not defined.^M
    Make breakpoint pending on future shared library load? (y or [n]) y^M
    Breakpoint 9 (DNE>::DNE) pending.^M
    n^M
    (gdb) FAIL: gdb.cp/namespace.exp: br malformed '>' (got interactive prompt)
    n^M
    ...
    
    The question is supposed to be handled by the question and response arguments
    to this gdb_test call:
    ...
    gdb_test "break DNE>::DNE" "" "br malformed \'>\'" \
        "Make breakpoint pending on future shared library load?.*" "y"
    ...
    but both this and the builtin handling in gdb_test_multiple triggers.
    
    The cause of this is that the question argument regexp is incomplete.
    
    Fix this by making sure that the entire question is matched in the regexp:
    ...
    set yn_re [string_to_regexp {(y or [n])}]
      ...
        "Make breakpoint pending on future shared library load\\? $yn_re " "Y"
    ...
    
    Tested on x86_64-linux.

Diff:
---
 gdb/testsuite/gdb.cp/namespace.exp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gdb/testsuite/gdb.cp/namespace.exp b/gdb/testsuite/gdb.cp/namespace.exp
index 79e9cb1ac79..504359d4998 100644
--- a/gdb/testsuite/gdb.cp/namespace.exp
+++ b/gdb/testsuite/gdb.cp/namespace.exp
@@ -251,8 +251,9 @@ gdb_test "print AAA::ALPHA" "\\$\[0-9\].* = AAA::ALPHA"
 gdb_test "whatis ::C::CClass::NestedClass" "type = C::CClass::NestedClass"
 gdb_test "whatis ::C::CClass::NestedClass *" "type = C::CClass::NestedClass \\*"
 
+set yn_re [string_to_regexp {(y or [n])}]
 # Break on functions with a malformed name.
 gdb_test "break DNE>::DNE" "" "br malformed \'>\'" \
-    "Make breakpoint pending on future shared library load?.*" "y"
+    "Make breakpoint pending on future shared library load\\? $yn_re " "Y"
 gdb_test "break DNE)::DNE" "" "br malformed \')\'" \
-    "Make breakpoint pending on future shared library load?.*" "y"
+    "Make breakpoint pending on future shared library load\\? $yn_re " "Y"

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-01-14  8:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-14  8:35 [binutils-gdb] [gdb/testsuite] Fix gdb.cp/namespace.exp with read1 Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).