Re: [PATCH] Fix double apropos output when both alias name and command name match the pattern

Simon Marchi <[email protected]>
Newsgroups gmane.comp.gdb.patches
Message-ID <[email protected]>
On 5/31/26 12:37 PM, Philippe Waroquiers wrote:
> diff --git a/gdb/testsuite/gdb.base/help.exp b/gdb/testsuite/gdb.base/help.exp
> index a8c55721ef2..6a88c8d4db2 100644
> --- a/gdb/testsuite/gdb.base/help.exp
> +++ b/gdb/testsuite/gdb.base/help.exp
> @@ -135,6 +135,14 @@ gdb_test_no_output "alias mybt10 = backtrace 10" "define mybt10 alias"
>  gdb_test "apropos Print backtrace of all stack frames, or innermost COUNT frames\." \
>      "backtrace, mybt10, mybt, where, bt -- Print backtrace of all stack frames, or innermost COUNT frames\.\[\r\n\]+  alias mybt10 = backtrace 10"
>  
> +# Test apropos when both the alias name and the aliased command match the pattern.
> +gdb_test_no_output "alias ter-exec = interpreter-exec" "define ter-exec alias"
> +gdb_test_multiple "apropos er-exe" "check we have a single output line when alias and command name match" {
> +    -re "^apropos er-exe\r\ninterpreter-exec, ter-exec -- Execute a command in an interpreter\.\r\n$gdb_prompt $" {
> +	pass $gdb_test_name
> +    }

Is there a reason why you can't use gdb_test here?

With an unpatched gdb, we get the bug with "backtrace":

(gdb) apropos backtrace
...
backtrace, where, bt -- Print backtrace of all stack frames, or innermost COUNT frames.
backtrace, where, bt -- Print backtrace of all stack frames, or innermost COUNT frames.
...

You could perhaps add a test using the backtrace command as well?

In any case:

Approved-By: Simon Marchi <[email protected]>

Simon
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.