🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gdb.bug
Article #1973

More problems with debugging C++ programs

#1973
From: Carlo Wood
Date: Wed, 22 May 2002 01:30
33 lines
1973 bytes
At a breakpoint in this line:

294           instance_locked[instance] += 1;
295           locked_by[instance] = pthread_self();
296           locked_from[instance] = __builtin_return_address(0);

(gdb) p instance_locked[instance]
No symbol "instance" in current context.

Fortunately I happen to know that instance == 3, so I type

(gdb) p instance_locked[3]
Address of "instance_locked" is unknown.

Fortunately I know that this is "caused" by gdb not being
able to deal with namespaces very well... so I type:

(gdb) p 'libcw::debug::_private_::instance_locked'[3]
cannot subscript something of type `<data variable, no debug info>'

Ah, gdb ALSO doesn't know the type... so lets TELL it the type:

(gdb) p ((unsigned int*)&'libcw::debug::_private_::instance_locked')[3]
$4 = 1

This isn't the nicest way to debug though.

I wish someone would react to my first post here...
(with subject: Huge problems with debugging threaded C++ programs)
so we can make a start with fixing things like this.

-- 
Carlo Wood <carlo@alinoe.com>
Technical Details
Message-ID: <20020522033003.A10504@alinoe.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!nntp.cs.ubc.ca!cyclone.bc.net!newsfeed.media.kyoto-u.ac.jp!newsfeed.mesh.ad.jp!osa.uu.net!sea.uu.net!ash.uu.net!spool0901.news.uu.net!wendy-fate.uu.net!bug-gdb

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f5053,3e2230d1a5d7f52d,start
X-Google-Attributes: gidf5053,public
X-Google-ArrivalTime: 2002-05-21 18:30:12 PST
x-uunet-gateway: chi6sosrv13.alter.net from bug-gdb to gnu.gdb.bug; Wed, 22 May 2002 01:30:11 GMT
Date: Wed, 22 May 2002 03:30:03 +0200
From: carlo@alinoe.com (Carlo Wood)
Subject: More problems with debugging C++ programs
Message-ID: <20020522033003.A10504@alinoe.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.2.5i
Approved: bug-gdb-request@mail.gnu.org
Newsgroups: gnu.gdb.bug
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!nntp.cs.ubc.ca!cyclone.bc.net!newsfeed.media.kyoto-u.ac.jp!newsfeed.mesh.ad.jp!osa.uu.net!sea.uu.net!ash.uu.net!spool0901.news.uu.net!wendy-fate.uu.net!bug-gdb
Sender: bug-gdb-request@mail.gnu.org
Lines: 33