Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Mar 2003 12:58:00 +0100 (CET)
From:      Martin Blapp <mb@imp.ch>
To:        current@freebsd.org
Cc:        kan@freebsd.org
Subject:   C++ Exception handling with shared libs in current is broken again
Message-ID:  <20030312125308.J59497@cvs.imp.ch>

index | next in thread | raw e-mail

[-- Attachment #1 --]

Hi all,

I do know now why I have again problems with building openoffice.
It seems that exceptions over shared libraries are broken again in
CURRENT.

Alexander, do you have a idea why this got broken again ?

Attached is your test programm ...

Martin

STABLE:

mb@stable:~/cxxtest$ export LD_LIBRARY_PATH=.
mb@stable:~/cxxtest$ ./arf
calling foo
in baz
foo caught Bax thowing...
returned from foo

CURRENT:

mb@current:~/cxxtest$ export LD_LIBRARY_PATH=.
mb@current:~/cxxtest$ ./arf
abort trap

... The exception is not catched at all ...

Martin Blapp, <mb@imp.ch> <mbr@FreeBSD.org>
------------------------------------------------------------------
ImproWare AG, UNIXSP & ISP, Zurlindenstrasse 29, 4133 Pratteln, CH
Phone: +41 61 826 93 00 Fax: +41 61 826 93 01
PGP: <finger -l mbr@freebsd.org>
PGP Fingerprint: B434 53FC C87C FE7B 0A18 B84C 8686 EF22 D300 551E
------------------------------------------------------------------
[-- Attachment #2 --]
# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#       Makefile
#       foo.cc
#       main.cc
#
echo x - Makefile
sed 's/^X//' >Makefile << 'END-of-Makefile'
XCXX=g++
XLD=ld
XCXXFLAGS=-g -fpic -fexceptions
X
Xall: arf
X
Xarf: main.o foo.so
X	${CXX} -o arf main.o foo.so
X
X
Xfoo.so: foo.o
X	${LD} -Bshareable -o foo.so foo.o
X
Xclean:
X	rm -f arf *.o *.so
END-of-Makefile
echo x - foo.cc
sed 's/^X//' >foo.cc << 'END-of-foo.cc'
X#include <stdio.h>
X
Xint Foo ();
X
Xint Baz ()
X{
X    char *msg = "Bax thowing..."; 
X    printf ("in baz\n");
X    throw msg;
X    printf ("baz should not be here.\n");
X}
X
X
Xint Foo ()
X{
X    try {
X        Baz ();
X    } catch (char *msg) {
X        printf ("foo caught %s\n", msg);
X    }
X}
END-of-foo.cc
echo x - main.cc
sed 's/^X//' >main.cc << 'END-of-main.cc'
X#include <stdio.h>
X
Xint Foo ();
X
Xint
Xmain ()
X{
X    try {
X        printf ("calling foo\n");
X        Foo ();
X        printf ("returned from foo\n");
X    } catch (char *msg) {
X        printf ("exception from foo: %s\n", msg);
X    } catch (...) {
X        printf ("unknown exception\n");
X    }
X}
END-of-main.cc
exit
help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030312125308.J59497>