Skip to content
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

RUMM-1883 Report binary image with no UUID #724

Merged
merged 1 commit into from
Jan 19, 2022

Conversation

maxep
Copy link
Member

@maxep maxep commented Jan 18, 2022

What and why?

Stack frames in crash report could be reported as ??? if PLCR could not find the image or if the image's UUID is missing. To identify the root cause, we should keep reporting binary images without UUID.

How?

  • Set StackFrame.libraryName even for binary image with no UUID
  • Allow optional uuid in BinaryImageInfo

Review checklist

  • Feature or bugfix MUST have appropriate tests (unit, integration)
  • Make sure each commit and the PR mention the Issue number or JIRA reference

@maxep maxep self-assigned this Jan 18, 2022
@maxep maxep force-pushed the maxep/RUMM-1883/report-invalid-images branch from a63ce49 to d635cdf Compare January 18, 2022 13:20
@@ -150,7 +150,7 @@ internal struct DDCrashReportExporter {

return DDCrashReport.BinaryImage(
libraryName: image.imageName,
uuid: image.uuid,
uuid: image.uuid ?? unavailable,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is still relevant to report binary images with no UUID, like we do for missing architecture. Without uuid nor arch, symbolication won't be possible, but this will give more info to the crash report and help us identify missing data.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double checking - this will be possible to differentiate one ??? from another ??? by exploring the content of binary_images[], right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. We shouldn't even get ??? in stack frames for known library from PLCR as it already checks for name nullability (as long as the name is UTF8).
And we will now be able to identify binary_images with no uuid, they were filtered out before.

@maxep maxep marked this pull request as ready for review January 18, 2022 13:29
@maxep maxep requested a review from a team as a code owner January 18, 2022 13:29
Copy link
Member

@ncreated ncreated left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👌!

return nil
}

self.uuid = imageUUID
self.uuid = imageInfo.imageUUID
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's safe, but wanted to double check if this won't crash if imageUUID is nil? In PLCR it is defined as implicitly unwrapped String:

/**
 * 128-bit object UUID (matches Mach-O DWARF dSYM files). May be nil if unavailable.
 */
@property(nonatomic, readonly, strong) NSString *imageUUID;

Hence, previous code was checking imageInfo.hasImageUUID before evaluating it.

/**
 * YES if this image has an associated UUID.
 */
@property(nonatomic, readonly) BOOL hasImageUUID;

The problem with implicit unwrapping is common to many PLCR types/fields and is solved by our CrashReport (swift). This test should already cover it:

func testGivenPLCrashReportWithSomeInconsistentValues_whenInitializing_itReturnsValue() throws {

but for the sake of sanity, let's double check if it does.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without NS_ASSUME_NONNULL_* region or _Nonnull objc annotation, the property is implicitly unwrapped optional, so this won't crash as uuid is now optional. The previous check was not necessary since the guard let was already evaluating nullability.
But I can checks in test tho 👍

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's actually already covered in test :)

var mockImageUUID: String! = nil

@maxep maxep merged commit 85f9785 into master Jan 19, 2022
@maxep maxep deleted the maxep/RUMM-1883/report-invalid-images branch January 19, 2022 08:07
@ncreated ncreated mentioned this pull request Jan 20, 2022
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants