feat: Enable plumbing through keep_names to wasm build for better stack traces (#5296)
Co-authored-by: Robert Deaton <me@rdeaton.space>
This commit is contained in:
1 parent
33159f366a
commit
df4fe37180
3 files changed
+23
-1
No files matched your search
@@ -393,6 +393,7 @@ pub(crate) struct BuildRequest {
|
|||||||
pub(crate) skip_assets: bool,
|
pub(crate) skip_assets: bool,
|
||||||
pub(crate) wasm_split: bool,
|
pub(crate) wasm_split: bool,
|
||||||
pub(crate) debug_symbols: bool,
|
pub(crate) debug_symbols: bool,
|
||||||
|
pub(crate) keep_names: bool,
|
||||||
pub(crate) inject_loading_scripts: bool,
|
pub(crate) inject_loading_scripts: bool,
|
||||||
pub(crate) custom_linker: Option<PathBuf>,
|
pub(crate) custom_linker: Option<PathBuf>,
|
||||||
pub(crate) base_path: Option<String>,
|
pub(crate) base_path: Option<String>,
|
||||||
@@ -1025,6 +1026,7 @@ impl BuildRequest {
|
|||||||
base_path: args.base_path.clone(),
|
base_path: args.base_path.clone(),
|
||||||
wasm_split: args.wasm_split,
|
wasm_split: args.wasm_split,
|
||||||
debug_symbols: args.debug_symbols,
|
debug_symbols: args.debug_symbols,
|
||||||
|
keep_names: args.keep_names,
|
||||||
inject_loading_scripts: args.inject_loading_scripts,
|
inject_loading_scripts: args.inject_loading_scripts,
|
||||||
apple_entitlements: args.apple_entitlements.clone(),
|
apple_entitlements: args.apple_entitlements.clone(),
|
||||||
apple_team_id: args.apple_team_id.clone(),
|
apple_team_id: args.apple_team_id.clone(),
|
||||||
@@ -4309,7 +4311,10 @@ impl BuildRequest {
|
|||||||
|| self.wasm_split
|
|| self.wasm_split
|
||||||
|| !self.release
|
|| !self.release
|
||||||
|| ctx.mode == BuildMode::Fat;
|
|| ctx.mode == BuildMode::Fat;
|
||||||
let keep_names = self.wasm_split || ctx.mode == BuildMode::Fat;
|
let keep_names = self.config.web.wasm_opt.keep_names
|
||||||
|
|| self.keep_names
|
||||||
|
|| self.wasm_split
|
||||||
|
|| ctx.mode == BuildMode::Fat;
|
||||||
let demangle = false;
|
let demangle = false;
|
||||||
let wasm_opt_options = WasmOptConfig {
|
let wasm_opt_options = WasmOptConfig {
|
||||||
memory_packing: self.wasm_split,
|
memory_packing: self.wasm_split,
|
||||||
|
|||||||
@@ -104,6 +104,14 @@ pub(crate) struct TargetArgs {
|
|||||||
#[clap(long, default_value_t = true, help_heading = HELP_HEADING, num_args = 0..=1)]
|
#[clap(long, default_value_t = true, help_heading = HELP_HEADING, num_args = 0..=1)]
|
||||||
pub(crate) debug_symbols: bool,
|
pub(crate) debug_symbols: bool,
|
||||||
|
|
||||||
|
/// Keep the name section in the wasm binary, useful for profiling and debugging [default: false]
|
||||||
|
///
|
||||||
|
/// Unlike --debug-symbols which preserves DWARF debug info (requiring a browser extension to
|
||||||
|
/// read), the name section allows tools like console_error_panic_hook to print backtraces with
|
||||||
|
/// human-readable function names without any browser extension.
|
||||||
|
#[clap(long, default_value_t = false, help_heading = HELP_HEADING)]
|
||||||
|
pub(crate) keep_names: bool,
|
||||||
|
|
||||||
/// The name of the device we are hoping to upload to. By default, dx tries to upload to the active
|
/// The name of the device we are hoping to upload to. By default, dx tries to upload to the active
|
||||||
/// simulator. If the device name is passed, we will upload to that device instead.
|
/// simulator. If the device name is passed, we will upload to that device instead.
|
||||||
///
|
///
|
||||||
@@ -190,6 +198,7 @@ impl Anonymized for TargetArgs {
|
|||||||
"inject_loading_scripts": self.inject_loading_scripts,
|
"inject_loading_scripts": self.inject_loading_scripts,
|
||||||
"wasm_split": self.wasm_split,
|
"wasm_split": self.wasm_split,
|
||||||
"debug_symbols": self.debug_symbols,
|
"debug_symbols": self.debug_symbols,
|
||||||
|
"keep_names": self.keep_names,
|
||||||
"device": self.device,
|
"device": self.device,
|
||||||
"base_path": self.base_path.is_some(),
|
"base_path": self.base_path.is_some(),
|
||||||
"cargo_args": self.cargo_args.is_some(),
|
"cargo_args": self.cargo_args.is_some(),
|
||||||
|
|||||||
@@ -59,6 +59,14 @@ pub(crate) struct WasmOptConfig {
|
|||||||
#[serde(default = "false_bool")]
|
#[serde(default = "false_bool")]
|
||||||
pub(crate) debug: bool,
|
pub(crate) debug: bool,
|
||||||
|
|
||||||
|
/// Keep the wasm name section, useful for profiling and debugging
|
||||||
|
///
|
||||||
|
/// Unlike `debug` which preserves DWARF debug symbols (requiring a browser extension to read),
|
||||||
|
/// the name section allows tools like `console_error_panic_hook` to print backtraces with
|
||||||
|
/// human-readable function names without any browser extension.
|
||||||
|
#[serde(default = "false_bool")]
|
||||||
|
pub(crate) keep_names: bool,
|
||||||
|
|
||||||
/// Enable memory packing
|
/// Enable memory packing
|
||||||
#[serde(default = "false_bool")]
|
#[serde(default = "false_bool")]
|
||||||
pub(crate) memory_packing: bool,
|
pub(crate) memory_packing: bool,
|
||||||
|
|||||||
Reference in new issue
Block a user