Skip to content

Commit 255164a

Browse files
committed
Reorder use statements.
1 parent ce7b521 commit 255164a

13 files changed

+88
-81
lines changed

samply-symbols/src/binary_image.rs

+7-8
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@ use object::{
55
FileKind, Object, ReadRef,
66
};
77

8-
use crate::{
9-
debug_id_and_code_id_for_jitdump, debug_id_for_object,
10-
debugid_util::code_id_for_object,
11-
jitdump::JitDumpIndex,
12-
macho::{DyldCacheFileData, MachOData, MachOFatArchiveMemberData, ObjectAndMachOData},
13-
relative_address_base,
14-
shared::{FileContentsWrapper, LibraryInfo, PeCodeId, RangeReadRef},
15-
CodeId, ElfBuildId, Error, FileAndPathHelperError, FileContents,
8+
use crate::debugid_util::{code_id_for_object, debug_id_for_object};
9+
use crate::error::Error;
10+
use crate::jitdump::{debug_id_and_code_id_for_jitdump, JitDumpIndex};
11+
use crate::macho::{DyldCacheFileData, MachOData, MachOFatArchiveMemberData, ObjectAndMachOData};
12+
use crate::shared::{
13+
relative_address_base, CodeId, ElfBuildId, FileAndPathHelperError, FileContents,
14+
FileContentsWrapper, LibraryInfo, PeCodeId, RangeReadRef,
1615
};
1716

1817
#[derive(thiserror::Error, Debug)]

samply-symbols/src/cache.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
use std::{
2-
collections::HashMap,
3-
ops::Range,
4-
sync::{atomic::AtomicUsize, Mutex},
5-
};
6-
7-
use crate::chunked_read_buffer_manager::{ChunkedReadBufferManager, RangeLocation, RangeSourcing};
1+
use std::collections::HashMap;
2+
use std::ops::Range;
3+
use std::sync::{atomic::AtomicUsize, Mutex};
84

95
use elsa::sync::FrozenVec;
106

7+
use crate::chunked_read_buffer_manager::{ChunkedReadBufferManager, RangeLocation, RangeSourcing};
118
use crate::{FileAndPathHelperResult, FileContents};
129

1310
const CHUNK_SIZE: u64 = 32 * 1024;

samply-symbols/src/chunked_read_buffer_manager.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
use rangemap::RangeMap;
21
use std::ops::Range;
32

3+
use rangemap::RangeMap;
4+
45
pub struct ChunkedReadBufferManager<const CHUNK_SIZE: u64> {
56
file_len: u64,
67
buffer_ranges: Vec<BufferRange>,

samply-symbols/src/dwarf.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
use std::marker::PhantomData;
22

3-
use crate::path_mapper::PathMapper;
4-
use crate::shared::FrameDebugInfo;
5-
use crate::{demangle, Error, SourceFilePath};
63
use addr2line::fallible_iterator;
74
use addr2line::gimli;
85
use elsa::sync::FrozenVec;
@@ -11,6 +8,10 @@ use gimli::{EndianSlice, Reader, RunTimeEndian, SectionId};
118
use object::read::ReadRef;
129
use object::{CompressedFileRange, CompressionFormat};
1310

11+
use crate::path_mapper::PathMapper;
12+
use crate::shared::FrameDebugInfo;
13+
use crate::{demangle, Error, SourceFilePath};
14+
1415
pub fn get_frames<R: Reader>(
1516
address: u64,
1617
context: Option<&addr2line::Context<R>>,

samply-symbols/src/elf.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1+
use debugid::DebugId;
2+
use gimli::{CieOrFde, EhFrame, UnwindSection};
3+
use object::{File, FileKind, Object, ObjectSection, ReadRef};
4+
use std::io::Cursor;
5+
16
use crate::error::Error;
2-
use crate::shared::{FileContents, FileContentsWrapper};
7+
use crate::shared::{FileAndPathHelper, FileContents, FileContentsWrapper, FileLocation};
38
use crate::symbol_map::{
49
GenericSymbolMap, SymbolMap, SymbolMapDataMidTrait, SymbolMapDataOuterTrait,
510
};
611
use crate::symbol_map_object::{FunctionAddressesComputer, ObjectSymbolMapDataMid};
7-
use crate::{debug_id_for_object, ElfBuildId, FileAndPathHelper, FileLocation};
8-
use debugid::DebugId;
9-
use gimli::{CieOrFde, EhFrame, UnwindSection};
10-
use object::{File, FileKind, Object, ObjectSection, ReadRef};
11-
use std::io::Cursor;
12+
use crate::{debug_id_for_object, ElfBuildId};
1213

1314
pub async fn load_symbol_map_for_elf<'h, T, FL, H>(
1415
file_location: FL,

samply-symbols/src/external_file.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ use object::{read::archive::ArchiveFile, File, FileKind, ReadRef};
44
use yoke::Yoke;
55
use yoke_derive::Yokeable;
66

7-
use crate::{
8-
dwarf::{get_frames, Addr2lineContextData},
9-
macho,
10-
path_mapper::PathMapper,
11-
shared::{ExternalFileAddressInFileRef, ExternalFileRef, FileContentsWrapper, RangeReadRef},
12-
Error, FileAndPathHelper, FileContents, FileLocation, FrameDebugInfo, MultiArchDisambiguator,
7+
use crate::dwarf::{get_frames, Addr2lineContextData};
8+
use crate::error::Error;
9+
use crate::macho;
10+
use crate::path_mapper::PathMapper;
11+
use crate::shared::{
12+
ExternalFileAddressInFileRef, ExternalFileRef, FileAndPathHelper, FileContents,
13+
FileContentsWrapper, FileLocation, FrameDebugInfo, MultiArchDisambiguator, RangeReadRef,
1314
};
1415

1516
pub async fn load_external_file<'h, H>(

samply-symbols/src/jitdump.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ use std::{
1212
sync::Mutex,
1313
};
1414

15-
use crate::shared::FileContentsCursor;
16-
use crate::{
17-
symbol_map::{SymbolMapInnerWrapper, SymbolMapTrait},
18-
AddressInfo, Error, FileContents, FileContentsWrapper, FileLocation, FrameDebugInfo,
19-
FramesLookupResult, SourceFilePath, SymbolInfo, SymbolMap,
15+
use crate::error::Error;
16+
use crate::shared::{
17+
AddressInfo, FileContents, FileContentsCursor, FileContentsWrapper, FileLocation,
18+
FrameDebugInfo, FramesLookupResult, SourceFilePath, SymbolInfo,
2019
};
20+
use crate::symbol_map::{SymbolMap, SymbolMapInnerWrapper, SymbolMapTrait};
2121

2222
pub fn is_jitdump_file<T: FileContents>(file_contents: &FileContentsWrapper<T>) -> bool {
2323
const MAGIC_BYTES_BE: &[u8] = b"JiTD";

samply-symbols/src/macho.rs

+15-9
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
1-
use crate::binary_image::BinaryImageInner;
2-
use crate::error::Error;
3-
use crate::shared::{FileAndPathHelper, FileContents, FileContentsWrapper, RangeReadRef};
4-
use crate::symbol_map::{
5-
GenericSymbolMap, SymbolMap, SymbolMapDataMidTrait, SymbolMapDataOuterTrait,
6-
};
7-
use crate::symbol_map_object::{FunctionAddressesComputer, ObjectSymbolMapDataMid};
8-
use crate::{debug_id_for_object, BinaryImage, FileLocation, MultiArchDisambiguator};
1+
use std::marker::PhantomData;
2+
93
use debugid::DebugId;
104
use macho_unwind_info::UnwindInfo;
115
use object::macho::{self, LinkeditDataCommand, MachHeader32, MachHeader64};
@@ -14,9 +8,21 @@ use object::read::macho::{
148
};
159
use object::read::{File, Object, ObjectSection};
1610
use object::{Endianness, FileKind, ReadRef};
17-
use std::marker::PhantomData;
1811
use uuid::Uuid;
1912

13+
use crate::binary_image::BinaryImage;
14+
use crate::binary_image::BinaryImageInner;
15+
use crate::debugid_util::debug_id_for_object;
16+
use crate::error::Error;
17+
use crate::shared::{
18+
FileAndPathHelper, FileContents, FileContentsWrapper, FileLocation, MultiArchDisambiguator,
19+
RangeReadRef,
20+
};
21+
use crate::symbol_map::{
22+
GenericSymbolMap, SymbolMap, SymbolMapDataMidTrait, SymbolMapDataOuterTrait,
23+
};
24+
use crate::symbol_map_object::{FunctionAddressesComputer, ObjectSymbolMapDataMid};
25+
2026
/// Converts a cpu type/subtype pair into the architecture name.
2127
///
2228
/// For example, this converts `CPU_TYPE_ARM64, CPU_SUBTYPE_ARM64E` to `Some("arm64e")`.

samply-symbols/src/path_mapper.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1+
use std::collections::HashMap;
2+
13
use nom::branch::alt;
24
use nom::bytes::complete::{tag, take_till1, take_until1, take_while1};
35
use nom::character::complete::one_of;
46
use nom::error::ErrorKind;
57
use nom::sequence::{delimited, preceded, terminated, tuple};
68
use nom::Err;
79

8-
use crate::MappedPath;
9-
10-
use std::collections::HashMap;
10+
use crate::mapped_path::MappedPath;
1111

1212
pub trait ExtraPathMapper {
1313
fn map_path(&mut self, path: &str) -> Option<MappedPath>;

samply-symbols/src/shared.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
use debugid::DebugId;
2-
use object::read::ReadRef;
3-
use object::FileFlags;
4-
use uuid::Uuid;
5-
6-
use crate::MappedPath;
7-
81
use std::fmt::{Debug, Display};
92
use std::future::Future;
103
use std::ops::Range;
114
use std::str::FromStr;
125
use std::{marker::PhantomData, ops::Deref};
136

7+
use debugid::DebugId;
8+
use object::read::ReadRef;
9+
use object::FileFlags;
10+
use uuid::Uuid;
11+
12+
use crate::mapped_path::MappedPath;
13+
1414
#[cfg(feature = "partial_read_stats")]
1515
use bitvec::{bitvec, prelude::BitVec};
1616
#[cfg(feature = "partial_read_stats")]

samply-symbols/src/symbol_map.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ use debugid::DebugId;
44
use yoke::Yoke;
55
use yoke_derive::Yokeable;
66

7-
use crate::{shared::AddressInfo, Error, FileLocation};
7+
use crate::error::Error;
8+
use crate::shared::{AddressInfo, FileLocation};
89

910
pub struct SymbolMap<FL: FileLocation> {
1011
debug_file_location: FL,

samply-symbols/src/symbol_map_object.rs

+8-11
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,15 @@ use object::{
66
SectionKind, SymbolKind,
77
};
88

9-
use crate::ExternalFileAddressRef;
10-
use crate::{
11-
demangle,
12-
dwarf::{get_frames, Addr2lineContextData},
13-
path_mapper::PathMapper,
14-
shared::{
15-
relative_address_base, AddressInfo, ExternalFileAddressInFileRef, ExternalFileRef,
16-
SymbolInfo,
17-
},
18-
symbol_map::{SymbolMapDataMidTrait, SymbolMapInnerWrapper, SymbolMapTrait},
19-
Error, FramesLookupResult,
9+
use crate::demangle;
10+
use crate::dwarf::{get_frames, Addr2lineContextData};
11+
use crate::error::Error;
12+
use crate::path_mapper::PathMapper;
13+
use crate::shared::{
14+
relative_address_base, AddressInfo, ExternalFileAddressInFileRef, ExternalFileAddressRef,
15+
ExternalFileRef, FramesLookupResult, SymbolInfo,
2016
};
17+
use crate::symbol_map::{SymbolMapDataMidTrait, SymbolMapInnerWrapper, SymbolMapTrait};
2118

2219
pub trait FunctionAddressesComputer<'data> {
2320
fn compute_function_addresses<'file, O>(

samply-symbols/src/windows.rs

+17-14
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,30 @@
1+
use std::borrow::Cow;
2+
use std::collections::HashMap;
3+
use std::ops::Deref;
4+
use std::sync::Mutex;
5+
6+
use debugid::DebugId;
7+
use nom::bytes::complete::{tag, take_until1};
8+
use nom::combinator::eof;
9+
use nom::sequence::terminated;
10+
use object::{File, FileKind};
11+
use pdb::PDB;
12+
use pdb_addr2line::pdb;
13+
114
use crate::debugid_util::debug_id_for_object;
15+
use crate::demangle;
216
use crate::error::{Context, Error};
17+
use crate::mapped_path::MappedPath;
318
use crate::path_mapper::{ExtraPathMapper, PathMapper};
419
use crate::shared::{
5-
AddressInfo, FileAndPathHelper, FileContents, FileContentsWrapper, FrameDebugInfo,
6-
FramesLookupResult, SymbolInfo,
20+
AddressInfo, FileAndPathHelper, FileContents, FileContentsWrapper, FileLocation,
21+
FrameDebugInfo, FramesLookupResult, SourceFilePath, SymbolInfo,
722
};
823
use crate::symbol_map::{
924
GenericSymbolMap, SymbolMap, SymbolMapDataMidTrait, SymbolMapDataOuterTrait,
1025
SymbolMapInnerWrapper, SymbolMapTrait,
1126
};
1227
use crate::symbol_map_object::{FunctionAddressesComputer, ObjectSymbolMapDataMid};
13-
use crate::{demangle, FileLocation, MappedPath, SourceFilePath};
14-
use debugid::DebugId;
15-
use nom::bytes::complete::{tag, take_until1};
16-
use nom::combinator::eof;
17-
use nom::sequence::terminated;
18-
use object::{File, FileKind};
19-
use pdb::PDB;
20-
use pdb_addr2line::pdb;
21-
use std::borrow::Cow;
22-
use std::collections::HashMap;
23-
use std::ops::Deref;
24-
use std::sync::Mutex;
2528

2629
pub async fn load_symbol_map_for_pdb_corresponding_to_binary<
2730
'h,

0 commit comments

Comments
 (0)