This is the mail archive of the gdb@sourceware.org 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]

GDB crashes when call member function having same name as a local pointer variable


hi,

I am wondering if it would be a bug. The following is the tiny program I am using to test. This test failed on both gdb 6.5 and 6.6

=========================
#include <stdio.h>

class foo {
 private:
   int _data;
 public:
   int data() { return _data; }
   void bar();
};

void
foo::bar()
{
char * data = NULL;
printf("Can you do p data()?\n"); // When let gdb breaks on this statement, "p data()" will cause segmentation fault.
}


int main(int argc, char ** argv)
{
foo obj;
obj.bar();
return 0;
}
===================
Do we need to provide some hints to the user such as popping up "this->data()" ?


Thanks,
Neo

--
I would remember that if researchers were not ambitious
probably today we haven't the technology we are using!


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