From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19167 invoked by alias); 20 Nov 2013 17:58:05 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 19111 invoked by uid 89); 20 Nov 2013 17:58:05 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_50,RDNS_NONE,URIBL_BLOCKED autolearn=no version=3.3.2 X-HELO: mail3-relais-sop.national.inria.fr Received: from Unknown (HELO mail3-relais-sop.national.inria.fr) (192.134.164.104) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Wed, 20 Nov 2013 17:58:03 +0000 Received: from stedding.saclay.inria.fr ([193.55.250.194]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES128-SHA; 20 Nov 2013 18:57:54 +0100 Received: from glisse (helo=localhost) by stedding.saclay.inria.fr with local-esmtp (Exim 4.80) (envelope-from ) id 1VjC2D-0002xQ-Tt; Wed, 20 Nov 2013 18:57:53 +0100 Date: Wed, 20 Nov 2013 17:59:00 -0000 From: Marc Glisse Reply-To: gcc-help@gcc.gnu.org To: vijay nag cc: "gcc-help@gcc.gnu.org" Subject: Re: C++ exceptions In-Reply-To: Message-ID: References: User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII X-SW-Source: 2013-11/txt/msg00151.txt.bz2 On Wed, 20 Nov 2013, vijay nag wrote: > On Wed, Nov 20, 2013 at 6:19 PM, Marc Glisse wrote: >> On Wed, 20 Nov 2013, vijay nag wrote: >> >>> Hello gcc, >>> >>> I'm working on a big project consisting of both C && C++ libraries. >>> The shared binary created out of these two libraries seems to be >>> having trouble with the exceptions. Exception handler i.e catch() is >>> not being dispatched by libstdc++ for some reason and the program is >>> terminating with SIGABRT as a result of it. Static binary seems to be >>> catching exceptions without any issues. >>> Some amount of googling on this topic suggested me to use >>> "-fexceptions" compiler switch but it didn't have any affect. Since >>> static binary works even without "-fexceptions" I think the issue has >>> nothing to do with "-fexceptions" compiler switch. Just before >>> sigabrt I see these lines being printed by libstdc++. How do I debug >>> this issue ? >>> >>> "terminate called after throwing an instance of 'ORBEM_AS_NotFound' >> >> >> Are you running on Solaris (or maybe a BSD)? Does LD_PRELOAD=libgcc_s.so.1 >> (or maybe LD_PRELOAD=/path/to/libgcc_s.so.1) help? >> >> -- >> Marc Glisse > > Nope Im running a variant of debian linux i686 kernel. Does GCC pick > libgcc from GCC_EXEC_PREFIX ? At runtime, it uses RPATH or /etc/ld.so.conf. > I am running the program in complete > chroot encironment so that libraries donot collide with host machine. > Are you telling me that Issue is because of wrong version of libgcc ? Probably not. I only asked because a common issue on solaris is that both libc and libgcc_s provide exception routines, and if not all routines are taken from the same library, bad things happen. The first thing you need to do is reduce your testcase. Can it show the issue with a single shared lib? With none? Does any try-throw-catch fail this way or only some? That will give you more information about the issue, and once the test is small enough, you can consider using a debugger to follow what is going on. ------ Wait, are you throwing from a destructor? Those are noexcept by default nowadays, which would cause a call to std::terminate. Specify noexcept(false) on it if you insist. -- Marc Glisse