Re: Demangling issues with libcxxrt.so.1 on v9.2

From: David Chisnall <theraven_at_FreeBSD.org>
Date: Tue, 15 Jul 2014 14:24:37 +0100
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 <ivan_at_ivan-labs.com> wrote:

> Hello everybody,
> 
> 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).
> 
> This program:
> ---
> #include <stdio.h>
> #include <stdlib.h>
> 
> extern "C" char* __cxa_demangle(const char* mangled_name,
>                     char* buf, size_t* n, int* status);
> 
> void test(const char *mangled) {
>  int status = 0;
>  char *DemangledName = __cxa_demangle(mangled, NULL, NULL, &status);
>  printf("%s: status %d", mangled, status);
>  if(status == 0)
>    printf("; demangled: '%s'", DemangledName);
>  free(DemangledName);
>  printf("\n");
> }
> 
> int main(void) {
>  test("_Z9NullDerefPi");
>  test("_ZL9NullDerefPi");
>  test("_ZN8DeepFreeILi0EE4freeEPc");
>  test("_ZN8DeepFreeILi13EE4freeEPc");
>  test("_ZN8DeepFreeILi36EE4freeEPc");
>  return 0;
> }
> ---
> 
> 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*)'
> ---
> 
> Note that it fails to demangle the local name in the 2nd line and adds extra 'E' character in DeepFree<...E>s.
> 
> 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?
> 
> Thanks a lot.
> 
> -- 
> 
> _______________________________________________
> freebsd-current_at_freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to "freebsd-current-unsubscribe_at_freebsd.org"
Received on Tue Jul 15 2014 - 11:24:48 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:50 UTC