diff options
author | eldritch horrors <pennae@lix.systems> | 2024-03-08 09:47:09 +0100 |
---|---|---|
committer | eldritch horrors <pennae@lix.systems> | 2024-03-09 10:17:26 -0700 |
commit | a9b813cc3bcf89f03de0db96fc2e88d1c83b8303 (patch) | |
tree | b64221dbd3b3461c57e90289cd0539bf96c860dd /src/libutil/error.cc | |
parent | f2e11ddce1ef76d9f653e0c32659d46ff7d6cafa (diff) |
Merge pull request #10066 from 9999years/print-all-frames
Do not skip any stack frames when `--show-trace` is given
(cherry picked from commit 0b47783d0a879875d558f0b56e49584f25ceb2d0)
Change-Id: Ia0f18266dbcf97543110110c655c219c7a3e3270
Diffstat (limited to 'src/libutil/error.cc')
-rw-r--r-- | src/libutil/error.cc | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/libutil/error.cc b/src/libutil/error.cc index 49a18fa1c..d30da58c0 100644 --- a/src/libutil/error.cc +++ b/src/libutil/error.cc @@ -10,9 +10,9 @@ namespace nix { const std::string nativeSystem = SYSTEM; -void BaseError::addTrace(std::shared_ptr<Pos> && e, HintFmt hint, bool frame) +void BaseError::addTrace(std::shared_ptr<Pos> && e, HintFmt hint) { - err.traces.push_front(Trace { .pos = std::move(e), .hint = hint, .frame = frame }); + err.traces.push_front(Trace { .pos = std::move(e), .hint = hint }); } void throwExceptionSelfCheck(){ @@ -60,8 +60,7 @@ inline bool operator<(const Trace& lhs, const Trace& rhs) // This formats a freshly formatted hint string and then throws it away, which // shouldn't be much of a problem because it only runs when pos is equal, and this function is // used for trace printing, which is infrequent. - return std::forward_as_tuple(lhs.hint.str(), lhs.frame) - < std::forward_as_tuple(rhs.hint.str(), rhs.frame); + return lhs.hint.str() < rhs.hint.str(); } inline bool operator> (const Trace& lhs, const Trace& rhs) { return rhs < lhs; } inline bool operator<=(const Trace& lhs, const Trace& rhs) { return !(lhs > rhs); } @@ -372,7 +371,6 @@ std::ostream & showErrorInfo(std::ostream & out, const ErrorInfo & einfo, bool s // prepended to each element of the trace auto ellipsisIndent = " "; - bool frameOnly = false; if (!einfo.traces.empty()) { // Stack traces seen since we last printed a chunk of `duplicate frames // omitted`. @@ -383,7 +381,6 @@ std::ostream & showErrorInfo(std::ostream & out, const ErrorInfo & einfo, bool s for (const auto & trace : einfo.traces) { if (trace.hint.str().empty()) continue; - if (frameOnly && !trace.frame) continue; if (!showTrace && count > 3) { oss << "\n" << ANSI_WARNING "(stack trace truncated; use '--show-trace' to show the full trace)" ANSI_NORMAL << "\n"; @@ -399,7 +396,6 @@ std::ostream & showErrorInfo(std::ostream & out, const ErrorInfo & einfo, bool s printSkippedTracesMaybe(oss, ellipsisIndent, count, skippedTraces, tracesSeen); count++; - frameOnly = trace.frame; printTrace(oss, ellipsisIndent, count, trace); } |