| 249 | } |
| 250 | |
| 251 | inline std::size_t source_line(const void* addr, bool position_independent) { |
| 252 | std::size_t line_num = 0; |
| 253 | uintptr_t addr_base = 0; |
| 254 | if(position_independent){ |
| 255 | addr_base = boost::stacktrace::detail::get_own_proc_addr_base(addr); |
| 256 | } |
| 257 | const void* offset = reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(addr) - addr_base); |
| 258 | std::string res = boost::stacktrace::detail::addr2line("-e", offset); |
| 259 | const std::size_t last = res.find_last_of(':'); |
| 260 | if (last == std::string::npos) { |
| 261 | return 0; |
| 262 | } |
| 263 | res = res.substr(last + 1); |
| 264 | |
| 265 | if (!boost::stacktrace::detail::try_dec_convert(res.c_str(), line_num)) { |
| 266 | return 0; |
| 267 | } |
| 268 | |
| 269 | return line_num; |
| 270 | } |
| 271 | |
| 272 | } // namespace detail |
| 273 |
no test coverage detected