MCPcopy Create free account
hub / github.com/GaijinEntertainment/daScript / demangle

Function demangle

src/hal/crash_handler.cpp:214–236  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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;

Callers 1

print_backtrace_framesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected