aboutsummaryrefslogtreecommitdiff
path: root/tests/functional/repl_characterization
diff options
context:
space:
mode:
authorThéophane Hufschmitt <7226587+thufschmitt@users.noreply.github.com>2024-03-05 06:58:29 +0100
committereldritch horrors <pennae@lix.systems>2024-03-31 17:28:25 +0000
commit6c29016a0972f20cb0c91a4d9c8020f09baf6293 (patch)
tree5acbafb203e465d030d6d41bf447ce9d552eb360 /tests/functional/repl_characterization
parent45623f077fdd53eb227bfee94f061835e86742ff (diff)
Merge pull request #9920 from 9999years/forbid-nested-debuggers
Forbid nested debuggers (cherry picked from commit e164b39ee90fd655dbb7f479fdd4fbe38cc883bd) Change-Id: Iff62f40fd251116516a63e2d3f9fb5b21480b16d
Diffstat (limited to 'tests/functional/repl_characterization')
-rw-r--r--tests/functional/repl_characterization/data/no_nested_debuggers.nix1
-rw-r--r--tests/functional/repl_characterization/data/no_nested_debuggers.test39
-rw-r--r--tests/functional/repl_characterization/repl_characterization.cc1
3 files changed, 41 insertions, 0 deletions
diff --git a/tests/functional/repl_characterization/data/no_nested_debuggers.nix b/tests/functional/repl_characterization/data/no_nested_debuggers.nix
new file mode 100644
index 000000000..bf3ad7f0a
--- /dev/null
+++ b/tests/functional/repl_characterization/data/no_nested_debuggers.nix
@@ -0,0 +1 @@
+builtins.break {}
diff --git a/tests/functional/repl_characterization/data/no_nested_debuggers.test b/tests/functional/repl_characterization/data/no_nested_debuggers.test
new file mode 100644
index 000000000..5e834a68a
--- /dev/null
+++ b/tests/functional/repl_characterization/data/no_nested_debuggers.test
@@ -0,0 +1,39 @@
+we enter a debugger via builtins.break in the input file.
+
+ info: breakpoint reached
+
+causing another debugger even should not nest, but simply
+print the error, skip the breakpoint, etc as appropriate.
+
+ nix-repl> "values show"
+ "values show"
+
+ nix-repl> builtins.break 2
+ 2
+
+ nix-repl> builtins.throw "foo"
+ error:
+ … while calling the 'throw' builtin
+ at «string»:1:1:
+ 1| builtins.throw "foo"
+ | ^
+
+ error: foo
+
+ nix-repl> assert false; 2
+ error: assertion 'false' failed
+ at «string»:1:1:
+ 1| assert false; 2
+ | ^
+
+exiting the debug frame should allow another to open.
+
+ nix-repl> :c
+
+ nix-repl> builtins.throw "bar"
+ error: bar
+
+and once again, more breakpoints are ignored.
+
+ nix-repl> builtins.break 3
+ 3
diff --git a/tests/functional/repl_characterization/repl_characterization.cc b/tests/functional/repl_characterization/repl_characterization.cc
index d0c3b0a71..d46f09553 100644
--- a/tests/functional/repl_characterization/repl_characterization.cc
+++ b/tests/functional/repl_characterization/repl_characterization.cc
@@ -126,5 +126,6 @@ DEBUGGER_TEST(regression_9918);
DEBUGGER_TEST(regression_9917);
DEBUGGER_TEST(regression_l145);
DEBUGGER_TEST(stack_vars);
+DEBUGGER_TEST(no_nested_debuggers);
};