Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@efficios.com>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@efficios.com>
Subject: [PATCH 1/2] gdb/testsuite: fix max-completions regex in test_gdb_complete_cmd_multiple
Date: Mon, 26 Oct 2026 10:45:55 -0400	[thread overview]
Message-ID: <20261026144606.1941722-1-simon.marchi@efficios.com> (raw)

When called with MAX_COMPLETIONS true and a non-empty COMPLETION_WORD,
test_gdb_complete_cmd_multiple fails to match the "List may be
truncated" line.  It expects that line to start with CMD_PREFIX only
("macro expand " in the example below), but GDB prints CMD_PREFIX
("macro expand ") followed by COMPLETION_WORD ("BEFORE_"):

    (gdb) complete macro expand BEFORE_
    macro expand BEFORE_MACSCP1_1
    macro expand BEFORE_MACSCP1_2
    macro expand BEFORE_ *** List may be truncated, max-completions reached. ***

Fix it by including COMPLETION_WORD in the expected line.  The next
patch adds a test that depends on this.  I suppose that no other test
uses this proc in this exact way currently, I don't see any regression
following this change.

Change-Id: I645197f625212dd6c654081742b3bd42fac36229
---
 gdb/testsuite/lib/completion-support.exp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gdb/testsuite/lib/completion-support.exp b/gdb/testsuite/lib/completion-support.exp
index 112c48df6cf0..0c4b72b1c073 100644
--- a/gdb/testsuite/lib/completion-support.exp
+++ b/gdb/testsuite/lib/completion-support.exp
@@ -246,9 +246,9 @@ proc test_gdb_complete_cmd_multiple { cmd_prefix completion_word completion_list
     set expected_re [make_cmd_completion_list_re $cmd_prefix $completion_list $start_quote_char $end_quote_char]
 
     if {$max_completions} {
-	set cmd_prefix_re [string_to_regexp $cmd_prefix]
+	set input_re [string_to_regexp $cmd_prefix$completion_word]
 	append expected_re \
-	    "$cmd_prefix_re \\*\\*\\* List may be truncated, max-completions reached\\. \\*\\*\\*.*\r\n"
+	    "$input_re \\*\\*\\* List may be truncated, max-completions reached\\. \\*\\*\\*.*\r\n"
     }
 
     set cmd_re [string_to_regexp "complete $cmd_prefix$completion_word"]

base-commit: 50b7267f00c094614ab4efb43f7aac0507a436e7
-- 
2.56.0


             reply	other threads:[~2026-10-26 14:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-26 14:45 Simon Marchi [this message]
2026-10-26 14:45 ` [PATCH 2/2] gdb/macrotab: catch exception and rethrow around splay_tree_foreach Simon Marchi
2026-10-28 17:37   ` Andrew Burgess
2026-10-28 19:24     ` Simon Marchi
2026-10-28 17:21 ` [PATCH 1/2] gdb/testsuite: fix max-completions regex in test_gdb_complete_cmd_multiple Andrew Burgess

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=20261026144606.1941722-1-simon.marchi@efficios.com \
    --to=simon.marchi@efficios.com \
    --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