🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Carlo Wood Wed, 22 May 2002 01:30
More problems with debugging C++ programs
#1973
Author: 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>
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads