From owner-freebsd-current@FreeBSD.ORG Tue Jul 15 13:24:48 2014 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A5E73C56; Tue, 15 Jul 2014 13:24:48 +0000 (UTC) Received: from theravensnest.org (theraven.freebsd.your.org [216.14.102.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cloud.theravensnest.org", Issuer "StartCom Class 1 Primary Intermediate Server CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 54E38260B; Tue, 15 Jul 2014 13:24:47 +0000 (UTC) Received: from c106.sec.cl.cam.ac.uk (c106.sec.cl.cam.ac.uk [128.232.18.106]) (authenticated bits=0) by theravensnest.org (8.14.7/8.14.7) with ESMTP id s6FDObLV080575 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Tue, 15 Jul 2014 13:24:39 GMT (envelope-from theraven@FreeBSD.org) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: Demangling issues with libcxxrt.so.1 on v9.2 From: David Chisnall In-Reply-To: <53C52873.5050309@ivan-labs.com> Date: Tue, 15 Jul 2014 14:24:37 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: <2540F968-444A-4D9C-86C9-45CEA093F34F@FreeBSD.org> References: <53C52873.5050309@ivan-labs.com> To: "Ivan A. Kosarev" X-Mailer: Apple Mail (2.1878.6) Cc: Current FreeBSD , Kai Wang X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Jul 2014 13:24:48 -0000 Hi Ivan, The demangler in libcxxrt is taken from the elftoolchain project. Kai = Wang (added to cc:) was interested in improving it, but I doubt any = fixes will be merged to 9.x any time soon. David On 15 Jul 2014, at 14:11, Ivan A. Kosarev wrote: > Hello everybody, >=20 > It seems there are problems with demandling some kinds of names with = libcxxrt.so.1 on FreeBSD 9.2 (I didn't test other versions yet). >=20 > This program: > --- > #include > #include >=20 > extern "C" char* __cxa_demangle(const char* mangled_name, > char* buf, size_t* n, int* status); >=20 > void test(const char *mangled) { > int status =3D 0; > char *DemangledName =3D __cxa_demangle(mangled, NULL, NULL, &status); > printf("%s: status %d", mangled, status); > if(status =3D=3D 0) > printf("; demangled: '%s'", DemangledName); > free(DemangledName); > printf("\n"); > } >=20 > int main(void) { > test("_Z9NullDerefPi"); > test("_ZL9NullDerefPi"); > test("_ZN8DeepFreeILi0EE4freeEPc"); > test("_ZN8DeepFreeILi13EE4freeEPc"); > test("_ZN8DeepFreeILi36EE4freeEPc"); > return 0; > } > --- >=20 > outputs: > --- > _Z9NullDerefPi: status 0; demangled: 'NullDeref(int*)' > _ZL9NullDerefPi: status -2 > _ZN8DeepFreeILi0EE4freeEPc: status 0; demangled: = 'DeepFree<0E>::free(char*)' > _ZN8DeepFreeILi13EE4freeEPc: status 0; demangled: = 'DeepFree<13E>::free(char*)' > _ZN8DeepFreeILi36EE4freeEPc: status 0; demangled: = 'DeepFree<36E>::free(char*)' > --- >=20 > Note that it fails to demangle the local name in the 2nd line and adds = extra 'E' character in DeepFree<...E>s. >=20 > The case with the local name is not critical, but the case with = DeepFree<...E> prevents LLVM's address sanitizer tests from passing on = FreeBSD so the question is: is there a chance the defect will be = resolved any time soon or should I try to prepare a fix to speed up the = process? >=20 > Thanks a lot. >=20 > --=20 >=20 > _______________________________________________ > freebsd-current@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to = "freebsd-current-unsubscribe@freebsd.org"