| 212 | #endif |
| 213 | |
| 214 | static char * demangle(char * line) { |
| 215 | int status = -1; |
| 216 | #if defined(__linux__) |
| 217 | char *ms = strchr(line, '('); |
| 218 | char *me = ms ? strchr(ms, '+') : nullptr; |
| 219 | if (ms && me) { |
| 220 | char c = *me; *me = '\0'; |
| 221 | char *d = abi::__cxa_demangle(ms + 1, nullptr, nullptr, &status); |
| 222 | *me = c; |
| 223 | if (status == 0) return d; |
| 224 | } |
| 225 | #elif defined(__APPLE__) |
| 226 | char *zs = strstr(line, "_Z"); |
| 227 | char *ze = zs ? strstr(zs, " + ") : nullptr; |
| 228 | if (zs && ze) { |
| 229 | char c = *ze; *ze = '\0'; |
| 230 | char *d = abi::__cxa_demangle(zs, nullptr, nullptr, &status); |
| 231 | *ze = c; |
| 232 | if (status == 0) return d; |
| 233 | } |
| 234 | #endif |
| 235 | return nullptr; |
| 236 | } |
| 237 | |
| 238 | static std::pair<uintptr_t, uintptr_t> get_fp_sp(void *ucontext_ptr) { |
| 239 | uintptr_t fp = 0, sp = 0; |
no outgoing calls
no test coverage detected