MCPcopy Create free account
hub / github.com/boostorg/stacktrace / source_location

Function source_location

include/boost/stacktrace/detail/addr2line_impls.hpp:162–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

160}
161
162inline 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
176struct to_string_using_addr2line {
177 std::string res;

Callers 1

Calls 3

addr2lineFunction · 0.85
get_own_proc_addr_baseFunction · 0.70
emptyMethod · 0.45

Tested by

no test coverage detected