Allow dwarf expr support to be turned off

This commit is contained in:
Gary Guo 2021-08-26 05:37:45 +01:00
parent d22df752ca
commit a942d60e1a
3 changed files with 13 additions and 2 deletions

View File

@ -16,8 +16,9 @@ spin = { version = "0.9", default-features = false, features = ["mutex", "spin_m
alloc = [] alloc = []
fde-phdr = ["libc"] fde-phdr = ["libc"]
fde-registry = ["alloc"] fde-registry = ["alloc"]
dwarf-expr = []
system-alloc = [] system-alloc = []
default = ["fde-phdr"] default = ["dwarf-expr", "fde-phdr", "fde-registry"]
[profile.dev] [profile.dev]
# Must be turned on due to Rust bug https://github.com/rust-lang/rust/issues/50007 # Must be turned on due to Rust bug https://github.com/rust-lang/rust/issues/50007

View File

@ -8,5 +8,5 @@ edition = "2018"
crate-type = ["cdylib"] crate-type = ["cdylib"]
[dependencies] [dependencies]
unwind = { path = "../", features = ["fde-registry"] } unwind = { path = "../", features = ["system-alloc"] }
libc = "0.2" libc = "0.2"

View File

@ -44,6 +44,7 @@ impl Frame {
Ok(Some(Self { fde_result, row })) Ok(Some(Self { fde_result, row }))
} }
#[cfg(feature = "dwarf-expr")]
fn evaluate_expression( fn evaluate_expression(
&self, &self,
ctx: &Context, ctx: &Context,
@ -83,6 +84,15 @@ impl Frame {
) )
} }
#[cfg(not(feature = "dwarf-expr"))]
fn evaluate_expression(
&self,
ctx: &Context,
expr: Expression<StaticSlice>,
) -> Result<usize, gimli::Error> {
Err(gimli::Error::UnsupportedEvaluation)
}
pub fn unwind(&self, ctx: &Context) -> Result<Context, gimli::Error> { pub fn unwind(&self, ctx: &Context) -> Result<Context, gimli::Error> {
let row = &self.row; let row = &self.row;
let mut new_ctx = ctx.clone(); let mut new_ctx = ctx.clone();