Skip alloc of additional data structure
@@ -160,7 +160,6 @@ impl fmt::Debug for Location {
pub type Locations = BTreeMap<u64, Location>;
pub fn get_locations(elf: &[u8], table: &Table) -> Result<Locations, anyhow::Error> {
- let live_syms = table.raw_symbols().collect::<Vec<_>>();
let object = object::File::parse(elf)?;
let endian = if object.is_little_endian() {
gimli::RunTimeEndian::Little
@@ -279,7 +278,7 @@ pub fn get_locations(elf: &[u8], table: &Table) -> Result<Locations, anyhow::Err
let linkage_name = core::str::from_utf8(&linkage_name_slice)?;
if name == "DEFMT_LOG_STATEMENT" {
- if live_syms.contains(&linkage_name) {
+ if table.raw_symbols().any(|i| i == linkage_name) {
let addr = exprloc2address(unit.encoding(), &loc)?;
let file = file_index_to_path(file_index, &unit, &dwarf)?;
let module = segments.join("::");
