Skip to content

Commit

Permalink
chore: Remove remaining fishhook code (#3020)
Browse files Browse the repository at this point in the history
Removed the remaining async stitch code
  • Loading branch information
brustolin committed May 11, 2023
1 parent 1bf8571 commit 0dfdaaa
Show file tree
Hide file tree
Showing 24 changed files with 7 additions and 861 deletions.
15 changes: 4 additions & 11 deletions Samples/iOS-ObjectiveC/iOS-ObjectiveC/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="20037" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="21701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="20020"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21678"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
Expand All @@ -18,13 +18,13 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Sentry Test App (Objective-C)" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Si0-bZ-rNR">
<rect key="frame" x="92" y="88" width="230" height="20.5"/>
<rect key="frame" x="92" y="92" width="230" height="20.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="AVC-4r-eVc">
<rect key="frame" x="8" y="116.5" width="398" height="270"/>
<rect key="frame" x="8" y="120.5" width="398" height="240"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="rUC-at-hwU">
<rect key="frame" x="0.0" y="0.0" width="398" height="30"/>
Expand Down Expand Up @@ -84,13 +84,6 @@
<action selector="oomCrash:" destination="BYZ-38-t0r" eventType="touchUpInside" id="6Eb-uS-ljp"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Lr8-6E-lN6">
<rect key="frame" x="0.0" y="240" width="398" height="30"/>
<state key="normal" title="async crash"/>
<connections>
<action selector="asyncCrash:" destination="BYZ-38-t0r" eventType="touchUpInside" id="c9v-X0-ZOl"/>
</connections>
</button>
</subviews>
</stackView>
</subviews>
Expand Down
15 changes: 0 additions & 15 deletions Samples/iOS-ObjectiveC/iOS-ObjectiveC/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -124,21 +124,6 @@ - (IBAction)crash:(id)sender
[SentrySDK crash];
}

- (IBAction)asyncCrash:(id)sender
{
dispatch_async(dispatch_get_main_queue(), ^{ [self asyncCrash1]; });
}

- (void)asyncCrash1
{
dispatch_async(dispatch_get_main_queue(), ^{ [self asyncCrash2]; });
}

- (void)asyncCrash2
{
dispatch_async(dispatch_get_main_queue(), ^{ [SentrySDK crash]; });
}

- (IBAction)oomCrash:(id)sender
{
dispatch_async(dispatch_get_main_queue(), ^{
Expand Down
10 changes: 1 addition & 9 deletions Samples/iOS-Swift/iOS-Swift/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -364,21 +364,13 @@
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="s6w-E3-5yE" userLabel="DiskWriteException">
<rect key="frame" x="0.0" y="28" width="135" height="28"/>
<rect key="frame" x="0.0" y="42" width="135" height="28"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<state key="normal" title="DiskWriteException"/>
<connections>
<action selector="diskWriteException:" destination="QmU-DD-itF" eventType="touchUpInside" id="p74-qC-kH7"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="cki-iy-1lL">
<rect key="frame" x="0.0" y="56" width="135" height="28"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<state key="normal" title="async crash"/>
<connections>
<action selector="asyncCrash:" destination="QmU-DD-itF" eventType="touchUpInside" id="L4F-Xr-S2F"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="NNd-Ec-zXw">
<rect key="frame" x="0.0" y="84" width="135" height="28"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
Expand Down
19 changes: 0 additions & 19 deletions Samples/iOS-Swift/iOS-Swift/ErrorsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,6 @@ class ErrorsViewController: UIViewController {
}
// swiftlint:enable force_unwrapping

@IBAction func asyncCrash(_ sender: UIButton) {
highlightButton(sender)
DispatchQueue.main.async {
self.asyncCrash1()
}
}

@IBAction func captureError(_ sender: UIButton) {
highlightButton(sender)
do {
Expand Down Expand Up @@ -68,18 +61,6 @@ class ErrorsViewController: UIViewController {
fatalError("This is a fatal error. Oh no 😬.")
}

func asyncCrash1() {
DispatchQueue.main.async {
self.asyncCrash2()
}
}

func asyncCrash2() {
DispatchQueue.main.async {
SentrySDK.crash()
}
}

@IBAction func oomCrash(_ sender: UIButton) {
highlightButton(sender)
DispatchQueue.main.async {
Expand Down
16 changes: 0 additions & 16 deletions Sentry.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -714,10 +714,6 @@
9286059729A5098900F96038 /* SentryGeo.m in Sources */ = {isa = PBXBuildFile; fileRef = 9286059629A5098900F96038 /* SentryGeo.m */; };
9286059929A50BAB00F96038 /* SentryGeoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9286059829A50BAA00F96038 /* SentryGeoTests.swift */; };
92F6726B29C8B7B100BFD34D /* SentryUser+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 92F6726A29C8B7B000BFD34D /* SentryUser+Private.h */; };
A2475E1325FB63A3007D9080 /* fishhook.h in Headers */ = {isa = PBXBuildFile; fileRef = A2475E1225FB63A3007D9080 /* fishhook.h */; };
A2475E1725FB63AF007D9080 /* SentryHook.h in Headers */ = {isa = PBXBuildFile; fileRef = A2475E1625FB63AF007D9080 /* SentryHook.h */; };
A2475E1B25FB63D7007D9080 /* SentryHook.c in Sources */ = {isa = PBXBuildFile; fileRef = A2475E1A25FB63D7007D9080 /* SentryHook.c */; };
A2475E1F25FB648B007D9080 /* fishhook.c in Sources */ = {isa = PBXBuildFile; fileRef = A2475E1E25FB648B007D9080 /* fishhook.c */; };
A811D867248E2770008A41EA /* SentrySystemEventBreadcrumbsTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = A811D866248E2770008A41EA /* SentrySystemEventBreadcrumbsTest.swift */; };
A839D89824864B80003B7AFD /* SentrySystemEventBreadcrumbs.h in Headers */ = {isa = PBXBuildFile; fileRef = A839D89724864B80003B7AFD /* SentrySystemEventBreadcrumbs.h */; };
A839D89A24864BA8003B7AFD /* SentrySystemEventBreadcrumbs.m in Sources */ = {isa = PBXBuildFile; fileRef = A839D89924864BA8003B7AFD /* SentrySystemEventBreadcrumbs.m */; };
Expand Down Expand Up @@ -1639,10 +1635,6 @@
9286059629A5098900F96038 /* SentryGeo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SentryGeo.m; sourceTree = "<group>"; };
9286059829A50BAA00F96038 /* SentryGeoTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SentryGeoTests.swift; sourceTree = "<group>"; };
92F6726A29C8B7B000BFD34D /* SentryUser+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "SentryUser+Private.h"; path = "include/HybridPublic/SentryUser+Private.h"; sourceTree = "<group>"; };
A2475E1225FB63A3007D9080 /* fishhook.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fishhook.h; sourceTree = "<group>"; };
A2475E1625FB63AF007D9080 /* SentryHook.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SentryHook.h; sourceTree = "<group>"; };
A2475E1A25FB63D7007D9080 /* SentryHook.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SentryHook.c; sourceTree = "<group>"; };
A2475E1E25FB648B007D9080 /* fishhook.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fishhook.c; sourceTree = "<group>"; };
A811D866248E2770008A41EA /* SentrySystemEventBreadcrumbsTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentrySystemEventBreadcrumbsTest.swift; sourceTree = "<group>"; };
A839D89724864B80003B7AFD /* SentrySystemEventBreadcrumbs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentrySystemEventBreadcrumbs.h; path = include/SentrySystemEventBreadcrumbs.h; sourceTree = "<group>"; };
A839D89924864BA8003B7AFD /* SentrySystemEventBreadcrumbs.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentrySystemEventBreadcrumbs.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2397,8 +2389,6 @@
63FE700520DA4C1000CDBAE8 /* Tools */ = {
isa = PBXGroup;
children = (
A2475E1E25FB648B007D9080 /* fishhook.c */,
A2475E1225FB63A3007D9080 /* fishhook.h */,
63FE702E20DA4C1000CDBAE8 /* NSError+SentrySimpleConstructor.h */,
63FE700E20DA4C1000CDBAE8 /* NSError+SentrySimpleConstructor.m */,
63FE703E20DA4C1000CDBAE8 /* SentryCrashCPU_Apple.h */,
Expand Down Expand Up @@ -2454,8 +2444,6 @@
63FE703220DA4C1000CDBAE8 /* SentryCrashThread.h */,
7B883F48253D714C00879E62 /* SentryCrashUUIDConversion.c */,
71F11CDEF5952DF5CC69AC74 /* SentryCrashUUIDConversion.h */,
A2475E1A25FB63D7007D9080 /* SentryHook.c */,
A2475E1625FB63AF007D9080 /* SentryHook.h */,
7B31C290277B04A000337126 /* SentryCrashPlatformSpecificDefines.h */,
);
path = Tools;
Expand Down Expand Up @@ -3526,7 +3514,6 @@
63FE70EB20DA4C1000CDBAE8 /* SentryCrashMonitor_MachException.h in Headers */,
7BC8522F24581096005A70F0 /* SentryFileContents.h in Headers */,
7B30B67C26527886006B2752 /* SentryDisplayLinkWrapper.h in Headers */,
A2475E1325FB63A3007D9080 /* fishhook.h in Headers */,
7BD86ECF264A7C77005439DB /* SentryAppStartMeasurement.h in Headers */,
7DC8310A2398283C0043DD9A /* SentryCrashIntegration.h in Headers */,
63FE718320DA4C1100CDBAE8 /* SentryCrashReportFixer.h in Headers */,
Expand Down Expand Up @@ -3630,7 +3617,6 @@
6344DDB91EC3115C00D9160D /* SentryCrashReportConverter.h in Headers */,
0A2D8D9828997887008720F6 /* NSLocale+Sentry.h in Headers */,
71F116E8F40D530BB68A2987 /* SentryCrashUUIDConversion.h in Headers */,
A2475E1725FB63AF007D9080 /* SentryHook.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -3888,7 +3874,6 @@
7B7A599726B692F00060A676 /* SentryScreenFrames.m in Sources */,
7B3398652459C15200BD9C96 /* SentryEnvelopeRateLimit.m in Sources */,
0A2D8D9628997845008720F6 /* NSLocale+Sentry.m in Sources */,
A2475E1F25FB648B007D9080 /* fishhook.c in Sources */,
7B0DC730288698F70039995F /* NSMutableDictionary+Sentry.m in Sources */,
7BD4BD4527EB29F50071F4FF /* SentryClientReport.m in Sources */,
631E6D341EBC679C00712345 /* SentryQueueableRequestManager.m in Sources */,
Expand Down Expand Up @@ -3977,7 +3962,6 @@
63FE716720DA4C1100CDBAE8 /* SentryCrashCPU.c in Sources */,
63FE717320DA4C1100CDBAE8 /* SentryCrashC.c in Sources */,
63FE712120DA4C1000CDBAE8 /* SentryCrashSymbolicator.c in Sources */,
A2475E1B25FB63D7007D9080 /* SentryHook.c in Sources */,
63FE70D720DA4C1000CDBAE8 /* SentryCrashMonitor_MachException.c in Sources */,
7B96572226830D2400C66E25 /* SentryScopeSyncC.c in Sources */,
0A9BF4E228A114940068D266 /* SentryViewHierarchyIntegration.m in Sources */,
Expand Down
15 changes: 0 additions & 15 deletions Sources/Sentry/SentryCrashWrapper.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#import "SentryCrash.h"
#import "SentryCrashMonitor_AppState.h"
#import "SentryCrashMonitor_System.h"
#import "SentryHook.h"
#import <Foundation/Foundation.h>
#import <SentryCrashCachedData.h>
#import <SentryCrashDebug.h>
Expand Down Expand Up @@ -51,20 +50,6 @@ - (BOOL)isApplicationInForeground
return sentrycrashstate_currentState()->applicationIsInForeground;
}

- (void)installAsyncHooks
{
NSAssert(false,
@"`installAsyncHooks` should not be called, as its behavior is unpredictable and sometimes "
@"resulted in unexpected errors.");
sentrycrash_install_async_hooks();
}

- (void)uninstallAsyncHooks
{
NSAssert(false, @"`uninstallAsyncHooks` should not be called");
sentrycrash_deactivate_async_hooks();
}

- (NSDictionary *)systemInfo
{
static NSDictionary *sharedInfo = nil;
Expand Down
1 change: 0 additions & 1 deletion Sources/Sentry/SentryStacktraceBuilder.m
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ - (SentryStacktrace *)retrieveStacktraceFromCursor:(SentryCrashStackCursor)stack
[frames addObject:frame];
}
}
sentrycrash_async_backtrace_decref(stackCursor.async_caller);

NSArray<SentryFrame *> *framesCleared = [SentryFrameRemover removeNonSdkFrames:frames];

Expand Down
1 change: 0 additions & 1 deletion Sources/Sentry/SentryThreadInspector.m
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
entries++;
}
}
sentrycrash_async_backtrace_decref(stackCursor.async_caller);

return entries;
}
Expand Down
4 changes: 0 additions & 4 deletions Sources/Sentry/include/SentryCrashWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ SENTRY_NO_INIT

