Dropped dependency to the aligned_storage, fixed issue in linux backend with incorrect detection of end pointer and fix getting coverage in travis script

This commit is contained in:
Antony Polukhin
2016-12-03 21:24:55 +03:00
parent 4ce841ef65
commit 6e01617dad
6 changed files with 20 additions and 18 deletions

View File

@@ -76,7 +76,7 @@ class backend {
}
public:
BOOST_STACKTRACE_FUNCTION backend(void* memory, std::size_t size) BOOST_NOEXCEPT;
BOOST_STACKTRACE_FUNCTION backend(void** memory, std::size_t size) BOOST_NOEXCEPT;
BOOST_STACKTRACE_FUNCTION static std::string get_name(const void* addr);
const void* get_address(std::size_t frame_no) const BOOST_NOEXCEPT {
return frame_no < frames_count_ ? data_[frame_no] : 0;
@@ -86,10 +86,10 @@ public:
BOOST_STACKTRACE_FUNCTION bool operator< (const backend& rhs) const BOOST_NOEXCEPT;
BOOST_STACKTRACE_FUNCTION bool operator==(const backend& rhs) const BOOST_NOEXCEPT;
backend(const backend& b, void* memory) BOOST_NOEXCEPT
backend(const backend& b, void** memory) BOOST_NOEXCEPT
: hash_code_(b.hash_code_)
, frames_count_(b.frames_count_)
, data_(static_cast<void**>(memory))
, data_(memory)
{
copy_frames_from(b);
}

View File

@@ -174,17 +174,20 @@ inline _Unwind_Reason_Code unwind_callback(struct _Unwind_Context* context, void
backend::backend(void* memory, std::size_t size) BOOST_NOEXCEPT
backend::backend(void** memory, std::size_t size) BOOST_NOEXCEPT
: hash_code_(0)
, frames_count_(0)
, data_(static_cast<void**>(memory))
, data_(memory)
{
if (!size) {
return;
}
#if defined(BOOST_STACKTRACE_USE_UNWIND)
unwind_state state = { data_, data_ + frames_count_ };
unwind_state state = { data_, data_ + size };
_Unwind_Backtrace(&unwind_callback, &state);
frames_count_ = state.current - data_;
#elif defined(BOOST_STACKTRACE_USE_BACKTRACE)
frames_count_ = ::backtrace(data_, size / sizeof(void*));
frames_count_ = ::backtrace(data_, size);
if (data_[frames_count_ - 1] == 0) {
-- frames_count_;
}

View File

@@ -15,7 +15,7 @@
namespace boost { namespace stacktrace { namespace detail {
backend::backend(void* /*memory*/, std::size_t /*size*/) BOOST_NOEXCEPT
backend::backend(void** /*memory*/, std::size_t /*size*/) BOOST_NOEXCEPT
: hash_code_(0)
, frames_count_(0)
, data_(0)

View File

@@ -96,15 +96,15 @@ inline bool try_init_com(com_holder<IDebugSymbols>& idebug_) BOOST_NOEXCEPT {
backend::backend(void* memory, std::size_t size) BOOST_NOEXCEPT
backend::backend(void** memory, std::size_t size) BOOST_NOEXCEPT
: hash_code_(0)
, frames_count_(0)
, data_(static_cast<void**>(memory))
, data_(memory)
{
boost::detail::winapi::ULONG_ hc = 0;
frames_count_ = CaptureStackBackTrace(
0,
static_cast<boost::detail::winapi::ULONG_>(size / sizeof(void*)),
static_cast<boost::detail::winapi::ULONG_>(size),
data_,
&hc
);

View File

@@ -12,7 +12,6 @@
# pragma once
#endif
#include <boost/aligned_storage.hpp>
#include <boost/core/explicit_operator_bool.hpp>
#include <iosfwd>
@@ -27,8 +26,8 @@ namespace boost { namespace stacktrace {
/// Class that on construction copies minimal information about call stack into its internals and provides access to that information.
class stacktrace {
/// @cond
BOOST_STATIC_CONSTEXPR std::size_t max_implementation_size = sizeof(void*) * 110u;
boost::aligned_storage<max_implementation_size>::type impl_;
BOOST_STATIC_CONSTEXPR std::size_t max_implementation_size = sizeof(void*) * 100u;
void* impl_[max_implementation_size];
boost::stacktrace::detail::backend back_;
/// @endcond
@@ -47,7 +46,7 @@ public:
/// @b Async-Handler-Safety: Depends on backend, see "Build, Macros and Backends" section.
BOOST_FORCEINLINE stacktrace() BOOST_NOEXCEPT
: impl_()
, back_(&impl_, sizeof(impl_))
, back_(impl_, max_implementation_size)
{}
/// @b Complexity: O(st.size())
@@ -55,7 +54,7 @@ public:
/// @b Async-Handler-Safety: Safe.
stacktrace(const stacktrace& st) BOOST_NOEXCEPT
: impl_()
, back_(st.back_, &impl_)
, back_(st.back_, impl_)
{}
/// @b Complexity: O(st.size())