[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#414178: No debugging symbols of local variables in constructor and destructors.



Package: g++
Version: 4:4.1.1-15

I tried to debug this simple program, and i cannot print the local variables in constructor and destructor methods. I write "print i" in the gdb command line and I get "No symbol found". I tested this code on Debian etch but, was tested by other guy who uses Fedora, and he get the same result. We tested it with both gdb 6.5 and gdb 6.6, so it seems g++ bug. I suggest to forward this bug to gcc developers as soon as possible.

---------------------------------file show_bug.cpp---------------------------------------------------------
/***
* This test program demonstrates a problem encountered with g+ v4.1.1 on
* Fedora Core 6 x86_64 using both gdb 6.5 and gdb 6.6.  The value of a
* local variable in a constructor or destructor is not printable, however
* the value of a local variable in a simple member function is printable.
* For testing the code was compiled as:
*     g++  -O0 -ggdb3 show_bug.cpp
*/
#include <iostream>

class Show_Bug
{
public:
 Show_Bug();

 void
   show_ints() ;

 ~Show_Bug();

} ; /* class Show_Bug */


Show_Bug::Show_Bug()
{
 // Trying to display the value of i in this scope results in the message:
 // No symbol "i" in current context.
 int i = 0 ;

 for (i=0; i<3; i++)
 {
   std::cout << i << std::endl;
 }

} /* Show_Bug::Show_Bug() */


void
Show_Bug::show_ints()
{
 // Trying to display the value of i in this scope works fine
 int i = 0 ;

 for (i=0; i<3; i++)
 {
   std::cout << i << std::endl;
 }

} /* Show_Bug::show_ints() */

Show_Bug::~Show_Bug()
{

 // Trying to display the value of i in this scope results in the message:
 // No symbol "i" in current context.
 int i = 0 ;

 for (i=4; i<6; i++)
 {
   std::cout << i << std::endl;
 }

}


int
main()
{
 Show_Bug tst ;

 tst.show_ints() ;

 return 0 ;

} /* main */
---------------End of file--------------------------------------------------------------------

_________________________________________________________________
MSN Amor: busca tu ½ naranja http://latam.msn.com/amor/




Reply to: