Subject: Debugging dynamically-linked C++ programs in 1.0
To: None <port-sparc@netbsd.org>
From: Greg Earle <earle@isolar.Tujunga.CA.US>
List: port-sparc
Date: 11/30/1994 01:04:44
I was trying to build Steve McCanne's nifty new videoconferencing tool "vic"
(ftp://ftp.ee.lbl.gov/conferencing/vic/vicsrc-2.4.tar.Z) and a little source
file was core dumping on me.

It was being compiled with

g++ -g -O2 -Wall -o mkcube -DED_YBITS=4 -I/usr/local/include -I./jpeg -I./p64 -I. mkcube.c

It ended up with these dynamic dependancies:

netbsd4me# ldd mkcube
mkcube:
        -lg++.2 => /usr/lib/libg++.so.2.0 (0x4022000)
        -lc.12 => /usr/lib/libc.so.12.0 (0x407e000)
        -lcurses.2 => /usr/lib/libcurses.so.2.1 (0x40e8000)

The program was core dumping on exit() (in end()).

So I took out the "-O2" and built it again, and fired up "gdb" on it.

I then set some breakpoints, but it plowed right past them and gave me a
"Usage" message which was wrong (i.e., it shouldn't have executed in the
first place).

I found that I could only debug the program (i.e., set breakpoints and have it
stop at them (-: ) if I compiled/linked statically.  Is this a Known Problem
in 1.0 with g++ that I just wasn't aware of?  (Anyone tried gcc/g++ 2.6.2 yet?)

Also, given that the program core dumped when linked dynamically, it makes
me wary of linking any C++ program dynamically under 1.0.

	- Greg