- int status;
- char *ret = abi::__cxa_demangle(begin, function, &sz, &status);
- if (ret)
- {
- function= ret;
- }
- else
- {
- strncpy(function, begin, sz);
- strncat(function, "()", sz);
- function[sz-1] = '\0';
- }
- fprintf(stderr, "%s\n", function);
- }
- else
+ const char* symname= dlinfo.dli_sname;
+
+ int status;
+ char* demangled= abi::__cxa_demangle(symname, NULL, 0, &status);
+ if (status == 0 and demangled)