Opened 5 years ago
Closed 4 years ago
#13300 closed Bugs (obsolete)
boost stacktrace broken on solaris
Reported by: | Owned by: | joseph.gauterin | |
---|---|---|---|
Milestone: | To Be Determined | Component: | swap |
Version: | Boost 1.65.0 | Severity: | Problem |
Keywords: | Cc: |
Description
Solaris dladdr
doesn’t match function signature of most platforms nor the signature expected in boost stacktrace sources.
Solaris: int dladdr(void* addr, Dl_info* info);
Darwin: int dladdr(const void* addr, Dl_info* info);
This caused the following build errors on Solaris SPARC and Solaris X86.
location_from_symbol.hpp, line 31: Error: Cannot cast away const or volatile. location_from_symbol.hpp, line 31: Error: Formal argument 1 of type void* in call to dladdr(void*, dl_info*) is being passed const void*. frame_unwind.ipp, line 87: Error: Cannot cast away const or volatile. frame_unwind.ipp, line 87: Error: Formal argument 1 of type void* in call to dladdr(void*, dl_info*) is being passed const void*const.
Following diff seems to fix this issue:
diff -ru a/boost/stacktrace/detail/frame_unwind.ipp b/boost/stacktrace/detail/frame_unwind.ipp --- a/boost/stacktrace/detail/frame_unwind.ipp Sat Aug 19 16:49:49 2017 +++ b/boost/stacktrace/detail/frame_unwind.ipp Fri Sep 15 20:12:08 2017 @@ -84,7 +84,7 @@ std::string frame::name() const { #if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) ::Dl_info dli; +#if defined(__sun) + const bool dl_ok = !!::dladdr(const_cast<void *>(addr_), &dli); +#else const bool dl_ok = !!::dladdr(addr_, &dli); +#endif if (dl_ok && dli.dli_sname) { return boost::core::demangle(dli.dli_sname); } diff -ru a/boost/stacktrace/detail/location_from_symbol.hpp b/boost/stacktrace/detail/location_from_symbol.hpp --- a/boost/stacktrace/detail/location_from_symbol.hpp Sat Aug 19 16:49:49 2017 +++ b/boost/stacktrace/detail/location_from_symbol.hpp Fri Sep 15 20:12:51 2017 @@ -28,7 +28,7 @@ explicit location_from_symbol(const void* addr) BOOST_NOEXCEPT : dli_() { +#if defined(__sun) + if (!::dladdr(const_cast<void *>(addr), &dli_)) { +#else if (!::dladdr(addr, &dli_)) { +#endif dli_.dli_fname = 0; } }
Change History (1)
comment:1 by , 4 years ago
Component: | None → swap |
---|---|
Owner: | set to |
Resolution: | → obsolete |
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Moved to https://github.com/boostorg/stacktrace/issues/54