mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 17:41:59 +00:00
Merge
This commit is contained in:
commit
77f2e60146
@ -52,7 +52,7 @@ private:
|
||||
char * c_end;
|
||||
char * c_end_of_storage;
|
||||
|
||||
bool use_libc_realloc;
|
||||
bool use_libc_realloc = false;
|
||||
|
||||
T * t_start() { return reinterpret_cast<T *>(c_start); }
|
||||
T * t_end() { return reinterpret_cast<T *>(c_end); }
|
||||
@ -175,10 +175,10 @@ public:
|
||||
};
|
||||
|
||||
|
||||
PODArray() : use_libc_realloc(false) { alloc(0); }
|
||||
PODArray(size_t n) : use_libc_realloc(false) { alloc(n); c_end += byte_size(n); }
|
||||
PODArray(size_t n, const T & x) : use_libc_realloc(false) { alloc(n); assign(n, x); }
|
||||
PODArray(const_iterator from_begin, const_iterator from_end) : use_libc_realloc(false) { alloc(from_end - from_begin); insert(from_begin, from_end); }
|
||||
PODArray() { alloc(0); }
|
||||
PODArray(size_t n) { alloc(n); c_end += byte_size(n); }
|
||||
PODArray(size_t n, const T & x) { alloc(n); assign(n, x); }
|
||||
PODArray(const_iterator from_begin, const_iterator from_end) { alloc(from_end - from_begin); insert(from_begin, from_end); }
|
||||
~PODArray() { dealloc(); }
|
||||
|
||||
PODArray(PODArray && other) { *this = std::move(other); }
|
||||
|
@ -43,6 +43,14 @@ ExceptionPtr cloneCurrentException()
|
||||
}
|
||||
}
|
||||
|
||||
inline std::string demangle(const char * const mangled, int & status)
|
||||
{
|
||||
const auto demangled_str = abi::__cxa_demangle(mangled, 0, 0, &status);
|
||||
std::string demangled{demangled_str};
|
||||
free(demangled_str);
|
||||
|
||||
return demangled;
|
||||
}
|
||||
|
||||
void tryLogCurrentException(const char * log_name)
|
||||
{
|
||||
@ -72,10 +80,8 @@ void tryLogCurrentException(const char * log_name)
|
||||
{
|
||||
try
|
||||
{
|
||||
int status;
|
||||
char * realname = abi::__cxa_demangle(typeid(e).name(), 0, 0, &status);
|
||||
std::string name = realname;
|
||||
free(realname);
|
||||
int status = 0;
|
||||
auto name = demangle(typeid(e).name(), status);
|
||||
|
||||
if (status)
|
||||
name += " (demangling status: " + toString(status) + ")";
|
||||
@ -88,7 +94,13 @@ void tryLogCurrentException(const char * log_name)
|
||||
{
|
||||
try
|
||||
{
|
||||
LOG_ERROR(&Logger::get(log_name), "Unknown exception. Code: " << ErrorCodes::UNKNOWN_EXCEPTION);
|
||||
int status = 0;
|
||||
auto name = demangle(abi::__cxa_current_exception_type()->name(), status);
|
||||
|
||||
if (status)
|
||||
name += " (demangling status: " + toString(status) + ")";
|
||||
|
||||
LOG_ERROR(&Logger::get(log_name), "Unknown exception. Code: " << ErrorCodes::UNKNOWN_EXCEPTION << ", type: " << name);
|
||||
}
|
||||
catch (...) {}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user