Skip to content

Commit 1b65727

Browse files
authored
Some small fixes (#688)
2 parents ece1ec7 + 1760704 commit 1b65727

File tree

6 files changed

+27
-39
lines changed

6 files changed

+27
-39
lines changed

samply-symbols/src/breakpad/index.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ impl<'a> StringListRef<'a> {
431431
pub fn as_slice(&self) -> &'a [StringLocation] {
432432
self.inner
433433
}
434-
pub fn get<R: ReadRef<'a>>(&self, index: u32, data: R) -> Option<&'a [u8]> {
434+
pub fn get<'d, R: ReadRef<'d>>(&self, index: u32, data: R) -> Option<&'d [u8]> {
435435
let location = *self.inner.get(usize::try_from(index).ok()?)?;
436436
location.get(data)
437437
}

samply-symbols/src/breakpad/symbol_map.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -202,18 +202,6 @@ impl<'a> BreakpadSymbolMapSymbolCache<'a> {
202202
}
203203
}
204204

205-
// let file_offset = entry.offset.get();
206-
// let line_length = entry.line_len.get();
207-
// let line = self
208-
// .data
209-
// .read_bytes_at(file_offset, line_length.into())
210-
// .map_err(|e| {
211-
// Error::HelperErrorDuringFileReading(
212-
// "Breakpad FILE or INLINE_ORIGIN record".to_string(),
213-
// e,
214-
// )
215-
// })?;
216-
217205
impl<'object, T: FileContents> SymbolMapTrait for BreakpadSymbolMapInner<'object, T> {
218206
fn debug_id(&self) -> debugid::DebugId {
219207
self.index.debug_id

samply/src/shared/presymbolicate.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ use fxprof_processed_profile::symbol_info::{
88
};
99
use fxprof_processed_profile::LibraryHandle;
1010
use rustc_hash::FxHashMap;
11-
use wholesym::samply_symbols::SourceFilePathHandle;
12-
use wholesym::{SymbolManager, SymbolMap};
11+
use wholesym::{SourceFilePathHandle, SymbolManager, SymbolMap};
1312

1413
use crate::symbols::create_symbol_manager_and_quota_manager;
1514

samply/src/shared/symbol_precog.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@ use std::{borrow::Cow, fs::File};
55

66
use serde::de::{Deserialize, Deserializer};
77
use serde_derive::Deserialize;
8-
use wholesym::{
9-
samply_symbols::{SourceFilePathHandle, SourceFilePathIndex, SymbolMapGeneration},
10-
SourceFilePath,
11-
};
8+
use wholesym::{SourceFilePath, SourceFilePathHandle, SourceFilePathIndex, SymbolMapGeneration};
129

1310
#[derive(Debug, Copy, Clone, PartialOrd, Ord, PartialEq, Eq, Hash)]
1411
struct StringTableIndex(usize);

wholesym/src/breakpad.rs

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use std::io::Read;
12
use std::path::{Path, PathBuf};
23
use std::sync::Arc;
34

@@ -284,25 +285,28 @@ impl BreakpadSymbolDownloaderInner {
284285
&self,
285286
sym_path: &Path,
286287
) -> Result<OwnedBreakpadIndex, SymindexGenerationError> {
287-
let mut sym_file = tokio::fs::File::open(sym_path)
288-
.await
289-
.map_err(SymindexGenerationError::SymReading)?;
290-
let mut parser = BreakpadIndexCreator::new();
291-
const CHUNK_SIZE: usize = 2 * 1024 * 1024; // 2 MiB
292-
let mut buffer = vec![0; CHUNK_SIZE];
293-
loop {
294-
let read_len = sym_file
295-
.read(&mut buffer)
296-
.await
297-
.map_err(SymindexGenerationError::SymReading)?;
298-
if read_len == 0 {
299-
break;
288+
let sym_path = sym_path.to_path_buf();
289+
tokio::task::spawn_blocking(|| {
290+
let mut sym_file =
291+
std::fs::File::open(sym_path).map_err(SymindexGenerationError::SymReading)?;
292+
let mut parser = BreakpadIndexCreator::new();
293+
const CHUNK_SIZE: usize = 64 * 1024; // 64 KiB
294+
let mut buffer = vec![0; CHUNK_SIZE];
295+
loop {
296+
let read_len = sym_file
297+
.read(&mut buffer)
298+
.map_err(SymindexGenerationError::SymReading)?;
299+
if read_len == 0 {
300+
break;
301+
}
302+
parser.consume(&buffer[..read_len]);
300303
}
301-
parser.consume(&buffer[..read_len]);
302-
}
303-
parser
304-
.finish()
305-
.map_err(SymindexGenerationError::BreakpadParsing)
304+
parser
305+
.finish()
306+
.map_err(SymindexGenerationError::BreakpadParsing)
307+
})
308+
.await
309+
.unwrap()
306310
}
307311
}
308312

wholesym/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@ pub use samply_symbols;
153153
pub use samply_symbols::{
154154
AddressInfo, CodeId, ElfBuildId, Error, ExternalFileAddressInFileRef, ExternalFileAddressRef,
155155
ExternalFileRef, ExternalFileSymbolMap, FrameDebugInfo, FramesLookupResult, LibraryInfo,
156-
LookupAddress, MappedPath, MultiArchDisambiguator, PeCodeId, SourceFilePath, SymbolInfo,
157-
SyncAddressInfo,
156+
LookupAddress, MappedPath, MultiArchDisambiguator, PeCodeId, SourceFilePath,
157+
SourceFilePathHandle, SourceFilePathIndex, SymbolInfo, SymbolMapGeneration, SyncAddressInfo,
158158
};
159159
pub use symbol_manager::{SymbolFileOrigin, SymbolManager, SymbolMap};
160160
pub use symbol_manager_observer::SymbolManagerObserver;

0 commit comments

Comments
 (0)