Skip to content
This repository was archived by the owner on Nov 30, 2022. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 6 additions & 12 deletions include/exception
Original file line number Diff line number Diff line change
Expand Up @@ -105,29 +105,23 @@ class _LIBCPP_EXCEPTION_ABI exception
public:
_LIBCPP_INLINE_VISIBILITY exception() _NOEXCEPT
{
#ifdef STD_EXCEPTION_HAS_STACK_TRACE
#if defined(STD_EXCEPTION_HAS_STACK_TRACE)
capture();
#endif
}
_LIBCPP_INLINE_VISIBILITY exception(const exception&) _NOEXCEPT = default;

virtual ~exception() _NOEXCEPT;
virtual const char* what() const _NOEXCEPT;
#ifdef STD_EXCEPTION_HAS_STACK_TRACE
#if defined(STD_EXCEPTION_HAS_STACK_TRACE)
/// This is ClickHouse patch to libc++. It breaks ABI, so you cannot link your code with any C++ library
/// that has any std::exception-related symbols exported and was built without this patch.
void ** const get_stack_trace_frames() const _NOEXCEPT { return const_cast<void**>(frames); }
int get_stack_trace_size() const _NOEXCEPT { return size; }
void set_stack_trace(void ** frames_, int size_) _NOEXCEPT
{
size = size_;
for (int i = 0; i < size; ++i)
frames[i] = frames_[i];
}
void * const * get_stack_trace_frames() const _NOEXCEPT { return frames; }
size_t get_stack_trace_size() const _NOEXCEPT { return size; }
private:
static constexpr int capacity = 32;
static constexpr size_t capacity = 32;
void * frames[capacity];
int size = 0;
size_t size = 0;
void capture() _NOEXCEPT
{
size = unw_backtrace(frames, capacity);
Expand Down