Skip to content

Commit b69b482

Browse files
authored
Merge pull request #505 from mstange/push-qswtrvmmqlyu
Fix repeated external object file reads with async lookup
2 parents 9700a37 + 7f1eb4e commit b69b482

File tree

4 files changed

+19
-6
lines changed

4 files changed

+19
-6
lines changed

samply-api/src/symbolicate/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ impl<'a, H: FileAndPathHelper> SymbolicateApi<'a, H> {
114114
}
115115

116116
// Look up any addresses whose debug info is in an external file.
117-
// The symbol_manager caches the most recent external file, so we sort our
117+
// The symbol_map caches the most recent external file, so we sort our
118118
// external addresses by ExternalFileAddressRef before we do the lookup,
119119
// in order to get the best hit rate in lookup_external.
120120
external_addresses.sort_unstable_by(|(_, a), (_, b)| a.cmp(b));

samply-symbols/src/symbol_map.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ pub trait SymbolMapTrait {
1616

1717
fn iter_symbols(&self) -> Box<dyn Iterator<Item = (u32, Cow<'_, str>)> + '_>;
1818

19+
/// Look up information for an address synchronously.
20+
///
21+
/// If the information is known to be in an external file, and this file is
22+
/// already cached within this symbol map, then that cached information is
23+
/// consulted as part of this lookup_sync invocation. This method only returns
24+
/// `FramesLookupResult::External` if the caller actually needs to supply new
25+
/// file contents with a follow-up call to `try_lookup_external_with_file_contents`.
1926
fn lookup_sync(&self, address: LookupAddress) -> Option<SyncAddressInfo>;
2027
}
2128

samply-symbols/src/symbol_map_object.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,12 @@ where
579579
if frames.is_none() {
580580
frames = self.frames_lookup_for_object_map_references(svma);
581581
}
582+
if let Some(FramesLookupResult::External(external_file_address_ref)) = frames {
583+
frames = self.try_lookup_external_impl(
584+
&external_file_address_ref,
585+
ExternalLookupRequest::ReplyIfYouHaveOrTellMeWhatYouNeed,
586+
);
587+
}
582588
Some(SyncAddressInfo { symbol, frames })
583589
}
584590
}

samply/src/linux_shared/convert_regs.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ impl ConvertRegs for ConvertRegsX86_64 {
2727
}
2828

2929
fn regs_mask() -> u64 {
30-
1 << PERF_REG_X86_IP | 1 << PERF_REG_X86_SP | 1 << PERF_REG_X86_BP
30+
(1 << PERF_REG_X86_IP) | (1 << PERF_REG_X86_SP) | (1 << PERF_REG_X86_BP)
3131
}
3232
}
3333

@@ -44,9 +44,9 @@ impl ConvertRegs for ConvertRegsAarch64 {
4444
}
4545

4646
fn regs_mask() -> u64 {
47-
1 << PERF_REG_ARM64_PC
48-
| 1 << PERF_REG_ARM64_LR
49-
| 1 << PERF_REG_ARM64_SP
50-
| 1 << PERF_REG_ARM64_X29
47+
(1 << PERF_REG_ARM64_PC)
48+
| (1 << PERF_REG_ARM64_LR)
49+
| (1 << PERF_REG_ARM64_SP)
50+
| (1 << PERF_REG_ARM64_X29)
5151
}
5252
}

0 commit comments

Comments
 (0)