- (BOOL)isApplicationInForeground;

- (void)installAsyncHooks;

- (void)uninstallAsyncHooks;

- (NSDictionary *)systemInfo;

- (bytes)freeMemorySize;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ void
__cxa_throw(void *thrown_exception, std::type_info *tinfo, void (*dest)(void *))
{
if (g_captureNextStackTrace) {
sentrycrash_async_backtrace_decref(g_stackCursor.async_caller);
sentrycrashsc_initSelfThread(&g_stackCursor, 1);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,6 @@ handleExceptions(void *const userData)
SentryCrashLOG_DEBUG("Crash handling complete. Restoring original handlers.");
g_isHandlingCrash = false;
sentrycrashmc_resumeEnvironment(threads, numThreads);
sentrycrash_async_backtrace_decref(g_stackCursor.async_caller);
}

SentryCrashLOG_DEBUG("Replying to mach exception message.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@
SentryCrashLOG_DEBUG(@"Calling original exception handler.");
g_previousUncaughtExceptionHandler(exception);
}
sentrycrash_async_backtrace_decref(cursor.async_caller);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ handleSignal(int sigNum, siginfo_t *signalInfo, void *userContext)

sentrycrashcm_handleException(crashContext);
sentrycrashmc_resumeEnvironment(threads, numThreads);
sentrycrash_async_backtrace_decref(g_stackCursor.async_caller);
}

