Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* no symbol in current context problem
@ 2008-09-15 16:55 Peng Yu
  2008-09-15 17:00 ` Daniel Jacobowitz
  0 siblings, 1 reply; 4+ messages in thread
From: Peng Yu @ 2008-09-15 16:55 UTC (permalink / raw)
  To: gdb

Hi,

I have the following program. When I step in to test's constructor, I
would be able to print the variable three. It says
(gdb) n
7             T three = 3;
(gdb) n
8             std::cout << three << std::endl;
(gdb) p three
No symbol "three" in current context.

I know that this is a bug has been reported before. But I'm wondering
if it is already fixed in the newest version of gdb.

Thanks,
Peng

#include <iostream>

template <typename T>
class test {
  public:
    test(const T &a) : _a(a) {
      T three = 3;
      std::cout << three << std::endl;
    }
  private:
    T _a;
};

int main() {
  test<double> p(10);
}


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

* Re: no symbol in current context problem
  2008-09-15 16:55 no symbol in current context problem Peng Yu
@ 2008-09-15 17:00 ` Daniel Jacobowitz
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Jacobowitz @ 2008-09-15 17:00 UTC (permalink / raw)
  To: Peng Yu; +Cc: gdb

On Mon, Sep 15, 2008 at 11:54:51AM -0500, Peng Yu wrote:
> Hi,
> 
> I have the following program. When I step in to test's constructor, I
> would be able to print the variable three. It says
> (gdb) n
> 7             T three = 3;
> (gdb) n
> 8             std::cout << three << std::endl;
> (gdb) p three
> No symbol "three" in current context.
> 
> I know that this is a bug has been reported before. But I'm wondering
> if it is already fixed in the newest version of gdb.

I believe it's a bug in GCC, not in GDB - try searching the GCC bugzilla.

-- 
Daniel Jacobowitz
CodeSourcery


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

* Re: no symbol in current context problem
  2007-07-27  0:39 kdsfinger
@ 2007-07-27  5:57 ` Daniel Jacobowitz
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Jacobowitz @ 2007-07-27  5:57 UTC (permalink / raw)
  To: kdsfinger; +Cc: gdb

On Thu, Jul 26, 2007 at 07:53:22PM -0400, kdsfinger@gmail.com wrote:
> Is that a known bug for any of the software I am using listed above?
> Thanks for help.

I believe you can find a description of this bug in the GCC bugzilla
somewhere; it omits local variables from constructors when generating
debug info.  I don't remember if it's been fixed or not, though.

-- 
Daniel Jacobowitz
CodeSourcery


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

* no symbol in current context problem
@ 2007-07-27  0:39 kdsfinger
  2007-07-27  5:57 ` Daniel Jacobowitz
  0 siblings, 1 reply; 4+ messages in thread
From: kdsfinger @ 2007-07-27  0:39 UTC (permalink / raw)
  To: gdb

hi, all
I got the "no symbol 'xxx' in current context" message when I am using
DDD to debug a very simple c++ program. Following is the trouble code.

Test::Test(){
  int n = 100; //breakpoint
  for (int i = 0; i < 3; i++) //breakpoint
    std::cout<<i<<std::endl; //breakpoint
}

int main(){
Test test;
int n = 10;//ok to print n
for (int i = 0; i < 3; i++)//ok to print i
std::cout<<i<<std::endl;//ok to print i
return 1;
}

When I run into the breakpoints and try to print the n or i in DDD, I
got the no symbol message. The global variables are fine.

Here are the versions of the software I am using

GNU DDD 3.3.11 (i486-pc-linux-gnu)
GNU gdb 6.6-debian
cmake version 2.4-patch 6, using "-ggdb -W -Wall -O0" in CMakeLists.txt
gcc version 4.1.2 (Ubuntu 4.1.2-0ubuntu4)
OS Kubuntu 7.0.4, kernel 2.6.20-16-generic

Is that a known bug for any of the software I am using listed above?
Thanks for help.


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

end of thread, other threads:[~2008-09-15 17:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-15 16:55 no symbol in current context problem Peng Yu
2008-09-15 17:00 ` Daniel Jacobowitz
  -- strict thread matches above, loose matches on Subject: below --
2007-07-27  0:39 kdsfinger
2007-07-27  5:57 ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox