Opened 6 months ago

Closed 3 weeks ago

#13300 closed Bugs (obsolete)

boost stacktrace broken on solaris

Reported by: dkimura@… Owned by: joseph.gauterin
Milestone: To Be Determined Component: swap
Version: Boost 1.65.0 Severity: Problem
Keywords: Cc:


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);
     const bool dl_ok = !!::dladdr(addr_, &dli);
     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_)) {
        if (!::dladdr(addr, &dli_)) {
             dli_.dli_fname = 0;

Attachments (0)

Change History (1)

comment:1 Changed 3 weeks ago by John Maddock

Component: Noneswap
Owner: set to joseph.gauterin
Resolution: obsolete
Status: newclosed

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain joseph.gauterin.
The resolution will be deleted.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.