mirror of
https://github.com/NixOS/nix.git
synced 2024-11-25 00:02:25 +00:00
fix debugger crashing while printing envs
fixes #9932
(cherry picked from commit 5ccb06ee1b
)
This commit is contained in:
parent
fea2043060
commit
631b2de30f
1
.gitignore
vendored
1
.gitignore
vendored
@ -94,6 +94,7 @@ perl/Makefile.config
|
|||||||
/tests/functional/ca/config.nix
|
/tests/functional/ca/config.nix
|
||||||
/tests/functional/dyn-drv/config.nix
|
/tests/functional/dyn-drv/config.nix
|
||||||
/tests/functional/repl-result-out
|
/tests/functional/repl-result-out
|
||||||
|
/tests/functional/debugger-test-out
|
||||||
/tests/functional/test-libstoreconsumer/test-libstoreconsumer
|
/tests/functional/test-libstoreconsumer/test-libstoreconsumer
|
||||||
|
|
||||||
# /tests/functional/lang/
|
# /tests/functional/lang/
|
||||||
|
@ -744,7 +744,8 @@ void printEnvBindings(const SymbolTable & st, const StaticEnv & se, const Env &
|
|||||||
if (se.up && env.up) {
|
if (se.up && env.up) {
|
||||||
std::cout << "static: ";
|
std::cout << "static: ";
|
||||||
printStaticEnvBindings(st, se);
|
printStaticEnvBindings(st, se);
|
||||||
printWithBindings(st, env);
|
if (se.isWith)
|
||||||
|
printWithBindings(st, env);
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
printEnvBindings(st, *se.up, *env.up, ++lvl);
|
printEnvBindings(st, *se.up, *env.up, ++lvl);
|
||||||
} else {
|
} else {
|
||||||
@ -756,7 +757,8 @@ void printEnvBindings(const SymbolTable & st, const StaticEnv & se, const Env &
|
|||||||
std::cout << st[i.first] << " ";
|
std::cout << st[i.first] << " ";
|
||||||
std::cout << ANSI_NORMAL;
|
std::cout << ANSI_NORMAL;
|
||||||
std::cout << std::endl;
|
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;
|
std::cout << std::endl;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -778,7 +780,7 @@ void mapStaticEnvBindings(const SymbolTable & st, const StaticEnv & se, const En
|
|||||||
if (env.up && se.up) {
|
if (env.up && se.up) {
|
||||||
mapStaticEnvBindings(st, *se.up, *env.up, vm);
|
mapStaticEnvBindings(st, *se.up, *env.up, vm);
|
||||||
|
|
||||||
if (!env.values[0]->isThunk()) {
|
if (se.isWith && !env.values[0]->isThunk()) {
|
||||||
// add 'with' bindings.
|
// add 'with' bindings.
|
||||||
Bindings::iterator j = env.values[0]->attrs->begin();
|
Bindings::iterator j = env.values[0]->attrs->begin();
|
||||||
while (j != env.values[0]->attrs->end()) {
|
while (j != env.values[0]->attrs->end()) {
|
||||||
|
13
tests/functional/debugger.sh
Normal file
13
tests/functional/debugger.sh
Normal file
@ -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
|
@ -127,7 +127,8 @@ nix_tests = \
|
|||||||
toString-path.sh \
|
toString-path.sh \
|
||||||
read-only-store.sh \
|
read-only-store.sh \
|
||||||
nested-sandboxing.sh \
|
nested-sandboxing.sh \
|
||||||
impure-env.sh
|
impure-env.sh \
|
||||||
|
debugger.sh
|
||||||
|
|
||||||
ifeq ($(HAVE_LIBCPUID), 1)
|
ifeq ($(HAVE_LIBCPUID), 1)
|
||||||
nix_tests += compute-levels.sh
|
nix_tests += compute-levels.sh
|
||||||
|
Loading…
Reference in New Issue
Block a user