Skip to content

Commit

Permalink
Upgrade gimli and downgrade addr2line to match other Theseus depe…
Browse files Browse the repository at this point in the history
…ndencies (theseus-os#516)

* This is to simplify building and loading `wasmtime` which currently has strict dependencies on versions. 

* Theseus also needs better support for loading multiple versions of a crate when a missing dependency is requested; until then, this commit makes loading simpler.
  • Loading branch information
kevinaboos authored May 4, 2022
1 parent fe3401a commit 9ae6395
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 59 deletions.
55 changes: 11 additions & 44 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions kernel/debug_info/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ rustc-demangle = "0.1.19"
version = "0.4.8"

[dependencies.gimli]
version = "0.19.0"
version = "0.25.0"
default-features = false
features = [ "read", "alloc" ]
features = [ "read" ]

### used for linker relocation typedefs
[dependencies.goblin]
Expand Down
24 changes: 14 additions & 10 deletions kernel/debug_info/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ use gimli::{
DebugStr,
Reader,
// Section,
},
}, RawRngListEntry,
};
use rustc_demangle::demangle;
use hashbrown::{HashMap, HashSet};
Expand Down Expand Up @@ -180,15 +180,22 @@ impl DebugSections {
// A lexical block's address range can exist in two forms: a low_pc and high_pc attribute pair, or a list of ranges
let (starting_vaddr, ending_vaddr) = {
if let Some(gimli::AttributeValue::RangeListsRef(ranges_offset)) = entry.attr_value(gimli::DW_AT_ranges)? {
let mut ranges_list = context.dwarf.ranges(&context.unit, ranges_offset)?;
let range_lists_offset = context.dwarf.ranges_offset_from_raw(&context.unit, ranges_offset);
let mut raw_ranges = context.dwarf.raw_ranges(&context.unit, range_lists_offset)?;
debug!("{:indent$}--Lexical Block range list:", "", indent = ((depth) * 2));
// we only care about the first range, since the additional ranges will be for unwinding routines
let mut first_range = None;
while let Some(r) = ranges_list.next()? {
debug!("{:indent$} --> {:#X} to {:#X}", "", r.begin, r.end, indent = ((depth+1) * 2));
if first_range.is_none() { first_range = Some(r); }
while let Some(r) = raw_ranges.next()? {
let (begin, end) = match r {
RawRngListEntry::AddressOrOffsetPair { begin, end } |
RawRngListEntry::OffsetPair { begin, end } |
RawRngListEntry::StartEnd { begin, end } => (begin, end),
other => todo!("unsupported RawRngListEntry {:?}", other),
};
debug!("{:indent$} --> {:#X} to {:#X}", "", begin, end, indent = ((depth+1) * 2));
if first_range.is_none() { first_range = Some((begin, end)); }
}
first_range.map(|range| (range.begin as usize, range.end as usize)).expect("range list iter was empty")
first_range.map(|(begin, end)| (begin as usize, end as usize)).expect("range list iter was empty")
}
else if let (Some(low_pc), Some(high_pc)) = (entry.attr_value(gimli::DW_AT_low_pc)?, entry.attr_value(gimli::DW_AT_high_pc)?) {
let starting_vaddr = match low_pc {
Expand Down Expand Up @@ -499,10 +506,7 @@ impl DebugSections {
};
Ok(gimli::EndianSlice::new(slice_opt.unwrap_or_default(), NativeEndian))
};
let load_supplementary = |_section_id| {
Ok(gimli::EndianSlice::new(&[][..], NativeEndian))
};
let dwarf = gimli::Dwarf::load(load_section, load_supplementary)?;
let dwarf = gimli::Dwarf::load(load_section)?;

let debug_info_sec = self.debug_info();
let debug_abbrev_sec = self.debug_abbrev();
Expand Down
4 changes: 2 additions & 2 deletions kernel/unwind/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ build = "../../build.rs"
fallible-iterator = { version = "0.2.0", default-features = false }

[dependencies.gimli]
version = "0.19.0"
version = "0.25.0"
default-features = false
features = [ "read", "alloc" ]
features = [ "read" ]

[dependencies.log]
version = "0.4.8"
Expand Down
2 changes: 1 addition & 1 deletion ports/backtrace
Submodule backtrace updated 1 files
+1 −1 Cargo.toml

0 comments on commit 9ae6395

Please sign in to comment.