aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--src/libexpr/eval.cc8
-rw-r--r--tests/functional/debugger.sh13
-rw-r--r--tests/functional/local.mk3
4 files changed, 21 insertions, 4 deletions
diff --git a/.gitignore b/.gitignore
index 07048f0e8..46ae8bc41 100644
--- a/.gitignore
+++ b/.gitignore
@@ -92,6 +92,7 @@ perl/Makefile.config
/tests/functional/ca/config.nix
/tests/functional/dyn-drv/config.nix
/tests/functional/repl-result-out
+/tests/functional/debugger-test-out
/tests/functional/test-libstoreconsumer/test-libstoreconsumer
# /tests/functional/lang/
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc
index a1782dcad..565688868 100644
--- a/src/libexpr/eval.cc
+++ b/src/libexpr/eval.cc
@@ -810,7 +810,8 @@ void printEnvBindings(const SymbolTable & st, const StaticEnv & se, const Env &
if (se.up && env.up) {
std::cout << "static: ";
printStaticEnvBindings(st, se);
- printWithBindings(st, env);
+ if (se.isWith)
+ printWithBindings(st, env);
std::cout << std::endl;
printEnvBindings(st, *se.up, *env.up, ++lvl);
} else {
@@ -822,7 +823,8 @@ void printEnvBindings(const SymbolTable & st, const StaticEnv & se, const Env &
std::cout << st[i.first] << " ";
std::cout << ANSI_NORMAL;
std::cout << std::endl;
- printWithBindings(st, env); // probably nothing there for the top level.
+ if (se.isWith)
+ printWithBindings(st, env); // probably nothing there for the top level.
std::cout << std::endl;
}
@@ -844,7 +846,7 @@ void mapStaticEnvBindings(const SymbolTable & st, const StaticEnv & se, const En
if (env.up && se.up) {
mapStaticEnvBindings(st, *se.up, *env.up, vm);
- if (!env.values[0]->isThunk()) {
+ if (se.isWith && !env.values[0]->isThunk()) {
// add 'with' bindings.
Bindings::iterator j = env.values[0]->attrs->begin();
while (j != env.values[0]->attrs->end()) {
diff --git a/tests/functional/debugger.sh b/tests/functional/debugger.sh
new file mode 100644
index 000000000..63d88cbf3
--- /dev/null
+++ b/tests/functional/debugger.sh
@@ -0,0 +1,13 @@
+source common.sh
+
+clearStore
+
+# regression #9932
+echo ":env" | expect 1 nix eval --debugger --expr '(_: throw "oh snap") 42'
+echo ":env" | expect 1 nix eval --debugger --expr '
+ let x.a = 1; in
+ with x;
+ (_: builtins.seq x.a (throw "oh snap")) x.a
+' >debugger-test-out
+grep -P 'with: .*a' debugger-test-out
+grep -P 'static: .*x' debugger-test-out
diff --git a/tests/functional/local.mk b/tests/functional/local.mk
index 24d772cc7..9f50a6dcc 100644
--- a/tests/functional/local.mk
+++ b/tests/functional/local.mk
@@ -122,7 +122,8 @@ nix_tests = \
path-from-hash-part.sh \
toString-path.sh \
read-only-store.sh \
- nested-sandboxing.sh
+ nested-sandboxing.sh \
+ debugger.sh
ifeq ($(HAVE_LIBCPUID), 1)
nix_tests += compute-levels.sh