Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 01 Nov 2020 12:29:25 +0000
From:      bugzilla-noreply@freebsd.org
To:        toolchain@FreeBSD.org
Subject:   [Bug 250702] c++filt crashes on a particular symbol
Message-ID:  <bug-250702-29464-SPe74A9ukU@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-250702-29464@https.bugs.freebsd.org/bugzilla/>
References:  <bug-250702-29464@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D250702

--- Comment #7 from Dimitry Andric <dim@FreeBSD.org> ---
It's pretty interesting, when I use this simple little demangle.cpp program:

#include <cxxabi.h>
#include <stdio.h>
#include <stdlib.h>

static char *demangle_buf;
static size_t demangle_size =3D 2 * 1024;

static void demangle(const char *mangled_name)
{
  int status;
  char *demangled_name =3D abi::__cxa_demangle(mangled_name, demangle_buf,
&demangle_size, &status);
  switch (status) {
  case 0:
    printf("%s -> %s\n", mangled_name, demangled_name);
    break;
  case -1:
    printf("error: memory allocation failure while demangling %s\n",
mangled_name);
    break;
  case -2:
    printf("error: %s is not a valid C++ mangled name\n", mangled_name);
    break;
  case -3:
    printf("error: invalid argument(s) while demangling %s\n", mangled_name=
);
    break;
  default:
    printf("error: unknown status %d while demangling %s\n", status,
mangled_name);
    break;
  }
}

int main(int argc, char *argv[])
{
  if (argc <=3D 1) {
    printf("Usage: %s mangled_name ...\n", argv[0]);
    return 1;
  }
  if ((demangle_buf =3D (char *)malloc(demangle_size)) =3D=3D NULL) {
    printf("Unable to allocate memory for demangle buffer\n");
    return 1;
  }
  for (int i =3D 1; i < argc; ++i) {
    demangle(argv[i]);
  }
  free(demangle_buf);
  return 0;
}

it works just fine on the identifier:

% ./demangle '_ZZ5func1vENK3$_0clEv'
_ZZ5func1vENK3$_0clEv -> func1(void)::$_0::operator()(void) const

However, it uses the *older* copy of elftoolchain's libelftc_dem_gnu3.c in
contrib/libcxxrt!

E.g. something has been broken in this area in more recent releases of
elftoolchain...

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-250702-29464-SPe74A9ukU>