Update trace objects to just be aggregates
This commit is contained in:
parent
5079aef62f
commit
c3a27d15fb
@ -140,8 +140,6 @@ namespace cpptrace {
|
||||
|
||||
struct stacktrace {
|
||||
std::vector<stacktrace_frame> frames;
|
||||
explicit stacktrace();
|
||||
explicit stacktrace(std::vector<stacktrace_frame>&& frames);
|
||||
static stacktrace current(std::uint_least32_t skip = 0); // here as a drop-in for std::stacktrace
|
||||
static stacktrace current(std::uint_least32_t skip, std::uint_least32_t max_depth);
|
||||
void print() const;
|
||||
@ -175,7 +173,6 @@ namespace cpptrace {
|
||||
|
||||
struct object_trace {
|
||||
std::vector<object_frame> frames;
|
||||
explicit object_trace(std::vector<object_frame>&& frames);
|
||||
static object_trace current(std::uint_least32_t skip = 0);
|
||||
static object_trace current(std::uint_least32_t skip, std::uint_least32_t max_depth);
|
||||
stacktrace resolve() const;
|
||||
@ -200,7 +197,6 @@ Note it is important executables and shared libraries in memory aren't somehow u
|
||||
namespace cpptrace {
|
||||
struct raw_trace {
|
||||
std::vector<uintptr_t> frames;
|
||||
explicit raw_trace(std::vector<uintptr_t>&& frames);
|
||||
static raw_trace current(std::uint_least32_t skip = 0);
|
||||
static raw_trace current(std::uint_least32_t skip, std::uint_least32_t max_depth);
|
||||
object_trace resolve_object_trace() const;
|
||||
|
||||
@ -29,7 +29,6 @@ namespace cpptrace {
|
||||
|
||||
struct raw_trace {
|
||||
std::vector<uintptr_t> frames;
|
||||
explicit raw_trace(std::vector<uintptr_t>&& frames_) : frames(frames_) {}
|
||||
CPPTRACE_API static raw_trace current(std::uint_least32_t skip = 0);
|
||||
CPPTRACE_API static raw_trace current(std::uint_least32_t skip, std::uint_least32_t max_depth);
|
||||
CPPTRACE_API object_trace resolve_object_trace() const;
|
||||
@ -56,7 +55,6 @@ namespace cpptrace {
|
||||
|
||||
struct object_trace {
|
||||
std::vector<object_frame> frames;
|
||||
explicit object_trace(std::vector<object_frame>&& frames_) : frames(frames_) {}
|
||||
CPPTRACE_API static object_trace current(std::uint_least32_t skip = 0);
|
||||
CPPTRACE_API static object_trace current(std::uint_least32_t skip, std::uint_least32_t max_depth);
|
||||
CPPTRACE_API stacktrace resolve() const;
|
||||
@ -95,8 +93,6 @@ namespace cpptrace {
|
||||
|
||||
struct stacktrace {
|
||||
std::vector<stacktrace_frame> frames;
|
||||
explicit stacktrace() {}
|
||||
explicit stacktrace(std::vector<stacktrace_frame>&& frames_) : frames(frames_) {}
|
||||
CPPTRACE_API static stacktrace current(std::uint_least32_t skip = 0);
|
||||
CPPTRACE_API static stacktrace current(std::uint_least32_t skip, std::uint_least32_t max_depth);
|
||||
CPPTRACE_API void print() const;
|
||||
@ -166,7 +162,7 @@ namespace cpptrace {
|
||||
e.what()
|
||||
);
|
||||
}
|
||||
return raw_trace({});
|
||||
return raw_trace{};
|
||||
}
|
||||
} ()) {}
|
||||
explicit exception(std::uint_least32_t skip) noexcept : exception(skip + 1, UINT_LEAST32_MAX) {}
|
||||
|
||||
@ -39,12 +39,12 @@ namespace cpptrace {
|
||||
CPPTRACE_API
|
||||
object_trace raw_trace::resolve_object_trace() const {
|
||||
try {
|
||||
return object_trace(detail::get_frames_object_info(frames));
|
||||
return object_trace{detail::get_frames_object_info(frames)};
|
||||
} catch(...) { // NOSONAR
|
||||
if(!detail::should_absorb_trace_exceptions()) {
|
||||
throw;
|
||||
}
|
||||
return object_trace({});
|
||||
return object_trace{};
|
||||
}
|
||||
}
|
||||
|
||||
@ -55,12 +55,12 @@ namespace cpptrace {
|
||||
for(auto& frame : trace) {
|
||||
frame.symbol = detail::demangle(frame.symbol);
|
||||
}
|
||||
return stacktrace(std::move(trace));
|
||||
return stacktrace{std::move(trace)};
|
||||
} catch(...) { // NOSONAR
|
||||
if(!detail::should_absorb_trace_exceptions()) {
|
||||
throw;
|
||||
}
|
||||
return stacktrace();
|
||||
return stacktrace{};
|
||||
}
|
||||
}
|
||||
|
||||
@ -87,7 +87,7 @@ namespace cpptrace {
|
||||
CPPTRACE_API
|
||||
stacktrace object_trace::resolve() const {
|
||||
try {
|
||||
return stacktrace(detail::resolve_frames(frames));
|
||||
return stacktrace{detail::resolve_frames(frames)};
|
||||
} catch(...) { // NOSONAR
|
||||
if(!detail::should_absorb_trace_exceptions()) {
|
||||
throw;
|
||||
@ -240,48 +240,48 @@ namespace cpptrace {
|
||||
CPPTRACE_FORCE_NO_INLINE CPPTRACE_API
|
||||
raw_trace generate_raw_trace(std::uint_least32_t skip) {
|
||||
try {
|
||||
return raw_trace(detail::capture_frames(skip + 1, UINT_LEAST32_MAX));
|
||||
return raw_trace{detail::capture_frames(skip + 1, UINT_LEAST32_MAX)};
|
||||
} catch(...) { // NOSONAR
|
||||
if(!detail::should_absorb_trace_exceptions()) {
|
||||
throw;
|
||||
}
|
||||
return raw_trace({});
|
||||
return raw_trace{};
|
||||
}
|
||||
}
|
||||
|
||||
CPPTRACE_FORCE_NO_INLINE CPPTRACE_API
|
||||
raw_trace generate_raw_trace(std::uint_least32_t skip, std::uint_least32_t max_depth) {
|
||||
try {
|
||||
return raw_trace(detail::capture_frames(skip + 1, max_depth));
|
||||
return raw_trace{detail::capture_frames(skip + 1, max_depth)};
|
||||
} catch(...) { // NOSONAR
|
||||
if(!detail::should_absorb_trace_exceptions()) {
|
||||
throw;
|
||||
}
|
||||
return raw_trace({});
|
||||
return raw_trace{};
|
||||
}
|
||||
}
|
||||
|
||||
CPPTRACE_FORCE_NO_INLINE CPPTRACE_API
|
||||
object_trace generate_object_trace(std::uint_least32_t skip) {
|
||||
try {
|
||||
return object_trace(detail::get_frames_object_info(detail::capture_frames(skip + 1, UINT_LEAST32_MAX)));
|
||||
return object_trace{detail::get_frames_object_info(detail::capture_frames(skip + 1, UINT_LEAST32_MAX))};
|
||||
} catch(...) { // NOSONAR
|
||||
if(!detail::should_absorb_trace_exceptions()) {
|
||||
throw;
|
||||
}
|
||||
return object_trace({});
|
||||
return object_trace{};
|
||||
}
|
||||
}
|
||||
|
||||
CPPTRACE_FORCE_NO_INLINE CPPTRACE_API
|
||||
object_trace generate_object_trace(std::uint_least32_t skip, std::uint_least32_t max_depth) {
|
||||
try {
|
||||
return object_trace(detail::get_frames_object_info(detail::capture_frames(skip + 1, max_depth)));
|
||||
return object_trace{detail::get_frames_object_info(detail::capture_frames(skip + 1, max_depth))};
|
||||
} catch(...) { // NOSONAR
|
||||
if(!detail::should_absorb_trace_exceptions()) {
|
||||
throw;
|
||||
}
|
||||
return object_trace({});
|
||||
return object_trace{};
|
||||
}
|
||||
}
|
||||
|
||||
@ -298,7 +298,7 @@ namespace cpptrace {
|
||||
for(auto& frame : trace) {
|
||||
frame.symbol = detail::demangle(frame.symbol);
|
||||
}
|
||||
return stacktrace(std::move(trace));
|
||||
return stacktrace{std::move(trace)};
|
||||
} catch(...) { // NOSONAR
|
||||
if(!detail::should_absorb_trace_exceptions()) {
|
||||
throw;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user