aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/eval.cc
diff options
context:
space:
mode:
authoreldritch horrors <pennae@lix.systems>2024-03-08 09:47:09 +0100
committereldritch horrors <pennae@lix.systems>2024-03-09 10:17:26 -0700
commita9b813cc3bcf89f03de0db96fc2e88d1c83b8303 (patch)
treeb64221dbd3b3461c57e90289cd0539bf96c860dd /src/libexpr/eval.cc
parentf2e11ddce1ef76d9f653e0c32659d46ff7d6cafa (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/libexpr/eval.cc')
-rw-r--r--src/libexpr/eval.cc15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc
index e15781404..bb3e6f3bd 100644
--- a/src/libexpr/eval.cc
+++ b/src/libexpr/eval.cc
@@ -812,14 +812,16 @@ void EvalState::runDebugRepl(const Error * error, const Env & env, const Expr &
}
}
-void EvalState::addErrorTrace(Error & e, const char * s, const std::string & s2) const
+template<typename... Args>
+void EvalState::addErrorTrace(Error & e, const Args & ... formatArgs) const
{
- e.addTrace(nullptr, s, s2);
+ e.addTrace(nullptr, HintFmt(formatArgs...));
}
-void EvalState::addErrorTrace(Error & e, const PosIdx pos, const char * s, const std::string & s2, bool frame) const
+template<typename... Args>
+void EvalState::addErrorTrace(Error & e, const PosIdx pos, const Args & ... formatArgs) const
{
- e.addTrace(positions[pos], HintFmt(s, s2), frame);
+ e.addTrace(positions[pos], HintFmt(formatArgs...));
}
template<typename... Args>
@@ -1606,9 +1608,8 @@ void EvalState::callFunction(Value & fun, size_t nrArgs, Value * * args, Value &
"while calling %s",
lambda.name
? concatStrings("'", symbols[lambda.name], "'")
- : "anonymous lambda",
- true);
- if (pos) addErrorTrace(e, pos, "from call site%s", "", true);
+ : "anonymous lambda");
+ if (pos) addErrorTrace(e, pos, "from call site");
}
throw;
}