| 160 | } |
| 161 | |
| 162 | inline std::string source_location(const void* addr, bool position_independent) { |
| 163 | uintptr_t addr_base = 0; |
| 164 | if (position_independent) { |
| 165 | addr_base = boost::stacktrace::detail::get_own_proc_addr_base(addr); |
| 166 | } |
| 167 | const void* offset = reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(addr) - addr_base); |
| 168 | std::string source_line = boost::stacktrace::detail::addr2line("-Cpe", reinterpret_cast<const void*>(offset)); |
| 169 | if (source_line.empty() || source_line[0] == '?') { |
| 170 | return ""; |
| 171 | } |
| 172 | |
| 173 | return source_line; |
| 174 | } |
| 175 | |
| 176 | struct to_string_using_addr2line { |
| 177 | std::string res; |
no test coverage detected