🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gdb.bug
Article #724

static members and gdb-3.1.1

#724
From: David Fox
Date: Mon, 20 Mar 1989 21:41
31 lines
969 bytes
On the sun-4 I compiled the following program with g++-1.34.1:

	class Box {
	  static int boxId;
	protected:
	  int x;
	  Box() : x(++boxId) {}
	};
	
	main()
	{
	  Box b;
	  int x = 0;
	  x = x + 1;
	}

And when I try to print the value of b I get the following message:

	(gdb) break main
	Breakpoint 1 at 0x2188: file bug.cc, line 11.
	(gdb) run
	Starting program: /u/tom/fox/src/text/bug 

	Bpt 1, main () (bug.cc line 11)
	(gdb) p b
	$1 = {boxId = ptrace: I/O error.
	Cannot read memory: address 0x0 out of bounds.
	(gdb) 

David Fox
fox@cs.columbia.edu
Technical Details
Message-ID: <8903202141.AA27581@cs.columbia.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!CS.COLUMBIA.EDU!fox

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!CS.COLUMBIA.EDU!fox
From: fox@CS.COLUMBIA.EDU (David Fox)
Newsgroups: gnu.gdb.bug
Subject: static members and gdb-3.1.1
Message-ID: <8903202141.AA27581@cs.columbia.edu>
Date: 20 Mar 89 21:41:06 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 31