SentryCrashLOG_DEBUG("Re-raising signal for regular handlers to catch.");
Expand Down
3 changes: 0 additions & 3 deletions Sources/SentryCrash/Recording/SentryCrashReport.c
Original file line number Diff line number Diff line change
Expand Up @@ -1079,7 +1079,6 @@ writeThread(const SentryCrashReportWriter *const writer, const char *const key,
"Writing thread %x (index %d). is crashed: %d", thread, threadIndex, isCrashedThread);

SentryCrashStackCursor stackCursor;
stackCursor.async_caller = NULL;

bool hasBacktrace = getStackCursor(crash, machineContext, &stackCursor);

Expand Down Expand Up @@ -1112,8 +1111,6 @@ writeThread(const SentryCrashReportWriter *const writer, const char *const key,
}
}
writer->endContainer(writer);

sentrycrash_async_backtrace_decref(stackCursor.async_caller);
}

/** Write information about all threads to the report.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ isStackOverflow(const SentryCrashMachineContext *const context)
&stackCursor, SentryCrashSC_STACK_OVERFLOW_THRESHOLD, context);
while (stackCursor.advanceCursor(&stackCursor)) { }
bool rv = stackCursor.state.hasGivenUp;
sentrycrash_async_backtrace_decref(stackCursor.async_caller);
return rv;
}

Expand Down
34 changes: 0 additions & 34 deletions Sources/SentryCrash/Recording/Tools/SentryCrashStackCursor.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ sentrycrashsc_resetCursor(SentryCrashStackCursor *cursor)
{
cursor->state.currentDepth = 0;
cursor->state.hasGivenUp = false;
cursor->state.current_async_caller = NULL;
cursor->stackEntry.address = 0;
cursor->stackEntry.imageAddress = 0;
cursor->stackEntry.imageName = NULL;
Expand All @@ -59,39 +58,6 @@ sentrycrashsc_initCursor(SentryCrashStackCursor *cursor,
{
cursor->symbolicate = sentrycrashsymbolicator_symbolicate;
cursor->advanceCursor = advanceCursor != NULL ? advanceCursor : g_advanceCursor;
cursor->async_caller = NULL;
cursor->resetCursor = resetCursor != NULL ? resetCursor : sentrycrashsc_resetCursor;
cursor->resetCursor(cursor);
}

bool
sentrycrashsc_tryAsyncChain(
SentryCrashStackCursor *cursor, sentrycrash_async_backtrace_t *async_caller)
{
if (!async_caller) {
return false;
}
cursor->state.current_async_caller = async_caller;
cursor->state.currentDepth = 0;

cursor->stackEntry.address = SentryCrashSC_ASYNC_MARKER;
return true;
}

bool
sentrycrashsc_advanceAsyncCursor(SentryCrashStackCursor *cursor)
{
sentrycrash_async_backtrace_t *async_caller = cursor->state.current_async_caller;
if (!async_caller) {
return false;
}
if (cursor->state.currentDepth < async_caller->len) {
uintptr_t nextAddress = (uintptr_t)async_caller->backtrace[cursor->state.currentDepth];
if (nextAddress > 1) {
cursor->stackEntry.address = sentrycrashcpu_normaliseInstructionPointer(nextAddress);
cursor->state.currentDepth++;
return true;
}
}
return sentrycrashsc_tryAsyncChain(cursor, async_caller->async_caller);
}

0 comments on commit 0dfdaaa

Please sign in to comment.