Skip to content

Commit

Permalink
Split most of native symbolication into its own crate (#1324)
Browse files Browse the repository at this point in the history
  • Loading branch information
Swatinem authored Oct 17, 2023
1 parent 75db4ae commit 32f71a5
Show file tree
Hide file tree
Showing 89 changed files with 1,565 additions and 1,485 deletions.
42 changes: 33 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions crates/symbolicator-js/src/api_lookup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ use std::time::Duration;
use sentry::types::DebugId;
use sentry::SentryFutureExt;
use serde::Deserialize;
use symbolicator_service::download::retry;
use symbolicator_service::download::sentry::{SearchQuery, SentryDownloader};
use symbolicator_service::metric;
use symbolicator_service::services::download::retry;
use symbolicator_service::services::download::sentry::{SearchQuery, SentryDownloader};
use url::Url;

use symbolicator_service::caching::{CacheEntry, CacheError};
Expand Down
5 changes: 2 additions & 3 deletions crates/symbolicator-js/src/bundle_index_cache.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
use std::sync::Arc;

use symbolic::common::ByteView;
use symbolicator_service::caches::versions::BUNDLE_INDEX_CACHE_VERSIONS;
use symbolicator_service::caching::{
Cache, CacheEntry, CacheItemRequest, CacheKey, CacheVersions, Cacher, SharedCacheRef,
};
use symbolicator_service::services::caches::versions::BUNDLE_INDEX_CACHE_VERSIONS;
use symbolicator_service::services::download::DownloadService;
use symbolicator_service::services::fetch_file;
use symbolicator_service::download::{fetch_file, DownloadService};
use symbolicator_service::types::Scope;
use symbolicator_sources::RemoteFile;

Expand Down
3 changes: 1 addition & 2 deletions crates/symbolicator-js/src/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ use reqwest::Url;
use serde::{Deserialize, Serialize};

use symbolicator_service::caching::CacheError;
use symbolicator_service::services::ScrapingConfig;
use symbolicator_service::types::{RawObjectInfo, Scope};
use symbolicator_service::types::{RawObjectInfo, Scope, ScrapingConfig};
use symbolicator_sources::{SentryFileId, SentrySourceConfig};

#[derive(Debug, Clone)]
Expand Down
11 changes: 5 additions & 6 deletions crates/symbolicator-js/src/lookup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,14 @@ use symbolicator_sources::{
};
use tempfile::NamedTempFile;

use symbolicator_service::caches::versions::SOURCEMAP_CACHE_VERSIONS;
use symbolicator_service::caches::{ByteViewString, SourceFilesCache};
use symbolicator_service::caching::{
CacheEntry, CacheError, CacheItemRequest, CacheKey, CacheKeyBuilder, CacheVersions, Cacher,
};
use symbolicator_service::services::caches::versions::SOURCEMAP_CACHE_VERSIONS;
use symbolicator_service::services::caches::{ByteViewString, SourceFilesCache};
use symbolicator_service::services::download::DownloadService;
use symbolicator_service::services::objects::{ObjectHandle, ObjectMetaHandle, ObjectsActor};
use symbolicator_service::services::symbolication::ScrapingConfig;
use symbolicator_service::types::Scope;
use symbolicator_service::download::DownloadService;
use symbolicator_service::objects::{ObjectHandle, ObjectMetaHandle, ObjectsActor};
use symbolicator_service::types::{Scope, ScrapingConfig};
use symbolicator_service::utils::http::is_valid_origin;

use crate::api_lookup::{ArtifactHeaders, JsLookupResult, SentryLookupApi};
Expand Down
6 changes: 3 additions & 3 deletions crates/symbolicator-js/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
use std::sync::Arc;

use symbolicator_service::caches::SourceFilesCache;
use symbolicator_service::caching::Cacher;
use symbolicator_service::services::caches::SourceFilesCache;
use symbolicator_service::services::download::DownloadService;
use symbolicator_service::services::objects::ObjectsActor;
use symbolicator_service::download::DownloadService;
use symbolicator_service::objects::ObjectsActor;
use symbolicator_service::services::SharedServices;

use crate::api_lookup::SentryLookupApi;
Expand Down
2 changes: 1 addition & 1 deletion crates/symbolicator-js/src/symbolication.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::collections::BTreeSet;
use symbolic::sourcemapcache::{ScopeLookupResult, SourcePosition};
use symbolicator_service::caching::CacheError;
use symbolicator_service::metric;
use symbolicator_service::services::symbolication::source_context::get_context_lines;
use symbolicator_service::source_context::get_context_lines;

use crate::interface::{
CompletedJsSymbolicationResponse, JsFrame, JsModuleError, JsModuleErrorKind, JsStacktrace,
Expand Down
3 changes: 1 addition & 2 deletions crates/symbolicator-js/tests/integration/sourcemap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ use std::sync::Arc;
use reqwest::Url;
use serde_json::json;
use symbolicator_js::interface::{JsFrame, JsStacktrace, SymbolicateJsStacktraces};
use symbolicator_service::services::ScrapingConfig;
use symbolicator_service::types::{RawObjectInfo, Scope};
use symbolicator_service::types::{RawObjectInfo, Scope, ScrapingConfig};
use symbolicator_sources::{SentrySourceConfig, SourceId};

use crate::{assert_snapshot, setup_service};
Expand Down
36 changes: 36 additions & 0 deletions crates/symbolicator-native/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[package]
name = "symbolicator-native"
publish = false
version = "23.10.0"
authors = ["Sentry <[email protected]>"]
edition = "2021"
license = "MIT"

[dependencies]
anyhow = "1.0.57"
apple-crash-report-parser = "0.5.1"
async-trait = "0.1.53"
chrono = { version = "0.4.19", features = ["serde"] }
futures = "0.3.12"
lazy_static = "1.4.0"
minidump = "0.18.0"
minidump-processor = "0.18.0"
minidump-unwind = "0.18.0"
moka = { version = "0.12.1", features = ["future", "sync"] }
regex = "1.5.5"
sentry = { version = "0.31.7", features = ["tracing"] }
serde = { version = "1.0.137", features = ["derive", "rc"] }
symbolic = { version = "12.4.0", features = ["cfi", "common-serde", "debuginfo", "demangle", "symcache", "il2cpp", "ppdb"] }
symbolicator-service = { path = "../symbolicator-service" }
symbolicator-sources = { path = "../symbolicator-sources" }
tempfile = "3.2.0"
thiserror = "1.0.31"
tracing = "0.1.34"
url = { version = "2.2.0", features = ["serde"] }

[dev-dependencies]
insta = { version = "1.18.0", features = ["redactions", "yaml"] }
serde_json = "1.0.81"
symbolicator-test = { path = "../symbolicator-test" }
test-assembler = "0.1.5"
tokio = { version = "1.24.2", features = ["rt", "macros", "fs"] }
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,16 @@ use sentry::{Hub, SentryFutureExt};

use symbolic::common::{ByteView, DebugId};
use symbolic::debuginfo::macho::{BcSymbolMap, UuidMapping};
use symbolicator_sources::{FileType, RemoteFile, SourceConfig};
use tempfile::NamedTempFile;

use crate::caching::{
use symbolicator_service::caches::versions::BITCODE_CACHE_VERSIONS;
use symbolicator_service::caching::{
Cache, CacheEntry, CacheError, CacheItemRequest, CacheKey, CacheVersions, Cacher,
SharedCacheRef,
};
use crate::services::download::DownloadService;
use crate::types::Scope;

use super::caches::versions::BITCODE_CACHE_VERSIONS;
use super::fetch_file;
use symbolicator_service::download::{fetch_file, DownloadService};
use symbolicator_service::metric;
use symbolicator_service::types::Scope;
use symbolicator_sources::{FileType, RemoteFile, SourceConfig};
use tempfile::NamedTempFile;

/// Handle to a valid BCSymbolMap.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,17 @@ use tempfile::NamedTempFile;
use symbolic::cfi::CfiCache;
use symbolic::common::ByteView;
use symbolic::debuginfo::breakpad::BreakpadModuleRecord;
use symbolicator_sources::{FileType, ObjectId, ObjectType, SourceConfig};

use crate::caching::{
use symbolicator_service::caches::versions::CFICACHE_VERSIONS;
use symbolicator_service::caching::{
Cache, CacheEntry, CacheError, CacheItemRequest, CacheVersions, Cacher, SharedCacheRef,
};
use crate::services::objects::{
FindObject, ObjectHandle, ObjectMetaHandle, ObjectPurpose, ObjectsActor,
use symbolicator_service::objects::{
CandidateStatus, FindObject, ObjectHandle, ObjectMetaHandle, ObjectPurpose, ObjectsActor,
};
use crate::types::{CandidateStatus, Scope};
use crate::utils::sentry::ConfigureScope;
use symbolicator_service::types::Scope;
use symbolicator_service::utils::sentry::ConfigureScope;
use symbolicator_sources::{FileType, ObjectId, ObjectType, SourceConfig};

use super::caches::versions::CFICACHE_VERSIONS;
use super::derived::{derive_from_object_handle, DerivedCache};

type CfiItem = Option<Arc<(SymbolFile, Option<CfiModuleInfo>)>>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
use std::sync::Arc;

use crate::caching::{CacheEntry, CacheError};
use crate::services::objects::{FindResult, ObjectMetaHandle};
use crate::types::{AllObjectCandidates, CandidateStatus, ObjectFeatures, ObjectUseInfo};
use symbolicator_service::caching::{CacheEntry, CacheError};
use symbolicator_service::objects::{
AllObjectCandidates, CandidateStatus, FindResult, ObjectFeatures, ObjectMetaHandle,
ObjectUseInfo,
};

/// This is the result of fetching a derived cache file.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,16 @@ use sentry::{Hub, SentryFutureExt};

use symbolic::common::{ByteView, DebugId};
use symbolic::il2cpp::LineMapping;
use symbolicator_sources::{FileType, ObjectId, RemoteFile, SourceConfig};
use tempfile::NamedTempFile;

use crate::caching::{
use symbolicator_service::caches::versions::IL2CPP_CACHE_VERSIONS;
use symbolicator_service::caching::{
Cache, CacheEntry, CacheError, CacheItemRequest, CacheKey, CacheVersions, Cacher,
SharedCacheRef,
};
use crate::services::download::DownloadService;
use crate::types::Scope;

use super::caches::versions::IL2CPP_CACHE_VERSIONS;
use super::fetch_file;
use symbolicator_service::download::{fetch_file, DownloadService};
use symbolicator_service::metric;
use symbolicator_service::types::Scope;
use symbolicator_sources::{FileType, ObjectId, RemoteFile, SourceConfig};
use tempfile::NamedTempFile;

/// Handle to a valid [`LineMapping`].
///
Expand Down
6 changes: 6 additions & 0 deletions crates/symbolicator-native/src/caches/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pub mod bitcode;
pub mod cficaches;
pub mod derived;
pub mod il2cpp;
pub mod ppdb_caches;
pub mod symcaches;
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,18 @@ use tempfile::NamedTempFile;
use symbolic::common::{ByteView, SelfCell};
use symbolic::debuginfo::Object;
use symbolic::ppdb::{PortablePdbCache, PortablePdbCacheConverter};
use symbolicator_sources::{FileType, ObjectId, SourceConfig};

use crate::caching::{
use symbolicator_service::caches::versions::PPDB_CACHE_VERSIONS;
use symbolicator_service::caching::{
Cache, CacheEntry, CacheError, CacheItemRequest, CacheVersions, Cacher, SharedCacheRef,
};
use crate::types::{CandidateStatus, Scope};
use crate::utils::sentry::ConfigureScope;
use symbolicator_service::objects::{
CandidateStatus, FindObject, ObjectHandle, ObjectMetaHandle, ObjectPurpose, ObjectsActor,
};
use symbolicator_service::types::Scope;
use symbolicator_service::utils::sentry::ConfigureScope;
use symbolicator_sources::{FileType, ObjectId, SourceConfig};

use super::caches::versions::PPDB_CACHE_VERSIONS;
use super::derived::{derive_from_object_handle, DerivedCache};
use super::objects::{FindObject, ObjectHandle, ObjectMetaHandle, ObjectPurpose, ObjectsActor};

pub type OwnedPortablePdbCache = SelfCell<ByteView<'static>, PortablePdbCache<'static>>;

Expand Down
Loading

0 comments on commit 32f71a5

Please sign in to comment.