Don't re-parse wasm for debuginfo (#2085)
* Don't re-parse wasm for debuginfo This commit updates debuginfo parsing to happen during the main translation of the original wasm module. This avoid re-parsing the wasm module twice (at least the section-level headers). Additionally this ties debuginfo directly to a `ModuleTranslation` which makes it easier to process debuginfo for nested modules in the upcoming module linking proposal. The changes here are summarized by taking the `read_debuginfo` function and merging it with the main module translation that happens which is driven by cranelift. Some new hooks were added to the module environment trait to support this, but most of it was integrating with existing hooks. * Fix tests in debug crate
This commit is contained in:
@@ -2,7 +2,7 @@ use anyhow::{anyhow, bail, Context as _, Result};
|
||||
use object::write::Object;
|
||||
use target_lexicon::Triple;
|
||||
use wasmtime::Strategy;
|
||||
use wasmtime_debug::{emit_dwarf, read_debuginfo};
|
||||
use wasmtime_debug::emit_dwarf;
|
||||
#[cfg(feature = "lightbeam")]
|
||||
use wasmtime_environ::Lightbeam;
|
||||
use wasmtime_environ::{
|
||||
@@ -103,8 +103,7 @@ pub fn compile_to_obj(
|
||||
}
|
||||
};
|
||||
|
||||
let dwarf_sections = if debug_info {
|
||||
let debug_data = read_debuginfo(wasm).context("failed to emit DWARF")?;
|
||||
let dwarf_sections = if let Some(debug_data) = &translation.debuginfo {
|
||||
emit_dwarf(
|
||||
&*isa,
|
||||
&debug_data,
|
||||
|
||||
Reference in New Issue
Block a user