From owner-freebsd-questions Wed Sep 12 7: 3:37 2001 Delivered-To: freebsd-questions@freebsd.org Received: from relay.flashnet.it (ems.flashnet.it [194.247.160.44]) by hub.freebsd.org (Postfix) with ESMTP id 7DBC537B40C for ; Wed, 12 Sep 2001 07:03:32 -0700 (PDT) Received: from smtp.flashnet.it (ip100.pool-173.cyb.it [195.191.181.101]) by relay.flashnet.it (8.11.3/8.11.3) with SMTP id f8CE3U401986 for ; Wed, 12 Sep 2001 16:03:30 +0200 Message-Id: <200109121403.f8CE3U401986@relay.flashnet.it> To: freebsd-questions@FreeBSD.ORG X-Mailer: Post Road Mailer for OS/2 (Green Edition Ver 3.0) Date: Wed, 12 Sep 2001 16:03:31 EST From: Andrea Venturoli Reply-To: Andrea Venturoli Subject: Does g++/gdb work??? Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hello. I'm trying to compile some C++ projects of mine on FreeBSD 4.3. The problem is I get very strange behaviours, some of which are listed below: _ I declare main as "int main(int argv,char**argv)"; now if put a breakpoint on main I sometime get trash in argv and argc; if I continue the execution, however, it seems that the two values are correct, since the program behaves, possibly indicating that gdb shows them wrong; this problem disappears if I remove a try/catch block from inside main. I don't see any reason why modifing something *inside* main should influence the program behaviour when main is called! _ I have a class ON_BinaryStream which is derived from class ON_BinaryArchive; I put a breakpoint in one of ON_BinaryArchive method (on a ON_BinaryStream object): now, if I "p this" the result is obvioulsy (ON_BinaryArchive*) 0xsomeaddress; if I "p (ON_BinaryStream*)this" I get the same address, but "p *this" and "p *((ON_BinaryArchive*)this)" show different values for the base class data members! Then "p *this" shows that _vptr$ is 0x0, and, in fact, the program generates a sigsev when a virtual method is called. I found no explanation for this, either. _ Another project uses "vector"s from the STL. Here the result are sometimes completely random. Inverting the order of some *totally unrelated* statements may cause the program to work or fail with gdb showing trash in the vector's data member. Again this is not normal, IMHO. I tried this on three different machines (a 486 with 4.3, a Pentium with 4.3 and a Duron with 4.2). These are only some of the strange things I witnessed. "gcc -v" tells "2.95.3 [FreeBSD] 20010315 (release)". I usually compile all of the projects above on an OS/2 machine with pgcc-2.95.2 and they work fine. So I tried installing the package pgcc-2.95.2 and use that, but the results are the same. Now, I can't believe C++ support is so buggy, I guess a lot of people must be using it and they would be complaining very loud. Am I missing something? Is there an upgrade path I must take? Anything that could enable me to work with C++ is appreciated. Bye & Thanks av. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message