From maho@localhost.FreeBSD.ORG Sun Feb 8 19:17:08 2004 Return-Path: Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 889E816A4CE for ; Sun, 8 Feb 2004 19:17:08 -0800 (PST) Received: from debussy.private.org (25.60.138.210.bn.2iij.net [210.138.60.25]) by mx1.FreeBSD.org (Postfix) with ESMTP id 04DDF43D1D for ; Sun, 8 Feb 2004 19:17:08 -0800 (PST) (envelope-from maho@localhost) Received: from debussy.private.org (localhost [127.0.0.1]) by debussy.private.org (8.12.10/8.12.10) with ESMTP id i193LACC098467 for ; Mon, 9 Feb 2004 12:21:10 +0900 (JST) (envelope-from maho@debussy.private.org) Received: (from maho@localhost) by debussy.private.org (8.12.10/8.12.10/Submit) id i193LAjl098466; Mon, 9 Feb 2004 12:21:10 +0900 (JST) (envelope-from maho) Message-Id: <200402090321.i193LAjl098466@debussy.private.org> Date: Mon, 9 Feb 2004 12:21:10 +0900 (JST) From: Nakata Maho Reply-To: Nakata Maho To: FreeBSD-gnats-submit@freebsd.org Cc: Subject: FreeBSD's exception (try/catch) handling is somewhat odd X-Send-Pr-Version: 3.113 X-GNATS-Notify: >Number: 62559 >Category: bin >Synopsis: FreeBSD's exception (try/catch) handling is somewhat odd >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-bugs >State: closed >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Feb 08 19:20:19 PST 2004 >Closed-Date: Tue Feb 10 17:32:08 PST 2004 >Last-Modified: Tue Feb 10 17:32:08 PST 2004 >Originator: Nakata Maho >Release: FreeBSD 5.2-RELEASE i386 >Organization: private >Environment: FreeBSD satie.private.org 5.2-RELEASE FreeBSD 5.2-RELEASE #0: Thu Jan 22 18:23:40 JST 2004 root@satie.private.org:/usr/src/sys/i386/compile/MAHO-5.2-SATIE i386 >Description: We are porting OpenOffice.org to FreeBSD, handling of exception throwing seems to be somewhat odd, so _random_ core dump can happen, and OpenOffice.org for FreeBSD will be unstable. >How-To-Repeat: you can fetch test program at: http://www.fs.tum.de/~mrauch/OpenOffice/gcc_eh_test.tar.gz begin 644 gcc_eh_test.tar.gz M'XL(`.#^U#\``^U:_V_BQA*_7_%?,I`2@@V!)W(]U0$GL1Z!U#:7IGK2 MU;&7X-9XD6V20[V\O[TS:P,F22]17T*EZWXD9+,[.]]V=V9VX=KS/K+)QY0E MZ9O70KW>K+?;!_BLJ^T#E9YUM=D4SQQOD*!UH+;;#8W:5:U1;[\Y>#6-"I@G MJ1L#O)D&WB3X(AV+DVTHM%U@R3U#Q4E7[] M??!"-TG`.!5/)7]V.OE+.8A2^+4"'0C*^/C]KK0F^=^2)FM7B)26+7U7%,AD M[J)0M9H]2'CVJN4/:CE$TEPST4@OZB$Q\/@\A7?O8,=!(\DZ]LECLS3@$4S< MR`^IJ5:KP0X1,6S(6:GP/?@AG[&HO%/;SYVDUA*^4[6S&`4L4Y93?0LH!7=91=F$4D81@N*L@^GD=(^1M3%#-% M7?@\]&$64V(0,3RCQX3D?[-3`V6(>L2W08+)BD\9!H?IUT0'$R.U#D+.;7L3L% M3%1SS(TXTLV&)PLT88JA:CI#5\0D&3=@HP;F&"*>.T#8GG+%]7\E5]"X]):C M3M%UB,[`\'C%PRSK0A#!LFJK_:4P5=S_JSSRPC7@4_M?.V@N][_:JF?U7TO5 MY/[?`KY8_SVCV%L6>2)=8A663F)^6\ZK-"K*"B65AZ&&>*S2]WHK?[-13VTP M*3>U"M6-=U]Q%O[[4-S_9QA%*42_M(RG]G^KT5[E?Z3(SG^-NMS_6P!FSXY( M(4JI)BX`X'V647#3*J6]'_Q@/,X:V*?9J@>^_1:8-^$/4RR42O]52@CX_#DG M,:@<3S!ISB,D4!1BTH'"$0D*!YA5.E-*U]]]!WL75)[LH6P>IWO^`L-/X,%> M1K:F50K<"JSOL\DKE3W^F'1U@Y-6Y*0]S4G;L$-P\D+F1AVE%$]A+_/AGQKM M\9C!;BU_\/4,O/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/catch) handling is somewhat odd Date: Mon, 09 Feb 2004 12:28:35 +0900 Sorry, description inappropreate. so I send follow-up We are porting OpenOffice.org to FreeBSD, and encounter the problem. FreeBSD's g++'s handling of exception throwing seems to be somewhat odd, so coredump can happen everywhere when throwing the exception, and OpenOffice.org for FreeBSD will be unbuildable/unstable. Michael Rauch wote very simple test program. http://porting.openoffice.org/servlets/ReadMsg?list=dev&msgNo=11408 a) untar gcc_eh_test.tar.gz b) make clean ; make For FreeBSD 5.2-RELEASE i386, % make clean ; make rm -f main libtest1.so libtest2.so core *.core *.o main.out g++ -Wall -shared -o libtest1.so libtest1.cpp g++ -Wall -shared -o libtest2.so libtest2.cpp g++ -Wall -export-dynamic -o main main.cpp ./main > main.out Abort trap (core dumped) *** Error code 134 % cat main.out Testing exception handling ... calling lib2func successful! % gdb main main.core GNU gdb 5.2.1 (FreeBSD) Copyright 2002 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-unknown-freebsd"...(no debugging symbols found)... Core was generated by `main'. Program terminated with signal 6, Aborted. Reading symbols from /usr/lib/libstdc++.so.4...(no debugging symbols found)...done. Loaded symbols for /usr/lib/libstdc++.so.4 Reading symbols from /lib/libm.so.2...(no debugging symbols found)...done. Loaded symbols for /lib/libm.so.2 Reading symbols from /lib/libc.so.5...(no debugging symbols found)...done. Loaded symbols for /lib/libc.so.5 Reading symbols from ./libtest1.so...(no debugging symbols found)...done. Loaded symbols for ./libtest1.so Reading symbols from ./libtest2.so...(no debugging symbols found)...done. Loaded symbols for ./libtest2.so Reading symbols from /libexec/ld-elf.so.1...(no debugging symbols found)...done. Loaded symbols for /libexec/ld-elf.so.1 #0 0x28193d4f in kill () from /lib/libc.so.5 (gdb) bt #0 0x28193d4f in kill () from /lib/libc.so.5 #1 0x281887f8 in raise () from /lib/libc.so.5 #2 0x28200f02 in abort () from /lib/libc.so.5 #3 0x28102007 in __cxxabiv1::__terminate(void (*)()) () from /usr/lib/libstdc++.so.4 #4 0x28102044 in std::terminate() () from /usr/lib/libstdc++.so.4 #5 0x28101f86 in __cxa_throw () from /usr/lib/libstdc++.so.4 #6 0x28226ab9 in lib2func() () from ./libtest2.so #7 0x28224a4e in lib1func(void*) () from ./libtest1.so #8 0x08048aa7 in main () #9 0x08048862 in _start () (gdb) apparently exception are thrown correctly (at #6) but not catched correctly (at #5). % cat libtest2.cpp #include #include "libtest.h" using namespace std; void lib2func() throw(EHclass) { cout << "calling lib2func successful!" << endl; throw(EHclass(42)); <---here } you see that exception is thrown perfectly, and catcher % cat libtest1.cpp #include #include "libtest.h" using namespace std; typedef void libfunc(); void lib1func(void * lib2func) { libfunc *libfunc2; try{ libfunc2 = (libfunc*) lib2func; libfunc2(); } catch(EHclass e) { cout << "Exception caught: " << e.i << endl; <---here } } doesn't work. expected result is: % cat main.exp Testing exception handling ... calling lib2func successful! Exception caught: 42 --------------------------------------------------------------- you can fetch test program at: http://www.fs.tum.de/~mrauch/OpenOffice/gcc_eh_test.tar.gz in BSD style license, but for infomative reason, I pasted in this PR. >Fix: Sorry. N/A. I desperately need Guru's help. From: Nakata Maho To: freebsd-gnats-submit@FreeBSD.org, maho@FreeBSD.org Cc: Subject: Re: bin/62559: FreeBSD's exception (try/catch) handling is somewhat odd Date: Mon, 09 Feb 2004 13:54:37 +0900 seemed to be fixed in * $FreeBSD: src/libexec/rtld-elf/rtld.c,v 1.91 2003/12/31 15:10:41 dfr Exp $ which is not included in 5.2-RELEASE State-Changed-From-To: open->closed State-Changed-By: maho State-Changed-When: Tue Feb 10 17:31:20 PST 2004 State-Changed-Why: As already mentioned, it has been already fixed http://www.freebsd.org/cgi/query-pr.cgi?pr=62559 >Unformatted: