Skip to content

Commit

Permalink
add debug_info to config
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Nelson committed Feb 5, 2025
1 parent de562f3 commit 7dee81b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/wasmex/engine_config.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ defmodule Wasmex.EngineConfig do
* `:consume_fuel` - Whether or not to consume fuel when executing Wasm instructions. This defaults to `false`.
* `:cranelift_opt_level` - Optimization level for the Cranelift code generator. This defaults to `:none`.
* `:wasm_backtrace_details` - Whether or not backtraces in traps will parse debug info in the Wasm file to have filename/line number information. This defaults to `false`.
* `:debug_info` - Configures whether DWARF debug information will be emitted during compilation. This defaults to `false`.
* `:memory64` - Whether or not to use 64-bit memory. This defaults to `false`.
* `:wasm_component_model` - Whether or not to use the WebAssembly component model. This defaults to `true`.
## Example
Expand All @@ -20,13 +23,16 @@ defmodule Wasmex.EngineConfig do
cranelift_opt_level: :none,
wasm_backtrace_details: false,
memory64: false,
wasm_component_model: true
wasm_component_model: true,
debug_info: false

@type t :: %__MODULE__{
consume_fuel: boolean(),
cranelift_opt_level: :none | :speed | :speed_and_size,
wasm_backtrace_details: boolean(),
memory64: boolean()
memory64: boolean(),
wasm_component_model: boolean(),
debug_info: boolean()
}

@doc ~S"""
Expand Down
2 changes: 2 additions & 0 deletions native/wasmex/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pub struct ExEngineConfig {
cranelift_opt_level: rustler::Atom,
memory64: bool,
wasm_component_model: bool,
debug_info: bool,
}

#[rustler::resource_impl()]
Expand Down Expand Up @@ -70,6 +71,7 @@ pub(crate) fn engine_config(engine_config: ExEngineConfig) -> Config {
config.cranelift_opt_level(cranelift_opt_level);
config.wasm_memory64(engine_config.memory64);
config.wasm_component_model(engine_config.wasm_component_model);
config.debug_info(engine_config.debug_info);
config
}

Expand Down

0 comments on commit 7dee81b

Please sign in to comment.