Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip alloc of additional data structure #385

Merged
merged 1 commit into from
Feb 12, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions decoder/src/elf2table/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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("::");
Expand Down