* pr 11543 using-directive does not autocomplete
@ 2010-04-27 17:58 Chris Moller
2010-04-27 20:32 ` Jan Kratochvil
0 siblings, 1 reply; 4+ messages in thread
From: Chris Moller @ 2010-04-27 17:58 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 189 bytes --]
Attached patch fixes this, but here's a question: Is it possible to
have multiple name qualifications like "A::B::whatever"? If so, this
path will have to be tweaked to address that.
[-- Attachment #2: pr11543.patch --]
[-- Type: text/x-patch, Size: 4469 bytes --]
? testsuite/gdb.cp/.Makefile.in.swp
? testsuite/gdb.cp/pr11543
? testsuite/gdb.cp/pr9594
Index: ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/ChangeLog,v
retrieving revision 1.11687
diff -u -r1.11687 ChangeLog
--- ChangeLog 26 Apr 2010 21:45:47 -0000 1.11687
+++ ChangeLog 27 Apr 2010 17:53:59 -0000
@@ -1,3 +1,8 @@
+2010-04-27 Chris Moller <cmoller@redhat.com>
+
+ PR 11543
+ * symtab.c (completion_list_add_name): Handle qualified names.
+
2010-04-26 Doug Evans <dje@google.com>
* serial.c (serial_write): Handle serial_debug_p akin to serial_read.
Index: symtab.c
===================================================================
RCS file: /cvs/src/src/gdb/symtab.c,v
retrieving revision 1.233
diff -u -r1.233 symtab.c
--- symtab.c 23 Apr 2010 12:08:06 -0000 1.233
+++ symtab.c 27 Apr 2010 17:54:03 -0000
@@ -3345,6 +3345,21 @@
int newsize;
int i;
+ {
+ if (!strstr (sym_text, "::"))
+ {
+ char *sym_qual_ptr = strstr (symname, "::");
+
+ if (sym_qual_ptr)
+ {
+ sym_qual_ptr += 2;
+ while(isspace (*sym_qual_ptr))
+ sym_qual_ptr++;
+ symname = sym_qual_ptr;
+ }
+ }
+ }
+
/* clip symbols that cannot match */
if (strncmp (symname, sym_text, sym_text_len) != 0)
Index: testsuite/ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/ChangeLog,v
retrieving revision 1.2256
diff -u -r1.2256 ChangeLog
--- testsuite/ChangeLog 26 Apr 2010 20:49:27 -0000 1.2256
+++ testsuite/ChangeLog 27 Apr 2010 17:54:20 -0000
@@ -1,3 +1,10 @@
+Tue Apr 27 13:49:24 2010 Chris Moller <cmoller@redhat.com>
+
+ PR 11543
+ * gdb.cp/Makefile.in (EXECUTABLES): Added pr11543.
+ * gdb.cp/pr11543.cc:
+ * gdb.cp/pr11543.exp: New files.
+
2010-04-24 Pierre Muller <muller@ics.u-strasbg.fr>
PR breakpoints/11531.
Index: testsuite/gdb.cp/Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.cp/Makefile.in,v
retrieving revision 1.11
diff -u -r1.11 Makefile.in
--- testsuite/gdb.cp/Makefile.in 21 Apr 2010 17:33:54 -0000 1.11
+++ testsuite/gdb.cp/Makefile.in 27 Apr 2010 17:54:21 -0000
@@ -5,7 +5,7 @@
derivation inherit local member-ptr method misc \
overload ovldbreak ref-typ ref-typ2 templates userdef virtfunc namespace \
ref-types ref-params method2 pr9594 gdb2495 virtfunc2 pr9067 \
- pr1072 pr10687 pr9167
+ pr1072 pr10687 pr9167 pr11543
all info install-info dvi install uninstall installcheck check:
@echo "Nothing to be done for $@..."
Index: testsuite/gdb.cp/pr11543.cc
===================================================================
RCS file: testsuite/gdb.cp/pr11543.cc
diff -N testsuite/gdb.cp/pr11543.cc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ testsuite/gdb.cp/pr11543.cc 27 Apr 2010 17:54:21 -0000
@@ -0,0 +1,7 @@
+namespace A { int variablex = 1; }
+int main (void)
+{
+ int variabley = 2;
+ using namespace A;
+ return 0; /* break-here */
+}
Index: testsuite/gdb.cp/pr11543.exp
===================================================================
RCS file: testsuite/gdb.cp/pr11543.exp
diff -N testsuite/gdb.cp/pr11543.exp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ testsuite/gdb.cp/pr11543.exp 27 Apr 2010 17:54:21 -0000
@@ -0,0 +1,34 @@
+#Copyright 2010 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+set nl "\[\r\n\]+"
+
+set testfile pr11543
+set srcfile ${testfile}.cc
+if [prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}] {
+ return -1
+}
+
+if ![runto_main] then {
+ fail "Can't run to main"
+ return
+}
+
+gdb_breakpoint [gdb_get_line_number "break-here"]
+gdb_continue_to_breakpoint "break-here"
+
+gdb_test "complete p vari" "p variablex${nl}p variabley"
+gdb_test "complete p A::vari" "p A::variablex"
+
[-- Attachment #3: pr11543-sum.diff --]
[-- Type: text/x-patch, Size: 3078 bytes --]
--- virgin.sum 2010-04-27 11:56:57.722206261 -0400
+++ patched.sum 2010-04-27 13:43:32.856201547 -0400
@@ -1,4 +1,4 @@
-Test Run By moller on Tue Apr 27 11:41:42 2010
+Test Run By moller on Tue Apr 27 13:30:09 2010
Native configuration is i686-pc-linux-gnu
=== gdb tests ===
@@ -629,8 +629,8 @@
PASS: gdb.base/attach.exp: cd away from process working directory
FAIL: gdb.base/attach.exp: before attach3, flush symbols (GDB internal error)
PASS: gdb.base/attach.exp: before attach3, flush exec
-FAIL: gdb.base/attach.exp: attach when process' a.out not in cwd (GDB internal error)
-FAIL: gdb.base/attach.exp: after attach3, exit (the program is no longer running)
+PASS: gdb.base/attach.exp: attach when process' a.out not in cwd
+PASS: gdb.base/attach.exp: after attach3, exit
PASS: gdb.base/attach.exp: force switch to gdb64, if necessary
PASS: gdb.base/attach.exp: attach call
PASS: gdb.base/attach.exp: info other register
@@ -12341,6 +12341,10 @@
Running ../../../src/gdb/testsuite/gdb.cp/pr10728.exp ...
PASS: gdb.cp/pr10728.exp: continue to breakpoint: marker 1
PASS: gdb.cp/pr10728.exp: print x->y2 - x->y1
+Running ../../../src/gdb/testsuite/gdb.cp/pr11543.exp ...
+PASS: gdb.cp/pr11543.exp: continue to breakpoint: break-here
+PASS: gdb.cp/pr11543.exp: complete p vari
+PASS: gdb.cp/pr11543.exp: complete p A::vari
Running ../../../src/gdb/testsuite/gdb.cp/pr9067.exp ...
PASS: gdb.cp/pr9067.exp: print b
Running ../../../src/gdb/testsuite/gdb.cp/pr9167.exp ...
@@ -15727,11 +15731,11 @@
Running ../../../src/gdb/testsuite/gdb.reverse/watch-reverse.exp ...
Running ../../../src/gdb/testsuite/gdb.server/ext-attach.exp ...
PASS: gdb.server/ext-attach.exp: set remote exec-file
-FAIL: gdb.server/ext-attach.exp: attach to remote program 1
+PASS: gdb.server/ext-attach.exp: attach to remote program 1
PASS: gdb.server/ext-attach.exp: backtrace 1
-FAIL: gdb.server/ext-attach.exp: detach
+PASS: gdb.server/ext-attach.exp: detach
PASS: gdb.server/ext-attach.exp: backtrace with no program
-FAIL: gdb.server/ext-attach.exp: attach to remote program 2
+PASS: gdb.server/ext-attach.exp: attach to remote program 2
PASS: gdb.server/ext-attach.exp: backtrace 2
PASS: gdb.server/ext-attach.exp: kill
PASS: gdb.server/ext-attach.exp: monitor exit
@@ -16546,7 +16550,7 @@
PASS: gdb.threads/watchthreads2.exp: all threads started
PASS: gdb.threads/watchthreads2.exp: watch x
PASS: gdb.threads/watchthreads2.exp: set var test_ready = 1
-KFAIL: gdb.threads/watchthreads2.exp: gdb can drop watchpoints in multithreaded app (PRMS: gdb/10116)
+PASS: gdb.threads/watchthreads2.exp: all threads incremented x
Running ../../../src/gdb/testsuite/gdb.trace/actions.exp ...
PASS: gdb.trace/actions.exp: 5.1a: set three tracepoints, no actions
PASS: gdb.trace/actions.exp: 5.1b: set actions for first tracepoint
@@ -16814,8 +16818,8 @@
=== gdb Summary ===
-# of expected passes 15944
-# of unexpected failures 47
+# of expected passes 15953
+# of unexpected failures 42
# of expected failures 45
# of untested testcases 7
# of unsupported tests 62
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: pr 11543 using-directive does not autocomplete
2010-04-27 17:58 pr 11543 using-directive does not autocomplete Chris Moller
@ 2010-04-27 20:32 ` Jan Kratochvil
2010-04-27 20:42 ` Chris Moller
2010-04-27 21:10 ` Tom Tromey
0 siblings, 2 replies; 4+ messages in thread
From: Jan Kratochvil @ 2010-04-27 20:32 UTC (permalink / raw)
To: Chris Moller; +Cc: gdb-patches
On Tue, 27 Apr 2010 19:58:20 +0200, Chris Moller wrote:
> Attached patch fixes this, but here's a question: Is it possible to
> have multiple name qualifications like "A::B::whatever"?
Yes.
Unfortunately your patch has a regression even for single-namespace case:
------------------------------------------------------------------------------
namespace A
{
int variableq = 1;
namespace B
{
int variabler = 2;
}
}
int
main (void)
{
return A::variableq + A::B::variabler;
}
------------------------------------------------------------------------------
(gdb) p var<tab>
->
(gdb) p variableq
No symbol "variableq" in current context.
In this case current FSF GDB HEAD behavior is the only correct one.
The completion patch must follow the existing / non-existing "using namespace"
directives. The patch must be integrated with `struct using_direct' lists
tracked by Sami Wagiaalla's using_directive infrastructure.
Thanks for picking this up.
Thanks,
Jan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: pr 11543 using-directive does not autocomplete
2010-04-27 20:32 ` Jan Kratochvil
@ 2010-04-27 20:42 ` Chris Moller
2010-04-27 21:10 ` Tom Tromey
1 sibling, 0 replies; 4+ messages in thread
From: Chris Moller @ 2010-04-27 20:42 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: gdb-patches
On 04/27/10 16:32, Jan Kratochvil wrote:
> On Tue, 27 Apr 2010 19:58:20 +0200, Chris Moller wrote:
>
>> Attached patch fixes this, but here's a question: Is it possible to
>> have multiple name qualifications like "A::B::whatever"?
>>
>
> Yes.
>
> Unfortunately your patch has a regression even for single-namespace case:
>
I /thought/ that was too easy. :-)
Okay, I'll go hack on it some more,
Thanks,
Chris
> ------------------------------------------------------------------------------
> namespace A
> {
> int variableq = 1;
> namespace B
> {
> int variabler = 2;
> }
> }
> int
> main (void)
> {
> return A::variableq + A::B::variabler;
> }
> ------------------------------------------------------------------------------
> (gdb) p var<tab>
> ->
> (gdb) p variableq
> No symbol "variableq" in current context.
>
> In this case current FSF GDB HEAD behavior is the only correct one.
>
> The completion patch must follow the existing / non-existing "using namespace"
> directives. The patch must be integrated with `struct using_direct' lists
> tracked by Sami Wagiaalla's using_directive infrastructure.
>
> Thanks for picking this up.
>
>
> Thanks,
> Jan
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: pr 11543 using-directive does not autocomplete
2010-04-27 20:32 ` Jan Kratochvil
2010-04-27 20:42 ` Chris Moller
@ 2010-04-27 21:10 ` Tom Tromey
1 sibling, 0 replies; 4+ messages in thread
From: Tom Tromey @ 2010-04-27 21:10 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: Chris Moller, gdb-patches
>>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:
Jan> The completion patch must follow the existing / non-existing "using
Jan> namespace" directives. The patch must be integrated with `struct
Jan> using_direct' lists tracked by Sami Wagiaalla's using_directive
Jan> infrastructure.
Also, I think this should probably be done via la_make_symbol_completion_list.
Tom
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-04-27 21:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-27 17:58 pr 11543 using-directive does not autocomplete Chris Moller
2010-04-27 20:32 ` Jan Kratochvil
2010-04-27 20:42 ` Chris Moller
2010-04-27 21:10 ` Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox