-
Notifications
You must be signed in to change notification settings - Fork 2.1k
feat(cymbal): add ios raw frame #42270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
ioannisj
wants to merge
1
commit into
master
Choose a base branch
from
feat/add-native-ios-raw-frame
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| use common_types::error_tracking::FrameId; | ||
| use serde::{Deserialize, Serialize}; | ||
| use sha2::{Digest, Sha512}; | ||
|
|
||
| use crate::{ | ||
| frames::Frame, | ||
| langs::{utils::add_raw_to_junk, CommonFrameMetadata}, | ||
| }; | ||
|
|
||
| #[derive(Debug, Clone, Deserialize, Serialize)] | ||
| pub struct RawIOSFrame { | ||
| pub instruction_addr: Option<String>, | ||
| pub symbol_addr: Option<String>, | ||
| pub image_addr: Option<String>, | ||
| pub image_uuid: Option<String>, | ||
| pub module: Option<String>, | ||
| pub function: Option<String>, | ||
| pub filename: Option<String>, | ||
| pub lineno: Option<u32>, | ||
| pub colno: Option<u32>, | ||
| #[serde(flatten)] | ||
| pub meta: CommonFrameMetadata, | ||
| } | ||
|
|
||
| impl RawIOSFrame { | ||
| pub fn frame_id(&self) -> String { | ||
| let mut hasher = Sha512::new(); | ||
|
|
||
| if let Some(instruction_addr) = &self.instruction_addr { | ||
| hasher.update(instruction_addr.as_bytes()); | ||
| } | ||
|
|
||
| if let Some(module) = &self.module { | ||
| hasher.update(module.as_bytes()); | ||
| } | ||
|
|
||
| if let Some(function) = &self.function { | ||
| hasher.update(function.as_bytes()); | ||
| } | ||
|
|
||
| if let Some(image_uuid) = &self.image_uuid { | ||
| hasher.update(image_uuid.as_bytes()); | ||
| } | ||
|
|
||
| format!("{:x}", hasher.finalize()) | ||
| } | ||
|
|
||
| } | ||
|
|
||
| impl From<&RawIOSFrame> for Frame { | ||
| fn from(raw: &RawIOSFrame) -> Self { | ||
| let mut f = Frame { | ||
| frame_id: FrameId::placeholder(), | ||
| mangled_name: raw.function.clone().unwrap_or_default(), | ||
| line: raw.lineno, | ||
| column: raw.colno, | ||
| source: raw.filename.clone(), | ||
| in_app: raw.meta.in_app, | ||
| resolved_name: raw.function.clone(), | ||
| lang: "ios".to_string(), | ||
| resolved: raw.function.is_some(), | ||
| resolve_failure: None, | ||
| junk_drawer: None, | ||
| release: None, | ||
| synthetic: raw.meta.synthetic, | ||
| context: None, | ||
| suspicious: false, | ||
| module: raw.module.clone(), | ||
| exception_type: None, | ||
| code_variables: None, | ||
| }; | ||
|
|
||
| // Store raw frame data in junk drawer for debugging/analysis | ||
| add_raw_to_junk(&mut f, raw); | ||
| f | ||
| } | ||
| } | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we be using the language here not the platform? Are these Swift or Objective C frames or something else? I can see a world where it's confusing for "iOS frames" to process MacOS exceptions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah expressed the same concern in PR body. To my best understanding frames will be identical (and handled similarly) regardless of swift/objc and platform. Not sure I can distinguish runtime in a deterministic way if a specific frame is objc/swift
Some other alternatives can be
apple,apple-native?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also have
javawhich also handles Kotlin and other jvm languages if I'm not mistaken? @marandaneto thoughts on this?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kotlin compiles to java bytecode so its the same thing.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'd rather call it apple.
i think
langhere is a confusing name since you only think about the language and its properties.it should have been something more connected to the symbolication type.
eg
for code highlighting:
lang=kotlin | java | etc
for symbolication:
symbol_type (or platform)=elf (linux) | proguard | r8 (android/java/kotlin) | sourcemaps (web) | Mach-O (apple) | etc
right now we are using
langas a way to trigger a certain symbolication process, in my example,symbol_type.on the SDK side we use
platformwhich can behermesand then it symbolicates to javascript, see the confusion.