public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* namespaces and gdb
@ 2000-06-28  7:34 Alexander Zhuckov
  2000-06-28 10:28 ` Daniel Berlin
  0 siblings, 1 reply; 4+ messages in thread
From: Alexander Zhuckov @ 2000-06-28  7:34 UTC (permalink / raw)
  To: gdb

Hi!

I use Linux, C++ and gdb 5.0.
Suppose I have a simple program:

namespace Foo {

    const char version[] = "0.1";

}

int main()
{
    return 0;
}

How I can eximine a value of the Foo::vesrion varibale?

-- 
Alexander Zhuckov   zuav@int.spb.ru   2:5030/518.50

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: namespaces and gdb
  2000-06-28  7:34 namespaces and gdb Alexander Zhuckov
@ 2000-06-28 10:28 ` Daniel Berlin
  2000-06-30  2:05   ` Alexander Zhuckov
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Berlin @ 2000-06-28 10:28 UTC (permalink / raw)
  To: Alexander Zhuckov; +Cc: gdb

p 'Foo::version'
I'm trying to remember if i made it possible to just do p Foo::version, i
know i did it with templates.
If you don't want to have to quote it, try the latest CVS version of gdb,
and tell me if i fixed that (Bell Atlantic DSL is down right now, or else
i'd do a checkout myself).


On 28 Jun 2000, Alexander Zhuckov wrote:

> Hi!
> 
> I use Linux, C++ and gdb 5.0.
> Suppose I have a simple program:
> 
> namespace Foo {
> 
>     const char version[] = "0.1";
> 
> }
> 
> int main()
> {
>     return 0;
> }
> 
> How I can eximine a value of the Foo::vesrion varibale?
> 
> -- 
> Alexander Zhuckov   zuav@int.spb.ru   2:5030/518.50
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: namespaces and gdb
  2000-06-28 10:28 ` Daniel Berlin
@ 2000-06-30  2:05   ` Alexander Zhuckov
  2000-06-30  7:28     ` Daniel Berlin
  0 siblings, 1 reply; 4+ messages in thread
From: Alexander Zhuckov @ 2000-06-30  2:05 UTC (permalink / raw)
  To: gdb

Daniel Berlin <dan@cgsoftware.com> writes:
> p 'Foo::version'
> I'm trying to remember if i made it possible to just do p Foo::version, i
> know i did it with templates.
> If you don't want to have to quote it, try the latest CVS version of gdb,
> and tell me if i fixed that (Bell Atlantic DSL is down right now, or else
> i'd do a checkout myself).

Thank you very much! I tried it (p 'Foo::version') in gdb 5.0 and it works.
And now I have one more question: how I can examine a value of a variable
in anonymous namespace?
-- 
Alexander Zhuckov   zuav@int.spb.ru   2:5030/518.50

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: namespaces and gdb
  2000-06-30  2:05   ` Alexander Zhuckov
@ 2000-06-30  7:28     ` Daniel Berlin
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Berlin @ 2000-06-30  7:28 UTC (permalink / raw)
  To: Alexander Zhuckov; +Cc: gdb

On 30 Jun 2000, Alexander Zhuckov wrote:

> 
> Thank you very much! I tried it (p 'Foo::version') in gdb 5.0 and it works.
> And now I have one more question: how I can examine a value of a variable
> in anonymous namespace?
> 
You have to know how it's really being named. nm <your
executable>|c++filt|grep -i <the variable name>
See, the real problem is that namespaces don't generate any debug info,
and aren't symbols, so they don't really exist, so to speak.
The reason quoting it works is because it also matches it against the
demangled names.
--Dan
C++ Support Maintainer - GDB

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2000-06-30  7:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-06-28  7:34 namespaces and gdb Alexander Zhuckov
2000-06-28 10:28 ` Daniel Berlin
2000-06-30  2:05   ` Alexander Zhuckov
2000-06-30  7:28     ` Daniel Berlin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).