This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: current namespace game plan


On 04 Oct 2002 21:43:20 -0500, Jim Blandy <jimb@red-bean.com> said:

> For my own sake, at least, it would be nice to have specific
> examples of code and commands that GDB gets wrong at present.

I'm including a file with examples after my signature: break in main
and try to print out each expression listed in the body of main;
you'll have problems.  And break in B::b2 and try to print out b1;
you'll have problems.

For some of these (u1, a1, and b1, but not the foo expression, D::b1,
or e2), GDB actually prints out an answer that is incorrect, rather
than saying that there isn't a symbol by that name.  Pretty weird; I
just noticed that, and I really don't understand why GDB would do so.
I'll have to look into that, but if you happen to understand what's
going on with those examples, please tell me.

David Carlton
carlton@math.stanford.edu

namespace {
  int u1 = 1;
}

namespace A {
  int a1 = 1;
}

using namespace A;

namespace B {
  int b1 = 1;

  int b2()
  {
    return b1;
  }
}

namespace C {
  class c1 {};
  void foo(c1 x)
  {
  }
}

namespace D = B;

namespace E {
  int e1 = 1;
  int e2 = 2;
}

using E::e2;

int main()
{
  // For each of these, try to print out the expression in question,
  // as typed here.  (Well, you should probably enclose them in single
  // quotes.)  GDB either won't let you or will print out garbage.

  // GDB can't see unnamed namespaces.
  u1;
  // GDB can't see using directives.
  a1;
  // GDB can't do Koenig lookup.
  foo(C::c1());
  // GDB can't see namespace aliases.
  D::b1;
  // GDB can't see using declarations.
  e2;

  // For this one, break in B::b2 and try to print b1.  GDB won't let you.
  B::b2();
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]