-#if defined(SIGSEGV_STACK_IA64)
- ip = (void*)ucontext->uc_mcontext.gregs[REG_RIP];
- bp = (void**)ucontext->uc_mcontext.gregs[REG_RBP];
-#elif defined(SIGSEGV_STACK_X86)
- ip = (void*)ucontext->uc_mcontext.gregs[REG_EIP];
- bp = (void**)ucontext->uc_mcontext.gregs[REG_EBP];
-#endif
-
- fprintf(stderr, "Stack trace:\n");
- while(bp && ip) {
- if(!dladdr(ip, &dlinfo))
- break;
-
- const char *symname = dlinfo.dli_sname;
-#ifndef NO_CPP_DEMANGLE
- int status;
- char *tmp = __cxa_demangle(symname, NULL, 0, &status);
-
- if(status == 0 && tmp)
- symname = tmp;
-#endif
-
- fprintf(stderr, "% 2d: %p <%s+%u> (%s)\n",
- ++f,
- ip,
- symname,
- (unsigned)(ip - dlinfo.dli_saddr),
- dlinfo.dli_fname);
-
-#ifndef NO_CPP_DEMANGLE
- if(tmp)
- free(tmp);
-#endif
-
- if(dlinfo.dli_sname && !strcmp(dlinfo.dli_sname, "main"))
- break;
-
- ip = bp[1];
- bp = (void**)bp[0];
- }
+# if defined(SIGSEGV_STACK_IA64)
+ ip= (void *)ucontext->uc_mcontext.gregs[REG_RIP];
+ bp= (void **)ucontext->uc_mcontext.gregs[REG_RBP];
+# elif defined(SIGSEGV_STACK_X86)
+ ip= (void *)ucontext->uc_mcontext.gregs[REG_EIP];
+ bp= (void **)ucontext->uc_mcontext.gregs[REG_EBP];
+# endif
+
+ fprintf(stderr, "Stack trace:\n");
+ while (bp && ip)
+ {
+ if (! dladdr(ip, &dlinfo))
+ break;
+
+ const char *symname= dlinfo.dli_sname;
+# if defined(HAVE_ABI_CXA_DEMANGLE) && defined(__cplusplus)
+ int status;
+ char *tmp= __cxa_demangle(symname, NULL, 0, &status);
+
+ if ((status == 0) && tmp)
+ symname= tmp;
+# endif
+
+ fprintf(stderr, "% 2d: %p <%s+%u> (%s)\n",
+ ++f,
+ ip,
+ symname,
+ (unsigned)(ip - dlinfo.dli_saddr),
+ dlinfo.dli_fname);
+
+# if defined(HAVE_ABI_CXA_DEMANGLE) && defined(__cplusplus)
+ if (tmp)
+ free(tmp);
+# endif
+
+ if (dlinfo.dli_sname && ! strcmp(dlinfo.dli_sname, "main"))
+ break;
+
+ ip= bp[1];
+ bp= (void **)bp[0];
+ }