| 201 | } |
| 202 | |
| 203 | void |
| 204 | jassert_internal::JAssert::PrintBacktrace() |
| 205 | { |
| 206 | void *buffer[BT_SIZE]; |
| 207 | int nptrs = backtrace(buffer, BT_SIZE); |
| 208 | |
| 209 | Print(" Backtrace:\n"); |
| 210 | char buf[1024]; |
| 211 | |
| 212 | for (int i = 1; i < nptrs; i++) { |
| 213 | Dl_info info; |
| 214 | ss << " " << i << ' ' ; |
| 215 | if (dladdr1(buffer[i], &info, NULL, 0)) { |
| 216 | buf[0] = '\0'; |
| 217 | if (info.dli_sname) { |
| 218 | // int status; |
| 219 | // size_t buflen = sizeof(buf); |
| 220 | // char *demangled = |
| 221 | // abi::__cxa_demangle(info.dli_sname, buf, &buflen, &status); |
| 222 | // if (status != 0) { |
| 223 | // strncpy(buf, info.dli_sname, sizeof(buf) - 1); |
| 224 | // } |
| 225 | strncpy(buf, info.dli_sname, sizeof(buf) - 1); |
| 226 | } |
| 227 | |
| 228 | ss << (buf[0] ? buf : "") << " in " << info.dli_fname << " "; |
| 229 | } |
| 230 | ss << XToHexString(buffer[i]) << "\n"; |
| 231 | } |
| 232 | } |
| 233 | |
| 234 | // This routine is called when JASSERT triggers. Something failed. |
| 235 | // DOES (for further diagnosis): cp /proc/self/maps $DMTCP_TMPDIR/proc-maps |
nothing calls this directly
no test coverage detected