Merge "Fix crash in debugger mode using with" into main

This commit is contained in:
jade
2025-02-04 16:36:50 +00:00
committed by Gerrit Code Review
4 changed files with 25 additions and 2 deletions
+2 -2
View File
@@ -629,7 +629,7 @@ void printStaticEnvBindings(const SymbolTable & st, const StaticEnv & se)
// just for the current level of Env, not the whole chain.
void printWithBindings(const SymbolTable & st, const Env & env)
{
if (!env.values[0]->isThunk()) {
if (env.values[0]->type() == nAttrs) {
std::set<std::string_view> bindings;
for (const auto & attr : *env.values[0]->attrs)
bindings.emplace(st[attr.name]);
@@ -686,7 +686,7 @@ void mapStaticEnvBindings(const SymbolTable & st, const StaticEnv & se, const En
if (env.up && se.up) {
mapStaticEnvBindings(st, *se.up, *env.up, vm);
if (se.isWith && !env.values[0]->isThunk()) {
if (se.isWith && env.values[0]->type() == nAttrs) {
// add 'with' bindings.
Bindings::iterator j = env.values[0]->attrs->begin();
while (j != env.values[0]->attrs->end()) {
@@ -0,0 +1 @@
let x = 4; in __seq x (with x; (x: builtins.break x) 1)
@@ -0,0 +1,21 @@
@args --debugger
breakpoint reached
nix-repl> :quit
error:
… while evaluating the file '$TEST_DATA/regression_l592.nix':
… while calling the 'seq' builtin
at $TEST_DATA/regression_l592.nix:1:15:
1| let x = 4; in __seq x (with x; (x: builtins.break x) 1)
| ^
2|
… while calling the 'break' builtin
at $TEST_DATA/regression_l592.nix:1:36:
1| let x = 4; in __seq x (with x; (x: builtins.break x) 1)
| ^
2|
error: breakpoint reached
@@ -177,6 +177,7 @@ REPL_TEST(no_nested_debuggers);
REPL_TEST(regression_9917);
REPL_TEST(regression_9918);
REPL_TEST(regression_l145);
REPL_TEST(regression_l592);
REPL_TEST(repl_overlays);
REPL_TEST(repl_overlays_compose);
REPL_TEST(repl_overlays_destructure_without_dotdotdot_errors);