On Wed, 20 Nov 2013, vijay nag wrote:
On Wed, Nov 20, 2013 at 6:19 PM, Marc Glisse <marc.glisse@xxxxxxxx> 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