From 95ecb7e4d440605165a74de607de5389508779be Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 31 Oct 2022 09:52:13 -0500 Subject: [PATCH] Add a CLI option for the maximum stack size (#5156) This should allow either increasing or decreasing it for debugging and otherwise prodding at stack overflow behavior from the CLI. --- crates/cli-flags/src/lib.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/crates/cli-flags/src/lib.rs b/crates/cli-flags/src/lib.rs index 058522bbb9..e4066edb9d 100644 --- a/crates/cli-flags/src/lib.rs +++ b/crates/cli-flags/src/lib.rs @@ -229,6 +229,11 @@ pub struct CommonOptions { #[cfg(feature = "pooling-allocator")] #[clap(long)] pub pooling_allocator: bool, + + /// Maximum stack size, in bytes, that wasm is allowed to consumed before a + /// stack overflow is reported. + #[clap(long)] + pub max_wasm_stack: Option, } impl CommonOptions { @@ -335,6 +340,10 @@ impl CommonOptions { } } + if let Some(max) = self.max_wasm_stack { + config.max_wasm_stack(max); + } + Ok(config) }