Update gimli to 0.25; addr2line to 0.16

This commit is contained in:
Nick Fitzgerald
2021-07-26 11:00:23 -07:00
parent 6f3adacb9f
commit 3d76cbdf34
13 changed files with 54 additions and 23 deletions

View File

@@ -11,7 +11,7 @@ keywords = ["webassembly", "wasm", "debuginfo"]
edition = "2018"
[dependencies]
gimli = "0.24.0"
gimli = "0.25.0"
wasmparser = "0.79"
object = { version = "0.25.0", default-features = false, features = ["read_core", "elf", "write"] }
wasmtime-environ = { path = "../environ", version = "0.28.0" }

View File

@@ -120,7 +120,9 @@ fn has_valid_code_range<R: Reader<Offset = usize>>(
constants::DW_TAG_subprogram => {
if let Some(ranges_attr) = die.attr_value(constants::DW_AT_ranges)? {
let offset = match ranges_attr {
read::AttributeValue::RangeListsRef(val) => val,
read::AttributeValue::RangeListsRef(val) => {
dwarf.ranges_offset_from_raw(unit, val)
}
read::AttributeValue::DebugRngListsIndex(index) => {
dwarf.ranges_offset(unit, index)?
}

View File

@@ -36,6 +36,7 @@ fn is_exprloc_to_loclist_allowed(attr_name: gimli::constants::DwAt) -> bool {
}
pub(crate) fn clone_die_attributes<'a, R>(
dwarf: &gimli::Dwarf<R>,
unit: &Unit<R, R::Offset>,
entry: &DebuggingInformationEntry<R>,
context: &DebugInputContext<R>,
@@ -63,7 +64,7 @@ where
// FIXME for CU: currently address_transform operate on a single
// function range, and when CU spans multiple ranges the
// transformation may be incomplete.
RangeInfoBuilder::from(unit, entry, context, cu_low_pc)?
RangeInfoBuilder::from(dwarf, unit, entry, context, cu_low_pc)?
};
range_info.build(addr_tr, out_unit, current_scope_id);
@@ -139,6 +140,7 @@ where
write::AttributeValue::StringRef(out_strings.add(s))
}
AttributeValue::RangeListsRef(r) => {
let r = dwarf.ranges_offset_from_raw(unit, r);
let range_info = RangeInfoBuilder::from_ranges_ref(unit, r, context, cu_low_pc)?;
let range_list_id = range_info.build_ranges(addr_tr, &mut out_unit.ranges);
write::AttributeValue::RangeListRef(range_list_id)

View File

@@ -85,6 +85,7 @@ pub fn transform_dwarf(
while let Some(header) = iter.next().unwrap_or(None) {
let unit = di.dwarf.unit(header)?;
if let Some((id, ref_map, pending_refs)) = clone_unit(
&di.dwarf,
unit,
&context,
&addr_tr,

View File

@@ -15,6 +15,7 @@ pub(crate) enum RangeInfoBuilder {
impl RangeInfoBuilder {
pub(crate) fn from<R>(
dwarf: &gimli::Dwarf<R>,
unit: &Unit<R, R::Offset>,
entry: &DebuggingInformationEntry<R>,
context: &DebugInputContext<R>,
@@ -24,6 +25,7 @@ impl RangeInfoBuilder {
R: Reader,
{
if let Some(AttributeValue::RangeListsRef(r)) = entry.attr_value(gimli::DW_AT_ranges)? {
let r = dwarf.ranges_offset_from_raw(unit, r);
return RangeInfoBuilder::from_ranges_ref(unit, r, context, cu_low_pc);
};
@@ -80,6 +82,7 @@ impl RangeInfoBuilder {
}
pub(crate) fn from_subprogram_die<R>(
dwarf: &gimli::Dwarf<R>,
unit: &Unit<R, R::Offset>,
entry: &DebuggingInformationEntry<R>,
context: &DebugInputContext<R>,
@@ -100,6 +103,7 @@ impl RangeInfoBuilder {
} else if let Some(AttributeValue::RangeListsRef(r)) =
entry.attr_value(gimli::DW_AT_ranges)?
{
let r = dwarf.ranges_offset_from_raw(unit, r);
let mut ranges = context.rnglists.ranges(
r,
unit_encoding,

View File

@@ -244,6 +244,7 @@ where
}
pub(crate) fn clone_unit<'a, R>(
dwarf: &gimli::Dwarf<R>,
unit: Unit<R, R::Offset>,
context: &DebugInputContext<R>,
addr_tr: &'a AddressTransform,
@@ -302,6 +303,7 @@ where
};
clone_die_attributes(
dwarf,
&unit,
entry,
context,
@@ -369,8 +371,9 @@ where
current_scope_ranges.update(new_stack_len);
current_value_range.update(new_stack_len);
let range_builder = if entry.tag() == gimli::DW_TAG_subprogram {
let range_builder =
RangeInfoBuilder::from_subprogram_die(&unit, entry, context, addr_tr, cu_low_pc)?;
let range_builder = RangeInfoBuilder::from_subprogram_die(
dwarf, &unit, entry, context, addr_tr, cu_low_pc,
)?;
if let RangeInfoBuilder::Function(func_index) = range_builder {
if let Some(frame_info) = get_function_frame_info(memory_offset, funcs, func_index)
{
@@ -387,7 +390,8 @@ where
let high_pc = entry.attr_value(gimli::DW_AT_high_pc)?;
let ranges = entry.attr_value(gimli::DW_AT_ranges)?;
if high_pc.is_some() || ranges.is_some() {
let range_builder = RangeInfoBuilder::from(&unit, entry, context, cu_low_pc)?;
let range_builder =
RangeInfoBuilder::from(dwarf, &unit, entry, context, cu_low_pc)?;
current_scope_ranges.push(new_stack_len, range_builder.get_ranges(addr_tr));
Some(range_builder)
} else {
@@ -443,6 +447,7 @@ where
die_ref_map.insert(entry.offset(), die_id);
clone_die_attributes(
dwarf,
&unit,
entry,
context,