Skip to content

Commit 4c8d5eb

Browse files
afranchukmstange
authored andcommitted
Support Send on SymbolMap.
1 parent 451b5bd commit 4c8d5eb

File tree

7 files changed

+80
-46
lines changed

7 files changed

+80
-46
lines changed

Cargo.lock

Lines changed: 46 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

samply-symbols/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ features = ["std", "read_core", "archive", "elf", "macho", "pe", "unaligned", "c
3131
version = "0.30.2"
3232

3333
[dependencies]
34-
# pdb-addr2line = { path = "../../pdb-addr2line" }
35-
pdb-addr2line = "0.10.0"
34+
#pdb-addr2line = { path = "../../pdb-addr2line" }
35+
pdb-addr2line = "0.11.0"
3636
uuid = "1.0.0"
3737
thiserror = "1.0.26"
3838
cpp_demangle = "0.4.0"

samply-symbols/src/elf.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,9 @@ impl<T: FileContents> ElfSymbolMapData<T> {
300300
}
301301

302302
impl<T: FileContents + 'static> SymbolMapDataOuterTrait for ElfSymbolMapData<T> {
303-
fn make_symbol_map_data_mid(&self) -> Result<Box<dyn SymbolMapDataMidTrait + '_>, Error> {
303+
fn make_symbol_map_data_mid(
304+
&self,
305+
) -> Result<Box<dyn SymbolMapDataMidTrait + Send + '_>, Error> {
304306
let object =
305307
File::parse(&self.file_data).map_err(|e| Error::ObjectParseError(self.file_kind, e))?;
306308
let supplementary_object = match self.supplementary_file_data.as_ref() {

samply-symbols/src/macho.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,9 @@ impl<T: FileContents + 'static> DyldCacheFileData<T> {
333333
}
334334

335335
impl<T: FileContents + 'static> SymbolMapDataOuterTrait for DyldCacheFileData<T> {
336-
fn make_symbol_map_data_mid(&self) -> Result<Box<dyn SymbolMapDataMidTrait + '_>, Error> {
336+
fn make_symbol_map_data_mid(
337+
&self,
338+
) -> Result<Box<dyn SymbolMapDataMidTrait + Send + '_>, Error> {
337339
let ObjectAndMachOData { object, macho_data } = self.make_object()?;
338340
let arch = macho_data.get_arch();
339341
let function_addresses_computer = MachOFunctionAddressesComputer { macho_data };
@@ -388,7 +390,9 @@ impl<T: FileContents> MachSymbolMapData<T> {
388390
}
389391

390392
impl<T: FileContents + 'static> SymbolMapDataOuterTrait for MachSymbolMapData<T> {
391-
fn make_symbol_map_data_mid(&self) -> Result<Box<dyn SymbolMapDataMidTrait + '_>, Error> {
393+
fn make_symbol_map_data_mid(
394+
&self,
395+
) -> Result<Box<dyn SymbolMapDataMidTrait + Send + '_>, Error> {
392396
let macho_file = File::parse(&self.file_data).map_err(Error::MachOHeaderParseError)?;
393397
let macho_data = MachOData::new(&self.file_data, 0, macho_file.is_64());
394398
let arch = macho_data.get_arch();
@@ -440,7 +444,9 @@ impl<T: FileContents> MachOFatArchiveMemberData<T> {
440444
}
441445

442446
impl<T: FileContents + 'static> SymbolMapDataOuterTrait for MachOFatArchiveMemberData<T> {
443-
fn make_symbol_map_data_mid(&self) -> Result<Box<dyn SymbolMapDataMidTrait + '_>, Error> {
447+
fn make_symbol_map_data_mid(
448+
&self,
449+
) -> Result<Box<dyn SymbolMapDataMidTrait + Send + '_>, Error> {
444450
let range_data = self.data();
445451
let macho_file = File::parse(range_data).map_err(Error::MachOHeaderParseError)?;
446452
let macho_data = MachOData::new(range_data, 0, macho_file.is_64());

samply-symbols/src/symbol_map.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ use crate::{shared::AddressInfo, Error, FileLocation};
77

88
pub struct SymbolMap<FL: FileLocation> {
99
debug_file_location: FL,
10-
pub(crate) inner: Box<dyn SymbolMapTrait>,
10+
pub(crate) inner: Box<dyn SymbolMapTrait + Send>,
1111
}
1212

1313
impl<FL: FileLocation> SymbolMap<FL> {
14-
pub(crate) fn new(debug_file_location: FL, inner: Box<dyn SymbolMapTrait>) -> Self {
14+
pub(crate) fn new(debug_file_location: FL, inner: Box<dyn SymbolMapTrait + Send>) -> Self {
1515
Self {
1616
debug_file_location,
1717
inner,
@@ -60,15 +60,16 @@ pub trait SymbolMapTrait {
6060
}
6161

6262
pub trait SymbolMapDataOuterTrait {
63-
fn make_symbol_map_data_mid(&self) -> Result<Box<dyn SymbolMapDataMidTrait + '_>, Error>;
63+
fn make_symbol_map_data_mid(&self)
64+
-> Result<Box<dyn SymbolMapDataMidTrait + Send + '_>, Error>;
6465
}
6566

6667
pub trait SymbolMapDataMidTrait {
6768
fn make_symbol_map_inner(&self) -> Result<SymbolMapInnerWrapper<'_>, Error>;
6869
}
6970

7071
#[derive(Yokeable)]
71-
pub struct SymbolMapDataMidWrapper<'data>(Box<dyn SymbolMapDataMidTrait + 'data>);
72+
pub struct SymbolMapDataMidWrapper<'data>(Box<dyn SymbolMapDataMidTrait + Send + 'data>);
7273

7374
struct SymbolMapDataOuterAndMid<SMDO: SymbolMapDataOuterTrait>(
7475
Yoke<SymbolMapDataMidWrapper<'static>, Box<SMDO>>,
@@ -102,7 +103,7 @@ impl<SMDO: SymbolMapDataOuterTrait> GenericSymbolMap<SMDO> {
102103
}
103104

104105
#[derive(Yokeable)]
105-
pub struct SymbolMapInnerWrapper<'data>(pub Box<dyn SymbolMapTrait + 'data>);
106+
pub struct SymbolMapInnerWrapper<'data>(pub Box<dyn SymbolMapTrait + Send + 'data>);
106107

107108
impl<SMDO: SymbolMapDataOuterTrait> SymbolMapTrait for GenericSymbolMap<SMDO> {
108109
fn debug_id(&self) -> debugid::DebugId {

samply-symbols/src/symbol_map_object.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ impl<'data, R: ReadRef<'data>, FAC: FunctionAddressesComputer<'data>>
6565
}
6666
}
6767

68-
impl<'data, R: ReadRef<'data>, FAC: FunctionAddressesComputer<'data>> SymbolMapDataMidTrait
69-
for ObjectSymbolMapDataMid<'data, R, FAC>
68+
impl<'data, R: ReadRef<'data> + Send + Sync, FAC: FunctionAddressesComputer<'data>>
69+
SymbolMapDataMidTrait for ObjectSymbolMapDataMid<'data, R, FAC>
7070
{
7171
fn make_symbol_map_inner(&self) -> Result<SymbolMapInnerWrapper<'_>, Error> {
7272
let (function_starts, function_ends) = self

samply-symbols/src/windows.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@ impl<T: FileContents> PeSymbolMapData<T> {
9494
}
9595

9696
impl<T: FileContents + 'static> SymbolMapDataOuterTrait for PeSymbolMapData<T> {
97-
fn make_symbol_map_data_mid(&self) -> Result<Box<dyn SymbolMapDataMidTrait + '_>, Error> {
97+
fn make_symbol_map_data_mid(
98+
&self,
99+
) -> Result<Box<dyn SymbolMapDataMidTrait + Send + '_>, Error> {
98100
let object =
99101
File::parse(&self.file_data).map_err(|e| Error::ObjectParseError(self.file_kind, e))?;
100102
let debug_id = debug_id_for_object(&object)
@@ -145,7 +147,7 @@ pub fn is_pdb_file<F: FileContents>(file: &FileContentsWrapper<F>) -> bool {
145147
struct PdbObject<'data, FC: FileContents + 'static> {
146148
context_data: pdb_addr2line::ContextPdbData<'data, 'data, &'data FileContentsWrapper<FC>>,
147149
debug_id: DebugId,
148-
srcsrv_stream: Option<Box<dyn Deref<Target = [u8]> + 'data>>,
150+
srcsrv_stream: Option<Box<dyn Deref<Target = [u8]> + Send + 'data>>,
149151
}
150152

151153
impl<'data, FC: FileContents + 'static> SymbolMapDataMidTrait for PdbObject<'data, FC> {
@@ -172,7 +174,7 @@ impl<'data, FC: FileContents + 'static> SymbolMapDataMidTrait for PdbObject<'dat
172174
impl<'data, FC: FileContents + 'static> PdbObject<'data, FC> {
173175
fn make_context<'object>(
174176
&'object self,
175-
) -> Result<Box<dyn PdbAddr2lineContextTrait + 'object>, Error> {
177+
) -> Result<Box<dyn PdbAddr2lineContextTrait + Send + 'object>, Error> {
176178
let context = self.context_data.make_context().context("make_context()")?;
177179
Ok(Box::new(context))
178180
}
@@ -205,7 +207,7 @@ impl<'a, 's> PdbAddr2lineContextTrait for pdb_addr2line::Context<'a, 's> {
205207
}
206208

207209
struct PdbSymbolMapInner<'object> {
208-
context: Box<dyn PdbAddr2lineContextTrait + 'object>,
210+
context: Box<dyn PdbAddr2lineContextTrait + Send + 'object>,
209211
debug_id: DebugId,
210212
path_mapper: Mutex<PathMapper<SrcSrvPathMapper<'object>>>,
211213
}
@@ -281,17 +283,19 @@ impl<'object> SymbolMapTrait for PdbSymbolMapInner<'object> {
281283
}
282284
}
283285

