Add option to get depth of stack trace.
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2020-08-15 13:48:34 +02:00
parent f29e111b78
commit 5ac7654be1
2 changed files with 4 additions and 9 deletions

View File

@@ -18,11 +18,11 @@ namespace ArbUt {
[[nodiscard]] const char* what() const _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_NOTHROW override { return _msg.c_str(); }
[[nodiscard]] std::string GetStacktrace() const {
[[nodiscard]] std::string GetStacktrace(size_t depth = 6) const {
backward::TraceResolver tr;
tr.load_stacktrace(_stack);
std::stringstream ss;
for (size_t i = 3; i < _stack.size(); ++i) {
for (size_t i = 3; i < _stack.size() && i < depth + 3; ++i) {
backward::ResolvedTrace trace = tr.resolve(_stack[i]);
if (trace.source.filename.empty()){