This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: MI: getting qualified type name
On Thu, Apr 13, 2006 at 10:26:46AM -0700, Jim Ingham wrote:
> That's odd. If I define some struct in a namespace myself, like:
>
> namespace bar
> {
> struct whatever
> {
> int someval;
> };
> };
>
> then -var-create lists the type as bar::whatever. So it must be
> something funny about how "string" is defined, rather than a general
> bug or a decision to strip the namespace info.
It appears to be a bug involving typedefs. Try adding "typedef
whatever zot" inside of namespace bar.
namespace bar
{
struct whatever
{
int someval;
};
typedef whatever zot;
};
(gdb) interpreter-exec mi "-var-create - * b"
^done,name="var2",numchild="1",type="bar::whatever"
(gdb)
(gdb) interpreter-exec mi "-var-create - * c"
^done,name="var3",numchild="1",type="zot"
(gdb)
I don't know what compiler you're using, Vladimir, but in GCC 4.0.3
this appears to be a compiler bug. The typedef gets emitted inside
main, not inside the namespace. Same in 3.3. Slightly different,
but similar problem in 4.1.
This is now GCC PR 27160.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27160
> (Note, however, if you are using stabs, you'll never get the
> namespace, since it isn't in the debug info. You probably aren't
> using stabs, but just to be clear...)
Actually, IIRC, it does but poorly? Hmm, maybe not for this case.
--
Daniel Jacobowitz
CodeSourcery