diff options
author | eldritch horrors <pennae@lix.systems> | 2024-03-08 09:30:33 +0100 |
---|---|---|
committer | eldritch horrors <pennae@lix.systems> | 2024-03-09 10:17:26 -0700 |
commit | f2e11ddce1ef76d9f653e0c32659d46ff7d6cafa (patch) | |
tree | c766fd8bfdb45624aff3c9ee316d72e0fc076a9e /src/libexpr/primops.cc | |
parent | 030c8aa833e019df6caa5c686dc989442c3d7638 (diff) |
Merge pull request #9914 from 9999years/debugger-on-trace
Enter debugger on `builtins.trace` with an option
(cherry picked from commit 774e7ca5847ebc392eac2a124a8f12b24da4f65a)
Change-Id: If01e2110b3a128e639b05143227e365227d149f1
Diffstat (limited to 'src/libexpr/primops.cc')
-rw-r--r-- | src/libexpr/primops.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index 30933e191..b5b28efcd 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -980,6 +980,10 @@ static void prim_trace(EvalState & state, const PosIdx pos, Value * * args, Valu printError("trace: %1%", args[0]->string.s); else printError("trace: %1%", ValuePrinter(state, *args[0])); + if (evalSettings.builtinsTraceDebugger && state.debugRepl && !state.debugTraces.empty()) { + const DebugTrace & last = state.debugTraces.front(); + state.runDebugRepl(nullptr, last.env, last.expr); + } state.forceValue(*args[1], pos); v = *args[1]; } @@ -991,6 +995,12 @@ static RegisterPrimOp primop_trace({ Evaluate *e1* and print its abstract syntax representation on standard error. Then return *e2*. This function is useful for debugging. + + If the + [`debugger-on-trace`](@docroot@/command-ref/conf-file.md#conf-debugger-on-trace) + option is set to `true` and the `--debugger` flag is given, the + interactive debugger will be started when `trace` is called (like + [`break`](@docroot@/language/builtins.md#builtins-break)). )", .fun = prim_trace, }); |