Acknowledgement sent
to Thomas Richter <[email protected]>:
New Bug report received and forwarded. Copy sent to Daniel Jacobowitz <[email protected]>.
(Fri, 13 Mar 2009 10:21:09 GMT) (full text, mbox, link).
Subject: gdb: TAB expansion for class members does not work
Date: Fri, 13 Mar 2009 11:20:38 +0100
Package: gdb
Version: 6.8-3
Severity: normal
gdb does not provide any useful TAB expansion for class members. That is, if you define a
name space like A::, pressing on TAB presents all useless symbols that are not even members
of the class. To reproduce, enter the following program:
#include <cstdio>
class A {
int x;
public:
A(int y);
~A();
int getX() const;
};
A::A(int y)
: x(y)
{
std::printf("creating\n");
}
A::~A()
{
std::printf("destroying\n");
}
int A::getX() const
{
return x;
}
int main(int argc,char **argv)
{
A a(5);
std::printf("The value of a is %d\n",a.getX());
return 0;
}
Compile this program with g++ -O0 -ggdb3 test.cpp and start debugging with gdb a.out.
Then enter the following:
break A:: (do not press return)
now press TAB. gdb shows now a lot of useless symbols that are not even members of
the class A, rendering TAB expansion useless.
-- System Information:
Debian Release: 5.0
APT prefers stable
APT policy: (500, 'stable')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.26-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=de_DE.iso-8859-1, LC_CTYPE=de_DE (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/bash
Versions of packages gdb depends on:
ii libc6 2.7-18 GNU C Library: Shared libraries
ii libexpat1 2.0.1-4 XML parsing C library - runtime li
ii libncurses5 5.7+20081213-1 shared libraries for terminal hand
ii libreadline5 5.2-3.1 GNU readline and history libraries
gdb recommends no packages.
Versions of packages gdb suggests:
pn gdb-doc <none> (no description available)
-- no debconf information
Acknowledgement sent
to Daniel Jacobowitz <[email protected]>:
Extra info received and forwarded to list. Copy sent to Daniel Jacobowitz <[email protected]>.
(Sun, 11 Oct 2009 21:51:05 GMT) (full text, mbox, link).
Subject: Re: Bug#519525: gdb: TAB expansion for class members does not work
Date: Sun, 11 Oct 2009 17:44:07 -0400
On Fri, Mar 13, 2009 at 11:20:38AM +0100, Thomas Richter wrote:
> Package: gdb
> Version: 6.8-3
> Severity: normal
>
>
> gdb does not provide any useful TAB expansion for class members. That is, if you define a
> name space like A::, pressing on TAB presents all useless symbols that are not even members
> of the class. To reproduce, enter the following program:
This is improved in GDB 7.0, but still not great.
(gdb) complete break A::
break A::A(int)
break A::getX() const
break A::~A()
(gdb) complete break A::A
break A::A(int)
(gdb) break A::A(int)
Breakpoint 1 at 0x4006eb: file 519525.cc, line 12. (2 locations)
Good so far. But:
(gdb) break A::getX() const
Function "A::getX()" not defined.
Make breakpoint pending on future shared library load? (y or [n]) n
(gdb) break A::getX()
Function "A::getX()" not defined.
Make breakpoint pending on future shared library load? (y or [n]) n
(gdb) break 'A::getX() const'
Breakpoint 2 at 0x4006a4: file 519525.cc, line 24.
If the quotes are necessary, GDB should insert them for you; ideally
they shouldn't be necessary.
And:
(gdb) complete break A::~
break A::~<anonymous struct>
break A::~<anonymous struct>::<anonymous union>
break A::~A
break A::~A::A(int)
break A::~A::getX() const
break A::~A::~A()
break A::~FILE
...
Completion is not recognizing ~ as valid in the middle of a symbol.
--
Daniel Jacobowitz
CodeSourcery