tvl-depot/tvix/eval/Cargo.toml
Adam Joseph 56c00df710 feat(tvix/eval): use backtrace-on-stack-overflow crate
The backtrace-on-stack-overflow create provides best-effort stack
traces when a stack overflow happens.  Since it's running on the
(usually tiny) signal alternate stack this isn't easy.

This is guarded by a new `backtrace_overflow` feature flag and never
enabled (even if that feature is selected) for release builds.  This
is strictly for debugging; there's crazy unsafe voodoo in there.

   https://lib.rs/crates/backtrace-on-stack-overflow

Example output:

```
Stack Overflow:
   0: backtrace_on_stack_overflow::handle_sigsegv
             at /home/amjoseph/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-on-stack-overflow-0.2.0/src/lib.rs:93:40
   1: <unknown>
   2: __rust_probestack
   3: tvix_eval::vm::VM::run_op
             at src/vm.rs:399
   4: tvix_eval::vm::VM::run
             at src/vm.rs:388:23
   5: tvix_eval::vm::VM::enter_frame
             at src/vm.rs:360:22
   6: tvix_eval::value::thunk::Thunk::force
             at src/value/thunk.rs:116:25
   7: tvix_eval::vm::VM::run_op
             at src/vm.rs:801:37
   8: tvix_eval::vm::VM::run
             at src/vm.rs:388:23
   9: tvix_eval::vm::VM::enter_frame
             at src/vm.rs:360:22
  10: tvix_eval::value::thunk::Thunk::force
             at src/value/thunk.rs:116:25
...
```

Signed-off-by: Adam Joseph <adam@westernsemico.com>
Change-Id: I1d8a2017f836be7bf91a2223e7adacb86fa1dbb2
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7354
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
2022-11-26 19:41:43 +00:00

71 lines
2 KiB
TOML

[package]
name = "tvix-eval"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[lib]
name = "tvix_eval"
[[bin]]
name = "tvix-eval"
required-features = [ "repl" ]
[dependencies]
smol_str = "0.1"
rustyline = { version = "10.0.0", optional = true }
dirs = "4.0.0"
path-clean = "0.1"
tabwriter = "1.2"
rowan = "*" # pinned by rnix
codemap = "0.1.3"
codemap-diagnostic = "0.1.1"
proptest = { version = "1.0.0", default_features = false, features = ["std", "alloc", "break-dead-code", "tempfile"], optional = true }
test-strategy = { version = "0.2.1", optional = true }
clap = { version = "3.2.22", optional = true, features = ["derive", "env"] }
serde = "1.0"
serde_json = "1.0"
regex = "1.6.0"
builtin-macros = { path = "./builtin-macros", package = "tvix-eval-builtin-macros" }
backtrace-on-stack-overflow = { version = "0.2.0", optional = true }
# rnix has not been released in a while (as of 2022-09-23), we will
# use it from git.
[dependencies.rnix]
git = "https://github.com/nix-community/rnix-parser.git"
rev = "85a045afd33e073a3eab4c0ea2f515b6bed557ab"
[dev-dependencies]
criterion = "0.3.6"
test-generator = "0.3.0"
pretty_assertions = "1.2.1"
itertools = "0.10.3"
tempdir = "0.3.7"
[features]
default = [ "repl", "impure", "arbitrary", "nix_tests", "backtrace_overflow" ]
# Enables running the Nix language test suite from the original C++
# Nix implementation (at version 2.3) against Tvix.
nix_tests = []
# Enables building the binary (tvix-eval REPL)
repl = [ "rustyline", "clap" ]
# Enables operations in the VM which depend on the ability to perform I/O
impure = []
# Enables Arbitrary impls for internal types (required to run tests)
arbitrary = [ "proptest", "test-strategy" ]
# For debugging use only; not appropriate for production use.
backtrace_overflow = [ "backtrace-on-stack-overflow" ]
[[bench]]
name = "eval"
harness = false
[profile.release-with-debug]
inherits = "release"
debug = true