This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH,v2] Fix gdb.linespec/explicit.exp
- From: Pedro Alves <palves at redhat dot com>
- To: Luis Machado <lgustavo at codesourcery dot com>, gdb-patches at sourceware dot org, keiths at redhat dot com
- Date: Tue, 7 Feb 2017 11:59:46 +0000
- Subject: Re: [PATCH,v2] Fix gdb.linespec/explicit.exp
- Authentication-results: sourceware.org; auth=none
- References: <1485552639-18470-1-git-send-email-lgustavo@codesourcery.com> <1485870899-12563-1-git-send-email-lgustavo@codesourcery.com>
On 01/31/2017 01:54 PM, Luis Machado wrote:
> The first one is that i couldn't see the hex character x07 being ouput in both
> of the above systems for this particular test. There is really only one
> possible completion result for the main function. Maybe this character is
> output in other systems?
Yes. Readline outputs the bell character (x07) when there's more than
one possible completion.
I actually tripped on this a couple months back, while working on
my palves/cp-linespec branch (on my github, it reworks completion support
and adds a real linespec completer). I have a fix there that says:
~~~
On the explicit.exp change:
The test currently expects a bell because:
(gdb) complete b -function main
b -function main
b -function main_arena
"main_arena" is a data global part of glibc's malloc implementation.
I.e., the test must be failing on target whose malloc implementation
doesn't share an ancestry with glibc's...
~~~
So if you're on a glibc system with debug info for glibc, you'll
see the bell. Elsewhere, you won't.
The real problem is that the completer for linespecs should not be
finding "main_arena", because that's a data symbol, not a function.
The change to the test itself in the branch is:
--- a/gdb/testsuite/gdb.linespec/explicit.exp
+++ b/gdb/testsuite/gdb.linespec/explicit.exp
@@ -187,7 +187,7 @@ namespace eval $testfile {
set tst "complete unique function name"
send_gdb "break -function mai\t"
gdb_test_multiple "" $tst {
- "break -function mai\\\x07n" {
+ "break -function main" {
send_gdb "\n"
gdb_test "" ".*Breakpoint \[0-9\]+.*" $tst
gdb_test_no_output "delete \$bpnum" "delete $tst breakpoint"
>
> So i started playing around with the regular expression to make x07 optional,
> but no matter what pattern i used, it just didn't match.
>
> It was then that i noticed we're missing a leading "-re" before the
> gdb_test_multiple pattern to be matched, the second problem. I checked the
> documentation for the command and did not find anything about the use
> without "-re". So i assumed it is an oversight.
gdb_test_multiple is just a wrapper around expect. Not writing
"-re" just means you're matching a pattern literally, instead of with
a regex. So without the -re, regexp things like ? or * have no
special meaning, they are matched literally.
See the manual at <http://www.tcl.tk/man/expect5.31/expect.1.html>,
after "For example, the following fragment looks".
> Make the x07 character optional in the unique function name completion
> test.
This test is exercising completion of a _unique_ function name, so
expecting a bell never really made sense... A better fix would be to
try completion of a symbol name that is more likely to not conflict
with some other system symbol, like Keith was suggesting.
Meanwhile, this is OK (with the commit log adjusted / clarified).
Thanks,
Pedro Alves