284-
fn box_stream<'data, T>(stream: T) -> Box<dyn Deref<Target = [u8]> + 'data>
286+
fn box_stream<'data, T>(stream: T) -> Box<dyn Deref<Target = [u8]> + Send + 'data>
285287
where
286-
T: Deref<Target = [u8]> + 'data,
288+
T: Deref<Target = [u8]> + Send + 'data,
287289
{
288290
Box::new(stream)
289291
}
290292

291293
struct PdbSymbolData<T: FileContents + 'static>(FileContentsWrapper<T>);
292294

293295
impl<T: FileContents + 'static> SymbolMapDataOuterTrait for PdbSymbolData<T> {
294-
fn make_symbol_map_data_mid(&self) -> Result<Box<dyn SymbolMapDataMidTrait + '_>, Error> {
296+
fn make_symbol_map_data_mid(
297+
&self,
298+
) -> Result<Box<dyn SymbolMapDataMidTrait + Send + '_>, Error> {
295299
let mut pdb = PDB::open(&self.0)?;
296300
let info = pdb.pdb_information().context("pdb_information")?;
297301
let dbi = pdb.debug_information()?;
@@ -464,7 +468,7 @@ impl<'s, F: FileContents> pdb::Source<'s> for &'s FileContentsWrapper<F> {
464468
fn view(
465469
&mut self,
466470
slices: &[pdb::SourceSlice],
467-
) -> std::result::Result<Box<dyn pdb::SourceView<'s>>, std::io::Error> {
471+
) -> std::result::Result<Box<dyn pdb::SourceView<'s> + Send + Sync>, std::io::Error> {
468472
let len = slices.iter().fold(0, |acc, s| acc + s.size);
469473

470474
let mut bytes = Vec::with_capacity(len);

0 commit comments

Comments
 (0)