Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* GDB crashes when call member function having same name as a local  pointer variable
@ 2007-02-02 19:14 Neo
  2007-02-02 19:43 ` Daniel Jacobowitz
  0 siblings, 1 reply; 2+ messages in thread
From: Neo @ 2007-02-02 19:14 UTC (permalink / raw)
  To: gdb

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!


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

* Re: GDB crashes when call member function having same name as a local  pointer variable
  2007-02-02 19:14 GDB crashes when call member function having same name as a local pointer variable Neo
@ 2007-02-02 19:43 ` Daniel Jacobowitz
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Jacobowitz @ 2007-02-02 19:43 UTC (permalink / raw)
  To: Neo; +Cc: gdb

On Fri, Feb 02, 2007 at 01:13:46PM -0600, Neo wrote:
> 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

I don't think it is.  GDB always evaluates expressions in the context
of the current program location; if you ask it to print just "data", it
will show you whether it's a function or not.

-- 
Daniel Jacobowitz
CodeSourcery


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

end of thread, other threads:[~2007-02-02 19:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-02 19:14 GDB crashes when call member function having same name as a local pointer variable Neo
2007-02-02 19:43 ` Daniel Jacobowitz

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