@@ -100,25 +100,6 @@ std::string to_string(const frame* frames, std::size_t size) {
100100 return res;
101101}
102102
103- } // namespace detail
104-
105-
106- std::string frame::name () const {
107- ::Dl_info dli;
108- const bool dl_ok = !!::dladdr (addr_, &dli);
109- if (dl_ok && dli.dli_sname ) {
110- return boost::stacktrace::detail::try_demangle (dli.dli_sname );
111- }
112-
113- return boost::stacktrace::detail::name_impl (addr_);
114- }
115-
116- std::string to_string (const frame& f) {
117- boost::stacktrace::detail::to_string_impl impl;
118- return impl (f.address ());
119- }
120-
121-
122103std::size_t this_thread_frames::collect (void ** memory, std::size_t size) BOOST_NOEXCEPT {
123104 std::size_t frames_count = 0 ;
124105 if (!size) {
@@ -137,34 +118,48 @@ std::size_t this_thread_frames::collect(void** memory, std::size_t size) BOOST_N
137118}
138119
139120
140- std::size_t this_thread_frames::dump (int fd) BOOST_NOEXCEPT {
141- BOOST_CONSTEXPR_OR_CONST std::size_t buf_size = boost::stacktrace::detail::max_frames_dump;
142- BOOST_CONSTEXPR_OR_CONST std::size_t frames_to_skip = 1 ;
143- void * buf[buf_size];
144- const std::size_t size = boost::stacktrace::this_thread_frames::collect (buf, buf_size);
145-
146- // We do not retry, becase this function must be typically called from signal handler so it's:
121+ std::size_t dump (int fd, void ** memory, std::size_t size) BOOST_NOEXCEPT {
122+ // We do not retry, because this function must be typically called from signal handler so it's:
147123 // * to scary to continue in case of EINTR
148124 // * EAGAIN or EWOULDBLOCK may occur only in case of O_NONBLOCK is set for fd,
149125 // so it seems that user does not want to block
150- if (::write (fd, buf + frames_to_skip , sizeof (void *) * ( size - frames_to_skip) ) == -1 ) {
126+ if (::write (fd, memory , sizeof (void *) * size) == -1 ) {
151127 return 0 ;
152128 }
153129
154130 return size;
155131}
156132
157- std::size_t this_thread_frames:: dump (const char * file) BOOST_NOEXCEPT {
133+ std::size_t dump (const char * file, void ** memory, std:: size_t mem_size ) BOOST_NOEXCEPT {
158134 const int fd = ::open (file, O_CREAT | O_WRONLY | O_TRUNC, S_IFREG | S_IWUSR | S_IRUSR);
159135 if (fd == -1 ) {
160136 return 0 ;
161137 }
162138
163- const std::size_t size = boost::stacktrace::this_thread_frames ::dump (fd);
139+ const std::size_t size = boost::stacktrace::detail ::dump (fd, memory, mem_size );
164140 ::close (fd);
165141 return size;
166142}
167143
144+ } // namespace detail
145+
146+
147+ std::string frame::name () const {
148+ ::Dl_info dli;
149+ const bool dl_ok = !!::dladdr (addr_, &dli);
150+ if (dl_ok && dli.dli_sname ) {
151+ return boost::stacktrace::detail::try_demangle (dli.dli_sname );
152+ }
153+
154+ return boost::stacktrace::detail::name_impl (addr_);
155+ }
156+
157+ std::string to_string (const frame& f) {
158+ boost::stacktrace::detail::to_string_impl impl;
159+ return impl (f.address ());
160+ }
161+
162+
168163}} // namespace boost::stacktrace
169164
170165#endif // BOOST_STACKTRACE_DETAIL_FRAME_UNWIND_IPP
0 commit comments