Article View: gnu.gdb.bug
Article #790Applying Member Functions
From: John Hagerman
Date: Sat, 03 Jun 1989 18:40
Date: Sat, 03 Jun 1989 18:40
40 lines
1188 bytes
1188 bytes
This is on a VAXstation 3200 running BSD 4.3, using g++ version 1.35.0
and GDB 3.1.2.
Consider the following C++ program:
#include <stream.h>
class Simple
{
int i;
public:
Simple(int i_init) { i = i_init; }
int GetI() { return i; }
}
main()
{
Simple s_real(5);
Simple &s_ref = s_real;
cout << s_real.GetI() << "\n";
cout << s_ref.GetI() << "\n";
exit(0);
}
When compiled and run, it produces two 5's as expected. When in GDB,
however, applying the member function works for the object but not for
the object reference:
...
Bpt 1, main (1, 2147477544, 2147477552) (gdb-bug.C line 14)
(gdb) n
(gdb) print s_real.GetI()
$1 = 5
(gdb) print s_ref.GetI()
$2 = 2147477444
(gdb)
- John
Technical Details
Message-ID:
<8906031840.AA20526@maxwell.ece.cmu.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!MAXWELL.ECE.CMU.EDU!hagermanShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!MAXWELL.ECE.CMU.EDU!hagerman From: hagerman@MAXWELL.ECE.CMU.EDU (John Hagerman) Newsgroups: gnu.gdb.bug Subject: Applying Member Functions Message-ID: <8906031840.AA20526@maxwell.ece.cmu.edu> Date: 3 Jun 89 18:40:23 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 40